diff options
Diffstat (limited to 'libqpdf')
-rw-r--r-- | libqpdf/QPDF.cc | 6 | ||||
-rw-r--r-- | libqpdf/QPDF_linearization.cc | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index d176e516..35d9b400 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -782,7 +782,7 @@ QPDF::read_xrefStream(off_t xref_offset) try { xref_obj = readObjectAtOffset( - false, xref_offset, "xref stream", 0, 0, xobj, xgen); + false, xref_offset, "xref stream", -1, 0, xobj, xgen); } catch (QPDFExc& e) { @@ -1580,7 +1580,7 @@ QPDF::readObjectAtOffset(bool try_recovery, objid = atoi(tobjid.getValue().c_str()); generation = atoi(tgen.getValue().c_str()); - if (exp_objid && + if ((exp_objid >= 0) && (! ((objid == exp_objid) && (generation == exp_generation)))) { QTC::TC("qpdf", "QPDF err wrong objid/generation"); @@ -1593,7 +1593,7 @@ QPDF::readObjectAtOffset(bool try_recovery, } catch (QPDFExc& e) { - if (exp_objid && try_recovery && this->attempt_recovery) + if ((exp_objid >= 0) && try_recovery && this->attempt_recovery) { // Try again after reconstructing xref table reconstruct_xref(e); diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index ca3fdbae..4152a6da 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -95,9 +95,9 @@ QPDF::isLinearized() static PCRE lindict_re("(?s:(\\d+)\\s+0\\s+obj\\s*<<)"); off_t offset = -1; - int lindict_obj = 0; + int lindict_obj = -1; char* p = buf; - while (lindict_obj == 0) + while (lindict_obj == -1) { PCRE::Match m(lindict_re.match(p)); if (m) @@ -312,7 +312,7 @@ QPDF::readHintStream(Pipeline& pl, off_t offset, size_t length) int obj; int gen; QPDFObjectHandle H = readObjectAtOffset( - false, offset, "linearization hint stream", 0, 0, obj, gen); + false, offset, "linearization hint stream", -1, 0, obj, gen); ObjCache& oc = this->obj_cache[ObjGen(obj, gen)]; off_t min_end_offset = oc.end_before_space; off_t max_end_offset = oc.end_after_space; |