Commit f797de7bf1a5d8f42aaa21bd5e72abc63b6cc255

Authored by m-holger
1 parent d1af5099

Refactor: streamline `Stream` dictionary access and simplify `isRootMetadata` logic

libqpdf/QPDF_Stream.cc
@@ -376,11 +376,10 @@ Stream::getRawStreamData() @@ -376,11 +376,10 @@ Stream::getRawStreamData()
376 bool 376 bool
377 Stream::isRootMetadata() const 377 Stream::isRootMetadata() const
378 { 378 {
379 - if (!getDict().isDictionaryOfType("/Metadata", "/XML")) { 379 + if (!stream()->stream_dict.isDictionaryOfType("/Metadata", "/XML")) {
380 return false; 380 return false;
381 } 381 }
382 - auto root_metadata = qpdf()->getRoot().getKey("/Metadata");  
383 - return root_metadata.isSameObjectAs(obj); 382 + return qpdf()->getRoot()["/Metadata"].isSameObjectAs(obj);
384 } 383 }
385 384
386 bool 385 bool
libqpdf/qpdf/QPDFObjectHandle_private.hh
@@ -469,10 +469,10 @@ namespace qpdf @@ -469,10 +469,10 @@ namespace qpdf
469 qpdf_offset_t offset, 469 qpdf_offset_t offset,
470 size_t length); 470 size_t length);
471 471
472 - QPDFObjectHandle 472 + Dictionary
473 getDict() const 473 getDict() const
474 { 474 {
475 - return stream()->stream_dict; 475 + return {stream()->stream_dict};
476 } 476 }
477 bool 477 bool
478 isDataModified() const 478 isDataModified() const