From 38d8cc7f674b10b14a229f06bf205067996745a0 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 8 Feb 2025 11:03:48 -0500 Subject: [PATCH] Bump clang-format to version 20 and reformat --- ChangeLog | 2 +- examples/pdf-attach-file.cc | 46 ++++++++++++++++++++++++---------------------- examples/pdf-create.cc | 9 +++++---- format-code | 2 +- include/qpdf/QPDFObjectHandle.hh | 3 ++- include/qpdf/QPDFObjectHandle_future.hh | 3 ++- libqpdf/InputSource.cc | 5 +++-- libqpdf/NNTree.cc | 5 +++-- libqpdf/Pl_AES_PDF.cc | 5 +++-- libqpdf/Pl_ASCIIHexDecoder.cc | 5 +++-- libqpdf/QPDF.cc | 32 +++++++++++++++++++------------- libqpdf/QPDFAcroFormDocumentHelper.cc | 15 +++++++++------ libqpdf/QPDFFormFieldObjectHelper.cc | 17 +++++++++-------- libqpdf/QPDFJob.cc | 42 +++++++++++++++++++++++++----------------- libqpdf/QPDFJob_json.cc | 10 ++++++---- libqpdf/QPDFLogger.cc | 5 +++-- libqpdf/QPDFObjectHandle.cc | 10 ++++++---- libqpdf/QPDFPageDocumentHelper.cc | 5 +++-- libqpdf/QPDFPageObjectHelper.cc | 17 ++++++++++------- libqpdf/QPDFParser.cc | 10 ++++++---- libqpdf/QPDFWriter.cc | 17 ++++++++++------- libqpdf/QPDF_Stream.cc | 24 ++++++++++++++---------- libqpdf/QPDF_encryption.cc | 5 +++-- libqpdf/QPDF_json.cc | 9 +++++---- libqpdf/QPDF_linearization.cc | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------- libqpdf/QPDF_optimization.cc | 5 +++-- libqpdf/QPDF_pages.cc | 5 +++-- libqpdf/QUtil.cc | 7 ++++--- libqpdf/SecureRandomDataProvider.cc | 5 +++-- libqpdf/qpdf/QPDFParser.hh | 5 +++-- libqpdf/qpdf/qpdf-c_impl.hh | 2 +- libtests/md5.cc | 10 ++++++---- libtests/qutil.cc | 5 +++-- manual/contributing.rst | 2 +- qpdf/pdf_from_scratch.cc | 17 +++++++++-------- 35 files changed, 263 insertions(+), 192 deletions(-) diff --git a/ChangeLog b/ChangeLog index 76d66af..dfc5b21 100644 --- a/ChangeLog +++ b/ChangeLog @@ -49,7 +49,7 @@ * Add QPDF::setMaxWarnings to set the maximum of warnings before warning suppression. - * Add static option to Pl_DCT to limit memory usage of + * Add static option to Pl_DCT to limit memory usage of decompression. The option is generally exposed but is primarily intended to support fuzz tests, which have explicit memory limits that are smaller than what is commonly seen in the wild with PDF diff --git a/examples/pdf-attach-file.cc b/examples/pdf-attach-file.cc index 9ae3b24..be3ca25 100644 --- a/examples/pdf-attach-file.cc +++ b/examples/pdf-attach-file.cc @@ -86,13 +86,14 @@ process( // Create appearance stream for the attachment. - auto ap = q.newStream("0 10 m\n" - "10 0 l\n" - "20 10 l\n" - "10 0 m\n" - "10 20 l\n" - "0 0 20 20 re\n" - "S\n"); + auto ap = q.newStream( + "0 10 m\n" + "10 0 l\n" + "20 10 l\n" + "10 0 m\n" + "10 20 l\n" + "0 0 20 20 re\n" + "S\n"); auto apdict = ap.getDict(); // The following four lines demonstrate the use of the qpdf literal syntax introduced in @@ -105,21 +106,22 @@ process( apdict.replaceKey("/Type", "/XObject"_qpdf); apdict.replaceKey("/Subtype", "/Form"_qpdf); apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf); - auto annot = q.makeIndirectObject(QPDFObjectHandle::parse( - &q, - ("<<" - " /AP <<" - " /N " + - ap.unparse() + - " >>" - " /Contents " + - QPDFObjectHandle::newUnicodeString(attachment).unparse() + " /FS " + - fs.getObjectHandle().unparse() + " /NM " + - QPDFObjectHandle::newUnicodeString(attachment).unparse() + - " /Rect [ 72 700 92 720 ]" - " /Subtype /FileAttachment" - " /Type /Annot" - ">>"))); + auto annot = q.makeIndirectObject( + QPDFObjectHandle::parse( + &q, + ("<<" + " /AP <<" + " /N " + + ap.unparse() + + " >>" + " /Contents " + + QPDFObjectHandle::newUnicodeString(attachment).unparse() + " /FS " + + fs.getObjectHandle().unparse() + " /NM " + + QPDFObjectHandle::newUnicodeString(attachment).unparse() + + " /Rect [ 72 700 92 720 ]" + " /Subtype /FileAttachment" + " /Type /Annot" + ">>"))); // Generate contents for the page. auto contents = q.newStream(("q\n" diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc index 136643d..c44e5f5 100644 --- a/examples/pdf-create.cc +++ b/examples/pdf-create.cc @@ -194,10 +194,11 @@ add_page( QPDFObjectHandle contents = createPageContents(pdf, color_space + " with filter " + filter); // Create the page dictionary - QPDFObjectHandle page = pdf.makeIndirectObject("<<" - " /Type /Page" - " /MediaBox [0 0 612 392]" - ">>"_qpdf); + QPDFObjectHandle page = pdf.makeIndirectObject( + "<<" + " /Type /Page" + " /MediaBox [0 0 612 392]" + ">>"_qpdf); page.replaceKey("/Contents", contents); page.replaceKey("/Resources", resources); diff --git a/format-code b/format-code index 6c5bfed..125e543 100755 --- a/format-code +++ b/format-code @@ -23,7 +23,7 @@ # are improvements, bump the minimum required version of clang-format # here, and update manual/contributing.rst. There's a comment there # that refers to this comment. See also .clang-format. -min_version=18 +min_version=20 clang_format=clang-format if clang-format-$min_version --version >/dev/null 2>&1; then diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index bfa3236..cd0f91c 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const return obj != nullptr; } -inline QPDFObjectHandle::operator bool() const noexcept +inline QPDFObjectHandle:: +operator bool() const noexcept { return static_cast(obj); } diff --git a/include/qpdf/QPDFObjectHandle_future.hh b/include/qpdf/QPDFObjectHandle_future.hh index fe255af..539bb52 100644 --- a/include/qpdf/QPDFObjectHandle_future.hh +++ b/include/qpdf/QPDFObjectHandle_future.hh @@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const noexcept return obj != nullptr; } -inline QPDFObjectHandle::operator bool() const noexcept +inline QPDFObjectHandle:: +operator bool() const noexcept { return static_cast(obj); } diff --git a/libqpdf/InputSource.cc b/libqpdf/InputSource.cc index 9389c2f..8055330 100644 --- a/libqpdf/InputSource.cc +++ b/libqpdf/InputSource.cc @@ -57,8 +57,9 @@ InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len // memory. size_t size = sizeof(buf) - 1; if ((strlen(start_chars) < 1) || (strlen(start_chars) > size)) { - throw std::logic_error("InputSource::findSource called with" - " too small or too large of a character sequence"); + throw std::logic_error( + "InputSource::findSource called with" + " too small or too large of a character sequence"); } char* p = nullptr; diff --git a/libqpdf/NNTree.cc b/libqpdf/NNTree.cc index 58d07d2..b71f8a1 100644 --- a/libqpdf/NNTree.cc +++ b/libqpdf/NNTree.cc @@ -62,8 +62,9 @@ NNTreeIterator::updateIValue(bool allow_invalid) } if (!okay) { if (!allow_invalid) { - throw std::logic_error("attempt made to dereference an invalid" - " name/number tree iterator"); + throw std::logic_error( + "attempt made to dereference an invalid" + " name/number tree iterator"); } this->ivalue.first = QPDFObjectHandle(); this->ivalue.second = QPDFObjectHandle(); diff --git a/libqpdf/Pl_AES_PDF.cc b/libqpdf/Pl_AES_PDF.cc index 8b3982b..2236486 100644 --- a/libqpdf/Pl_AES_PDF.cc +++ b/libqpdf/Pl_AES_PDF.cc @@ -111,8 +111,9 @@ Pl_AES_PDF::finish() // However, we have encountered files for which the output is not a multiple of the // block size. In this case, pad with zeroes and hope for the best. if (this->offset >= this->buf_size) { - throw std::logic_error("buffer overflow in AES encryption" - " pipeline"); + throw std::logic_error( + "buffer overflow in AES encryption" + " pipeline"); } std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset); this->offset = this->buf_size; diff --git a/libqpdf/Pl_ASCIIHexDecoder.cc b/libqpdf/Pl_ASCIIHexDecoder.cc index b78d554..dd2cd46 100644 --- a/libqpdf/Pl_ASCIIHexDecoder.cc +++ b/libqpdf/Pl_ASCIIHexDecoder.cc @@ -47,8 +47,9 @@ Pl_ASCIIHexDecoder::write(unsigned char const* buf, size_t len) t[0] = ch; t[1] = 0; throw std::runtime_error( - std::string("character out of range" - " during base Hex decode: ") + + std::string( + "character out of range" + " during base Hex decode: ") + t); } break; diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc index 85fe94d..70bdf62 100644 --- a/libqpdf/QPDF.cc +++ b/libqpdf/QPDF.cc @@ -101,9 +101,10 @@ namespace void throwException() { - throw std::logic_error("QPDF operation attempted on a QPDF object with no input " - "source. QPDF operations are invalid before processFile (or " - "another process method) or after closeInputSource"); + throw std::logic_error( + "QPDF operation attempted on a QPDF object with no input " + "source. QPDF operations are invalid before processFile (or " + "another process method) or after closeInputSource"); } }; } // namespace @@ -495,8 +496,9 @@ QPDF::inParse(bool v) if (m->in_parse == v) { // This happens if QPDFParser::parse tries to resolve an indirect object while it is // parsing. - throw std::logic_error("QPDF: re-entrant parsing detected. This is a qpdf bug." - " Please report at https://github.com/qpdf/qpdf/issues."); + throw std::logic_error( + "QPDF: re-entrant parsing detected. This is a qpdf bug." + " Please report at https://github.com/qpdf/qpdf/issues."); } m->in_parse = v; } @@ -1188,8 +1190,9 @@ QPDF::processXRefIndex( throw damaged( "Cross-reference stream's /Index contains a negative object id"); } else if (first > max_num_entries) { - throw damaged("Cross-reference stream's /Index contains an impossibly " - "large object id"); + throw damaged( + "Cross-reference stream's /Index contains an impossibly " + "large object id"); } } } else { @@ -1392,8 +1395,9 @@ QPDF::showXRefTable() break; default: - throw std::logic_error("unknown cross-reference table type while" - " showing xref_table"); + throw std::logic_error( + "unknown cross-reference table type while" + " showing xref_table"); break; } m->log->info("\n"); @@ -2266,8 +2270,9 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign) ObjCopier& obj_copier = m->object_copiers[other.m->unique_id]; if (!obj_copier.visiting.empty()) { - throw std::logic_error("obj_copier.visiting is not empty" - " at the beginning of copyForeignObject"); + throw std::logic_error( + "obj_copier.visiting is not empty" + " at the beginning of copyForeignObject"); } // Make sure we have an object in this file for every referenced object in the old file. @@ -2439,8 +2444,9 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign) auto stream = foreign.getObjectPtr()->as(); if (stream == nullptr) { - throw std::logic_error("unable to retrieve underlying" - " stream object from foreign stream"); + throw std::logic_error( + "unable to retrieve underlying" + " stream object from foreign stream"); } std::shared_ptr stream_buffer = stream->getStreamDataBuffer(); if ((foreign_stream_qpdf.m->immediate_copy_from) && (stream_buffer == nullptr)) { diff --git a/libqpdf/QPDFAcroFormDocumentHelper.cc b/libqpdf/QPDFAcroFormDocumentHelper.cc index fb096e5..7fe779a 100644 --- a/libqpdf/QPDFAcroFormDocumentHelper.cc +++ b/libqpdf/QPDFAcroFormDocumentHelper.cc @@ -276,8 +276,9 @@ QPDFAcroFormDocumentHelper::analyze() // case such as a PDF creator adding a self-contained annotation (merged with the // field dictionary) to the page's /Annots array and forgetting to also put it in // /AcroForm. - annot.warnIfPossible("this widget annotation is not" - " reachable from /AcroForm in the document catalog"); + annot.warnIfPossible( + "this widget annotation is not" + " reachable from /AcroForm in the document catalog"); m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot); m->field_to_annotations[og].emplace_back(annot); } @@ -296,14 +297,16 @@ QPDFAcroFormDocumentHelper::traverseField( } if (!field.isIndirect()) { QTC::TC("qpdf", "QPDFAcroFormDocumentHelper direct field"); - field.warnIfPossible("encountered a direct object as a field or annotation while " - "traversing /AcroForm; ignoring field or annotation"); + field.warnIfPossible( + "encountered a direct object as a field or annotation while " + "traversing /AcroForm; ignoring field or annotation"); return; } if (!field.isDictionary()) { QTC::TC("qpdf", "QPDFAcroFormDocumentHelper non-dictionary field"); - field.warnIfPossible("encountered a non-dictionary as a field or annotation while" - " traversing /AcroForm; ignoring field or annotation"); + field.warnIfPossible( + "encountered a non-dictionary as a field or annotation while" + " traversing /AcroForm; ignoring field or annotation"); return; } QPDFObjGen og(field.getObjGen()); diff --git a/libqpdf/QPDFFormFieldObjectHelper.cc b/libqpdf/QPDFFormFieldObjectHelper.cc index 0154511..8e5b2d8 100644 --- a/libqpdf/QPDFFormFieldObjectHelper.cc +++ b/libqpdf/QPDFFormFieldObjectHelper.cc @@ -331,9 +331,9 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances) setFieldAttribute("/V", value); } if (need_appearances) { - QPDF& qpdf = - this->oh.getQPDF("QPDFFormFieldObjectHelper::setV called with need_appearances = " - "true on an object that is not associated with an owning QPDF"); + QPDF& qpdf = this->oh.getQPDF( + "QPDFFormFieldObjectHelper::setV called with need_appearances = " + "true on an object that is not associated with an owning QPDF"); QPDFAcroFormDocumentHelper(qpdf).setNeedAppearances(true); } } @@ -368,8 +368,9 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name) QPDFObjectHandle kids = this->oh.getKey("/Kids"); if (!(isRadioButton() && parent.isNull() && kids.isArray())) { - this->oh.warnIfPossible("don't know how to set the value" - " of this field as a radio button"); + this->oh.warnIfPossible( + "don't know how to set the value" + " of this field as a radio button"); return; } setFieldAttribute("/V", name); @@ -770,9 +771,9 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper& ao QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AS from scratch"); QPDFObjectHandle::Rectangle rect = aoh.getRect(); QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly); - QPDFObjectHandle dict = - QPDFObjectHandle::parse("<< /Resources << /ProcSet [ /PDF /Text ] >>" - " /Type /XObject /Subtype /Form >>"); + QPDFObjectHandle dict = QPDFObjectHandle::parse( + "<< /Resources << /ProcSet [ /PDF /Text ] >>" + " /Type /XObject /Subtype /Form >>"); dict.replaceKey("/BBox", QPDFObjectHandle::newFromRectangle(bbox)); AS = QPDFObjectHandle::newStream(this->oh.getOwningQPDF(), "/Tx BMC\nEMC\n"); AS.replaceDict(dict); diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index a8d6541..8ea06dc 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -614,8 +614,9 @@ QPDFJob::checkConfiguration() usage("no output file may be given for this option"); } if (m->check_requires_password && m->check_is_encrypted) { - usage("--requires-password and --is-encrypted may not be given" - " together"); + usage( + "--requires-password and --is-encrypted may not be given" + " together"); } if (m->encrypt && (!m->allow_insecure) && @@ -646,8 +647,9 @@ QPDFJob::checkConfiguration() } if ((!m->split_pages) && QUtil::same_file(m->infilename.get(), m->outfilename.get())) { QTC::TC("qpdf", "QPDFJob same file error"); - usage("input file and output file are the same; use --replace-input to intentionally " - "overwrite the input file"); + usage( + "input file and output file are the same; use --replace-input to intentionally " + "overwrite the input file"); } if (m->json_version == 1) { @@ -2243,8 +2245,9 @@ QPDFJob::handleTransformations(QPDF& pdf) } last_page_seen = spec.first_page; nums.appendItem(QPDFObjectHandle::newInteger(spec.first_page - 1)); - nums.appendItem(QPDFPageLabelDocumentHelper::pageLabelDict( - spec.label_type, spec.start_num, spec.prefix)); + nums.appendItem( + QPDFPageLabelDocumentHelper::pageLabelDict( + spec.label_type, spec.start_num, spec.prefix)); } auto page_labels = QPDFObjectHandle::newDictionary(); page_labels.replaceKey("/Nums", nums); @@ -2497,8 +2500,9 @@ QPDFJob::handlePageSpecs(QPDF& pdf, std::vector>& page_hea auto n_collate = m->collate.size(); auto n_specs = parsed_specs.size(); if (!(n_collate == 0 || n_collate == 1 || n_collate == n_specs)) { - usage("--pages: if --collate has more than one value, it must have one value per page " - "specification"); + usage( + "--pages: if --collate has more than one value, it must have one value per page " + "specification"); } if (n_collate > 0 && n_specs > 1) { // Collate the pages by selecting one page from each spec in order. When a spec runs out of @@ -2706,8 +2710,9 @@ QPDFJob::maybeFixWritePassword(int R, std::string& password) std::string encoded; if (!QUtil::utf8_to_pdf_doc(password, encoded)) { QTC::TC("qpdf", "QPDFJob password not encodable"); - throw std::runtime_error("supplied password cannot be encoded for 40-bit " - "or 128-bit encryption formats"); + throw std::runtime_error( + "supplied password cannot be encoded for 40-bit " + "or 128-bit encryption formats"); } password = encoded; } @@ -2948,13 +2953,15 @@ QPDFJob::setWriterOptions(QPDFWriter& w) } if (m->progress) { if (m->progress_handler) { - w.registerProgressReporter(std::shared_ptr( - new QPDFWriter::FunctionProgressReporter(m->progress_handler))); + w.registerProgressReporter( + std::shared_ptr( + new QPDFWriter::FunctionProgressReporter(m->progress_handler))); } else { char const* outfilename = m->outfilename ? m->outfilename.get() : "standard output"; - w.registerProgressReporter(std::shared_ptr( - // line-break - new ProgressReporter(*m->log->getInfo(), m->message_prefix, outfilename))); + w.registerProgressReporter( + std::shared_ptr( + // line-break + new ProgressReporter(*m->log->getInfo(), m->message_prefix, outfilename))); } } } @@ -3127,8 +3134,9 @@ QPDFJob::writeJSON(QPDF& pdf) fp = std::make_shared("json output", fc->f); } else if ((m->json_stream_data == qpdf_sj_file) && m->json_stream_prefix.empty()) { QTC::TC("qpdf", "QPDFJob need json-stream-prefix for stdout"); - usage("please specify --json-stream-prefix since the input file " - "name is unknown"); + usage( + "please specify --json-stream-prefix since the input file " + "name is unknown"); } else { QTC::TC("qpdf", "QPDFJob write json to stdout"); m->log->saveToStandardOutput(true); diff --git a/libqpdf/QPDFJob_json.cc b/libqpdf/QPDFJob_json.cc index 83bc856..f5ed0a8 100644 --- a/libqpdf/QPDFJob_json.cc +++ b/libqpdf/QPDFJob_json.cc @@ -295,13 +295,15 @@ Handlers::beginEncrypt(JSON j) }); if (key_len == 0) { QTC::TC("qpdf", "QPDFJob json encrypt no key length"); - usage("exactly one of 40bit, 128bit, or 256bit must be given; an empty dictionary may be " - "supplied for one of them to set the key length without imposing any restrictions"); + usage( + "exactly one of 40bit, 128bit, or 256bit must be given; an empty dictionary may be " + "supplied for one of them to set the key length without imposing any restrictions"); } if (!(user_password_seen && owner_password_seen)) { QTC::TC("qpdf", "QPDFJob json encrypt missing password"); - usage("the user and owner password are both required; use the empty string for the user " - "password if you don't want a password"); + usage( + "the user and owner password are both required; use the empty string for the user " + "password if you don't want a password"); } this->c_enc = c_main->encrypt(key_len, user_password, owner_password); } diff --git a/libqpdf/QPDFLogger.cc b/libqpdf/QPDFLogger.cc index 07c08cc..2661472 100644 --- a/libqpdf/QPDFLogger.cc +++ b/libqpdf/QPDFLogger.cc @@ -200,8 +200,9 @@ QPDFLogger::setSave(std::shared_ptr p, bool only_if_not_set) if (p == m->p_stdout) { auto pt = dynamic_cast(p.get()); if (pt->getUsed()) { - throw std::logic_error("QPDFLogger: called setSave on standard output after standard" - " output has already been used"); + throw std::logic_error( + "QPDFLogger: called setSave on standard output after standard" + " output has already been used"); } if (m->p_info == m->p_stdout) { m->p_info = m->p_stderr; diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index aec3e58..b3de030 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1507,8 +1507,9 @@ QPDFObjectHandle::getUniqueResourceName( // This could only happen if there is a coding error. // The number of candidates we test is more than the // number of keys we're checking against. - throw std::logic_error("unable to find unconflicting name in" - " QPDFObjectHandle::getUniqueResourceName"); + throw std::logic_error( + "unable to find unconflicting name in" + " QPDFObjectHandle::getUniqueResourceName"); } // Dictionary mutators @@ -2820,8 +2821,9 @@ QPDFObjectHandle::checkOwnership(QPDFObjectHandle const& item) const auto item_qpdf = item.getOwningQPDF(); if ((qpdf != nullptr) && (item_qpdf != nullptr) && (qpdf != item_qpdf)) { QTC::TC("qpdf", "QPDFObjectHandle check ownership"); - throw std::logic_error("Attempting to add an object from a different QPDF. Use " - "QPDF::copyForeignObject to add objects from another file."); + throw std::logic_error( + "Attempting to add an object from a different QPDF. Use " + "QPDF::copyForeignObject to add objects from another file."); } } diff --git a/libqpdf/QPDFPageDocumentHelper.cc b/libqpdf/QPDFPageDocumentHelper.cc index 1bfcf7e..e1765fe 100644 --- a/libqpdf/QPDFPageDocumentHelper.cc +++ b/libqpdf/QPDFPageDocumentHelper.cc @@ -59,8 +59,9 @@ QPDFPageDocumentHelper::flattenAnnotations(int required_flags, int forbidden_fla if (afdh.getNeedAppearances()) { this->qpdf.getRoot() .getKey("/AcroForm") - .warnIfPossible("document does not have updated appearance streams, so form fields " - "will not be flattened"); + .warnIfPossible( + "document does not have updated appearance streams, so form fields " + "will not be flattened"); } for (auto& ph: getAllPages()) { QPDFObjectHandle resources = ph.getAttribute("/Resources", true); diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc index c250db8..f474e1c 100644 --- a/libqpdf/QPDFPageObjectHelper.cc +++ b/libqpdf/QPDFPageObjectHelper.cc @@ -551,9 +551,10 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( ph.parseContents(&rf); size_t after_nw = (q ? q->numWarnings() : 0); if (after_nw > before_nw) { - ph.oh.warnIfPossible("Bad token found while scanning content stream; " - "not attempting to remove unreferenced objects from" - " this object"); + ph.oh.warnIfPossible( + "Bad token found while scanning content stream; " + "not attempting to remove unreferenced objects from" + " this object"); return false; } } catch (std::exception& e) { @@ -715,8 +716,9 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations) newdict.replaceKey("/Group", getAttribute("/Group", false).shallowCopy()); QPDFObjectHandle bbox = getTrimBox(false).shallowCopy(); if (!bbox.isRectangle()) { - this->oh.warnIfPossible("bounding box is invalid; form" - " XObject created from page will not work"); + this->oh.warnIfPossible( + "bounding box is invalid; form" + " XObject created from page will not work"); } newdict.replaceKey("/BBox", bbox); auto provider = @@ -1018,8 +1020,9 @@ QPDFPageObjectHelper::copyAnnotations( from_afdh = afdh; } else if (from_afdh) { if (from_afdh->getQPDF().getUniqueId() != from_qpdf.getUniqueId()) { - throw std::logic_error("QPDFAcroFormDocumentHelper::copyAnnotations: from_afdh" - " is not from the same QPDF as from_page"); + throw std::logic_error( + "QPDFAcroFormDocumentHelper::copyAnnotations: from_afdh" + " is not from the same QPDF as from_page"); } } else { from_afdhph = std::make_shared(from_qpdf); diff --git a/libqpdf/QPDFParser.cc b/libqpdf/QPDFParser.cc index 0e302a9..529cbd9 100644 --- a/libqpdf/QPDFParser.cc +++ b/libqpdf/QPDFParser.cc @@ -160,8 +160,9 @@ QPDFParser::parseRemainder(bool content_stream) tokenizer.getValue() == "R") { if (context == nullptr) { QTC::TC("qpdf", "QPDFParser indirect without context"); - throw std::logic_error("QPDFParser::parse called without context on an object " - "with indirect references"); + throw std::logic_error( + "QPDFParser::parse called without context on an object " + "with indirect references"); } auto id = QIntC::to_int(int_buffer[(int_count - 1) % 2]); auto gen = QIntC::to_int(int_buffer[(int_count) % 2]); @@ -470,8 +471,9 @@ bool QPDFParser::tooManyBadTokens() { if (frame->olist.size() > 5'000 || frame->dict.size() > 5'000) { - warn("encountered errors while parsing an array or dictionary with more than 5000 " - "elements; giving up on reading object"); + warn( + "encountered errors while parsing an array or dictionary with more than 5000 " + "elements; giving up on reading object"); return true; } if (--max_bad_count > 0 && good_count > 4) { diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc index 39f7ad6..6652a40 100644 --- a/libqpdf/QPDFWriter.cc +++ b/libqpdf/QPDFWriter.cc @@ -1012,8 +1012,9 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper& pp) { if (!m->id2.empty()) { // Can't happen in the code - throw std::logic_error("Deterministic ID computation enabled after ID" - " generation has already occurred."); + throw std::logic_error( + "Deterministic ID computation enabled after ID" + " generation has already occurred."); } qpdf_assert_debug(m->deterministic_id); qpdf_assert_debug(m->md5_pipeline == nullptr); @@ -1081,8 +1082,9 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object) // original QPDF gets destroyed, which just disconnects the QPDFObjectHandle from its owner. if (object.getOwningQPDF() != &(m->pdf)) { QTC::TC("qpdf", "QPDFWriter foreign object"); - throw std::logic_error("QPDFObjectHandle from different QPDF found while writing. Use " - "QPDF::copyForeignObject to add objects from another file."); + throw std::logic_error( + "QPDFObjectHandle from different QPDF found while writing. Use " + "QPDF::copyForeignObject to add objects from another file."); } if (m->qdf_mode && object.isStreamOfType("/XRef")) { @@ -1876,9 +1878,10 @@ QPDFWriter::generateID() if (m->deterministic_id) { if (m->deterministic_id_data.empty()) { QTC::TC("qpdf", "QPDFWriter deterministic with no data"); - throw std::runtime_error("INTERNAL ERROR: QPDFWriter::generateID has no data for " - "deterministic ID. This may happen if deterministic ID " - "and file encryption are requested together."); + throw std::runtime_error( + "INTERNAL ERROR: QPDFWriter::generateID has no data for " + "deterministic ID. This may happen if deterministic ID " + "and file encryption are requested together."); } seed += m->deterministic_id_data; } else { diff --git a/libqpdf/QPDF_Stream.cc b/libqpdf/QPDF_Stream.cc index 8ffe919..3e1defa 100644 --- a/libqpdf/QPDF_Stream.cc +++ b/libqpdf/QPDF_Stream.cc @@ -209,8 +209,9 @@ QPDF_Stream::writeStreamJSON( case qpdf_sj_none: case qpdf_sj_inline: if (p != nullptr) { - throw std::logic_error("QPDF_Stream::writeStreamJSON: pipeline should only be supplied " - "when json_data is file"); + throw std::logic_error( + "QPDF_Stream::writeStreamJSON: pipeline should only be supplied " + "when json_data is file"); } break; case qpdf_sj_file: @@ -219,8 +220,9 @@ QPDF_Stream::writeStreamJSON( "QPDF_Stream::writeStreamJSON: pipeline must be supplied when json_data is file"); } if (data_filename.empty()) { - throw std::logic_error("QPDF_Stream::writeStreamJSON: data_filename must be supplied " - "when json_data is file"); + throw std::logic_error( + "QPDF_Stream::writeStreamJSON: data_filename must be supplied " + "when json_data is file"); } break; } @@ -617,13 +619,15 @@ QPDF_Stream::pipeStreamData( warn("content normalization encountered bad tokens"); if (normalizer->lastTokenWasBad()) { QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize"); - warn("normalized content ended with a bad token; you may be able to resolve this by " - "coalescing content streams in combination with normalizing content. From the " - "command line, specify --coalesce-contents"); + warn( + "normalized content ended with a bad token; you may be able to resolve this by " + "coalescing content streams in combination with normalizing content. From the " + "command line, specify --coalesce-contents"); } - warn("Resulting stream data may be corrupted but is may still useful for manual " - "inspection. For more information on this warning, search for content normalization " - "in the manual."); + warn( + "Resulting stream data may be corrupted but is may still useful for manual " + "inspection. For more information on this warning, search for content normalization " + "in the manual."); } return success; diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc index 1dd7b96..952b860 100644 --- a/libqpdf/QPDF_encryption.cc +++ b/libqpdf/QPDF_encryption.cc @@ -997,8 +997,9 @@ QPDF::decryptString(std::string& str, QPDFObjGen const& og) break; default: - warn(damagedPDF("unknown encryption filter for strings (check /StrF in " - "/Encrypt dictionary); strings may be decrypted improperly")); + warn(damagedPDF( + "unknown encryption filter for strings (check /StrF in " + "/Encrypt dictionary); strings may be decrypted improperly")); // To avoid repeated warnings, reset cf_string. Assume we'd want to use AES if V == 4. m->encp->cf_string = e_aes; use_aes = true; diff --git a/libqpdf/QPDF_json.cc b/libqpdf/QPDF_json.cc index 92e5256..f1a9f25 100644 --- a/libqpdf/QPDF_json.cc +++ b/libqpdf/QPDF_json.cc @@ -237,8 +237,9 @@ class QPDF::JSONReactor: public JSON::Reactor pdf(pdf), is(is), must_be_complete(must_be_complete), - descr(std::make_shared( - QPDFValue::JSON_Descr(std::make_shared(is->getName()), ""))) + descr( + std::make_shared( + QPDFValue::JSON_Descr(std::make_shared(is->getName()), ""))) { } ~JSONReactor() override = default; @@ -267,10 +268,10 @@ class QPDF::JSONReactor: public JSON::Reactor struct StackFrame { StackFrame(state_e state) : - state(state){}; + state(state) {}; StackFrame(state_e state, QPDFObjectHandle&& object) : state(state), - object(object){}; + object(object) {}; state_e state; QPDFObjectHandle object; }; diff --git a/libqpdf/QPDF_linearization.cc b/libqpdf/QPDF_linearization.cc index 9ffefd2..907734a 100644 --- a/libqpdf/QPDF_linearization.cc +++ b/libqpdf/QPDF_linearization.cc @@ -20,7 +20,7 @@ template static void load_vector_int( - BitStream& bit_stream, int nitems, std::vector& vec, int bits_wanted, int_type T::*field) + BitStream& bit_stream, int nitems, std::vector& vec, int bits_wanted, int_type T::* field) { bool append = vec.empty(); // nitems times, read bits_wanted from the given bit stream, storing results in the ith vector @@ -46,9 +46,9 @@ load_vector_vector( BitStream& bit_stream, int nitems1, std::vector& vec1, - int T::*nitems2, + int T::* nitems2, int bits_wanted, - std::vector T::*vec2) + std::vector T::* vec2) { // nitems1 times, read nitems2 (from the ith element of vec1) items into the vec2 vector field // of the ith item of vec1. @@ -164,8 +164,9 @@ QPDF::readLinearizationData() // that prevent loading. if (!isLinearized()) { - throw std::logic_error("called readLinearizationData for file" - " that is not linearized"); + throw std::logic_error( + "called readLinearizationData for file" + " that is not linearized"); } // /L is read and stored in linp by isLinearized() @@ -478,8 +479,9 @@ QPDF::checkLinearizationInternal() // streams are in use. if (m->uncompressed_after_compressed) { - linearizationWarning("linearized file contains an uncompressed object after a compressed " - "one in a cross-reference stream"); + linearizationWarning( + "linearized file contains an uncompressed object after a compressed " + "one in a cross-reference stream"); } // Further checking requires optimization and order calculation. Don't allow optimization to @@ -689,8 +691,9 @@ QPDF::checkHPageOffset( for (size_t i = 0; i < toS(he.nshared_objects); ++i) { int idx = he.shared_identifiers.at(i); if (shared_idx_to_obj.count(idx) == 0) { - stopOnError("unable to get object for item in" - " shared objects hint table"); + stopOnError( + "unable to get object for item in" + " shared objects hint table"); } hint_shared.insert(shared_idx_to_obj[idx]); } @@ -753,8 +756,9 @@ QPDF::checkHSharedObject(std::vector const& pages, std::mappart8.empty()) { - linearizationWarning("part 8 is empty but nshared_total > " - "nshared_first_page"); + linearizationWarning( + "part 8 is empty but nshared_total > " + "nshared_first_page"); } else { int obj = m->part8.at(0).getObjectID(); if (obj != so.first_shared_obj) { @@ -839,8 +843,9 @@ QPDF::checkHOutlines() std::to_string(table_length) + "; computed = " + std::to_string(length)); } } else { - linearizationWarning("incorrect first object number in outline " - "hints table."); + linearizationWarning( + "incorrect first object number in outline " + "hints table."); } } else { linearizationWarning("incorrect object count in outline hint table"); @@ -1123,8 +1128,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) break; case ObjUser::ou_bad: - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: " - "invalid user type"); + stopOnError( + "INTERNAL ERROR: QPDF::calculateLinearizationData: " + "invalid user type"); break; } } @@ -1187,8 +1193,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) // Part 4: open document objects. We don't care about the order. if (lc_root.size() != 1) { - stopOnError("found other than one root while" - " calculating linearization data"); + stopOnError( + "found other than one root while" + " calculating linearization data"); } m->part4.push_back(getObject(*(lc_root.begin()))); for (auto const& og: lc_open_document) { @@ -1205,8 +1212,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) } QPDFObjGen first_page_og(pages.at(0).getObjGen()); if (!lc_first_page_private.count(first_page_og)) { - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: first page " - "object not in lc_first_page_private"); + stopOnError( + "INTERNAL ERROR: QPDF::calculateLinearizationData: first page " + "object not in lc_first_page_private"); } lc_first_page_private.erase(first_page_og); m->c_linp.first_page_object = pages.at(0).getObjectID(); @@ -1258,8 +1266,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) ObjUser ou(ObjUser::ou_page, toI(i)); if (m->obj_user_to_objects.count(ou) == 0) { - stopOnError("found unreferenced page while" - " calculating linearization data"); + stopOnError( + "found unreferenced page while" + " calculating linearization data"); } for (auto const& og: m->obj_user_to_objects[ou]) { if (lc_other_page_private.count(og)) { @@ -1271,9 +1280,10 @@ QPDF::calculateLinearizationData(T const& object_stream_data) } // That should have covered all part7 objects. if (!lc_other_page_private.empty()) { - stopOnError("INTERNAL ERROR:" - " QPDF::calculateLinearizationData: lc_other_page_private is " - "not empty after generation of part7"); + stopOnError( + "INTERNAL ERROR:" + " QPDF::calculateLinearizationData: lc_other_page_private is " + "not empty after generation of part7"); } // Part 8: other pages' shared objects @@ -1294,8 +1304,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) std::set pages_ogs = m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")]; if (pages_ogs.empty()) { - stopOnError("found empty pages tree while" - " calculating linearization data"); + stopOnError( + "found empty pages tree while" + " calculating linearization data"); } for (auto const& og: pages_ogs) { if (lc_other.count(og)) { @@ -1331,8 +1342,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) } } if (!lc_thumbnail_private.empty()) { - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not " - "empty after placing thumbnails"); + stopOnError( + "INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not " + "empty after placing thumbnails"); } // Place shared thumbnail objects @@ -1403,8 +1415,9 @@ QPDF::calculateLinearizationData(T const& object_stream_data) CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i); ObjUser ou(ObjUser::ou_page, toI(i)); if (m->obj_user_to_objects.count(ou) == 0) { - stopOnError("found unreferenced page while" - " calculating linearization data"); + stopOnError( + "found unreferenced page while" + " calculating linearization data"); } for (auto const& og: m->obj_user_to_objects[ou]) { if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) { @@ -1559,8 +1572,9 @@ QPDF::calculateHPageOffset(QPDFWriter::NewObjTable const& new_obj, QPDFWriter::O // Adjust delta entries if ((phe.at(i).delta_nobjects < min_nobjects) || (phe.at(i).delta_page_length < min_length)) { - stopOnError("found too small delta nobjects or delta page length while writing " - "linearization data"); + stopOnError( + "found too small delta nobjects or delta page length while writing " + "linearization data"); } phe.at(i).delta_nobjects -= min_nobjects; phe.at(i).delta_page_length -= min_length; @@ -1636,7 +1650,7 @@ QPDF::calculateHOutline(QPDFWriter::NewObjTable const& new_obj, QPDFWriter::ObjT template static void -write_vector_int(BitWriter& w, int nitems, std::vector& vec, int bits, int_type T::*field) +write_vector_int(BitWriter& w, int nitems, std::vector& vec, int bits, int_type T::* field) { // nitems times, write bits bits from the given field of the ith vector to the given bit writer. @@ -1654,9 +1668,9 @@ write_vector_vector( BitWriter& w, int nitems1, std::vector& vec1, - int T::*nitems2, + int T::* nitems2, int bits, - std::vector T::*vec2) + std::vector T::* vec2) { // nitems1 times, write nitems2 (from the ith element of vec1) items from the vec2 vector field // of the ith item of vec1. @@ -1742,8 +1756,9 @@ QPDF::writeHSharedObject(BitWriter& w) for (size_t i = 0; i < toS(nitems); ++i) { // If signature were present, we'd have to write a 128-bit hash. if (entries.at(i).signature_present != 0) { - stopOnError("found unexpected signature present" - " while writing linearization data"); + stopOnError( + "found unexpected signature present" + " while writing linearization data"); } } write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one); diff --git a/libqpdf/QPDF_optimization.cc b/libqpdf/QPDF_optimization.cc index 0e457af..d8c5129 100644 --- a/libqpdf/QPDF_optimization.cc +++ b/libqpdf/QPDF_optimization.cc @@ -174,8 +174,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) allow_changes, warn_skipped_keys); if (!key_ancestors.empty()) { - throw std::logic_error("key_ancestors not empty after" - " pushing inherited attributes to pages"); + throw std::logic_error( + "key_ancestors not empty after" + " pushing inherited attributes to pages"); } m->pushed_inherited_attributes_to_pages = true; m->ever_pushed_inherited_attributes_to_pages = true; diff --git a/libqpdf/QPDF_pages.cc b/libqpdf/QPDF_pages.cc index a5005e4..d64b08f 100644 --- a/libqpdf/QPDF_pages.cc +++ b/libqpdf/QPDF_pages.cc @@ -55,8 +55,9 @@ QPDF::getAllPages() // Files have been found in the wild where /Pages in the catalog points to the first // page. Try to work around this and similar cases with this heuristic. if (!warned) { - getRoot().warnIfPossible("document page tree root (root -> /Pages) doesn't point" - " to the root of the page tree; attempting to correct"); + getRoot().warnIfPossible( + "document page tree root (root -> /Pages) doesn't point" + " to the root of the page tree; attempting to correct"); warned = true; } changed_pages = true; diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc index d69838f..e075399 100644 --- a/libqpdf/QUtil.cc +++ b/libqpdf/QUtil.cc @@ -959,9 +959,10 @@ QUtil::qpdf_time_to_iso8601(QPDFTime const& qtm) bool QUtil::pdf_time_to_qpdf_time(std::string const& str, QPDFTime* qtm) { - static std::regex pdf_date("^D:([0-9]{4})([0-9]{2})([0-9]{2})" - "([0-9]{2})([0-9]{2})([0-9]{2})" - "(?:(Z?)|([\\+\\-])([0-9]{2})'([0-9]{2})')$"); + static std::regex pdf_date( + "^D:([0-9]{4})([0-9]{2})([0-9]{2})" + "([0-9]{2})([0-9]{2})([0-9]{2})" + "(?:(Z?)|([\\+\\-])([0-9]{2})'([0-9]{2})')$"); std::smatch m; if (!std::regex_match(str, m, pdf_date)) { return false; diff --git a/libqpdf/SecureRandomDataProvider.cc b/libqpdf/SecureRandomDataProvider.cc index e5007d6..2ae8782 100644 --- a/libqpdf/SecureRandomDataProvider.cc +++ b/libqpdf/SecureRandomDataProvider.cc @@ -17,8 +17,9 @@ void SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len) { - throw std::logic_error("SecureRandomDataProvider::provideRandomData called " - "when support was not compiled in"); + throw std::logic_error( + "SecureRandomDataProvider::provideRandomData called " + "when support was not compiled in"); } RandomDataProvider* diff --git a/libqpdf/qpdf/QPDFParser.hh b/libqpdf/qpdf/QPDFParser.hh index 7b92da2..4519d0f 100644 --- a/libqpdf/qpdf/QPDFParser.hh +++ b/libqpdf/qpdf/QPDFParser.hh @@ -23,8 +23,9 @@ class QPDFParser tokenizer(tokenizer), decrypter(decrypter), context(context), - description(std::make_shared( - std::string(input.getName() + ", " + object_description + " at offset $PO"))), + description( + std::make_shared( + std::string(input.getName() + ", " + object_description + " at offset $PO"))), parse_pdf(parse_pdf) { } diff --git a/libqpdf/qpdf/qpdf-c_impl.hh b/libqpdf/qpdf/qpdf-c_impl.hh index 0d52cf1..866b625 100644 --- a/libqpdf/qpdf/qpdf-c_impl.hh +++ b/libqpdf/qpdf/qpdf-c_impl.hh @@ -16,7 +16,7 @@ struct _qpdf_data _qpdf_data() = default; _qpdf_data(std::unique_ptr&& qpdf) : - qpdf(std::move(qpdf)){}; + qpdf(std::move(qpdf)) {}; ~_qpdf_data() = default; diff --git a/libtests/md5.cc b/libtests/md5.cc index baa59a4..93bfe58 100644 --- a/libtests/md5.cc +++ b/libtests/md5.cc @@ -21,10 +21,12 @@ main(int, char*[]) test_string("abc"); test_string("message digest"); test_string("abcdefghijklmnopqrstuvwxyz"); - test_string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi" - "jklmnopqrstuvwxyz0123456789"); - test_string("1234567890123456789012345678901234567890" - "1234567890123456789012345678901234567890"); + test_string( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi" + "jklmnopqrstuvwxyz0123456789"); + test_string( + "1234567890123456789012345678901234567890" + "1234567890123456789012345678901234567890"); MD5 a; a.encodeFile("md5.in"); std::cout << a.unparse() << std::endl; diff --git a/libtests/qutil.cc b/libtests/qutil.cc index 07232de..78ae82c 100644 --- a/libtests/qutil.cc +++ b/libtests/qutil.cc @@ -607,8 +607,9 @@ hex_encode_decode_test() std::cout << "begin hex encode/decode\n"; assert_hex_encode("", ""); assert_hex_encode("Potato", "506f7461746f"); - std::string with_null("a\367" - "00w"); + std::string with_null( + "a\367" + "00w"); with_null[3] = '\0'; assert_hex_encode(with_null, "61f7300077"); assert_hex_decode("", ""); diff --git a/manual/contributing.rst b/manual/contributing.rst index 103b0a0..cd8a879 100644 --- a/manual/contributing.rst +++ b/manual/contributing.rst @@ -27,7 +27,7 @@ The qpdf source code is formatted using clang-format with a :file:`.clang-format` file at the top of the source tree. The :file:`format-code` script reformats all the source code in the repository. You must have ``clang-format`` in your path, and it must -be at least version 18. +be at least version 20. For emacs users, the :file:`.dir-locals.el` file configures emacs ``cc-mode`` for an indentation style that is similar to but not diff --git a/qpdf/pdf_from_scratch.cc b/qpdf/pdf_from_scratch.cc index cc0c6ea..2c54d5e 100644 --- a/qpdf/pdf_from_scratch.cc +++ b/qpdf/pdf_from_scratch.cc @@ -38,14 +38,15 @@ runtest(int n) if (n == 0) { // Create a minimal PDF from scratch. - QPDFObjectHandle font = - pdf.makeIndirectObject(QPDFObjectHandle::parse("<<" - " /Type /Font" - " /Subtype /Type1" - " /Name /F1" - " /BaseFont /Helvetica" - " /Encoding /WinAnsiEncoding" - ">>")); + QPDFObjectHandle font = pdf.makeIndirectObject( + QPDFObjectHandle::parse( + "<<" + " /Type /Font" + " /Subtype /Type1" + " /Name /F1" + " /BaseFont /Helvetica" + " /Encoding /WinAnsiEncoding" + ">>")); QPDFObjectHandle procset = pdf.makeIndirectObject(QPDFObjectHandle::parse("[/PDF /Text]")); -- libgit2 0.21.4