aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDFJob.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <jberkenbilt@users.noreply.github.com>2022-07-24 20:41:33 +0200
committerGitHub <noreply@github.com>2022-07-24 20:41:33 +0200
commit5696a507b6dacf34d066810a3f2fca3525eb02f5 (patch)
treeb0009760e0f76c28aa99581e4bc6087adf93749f /libqpdf/QPDFJob.cc
parent6f1041afb8e6d1f57169cd4c79f42a7c1ce94da8 (diff)
parent8b4afa428e9caa1a34cad434dfe8a3e01e5a24d3 (diff)
downloadqpdf-5696a507b6dacf34d066810a3f2fca3525eb02f5.tar.zst
Merge pull request #731 from m-holger/og_unparse
Tidy QPDFObjGen related code
Diffstat (limited to 'libqpdf/QPDFJob.cc')
-rw-r--r--libqpdf/QPDFJob.cc24
1 files changed, 11 insertions, 13 deletions
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index c5f0eb2d..343fa348 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -49,8 +49,7 @@ namespace
size_t oi_min_area,
QPDFObjectHandle& image);
virtual ~ImageOptimizer() = default;
- virtual void
- provideStreamData(int objid, int generation, Pipeline* pipeline);
+ virtual void provideStreamData(QPDFObjGen const&, Pipeline* pipeline);
std::shared_ptr<Pipeline>
makePipeline(std::string const& description, Pipeline* next);
bool evaluate(std::string const& description);
@@ -250,7 +249,7 @@ ImageOptimizer::evaluate(std::string const& description)
}
void
-ImageOptimizer::provideStreamData(int, int, Pipeline* pipeline)
+ImageOptimizer::provideStreamData(QPDFObjGen const&, Pipeline* pipeline)
{
std::shared_ptr<Pipeline> p = makePipeline("", pipeline);
if (p.get() == nullptr) {
@@ -947,7 +946,7 @@ QPDFJob::doShowObj(QPDF& pdf)
}
if (error) {
throw std::runtime_error(
- "unable to get object " + obj.getObjGen().unparse());
+ "unable to get object " + obj.getObjGen().unparse(','));
}
}
@@ -995,7 +994,8 @@ QPDFJob::doListAttachments(QPDF& pdf)
auto efoh = i.second;
*this->m->log->getInfo()
<< key << " -> "
- << efoh->getEmbeddedFileStream().getObjGen().unparse() << "\n";
+ << efoh->getEmbeddedFileStream().getObjGen().unparse(',')
+ << "\n";
doIfVerbose([&](Pipeline& v, std::string const& prefix) {
auto desc = efoh->getDescription();
if (!desc.empty()) {
@@ -1010,7 +1010,7 @@ QPDFJob::doListAttachments(QPDF& pdf)
for (auto i2: efoh->getEmbeddedFileStreams().ditems()) {
auto efs = QPDFEFStreamObjectHelper(i2.second);
v << " " << i2.first << " -> "
- << efs.getObjectHandle().getObjGen().unparse() << "\n";
+ << efs.getObjectHandle().getObjGen().unparse(',') << "\n";
v << " creation date: " << efs.getCreationDate()
<< "\n"
<< " modification date: " << efs.getModDate() << "\n"
@@ -2463,7 +2463,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF& pdf)
QTC::TC("qpdf", "QPDFJob found resources in non-leaf");
doIfVerbose([&](Pipeline& v, std::string const& prefix) {
v << " found resources in non-leaf page node "
- << og.getObj() << " " << og.getGen() << "\n";
+ << og.unparse(' ') << "\n";
});
return true;
}
@@ -2480,9 +2480,8 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF& pdf)
QTC::TC("qpdf", "QPDFJob found shared resources in leaf");
doIfVerbose([&](Pipeline& v, std::string const& prefix) {
v << " found shared resources in leaf node "
- << og.getObj() << " " << og.getGen() << ": "
- << resources_og.getObj() << " "
- << resources_og.getGen() << "\n";
+ << og.unparse(' ') << ": "
+ << resources_og.unparse(' ') << "\n";
});
return true;
}
@@ -2497,8 +2496,7 @@ QPDFJob::shouldRemoveUnreferencedResources(QPDF& pdf)
QTC::TC("qpdf", "QPDFJob found shared xobject in leaf");
doIfVerbose([&](Pipeline& v, std::string const& prefix) {
v << " found shared xobject in leaf node "
- << og.getObj() << " " << og.getGen() << ": "
- << xobject_og.getObj() << " " << xobject_og.getGen()
+ << og.unparse(' ') << ": " << xobject_og.unparse(' ')
<< "\n";
});
return true;
@@ -3375,7 +3373,7 @@ QPDFJob::writeJSON(QPDF& pdf)
auto wanted = getWantedJSONObjects();
for (auto const& og: wanted) {
std::ostringstream s;
- s << "obj:" << og.getObj() << " " << og.getGen() << " R";
+ s << "obj:" << og.unparse(' ') << " R";
json_objects.insert(s.str());
}
pdf.writeJSON(