aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-07-16 12:21:11 +0200
committerm-holger <m-holger@kubitscheck.org>2022-07-24 16:41:48 +0200
commiteeb6162f7620fba49bb141ccd2c715cd829c8e24 (patch)
tree60869241401c5c4c673a54f1e00360bbf02a4542 /libqpdf/QPDF.cc
parent6f1041afb8e6d1f57169cd4c79f42a7c1ce94da8 (diff)
downloadqpdf-eeb6162f7620fba49bb141ccd2c715cd829c8e24.tar.zst
Add optional parameter separator to QPDFObjGen::unparse
Also, revert inlining of unparse and operator << from commit 4c6640c in order to avoid exposing QUtil.
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc31
1 files changed, 12 insertions, 19 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 86a4e3d2..3b2271bc 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -1493,9 +1493,8 @@ QPDF::setLastObjectDescription(
}
}
if (objid > 0) {
- this->m->last_object_description += "object " +
- QUtil::int_to_string(objid) + " " +
- QUtil::int_to_string(generation);
+ this->m->last_object_description +=
+ "object " + QPDFObjGen(objid, generation).unparse(' ');
}
}
@@ -1862,8 +1861,8 @@ QPDF::readObjectAtOffset(
this->m->file->getName(),
this->m->last_object_description,
offset,
- (std::string("expected ") + QUtil::int_to_string(exp_objid) +
- " " + QUtil::int_to_string(exp_generation) + " obj"));
+ (std::string("expected ") +
+ QPDFObjGen(exp_objid, exp_generation).unparse(' ') + " obj"));
if (try_recovery) {
// Will be retried below
throw e;
@@ -1898,8 +1897,8 @@ QPDF::readObjectAtOffset(
"",
0,
std::string(
- "object " + QUtil::int_to_string(exp_objid) + " " +
- QUtil::int_to_string(exp_generation) +
+ "object " +
+ QPDFObjGen(exp_objid, exp_generation).unparse(' ') +
" not found in file after regenerating"
" cross reference table"));
return QPDFObjectHandle::newNull();
@@ -2002,8 +2001,7 @@ QPDF::resolve(int objid, int generation)
qpdf_e_damaged_pdf,
"",
this->m->file->getLastOffset(),
- ("loop detected resolving object " + QUtil::int_to_string(objid) +
- " " + QUtil::int_to_string(generation)));
+ ("loop detected resolving object " + og.unparse(' ')));
return QPDF_Null::create();
}
ResolveRecorder rr(this, og);
@@ -2039,8 +2037,7 @@ QPDF::resolve(int objid, int generation)
this->m->file->getName(),
"",
0,
- ("object " + QUtil::int_to_string(objid) + "/" +
- QUtil::int_to_string(generation) +
+ ("object " + og.unparse('/') +
" has unexpected xref entry type"));
}
} catch (QPDFExc& e) {
@@ -2050,8 +2047,7 @@ QPDF::resolve(int objid, int generation)
qpdf_e_damaged_pdf,
"",
0,
- ("object " + QUtil::int_to_string(objid) + "/" +
- QUtil::int_to_string(generation) +
+ ("object " + og.unparse('/') +
": error reading object: " + e.what()));
}
}
@@ -2065,10 +2061,7 @@ QPDF::resolve(int objid, int generation)
std::shared_ptr<QPDFObject> result(this->m->obj_cache[og].object);
if (!result->hasDescription()) {
- result->setDescription(
- this,
- ("object " + QUtil::int_to_string(objid) + " " +
- QUtil::int_to_string(generation)));
+ result->setDescription(this, ("object " + og.unparse(' ')));
}
return result;
}
@@ -2809,8 +2802,8 @@ QPDF::pipeStreamData(
"",
file->getLastOffset(),
("error decoding stream data for object " +
- QUtil::int_to_string(objid) + " " +
- QUtil::int_to_string(generation) + ": " + e.what())));
+ QPDFObjGen(objid, generation).unparse(' ') + ": " +
+ e.what())));
if (will_retry) {
qpdf_for_warning.warn(
// line-break