Commit eeb6162f7620fba49bb141ccd2c715cd829c8e24
1 parent
6f1041af
Add optional parameter separator to QPDFObjGen::unparse
Also, revert inlining of unparse and operator << from commit 4c6640c in order to avoid exposing QUtil.
Showing
12 changed files
with
58 additions
and
70 deletions
include/qpdf/QPDFObjGen.hh
| @@ -23,7 +23,6 @@ | @@ -23,7 +23,6 @@ | ||
| 23 | #define QPDFOBJGEN_HH | 23 | #define QPDFOBJGEN_HH |
| 24 | 24 | ||
| 25 | #include <qpdf/DLL.h> | 25 | #include <qpdf/DLL.h> |
| 26 | -#include <qpdf/QUtil.hh> | ||
| 27 | #include <iostream> | 26 | #include <iostream> |
| 28 | 27 | ||
| 29 | // This class represents an object ID and generation pair. It is | 28 | // This class represents an object ID and generation pair. It is |
| @@ -69,18 +68,9 @@ class QPDFObjGen | @@ -69,18 +68,9 @@ class QPDFObjGen | ||
| 69 | return gen; | 68 | return gen; |
| 70 | } | 69 | } |
| 71 | QPDF_DLL | 70 | QPDF_DLL |
| 72 | - std::string | ||
| 73 | - unparse() const | ||
| 74 | - { | ||
| 75 | - return QUtil::int_to_string(obj) + "," + QUtil::int_to_string(gen); | ||
| 76 | - } | 71 | + std::string unparse(char separator = ',') const; |
| 77 | QPDF_DLL | 72 | QPDF_DLL |
| 78 | - friend std::ostream& | ||
| 79 | - operator<<(std::ostream& os, const QPDFObjGen& og) | ||
| 80 | - { | ||
| 81 | - os << og.obj << "," << og.gen; | ||
| 82 | - return os; | ||
| 83 | - } | 73 | + friend std::ostream& operator<<(std::ostream& os, const QPDFObjGen& og); |
| 84 | 74 | ||
| 85 | private: | 75 | private: |
| 86 | // This class does not use the Members pattern to avoid a memory | 76 | // This class does not use the Members pattern to avoid a memory |
include/qpdf/QPDFObjectHandle.hh
| @@ -1584,7 +1584,6 @@ class QPDFObjectHandle | @@ -1584,7 +1584,6 @@ class QPDFObjectHandle | ||
| 1584 | bool stop_at_streams); | 1584 | bool stop_at_streams); |
| 1585 | void shallowCopyInternal(QPDFObjectHandle& oh, bool first_level_only); | 1585 | void shallowCopyInternal(QPDFObjectHandle& oh, bool first_level_only); |
| 1586 | void releaseResolved(); | 1586 | void releaseResolved(); |
| 1587 | - std::string getObjGenAsStr() const; | ||
| 1588 | static void setObjectDescriptionFromInput( | 1587 | static void setObjectDescriptionFromInput( |
| 1589 | QPDFObjectHandle, | 1588 | QPDFObjectHandle, |
| 1590 | QPDF*, | 1589 | QPDF*, |
libqpdf/CMakeLists.txt
| @@ -74,6 +74,7 @@ set(libqpdf_SOURCES | @@ -74,6 +74,7 @@ set(libqpdf_SOURCES | ||
| 74 | QPDFNumberTreeObjectHelper.cc | 74 | QPDFNumberTreeObjectHelper.cc |
| 75 | QPDFObject.cc | 75 | QPDFObject.cc |
| 76 | QPDFObjectHandle.cc | 76 | QPDFObjectHandle.cc |
| 77 | + QPDFObjGen.cc | ||
| 77 | QPDFOutlineDocumentHelper.cc | 78 | QPDFOutlineDocumentHelper.cc |
| 78 | QPDFOutlineObjectHelper.cc | 79 | QPDFOutlineObjectHelper.cc |
| 79 | QPDFPageDocumentHelper.cc | 80 | QPDFPageDocumentHelper.cc |
libqpdf/QPDF.cc
| @@ -1493,9 +1493,8 @@ QPDF::setLastObjectDescription( | @@ -1493,9 +1493,8 @@ QPDF::setLastObjectDescription( | ||
| 1493 | } | 1493 | } |
| 1494 | } | 1494 | } |
| 1495 | if (objid > 0) { | 1495 | if (objid > 0) { |
| 1496 | - this->m->last_object_description += "object " + | ||
| 1497 | - QUtil::int_to_string(objid) + " " + | ||
| 1498 | - QUtil::int_to_string(generation); | 1496 | + this->m->last_object_description += |
| 1497 | + "object " + QPDFObjGen(objid, generation).unparse(' '); | ||
| 1499 | } | 1498 | } |
| 1500 | } | 1499 | } |
| 1501 | 1500 | ||
| @@ -1862,8 +1861,8 @@ QPDF::readObjectAtOffset( | @@ -1862,8 +1861,8 @@ QPDF::readObjectAtOffset( | ||
| 1862 | this->m->file->getName(), | 1861 | this->m->file->getName(), |
| 1863 | this->m->last_object_description, | 1862 | this->m->last_object_description, |
| 1864 | offset, | 1863 | offset, |
| 1865 | - (std::string("expected ") + QUtil::int_to_string(exp_objid) + | ||
| 1866 | - " " + QUtil::int_to_string(exp_generation) + " obj")); | 1864 | + (std::string("expected ") + |
| 1865 | + QPDFObjGen(exp_objid, exp_generation).unparse(' ') + " obj")); | ||
| 1867 | if (try_recovery) { | 1866 | if (try_recovery) { |
| 1868 | // Will be retried below | 1867 | // Will be retried below |
| 1869 | throw e; | 1868 | throw e; |
| @@ -1898,8 +1897,8 @@ QPDF::readObjectAtOffset( | @@ -1898,8 +1897,8 @@ QPDF::readObjectAtOffset( | ||
| 1898 | "", | 1897 | "", |
| 1899 | 0, | 1898 | 0, |
| 1900 | std::string( | 1899 | std::string( |
| 1901 | - "object " + QUtil::int_to_string(exp_objid) + " " + | ||
| 1902 | - QUtil::int_to_string(exp_generation) + | 1900 | + "object " + |
| 1901 | + QPDFObjGen(exp_objid, exp_generation).unparse(' ') + | ||
| 1903 | " not found in file after regenerating" | 1902 | " not found in file after regenerating" |
| 1904 | " cross reference table")); | 1903 | " cross reference table")); |
| 1905 | return QPDFObjectHandle::newNull(); | 1904 | return QPDFObjectHandle::newNull(); |
| @@ -2002,8 +2001,7 @@ QPDF::resolve(int objid, int generation) | @@ -2002,8 +2001,7 @@ QPDF::resolve(int objid, int generation) | ||
| 2002 | qpdf_e_damaged_pdf, | 2001 | qpdf_e_damaged_pdf, |
| 2003 | "", | 2002 | "", |
| 2004 | this->m->file->getLastOffset(), | 2003 | this->m->file->getLastOffset(), |
| 2005 | - ("loop detected resolving object " + QUtil::int_to_string(objid) + | ||
| 2006 | - " " + QUtil::int_to_string(generation))); | 2004 | + ("loop detected resolving object " + og.unparse(' '))); |
| 2007 | return QPDF_Null::create(); | 2005 | return QPDF_Null::create(); |
| 2008 | } | 2006 | } |
| 2009 | ResolveRecorder rr(this, og); | 2007 | ResolveRecorder rr(this, og); |
| @@ -2039,8 +2037,7 @@ QPDF::resolve(int objid, int generation) | @@ -2039,8 +2037,7 @@ QPDF::resolve(int objid, int generation) | ||
| 2039 | this->m->file->getName(), | 2037 | this->m->file->getName(), |
| 2040 | "", | 2038 | "", |
| 2041 | 0, | 2039 | 0, |
| 2042 | - ("object " + QUtil::int_to_string(objid) + "/" + | ||
| 2043 | - QUtil::int_to_string(generation) + | 2040 | + ("object " + og.unparse('/') + |
| 2044 | " has unexpected xref entry type")); | 2041 | " has unexpected xref entry type")); |
| 2045 | } | 2042 | } |
| 2046 | } catch (QPDFExc& e) { | 2043 | } catch (QPDFExc& e) { |
| @@ -2050,8 +2047,7 @@ QPDF::resolve(int objid, int generation) | @@ -2050,8 +2047,7 @@ QPDF::resolve(int objid, int generation) | ||
| 2050 | qpdf_e_damaged_pdf, | 2047 | qpdf_e_damaged_pdf, |
| 2051 | "", | 2048 | "", |
| 2052 | 0, | 2049 | 0, |
| 2053 | - ("object " + QUtil::int_to_string(objid) + "/" + | ||
| 2054 | - QUtil::int_to_string(generation) + | 2050 | + ("object " + og.unparse('/') + |
| 2055 | ": error reading object: " + e.what())); | 2051 | ": error reading object: " + e.what())); |
| 2056 | } | 2052 | } |
| 2057 | } | 2053 | } |
| @@ -2065,10 +2061,7 @@ QPDF::resolve(int objid, int generation) | @@ -2065,10 +2061,7 @@ QPDF::resolve(int objid, int generation) | ||
| 2065 | 2061 | ||
| 2066 | std::shared_ptr<QPDFObject> result(this->m->obj_cache[og].object); | 2062 | std::shared_ptr<QPDFObject> result(this->m->obj_cache[og].object); |
| 2067 | if (!result->hasDescription()) { | 2063 | if (!result->hasDescription()) { |
| 2068 | - result->setDescription( | ||
| 2069 | - this, | ||
| 2070 | - ("object " + QUtil::int_to_string(objid) + " " + | ||
| 2071 | - QUtil::int_to_string(generation))); | 2064 | + result->setDescription(this, ("object " + og.unparse(' '))); |
| 2072 | } | 2065 | } |
| 2073 | return result; | 2066 | return result; |
| 2074 | } | 2067 | } |
| @@ -2809,8 +2802,8 @@ QPDF::pipeStreamData( | @@ -2809,8 +2802,8 @@ QPDF::pipeStreamData( | ||
| 2809 | "", | 2802 | "", |
| 2810 | file->getLastOffset(), | 2803 | file->getLastOffset(), |
| 2811 | ("error decoding stream data for object " + | 2804 | ("error decoding stream data for object " + |
| 2812 | - QUtil::int_to_string(objid) + " " + | ||
| 2813 | - QUtil::int_to_string(generation) + ": " + e.what()))); | 2805 | + QPDFObjGen(objid, generation).unparse(' ') + ": " + |
| 2806 | + e.what()))); | ||
| 2814 | if (will_retry) { | 2807 | if (will_retry) { |
| 2815 | qpdf_for_warning.warn( | 2808 | qpdf_for_warning.warn( |
| 2816 | // line-break | 2809 | // line-break |
libqpdf/QPDFAcroFormDocumentHelper.cc
| @@ -991,8 +991,8 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -991,8 +991,8 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 991 | } else { | 991 | } else { |
| 992 | parent.warnIfPossible( | 992 | parent.warnIfPossible( |
| 993 | "while traversing field " + | 993 | "while traversing field " + |
| 994 | - obj.getObjGen().unparse() + ", found parent (" + | ||
| 995 | - parent_og.unparse() + | 994 | + obj.getObjGen().unparse(',') + ", found parent (" + |
| 995 | + parent_og.unparse(',') + | ||
| 996 | ") that had not been seen, indicating likely" | 996 | ") that had not been seen, indicating likely" |
| 997 | " invalid field structure"); | 997 | " invalid field structure"); |
| 998 | } | 998 | } |
libqpdf/QPDFJob.cc
| @@ -947,7 +947,7 @@ QPDFJob::doShowObj(QPDF& pdf) | @@ -947,7 +947,7 @@ QPDFJob::doShowObj(QPDF& pdf) | ||
| 947 | } | 947 | } |
| 948 | if (error) { | 948 | if (error) { |
| 949 | throw std::runtime_error( | 949 | throw std::runtime_error( |
| 950 | - "unable to get object " + obj.getObjGen().unparse()); | 950 | + "unable to get object " + obj.getObjGen().unparse(',')); |
| 951 | } | 951 | } |
| 952 | } | 952 | } |
| 953 | 953 | ||
| @@ -995,7 +995,8 @@ QPDFJob::doListAttachments(QPDF& pdf) | @@ -995,7 +995,8 @@ QPDFJob::doListAttachments(QPDF& pdf) | ||
| 995 | auto efoh = i.second; | 995 | auto efoh = i.second; |
| 996 | *this->m->log->getInfo() | 996 | *this->m->log->getInfo() |
| 997 | << key << " -> " | 997 | << key << " -> " |
| 998 | - << efoh->getEmbeddedFileStream().getObjGen().unparse() << "\n"; | 998 | + << efoh->getEmbeddedFileStream().getObjGen().unparse(',') |
| 999 | + << "\n"; | ||
| 999 | doIfVerbose([&](Pipeline& v, std::string const& prefix) { | 1000 | doIfVerbose([&](Pipeline& v, std::string const& prefix) { |
| 1000 | auto desc = efoh->getDescription(); | 1001 | auto desc = efoh->getDescription(); |
| 1001 | if (!desc.empty()) { | 1002 | if (!desc.empty()) { |
| @@ -1010,7 +1011,7 @@ QPDFJob::doListAttachments(QPDF& pdf) | @@ -1010,7 +1011,7 @@ QPDFJob::doListAttachments(QPDF& pdf) | ||
| 1010 | for (auto i2: efoh->getEmbeddedFileStreams().ditems()) { | 1011 | for (auto i2: efoh->getEmbeddedFileStreams().ditems()) { |
| 1011 | auto efs = QPDFEFStreamObjectHelper(i2.second); | 1012 | auto efs = QPDFEFStreamObjectHelper(i2.second); |
| 1012 | v << " " << i2.first << " -> " | 1013 | v << " " << i2.first << " -> " |
| 1013 | - << efs.getObjectHandle().getObjGen().unparse() << "\n"; | 1014 | + << efs.getObjectHandle().getObjGen().unparse(',') << "\n"; |
| 1014 | v << " creation date: " << efs.getCreationDate() | 1015 | v << " creation date: " << efs.getCreationDate() |
| 1015 | << "\n" | 1016 | << "\n" |
| 1016 | << " modification date: " << efs.getModDate() << "\n" | 1017 | << " modification date: " << efs.getModDate() << "\n" |
libqpdf/QPDFObjGen.cc
0 โ 100644
| 1 | +#include <qpdf/QPDFObjGen.hh> | ||
| 2 | + | ||
| 3 | +#include <qpdf/QUtil.hh> | ||
| 4 | + | ||
| 5 | +std::ostream& | ||
| 6 | +operator<<(std::ostream& os, const QPDFObjGen& og) | ||
| 7 | +{ | ||
| 8 | + os << og.obj << "," << og.gen; | ||
| 9 | + return os; | ||
| 10 | +} | ||
| 11 | + | ||
| 12 | +std::string | ||
| 13 | +QPDFObjGen::unparse(char separator) const | ||
| 14 | +{ | ||
| 15 | + return QUtil::int_to_string(this->obj) + separator + | ||
| 16 | + QUtil::int_to_string(this->gen); | ||
| 17 | +} |
libqpdf/QPDFObjectHandle.cc
| @@ -103,9 +103,8 @@ void | @@ -103,9 +103,8 @@ void | ||
| 103 | CoalesceProvider::provideStreamData(int, int, Pipeline* p) | 103 | CoalesceProvider::provideStreamData(int, int, Pipeline* p) |
| 104 | { | 104 | { |
| 105 | QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data"); | 105 | QTC::TC("qpdf", "QPDFObjectHandle coalesce provide stream data"); |
| 106 | - std::string description = "page object " + | ||
| 107 | - QUtil::int_to_string(containing_page.getObjectID()) + " " + | ||
| 108 | - QUtil::int_to_string(containing_page.getGeneration()); | 106 | + std::string description = |
| 107 | + "page object " + containing_page.getObjGen().unparse(' '); | ||
| 109 | std::string all_description; | 108 | std::string all_description; |
| 110 | old_contents.pipeContentStreams(p, description, all_description); | 109 | old_contents.pipeContentStreams(p, description, all_description); |
| 111 | } | 110 | } |
| @@ -1485,13 +1484,6 @@ QPDFObjectHandle::getObjGen() const | @@ -1485,13 +1484,6 @@ QPDFObjectHandle::getObjGen() const | ||
| 1485 | return QPDFObjGen(this->objid, this->generation); | 1484 | return QPDFObjGen(this->objid, this->generation); |
| 1486 | } | 1485 | } |
| 1487 | 1486 | ||
| 1488 | -std::string | ||
| 1489 | -QPDFObjectHandle::getObjGenAsStr() const | ||
| 1490 | -{ | ||
| 1491 | - return QUtil::int_to_string(this->objid) + " " + | ||
| 1492 | - QUtil::int_to_string(this->generation); | ||
| 1493 | -} | ||
| 1494 | - | ||
| 1495 | int | 1487 | int |
| 1496 | QPDFObjectHandle::getObjectID() const | 1488 | QPDFObjectHandle::getObjectID() const |
| 1497 | { | 1489 | { |
| @@ -1556,7 +1548,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray( | @@ -1556,7 +1548,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray( | ||
| 1556 | } else { | 1548 | } else { |
| 1557 | all_description += ","; | 1549 | all_description += ","; |
| 1558 | } | 1550 | } |
| 1559 | - all_description += " stream " + item.getObjGenAsStr(); | 1551 | + all_description += " stream " + item.getObjGen().unparse(' '); |
| 1560 | } | 1552 | } |
| 1561 | 1553 | ||
| 1562 | return result; | 1554 | return result; |
| @@ -1565,7 +1557,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray( | @@ -1565,7 +1557,7 @@ QPDFObjectHandle::arrayOrStreamToStreamArray( | ||
| 1565 | std::vector<QPDFObjectHandle> | 1557 | std::vector<QPDFObjectHandle> |
| 1566 | QPDFObjectHandle::getPageContents() | 1558 | QPDFObjectHandle::getPageContents() |
| 1567 | { | 1559 | { |
| 1568 | - std::string description = "page object " + getObjGenAsStr(); | 1560 | + std::string description = "page object " + getObjGen().unparse(' '); |
| 1569 | std::string all_description; | 1561 | std::string all_description; |
| 1570 | return this->getKey("/Contents") | 1562 | return this->getKey("/Contents") |
| 1571 | .arrayOrStreamToStreamArray(description, all_description); | 1563 | .arrayOrStreamToStreamArray(description, all_description); |
| @@ -1674,7 +1666,7 @@ QPDFObjectHandle::unparse() | @@ -1674,7 +1666,7 @@ QPDFObjectHandle::unparse() | ||
| 1674 | { | 1666 | { |
| 1675 | std::string result; | 1667 | std::string result; |
| 1676 | if (this->isIndirect()) { | 1668 | if (this->isIndirect()) { |
| 1677 | - result = getObjGenAsStr() + " R"; | 1669 | + result = getObjGen().unparse(' ') + " R"; |
| 1678 | } else { | 1670 | } else { |
| 1679 | result = unparseResolved(); | 1671 | result = unparseResolved(); |
| 1680 | } | 1672 | } |
| @@ -1789,7 +1781,7 @@ QPDFObjectHandle::parse( | @@ -1789,7 +1781,7 @@ QPDFObjectHandle::parse( | ||
| 1789 | void | 1781 | void |
| 1790 | QPDFObjectHandle::pipePageContents(Pipeline* p) | 1782 | QPDFObjectHandle::pipePageContents(Pipeline* p) |
| 1791 | { | 1783 | { |
| 1792 | - std::string description = "page object " + getObjGenAsStr(); | 1784 | + std::string description = "page object " + getObjGen().unparse(' '); |
| 1793 | std::string all_description; | 1785 | std::string all_description; |
| 1794 | this->getKey("/Contents") | 1786 | this->getKey("/Contents") |
| 1795 | .pipeContentStreams(p, description, all_description); | 1787 | .pipeContentStreams(p, description, all_description); |
| @@ -1813,7 +1805,7 @@ QPDFObjectHandle::pipeContentStreams( | @@ -1813,7 +1805,7 @@ QPDFObjectHandle::pipeContentStreams( | ||
| 1813 | throw QPDFExc( | 1805 | throw QPDFExc( |
| 1814 | qpdf_e_damaged_pdf, | 1806 | qpdf_e_damaged_pdf, |
| 1815 | "content stream", | 1807 | "content stream", |
| 1816 | - "content stream object " + stream.getObjGenAsStr(), | 1808 | + "content stream object " + stream.getObjGen().unparse(' '), |
| 1817 | 0, | 1809 | 0, |
| 1818 | "errors while decoding content stream"); | 1810 | "errors while decoding content stream"); |
| 1819 | } | 1811 | } |
| @@ -1829,7 +1821,7 @@ QPDFObjectHandle::pipeContentStreams( | @@ -1829,7 +1821,7 @@ QPDFObjectHandle::pipeContentStreams( | ||
| 1829 | void | 1821 | void |
| 1830 | QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) | 1822 | QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) |
| 1831 | { | 1823 | { |
| 1832 | - std::string description = "page object " + getObjGenAsStr(); | 1824 | + std::string description = "page object " + getObjGen().unparse(' '); |
| 1833 | this->getKey("/Contents") | 1825 | this->getKey("/Contents") |
| 1834 | .parseContentStream_internal(description, callbacks); | 1826 | .parseContentStream_internal(description, callbacks); |
| 1835 | } | 1827 | } |
| @@ -1837,14 +1829,15 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) | @@ -1837,14 +1829,15 @@ QPDFObjectHandle::parsePageContents(ParserCallbacks* callbacks) | ||
| 1837 | void | 1829 | void |
| 1838 | QPDFObjectHandle::parseAsContents(ParserCallbacks* callbacks) | 1830 | QPDFObjectHandle::parseAsContents(ParserCallbacks* callbacks) |
| 1839 | { | 1831 | { |
| 1840 | - std::string description = "object " + getObjGenAsStr(); | 1832 | + std::string description = "object " + getObjGen().unparse(' '); |
| 1841 | this->parseContentStream_internal(description, callbacks); | 1833 | this->parseContentStream_internal(description, callbacks); |
| 1842 | } | 1834 | } |
| 1843 | 1835 | ||
| 1844 | void | 1836 | void |
| 1845 | QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) | 1837 | QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) |
| 1846 | { | 1838 | { |
| 1847 | - auto description = "token filter for page object " + getObjGenAsStr(); | 1839 | + auto description = |
| 1840 | + "token filter for page object " + getObjGen().unparse(' '); | ||
| 1848 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); | 1841 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1849 | this->pipePageContents(&token_pipeline); | 1842 | this->pipePageContents(&token_pipeline); |
| 1850 | } | 1843 | } |
| @@ -1852,7 +1845,7 @@ QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) | @@ -1852,7 +1845,7 @@ QPDFObjectHandle::filterPageContents(TokenFilter* filter, Pipeline* next) | ||
| 1852 | void | 1845 | void |
| 1853 | QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next) | 1846 | QPDFObjectHandle::filterAsContents(TokenFilter* filter, Pipeline* next) |
| 1854 | { | 1847 | { |
| 1855 | - auto description = "token filter for object " + getObjGenAsStr(); | 1848 | + auto description = "token filter for object " + getObjGen().unparse(' '); |
| 1856 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); | 1849 | Pl_QPDFTokenizer token_pipeline(description.c_str(), filter, next); |
| 1857 | this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); | 1850 | this->pipeStreamData(&token_pipeline, 0, qpdf_dl_specialized); |
| 1858 | } | 1851 | } |
libqpdf/QPDFPageObjectHelper.cc
| @@ -33,9 +33,8 @@ void | @@ -33,9 +33,8 @@ void | ||
| 33 | ContentProvider::provideStreamData(int, int, Pipeline* p) | 33 | ContentProvider::provideStreamData(int, int, Pipeline* p) |
| 34 | { | 34 | { |
| 35 | Pl_Concatenate concat("concatenate", p); | 35 | Pl_Concatenate concat("concatenate", p); |
| 36 | - std::string description = "contents from page object " + | ||
| 37 | - QUtil::int_to_string(from_page.getObjectID()) + " " + | ||
| 38 | - QUtil::int_to_string(from_page.getGeneration()); | 36 | + std::string description = |
| 37 | + "contents from page object " + from_page.getObjGen().unparse(' '); | ||
| 39 | std::string all_description; | 38 | std::string all_description; |
| 40 | from_page.getKey("/Contents") | 39 | from_page.getKey("/Contents") |
| 41 | .pipeContentStreams(&concat, description, all_description); | 40 | .pipeContentStreams(&concat, description, all_description); |
libqpdf/QPDFWriter.cc
| @@ -1990,9 +1990,8 @@ QPDFWriter::writeObject(QPDFObjectHandle object, int object_stream_index) | @@ -1990,9 +1990,8 @@ QPDFWriter::writeObject(QPDFObjectHandle object, int object_stream_index) | ||
| 1990 | if (object_stream_index == -1) { | 1990 | if (object_stream_index == -1) { |
| 1991 | if (this->m->qdf_mode && (!this->m->suppress_original_object_ids)) { | 1991 | if (this->m->qdf_mode && (!this->m->suppress_original_object_ids)) { |
| 1992 | writeString( | 1992 | writeString( |
| 1993 | - "%% Original object ID: " + | ||
| 1994 | - QUtil::int_to_string(object.getObjectID()) + " " + | ||
| 1995 | - QUtil::int_to_string(object.getGeneration()) + "\n"); | 1993 | + "%% Original object ID: " + object.getObjGen().unparse(' ') + |
| 1994 | + "\n"); | ||
| 1996 | } | 1995 | } |
| 1997 | openObject(new_id); | 1996 | openObject(new_id); |
| 1998 | setDataKey(new_id); | 1997 | setDataKey(new_id); |
libqpdf/QPDF_Stream.cc
| @@ -130,8 +130,7 @@ QPDF_Stream::QPDF_Stream( | @@ -130,8 +130,7 @@ QPDF_Stream::QPDF_Stream( | ||
| 130 | setDescription( | 130 | setDescription( |
| 131 | this->qpdf, | 131 | this->qpdf, |
| 132 | this->qpdf->getFilename() + ", stream object " + | 132 | this->qpdf->getFilename() + ", stream object " + |
| 133 | - QUtil::int_to_string(this->objid) + " " + | ||
| 134 | - QUtil::int_to_string(this->generation)); | 133 | + QPDFObjGen(objid, generation).unparse(' ')); |
| 135 | } | 134 | } |
| 136 | 135 | ||
| 137 | std::shared_ptr<QPDFObject> | 136 | std::shared_ptr<QPDFObject> |
| @@ -196,8 +195,7 @@ std::string | @@ -196,8 +195,7 @@ std::string | ||
| 196 | QPDF_Stream::unparse() | 195 | QPDF_Stream::unparse() |
| 197 | { | 196 | { |
| 198 | // Unparse stream objects as indirect references | 197 | // Unparse stream objects as indirect references |
| 199 | - return QUtil::int_to_string(this->objid) + " " + | ||
| 200 | - QUtil::int_to_string(this->generation) + " R"; | 198 | + return QPDFObjGen(objid, generation).unparse(' ') + " R"; |
| 201 | } | 199 | } |
| 202 | 200 | ||
| 203 | JSON | 201 | JSON |
| @@ -643,8 +641,7 @@ QPDF_Stream::pipeStreamData( | @@ -643,8 +641,7 @@ QPDF_Stream::pipeStreamData( | ||
| 643 | // part of a library user, not by invalid input data. | 641 | // part of a library user, not by invalid input data. |
| 644 | throw std::runtime_error( | 642 | throw std::runtime_error( |
| 645 | "stream data provider for " + | 643 | "stream data provider for " + |
| 646 | - QUtil::int_to_string(this->objid) + " " + | ||
| 647 | - QUtil::int_to_string(this->generation) + " provided " + | 644 | + QPDFObjGen(objid, generation).unparse(' ') + " provided " + |
| 648 | QUtil::int_to_string(actual_length) + | 645 | QUtil::int_to_string(actual_length) + |
| 649 | " bytes instead of expected " + | 646 | " bytes instead of expected " + |
| 650 | QUtil::int_to_string(desired_length) + " bytes"); | 647 | QUtil::int_to_string(desired_length) + " bytes"); |
libqpdf/QPDF_encryption.cc
| @@ -1176,8 +1176,7 @@ QPDF::decryptString(std::string& str, int objid, int generation) | @@ -1176,8 +1176,7 @@ QPDF::decryptString(std::string& str, int objid, int generation) | ||
| 1176 | this->m->last_object_description, | 1176 | this->m->last_object_description, |
| 1177 | this->m->file->getLastOffset(), | 1177 | this->m->file->getLastOffset(), |
| 1178 | "error decrypting string for object " + | 1178 | "error decrypting string for object " + |
| 1179 | - QUtil::int_to_string(objid) + " " + | ||
| 1180 | - QUtil::int_to_string(generation) + ": " + e.what()); | 1179 | + QPDFObjGen(objid, generation).unparse() + ": " + e.what()); |
| 1181 | } | 1180 | } |
| 1182 | } | 1181 | } |
| 1183 | 1182 |