2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Don't declare any PCRE objects static.

This commit is contained in:
Jay Berkenbilt 2011-12-28 14:30:16 -05:00
parent 22f5b01f54
commit 11314a9551
4 changed files with 21 additions and 10 deletions

View File

@ -1,3 +1,14 @@
2011-12-28 Jay Berkenbilt <ejb@ql.org>
* Since PCRE is not necessarily thread safe, don't declare any
PCRE objects to be static.
* Disregard stderr output from ghostscript when using it to
compare images in the test suite; see comments in qpdf.test for
details.
* Fixed a few documentation errors.
2011-08-11 Jay Berkenbilt <ejb@ql.org>
* 2.3.0: release

View File

@ -364,8 +364,8 @@ QPDF::getWarnings()
void
QPDF::parse(char const* password)
{
static PCRE header_re("^%PDF-(1.\\d+)\\b");
static PCRE eof_re("(?s:startxref\\s+(\\d+)\\s+%%EOF\\b)");
PCRE header_re("^%PDF-(1.\\d+)\\b");
PCRE eof_re("(?s:startxref\\s+(\\d+)\\s+%%EOF\\b)");
if (password)
{
@ -475,9 +475,9 @@ QPDF::setTrailer(QPDFObjectHandle obj)
void
QPDF::reconstruct_xref(QPDFExc& e)
{
static PCRE obj_re("^\\s*(\\d+)\\s+(\\d+)\\s+obj\\b");
static PCRE endobj_re("^\\s*endobj\\b");
static PCRE trailer_re("^\\s*trailer\\b");
PCRE obj_re("^\\s*(\\d+)\\s+(\\d+)\\s+obj\\b");
PCRE endobj_re("^\\s*endobj\\b");
PCRE trailer_re("^\\s*trailer\\b");
warn(QPDFExc(qpdf_e_damaged_pdf, this->file->getName(), "", 0,
"file is damaged"));
@ -615,8 +615,8 @@ QPDF::read_xref(off_t xref_offset)
int
QPDF::read_xrefTable(off_t xref_offset)
{
static PCRE xref_first_re("^\\s*(\\d+)\\s+(\\d+)");
static PCRE xref_entry_re("(?s:(^\\d{10}) (\\d{5}) ([fn])[ \r\n]{2}$)");
PCRE xref_first_re("^\\s*(\\d+)\\s+(\\d+)");
PCRE xref_entry_re("(?s:(^\\d{10}) (\\d{5}) ([fn])[ \r\n]{2}$)");
std::vector<ObjGen> deleted_items;
@ -1461,7 +1461,7 @@ int
QPDF::recoverStreamLength(PointerHolder<InputSource> input,
int objid, int generation, off_t stream_offset)
{
static PCRE endobj_re("^\\s*endobj\\b");
PCRE endobj_re("^\\s*endobj\\b");
// Try to reconstruct stream length by looking for
// endstream(\r\n?|\n)endobj

View File

@ -47,7 +47,7 @@ QPDFTokenizer::reset()
void
QPDFTokenizer::presentCharacter(char ch)
{
static PCRE num_re("^[\\+\\-]?(?:\\.\\d+|\\d+(?:\\.\\d+)?)$");
PCRE num_re("^[\\+\\-]?(?:\\.\\d+|\\d+(?:\\.\\d+)?)$");
if (state == st_token_ready)
{

View File

@ -92,7 +92,7 @@ QPDF::isLinearized()
memset(buf, '\0', tbuf_size);
this->file->read(buf, tbuf_size - 1);
static PCRE lindict_re("(?s:(\\d+)\\s+0\\s+obj\\s*<<)");
PCRE lindict_re("(?s:(\\d+)\\s+0\\s+obj\\s*<<)");
int lindict_obj = -1;
char* p = buf;