Commit c833c25499257662ab3bad8083989283fdbe0736

Authored by m-holger
Committed by Jay Berkenbilt
1 parent e684d816

Delay adding ObjGen to object descriptions until necessary

Showing 1 changed file with 6 additions and 2 deletions
libqpdf/qpdf/QPDFValue.hh
@@ -36,9 +36,10 @@ class QPDFValue @@ -36,9 +36,10 @@ class QPDFValue
36 void 36 void
37 setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og) 37 setDefaultDescription(QPDF* a_qpdf, QPDFObjGen const& a_og)
38 { 38 {
  39 + static auto default_description{
  40 + std::make_shared<std::string>("object $OG")};
39 if (!object_description) { 41 if (!object_description) {
40 - object_description =  
41 - std::make_shared<std::string>("object " + a_og.unparse(' ')); 42 + object_description = default_description;
42 } 43 }
43 qpdf = a_qpdf; 44 qpdf = a_qpdf;
44 og = a_og; 45 og = a_og;
@@ -48,6 +49,9 @@ class QPDFValue @@ -48,6 +49,9 @@ class QPDFValue
48 { 49 {
49 qpdf_p = qpdf; 50 qpdf_p = qpdf;
50 description = object_description ? *object_description : ""; 51 description = object_description ? *object_description : "";
  52 + if (auto pos = description.find("$OG"); pos != std::string::npos) {
  53 + description.replace(pos, 3, og.unparse(' '));
  54 + }
51 return qpdf != nullptr; 55 return qpdf != nullptr;
52 } 56 }
53 bool 57 bool