aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFParser.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2022-08-30 07:42:46 +0200
committerm-holger <m-holger@kubitscheck.org>2022-08-30 07:42:46 +0200
commit6fc982b71a31fd70581f826bff5df6333d094797 (patch)
treed2180eb61a76828b4a82d3e1d46fc0f2a42317f3 /libqpdf/QPDFParser.cc
parent8ad1ea34feb3f867b18ab13e1ac521431c0f9dd0 (diff)
downloadqpdf-6fc982b71a31fd70581f826bff5df6333d094797.tar.zst
Move QPDFObjectHandle::setObjectDescriptionFromInput to QPDFParser
Part of #729
Diffstat (limited to 'libqpdf/QPDFParser.cc')
-rw-r--r--libqpdf/QPDFParser.cc29
1 files changed, 15 insertions, 14 deletions
diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc
index 9ced53e9..64adb449 100644
--- a/libqpdf/QPDFParser.cc
+++ b/libqpdf/QPDFParser.cc
@@ -263,12 +263,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
case st_dictionary:
case st_array:
- QPDFObjectHandle::setObjectDescriptionFromInput(
- object,
- context,
- object_description,
- input,
- input->getLastOffset());
+ setDescriptionFromInput(object, input->getLastOffset());
object.setParsedOffset(input->getLastOffset());
set_offset = true;
olist.append(object);
@@ -293,8 +288,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
// There's no newArray(SparseOHArray) since
// SparseOHArray is not part of the public API.
object = QPDFObjectHandle(QPDF_Array::create(olist));
- QPDFObjectHandle::setObjectDescriptionFromInput(
- object, context, object_description, input, offset);
+ setDescriptionFromInput(object, offset);
// The `offset` points to the next of "[". Set the
// rewind offset to point to the beginning of "[".
// This has been explicitly tested with whitespace
@@ -347,8 +341,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
"dictionary ended prematurely; "
"using null as value for last key");
val = QPDFObjectHandle::newNull();
- QPDFObjectHandle::setObjectDescriptionFromInput(
- val, context, object_description, input, offset);
+ setDescriptionFromInput(val, offset);
} else {
val = olist.at(++i);
}
@@ -372,8 +365,7 @@ QPDFParser::parse(bool& empty, bool content_stream)
dict["/Contents"].setParsedOffset(contents_offset);
}
object = QPDFObjectHandle::newDictionary(dict);
- QPDFObjectHandle::setObjectDescriptionFromInput(
- object, context, object_description, input, offset);
+ setDescriptionFromInput(object, offset);
// The `offset` points to the next of "<<". Set the
// rewind offset to point to the beginning of "<<".
// This has been explicitly tested with whitespace
@@ -396,14 +388,23 @@ QPDFParser::parse(bool& empty, bool content_stream)
}
if (!set_offset) {
- QPDFObjectHandle::setObjectDescriptionFromInput(
- object, context, object_description, input, offset);
+ setDescriptionFromInput(object, offset);
object.setParsedOffset(offset);
}
return object;
}
void
+QPDFParser::setDescriptionFromInput(
+ QPDFObjectHandle oh, qpdf_offset_t offset) const
+{
+ oh.setObjectDescription(
+ context,
+ (input->getName() + ", " + object_description + " at offset " +
+ QUtil::int_to_string(offset)));
+}
+
+void
QPDFParser::warn(QPDF* qpdf, QPDFExc const& e)
{
// If parsing on behalf of a QPDF object and want to give a