Commit c63fb86c01c5635a3e7f28c3b66de7cf908ef6d6
Committed by
Jay Berkenbilt
1 parent
cb0a6be9
Inline call to QPDFObjectHandle::parse in QPDF::readObject
Showing
2 changed files
with
7 additions
and
9 deletions
include/qpdf/QPDFObjectHandle.hh
| @@ -455,7 +455,7 @@ class QPDFObjectHandle | @@ -455,7 +455,7 @@ class QPDFObjectHandle | ||
| 455 | // Construct an object as above by reading from the given | 455 | // Construct an object as above by reading from the given |
| 456 | // InputSource at its current position and using the tokenizer you | 456 | // InputSource at its current position and using the tokenizer you |
| 457 | // supply. Indirect objects and encrypted strings are permitted. | 457 | // supply. Indirect objects and encrypted strings are permitted. |
| 458 | - // This method is intended to be called by QPDF for parsing | 458 | + // This method was intended to be called by QPDF for parsing |
| 459 | // objects that are ready from the object's input stream. | 459 | // objects that are ready from the object's input stream. |
| 460 | QPDF_DLL | 460 | QPDF_DLL |
| 461 | static QPDFObjectHandle parse( | 461 | static QPDFObjectHandle parse( |
libqpdf/QPDF.cc
| @@ -22,6 +22,7 @@ | @@ -22,6 +22,7 @@ | ||
| 22 | #include <qpdf/QPDFExc.hh> | 22 | #include <qpdf/QPDFExc.hh> |
| 23 | #include <qpdf/QPDFLogger.hh> | 23 | #include <qpdf/QPDFLogger.hh> |
| 24 | #include <qpdf/QPDFObject_private.hh> | 24 | #include <qpdf/QPDFObject_private.hh> |
| 25 | +#include <qpdf/QPDFParser.hh> | ||
| 25 | #include <qpdf/QPDF_Array.hh> | 26 | #include <qpdf/QPDF_Array.hh> |
| 26 | #include <qpdf/QPDF_Dictionary.hh> | 27 | #include <qpdf/QPDF_Dictionary.hh> |
| 27 | #include <qpdf/QPDF_Null.hh> | 28 | #include <qpdf/QPDF_Null.hh> |
| @@ -530,7 +531,7 @@ void | @@ -530,7 +531,7 @@ void | ||
| 530 | QPDF::inParse(bool v) | 531 | QPDF::inParse(bool v) |
| 531 | { | 532 | { |
| 532 | if (this->m->in_parse == v) { | 533 | if (this->m->in_parse == v) { |
| 533 | - // This happens of QPDFObjectHandle::parseInternal tries to | 534 | + // This happens if QPDFParser::parse tries to |
| 534 | // resolve an indirect object while it is parsing. | 535 | // resolve an indirect object while it is parsing. |
| 535 | throw std::logic_error( | 536 | throw std::logic_error( |
| 536 | "QPDF: re-entrant parsing detected. This is a qpdf bug." | 537 | "QPDF: re-entrant parsing detected. This is a qpdf bug." |
| @@ -1413,13 +1414,10 @@ QPDF::readObject( | @@ -1413,13 +1414,10 @@ QPDF::readObject( | ||
| 1413 | decrypter_ph = std::make_shared<StringDecrypter>(this, og); | 1414 | decrypter_ph = std::make_shared<StringDecrypter>(this, og); |
| 1414 | decrypter = decrypter_ph.get(); | 1415 | decrypter = decrypter_ph.get(); |
| 1415 | } | 1416 | } |
| 1416 | - QPDFObjectHandle object = QPDFObjectHandle::parse( | ||
| 1417 | - input, | ||
| 1418 | - this->m->last_object_description, | ||
| 1419 | - this->m->tokenizer, | ||
| 1420 | - empty, | ||
| 1421 | - decrypter, | ||
| 1422 | - this); | 1417 | + auto object = |
| 1418 | + QPDFParser( | ||
| 1419 | + input, m->last_object_description, m->tokenizer, decrypter, this) | ||
| 1420 | + .parse(empty, false); | ||
| 1423 | if (empty) { | 1421 | if (empty) { |
| 1424 | // Nothing in the PDF spec appears to allow empty objects, but | 1422 | // Nothing in the PDF spec appears to allow empty objects, but |
| 1425 | // they have been encountered in actual PDF files and Adobe | 1423 | // they have been encountered in actual PDF files and Adobe |