Commit a4b8705014a0b86c7da42b4a5cdfdb23f5f5b144
Committed by
GitHub
Merge pull request #1393 from m-holger/hk
Minor code tidy and update .git-blame-ignore-revs
Showing
15 changed files
with
289 additions
and
283 deletions
.git-blame-ignore-revs
| @@ -12,11 +12,59 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb | @@ -12,11 +12,59 @@ d740c6ccced02147f84a39d5e5f0984d12bac6cb | ||
| 12 | # Switch line length from 80 to 100 columns | 12 | # Switch line length from 80 to 100 columns |
| 13 | 6b077332d38c093de2618d5e1481b42222106065 | 13 | 6b077332d38c093de2618d5e1481b42222106065 |
| 14 | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 | 14 | 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 |
| 15 | -# Reflow comments and strings to 100 columns | 15 | +# Reflow comments and strings |
| 16 | 698a70e6a84cf7c0db667e9d9e021b4c34c85a3e | 16 | 698a70e6a84cf7c0db667e9d9e021b4c34c85a3e |
| 17 | 3c5700c255f4603b5df9c6d183d13dd71a083cc3 | 17 | 3c5700c255f4603b5df9c6d183d13dd71a083cc3 |
| 18 | 9ae7bdea966102f9621b22192747a891078e7470 | 18 | 9ae7bdea966102f9621b22192747a891078e7470 |
| 19 | +a9b5ebef1f19ae50deee68401dd090c0f5587400 | ||
| 19 | # Normalize white space in ChangeLog | 20 | # Normalize white space in ChangeLog |
| 20 | d7b909f97d3effc9540c35b0251bdf1c9abf187c | 21 | d7b909f97d3effc9540c35b0251bdf1c9abf187c |
| 22 | +# Revert PRs 1272, 1289, 1297, 1301 | ||
| 23 | +0d5c57c151a35be81b98eef6051303301d253112 | ||
| 24 | +f1800410b6c1f1510890b97fe5e8ce962b69ac94 | ||
| 25 | +efb2e8f613511616744eb16aafc8f7138cd821a1 | ||
| 26 | +4bf09ff1cdda1eed496f2e670ef803175b7fed1e | ||
| 27 | +# PR 1301 | ||
| 28 | +54cf0e519c49e3fb44c7ca1de95a1fffbafc211c | ||
| 29 | +1eb5df92f49111e2ef1b9d0d8f12b849720b08c6 | ||
| 30 | +# PR 1297 | ||
| 31 | +c648b9a018105a3c30b3e7f3c5f8a058d3ddd92c | ||
| 32 | +acc57ca09095d5e6247893a54d94e99ba2304c52 | ||
| 33 | +336d7833250b9d8d8a28a6f232f659b765925593 | ||
| 34 | +113ea4e7ae962d3d0c54cb6bedf255f55b23de84 | ||
| 35 | +9e03dc54cc50c173f75375e76b31607a03c3f4a4 | ||
| 36 | +83fc18af095248ae22f38a52bf4e7e336f0a7c12 | ||
| 37 | +6c9903062ff10d35f6fb387f983e02b0134ecb82 | ||
| 38 | +83443c116d84494da3ee859f0115898118769dca | ||
| 39 | +b5a5780019a5b75465671a23f55772a20b007115 | ||
| 40 | +a3f693c8f982462ce03421e187504efbe31788b9 | ||
| 41 | +2015f71c7d6e316db6ae3cd6a9189b8ed8308c04 | ||
| 42 | +83897e8789acc07c7bc72f24ab1aff7ababaca66 | ||
| 43 | +9f0cc086b158b477ad942eb159b929b7b9ae7a0b | ||
| 44 | +# PR 1289 | ||
| 45 | +0e92cf6bf399249c603c3d0212e898fd29e71fcd | ||
| 46 | +477fbd9839b0c876bfafdcc26b492548f253b2bb | ||
| 47 | +21f176d374dd229401b5de5bf8a4cb89b10e1731 | ||
| 48 | +44a13951940def9699b2c169e8a8eabd35973934 | ||
| 49 | +# PR 1272 | ||
| 50 | +ff2a78f579ebdd06b417e34260a17dba06e71137 | ||
| 51 | +cb7180b1bafd075a00d31dc598ebb01e755a2f09 | ||
| 52 | +28c13f5492ecc8bb6b8e5419f66ad6e66d5869e7 | ||
| 53 | +ad10fa30067308d985b8a612a0f6a5390696ce25 | ||
| 54 | +0f0747b3ae9b2b74d337f92c2861a11e0d0573d4 | ||
| 55 | +965f0fcd6352348760e77004c8af5b9b44e74326 | ||
| 56 | +98c14e7740cb879be05ce95a22a3c1f2c403bea0 | ||
| 57 | +7775aec33e55db7a9440b6bcf402c062df1ee967 | ||
| 58 | +a1b646fccafbdbc39c78f2bad4c21aa507f0477f | ||
| 59 | +6b9eb14c76cdbee063051d0ba987e8a2961a4139 | ||
| 60 | +a4db9b3149562a6117b1d9edf89e3853480aeba8 | ||
| 61 | +f30a5eb05a8fe763184cd8167a4d4531909a34d5 | ||
| 62 | +253d3aee8fb231a777cae127af52c262dcdeb9a6 | ||
| 63 | +3fbff845949c56180dfdafc0812da95a168f224b | ||
| 64 | +1e072e223a61d26b612864978b21aac6a0d0dc19 | ||
| 65 | +0ac37bc9561f1cf1aca2c55fc0e4702d3febcf75 | ||
| 66 | +f8e6274a2e004e1b0f0bb5ac8f8fb0fb76f34c66 | ||
| 67 | +d42fda60d55d27bc61828901d09d15d2d536e5a7 | ||
| 21 | # Remove 'this->' | 68 | # Remove 'this->' |
| 22 | f5cac93ac63559ddc0aec1b1c61c9e2503c7b8e0 | 69 | f5cac93ac63559ddc0aec1b1c61c9e2503c7b8e0 |
| 70 | +7ede03992a963d56754fc522f4c6f0bf944947cd |
libqpdf/InputSource.cc
| @@ -58,8 +58,7 @@ InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len | @@ -58,8 +58,7 @@ InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len | ||
| 58 | size_t size = sizeof(buf) - 1; | 58 | size_t size = sizeof(buf) - 1; |
| 59 | if ((strlen(start_chars) < 1) || (strlen(start_chars) > size)) { | 59 | if ((strlen(start_chars) < 1) || (strlen(start_chars) > size)) { |
| 60 | throw std::logic_error( | 60 | throw std::logic_error( |
| 61 | - "InputSource::findSource called with" | ||
| 62 | - " too small or too large of a character sequence"); | 61 | + "InputSource::findSource called with too small or too large of a character sequence"); |
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | char* p = nullptr; | 64 | char* p = nullptr; |
libqpdf/NNTree.cc
| @@ -63,8 +63,7 @@ NNTreeIterator::updateIValue(bool allow_invalid) | @@ -63,8 +63,7 @@ NNTreeIterator::updateIValue(bool allow_invalid) | ||
| 63 | if (!okay) { | 63 | if (!okay) { |
| 64 | if (!allow_invalid) { | 64 | if (!allow_invalid) { |
| 65 | throw std::logic_error( | 65 | throw std::logic_error( |
| 66 | - "attempt made to dereference an invalid" | ||
| 67 | - " name/number tree iterator"); | 66 | + "attempt made to dereference an invalid name/number tree iterator"); |
| 68 | } | 67 | } |
| 69 | this->ivalue.first = QPDFObjectHandle(); | 68 | this->ivalue.first = QPDFObjectHandle(); |
| 70 | this->ivalue.second = QPDFObjectHandle(); | 69 | this->ivalue.second = QPDFObjectHandle(); |
libqpdf/Pl_AES_PDF.cc
| @@ -111,9 +111,7 @@ Pl_AES_PDF::finish() | @@ -111,9 +111,7 @@ Pl_AES_PDF::finish() | ||
| 111 | // However, we have encountered files for which the output is not a multiple of the | 111 | // However, we have encountered files for which the output is not a multiple of the |
| 112 | // block size. In this case, pad with zeroes and hope for the best. | 112 | // block size. In this case, pad with zeroes and hope for the best. |
| 113 | if (this->offset >= this->buf_size) { | 113 | if (this->offset >= this->buf_size) { |
| 114 | - throw std::logic_error( | ||
| 115 | - "buffer overflow in AES encryption" | ||
| 116 | - " pipeline"); | 114 | + throw std::logic_error("buffer overflow in AES encryption pipeline"); |
| 117 | } | 115 | } |
| 118 | std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset); | 116 | std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset); |
| 119 | this->offset = this->buf_size; | 117 | this->offset = this->buf_size; |
libqpdf/Pl_ASCIIHexDecoder.cc
| @@ -4,6 +4,8 @@ | @@ -4,6 +4,8 @@ | ||
| 4 | #include <cctype> | 4 | #include <cctype> |
| 5 | #include <stdexcept> | 5 | #include <stdexcept> |
| 6 | 6 | ||
| 7 | +using namespace std::literals; | ||
| 8 | + | ||
| 7 | Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : | 9 | Pl_ASCIIHexDecoder::Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next) : |
| 8 | Pipeline(identifier, next) | 10 | Pipeline(identifier, next) |
| 9 | { | 11 | { |
| @@ -46,11 +48,7 @@ Pl_ASCIIHexDecoder::write(unsigned char const* buf, size_t len) | @@ -46,11 +48,7 @@ Pl_ASCIIHexDecoder::write(unsigned char const* buf, size_t len) | ||
| 46 | char t[2]; | 48 | char t[2]; |
| 47 | t[0] = ch; | 49 | t[0] = ch; |
| 48 | t[1] = 0; | 50 | t[1] = 0; |
| 49 | - throw std::runtime_error( | ||
| 50 | - std::string( | ||
| 51 | - "character out of range" | ||
| 52 | - " during base Hex decode: ") + | ||
| 53 | - t); | 51 | + throw std::runtime_error("character out of range during base Hex decode: "s + t); |
| 54 | } | 52 | } |
| 55 | break; | 53 | break; |
| 56 | } | 54 | } |
libqpdf/QPDF.cc
| @@ -1390,9 +1390,7 @@ QPDF::showXRefTable() | @@ -1390,9 +1390,7 @@ QPDF::showXRefTable() | ||
| 1390 | break; | 1390 | break; |
| 1391 | 1391 | ||
| 1392 | default: | 1392 | default: |
| 1393 | - throw std::logic_error( | ||
| 1394 | - "unknown cross-reference table type while" | ||
| 1395 | - " showing xref_table"); | 1393 | + throw std::logic_error("unknown cross-reference table type while showing xref_table"); |
| 1396 | break; | 1394 | break; |
| 1397 | } | 1395 | } |
| 1398 | m->log->info("\n"); | 1396 | m->log->info("\n"); |
| @@ -2296,8 +2294,7 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign) | @@ -2296,8 +2294,7 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign) | ||
| 2296 | ObjCopier& obj_copier = m->object_copiers[other.m->unique_id]; | 2294 | ObjCopier& obj_copier = m->object_copiers[other.m->unique_id]; |
| 2297 | if (!obj_copier.visiting.empty()) { | 2295 | if (!obj_copier.visiting.empty()) { |
| 2298 | throw std::logic_error( | 2296 | throw std::logic_error( |
| 2299 | - "obj_copier.visiting is not empty" | ||
| 2300 | - " at the beginning of copyForeignObject"); | 2297 | + "obj_copier.visiting is not empty at the beginning of copyForeignObject"); |
| 2301 | } | 2298 | } |
| 2302 | 2299 | ||
| 2303 | // Make sure we have an object in this file for every referenced object in the old file. | 2300 | // Make sure we have an object in this file for every referenced object in the old file. |
libqpdf/QPDFAcroFormDocumentHelper.cc
| @@ -34,16 +34,16 @@ QPDFAcroFormDocumentHelper::invalidateCache() | @@ -34,16 +34,16 @@ QPDFAcroFormDocumentHelper::invalidateCache() | ||
| 34 | bool | 34 | bool |
| 35 | QPDFAcroFormDocumentHelper::hasAcroForm() | 35 | QPDFAcroFormDocumentHelper::hasAcroForm() |
| 36 | { | 36 | { |
| 37 | - return this->qpdf.getRoot().hasKey("/AcroForm"); | 37 | + return qpdf.getRoot().hasKey("/AcroForm"); |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | QPDFObjectHandle | 40 | QPDFObjectHandle |
| 41 | QPDFAcroFormDocumentHelper::getOrCreateAcroForm() | 41 | QPDFAcroFormDocumentHelper::getOrCreateAcroForm() |
| 42 | { | 42 | { |
| 43 | - auto acroform = this->qpdf.getRoot().getKey("/AcroForm"); | 43 | + auto acroform = qpdf.getRoot().getKey("/AcroForm"); |
| 44 | if (!acroform.isDictionary()) { | 44 | if (!acroform.isDictionary()) { |
| 45 | - acroform = this->qpdf.getRoot().replaceKeyAndGetNew( | ||
| 46 | - "/AcroForm", this->qpdf.makeIndirectObject(QPDFObjectHandle::newDictionary())); | 45 | + acroform = qpdf.getRoot().replaceKeyAndGetNew( |
| 46 | + "/AcroForm", qpdf.makeIndirectObject(QPDFObjectHandle::newDictionary())); | ||
| 47 | } | 47 | } |
| 48 | return acroform; | 48 | return acroform; |
| 49 | } | 49 | } |
| @@ -115,7 +115,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | @@ -115,7 +115,7 @@ QPDFAcroFormDocumentHelper::addAndRenameFormFields(std::vector<QPDFObjectHandle> | ||
| 115 | void | 115 | void |
| 116 | QPDFAcroFormDocumentHelper::removeFormFields(std::set<QPDFObjGen> const& to_remove) | 116 | QPDFAcroFormDocumentHelper::removeFormFields(std::set<QPDFObjGen> const& to_remove) |
| 117 | { | 117 | { |
| 118 | - auto acroform = this->qpdf.getRoot().getKey("/AcroForm"); | 118 | + auto acroform = qpdf.getRoot().getKey("/AcroForm"); |
| 119 | if (!acroform.isDictionary()) { | 119 | if (!acroform.isDictionary()) { |
| 120 | return; | 120 | return; |
| 121 | } | 121 | } |
| @@ -168,7 +168,7 @@ QPDFAcroFormDocumentHelper::getFormFields() | @@ -168,7 +168,7 @@ QPDFAcroFormDocumentHelper::getFormFields() | ||
| 168 | analyze(); | 168 | analyze(); |
| 169 | std::vector<QPDFFormFieldObjectHelper> result; | 169 | std::vector<QPDFFormFieldObjectHelper> result; |
| 170 | for (auto const& iter: m->field_to_annotations) { | 170 | for (auto const& iter: m->field_to_annotations) { |
| 171 | - result.emplace_back(this->qpdf.getObject(iter.first)); | 171 | + result.emplace_back(qpdf.getObject(iter.first)); |
| 172 | } | 172 | } |
| 173 | return result; | 173 | return result; |
| 174 | } | 174 | } |
| @@ -267,7 +267,7 @@ QPDFAcroFormDocumentHelper::analyze() | @@ -267,7 +267,7 @@ QPDFAcroFormDocumentHelper::analyze() | ||
| 267 | // a file that contains this kind of error will probably not | 267 | // a file that contains this kind of error will probably not |
| 268 | // actually work with most viewers. | 268 | // actually work with most viewers. |
| 269 | 269 | ||
| 270 | - for (auto const& ph: QPDFPageDocumentHelper(this->qpdf).getAllPages()) { | 270 | + for (auto const& ph: QPDFPageDocumentHelper(qpdf).getAllPages()) { |
| 271 | for (auto const& iter: getWidgetAnnotationsForPage(ph)) { | 271 | for (auto const& iter: getWidgetAnnotationsForPage(ph)) { |
| 272 | QPDFObjectHandle annot(iter.getObjectHandle()); | 272 | QPDFObjectHandle annot(iter.getObjectHandle()); |
| 273 | QPDFObjGen og(annot.getObjGen()); | 273 | QPDFObjGen og(annot.getObjGen()); |
| @@ -368,7 +368,7 @@ bool | @@ -368,7 +368,7 @@ bool | ||
| 368 | QPDFAcroFormDocumentHelper::getNeedAppearances() | 368 | QPDFAcroFormDocumentHelper::getNeedAppearances() |
| 369 | { | 369 | { |
| 370 | bool result = false; | 370 | bool result = false; |
| 371 | - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm"); | 371 | + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm"); |
| 372 | if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) { | 372 | if (acroform.isDictionary() && acroform.getKey("/NeedAppearances").isBool()) { |
| 373 | result = acroform.getKey("/NeedAppearances").getBoolValue(); | 373 | result = acroform.getKey("/NeedAppearances").getBoolValue(); |
| 374 | } | 374 | } |
| @@ -378,9 +378,9 @@ QPDFAcroFormDocumentHelper::getNeedAppearances() | @@ -378,9 +378,9 @@ QPDFAcroFormDocumentHelper::getNeedAppearances() | ||
| 378 | void | 378 | void |
| 379 | QPDFAcroFormDocumentHelper::setNeedAppearances(bool val) | 379 | QPDFAcroFormDocumentHelper::setNeedAppearances(bool val) |
| 380 | { | 380 | { |
| 381 | - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm"); | 381 | + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm"); |
| 382 | if (!acroform.isDictionary()) { | 382 | if (!acroform.isDictionary()) { |
| 383 | - this->qpdf.getRoot().warnIfPossible( | 383 | + qpdf.getRoot().warnIfPossible( |
| 384 | "ignoring call to QPDFAcroFormDocumentHelper::setNeedAppearances" | 384 | "ignoring call to QPDFAcroFormDocumentHelper::setNeedAppearances" |
| 385 | " on a file that lacks an /AcroForm dictionary"); | 385 | " on a file that lacks an /AcroForm dictionary"); |
| 386 | return; | 386 | return; |
| @@ -399,7 +399,7 @@ QPDFAcroFormDocumentHelper::generateAppearancesIfNeeded() | @@ -399,7 +399,7 @@ QPDFAcroFormDocumentHelper::generateAppearancesIfNeeded() | ||
| 399 | return; | 399 | return; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | - for (auto const& page: QPDFPageDocumentHelper(this->qpdf).getAllPages()) { | 402 | + for (auto const& page: QPDFPageDocumentHelper(qpdf).getAllPages()) { |
| 403 | for (auto& aoh: getWidgetAnnotationsForPage(page)) { | 403 | for (auto& aoh: getWidgetAnnotationsForPage(page)) { |
| 404 | QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh); | 404 | QPDFFormFieldObjectHelper ffh = getFieldForAnnotation(aoh); |
| 405 | if (ffh.getFieldType() == "/Btn") { | 405 | if (ffh.getFieldType() == "/Btn") { |
| @@ -548,7 +548,7 @@ ResourceReplacer::handleToken(QPDFTokenizer::Token const& token) | @@ -548,7 +548,7 @@ ResourceReplacer::handleToken(QPDFTokenizer::Token const& token) | ||
| 548 | wrote = true; | 548 | wrote = true; |
| 549 | } | 549 | } |
| 550 | } | 550 | } |
| 551 | - this->offset += token.getRawValue().length(); | 551 | + offset += token.getRawValue().length(); |
| 552 | if (!wrote) { | 552 | if (!wrote) { |
| 553 | writeToken(token); | 553 | writeToken(token); |
| 554 | } | 554 | } |
| @@ -590,11 +590,11 @@ QPDFAcroFormDocumentHelper::adjustDefaultAppearances( | @@ -590,11 +590,11 @@ QPDFAcroFormDocumentHelper::adjustDefaultAppearances( | ||
| 590 | // stream out of the string and then filter it. We don't attach the stream to anything, so it | 590 | // stream out of the string and then filter it. We don't attach the stream to anything, so it |
| 591 | // will get discarded. | 591 | // will get discarded. |
| 592 | ResourceFinder rf; | 592 | ResourceFinder rf; |
| 593 | - auto da_stream = QPDFObjectHandle::newStream(&this->qpdf, DA.getUTF8Value()); | 593 | + auto da_stream = QPDFObjectHandle::newStream(&qpdf, DA.getUTF8Value()); |
| 594 | try { | 594 | try { |
| 595 | - auto nwarnings = this->qpdf.numWarnings(); | 595 | + auto nwarnings = qpdf.numWarnings(); |
| 596 | da_stream.parseAsContents(&rf); | 596 | da_stream.parseAsContents(&rf); |
| 597 | - if (this->qpdf.numWarnings() > nwarnings) { | 597 | + if (qpdf.numWarnings() > nwarnings) { |
| 598 | QTC::TC("qpdf", "QPDFAcroFormDocumentHelper /DA parse error"); | 598 | QTC::TC("qpdf", "QPDFAcroFormDocumentHelper /DA parse error"); |
| 599 | } | 599 | } |
| 600 | } catch (std::exception& e) { | 600 | } catch (std::exception& e) { |
| @@ -632,7 +632,7 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( | @@ -632,7 +632,7 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( | ||
| 632 | bool was_indirect = resources.isIndirect(); | 632 | bool was_indirect = resources.isIndirect(); |
| 633 | resources = resources.shallowCopy(); | 633 | resources = resources.shallowCopy(); |
| 634 | if (was_indirect) { | 634 | if (was_indirect) { |
| 635 | - resources = this->qpdf.makeIndirectObject(resources); | 635 | + resources = qpdf.makeIndirectObject(resources); |
| 636 | } | 636 | } |
| 637 | dict.replaceKey("/Resources", resources); | 637 | dict.replaceKey("/Resources", resources); |
| 638 | // Create a dictionary with top-level keys so we can use mergeResources to force them to be | 638 | // Create a dictionary with top-level keys so we can use mergeResources to force them to be |
| @@ -683,9 +683,9 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( | @@ -683,9 +683,9 @@ QPDFAcroFormDocumentHelper::adjustAppearanceStream( | ||
| 683 | // Now attach a token filter to replace the actual resources. | 683 | // Now attach a token filter to replace the actual resources. |
| 684 | ResourceFinder rf; | 684 | ResourceFinder rf; |
| 685 | try { | 685 | try { |
| 686 | - auto nwarnings = this->qpdf.numWarnings(); | 686 | + auto nwarnings = qpdf.numWarnings(); |
| 687 | stream.parseAsContents(&rf); | 687 | stream.parseAsContents(&rf); |
| 688 | - if (this->qpdf.numWarnings() > nwarnings) { | 688 | + if (qpdf.numWarnings() > nwarnings) { |
| 689 | QTC::TC("qpdf", "QPDFAcroFormDocumentHelper AP parse error"); | 689 | QTC::TC("qpdf", "QPDFAcroFormDocumentHelper AP parse error"); |
| 690 | } | 690 | } |
| 691 | auto rr = new ResourceReplacer(dr_map, rf.getNamesByResourceType()); | 691 | auto rr = new ResourceReplacer(dr_map, rf.getNamesByResourceType()); |
| @@ -711,18 +711,18 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -711,18 +711,18 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 711 | std::shared_ptr<QPDFAcroFormDocumentHelper> afdhph; | 711 | std::shared_ptr<QPDFAcroFormDocumentHelper> afdhph; |
| 712 | if (!from_qpdf) { | 712 | if (!from_qpdf) { |
| 713 | // Assume these are from the same QPDF. | 713 | // Assume these are from the same QPDF. |
| 714 | - from_qpdf = &this->qpdf; | 714 | + from_qpdf = &qpdf; |
| 715 | from_afdh = this; | 715 | from_afdh = this; |
| 716 | - } else if ((from_qpdf != &this->qpdf) && (!from_afdh)) { | 716 | + } else if ((from_qpdf != &qpdf) && (!from_afdh)) { |
| 717 | afdhph = std::make_shared<QPDFAcroFormDocumentHelper>(*from_qpdf); | 717 | afdhph = std::make_shared<QPDFAcroFormDocumentHelper>(*from_qpdf); |
| 718 | from_afdh = afdhph.get(); | 718 | from_afdh = afdhph.get(); |
| 719 | } | 719 | } |
| 720 | - bool foreign = (from_qpdf != &this->qpdf); | 720 | + bool foreign = (from_qpdf != &qpdf); |
| 721 | 721 | ||
| 722 | // It's possible that we will transform annotations that don't include any form fields. This | 722 | // It's possible that we will transform annotations that don't include any form fields. This |
| 723 | // code takes care not to muck around with /AcroForm unless we have to. | 723 | // code takes care not to muck around with /AcroForm unless we have to. |
| 724 | 724 | ||
| 725 | - QPDFObjectHandle acroform = this->qpdf.getRoot().getKey("/AcroForm"); | 725 | + QPDFObjectHandle acroform = qpdf.getRoot().getKey("/AcroForm"); |
| 726 | QPDFObjectHandle from_acroform = from_qpdf->getRoot().getKey("/AcroForm"); | 726 | QPDFObjectHandle from_acroform = from_qpdf->getRoot().getKey("/AcroForm"); |
| 727 | 727 | ||
| 728 | // /DA and /Q may be inherited from the document-level /AcroForm dictionary. If we are copying a | 728 | // /DA and /Q may be inherited from the document-level /AcroForm dictionary. If we are copying a |
| @@ -753,7 +753,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -753,7 +753,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 753 | if (!from_dr.isIndirect()) { | 753 | if (!from_dr.isIndirect()) { |
| 754 | from_dr = from_qpdf->makeIndirectObject(from_dr); | 754 | from_dr = from_qpdf->makeIndirectObject(from_dr); |
| 755 | } | 755 | } |
| 756 | - from_dr = this->qpdf.copyForeignObject(from_dr); | 756 | + from_dr = qpdf.copyForeignObject(from_dr); |
| 757 | } | 757 | } |
| 758 | if (from_acroform.getKey("/DA").isString()) { | 758 | if (from_acroform.getKey("/DA").isString()) { |
| 759 | from_default_da = from_acroform.getKey("/DA").getUTF8Value(); | 759 | from_default_da = from_acroform.getKey("/DA").getUTF8Value(); |
| @@ -787,14 +787,14 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -787,14 +787,14 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 787 | if (!dr.isDictionary()) { | 787 | if (!dr.isDictionary()) { |
| 788 | dr = QPDFObjectHandle::newDictionary(); | 788 | dr = QPDFObjectHandle::newDictionary(); |
| 789 | } | 789 | } |
| 790 | - dr.makeResourcesIndirect(this->qpdf); | 790 | + dr.makeResourcesIndirect(qpdf); |
| 791 | if (!dr.isIndirect()) { | 791 | if (!dr.isIndirect()) { |
| 792 | - dr = acroform.replaceKeyAndGetNew("/DR", this->qpdf.makeIndirectObject(dr)); | 792 | + dr = acroform.replaceKeyAndGetNew("/DR", qpdf.makeIndirectObject(dr)); |
| 793 | } | 793 | } |
| 794 | // Merge the other document's /DR, creating a conflict map. mergeResources checks to | 794 | // Merge the other document's /DR, creating a conflict map. mergeResources checks to |
| 795 | // make sure both objects are dictionaries. By this point, if this is foreign, from_dr | 795 | // make sure both objects are dictionaries. By this point, if this is foreign, from_dr |
| 796 | // has been copied, so we use the target qpdf as the owning qpdf. | 796 | // has been copied, so we use the target qpdf as the owning qpdf. |
| 797 | - from_dr.makeResourcesIndirect(this->qpdf); | 797 | + from_dr.makeResourcesIndirect(qpdf); |
| 798 | dr.mergeResources(from_dr, &dr_map); | 798 | dr.mergeResources(from_dr, &dr_map); |
| 799 | 799 | ||
| 800 | if (from_afdh->getNeedAppearances()) { | 800 | if (from_afdh->getNeedAppearances()) { |
| @@ -811,7 +811,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -811,7 +811,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 811 | to_copy = orig_to_copy[og]; | 811 | to_copy = orig_to_copy[og]; |
| 812 | return false; | 812 | return false; |
| 813 | } else { | 813 | } else { |
| 814 | - to_copy = this->qpdf.makeIndirectObject(to_copy.shallowCopy()); | 814 | + to_copy = qpdf.makeIndirectObject(to_copy.shallowCopy()); |
| 815 | orig_to_copy[og] = to_copy; | 815 | orig_to_copy[og] = to_copy; |
| 816 | return true; | 816 | return true; |
| 817 | } | 817 | } |
| @@ -872,8 +872,8 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -872,8 +872,8 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 872 | // so we'll get the right object back. | 872 | // so we'll get the right object back. |
| 873 | 873 | ||
| 874 | // top_field and ffield_oh are known to be indirect. | 874 | // top_field and ffield_oh are known to be indirect. |
| 875 | - top_field = this->qpdf.copyForeignObject(top_field); | ||
| 876 | - ffield_oh = this->qpdf.copyForeignObject(ffield_oh); | 875 | + top_field = qpdf.copyForeignObject(top_field); |
| 876 | + ffield_oh = qpdf.copyForeignObject(ffield_oh); | ||
| 877 | } else { | 877 | } else { |
| 878 | // We don't need to add top_field to old_fields if it's foreign because the new copy | 878 | // We don't need to add top_field to old_fields if it's foreign because the new copy |
| 879 | // of the foreign field won't be referenced anywhere. It's just the starting point | 879 | // of the foreign field won't be referenced anywhere. It's just the starting point |
| @@ -957,7 +957,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | @@ -957,7 +957,7 @@ QPDFAcroFormDocumentHelper::transformAnnotations( | ||
| 957 | if (!annot.isIndirect()) { | 957 | if (!annot.isIndirect()) { |
| 958 | annot = from_qpdf->makeIndirectObject(annot); | 958 | annot = from_qpdf->makeIndirectObject(annot); |
| 959 | } | 959 | } |
| 960 | - annot = this->qpdf.copyForeignObject(annot); | 960 | + annot = qpdf.copyForeignObject(annot); |
| 961 | } | 961 | } |
| 962 | maybe_copy_object(annot); | 962 | maybe_copy_object(annot); |
| 963 | 963 |
libqpdf/QPDFFormFieldObjectHelper.cc
| @@ -752,8 +752,7 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao | @@ -752,8 +752,7 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao | ||
| 752 | QPDFObjectHandle::Rectangle rect = aoh.getRect(); | 752 | QPDFObjectHandle::Rectangle rect = aoh.getRect(); |
| 753 | QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly); | 753 | QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly); |
| 754 | QPDFObjectHandle dict = QPDFObjectHandle::parse( | 754 | QPDFObjectHandle dict = QPDFObjectHandle::parse( |
| 755 | - "<< /Resources << /ProcSet [ /PDF /Text ] >>" | ||
| 756 | - " /Type /XObject /Subtype /Form >>"); | 755 | + "<< /Resources << /ProcSet [ /PDF /Text ] >> /Type /XObject /Subtype /Form >>"); |
| 757 | dict.replaceKey("/BBox", QPDFObjectHandle::newFromRectangle(bbox)); | 756 | dict.replaceKey("/BBox", QPDFObjectHandle::newFromRectangle(bbox)); |
| 758 | AS = QPDFObjectHandle::newStream(oh().getOwningQPDF(), "/Tx BMC\nEMC\n"); | 757 | AS = QPDFObjectHandle::newStream(oh().getOwningQPDF(), "/Tx BMC\nEMC\n"); |
| 759 | AS.replaceDict(dict); | 758 | AS.replaceDict(dict); |
libqpdf/QPDFJob.cc
| @@ -618,9 +618,7 @@ QPDFJob::checkConfiguration() | @@ -618,9 +618,7 @@ QPDFJob::checkConfiguration() | ||
| 618 | usage("no output file may be given for this option"); | 618 | usage("no output file may be given for this option"); |
| 619 | } | 619 | } |
| 620 | if (m->check_requires_password && m->check_is_encrypted) { | 620 | if (m->check_requires_password && m->check_is_encrypted) { |
| 621 | - usage( | ||
| 622 | - "--requires-password and --is-encrypted may not be given" | ||
| 623 | - " together"); | 621 | + usage("--requires-password and --is-encrypted may not be given together"); |
| 624 | } | 622 | } |
| 625 | 623 | ||
| 626 | if (m->encrypt && (!m->allow_insecure) && | 624 | if (m->encrypt && (!m->allow_insecure) && |
| @@ -3142,9 +3140,7 @@ QPDFJob::writeJSON(QPDF& pdf) | @@ -3142,9 +3140,7 @@ QPDFJob::writeJSON(QPDF& pdf) | ||
| 3142 | fp = std::make_shared<Pl_StdioFile>("json output", fc->f); | 3140 | fp = std::make_shared<Pl_StdioFile>("json output", fc->f); |
| 3143 | } else if ((m->json_stream_data == qpdf_sj_file) && m->json_stream_prefix.empty()) { | 3141 | } else if ((m->json_stream_data == qpdf_sj_file) && m->json_stream_prefix.empty()) { |
| 3144 | QTC::TC("qpdf", "QPDFJob need json-stream-prefix for stdout"); | 3142 | QTC::TC("qpdf", "QPDFJob need json-stream-prefix for stdout"); |
| 3145 | - usage( | ||
| 3146 | - "please specify --json-stream-prefix since the input file " | ||
| 3147 | - "name is unknown"); | 3143 | + usage("please specify --json-stream-prefix since the input file name is unknown"); |
| 3148 | } else { | 3144 | } else { |
| 3149 | QTC::TC("qpdf", "QPDFJob write json to stdout"); | 3145 | QTC::TC("qpdf", "QPDFJob write json to stdout"); |
| 3150 | m->log->saveToStandardOutput(true); | 3146 | m->log->saveToStandardOutput(true); |
libqpdf/QPDFObjectHandle.cc
| @@ -1258,8 +1258,7 @@ QPDFObjectHandle::getUniqueResourceName( | @@ -1258,8 +1258,7 @@ QPDFObjectHandle::getUniqueResourceName( | ||
| 1258 | // The number of candidates we test is more than the | 1258 | // The number of candidates we test is more than the |
| 1259 | // number of keys we're checking against. | 1259 | // number of keys we're checking against. |
| 1260 | throw std::logic_error( | 1260 | throw std::logic_error( |
| 1261 | - "unable to find unconflicting name in" | ||
| 1262 | - " QPDFObjectHandle::getUniqueResourceName"); | 1261 | + "unable to find unconflicting name in QPDFObjectHandle::getUniqueResourceName"); |
| 1263 | } | 1262 | } |
| 1264 | 1263 | ||
| 1265 | // Dictionary mutators are in QPDF_Dictionary.cc | 1264 | // Dictionary mutators are in QPDF_Dictionary.cc |
libqpdf/QPDFPageObjectHelper.cc
| @@ -718,8 +718,7 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations) | @@ -718,8 +718,7 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations) | ||
| 718 | QPDFObjectHandle bbox = getTrimBox(false).shallowCopy(); | 718 | QPDFObjectHandle bbox = getTrimBox(false).shallowCopy(); |
| 719 | if (!bbox.isRectangle()) { | 719 | if (!bbox.isRectangle()) { |
| 720 | oh().warnIfPossible( | 720 | oh().warnIfPossible( |
| 721 | - "bounding box is invalid; form" | ||
| 722 | - " XObject created from page will not work"); | 721 | + "bounding box is invalid; form XObject created from page will not work"); |
| 723 | } | 722 | } |
| 724 | newdict.replaceKey("/BBox", bbox); | 723 | newdict.replaceKey("/BBox", bbox); |
| 725 | auto provider = | 724 | auto provider = |
libqpdf/QPDFTokenizer.cc
| @@ -166,8 +166,8 @@ Tokenizer::presentCharacter(char ch) | @@ -166,8 +166,8 @@ Tokenizer::presentCharacter(char ch) | ||
| 166 | { | 166 | { |
| 167 | handleCharacter(ch); | 167 | handleCharacter(ch); |
| 168 | 168 | ||
| 169 | - if (this->in_token) { | ||
| 170 | - this->raw_val += ch; | 169 | + if (in_token) { |
| 170 | + raw_val += ch; | ||
| 171 | } | 171 | } |
| 172 | } | 172 | } |
| 173 | 173 | ||
| @@ -177,7 +177,7 @@ Tokenizer::handleCharacter(char ch) | @@ -177,7 +177,7 @@ Tokenizer::handleCharacter(char ch) | ||
| 177 | // In some cases, functions called below may call a second handler. This happens whenever you | 177 | // In some cases, functions called below may call a second handler. This happens whenever you |
| 178 | // have to use a character from the next token to detect the end of the current token. | 178 | // have to use a character from the next token to detect the end of the current token. |
| 179 | 179 | ||
| 180 | - switch (this->state) { | 180 | + switch (state) { |
| 181 | case st_top: | 181 | case st_top: |
| 182 | inTop(ch); | 182 | inTop(ch); |
| 183 | return; | 183 | return; |
| @@ -283,18 +283,18 @@ Tokenizer::inBeforeToken(char ch) | @@ -283,18 +283,18 @@ Tokenizer::inBeforeToken(char ch) | ||
| 283 | { | 283 | { |
| 284 | // Note: we specifically do not use ctype here. It is locale-dependent. | 284 | // Note: we specifically do not use ctype here. It is locale-dependent. |
| 285 | if (isSpace(ch)) { | 285 | if (isSpace(ch)) { |
| 286 | - this->before_token = !this->include_ignorable; | ||
| 287 | - this->in_token = this->include_ignorable; | ||
| 288 | - if (this->include_ignorable) { | ||
| 289 | - this->state = st_in_space; | 286 | + before_token = !include_ignorable; |
| 287 | + in_token = include_ignorable; | ||
| 288 | + if (include_ignorable) { | ||
| 289 | + state = st_in_space; | ||
| 290 | } | 290 | } |
| 291 | } else if (ch == '%') { | 291 | } else if (ch == '%') { |
| 292 | - this->before_token = !this->include_ignorable; | ||
| 293 | - this->in_token = this->include_ignorable; | ||
| 294 | - this->state = st_in_comment; | 292 | + before_token = !include_ignorable; |
| 293 | + in_token = include_ignorable; | ||
| 294 | + state = st_in_comment; | ||
| 295 | } else { | 295 | } else { |
| 296 | - this->before_token = false; | ||
| 297 | - this->in_token = true; | 296 | + before_token = false; |
| 297 | + in_token = true; | ||
| 298 | inTop(ch); | 298 | inTop(ch); |
| 299 | } | 299 | } |
| 300 | } | 300 | } |
| @@ -304,48 +304,48 @@ Tokenizer::inTop(char ch) | @@ -304,48 +304,48 @@ Tokenizer::inTop(char ch) | ||
| 304 | { | 304 | { |
| 305 | switch (ch) { | 305 | switch (ch) { |
| 306 | case '(': | 306 | case '(': |
| 307 | - this->string_depth = 1; | ||
| 308 | - this->state = st_in_string; | 307 | + string_depth = 1; |
| 308 | + state = st_in_string; | ||
| 309 | return; | 309 | return; |
| 310 | 310 | ||
| 311 | case '<': | 311 | case '<': |
| 312 | - this->state = st_lt; | 312 | + state = st_lt; |
| 313 | return; | 313 | return; |
| 314 | 314 | ||
| 315 | case '>': | 315 | case '>': |
| 316 | - this->state = st_gt; | 316 | + state = st_gt; |
| 317 | return; | 317 | return; |
| 318 | 318 | ||
| 319 | case (')'): | 319 | case (')'): |
| 320 | - this->type = tt::tt_bad; | 320 | + type = tt::tt_bad; |
| 321 | QTC::TC("qpdf", "QPDFTokenizer bad )"); | 321 | QTC::TC("qpdf", "QPDFTokenizer bad )"); |
| 322 | - this->error_message = "unexpected )"; | ||
| 323 | - this->state = st_token_ready; | 322 | + error_message = "unexpected )"; |
| 323 | + state = st_token_ready; | ||
| 324 | return; | 324 | return; |
| 325 | 325 | ||
| 326 | case '[': | 326 | case '[': |
| 327 | - this->type = tt::tt_array_open; | ||
| 328 | - this->state = st_token_ready; | 327 | + type = tt::tt_array_open; |
| 328 | + state = st_token_ready; | ||
| 329 | return; | 329 | return; |
| 330 | 330 | ||
| 331 | case ']': | 331 | case ']': |
| 332 | - this->type = tt::tt_array_close; | ||
| 333 | - this->state = st_token_ready; | 332 | + type = tt::tt_array_close; |
| 333 | + state = st_token_ready; | ||
| 334 | return; | 334 | return; |
| 335 | 335 | ||
| 336 | case '{': | 336 | case '{': |
| 337 | - this->type = tt::tt_brace_open; | ||
| 338 | - this->state = st_token_ready; | 337 | + type = tt::tt_brace_open; |
| 338 | + state = st_token_ready; | ||
| 339 | return; | 339 | return; |
| 340 | 340 | ||
| 341 | case '}': | 341 | case '}': |
| 342 | - this->type = tt::tt_brace_close; | ||
| 343 | - this->state = st_token_ready; | 342 | + type = tt::tt_brace_close; |
| 343 | + state = st_token_ready; | ||
| 344 | return; | 344 | return; |
| 345 | 345 | ||
| 346 | case '/': | 346 | case '/': |
| 347 | - this->state = st_name; | ||
| 348 | - this->val += ch; | 347 | + state = st_name; |
| 348 | + val += ch; | ||
| 349 | return; | 349 | return; |
| 350 | 350 | ||
| 351 | case '0': | 351 | case '0': |
| @@ -358,20 +358,20 @@ Tokenizer::inTop(char ch) | @@ -358,20 +358,20 @@ Tokenizer::inTop(char ch) | ||
| 358 | case '7': | 358 | case '7': |
| 359 | case '8': | 359 | case '8': |
| 360 | case '9': | 360 | case '9': |
| 361 | - this->state = st_number; | 361 | + state = st_number; |
| 362 | return; | 362 | return; |
| 363 | 363 | ||
| 364 | case '+': | 364 | case '+': |
| 365 | case '-': | 365 | case '-': |
| 366 | - this->state = st_sign; | 366 | + state = st_sign; |
| 367 | return; | 367 | return; |
| 368 | 368 | ||
| 369 | case '.': | 369 | case '.': |
| 370 | - this->state = st_decimal; | 370 | + state = st_decimal; |
| 371 | return; | 371 | return; |
| 372 | 372 | ||
| 373 | default: | 373 | default: |
| 374 | - this->state = st_literal; | 374 | + state = st_literal; |
| 375 | return; | 375 | return; |
| 376 | } | 376 | } |
| 377 | } | 377 | } |
| @@ -381,10 +381,10 @@ Tokenizer::inSpace(char ch) | @@ -381,10 +381,10 @@ Tokenizer::inSpace(char ch) | ||
| 381 | { | 381 | { |
| 382 | // We only enter this state if include_ignorable is true. | 382 | // We only enter this state if include_ignorable is true. |
| 383 | if (!isSpace(ch)) { | 383 | if (!isSpace(ch)) { |
| 384 | - this->type = tt::tt_space; | ||
| 385 | - this->in_token = false; | ||
| 386 | - this->char_to_unread = ch; | ||
| 387 | - this->state = st_token_ready; | 384 | + type = tt::tt_space; |
| 385 | + in_token = false; | ||
| 386 | + char_to_unread = ch; | ||
| 387 | + state = st_token_ready; | ||
| 388 | } | 388 | } |
| 389 | } | 389 | } |
| 390 | 390 | ||
| @@ -392,13 +392,13 @@ void | @@ -392,13 +392,13 @@ void | ||
| 392 | Tokenizer::inComment(char ch) | 392 | Tokenizer::inComment(char ch) |
| 393 | { | 393 | { |
| 394 | if ((ch == '\r') || (ch == '\n')) { | 394 | if ((ch == '\r') || (ch == '\n')) { |
| 395 | - if (this->include_ignorable) { | ||
| 396 | - this->type = tt::tt_comment; | ||
| 397 | - this->in_token = false; | ||
| 398 | - this->char_to_unread = ch; | ||
| 399 | - this->state = st_token_ready; | 395 | + if (include_ignorable) { |
| 396 | + type = tt::tt_comment; | ||
| 397 | + in_token = false; | ||
| 398 | + char_to_unread = ch; | ||
| 399 | + state = st_token_ready; | ||
| 400 | } else { | 400 | } else { |
| 401 | - this->state = st_before_token; | 401 | + state = st_before_token; |
| 402 | } | 402 | } |
| 403 | } | 403 | } |
| 404 | } | 404 | } |
| @@ -408,36 +408,36 @@ Tokenizer::inString(char ch) | @@ -408,36 +408,36 @@ Tokenizer::inString(char ch) | ||
| 408 | { | 408 | { |
| 409 | switch (ch) { | 409 | switch (ch) { |
| 410 | case '\\': | 410 | case '\\': |
| 411 | - this->state = st_string_escape; | 411 | + state = st_string_escape; |
| 412 | return; | 412 | return; |
| 413 | 413 | ||
| 414 | case '(': | 414 | case '(': |
| 415 | - this->val += ch; | ||
| 416 | - ++this->string_depth; | 415 | + val += ch; |
| 416 | + ++string_depth; | ||
| 417 | return; | 417 | return; |
| 418 | 418 | ||
| 419 | case ')': | 419 | case ')': |
| 420 | - if (--this->string_depth == 0) { | ||
| 421 | - this->type = tt::tt_string; | ||
| 422 | - this->state = st_token_ready; | 420 | + if (--string_depth == 0) { |
| 421 | + type = tt::tt_string; | ||
| 422 | + state = st_token_ready; | ||
| 423 | return; | 423 | return; |
| 424 | } | 424 | } |
| 425 | 425 | ||
| 426 | - this->val += ch; | 426 | + val += ch; |
| 427 | return; | 427 | return; |
| 428 | 428 | ||
| 429 | case '\r': | 429 | case '\r': |
| 430 | // CR by itself is converted to LF | 430 | // CR by itself is converted to LF |
| 431 | - this->val += '\n'; | ||
| 432 | - this->state = st_string_after_cr; | 431 | + val += '\n'; |
| 432 | + state = st_string_after_cr; | ||
| 433 | return; | 433 | return; |
| 434 | 434 | ||
| 435 | case '\n': | 435 | case '\n': |
| 436 | - this->val += ch; | 436 | + val += ch; |
| 437 | return; | 437 | return; |
| 438 | 438 | ||
| 439 | default: | 439 | default: |
| 440 | - this->val += ch; | 440 | + val += ch; |
| 441 | return; | 441 | return; |
| 442 | } | 442 | } |
| 443 | } | 443 | } |
| @@ -452,32 +452,32 @@ Tokenizer::inName(char ch) | @@ -452,32 +452,32 @@ Tokenizer::inName(char ch) | ||
| 452 | // though not on any files in the test suite as of this | 452 | // though not on any files in the test suite as of this |
| 453 | // writing. | 453 | // writing. |
| 454 | 454 | ||
| 455 | - this->type = this->bad ? tt::tt_bad : tt::tt_name; | ||
| 456 | - this->in_token = false; | ||
| 457 | - this->char_to_unread = ch; | ||
| 458 | - this->state = st_token_ready; | 455 | + type = bad ? tt::tt_bad : tt::tt_name; |
| 456 | + in_token = false; | ||
| 457 | + char_to_unread = ch; | ||
| 458 | + state = st_token_ready; | ||
| 459 | } else if (ch == '#') { | 459 | } else if (ch == '#') { |
| 460 | - this->char_code = 0; | ||
| 461 | - this->state = st_name_hex1; | 460 | + char_code = 0; |
| 461 | + state = st_name_hex1; | ||
| 462 | } else { | 462 | } else { |
| 463 | - this->val += ch; | 463 | + val += ch; |
| 464 | } | 464 | } |
| 465 | } | 465 | } |
| 466 | 466 | ||
| 467 | void | 467 | void |
| 468 | Tokenizer::inNameHex1(char ch) | 468 | Tokenizer::inNameHex1(char ch) |
| 469 | { | 469 | { |
| 470 | - this->hex_char = ch; | 470 | + hex_char = ch; |
| 471 | 471 | ||
| 472 | if (char hval = util::hex_decode_char(ch); hval < '\20') { | 472 | if (char hval = util::hex_decode_char(ch); hval < '\20') { |
| 473 | - this->char_code = int(hval) << 4; | ||
| 474 | - this->state = st_name_hex2; | 473 | + char_code = int(hval) << 4; |
| 474 | + state = st_name_hex2; | ||
| 475 | } else { | 475 | } else { |
| 476 | QTC::TC("qpdf", "QPDFTokenizer bad name 1"); | 476 | QTC::TC("qpdf", "QPDFTokenizer bad name 1"); |
| 477 | - this->error_message = "name with stray # will not work with PDF >= 1.2"; | 477 | + error_message = "name with stray # will not work with PDF >= 1.2"; |
| 478 | // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName. | 478 | // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName. |
| 479 | - this->val += '\0'; | ||
| 480 | - this->state = st_name; | 479 | + val += '\0'; |
| 480 | + state = st_name; | ||
| 481 | inName(ch); | 481 | inName(ch); |
| 482 | } | 482 | } |
| 483 | } | 483 | } |
| @@ -486,26 +486,26 @@ void | @@ -486,26 +486,26 @@ void | ||
| 486 | Tokenizer::inNameHex2(char ch) | 486 | Tokenizer::inNameHex2(char ch) |
| 487 | { | 487 | { |
| 488 | if (char hval = util::hex_decode_char(ch); hval < '\20') { | 488 | if (char hval = util::hex_decode_char(ch); hval < '\20') { |
| 489 | - this->char_code |= int(hval); | 489 | + char_code |= int(hval); |
| 490 | } else { | 490 | } else { |
| 491 | QTC::TC("qpdf", "QPDFTokenizer bad name 2"); | 491 | QTC::TC("qpdf", "QPDFTokenizer bad name 2"); |
| 492 | - this->error_message = "name with stray # will not work with PDF >= 1.2"; | 492 | + error_message = "name with stray # will not work with PDF >= 1.2"; |
| 493 | // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName. | 493 | // Use null to encode a bad # -- this is reversed in QPDF_Name::normalizeName. |
| 494 | - this->val += '\0'; | ||
| 495 | - this->val += this->hex_char; | ||
| 496 | - this->state = st_name; | 494 | + val += '\0'; |
| 495 | + val += hex_char; | ||
| 496 | + state = st_name; | ||
| 497 | inName(ch); | 497 | inName(ch); |
| 498 | return; | 498 | return; |
| 499 | } | 499 | } |
| 500 | - if (this->char_code == 0) { | 500 | + if (char_code == 0) { |
| 501 | QTC::TC("qpdf", "QPDFTokenizer null in name"); | 501 | QTC::TC("qpdf", "QPDFTokenizer null in name"); |
| 502 | - this->error_message = "null character not allowed in name token"; | ||
| 503 | - this->val += "#00"; | ||
| 504 | - this->state = st_name; | ||
| 505 | - this->bad = true; | 502 | + error_message = "null character not allowed in name token"; |
| 503 | + val += "#00"; | ||
| 504 | + state = st_name; | ||
| 505 | + bad = true; | ||
| 506 | } else { | 506 | } else { |
| 507 | - this->val += char(this->char_code); | ||
| 508 | - this->state = st_name; | 507 | + val += char(char_code); |
| 508 | + state = st_name; | ||
| 509 | } | 509 | } |
| 510 | } | 510 | } |
| 511 | 511 | ||
| @@ -513,11 +513,11 @@ void | @@ -513,11 +513,11 @@ void | ||
| 513 | Tokenizer::inSign(char ch) | 513 | Tokenizer::inSign(char ch) |
| 514 | { | 514 | { |
| 515 | if (util::is_digit(ch)) { | 515 | if (util::is_digit(ch)) { |
| 516 | - this->state = st_number; | 516 | + state = st_number; |
| 517 | } else if (ch == '.') { | 517 | } else if (ch == '.') { |
| 518 | - this->state = st_decimal; | 518 | + state = st_decimal; |
| 519 | } else { | 519 | } else { |
| 520 | - this->state = st_literal; | 520 | + state = st_literal; |
| 521 | inLiteral(ch); | 521 | inLiteral(ch); |
| 522 | } | 522 | } |
| 523 | } | 523 | } |
| @@ -526,9 +526,9 @@ void | @@ -526,9 +526,9 @@ void | ||
| 526 | Tokenizer::inDecimal(char ch) | 526 | Tokenizer::inDecimal(char ch) |
| 527 | { | 527 | { |
| 528 | if (util::is_digit(ch)) { | 528 | if (util::is_digit(ch)) { |
| 529 | - this->state = st_real; | 529 | + state = st_real; |
| 530 | } else { | 530 | } else { |
| 531 | - this->state = st_literal; | 531 | + state = st_literal; |
| 532 | inLiteral(ch); | 532 | inLiteral(ch); |
| 533 | } | 533 | } |
| 534 | } | 534 | } |
| @@ -538,14 +538,14 @@ Tokenizer::inNumber(char ch) | @@ -538,14 +538,14 @@ Tokenizer::inNumber(char ch) | ||
| 538 | { | 538 | { |
| 539 | if (util::is_digit(ch)) { | 539 | if (util::is_digit(ch)) { |
| 540 | } else if (ch == '.') { | 540 | } else if (ch == '.') { |
| 541 | - this->state = st_real; | 541 | + state = st_real; |
| 542 | } else if (isDelimiter(ch)) { | 542 | } else if (isDelimiter(ch)) { |
| 543 | - this->type = tt::tt_integer; | ||
| 544 | - this->state = st_token_ready; | ||
| 545 | - this->in_token = false; | ||
| 546 | - this->char_to_unread = ch; | 543 | + type = tt::tt_integer; |
| 544 | + state = st_token_ready; | ||
| 545 | + in_token = false; | ||
| 546 | + char_to_unread = ch; | ||
| 547 | } else { | 547 | } else { |
| 548 | - this->state = st_literal; | 548 | + state = st_literal; |
| 549 | } | 549 | } |
| 550 | } | 550 | } |
| 551 | 551 | ||
| @@ -554,18 +554,18 @@ Tokenizer::inReal(char ch) | @@ -554,18 +554,18 @@ Tokenizer::inReal(char ch) | ||
| 554 | { | 554 | { |
| 555 | if (util::is_digit(ch)) { | 555 | if (util::is_digit(ch)) { |
| 556 | } else if (isDelimiter(ch)) { | 556 | } else if (isDelimiter(ch)) { |
| 557 | - this->type = tt::tt_real; | ||
| 558 | - this->state = st_token_ready; | ||
| 559 | - this->in_token = false; | ||
| 560 | - this->char_to_unread = ch; | 557 | + type = tt::tt_real; |
| 558 | + state = st_token_ready; | ||
| 559 | + in_token = false; | ||
| 560 | + char_to_unread = ch; | ||
| 561 | } else { | 561 | } else { |
| 562 | - this->state = st_literal; | 562 | + state = st_literal; |
| 563 | } | 563 | } |
| 564 | } | 564 | } |
| 565 | void | 565 | void |
| 566 | Tokenizer::inStringEscape(char ch) | 566 | Tokenizer::inStringEscape(char ch) |
| 567 | { | 567 | { |
| 568 | - this->state = st_in_string; | 568 | + state = st_in_string; |
| 569 | switch (ch) { | 569 | switch (ch) { |
| 570 | case '0': | 570 | case '0': |
| 571 | case '1': | 571 | case '1': |
| @@ -575,42 +575,42 @@ Tokenizer::inStringEscape(char ch) | @@ -575,42 +575,42 @@ Tokenizer::inStringEscape(char ch) | ||
| 575 | case '5': | 575 | case '5': |
| 576 | case '6': | 576 | case '6': |
| 577 | case '7': | 577 | case '7': |
| 578 | - this->state = st_char_code; | ||
| 579 | - this->char_code = 0; | ||
| 580 | - this->digit_count = 0; | 578 | + state = st_char_code; |
| 579 | + char_code = 0; | ||
| 580 | + digit_count = 0; | ||
| 581 | inCharCode(ch); | 581 | inCharCode(ch); |
| 582 | return; | 582 | return; |
| 583 | 583 | ||
| 584 | case 'n': | 584 | case 'n': |
| 585 | - this->val += '\n'; | 585 | + val += '\n'; |
| 586 | return; | 586 | return; |
| 587 | 587 | ||
| 588 | case 'r': | 588 | case 'r': |
| 589 | - this->val += '\r'; | 589 | + val += '\r'; |
| 590 | return; | 590 | return; |
| 591 | 591 | ||
| 592 | case 't': | 592 | case 't': |
| 593 | - this->val += '\t'; | 593 | + val += '\t'; |
| 594 | return; | 594 | return; |
| 595 | 595 | ||
| 596 | case 'b': | 596 | case 'b': |
| 597 | - this->val += '\b'; | 597 | + val += '\b'; |
| 598 | return; | 598 | return; |
| 599 | 599 | ||
| 600 | case 'f': | 600 | case 'f': |
| 601 | - this->val += '\f'; | 601 | + val += '\f'; |
| 602 | return; | 602 | return; |
| 603 | 603 | ||
| 604 | case '\n': | 604 | case '\n': |
| 605 | return; | 605 | return; |
| 606 | 606 | ||
| 607 | case '\r': | 607 | case '\r': |
| 608 | - this->state = st_string_after_cr; | 608 | + state = st_string_after_cr; |
| 609 | return; | 609 | return; |
| 610 | 610 | ||
| 611 | default: | 611 | default: |
| 612 | // PDF spec says backslash is ignored before anything else | 612 | // PDF spec says backslash is ignored before anything else |
| 613 | - this->val += ch; | 613 | + val += ch; |
| 614 | return; | 614 | return; |
| 615 | } | 615 | } |
| 616 | } | 616 | } |
| @@ -618,7 +618,7 @@ Tokenizer::inStringEscape(char ch) | @@ -618,7 +618,7 @@ Tokenizer::inStringEscape(char ch) | ||
| 618 | void | 618 | void |
| 619 | Tokenizer::inStringAfterCR(char ch) | 619 | Tokenizer::inStringAfterCR(char ch) |
| 620 | { | 620 | { |
| 621 | - this->state = st_in_string; | 621 | + state = st_in_string; |
| 622 | if (ch != '\n') { | 622 | if (ch != '\n') { |
| 623 | inString(ch); | 623 | inString(ch); |
| 624 | } | 624 | } |
| @@ -628,12 +628,12 @@ void | @@ -628,12 +628,12 @@ void | ||
| 628 | Tokenizer::inLt(char ch) | 628 | Tokenizer::inLt(char ch) |
| 629 | { | 629 | { |
| 630 | if (ch == '<') { | 630 | if (ch == '<') { |
| 631 | - this->type = tt::tt_dict_open; | ||
| 632 | - this->state = st_token_ready; | 631 | + type = tt::tt_dict_open; |
| 632 | + state = st_token_ready; | ||
| 633 | return; | 633 | return; |
| 634 | } | 634 | } |
| 635 | 635 | ||
| 636 | - this->state = st_in_hexstring; | 636 | + state = st_in_hexstring; |
| 637 | inHexstring(ch); | 637 | inHexstring(ch); |
| 638 | } | 638 | } |
| 639 | 639 | ||
| @@ -641,15 +641,15 @@ void | @@ -641,15 +641,15 @@ void | ||
| 641 | Tokenizer::inGt(char ch) | 641 | Tokenizer::inGt(char ch) |
| 642 | { | 642 | { |
| 643 | if (ch == '>') { | 643 | if (ch == '>') { |
| 644 | - this->type = tt::tt_dict_close; | ||
| 645 | - this->state = st_token_ready; | 644 | + type = tt::tt_dict_close; |
| 645 | + state = st_token_ready; | ||
| 646 | } else { | 646 | } else { |
| 647 | - this->type = tt::tt_bad; | 647 | + type = tt::tt_bad; |
| 648 | QTC::TC("qpdf", "QPDFTokenizer bad >"); | 648 | QTC::TC("qpdf", "QPDFTokenizer bad >"); |
| 649 | - this->error_message = "unexpected >"; | ||
| 650 | - this->in_token = false; | ||
| 651 | - this->char_to_unread = ch; | ||
| 652 | - this->state = st_token_ready; | 649 | + error_message = "unexpected >"; |
| 650 | + in_token = false; | ||
| 651 | + char_to_unread = ch; | ||
| 652 | + state = st_token_ready; | ||
| 653 | } | 653 | } |
| 654 | } | 654 | } |
| 655 | 655 | ||
| @@ -662,12 +662,12 @@ Tokenizer::inLiteral(char ch) | @@ -662,12 +662,12 @@ Tokenizer::inLiteral(char ch) | ||
| 662 | // stream keyword. Removing it here could make the stream-reading code break on some files, | 662 | // stream keyword. Removing it here could make the stream-reading code break on some files, |
| 663 | // though not on any files in the test suite as of this writing. | 663 | // though not on any files in the test suite as of this writing. |
| 664 | 664 | ||
| 665 | - this->in_token = false; | ||
| 666 | - this->char_to_unread = ch; | ||
| 667 | - this->state = st_token_ready; | ||
| 668 | - this->type = (this->raw_val == "true") || (this->raw_val == "false") | 665 | + in_token = false; |
| 666 | + char_to_unread = ch; | ||
| 667 | + state = st_token_ready; | ||
| 668 | + type = (raw_val == "true") || (raw_val == "false") | ||
| 669 | ? tt::tt_bool | 669 | ? tt::tt_bool |
| 670 | - : (this->raw_val == "null" ? tt::tt_null : tt::tt_word); | 670 | + : (raw_val == "null" ? tt::tt_null : tt::tt_word); |
| 671 | } | 671 | } |
| 672 | } | 672 | } |
| 673 | 673 | ||
| @@ -675,21 +675,21 @@ void | @@ -675,21 +675,21 @@ void | ||
| 675 | Tokenizer::inHexstring(char ch) | 675 | Tokenizer::inHexstring(char ch) |
| 676 | { | 676 | { |
| 677 | if (char hval = util::hex_decode_char(ch); hval < '\20') { | 677 | if (char hval = util::hex_decode_char(ch); hval < '\20') { |
| 678 | - this->char_code = int(hval) << 4; | ||
| 679 | - this->state = st_in_hexstring_2nd; | 678 | + char_code = int(hval) << 4; |
| 679 | + state = st_in_hexstring_2nd; | ||
| 680 | 680 | ||
| 681 | } else if (ch == '>') { | 681 | } else if (ch == '>') { |
| 682 | - this->type = tt::tt_string; | ||
| 683 | - this->state = st_token_ready; | 682 | + type = tt::tt_string; |
| 683 | + state = st_token_ready; | ||
| 684 | 684 | ||
| 685 | } else if (isSpace(ch)) { | 685 | } else if (isSpace(ch)) { |
| 686 | // ignore | 686 | // ignore |
| 687 | 687 | ||
| 688 | } else { | 688 | } else { |
| 689 | - this->type = tt::tt_bad; | 689 | + type = tt::tt_bad; |
| 690 | QTC::TC("qpdf", "QPDFTokenizer bad hexstring character"); | 690 | QTC::TC("qpdf", "QPDFTokenizer bad hexstring character"); |
| 691 | - this->error_message = std::string("invalid character (") + ch + ") in hexstring"; | ||
| 692 | - this->state = st_token_ready; | 691 | + error_message = std::string("invalid character (") + ch + ") in hexstring"; |
| 692 | + state = st_token_ready; | ||
| 693 | } | 693 | } |
| 694 | } | 694 | } |
| 695 | 695 | ||
| @@ -697,23 +697,23 @@ void | @@ -697,23 +697,23 @@ void | ||
| 697 | Tokenizer::inHexstring2nd(char ch) | 697 | Tokenizer::inHexstring2nd(char ch) |
| 698 | { | 698 | { |
| 699 | if (char hval = util::hex_decode_char(ch); hval < '\20') { | 699 | if (char hval = util::hex_decode_char(ch); hval < '\20') { |
| 700 | - this->val += char(this->char_code) | hval; | ||
| 701 | - this->state = st_in_hexstring; | 700 | + val += char(char_code) | hval; |
| 701 | + state = st_in_hexstring; | ||
| 702 | 702 | ||
| 703 | } else if (ch == '>') { | 703 | } else if (ch == '>') { |
| 704 | // PDF spec says odd hexstrings have implicit trailing 0. | 704 | // PDF spec says odd hexstrings have implicit trailing 0. |
| 705 | - this->val += char(this->char_code); | ||
| 706 | - this->type = tt::tt_string; | ||
| 707 | - this->state = st_token_ready; | 705 | + val += char(char_code); |
| 706 | + type = tt::tt_string; | ||
| 707 | + state = st_token_ready; | ||
| 708 | 708 | ||
| 709 | } else if (isSpace(ch)) { | 709 | } else if (isSpace(ch)) { |
| 710 | // ignore | 710 | // ignore |
| 711 | 711 | ||
| 712 | } else { | 712 | } else { |
| 713 | - this->type = tt::tt_bad; | 713 | + type = tt::tt_bad; |
| 714 | QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character"); | 714 | QTC::TC("qpdf", "QPDFTokenizer bad hexstring 2nd character"); |
| 715 | - this->error_message = std::string("invalid character (") + ch + ") in hexstring"; | ||
| 716 | - this->state = st_token_ready; | 715 | + error_message = std::string("invalid character (") + ch + ") in hexstring"; |
| 716 | + state = st_token_ready; | ||
| 717 | } | 717 | } |
| 718 | } | 718 | } |
| 719 | 719 | ||
| @@ -722,16 +722,16 @@ Tokenizer::inCharCode(char ch) | @@ -722,16 +722,16 @@ Tokenizer::inCharCode(char ch) | ||
| 722 | { | 722 | { |
| 723 | bool handled = false; | 723 | bool handled = false; |
| 724 | if (('0' <= ch) && (ch <= '7')) { | 724 | if (('0' <= ch) && (ch <= '7')) { |
| 725 | - this->char_code = 8 * this->char_code + (int(ch) - int('0')); | ||
| 726 | - if (++(this->digit_count) < 3) { | 725 | + char_code = 8 * char_code + (int(ch) - int('0')); |
| 726 | + if (++(digit_count) < 3) { | ||
| 727 | return; | 727 | return; |
| 728 | } | 728 | } |
| 729 | handled = true; | 729 | handled = true; |
| 730 | } | 730 | } |
| 731 | // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF | 731 | // We've accumulated \ddd or we have \d or \dd followed by other than an octal digit. The PDF |
| 732 | // Spec says to ignore high-order overflow. | 732 | // Spec says to ignore high-order overflow. |
| 733 | - this->val += char(this->char_code % 256); | ||
| 734 | - this->state = st_in_string; | 733 | + val += char(char_code % 256); |
| 734 | + state = st_in_string; | ||
| 735 | if (!handled) { | 735 | if (!handled) { |
| 736 | inString(ch); | 736 | inString(ch); |
| 737 | } | 737 | } |
| @@ -740,11 +740,11 @@ Tokenizer::inCharCode(char ch) | @@ -740,11 +740,11 @@ Tokenizer::inCharCode(char ch) | ||
| 740 | void | 740 | void |
| 741 | Tokenizer::inInlineImage(char ch) | 741 | Tokenizer::inInlineImage(char ch) |
| 742 | { | 742 | { |
| 743 | - if ((this->raw_val.length() + 1) == this->inline_image_bytes) { | 743 | + if ((raw_val.length() + 1) == inline_image_bytes) { |
| 744 | QTC::TC("qpdf", "QPDFTokenizer found EI by byte count"); | 744 | QTC::TC("qpdf", "QPDFTokenizer found EI by byte count"); |
| 745 | - this->type = tt::tt_inline_image; | ||
| 746 | - this->inline_image_bytes = 0; | ||
| 747 | - this->state = st_token_ready; | 745 | + type = tt::tt_inline_image; |
| 746 | + inline_image_bytes = 0; | ||
| 747 | + state = st_token_ready; | ||
| 748 | } | 748 | } |
| 749 | } | 749 | } |
| 750 | 750 | ||
| @@ -757,7 +757,7 @@ QPDFTokenizer::presentEOF() | @@ -757,7 +757,7 @@ QPDFTokenizer::presentEOF() | ||
| 757 | void | 757 | void |
| 758 | Tokenizer::presentEOF() | 758 | Tokenizer::presentEOF() |
| 759 | { | 759 | { |
| 760 | - switch (this->state) { | 760 | + switch (state) { |
| 761 | case st_name: | 761 | case st_name: |
| 762 | case st_name_hex1: | 762 | case st_name_hex1: |
| 763 | case st_name_hex2: | 763 | case st_name_hex2: |
| @@ -769,20 +769,20 @@ Tokenizer::presentEOF() | @@ -769,20 +769,20 @@ Tokenizer::presentEOF() | ||
| 769 | QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token"); | 769 | QTC::TC("qpdf", "QPDFTokenizer EOF reading appendable token"); |
| 770 | // Push any delimiter to the state machine to finish off the final token. | 770 | // Push any delimiter to the state machine to finish off the final token. |
| 771 | presentCharacter('\f'); | 771 | presentCharacter('\f'); |
| 772 | - this->in_token = true; | 772 | + in_token = true; |
| 773 | break; | 773 | break; |
| 774 | 774 | ||
| 775 | case st_top: | 775 | case st_top: |
| 776 | case st_before_token: | 776 | case st_before_token: |
| 777 | - this->type = tt::tt_eof; | 777 | + type = tt::tt_eof; |
| 778 | break; | 778 | break; |
| 779 | 779 | ||
| 780 | case st_in_space: | 780 | case st_in_space: |
| 781 | - this->type = this->include_ignorable ? tt::tt_space : tt::tt_eof; | 781 | + type = include_ignorable ? tt::tt_space : tt::tt_eof; |
| 782 | break; | 782 | break; |
| 783 | 783 | ||
| 784 | case st_in_comment: | 784 | case st_in_comment: |
| 785 | - this->type = this->include_ignorable ? tt::tt_comment : tt::tt_bad; | 785 | + type = include_ignorable ? tt::tt_comment : tt::tt_bad; |
| 786 | break; | 786 | break; |
| 787 | 787 | ||
| 788 | case st_token_ready: | 788 | case st_token_ready: |
| @@ -790,10 +790,10 @@ Tokenizer::presentEOF() | @@ -790,10 +790,10 @@ Tokenizer::presentEOF() | ||
| 790 | 790 | ||
| 791 | default: | 791 | default: |
| 792 | QTC::TC("qpdf", "QPDFTokenizer EOF reading token"); | 792 | QTC::TC("qpdf", "QPDFTokenizer EOF reading token"); |
| 793 | - this->type = tt::tt_bad; | ||
| 794 | - this->error_message = "EOF while reading token"; | 793 | + type = tt::tt_bad; |
| 794 | + error_message = "EOF while reading token"; | ||
| 795 | } | 795 | } |
| 796 | - this->state = st_token_ready; | 796 | + state = st_token_ready; |
| 797 | } | 797 | } |
| 798 | 798 | ||
| 799 | void | 799 | void |
| @@ -811,16 +811,16 @@ QPDFTokenizer::expectInlineImage(InputSource& input) | @@ -811,16 +811,16 @@ QPDFTokenizer::expectInlineImage(InputSource& input) | ||
| 811 | void | 811 | void |
| 812 | Tokenizer::expectInlineImage(InputSource& input) | 812 | Tokenizer::expectInlineImage(InputSource& input) |
| 813 | { | 813 | { |
| 814 | - if (this->state == st_token_ready) { | 814 | + if (state == st_token_ready) { |
| 815 | reset(); | 815 | reset(); |
| 816 | - } else if (this->state != st_before_token) { | 816 | + } else if (state != st_before_token) { |
| 817 | throw std::logic_error( | 817 | throw std::logic_error( |
| 818 | "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state"); | 818 | "QPDFTokenizer::expectInlineImage called when tokenizer is in improper state"); |
| 819 | } | 819 | } |
| 820 | findEI(input); | 820 | findEI(input); |
| 821 | - this->before_token = false; | ||
| 822 | - this->in_token = true; | ||
| 823 | - this->state = st_inline_image; | 821 | + before_token = false; |
| 822 | + in_token = true; | ||
| 823 | + state = st_inline_image; | ||
| 824 | } | 824 | } |
| 825 | 825 | ||
| 826 | void | 826 | void |
| @@ -913,15 +913,15 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch) | @@ -913,15 +913,15 @@ QPDFTokenizer::getToken(Token& token, bool& unread_char, char& ch) | ||
| 913 | bool | 913 | bool |
| 914 | Tokenizer::getToken(Token& token, bool& unread_char, char& ch) | 914 | Tokenizer::getToken(Token& token, bool& unread_char, char& ch) |
| 915 | { | 915 | { |
| 916 | - bool ready = (this->state == st_token_ready); | ||
| 917 | - unread_char = !this->in_token && !this->before_token; | ||
| 918 | - ch = this->char_to_unread; | 916 | + bool ready = (state == st_token_ready); |
| 917 | + unread_char = !in_token && !before_token; | ||
| 918 | + ch = char_to_unread; | ||
| 919 | if (ready) { | 919 | if (ready) { |
| 920 | - token = (!(this->type == tt::tt_name || this->type == tt::tt_string)) | ||
| 921 | - ? Token(this->type, this->raw_val, this->raw_val, this->error_message) | ||
| 922 | - : Token(this->type, this->val, this->raw_val, this->error_message); | 920 | + token = (!(type == tt::tt_name || type == tt::tt_string)) |
| 921 | + ? Token(type, raw_val, raw_val, error_message) | ||
| 922 | + : Token(type, val, raw_val, error_message); | ||
| 923 | 923 | ||
| 924 | - this->reset(); | 924 | + reset(); |
| 925 | } | 925 | } |
| 926 | return ready; | 926 | return ready; |
| 927 | } | 927 | } |
| @@ -980,46 +980,46 @@ Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_ | @@ -980,46 +980,46 @@ Tokenizer::readToken(InputSource& input, std::string const& context, bool allow_ | ||
| 980 | bool | 980 | bool |
| 981 | Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len) | 981 | Tokenizer::nextToken(InputSource& input, std::string const& context, size_t max_len) |
| 982 | { | 982 | { |
| 983 | - if (this->state != st_inline_image) { | 983 | + if (state != st_inline_image) { |
| 984 | reset(); | 984 | reset(); |
| 985 | } | 985 | } |
| 986 | qpdf_offset_t offset = input.fastTell(); | 986 | qpdf_offset_t offset = input.fastTell(); |
| 987 | 987 | ||
| 988 | - while (this->state != st_token_ready) { | 988 | + while (state != st_token_ready) { |
| 989 | char ch; | 989 | char ch; |
| 990 | if (!input.fastRead(ch)) { | 990 | if (!input.fastRead(ch)) { |
| 991 | presentEOF(); | 991 | presentEOF(); |
| 992 | 992 | ||
| 993 | - if ((this->type == tt::tt_eof) && (!this->allow_eof)) { | 993 | + if ((type == tt::tt_eof) && (!allow_eof)) { |
| 994 | // Nothing in the qpdf library calls readToken without allowEOF anymore, so this | 994 | // Nothing in the qpdf library calls readToken without allowEOF anymore, so this |
| 995 | // case is not exercised. | 995 | // case is not exercised. |
| 996 | - this->type = tt::tt_bad; | ||
| 997 | - this->error_message = "unexpected EOF"; | 996 | + type = tt::tt_bad; |
| 997 | + error_message = "unexpected EOF"; | ||
| 998 | offset = input.getLastOffset(); | 998 | offset = input.getLastOffset(); |
| 999 | } | 999 | } |
| 1000 | } else { | 1000 | } else { |
| 1001 | handleCharacter(ch); | 1001 | handleCharacter(ch); |
| 1002 | - if (this->before_token) { | 1002 | + if (before_token) { |
| 1003 | ++offset; | 1003 | ++offset; |
| 1004 | } | 1004 | } |
| 1005 | - if (this->in_token) { | ||
| 1006 | - this->raw_val += ch; | 1005 | + if (in_token) { |
| 1006 | + raw_val += ch; | ||
| 1007 | } | 1007 | } |
| 1008 | - if (max_len && (this->raw_val.length() >= max_len) && (this->state != st_token_ready)) { | 1008 | + if (max_len && (raw_val.length() >= max_len) && (state != st_token_ready)) { |
| 1009 | // terminate this token now | 1009 | // terminate this token now |
| 1010 | QTC::TC("qpdf", "QPDFTokenizer block long token"); | 1010 | QTC::TC("qpdf", "QPDFTokenizer block long token"); |
| 1011 | - this->type = tt::tt_bad; | ||
| 1012 | - this->state = st_token_ready; | ||
| 1013 | - this->error_message = "exceeded allowable length while reading token"; | 1011 | + type = tt::tt_bad; |
| 1012 | + state = st_token_ready; | ||
| 1013 | + error_message = "exceeded allowable length while reading token"; | ||
| 1014 | } | 1014 | } |
| 1015 | } | 1015 | } |
| 1016 | } | 1016 | } |
| 1017 | 1017 | ||
| 1018 | - input.fastUnread(!this->in_token && !this->before_token); | 1018 | + input.fastUnread(!in_token && !before_token); |
| 1019 | 1019 | ||
| 1020 | - if (this->type != tt::tt_eof) { | 1020 | + if (type != tt::tt_eof) { |
| 1021 | input.setLastOffset(offset); | 1021 | input.setLastOffset(offset); |
| 1022 | } | 1022 | } |
| 1023 | 1023 | ||
| 1024 | - return this->error_message.empty(); | 1024 | + return error_message.empty(); |
| 1025 | } | 1025 | } |
libqpdf/QPDFWriter.cc
| @@ -1013,8 +1013,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | @@ -1013,8 +1013,7 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) | ||
| 1013 | if (!m->id2.empty()) { | 1013 | if (!m->id2.empty()) { |
| 1014 | // Can't happen in the code | 1014 | // Can't happen in the code |
| 1015 | throw std::logic_error( | 1015 | throw std::logic_error( |
| 1016 | - "Deterministic ID computation enabled after ID" | ||
| 1017 | - " generation has already occurred."); | 1016 | + "Deterministic ID computation enabled after ID generation has already occurred."); |
| 1018 | } | 1017 | } |
| 1019 | qpdf_assert_debug(m->deterministic_id); | 1018 | qpdf_assert_debug(m->deterministic_id); |
| 1020 | qpdf_assert_debug(m->md5_pipeline == nullptr); | 1019 | qpdf_assert_debug(m->md5_pipeline == nullptr); |
libqpdf/QPDF_linearization.cc
| @@ -167,9 +167,7 @@ QPDF::readLinearizationData() | @@ -167,9 +167,7 @@ QPDF::readLinearizationData() | ||
| 167 | // that prevent loading. | 167 | // that prevent loading. |
| 168 | 168 | ||
| 169 | if (!isLinearized()) { | 169 | if (!isLinearized()) { |
| 170 | - throw std::logic_error( | ||
| 171 | - "called readLinearizationData for file" | ||
| 172 | - " that is not linearized"); | 170 | + throw std::logic_error("called readLinearizationData for file that is not linearized"); |
| 173 | } | 171 | } |
| 174 | 172 | ||
| 175 | // /L is read and stored in linp by isLinearized() | 173 | // /L is read and stored in linp by isLinearized() |
| @@ -468,8 +466,7 @@ QPDF::checkLinearizationInternal() | @@ -468,8 +466,7 @@ QPDF::checkLinearizationInternal() | ||
| 468 | if (m->file->tell() != m->first_xref_item_offset) { | 466 | if (m->file->tell() != m->first_xref_item_offset) { |
| 469 | QTC::TC("qpdf", "QPDF err /T mismatch"); | 467 | QTC::TC("qpdf", "QPDF err /T mismatch"); |
| 470 | linearizationWarning( | 468 | linearizationWarning( |
| 471 | - "space before first xref item (/T) mismatch " | ||
| 472 | - "(computed = " + | 469 | + "space before first xref item (/T) mismatch (computed = " + |
| 473 | std::to_string(m->first_xref_item_offset) + | 470 | std::to_string(m->first_xref_item_offset) + |
| 474 | "; file = " + std::to_string(m->file->tell())); | 471 | "; file = " + std::to_string(m->file->tell())); |
| 475 | } | 472 | } |
| @@ -694,9 +691,7 @@ QPDF::checkHPageOffset( | @@ -694,9 +691,7 @@ QPDF::checkHPageOffset( | ||
| 694 | for (size_t i = 0; i < toS(he.nshared_objects); ++i) { | 691 | for (size_t i = 0; i < toS(he.nshared_objects); ++i) { |
| 695 | int idx = he.shared_identifiers.at(i); | 692 | int idx = he.shared_identifiers.at(i); |
| 696 | if (shared_idx_to_obj.count(idx) == 0) { | 693 | if (shared_idx_to_obj.count(idx) == 0) { |
| 697 | - stopOnError( | ||
| 698 | - "unable to get object for item in" | ||
| 699 | - " shared objects hint table"); | 694 | + stopOnError("unable to get object for item in shared objects hint table"); |
| 700 | } | 695 | } |
| 701 | hint_shared.insert(shared_idx_to_obj[idx]); | 696 | hint_shared.insert(shared_idx_to_obj[idx]); |
| 702 | } | 697 | } |
| @@ -759,15 +754,12 @@ QPDF::checkHSharedObject(std::vector<QPDFObjectHandle> const& pages, std::map<in | @@ -759,15 +754,12 @@ QPDF::checkHSharedObject(std::vector<QPDFObjectHandle> const& pages, std::map<in | ||
| 759 | if (i == so.nshared_first_page) { | 754 | if (i == so.nshared_first_page) { |
| 760 | QTC::TC("qpdf", "QPDF lin check shared past first page"); | 755 | QTC::TC("qpdf", "QPDF lin check shared past first page"); |
| 761 | if (m->part8.empty()) { | 756 | if (m->part8.empty()) { |
| 762 | - linearizationWarning( | ||
| 763 | - "part 8 is empty but nshared_total > " | ||
| 764 | - "nshared_first_page"); | 757 | + linearizationWarning("part 8 is empty but nshared_total > nshared_first_page"); |
| 765 | } else { | 758 | } else { |
| 766 | int obj = m->part8.at(0).getObjectID(); | 759 | int obj = m->part8.at(0).getObjectID(); |
| 767 | if (obj != so.first_shared_obj) { | 760 | if (obj != so.first_shared_obj) { |
| 768 | linearizationWarning( | 761 | linearizationWarning( |
| 769 | - "first shared object number mismatch: " | ||
| 770 | - "hint table = " + | 762 | + "first shared object number mismatch: hint table = " + |
| 771 | std::to_string(so.first_shared_obj) + | 763 | std::to_string(so.first_shared_obj) + |
| 772 | "; computed = " + std::to_string(obj)); | 764 | "; computed = " + std::to_string(obj)); |
| 773 | } | 765 | } |
| @@ -846,9 +838,7 @@ QPDF::checkHOutlines() | @@ -846,9 +838,7 @@ QPDF::checkHOutlines() | ||
| 846 | std::to_string(table_length) + "; computed = " + std::to_string(length)); | 838 | std::to_string(table_length) + "; computed = " + std::to_string(length)); |
| 847 | } | 839 | } |
| 848 | } else { | 840 | } else { |
| 849 | - linearizationWarning( | ||
| 850 | - "incorrect first object number in outline " | ||
| 851 | - "hints table."); | 841 | + linearizationWarning("incorrect first object number in outline hints table."); |
| 852 | } | 842 | } |
| 853 | } else { | 843 | } else { |
| 854 | linearizationWarning("incorrect object count in outline hint table"); | 844 | linearizationWarning("incorrect object count in outline hint table"); |
| @@ -1131,9 +1121,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1131,9 +1121,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1131 | break; | 1121 | break; |
| 1132 | 1122 | ||
| 1133 | case ObjUser::ou_bad: | 1123 | case ObjUser::ou_bad: |
| 1134 | - stopOnError( | ||
| 1135 | - "INTERNAL ERROR: QPDF::calculateLinearizationData: " | ||
| 1136 | - "invalid user type"); | 1124 | + stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: invalid user type"); |
| 1137 | break; | 1125 | break; |
| 1138 | } | 1126 | } |
| 1139 | } | 1127 | } |
| @@ -1196,9 +1184,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1196,9 +1184,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1196 | // Part 4: open document objects. We don't care about the order. | 1184 | // Part 4: open document objects. We don't care about the order. |
| 1197 | 1185 | ||
| 1198 | if (lc_root.size() != 1) { | 1186 | if (lc_root.size() != 1) { |
| 1199 | - stopOnError( | ||
| 1200 | - "found other than one root while" | ||
| 1201 | - " calculating linearization data"); | 1187 | + stopOnError("found other than one root while calculating linearization data"); |
| 1202 | } | 1188 | } |
| 1203 | m->part4.push_back(getObject(*(lc_root.begin()))); | 1189 | m->part4.push_back(getObject(*(lc_root.begin()))); |
| 1204 | for (auto const& og: lc_open_document) { | 1190 | for (auto const& og: lc_open_document) { |
| @@ -1255,8 +1241,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1255,8 +1241,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1255 | QPDFObjGen page_og(pages.at(i).getObjGen()); | 1241 | QPDFObjGen page_og(pages.at(i).getObjGen()); |
| 1256 | if (!lc_other_page_private.count(page_og)) { | 1242 | if (!lc_other_page_private.count(page_og)) { |
| 1257 | stopOnError( | 1243 | stopOnError( |
| 1258 | - "INTERNAL ERROR: " | ||
| 1259 | - "QPDF::calculateLinearizationData: page object for page " + | 1244 | + "INTERNAL ERROR: QPDF::calculateLinearizationData: page object for page " + |
| 1260 | std::to_string(i) + " not in lc_other_page_private"); | 1245 | std::to_string(i) + " not in lc_other_page_private"); |
| 1261 | } | 1246 | } |
| 1262 | lc_other_page_private.erase(page_og); | 1247 | lc_other_page_private.erase(page_og); |
| @@ -1269,9 +1254,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1269,9 +1254,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1269 | 1254 | ||
| 1270 | ObjUser ou(ObjUser::ou_page, toI(i)); | 1255 | ObjUser ou(ObjUser::ou_page, toI(i)); |
| 1271 | if (m->obj_user_to_objects.count(ou) == 0) { | 1256 | if (m->obj_user_to_objects.count(ou) == 0) { |
| 1272 | - stopOnError( | ||
| 1273 | - "found unreferenced page while" | ||
| 1274 | - " calculating linearization data"); | 1257 | + stopOnError("found unreferenced page while calculating linearization data"); |
| 1275 | } | 1258 | } |
| 1276 | for (auto const& og: m->obj_user_to_objects[ou]) { | 1259 | for (auto const& og: m->obj_user_to_objects[ou]) { |
| 1277 | if (lc_other_page_private.count(og)) { | 1260 | if (lc_other_page_private.count(og)) { |
| @@ -1284,9 +1267,8 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1284,9 +1267,8 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1284 | // That should have covered all part7 objects. | 1267 | // That should have covered all part7 objects. |
| 1285 | if (!lc_other_page_private.empty()) { | 1268 | if (!lc_other_page_private.empty()) { |
| 1286 | stopOnError( | 1269 | stopOnError( |
| 1287 | - "INTERNAL ERROR:" | ||
| 1288 | - " QPDF::calculateLinearizationData: lc_other_page_private is " | ||
| 1289 | - "not empty after generation of part7"); | 1270 | + "INTERNAL ERROR: QPDF::calculateLinearizationData:" |
| 1271 | + " lc_other_page_private is not empty after generation of part7"); | ||
| 1290 | } | 1272 | } |
| 1291 | 1273 | ||
| 1292 | // Part 8: other pages' shared objects | 1274 | // Part 8: other pages' shared objects |
| @@ -1307,9 +1289,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1307,9 +1289,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1307 | std::set<QPDFObjGen> pages_ogs = | 1289 | std::set<QPDFObjGen> pages_ogs = |
| 1308 | m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")]; | 1290 | m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")]; |
| 1309 | if (pages_ogs.empty()) { | 1291 | if (pages_ogs.empty()) { |
| 1310 | - stopOnError( | ||
| 1311 | - "found empty pages tree while" | ||
| 1312 | - " calculating linearization data"); | 1292 | + stopOnError("found empty pages tree while calculating linearization data"); |
| 1313 | } | 1293 | } |
| 1314 | for (auto const& og: pages_ogs) { | 1294 | for (auto const& og: pages_ogs) { |
| 1315 | if (lc_other.count(og)) { | 1295 | if (lc_other.count(og)) { |
| @@ -1418,9 +1398,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | @@ -1418,9 +1398,7 @@ QPDF::calculateLinearizationData(T const& object_stream_data) | ||
| 1418 | CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i); | 1398 | CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i); |
| 1419 | ObjUser ou(ObjUser::ou_page, toI(i)); | 1399 | ObjUser ou(ObjUser::ou_page, toI(i)); |
| 1420 | if (m->obj_user_to_objects.count(ou) == 0) { | 1400 | if (m->obj_user_to_objects.count(ou) == 0) { |
| 1421 | - stopOnError( | ||
| 1422 | - "found unreferenced page while" | ||
| 1423 | - " calculating linearization data"); | 1401 | + stopOnError("found unreferenced page while calculating linearization data"); |
| 1424 | } | 1402 | } |
| 1425 | for (auto const& og: m->obj_user_to_objects[ou]) { | 1403 | for (auto const& og: m->obj_user_to_objects[ou]) { |
| 1426 | if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) { | 1404 | if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) { |
| @@ -1759,9 +1737,7 @@ QPDF::writeHSharedObject(BitWriter& w) | @@ -1759,9 +1737,7 @@ QPDF::writeHSharedObject(BitWriter& w) | ||
| 1759 | for (size_t i = 0; i < toS(nitems); ++i) { | 1737 | for (size_t i = 0; i < toS(nitems); ++i) { |
| 1760 | // If signature were present, we'd have to write a 128-bit hash. | 1738 | // If signature were present, we'd have to write a 128-bit hash. |
| 1761 | if (entries.at(i).signature_present != 0) { | 1739 | if (entries.at(i).signature_present != 0) { |
| 1762 | - stopOnError( | ||
| 1763 | - "found unexpected signature present" | ||
| 1764 | - " while writing linearization data"); | 1740 | + stopOnError("found unexpected signature present while writing linearization data"); |
| 1765 | } | 1741 | } |
| 1766 | } | 1742 | } |
| 1767 | write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one); | 1743 | write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one); |
libqpdf/QPDF_optimization.cc
| @@ -168,8 +168,7 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) | @@ -168,8 +168,7 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) | ||
| 168 | warn_skipped_keys); | 168 | warn_skipped_keys); |
| 169 | if (!key_ancestors.empty()) { | 169 | if (!key_ancestors.empty()) { |
| 170 | throw std::logic_error( | 170 | throw std::logic_error( |
| 171 | - "key_ancestors not empty after" | ||
| 172 | - " pushing inherited attributes to pages"); | 171 | + "key_ancestors not empty after pushing inherited attributes to pages"); |
| 173 | } | 172 | } |
| 174 | m->pushed_inherited_attributes_to_pages = true; | 173 | m->pushed_inherited_attributes_to_pages = true; |
| 175 | m->ever_pushed_inherited_attributes_to_pages = true; | 174 | m->ever_pushed_inherited_attributes_to_pages = true; |