aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/NNTree.cc17
-rw-r--r--libqpdf/QPDFAcroFormDocumentHelper.cc3
-rw-r--r--libqpdf/QPDFFileSpecObjectHelper.cc4
-rw-r--r--libqpdf/QPDFObjectHandle.cc15
-rw-r--r--libqpdf/QPDFPageLabelDocumentHelper.cc5
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc14
-rw-r--r--libqpdf/QPDF_Stream.cc4
7 files changed, 30 insertions, 32 deletions
diff --git a/libqpdf/NNTree.cc b/libqpdf/NNTree.cc
index bfeb15a1..a5df209d 100644
--- a/libqpdf/NNTree.cc
+++ b/libqpdf/NNTree.cc
@@ -208,8 +208,9 @@ NNTreeIterator::resetLimits(
}
}
if (first.isInitialized() && last.isInitialized()) {
- auto limits =
- QPDFObjectHandle::newArray().appendItem(first).appendItem(last);
+ auto limits = QPDFObjectHandle::newArray();
+ limits.appendItem(first);
+ limits.appendItem(last);
auto olimits = node.getKey("/Limits");
if (olimits.isArray() && (olimits.getArrayNItems() == 2)) {
auto ofirst = olimits.getArrayItem(0);
@@ -340,10 +341,9 @@ NNTreeIterator::split(
first_node.replaceKey(key, first_half);
QPDFObjectHandle new_kids = QPDFObjectHandle::newArray();
new_kids.appendItem(first_node);
- to_split
- .removeKey("/Limits") // already shouldn't be there for root
- .removeKey(impl.details.itemsKey())
- .replaceKey("/Kids", new_kids);
+ to_split.removeKey("/Limits"); // already shouldn't be there for root
+ to_split.removeKey(impl.details.itemsKey());
+ to_split.replaceKey("/Kids", new_kids);
if (is_leaf) {
QTC::TC("qpdf", "NNTree split root + leaf");
this->node = first_node;
@@ -884,8 +884,9 @@ NNTreeImpl::repair()
for (auto const& i: *this) {
repl.insert(i.first, i.second);
}
- this->oh.replaceKey("/Kids", new_node.getKey("/Kids"))
- .replaceKey(details.itemsKey(), new_node.getKey(details.itemsKey()));
+ this->oh.replaceKey("/Kids", new_node.getKey("/Kids"));
+ this->oh.replaceKey(
+ details.itemsKey(), new_node.getKey(details.itemsKey()));
}
NNTreeImpl::iterator
diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc
index 4e9f08b9..70d01b30 100644
--- a/libqpdf/QPDFAcroFormDocumentHelper.cc
+++ b/libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -733,7 +733,8 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream(
auto existing_old = subdict.getKey(old_key);
if (!existing_old.isNull()) {
QTC::TC("qpdf", "QPDFAcroFormDocumentHelper ap rename");
- subdict.replaceKey(new_key, existing_old).removeKey(old_key);
+ subdict.replaceKey(new_key, existing_old);
+ subdict.removeKey(old_key);
}
}
}
diff --git a/libqpdf/QPDFFileSpecObjectHelper.cc b/libqpdf/QPDFFileSpecObjectHelper.cc
index f9c19e3c..fcc19b45 100644
--- a/libqpdf/QPDFFileSpecObjectHelper.cc
+++ b/libqpdf/QPDFFileSpecObjectHelper.cc
@@ -103,8 +103,8 @@ QPDFFileSpecObjectHelper::createFileSpec(
QPDFFileSpecObjectHelper result(oh);
result.setFilename(filename);
auto ef = QPDFObjectHandle::newDictionary();
- ef.replaceKey("/F", efsoh.getObjectHandle())
- .replaceKey("/UF", efsoh.getObjectHandle());
+ ef.replaceKey("/F", efsoh.getObjectHandle());
+ ef.replaceKey("/UF", efsoh.getObjectHandle());
oh.replaceKey("/EF", ef);
return result;
}
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 4a0a69ae..f3d1883a 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -959,7 +959,7 @@ QPDFObjectHandle::setArrayFromVector(std::vector<QPDFObjectHandle> const& items)
}
}
-QPDFObjectHandle&
+void
QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item)
{
if (isArray()) {
@@ -968,7 +968,6 @@ QPDFObjectHandle::insertItem(int at, QPDFObjectHandle const& item)
typeWarning("array", "ignoring attempt to insert item");
QTC::TC("qpdf", "QPDFObjectHandle array ignoring insert item");
}
- return *this;
}
QPDFObjectHandle
@@ -978,7 +977,7 @@ QPDFObjectHandle::insertItemAndGet(int at, QPDFObjectHandle const& item)
return item;
}
-QPDFObjectHandle&
+void
QPDFObjectHandle::appendItem(QPDFObjectHandle const& item)
{
if (isArray()) {
@@ -988,7 +987,6 @@ QPDFObjectHandle::appendItem(QPDFObjectHandle const& item)
typeWarning("array", "ignoring attempt to append item");
QTC::TC("qpdf", "QPDFObjectHandle array ignoring append item");
}
- return *this;
}
QPDFObjectHandle
@@ -998,7 +996,7 @@ QPDFObjectHandle::appendItemAndGet(QPDFObjectHandle const& item)
return item;
}
-QPDFObjectHandle&
+void
QPDFObjectHandle::eraseItem(int at)
{
if (isArray() && (at < getArrayNItems()) && (at >= 0)) {
@@ -1012,7 +1010,6 @@ QPDFObjectHandle::eraseItem(int at)
QTC::TC("qpdf", "QPDFObjectHandle array ignoring erase item");
}
}
- return *this;
}
QPDFObjectHandle
@@ -1289,7 +1286,7 @@ QPDFObjectHandle::getOwningQPDF()
// Dictionary mutators
-QPDFObjectHandle&
+void
QPDFObjectHandle::replaceKey(
std::string const& key, QPDFObjectHandle const& value)
{
@@ -1300,7 +1297,6 @@ QPDFObjectHandle::replaceKey(
typeWarning("dictionary", "ignoring key replacement request");
QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring replaceKey");
}
- return *this;
}
QPDFObjectHandle
@@ -1311,7 +1307,7 @@ QPDFObjectHandle::replaceKeyAndGet(
return value;
}
-QPDFObjectHandle&
+void
QPDFObjectHandle::removeKey(std::string const& key)
{
if (isDictionary()) {
@@ -1320,7 +1316,6 @@ QPDFObjectHandle::removeKey(std::string const& key)
typeWarning("dictionary", "ignoring key removal request");
QTC::TC("qpdf", "QPDFObjectHandle dictionary ignoring removeKey");
}
- return *this;
}
QPDFObjectHandle
diff --git a/libqpdf/QPDFPageLabelDocumentHelper.cc b/libqpdf/QPDFPageLabelDocumentHelper.cc
index 8f3472c1..babfd5aa 100644
--- a/libqpdf/QPDFPageLabelDocumentHelper.cc
+++ b/libqpdf/QPDFPageLabelDocumentHelper.cc
@@ -44,8 +44,9 @@ QPDFPageLabelDocumentHelper::getLabelForPage(long long page_idx)
QIntC::range_check(start, offset);
start += offset;
result = QPDFObjectHandle::newDictionary();
- result.replaceKey("/S", S).replaceKey("/P", P).replaceKey(
- "/St", QPDFObjectHandle::newInteger(start));
+ result.replaceKey("/S", S);
+ result.replaceKey("/P", P);
+ result.replaceKey("/St", QPDFObjectHandle::newInteger(start));
return result;
}
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc
index a8880ec0..6c38f098 100644
--- a/libqpdf/QPDFPageObjectHelper.cc
+++ b/libqpdf/QPDFPageObjectHelper.cc
@@ -78,8 +78,8 @@ QPDFObjectHandle
InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
{
QPDFObjectHandle dict = QPDFObjectHandle::newDictionary();
- dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"))
- .replaceKey("/Subtype", QPDFObjectHandle::newName("/Image"));
+ dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
+ dict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Image"));
std::set<std::string> keys = odict.getKeys();
for (auto key: keys) {
QPDFObjectHandle value = odict.getKey(key);
@@ -752,11 +752,11 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations)
}
QPDFObjectHandle result = QPDFObjectHandle::newStream(qpdf);
QPDFObjectHandle newdict = result.getDict();
- newdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"))
- .replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"))
- .replaceKey(
- "/Resources", getAttribute("/Resources", false).shallowCopy())
- .replaceKey("/Group", getAttribute("/Group", false).shallowCopy());
+ newdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
+ newdict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
+ newdict.replaceKey(
+ "/Resources", getAttribute("/Resources", false).shallowCopy());
+ newdict.replaceKey("/Group", getAttribute("/Group", false).shallowCopy());
QPDFObjectHandle bbox = getTrimBox(false).shallowCopy();
if (!bbox.isRectangle()) {
this->oh.warnIfPossible("bounding box is invalid; form"
diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc
index ff62df73..c6f0d873 100644
--- a/libqpdf/QPDF_Stream.cc
+++ b/libqpdf/QPDF_Stream.cc
@@ -725,8 +725,8 @@ QPDF_Stream::replaceFilterData(
QPDFObjectHandle const& decode_parms,
size_t length)
{
- this->stream_dict.replaceKey("/Filter", filter)
- .replaceKey("/DecodeParms", decode_parms);
+ this->stream_dict.replaceKey("/Filter", filter);
+ this->stream_dict.replaceKey("/DecodeParms", decode_parms);
if (length == 0) {
QTC::TC("qpdf", "QPDF_Stream unknown stream length");
this->stream_dict.removeKey("/Length");