Commit d8e4a08122063dc604c6ea072abb00c6cbc61216
1 parent
567dd10a
Pass QPDFObjGen by value
Except for virtual functions to avoid the need for users to update code.
Showing
14 changed files
with
54 additions
and
60 deletions
examples/pdf-custom-filter.cc
| @@ -179,7 +179,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider | @@ -179,7 +179,7 @@ class StreamReplacer: public QPDFObjectHandle::StreamDataProvider | ||
| 179 | 179 | ||
| 180 | private: | 180 | private: |
| 181 | bool maybeReplace( | 181 | bool maybeReplace( |
| 182 | - QPDFObjGen const& og, | 182 | + QPDFObjGen og, |
| 183 | QPDFObjectHandle& stream, | 183 | QPDFObjectHandle& stream, |
| 184 | Pipeline* pipeline, | 184 | Pipeline* pipeline, |
| 185 | QPDFObjectHandle* dict_updates); | 185 | QPDFObjectHandle* dict_updates); |
| @@ -204,10 +204,7 @@ StreamReplacer::StreamReplacer(QPDF* pdf) : | @@ -204,10 +204,7 @@ StreamReplacer::StreamReplacer(QPDF* pdf) : | ||
| 204 | 204 | ||
| 205 | bool | 205 | bool |
| 206 | StreamReplacer::maybeReplace( | 206 | StreamReplacer::maybeReplace( |
| 207 | - QPDFObjGen const& og, | ||
| 208 | - QPDFObjectHandle& stream, | ||
| 209 | - Pipeline* pipeline, | ||
| 210 | - QPDFObjectHandle* dict_updates) | 207 | + QPDFObjGen og, QPDFObjectHandle& stream, Pipeline* pipeline, QPDFObjectHandle* dict_updates) |
| 211 | { | 208 | { |
| 212 | // As described in the class comments, this method is called twice. Before writing has started | 209 | // As described in the class comments, this method is called twice. Before writing has started |
| 213 | // pipeline is nullptr, and dict_updates is provided. In this mode, we figure out whether we | 210 | // pipeline is nullptr, and dict_updates is provided. In this mode, we figure out whether we |
include/qpdf/QPDF.hh
| @@ -367,13 +367,13 @@ class QPDF | @@ -367,13 +367,13 @@ class QPDF | ||
| 367 | // Retrieve an object by object ID and generation. Returns an indirect reference to it. The | 367 | // Retrieve an object by object ID and generation. Returns an indirect reference to it. The |
| 368 | // getObject() methods were added for qpdf 11. | 368 | // getObject() methods were added for qpdf 11. |
| 369 | QPDF_DLL | 369 | QPDF_DLL |
| 370 | - QPDFObjectHandle getObject(QPDFObjGen const&); | 370 | + QPDFObjectHandle getObject(QPDFObjGen); |
| 371 | QPDF_DLL | 371 | QPDF_DLL |
| 372 | QPDFObjectHandle getObject(int objid, int generation); | 372 | QPDFObjectHandle getObject(int objid, int generation); |
| 373 | // These are older methods, but there is no intention to deprecate | 373 | // These are older methods, but there is no intention to deprecate |
| 374 | // them. | 374 | // them. |
| 375 | QPDF_DLL | 375 | QPDF_DLL |
| 376 | - QPDFObjectHandle getObjectByObjGen(QPDFObjGen const&); | 376 | + QPDFObjectHandle getObjectByObjGen(QPDFObjGen); |
| 377 | QPDF_DLL | 377 | QPDF_DLL |
| 378 | QPDFObjectHandle getObjectByID(int objid, int generation); | 378 | QPDFObjectHandle getObjectByID(int objid, int generation); |
| 379 | 379 | ||
| @@ -387,14 +387,14 @@ class QPDF | @@ -387,14 +387,14 @@ class QPDF | ||
| 387 | // object is treated as a null object. To replace a reserved object, call replaceReserved | 387 | // object is treated as a null object. To replace a reserved object, call replaceReserved |
| 388 | // instead. | 388 | // instead. |
| 389 | QPDF_DLL | 389 | QPDF_DLL |
| 390 | - void replaceObject(QPDFObjGen const& og, QPDFObjectHandle); | 390 | + void replaceObject(QPDFObjGen og, QPDFObjectHandle); |
| 391 | QPDF_DLL | 391 | QPDF_DLL |
| 392 | void replaceObject(int objid, int generation, QPDFObjectHandle); | 392 | void replaceObject(int objid, int generation, QPDFObjectHandle); |
| 393 | 393 | ||
| 394 | // Swap two objects given by ID. Prior to qpdf 10.2.1, existing QPDFObjectHandle instances that | 394 | // Swap two objects given by ID. Prior to qpdf 10.2.1, existing QPDFObjectHandle instances that |
| 395 | // reference them objects not notice the swap, but this was fixed in 10.2.1. | 395 | // reference them objects not notice the swap, but this was fixed in 10.2.1. |
| 396 | QPDF_DLL | 396 | QPDF_DLL |
| 397 | - void swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2); | 397 | + void swapObjects(QPDFObjGen og1, QPDFObjGen og2); |
| 398 | QPDF_DLL | 398 | QPDF_DLL |
| 399 | void swapObjects(int objid1, int generation1, int objid2, int generation2); | 399 | void swapObjects(int objid1, int generation1, int objid2, int generation2); |
| 400 | 400 | ||
| @@ -694,7 +694,7 @@ class QPDF | @@ -694,7 +694,7 @@ class QPDF | ||
| 694 | // into the array returned by getAllPages() for that page. An exception is thrown if the page is | 694 | // into the array returned by getAllPages() for that page. An exception is thrown if the page is |
| 695 | // not found. | 695 | // not found. |
| 696 | QPDF_DLL | 696 | QPDF_DLL |
| 697 | - int findPage(QPDFObjGen const& og); | 697 | + int findPage(QPDFObjGen og); |
| 698 | QPDF_DLL | 698 | QPDF_DLL |
| 699 | int findPage(QPDFObjectHandle& page); | 699 | int findPage(QPDFObjectHandle& page); |
| 700 | 700 | ||
| @@ -859,7 +859,7 @@ class QPDF | @@ -859,7 +859,7 @@ class QPDF | ||
| 859 | static bool | 859 | static bool |
| 860 | pipeStreamData( | 860 | pipeStreamData( |
| 861 | QPDF* qpdf, | 861 | QPDF* qpdf, |
| 862 | - QPDFObjGen const& og, | 862 | + QPDFObjGen og, |
| 863 | qpdf_offset_t offset, | 863 | qpdf_offset_t offset, |
| 864 | size_t length, | 864 | size_t length, |
| 865 | QPDFObjectHandle dict, | 865 | QPDFObjectHandle dict, |
| @@ -964,7 +964,7 @@ class QPDF | @@ -964,7 +964,7 @@ class QPDF | ||
| 964 | ForeignStreamData( | 964 | ForeignStreamData( |
| 965 | std::shared_ptr<EncryptionParameters> encp, | 965 | std::shared_ptr<EncryptionParameters> encp, |
| 966 | std::shared_ptr<InputSource> file, | 966 | std::shared_ptr<InputSource> file, |
| 967 | - QPDFObjGen const& foreign_og, | 967 | + QPDFObjGen foreign_og, |
| 968 | qpdf_offset_t offset, | 968 | qpdf_offset_t offset, |
| 969 | size_t length, | 969 | size_t length, |
| 970 | QPDFObjectHandle local_dict); | 970 | QPDFObjectHandle local_dict); |
| @@ -1002,7 +1002,7 @@ class QPDF | @@ -1002,7 +1002,7 @@ class QPDF | ||
| 1002 | friend class QPDF; | 1002 | friend class QPDF; |
| 1003 | 1003 | ||
| 1004 | public: | 1004 | public: |
| 1005 | - StringDecrypter(QPDF* qpdf, QPDFObjGen const& og); | 1005 | + StringDecrypter(QPDF* qpdf, QPDFObjGen og); |
| 1006 | ~StringDecrypter() override = default; | 1006 | ~StringDecrypter() override = default; |
| 1007 | void decryptString(std::string& val) override; | 1007 | void decryptString(std::string& val) override; |
| 1008 | 1008 | ||
| @@ -1014,7 +1014,7 @@ class QPDF | @@ -1014,7 +1014,7 @@ class QPDF | ||
| 1014 | class ResolveRecorder | 1014 | class ResolveRecorder |
| 1015 | { | 1015 | { |
| 1016 | public: | 1016 | public: |
| 1017 | - ResolveRecorder(QPDF* qpdf, QPDFObjGen const& og) : | 1017 | + ResolveRecorder(QPDF* qpdf, QPDFObjGen og) : |
| 1018 | qpdf(qpdf), | 1018 | qpdf(qpdf), |
| 1019 | iter(qpdf->m->resolving.insert(og).first) | 1019 | iter(qpdf->m->resolving.insert(og).first) |
| 1020 | { | 1020 | { |
| @@ -1054,14 +1054,14 @@ class QPDF | @@ -1054,14 +1054,14 @@ class QPDF | ||
| 1054 | void insertXrefEntry(int obj, int f0, qpdf_offset_t f1, int f2); | 1054 | void insertXrefEntry(int obj, int f0, qpdf_offset_t f1, int f2); |
| 1055 | void insertFreeXrefEntry(QPDFObjGen); | 1055 | void insertFreeXrefEntry(QPDFObjGen); |
| 1056 | void insertReconstructedXrefEntry(int obj, qpdf_offset_t f1, int f2); | 1056 | void insertReconstructedXrefEntry(int obj, qpdf_offset_t f1, int f2); |
| 1057 | - void setLastObjectDescription(std::string const& description, QPDFObjGen const& og); | 1057 | + void setLastObjectDescription(std::string const& description, QPDFObjGen og); |
| 1058 | QPDFObjectHandle readTrailer(); | 1058 | QPDFObjectHandle readTrailer(); |
| 1059 | QPDFObjectHandle readObject(std::string const& description, QPDFObjGen og); | 1059 | QPDFObjectHandle readObject(std::string const& description, QPDFObjGen og); |
| 1060 | void readStream(QPDFObjectHandle& object, QPDFObjGen og, qpdf_offset_t offset); | 1060 | void readStream(QPDFObjectHandle& object, QPDFObjGen og, qpdf_offset_t offset); |
| 1061 | void validateStreamLineEnd(QPDFObjectHandle& object, QPDFObjGen og, qpdf_offset_t offset); | 1061 | void validateStreamLineEnd(QPDFObjectHandle& object, QPDFObjGen og, qpdf_offset_t offset); |
| 1062 | QPDFObjectHandle readObjectInStream(std::shared_ptr<InputSource>& input, int obj); | 1062 | QPDFObjectHandle readObjectInStream(std::shared_ptr<InputSource>& input, int obj); |
| 1063 | size_t recoverStreamLength( | 1063 | size_t recoverStreamLength( |
| 1064 | - std::shared_ptr<InputSource> input, QPDFObjGen const& og, qpdf_offset_t stream_offset); | 1064 | + std::shared_ptr<InputSource> input, QPDFObjGen og, qpdf_offset_t stream_offset); |
| 1065 | QPDFTokenizer::Token readToken(InputSource&, size_t max_len = 0); | 1065 | QPDFTokenizer::Token readToken(InputSource&, size_t max_len = 0); |
| 1066 | 1066 | ||
| 1067 | QPDFObjectHandle readObjectAtOffset( | 1067 | QPDFObjectHandle readObjectAtOffset( |
| @@ -1075,15 +1075,15 @@ class QPDF | @@ -1075,15 +1075,15 @@ class QPDF | ||
| 1075 | void resolveObjectsInStream(int obj_stream_number); | 1075 | void resolveObjectsInStream(int obj_stream_number); |
| 1076 | void stopOnError(std::string const& message); | 1076 | void stopOnError(std::string const& message); |
| 1077 | QPDFObjGen nextObjGen(); | 1077 | QPDFObjGen nextObjGen(); |
| 1078 | - QPDFObjectHandle newIndirect(QPDFObjGen const&, std::shared_ptr<QPDFObject> const&); | 1078 | + QPDFObjectHandle newIndirect(QPDFObjGen, std::shared_ptr<QPDFObject> const&); |
| 1079 | QPDFObjectHandle makeIndirectFromQPDFObject(std::shared_ptr<QPDFObject> const& obj); | 1079 | QPDFObjectHandle makeIndirectFromQPDFObject(std::shared_ptr<QPDFObject> const& obj); |
| 1080 | - bool isCached(QPDFObjGen const& og); | ||
| 1081 | - bool isUnresolved(QPDFObjGen const& og); | 1080 | + bool isCached(QPDFObjGen og); |
| 1081 | + bool isUnresolved(QPDFObjGen og); | ||
| 1082 | std::shared_ptr<QPDFObject> getObjectForParser(int id, int gen, bool parse_pdf); | 1082 | std::shared_ptr<QPDFObject> getObjectForParser(int id, int gen, bool parse_pdf); |
| 1083 | std::shared_ptr<QPDFObject> getObjectForJSON(int id, int gen); | 1083 | std::shared_ptr<QPDFObject> getObjectForJSON(int id, int gen); |
| 1084 | void removeObject(QPDFObjGen og); | 1084 | void removeObject(QPDFObjGen og); |
| 1085 | void updateCache( | 1085 | void updateCache( |
| 1086 | - QPDFObjGen const& og, | 1086 | + QPDFObjGen og, |
| 1087 | std::shared_ptr<QPDFObject> const& object, | 1087 | std::shared_ptr<QPDFObject> const& object, |
| 1088 | qpdf_offset_t end_before_space, | 1088 | qpdf_offset_t end_before_space, |
| 1089 | qpdf_offset_t end_after_space); | 1089 | qpdf_offset_t end_after_space); |
| @@ -1100,7 +1100,7 @@ class QPDF | @@ -1100,7 +1100,7 @@ class QPDF | ||
| 1100 | 1100 | ||
| 1101 | // Calls finish() on the pipeline when done but does not delete it | 1101 | // Calls finish() on the pipeline when done but does not delete it |
| 1102 | bool pipeStreamData( | 1102 | bool pipeStreamData( |
| 1103 | - QPDFObjGen const& og, | 1103 | + QPDFObjGen og, |
| 1104 | qpdf_offset_t offset, | 1104 | qpdf_offset_t offset, |
| 1105 | size_t length, | 1105 | size_t length, |
| 1106 | QPDFObjectHandle dict, | 1106 | QPDFObjectHandle dict, |
| @@ -1113,7 +1113,7 @@ class QPDF | @@ -1113,7 +1113,7 @@ class QPDF | ||
| 1113 | std::shared_ptr<QPDF::EncryptionParameters> encp, | 1113 | std::shared_ptr<QPDF::EncryptionParameters> encp, |
| 1114 | std::shared_ptr<InputSource> file, | 1114 | std::shared_ptr<InputSource> file, |
| 1115 | QPDF& qpdf_for_warning, | 1115 | QPDF& qpdf_for_warning, |
| 1116 | - QPDFObjGen const& og, | 1116 | + QPDFObjGen og, |
| 1117 | qpdf_offset_t offset, | 1117 | qpdf_offset_t offset, |
| 1118 | size_t length, | 1118 | size_t length, |
| 1119 | QPDFObjectHandle dict, | 1119 | QPDFObjectHandle dict, |
| @@ -1174,8 +1174,8 @@ class QPDF | @@ -1174,8 +1174,8 @@ class QPDF | ||
| 1174 | interpretCF(std::shared_ptr<EncryptionParameters> encp, QPDFObjectHandle); | 1174 | interpretCF(std::shared_ptr<EncryptionParameters> encp, QPDFObjectHandle); |
| 1175 | void initializeEncryption(); | 1175 | void initializeEncryption(); |
| 1176 | static std::string | 1176 | static std::string |
| 1177 | - getKeyForObject(std::shared_ptr<EncryptionParameters> encp, QPDFObjGen const& og, bool use_aes); | ||
| 1178 | - void decryptString(std::string&, QPDFObjGen const& og); | 1177 | + getKeyForObject(std::shared_ptr<EncryptionParameters> encp, QPDFObjGen og, bool use_aes); |
| 1178 | + void decryptString(std::string&, QPDFObjGen og); | ||
| 1179 | static std::string | 1179 | static std::string |
| 1180 | compute_encryption_key_from_password(std::string const& password, EncryptionData const& data); | 1180 | compute_encryption_key_from_password(std::string const& password, EncryptionData const& data); |
| 1181 | static std::string | 1181 | static std::string |
| @@ -1187,7 +1187,7 @@ class QPDF | @@ -1187,7 +1187,7 @@ class QPDF | ||
| 1187 | std::shared_ptr<InputSource> file, | 1187 | std::shared_ptr<InputSource> file, |
| 1188 | QPDF& qpdf_for_warning, | 1188 | QPDF& qpdf_for_warning, |
| 1189 | Pipeline*& pipeline, | 1189 | Pipeline*& pipeline, |
| 1190 | - QPDFObjGen const& og, | 1190 | + QPDFObjGen og, |
| 1191 | QPDFObjectHandle& stream_dict, | 1191 | QPDFObjectHandle& stream_dict, |
| 1192 | std::unique_ptr<Pipeline>& heap); | 1192 | std::unique_ptr<Pipeline>& heap); |
| 1193 | 1193 | ||
| @@ -1408,7 +1408,7 @@ class QPDF | @@ -1408,7 +1408,7 @@ class QPDF | ||
| 1408 | void readHSharedObject(BitStream); | 1408 | void readHSharedObject(BitStream); |
| 1409 | void readHGeneric(BitStream, HGeneric&); | 1409 | void readHGeneric(BitStream, HGeneric&); |
| 1410 | qpdf_offset_t maxEnd(ObjUser const& ou); | 1410 | qpdf_offset_t maxEnd(ObjUser const& ou); |
| 1411 | - qpdf_offset_t getLinearizationOffset(QPDFObjGen const&); | 1411 | + qpdf_offset_t getLinearizationOffset(QPDFObjGen); |
| 1412 | QPDFObjectHandle | 1412 | QPDFObjectHandle |
| 1413 | getUncompressedObject(QPDFObjectHandle&, std::map<int, int> const& object_stream_data); | 1413 | getUncompressedObject(QPDFObjectHandle&, std::map<int, int> const& object_stream_data); |
| 1414 | QPDFObjectHandle getUncompressedObject(QPDFObjectHandle&, QPDFWriter::ObjTable const& obj); | 1414 | QPDFObjectHandle getUncompressedObject(QPDFObjectHandle&, QPDFWriter::ObjTable const& obj); |
include/qpdf/QPDFOutlineDocumentHelper.hh
| @@ -58,16 +58,14 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | @@ -58,16 +58,14 @@ class QPDFOutlineDocumentHelper: public QPDFDocumentHelper | ||
| 58 | 58 | ||
| 59 | // Return a list outlines that are known to target the specified page. | 59 | // Return a list outlines that are known to target the specified page. |
| 60 | QPDF_DLL | 60 | QPDF_DLL |
| 61 | - std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen const&); | 61 | + std::vector<QPDFOutlineObjectHelper> getOutlinesForPage(QPDFObjGen); |
| 62 | 62 | ||
| 63 | class Accessor | 63 | class Accessor |
| 64 | { | 64 | { |
| 65 | friend class QPDFOutlineObjectHelper; | 65 | friend class QPDFOutlineObjectHelper; |
| 66 | 66 | ||
| 67 | - // ABI: remove QPDF_DLL and pass og by value. | ||
| 68 | - QPDF_DLL | ||
| 69 | static bool | 67 | static bool |
| 70 | - checkSeen(QPDFOutlineDocumentHelper& dh, QPDFObjGen const& og) | 68 | + checkSeen(QPDFOutlineDocumentHelper& dh, QPDFObjGen og) |
| 71 | { | 69 | { |
| 72 | return !dh.m->seen.add(og); | 70 | return !dh.m->seen.add(og); |
| 73 | } | 71 | } |
include/qpdf/QPDFWriter.hh
| @@ -485,7 +485,7 @@ class QPDFWriter | @@ -485,7 +485,7 @@ class QPDFWriter | ||
| 485 | void writeStringQDF(std::string_view str); | 485 | void writeStringQDF(std::string_view str); |
| 486 | void writeStringNoQDF(std::string_view str); | 486 | void writeStringNoQDF(std::string_view str); |
| 487 | void writePad(size_t nspaces); | 487 | void writePad(size_t nspaces); |
| 488 | - void assignCompressedObjectNumbers(QPDFObjGen const& og); | 488 | + void assignCompressedObjectNumbers(QPDFObjGen og); |
| 489 | void enqueueObject(QPDFObjectHandle object); | 489 | void enqueueObject(QPDFObjectHandle object); |
| 490 | void writeObjectStreamOffsets(std::vector<qpdf_offset_t>& offsets, int first_obj); | 490 | void writeObjectStreamOffsets(std::vector<qpdf_offset_t>& offsets, int first_obj); |
| 491 | void writeObjectStream(QPDFObjectHandle object); | 491 | void writeObjectStream(QPDFObjectHandle object); |
libqpdf/QPDF.cc
| @@ -112,7 +112,7 @@ namespace | @@ -112,7 +112,7 @@ namespace | ||
| 112 | QPDF::ForeignStreamData::ForeignStreamData( | 112 | QPDF::ForeignStreamData::ForeignStreamData( |
| 113 | std::shared_ptr<EncryptionParameters> encp, | 113 | std::shared_ptr<EncryptionParameters> encp, |
| 114 | std::shared_ptr<InputSource> file, | 114 | std::shared_ptr<InputSource> file, |
| 115 | - QPDFObjGen const& foreign_og, | 115 | + QPDFObjGen foreign_og, |
| 116 | qpdf_offset_t offset, | 116 | qpdf_offset_t offset, |
| 117 | size_t length, | 117 | size_t length, |
| 118 | QPDFObjectHandle local_dict) : | 118 | QPDFObjectHandle local_dict) : |
| @@ -164,7 +164,7 @@ QPDF::CopiedStreamDataProvider::registerForeignStream( | @@ -164,7 +164,7 @@ QPDF::CopiedStreamDataProvider::registerForeignStream( | ||
| 164 | this->foreign_stream_data[local_og] = foreign_stream; | 164 | this->foreign_stream_data[local_og] = foreign_stream; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | -QPDF::StringDecrypter::StringDecrypter(QPDF* qpdf, QPDFObjGen const& og) : | 167 | +QPDF::StringDecrypter::StringDecrypter(QPDF* qpdf, QPDFObjGen og) : |
| 168 | qpdf(qpdf), | 168 | qpdf(qpdf), |
| 169 | og(og) | 169 | og(og) |
| 170 | { | 170 | { |
| @@ -1463,7 +1463,7 @@ QPDF::getAllObjects() | @@ -1463,7 +1463,7 @@ QPDF::getAllObjects() | ||
| 1463 | } | 1463 | } |
| 1464 | 1464 | ||
| 1465 | void | 1465 | void |
| 1466 | -QPDF::setLastObjectDescription(std::string const& description, QPDFObjGen const& og) | 1466 | +QPDF::setLastObjectDescription(std::string const& description, QPDFObjGen og) |
| 1467 | { | 1467 | { |
| 1468 | m->last_object_description.clear(); | 1468 | m->last_object_description.clear(); |
| 1469 | if (!description.empty()) { | 1469 | if (!description.empty()) { |
| @@ -1650,7 +1650,7 @@ QPDF::findEndstream() | @@ -1650,7 +1650,7 @@ QPDF::findEndstream() | ||
| 1650 | 1650 | ||
| 1651 | size_t | 1651 | size_t |
| 1652 | QPDF::recoverStreamLength( | 1652 | QPDF::recoverStreamLength( |
| 1653 | - std::shared_ptr<InputSource> input, QPDFObjGen const& og, qpdf_offset_t stream_offset) | 1653 | + std::shared_ptr<InputSource> input, QPDFObjGen og, qpdf_offset_t stream_offset) |
| 1654 | { | 1654 | { |
| 1655 | // Try to reconstruct stream length by looking for endstream or endobj | 1655 | // Try to reconstruct stream length by looking for endstream or endobj |
| 1656 | warn(damagedPDF(*input, stream_offset, "attempting to recover stream length")); | 1656 | warn(damagedPDF(*input, stream_offset, "attempting to recover stream length")); |
| @@ -2023,7 +2023,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number) | @@ -2023,7 +2023,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number) | ||
| 2023 | } | 2023 | } |
| 2024 | 2024 | ||
| 2025 | QPDFObjectHandle | 2025 | QPDFObjectHandle |
| 2026 | -QPDF::newIndirect(QPDFObjGen const& og, std::shared_ptr<QPDFObject> const& obj) | 2026 | +QPDF::newIndirect(QPDFObjGen og, std::shared_ptr<QPDFObject> const& obj) |
| 2027 | { | 2027 | { |
| 2028 | obj->setDefaultDescription(this, og); | 2028 | obj->setDefaultDescription(this, og); |
| 2029 | return {obj}; | 2029 | return {obj}; |
| @@ -2031,7 +2031,7 @@ QPDF::newIndirect(QPDFObjGen const& og, std::shared_ptr<QPDFObject> const& obj) | @@ -2031,7 +2031,7 @@ QPDF::newIndirect(QPDFObjGen const& og, std::shared_ptr<QPDFObject> const& obj) | ||
| 2031 | 2031 | ||
| 2032 | void | 2032 | void |
| 2033 | QPDF::updateCache( | 2033 | QPDF::updateCache( |
| 2034 | - QPDFObjGen const& og, | 2034 | + QPDFObjGen og, |
| 2035 | std::shared_ptr<QPDFObject> const& object, | 2035 | std::shared_ptr<QPDFObject> const& object, |
| 2036 | qpdf_offset_t end_before_space, | 2036 | qpdf_offset_t end_before_space, |
| 2037 | qpdf_offset_t end_after_space) | 2037 | qpdf_offset_t end_after_space) |
| @@ -2048,13 +2048,13 @@ QPDF::updateCache( | @@ -2048,13 +2048,13 @@ QPDF::updateCache( | ||
| 2048 | } | 2048 | } |
| 2049 | 2049 | ||
| 2050 | bool | 2050 | bool |
| 2051 | -QPDF::isCached(QPDFObjGen const& og) | 2051 | +QPDF::isCached(QPDFObjGen og) |
| 2052 | { | 2052 | { |
| 2053 | return m->obj_cache.count(og) != 0; | 2053 | return m->obj_cache.count(og) != 0; |
| 2054 | } | 2054 | } |
| 2055 | 2055 | ||
| 2056 | bool | 2056 | bool |
| 2057 | -QPDF::isUnresolved(QPDFObjGen const& og) | 2057 | +QPDF::isUnresolved(QPDFObjGen og) |
| 2058 | { | 2058 | { |
| 2059 | return !isCached(og) || m->obj_cache[og].object->isUnresolved(); | 2059 | return !isCached(og) || m->obj_cache[og].object->isUnresolved(); |
| 2060 | } | 2060 | } |
| @@ -2152,7 +2152,7 @@ QPDF::getObjectForJSON(int id, int gen) | @@ -2152,7 +2152,7 @@ QPDF::getObjectForJSON(int id, int gen) | ||
| 2152 | } | 2152 | } |
| 2153 | 2153 | ||
| 2154 | QPDFObjectHandle | 2154 | QPDFObjectHandle |
| 2155 | -QPDF::getObject(QPDFObjGen const& og) | 2155 | +QPDF::getObject(QPDFObjGen og) |
| 2156 | { | 2156 | { |
| 2157 | if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) { | 2157 | if (auto it = m->obj_cache.find(og); it != m->obj_cache.end()) { |
| 2158 | return {it->second.object}; | 2158 | return {it->second.object}; |
| @@ -2171,7 +2171,7 @@ QPDF::getObject(int objid, int generation) | @@ -2171,7 +2171,7 @@ QPDF::getObject(int objid, int generation) | ||
| 2171 | } | 2171 | } |
| 2172 | 2172 | ||
| 2173 | QPDFObjectHandle | 2173 | QPDFObjectHandle |
| 2174 | -QPDF::getObjectByObjGen(QPDFObjGen const& og) | 2174 | +QPDF::getObjectByObjGen(QPDFObjGen og) |
| 2175 | { | 2175 | { |
| 2176 | return getObject(og); | 2176 | return getObject(og); |
| 2177 | } | 2177 | } |
| @@ -2189,7 +2189,7 @@ QPDF::replaceObject(int objid, int generation, QPDFObjectHandle oh) | @@ -2189,7 +2189,7 @@ QPDF::replaceObject(int objid, int generation, QPDFObjectHandle oh) | ||
| 2189 | } | 2189 | } |
| 2190 | 2190 | ||
| 2191 | void | 2191 | void |
| 2192 | -QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh) | 2192 | +QPDF::replaceObject(QPDFObjGen og, QPDFObjectHandle oh) |
| 2193 | { | 2193 | { |
| 2194 | if (!oh || (oh.isIndirect() && !(oh.isStream() && oh.getObjGen() == og))) { | 2194 | if (!oh || (oh.isIndirect() && !(oh.isStream() && oh.getObjGen() == og))) { |
| 2195 | QTC::TC("qpdf", "QPDF replaceObject called with indirect object"); | 2195 | QTC::TC("qpdf", "QPDF replaceObject called with indirect object"); |
| @@ -2493,7 +2493,7 @@ QPDF::swapObjects(int objid1, int generation1, int objid2, int generation2) | @@ -2493,7 +2493,7 @@ QPDF::swapObjects(int objid1, int generation1, int objid2, int generation2) | ||
| 2493 | } | 2493 | } |
| 2494 | 2494 | ||
| 2495 | void | 2495 | void |
| 2496 | -QPDF::swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2) | 2496 | +QPDF::swapObjects(QPDFObjGen og1, QPDFObjGen og2) |
| 2497 | { | 2497 | { |
| 2498 | // Force objects to be read from the input source if needed, then swap them in the cache. | 2498 | // Force objects to be read from the input source if needed, then swap them in the cache. |
| 2499 | resolve(og1); | 2499 | resolve(og1); |
| @@ -2727,7 +2727,7 @@ QPDF::pipeStreamData( | @@ -2727,7 +2727,7 @@ QPDF::pipeStreamData( | ||
| 2727 | std::shared_ptr<EncryptionParameters> encp, | 2727 | std::shared_ptr<EncryptionParameters> encp, |
| 2728 | std::shared_ptr<InputSource> file, | 2728 | std::shared_ptr<InputSource> file, |
| 2729 | QPDF& qpdf_for_warning, | 2729 | QPDF& qpdf_for_warning, |
| 2730 | - QPDFObjGen const& og, | 2730 | + QPDFObjGen og, |
| 2731 | qpdf_offset_t offset, | 2731 | qpdf_offset_t offset, |
| 2732 | size_t length, | 2732 | size_t length, |
| 2733 | QPDFObjectHandle stream_dict, | 2733 | QPDFObjectHandle stream_dict, |
| @@ -2789,7 +2789,7 @@ QPDF::pipeStreamData( | @@ -2789,7 +2789,7 @@ QPDF::pipeStreamData( | ||
| 2789 | 2789 | ||
| 2790 | bool | 2790 | bool |
| 2791 | QPDF::pipeStreamData( | 2791 | QPDF::pipeStreamData( |
| 2792 | - QPDFObjGen const& og, | 2792 | + QPDFObjGen og, |
| 2793 | qpdf_offset_t offset, | 2793 | qpdf_offset_t offset, |
| 2794 | size_t length, | 2794 | size_t length, |
| 2795 | QPDFObjectHandle stream_dict, | 2795 | QPDFObjectHandle stream_dict, |
libqpdf/QPDFOutlineDocumentHelper.cc
| @@ -50,7 +50,7 @@ QPDFOutlineDocumentHelper::initializeByPage() | @@ -50,7 +50,7 @@ QPDFOutlineDocumentHelper::initializeByPage() | ||
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | std::vector<QPDFOutlineObjectHelper> | 52 | std::vector<QPDFOutlineObjectHelper> |
| 53 | -QPDFOutlineDocumentHelper::getOutlinesForPage(QPDFObjGen const& og) | 53 | +QPDFOutlineDocumentHelper::getOutlinesForPage(QPDFObjGen og) |
| 54 | { | 54 | { |
| 55 | if (m->by_page.empty()) { | 55 | if (m->by_page.empty()) { |
| 56 | initializeByPage(); | 56 | initializeByPage(); |
libqpdf/QPDFWriter.cc
| @@ -1058,7 +1058,7 @@ QPDFWriter::closeObject(int objid) | @@ -1058,7 +1058,7 @@ QPDFWriter::closeObject(int objid) | ||
| 1058 | } | 1058 | } |
| 1059 | 1059 | ||
| 1060 | void | 1060 | void |
| 1061 | -QPDFWriter::assignCompressedObjectNumbers(QPDFObjGen const& og) | 1061 | +QPDFWriter::assignCompressedObjectNumbers(QPDFObjGen og) |
| 1062 | { | 1062 | { |
| 1063 | int objid = og.getObj(); | 1063 | int objid = og.getObj(); |
| 1064 | if ((og.getGen() != 0) || (m->object_stream_to_objects.count(objid) == 0)) { | 1064 | if ((og.getGen() != 0) || (m->object_stream_to_objects.count(objid) == 0)) { |
libqpdf/QPDF_Unresolved.cc
| @@ -3,13 +3,13 @@ | @@ -3,13 +3,13 @@ | ||
| 3 | #include <qpdf/QPDF.hh> | 3 | #include <qpdf/QPDF.hh> |
| 4 | #include <qpdf/QPDFObject_private.hh> | 4 | #include <qpdf/QPDFObject_private.hh> |
| 5 | 5 | ||
| 6 | -QPDF_Unresolved::QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const& og) : | 6 | +QPDF_Unresolved::QPDF_Unresolved(QPDF* qpdf, QPDFObjGen og) : |
| 7 | QPDFValue(::ot_unresolved, qpdf, og) | 7 | QPDFValue(::ot_unresolved, qpdf, og) |
| 8 | { | 8 | { |
| 9 | } | 9 | } |
| 10 | 10 | ||
| 11 | std::shared_ptr<QPDFObject> | 11 | std::shared_ptr<QPDFObject> |
| 12 | -QPDF_Unresolved::create(QPDF* qpdf, QPDFObjGen const& og) | 12 | +QPDF_Unresolved::create(QPDF* qpdf, QPDFObjGen og) |
| 13 | { | 13 | { |
| 14 | return do_create(new QPDF_Unresolved(qpdf, og)); | 14 | return do_create(new QPDF_Unresolved(qpdf, og)); |
| 15 | } | 15 | } |
libqpdf/QPDF_encryption.cc
| @@ -952,8 +952,7 @@ QPDF::initializeEncryption() | @@ -952,8 +952,7 @@ QPDF::initializeEncryption() | ||
| 952 | } | 952 | } |
| 953 | 953 | ||
| 954 | std::string | 954 | std::string |
| 955 | -QPDF::getKeyForObject( | ||
| 956 | - std::shared_ptr<EncryptionParameters> encp, QPDFObjGen const& og, bool use_aes) | 955 | +QPDF::getKeyForObject(std::shared_ptr<EncryptionParameters> encp, QPDFObjGen og, bool use_aes) |
| 957 | { | 956 | { |
| 958 | if (!encp->encrypted) { | 957 | if (!encp->encrypted) { |
| 959 | throw std::logic_error("request for encryption key in non-encrypted PDF"); | 958 | throw std::logic_error("request for encryption key in non-encrypted PDF"); |
| @@ -974,7 +973,7 @@ QPDF::getKeyForObject( | @@ -974,7 +973,7 @@ QPDF::getKeyForObject( | ||
| 974 | } | 973 | } |
| 975 | 974 | ||
| 976 | void | 975 | void |
| 977 | -QPDF::decryptString(std::string& str, QPDFObjGen const& og) | 976 | +QPDF::decryptString(std::string& str, QPDFObjGen og) |
| 978 | { | 977 | { |
| 979 | if (!og.isIndirect()) { | 978 | if (!og.isIndirect()) { |
| 980 | return; | 979 | return; |
| @@ -1048,7 +1047,7 @@ QPDF::decryptStream( | @@ -1048,7 +1047,7 @@ QPDF::decryptStream( | ||
| 1048 | std::shared_ptr<InputSource> file, | 1047 | std::shared_ptr<InputSource> file, |
| 1049 | QPDF& qpdf_for_warning, | 1048 | QPDF& qpdf_for_warning, |
| 1050 | Pipeline*& pipeline, | 1049 | Pipeline*& pipeline, |
| 1051 | - QPDFObjGen const& og, | 1050 | + QPDFObjGen og, |
| 1052 | QPDFObjectHandle& stream_dict, | 1051 | QPDFObjectHandle& stream_dict, |
| 1053 | std::unique_ptr<Pipeline>& decrypt_pipeline) | 1052 | std::unique_ptr<Pipeline>& decrypt_pipeline) |
| 1054 | { | 1053 | { |
libqpdf/QPDF_linearization.cc
| @@ -557,7 +557,7 @@ QPDF::maxEnd(ObjUser const& ou) | @@ -557,7 +557,7 @@ QPDF::maxEnd(ObjUser const& ou) | ||
| 557 | } | 557 | } |
| 558 | 558 | ||
| 559 | qpdf_offset_t | 559 | qpdf_offset_t |
| 560 | -QPDF::getLinearizationOffset(QPDFObjGen const& og) | 560 | +QPDF::getLinearizationOffset(QPDFObjGen og) |
| 561 | { | 561 | { |
| 562 | QPDFXRefEntry entry = m->xref_table[og]; | 562 | QPDFXRefEntry entry = m->xref_table[og]; |
| 563 | qpdf_offset_t result = 0; | 563 | qpdf_offset_t result = 0; |
libqpdf/QPDF_pages.cc
| @@ -323,7 +323,7 @@ QPDF::findPage(QPDFObjectHandle& page) | @@ -323,7 +323,7 @@ QPDF::findPage(QPDFObjectHandle& page) | ||
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | int | 325 | int |
| 326 | -QPDF::findPage(QPDFObjGen const& og) | 326 | +QPDF::findPage(QPDFObjGen og) |
| 327 | { | 327 | { |
| 328 | flattenPagesTree(); | 328 | flattenPagesTree(); |
| 329 | auto it = m->pageobj_to_pages_pos.find(og); | 329 | auto it = m->pageobj_to_pages_pos.find(og); |
libqpdf/qpdf/QPDFObject_private.hh
| @@ -132,13 +132,13 @@ class QPDFObject | @@ -132,13 +132,13 @@ class QPDFObject | ||
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | void | 134 | void |
| 135 | - setDefaultDescription(QPDF* qpdf, QPDFObjGen const& og) | 135 | + setDefaultDescription(QPDF* qpdf, QPDFObjGen og) |
| 136 | { | 136 | { |
| 137 | // Intended for use by the QPDF class | 137 | // Intended for use by the QPDF class |
| 138 | value->setDefaultDescription(qpdf, og); | 138 | value->setDefaultDescription(qpdf, og); |
| 139 | } | 139 | } |
| 140 | void | 140 | void |
| 141 | - setObjGen(QPDF* qpdf, QPDFObjGen const& og) | 141 | + setObjGen(QPDF* qpdf, QPDFObjGen og) |
| 142 | { | 142 | { |
| 143 | value->qpdf = qpdf; | 143 | value->qpdf = qpdf; |
| 144 | value->og = og; | 144 | value->og = og; |
libqpdf/qpdf/QPDFValue.hh
| @@ -65,7 +65,7 @@ class QPDFValue: public std::enable_shared_from_this<QPDFValue> | @@ -65,7 +65,7 @@ class QPDFValue: public std::enable_shared_from_this<QPDFValue> | ||
| 65 | setParsedOffset(offset); | 65 | setParsedOffset(offset); |
| 66 | } | 66 | } |
| 67 | void | 67 | void |
| 68 | - setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og) | 68 | + setDefaultDescription(QPDF* a_qpdf, QPDFObjGen a_og) |
| 69 | { | 69 | { |
| 70 | qpdf = a_qpdf; | 70 | qpdf = a_qpdf; |
| 71 | og = a_og; | 71 | og = a_og; |
libqpdf/qpdf/QPDF_Unresolved.hh
| @@ -7,14 +7,14 @@ class QPDF_Unresolved: public QPDFValue | @@ -7,14 +7,14 @@ class QPDF_Unresolved: public QPDFValue | ||
| 7 | { | 7 | { |
| 8 | public: | 8 | public: |
| 9 | ~QPDF_Unresolved() override = default; | 9 | ~QPDF_Unresolved() override = default; |
| 10 | - static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen const& og); | 10 | + static std::shared_ptr<QPDFObject> create(QPDF* qpdf, QPDFObjGen og); |
| 11 | std::shared_ptr<QPDFObject> copy(bool shallow = false) override; | 11 | std::shared_ptr<QPDFObject> copy(bool shallow = false) override; |
| 12 | std::string unparse() override; | 12 | std::string unparse() override; |
| 13 | void writeJSON(int json_version, JSON::Writer& p) override; | 13 | void writeJSON(int json_version, JSON::Writer& p) override; |
| 14 | std::string getStringValue() const override; | 14 | std::string getStringValue() const override; |
| 15 | 15 | ||
| 16 | private: | 16 | private: |
| 17 | - QPDF_Unresolved(QPDF* qpdf, QPDFObjGen const& og); | 17 | + QPDF_Unresolved(QPDF* qpdf, QPDFObjGen og); |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | #endif // QPDF_UNRESOLVED_HH | 20 | #endif // QPDF_UNRESOLVED_HH |