Commit ae6e484e23e4f11878689be32bfcc6a28259b708

Authored by m-holger
1 parent 356b582c

Change return type of QPDF::resolve to void

include/qpdf/QPDF.hh
@@ -846,10 +846,10 @@ class QPDF @@ -846,10 +846,10 @@ class QPDF
846 friend class QPDFObjectHandle; 846 friend class QPDFObjectHandle;
847 847
848 private: 848 private:
849 - static std::shared_ptr<QPDFObject> 849 + static void
850 resolve(QPDF* qpdf, QPDFObjGen const& og) 850 resolve(QPDF* qpdf, QPDFObjGen const& og)
851 { 851 {
852 - return qpdf->resolve(og); 852 + qpdf->resolve(og);
853 } 853 }
854 }; 854 };
855 friend class Resolver; 855 friend class Resolver;
@@ -1168,7 +1168,7 @@ class QPDF @@ -1168,7 +1168,7 @@ class QPDF
1168 std::string const& description, 1168 std::string const& description,
1169 QPDFObjGen const& exp_og, 1169 QPDFObjGen const& exp_og,
1170 QPDFObjGen& og); 1170 QPDFObjGen& og);
1171 - std::shared_ptr<QPDFObject> resolve(QPDFObjGen const& og); 1171 + void resolve(QPDFObjGen const& og);
1172 void resolveObjectsInStream(int obj_stream_number); 1172 void resolveObjectsInStream(int obj_stream_number);
1173 void stopOnError(std::string const& message); 1173 void stopOnError(std::string const& message);
1174 QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og); 1174 QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og);
libqpdf/QPDF.cc
@@ -1926,12 +1926,12 @@ QPDF::readObjectAtOffset( @@ -1926,12 +1926,12 @@ QPDF::readObjectAtOffset(
1926 return oh; 1926 return oh;
1927 } 1927 }
1928 1928
1929 -std::shared_ptr<QPDFObject> 1929 +void
1930 QPDF::resolve(QPDFObjGen const& og) 1930 QPDF::resolve(QPDFObjGen const& og)
1931 { 1931 {
1932 if (isCached(og) && !isUnresolved(og)) { 1932 if (isCached(og) && !isUnresolved(og)) {
1933 // We only need to resolve unresolved objects 1933 // We only need to resolve unresolved objects
1934 - return m->obj_cache[og].object; 1934 + return;
1935 } 1935 }
1936 1936
1937 // Check object cache before checking xref table. This allows us 1937 // Check object cache before checking xref table. This allows us
@@ -1947,9 +1947,8 @@ QPDF::resolve(QPDFObjGen const&amp; og) @@ -1947,9 +1947,8 @@ QPDF::resolve(QPDFObjGen const&amp; og)
1947 "", 1947 "",
1948 this->m->file->getLastOffset(), 1948 this->m->file->getLastOffset(),
1949 ("loop detected resolving object " + og.unparse(' '))); 1949 ("loop detected resolving object " + og.unparse(' ')));
1950 -  
1951 updateCache(og, QPDF_Null::create(), -1, -1); 1950 updateCache(og, QPDF_Null::create(), -1, -1);
1952 - return m->obj_cache[og].object; 1951 + return;
1953 } 1952 }
1954 ResolveRecorder rr(this, og); 1953 ResolveRecorder rr(this, og);
1955 1954
@@ -1998,11 +1997,10 @@ QPDF::resolve(QPDFObjGen const&amp; og) @@ -1998,11 +1997,10 @@ QPDF::resolve(QPDFObjGen const&amp; og)
1998 updateCache(og, QPDF_Null::create(), -1, -1); 1997 updateCache(og, QPDF_Null::create(), -1, -1);
1999 } 1998 }
2000 1999
2001 - std::shared_ptr<QPDFObject> result(this->m->obj_cache[og].object); 2000 + auto result(this->m->obj_cache[og].object);
2002 if (!result->hasDescription()) { 2001 if (!result->hasDescription()) {
2003 result->setDescription(this, ("object " + og.unparse(' '))); 2002 result->setDescription(this, ("object " + og.unparse(' ')));
2004 } 2003 }
2005 - return result;  
2006 } 2004 }
2007 2005
2008 void 2006 void
libqpdf/QPDFObjectHandle.cc
@@ -2596,7 +2596,7 @@ QPDFObjectHandle::dereference() @@ -2596,7 +2596,7 @@ QPDFObjectHandle::dereference()
2596 return false; 2596 return false;
2597 } 2597 }
2598 if (this->obj->isUnresolved()) { 2598 if (this->obj->isUnresolved()) {
2599 - this->obj = QPDF::Resolver::resolve(this->qpdf, getObjGen()); 2599 + QPDF::Resolver::resolve(this->qpdf, getObjGen());
2600 } 2600 }
2601 return true; 2601 return true;
2602 } 2602 }