Commit a0b1a181725721fe330c9b9abc6c16f93d28ac4d

Authored by Jay Berkenbilt
1 parent c5f61fcb

Remove redundant function calls

Showing 1 changed file with 3 additions and 9 deletions
libqpdf/QPDF.cc
@@ -1942,8 +1942,7 @@ QPDF::readObjectAtOffset( @@ -1942,8 +1942,7 @@ QPDF::readObjectAtOffset(
1942 void 1942 void
1943 QPDF::resolve(QPDFObjGen const& og) 1943 QPDF::resolve(QPDFObjGen const& og)
1944 { 1944 {
1945 - if (isCached(og) && !isUnresolved(og)) {  
1946 - // We only need to resolve unresolved objects 1945 + if (!isUnresolved(og)) {
1947 return; 1946 return;
1948 } 1947 }
1949 1948
@@ -2173,9 +2172,8 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh) @@ -2173,9 +2172,8 @@ QPDF::makeIndirectObject(QPDFObjectHandle oh)
2173 QPDFObjectHandle 2172 QPDFObjectHandle
2174 QPDF::reserveObjectIfNotExists(QPDFObjGen const& og) 2173 QPDF::reserveObjectIfNotExists(QPDFObjGen const& og)
2175 { 2174 {
2176 - if (!isCached(og) && !m->xref_table.count(og)) {  
2177 - resolve(og);  
2178 - m->obj_cache[og].object = QPDF_Reserved::create(); 2175 + if (!isCached(og) && m->xref_table.count(og) == 0) {
  2176 + updateCache(og, QPDF_Reserved::create(), -1, -1);
2179 return newIndirect(og, m->obj_cache[og].object); 2177 return newIndirect(og, m->obj_cache[og].object);
2180 } else { 2178 } else {
2181 return getObject(og); 2179 return getObject(og);
@@ -2233,10 +2231,6 @@ QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh) @@ -2233,10 +2231,6 @@ QPDF::replaceObject(QPDFObjGen const& og, QPDFObjectHandle oh)
2233 throw std::logic_error( 2231 throw std::logic_error(
2234 "QPDF::replaceObject called with indirect object handle"); 2232 "QPDF::replaceObject called with indirect object handle");
2235 } 2233 }
2236 - // Force new object to appear in the cache  
2237 - resolve(og);  
2238 -  
2239 - // Replace the object in the object cache  
2240 updateCache(og, QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1); 2234 updateCache(og, QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);
2241 } 2235 }
2242 2236