Commit 38d8cc7f674b10b14a229f06bf205067996745a0

Authored by Jay Berkenbilt
1 parent badcdf8f

Bump clang-format to version 20 and reformat

This improves indentation of long strings. This commit also fixes some
trailing whitespace in ChangeLog.
ChangeLog
@@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
49 * Add QPDF::setMaxWarnings to set the maximum of warnings before 49 * Add QPDF::setMaxWarnings to set the maximum of warnings before
50 warning suppression. 50 warning suppression.
51 51
52 - * Add static option to Pl_DCT to limit memory usage of 52 + * Add static option to Pl_DCT to limit memory usage of
53 decompression. The option is generally exposed but is primarily 53 decompression. The option is generally exposed but is primarily
54 intended to support fuzz tests, which have explicit memory limits 54 intended to support fuzz tests, which have explicit memory limits
55 that are smaller than what is commonly seen in the wild with PDF 55 that are smaller than what is commonly seen in the wild with PDF
examples/pdf-attach-file.cc
@@ -86,13 +86,14 @@ process( @@ -86,13 +86,14 @@ process(
86 86
87 // Create appearance stream for the attachment. 87 // Create appearance stream for the attachment.
88 88
89 - auto ap = q.newStream("0 10 m\n"  
90 - "10 0 l\n"  
91 - "20 10 l\n"  
92 - "10 0 m\n"  
93 - "10 20 l\n"  
94 - "0 0 20 20 re\n"  
95 - "S\n"); 89 + auto ap = q.newStream(
  90 + "0 10 m\n"
  91 + "10 0 l\n"
  92 + "20 10 l\n"
  93 + "10 0 m\n"
  94 + "10 20 l\n"
  95 + "0 0 20 20 re\n"
  96 + "S\n");
96 auto apdict = ap.getDict(); 97 auto apdict = ap.getDict();
97 98
98 // The following four lines demonstrate the use of the qpdf literal syntax introduced in 99 // The following four lines demonstrate the use of the qpdf literal syntax introduced in
@@ -105,21 +106,22 @@ process( @@ -105,21 +106,22 @@ process(
105 apdict.replaceKey("/Type", "/XObject"_qpdf); 106 apdict.replaceKey("/Type", "/XObject"_qpdf);
106 apdict.replaceKey("/Subtype", "/Form"_qpdf); 107 apdict.replaceKey("/Subtype", "/Form"_qpdf);
107 apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf); 108 apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf);
108 - auto annot = q.makeIndirectObject(QPDFObjectHandle::parse(  
109 - &q,  
110 - ("<<"  
111 - " /AP <<"  
112 - " /N " +  
113 - ap.unparse() +  
114 - " >>"  
115 - " /Contents " +  
116 - QPDFObjectHandle::newUnicodeString(attachment).unparse() + " /FS " +  
117 - fs.getObjectHandle().unparse() + " /NM " +  
118 - QPDFObjectHandle::newUnicodeString(attachment).unparse() +  
119 - " /Rect [ 72 700 92 720 ]"  
120 - " /Subtype /FileAttachment"  
121 - " /Type /Annot"  
122 - ">>"))); 109 + auto annot = q.makeIndirectObject(
  110 + QPDFObjectHandle::parse(
  111 + &q,
  112 + ("<<"
  113 + " /AP <<"
  114 + " /N " +
  115 + ap.unparse() +
  116 + " >>"
  117 + " /Contents " +
  118 + QPDFObjectHandle::newUnicodeString(attachment).unparse() + " /FS " +
  119 + fs.getObjectHandle().unparse() + " /NM " +
  120 + QPDFObjectHandle::newUnicodeString(attachment).unparse() +
  121 + " /Rect [ 72 700 92 720 ]"
  122 + " /Subtype /FileAttachment"
  123 + " /Type /Annot"
  124 + ">>")));
123 125
124 // Generate contents for the page. 126 // Generate contents for the page.
125 auto contents = q.newStream(("q\n" 127 auto contents = q.newStream(("q\n"
examples/pdf-create.cc
@@ -194,10 +194,11 @@ add_page( @@ -194,10 +194,11 @@ add_page(
194 QPDFObjectHandle contents = createPageContents(pdf, color_space + " with filter " + filter); 194 QPDFObjectHandle contents = createPageContents(pdf, color_space + " with filter " + filter);
195 195
196 // Create the page dictionary 196 // Create the page dictionary
197 - QPDFObjectHandle page = pdf.makeIndirectObject("<<"  
198 - " /Type /Page"  
199 - " /MediaBox [0 0 612 392]"  
200 - ">>"_qpdf); 197 + QPDFObjectHandle page = pdf.makeIndirectObject(
  198 + "<<"
  199 + " /Type /Page"
  200 + " /MediaBox [0 0 612 392]"
  201 + ">>"_qpdf);
201 page.replaceKey("/Contents", contents); 202 page.replaceKey("/Contents", contents);
202 page.replaceKey("/Resources", resources); 203 page.replaceKey("/Resources", resources);
203 204
format-code
@@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
23 # are improvements, bump the minimum required version of clang-format 23 # are improvements, bump the minimum required version of clang-format
24 # here, and update manual/contributing.rst. There's a comment there 24 # here, and update manual/contributing.rst. There's a comment there
25 # that refers to this comment. See also .clang-format. 25 # that refers to this comment. See also .clang-format.
26 -min_version=18 26 +min_version=20
27 27
28 clang_format=clang-format 28 clang_format=clang-format
29 if clang-format-$min_version --version >/dev/null 2>&1; then 29 if clang-format-$min_version --version >/dev/null 2>&1; then
include/qpdf/QPDFObjectHandle.hh
@@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const @@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const
1639 return obj != nullptr; 1639 return obj != nullptr;
1640 } 1640 }
1641 1641
1642 -inline QPDFObjectHandle::operator bool() const noexcept 1642 +inline QPDFObjectHandle::
  1643 +operator bool() const noexcept
1643 { 1644 {
1644 return static_cast<bool>(obj); 1645 return static_cast<bool>(obj);
1645 } 1646 }
include/qpdf/QPDFObjectHandle_future.hh
@@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const noexcept @@ -1639,7 +1639,8 @@ QPDFObjectHandle::isInitialized() const noexcept
1639 return obj != nullptr; 1639 return obj != nullptr;
1640 } 1640 }
1641 1641
1642 -inline QPDFObjectHandle::operator bool() const noexcept 1642 +inline QPDFObjectHandle::
  1643 +operator bool() const noexcept
1643 { 1644 {
1644 return static_cast<bool>(obj); 1645 return static_cast<bool>(obj);
1645 } 1646 }
libqpdf/InputSource.cc
@@ -57,8 +57,9 @@ InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len @@ -57,8 +57,9 @@ InputSource::findFirst(char const* start_chars, qpdf_offset_t offset, size_t len
57 // memory. 57 // memory.
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("InputSource::findSource called with"  
61 - " too small or too large of a character sequence"); 60 + throw std::logic_error(
  61 + "InputSource::findSource called with"
  62 + " too small or too large of a character sequence");
62 } 63 }
63 64
64 char* p = nullptr; 65 char* p = nullptr;
libqpdf/NNTree.cc
@@ -62,8 +62,9 @@ NNTreeIterator::updateIValue(bool allow_invalid) @@ -62,8 +62,9 @@ NNTreeIterator::updateIValue(bool allow_invalid)
62 } 62 }
63 if (!okay) { 63 if (!okay) {
64 if (!allow_invalid) { 64 if (!allow_invalid) {
65 - throw std::logic_error("attempt made to dereference an invalid"  
66 - " name/number tree iterator"); 65 + throw std::logic_error(
  66 + "attempt made to dereference an invalid"
  67 + " name/number tree iterator");
67 } 68 }
68 this->ivalue.first = QPDFObjectHandle(); 69 this->ivalue.first = QPDFObjectHandle();
69 this->ivalue.second = QPDFObjectHandle(); 70 this->ivalue.second = QPDFObjectHandle();
libqpdf/Pl_AES_PDF.cc
@@ -111,8 +111,9 @@ Pl_AES_PDF::finish() @@ -111,8 +111,9 @@ 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("buffer overflow in AES encryption"  
115 - " pipeline"); 114 + throw std::logic_error(
  115 + "buffer overflow in AES encryption"
  116 + " pipeline");
116 } 117 }
117 std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset); 118 std::memset(this->inbuf + this->offset, 0, this->buf_size - this->offset);
118 this->offset = this->buf_size; 119 this->offset = this->buf_size;
libqpdf/Pl_ASCIIHexDecoder.cc
@@ -47,8 +47,9 @@ Pl_ASCIIHexDecoder::write(unsigned char const* buf, size_t len) @@ -47,8 +47,9 @@ Pl_ASCIIHexDecoder::write(unsigned char const* buf, size_t len)
47 t[0] = ch; 47 t[0] = ch;
48 t[1] = 0; 48 t[1] = 0;
49 throw std::runtime_error( 49 throw std::runtime_error(
50 - std::string("character out of range"  
51 - " during base Hex decode: ") + 50 + std::string(
  51 + "character out of range"
  52 + " during base Hex decode: ") +
52 t); 53 t);
53 } 54 }
54 break; 55 break;
libqpdf/QPDF.cc
@@ -101,9 +101,10 @@ namespace @@ -101,9 +101,10 @@ namespace
101 void 101 void
102 throwException() 102 throwException()
103 { 103 {
104 - throw std::logic_error("QPDF operation attempted on a QPDF object with no input "  
105 - "source. QPDF operations are invalid before processFile (or "  
106 - "another process method) or after closeInputSource"); 104 + throw std::logic_error(
  105 + "QPDF operation attempted on a QPDF object with no input "
  106 + "source. QPDF operations are invalid before processFile (or "
  107 + "another process method) or after closeInputSource");
107 } 108 }
108 }; 109 };
109 } // namespace 110 } // namespace
@@ -495,8 +496,9 @@ QPDF::inParse(bool v) @@ -495,8 +496,9 @@ QPDF::inParse(bool v)
495 if (m->in_parse == v) { 496 if (m->in_parse == v) {
496 // This happens if QPDFParser::parse tries to resolve an indirect object while it is 497 // This happens if QPDFParser::parse tries to resolve an indirect object while it is
497 // parsing. 498 // parsing.
498 - throw std::logic_error("QPDF: re-entrant parsing detected. This is a qpdf bug."  
499 - " Please report at https://github.com/qpdf/qpdf/issues."); 499 + throw std::logic_error(
  500 + "QPDF: re-entrant parsing detected. This is a qpdf bug."
  501 + " Please report at https://github.com/qpdf/qpdf/issues.");
500 } 502 }
501 m->in_parse = v; 503 m->in_parse = v;
502 } 504 }
@@ -1188,8 +1190,9 @@ QPDF::processXRefIndex( @@ -1188,8 +1190,9 @@ QPDF::processXRefIndex(
1188 throw damaged( 1190 throw damaged(
1189 "Cross-reference stream's /Index contains a negative object id"); 1191 "Cross-reference stream's /Index contains a negative object id");
1190 } else if (first > max_num_entries) { 1192 } else if (first > max_num_entries) {
1191 - throw damaged("Cross-reference stream's /Index contains an impossibly "  
1192 - "large object id"); 1193 + throw damaged(
  1194 + "Cross-reference stream's /Index contains an impossibly "
  1195 + "large object id");
1193 } 1196 }
1194 } 1197 }
1195 } else { 1198 } else {
@@ -1392,8 +1395,9 @@ QPDF::showXRefTable() @@ -1392,8 +1395,9 @@ QPDF::showXRefTable()
1392 break; 1395 break;
1393 1396
1394 default: 1397 default:
1395 - throw std::logic_error("unknown cross-reference table type while"  
1396 - " showing xref_table"); 1398 + throw std::logic_error(
  1399 + "unknown cross-reference table type while"
  1400 + " showing xref_table");
1397 break; 1401 break;
1398 } 1402 }
1399 m->log->info("\n"); 1403 m->log->info("\n");
@@ -2266,8 +2270,9 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign) @@ -2266,8 +2270,9 @@ QPDF::copyForeignObject(QPDFObjectHandle foreign)
2266 2270
2267 ObjCopier& obj_copier = m->object_copiers[other.m->unique_id]; 2271 ObjCopier& obj_copier = m->object_copiers[other.m->unique_id];
2268 if (!obj_copier.visiting.empty()) { 2272 if (!obj_copier.visiting.empty()) {
2269 - throw std::logic_error("obj_copier.visiting is not empty"  
2270 - " at the beginning of copyForeignObject"); 2273 + throw std::logic_error(
  2274 + "obj_copier.visiting is not empty"
  2275 + " at the beginning of copyForeignObject");
2271 } 2276 }
2272 2277
2273 // Make sure we have an object in this file for every referenced object in the old file. 2278 // 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) @@ -2439,8 +2444,9 @@ QPDF::copyStreamData(QPDFObjectHandle result, QPDFObjectHandle foreign)
2439 2444
2440 auto stream = foreign.getObjectPtr()->as<QPDF_Stream>(); 2445 auto stream = foreign.getObjectPtr()->as<QPDF_Stream>();
2441 if (stream == nullptr) { 2446 if (stream == nullptr) {
2442 - throw std::logic_error("unable to retrieve underlying"  
2443 - " stream object from foreign stream"); 2447 + throw std::logic_error(
  2448 + "unable to retrieve underlying"
  2449 + " stream object from foreign stream");
2444 } 2450 }
2445 std::shared_ptr<Buffer> stream_buffer = stream->getStreamDataBuffer(); 2451 std::shared_ptr<Buffer> stream_buffer = stream->getStreamDataBuffer();
2446 if ((foreign_stream_qpdf.m->immediate_copy_from) && (stream_buffer == nullptr)) { 2452 if ((foreign_stream_qpdf.m->immediate_copy_from) && (stream_buffer == nullptr)) {
libqpdf/QPDFAcroFormDocumentHelper.cc
@@ -276,8 +276,9 @@ QPDFAcroFormDocumentHelper::analyze() @@ -276,8 +276,9 @@ QPDFAcroFormDocumentHelper::analyze()
276 // case such as a PDF creator adding a self-contained annotation (merged with the 276 // case such as a PDF creator adding a self-contained annotation (merged with the
277 // field dictionary) to the page's /Annots array and forgetting to also put it in 277 // field dictionary) to the page's /Annots array and forgetting to also put it in
278 // /AcroForm. 278 // /AcroForm.
279 - annot.warnIfPossible("this widget annotation is not"  
280 - " reachable from /AcroForm in the document catalog"); 279 + annot.warnIfPossible(
  280 + "this widget annotation is not"
  281 + " reachable from /AcroForm in the document catalog");
281 m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot); 282 m->annotation_to_field[og] = QPDFFormFieldObjectHelper(annot);
282 m->field_to_annotations[og].emplace_back(annot); 283 m->field_to_annotations[og].emplace_back(annot);
283 } 284 }
@@ -296,14 +297,16 @@ QPDFAcroFormDocumentHelper::traverseField( @@ -296,14 +297,16 @@ QPDFAcroFormDocumentHelper::traverseField(
296 } 297 }
297 if (!field.isIndirect()) { 298 if (!field.isIndirect()) {
298 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper direct field"); 299 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper direct field");
299 - field.warnIfPossible("encountered a direct object as a field or annotation while "  
300 - "traversing /AcroForm; ignoring field or annotation"); 300 + field.warnIfPossible(
  301 + "encountered a direct object as a field or annotation while "
  302 + "traversing /AcroForm; ignoring field or annotation");
301 return; 303 return;
302 } 304 }
303 if (!field.isDictionary()) { 305 if (!field.isDictionary()) {
304 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper non-dictionary field"); 306 QTC::TC("qpdf", "QPDFAcroFormDocumentHelper non-dictionary field");
305 - field.warnIfPossible("encountered a non-dictionary as a field or annotation while"  
306 - " traversing /AcroForm; ignoring field or annotation"); 307 + field.warnIfPossible(
  308 + "encountered a non-dictionary as a field or annotation while"
  309 + " traversing /AcroForm; ignoring field or annotation");
307 return; 310 return;
308 } 311 }
309 QPDFObjGen og(field.getObjGen()); 312 QPDFObjGen og(field.getObjGen());
libqpdf/QPDFFormFieldObjectHelper.cc
@@ -331,9 +331,9 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances) @@ -331,9 +331,9 @@ QPDFFormFieldObjectHelper::setV(QPDFObjectHandle value, bool need_appearances)
331 setFieldAttribute("/V", value); 331 setFieldAttribute("/V", value);
332 } 332 }
333 if (need_appearances) { 333 if (need_appearances) {
334 - QPDF& qpdf =  
335 - this->oh.getQPDF("QPDFFormFieldObjectHelper::setV called with need_appearances = "  
336 - "true on an object that is not associated with an owning QPDF"); 334 + QPDF& qpdf = this->oh.getQPDF(
  335 + "QPDFFormFieldObjectHelper::setV called with need_appearances = "
  336 + "true on an object that is not associated with an owning QPDF");
337 QPDFAcroFormDocumentHelper(qpdf).setNeedAppearances(true); 337 QPDFAcroFormDocumentHelper(qpdf).setNeedAppearances(true);
338 } 338 }
339 } 339 }
@@ -368,8 +368,9 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name) @@ -368,8 +368,9 @@ QPDFFormFieldObjectHelper::setRadioButtonValue(QPDFObjectHandle name)
368 368
369 QPDFObjectHandle kids = this->oh.getKey("/Kids"); 369 QPDFObjectHandle kids = this->oh.getKey("/Kids");
370 if (!(isRadioButton() && parent.isNull() && kids.isArray())) { 370 if (!(isRadioButton() && parent.isNull() && kids.isArray())) {
371 - this->oh.warnIfPossible("don't know how to set the value"  
372 - " of this field as a radio button"); 371 + this->oh.warnIfPossible(
  372 + "don't know how to set the value"
  373 + " of this field as a radio button");
373 return; 374 return;
374 } 375 }
375 setFieldAttribute("/V", name); 376 setFieldAttribute("/V", name);
@@ -770,9 +771,9 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper&amp; ao @@ -770,9 +771,9 @@ QPDFFormFieldObjectHelper::generateTextAppearance(QPDFAnnotationObjectHelper&amp; ao
770 QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AS from scratch"); 771 QTC::TC("qpdf", "QPDFFormFieldObjectHelper create AS from scratch");
771 QPDFObjectHandle::Rectangle rect = aoh.getRect(); 772 QPDFObjectHandle::Rectangle rect = aoh.getRect();
772 QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly); 773 QPDFObjectHandle::Rectangle bbox(0, 0, rect.urx - rect.llx, rect.ury - rect.lly);
773 - QPDFObjectHandle dict =  
774 - QPDFObjectHandle::parse("<< /Resources << /ProcSet [ /PDF /Text ] >>"  
775 - " /Type /XObject /Subtype /Form >>"); 774 + QPDFObjectHandle dict = QPDFObjectHandle::parse(
  775 + "<< /Resources << /ProcSet [ /PDF /Text ] >>"
  776 + " /Type /XObject /Subtype /Form >>");
776 dict.replaceKey("/BBox", QPDFObjectHandle::newFromRectangle(bbox)); 777 dict.replaceKey("/BBox", QPDFObjectHandle::newFromRectangle(bbox));
777 AS = QPDFObjectHandle::newStream(this->oh.getOwningQPDF(), "/Tx BMC\nEMC\n"); 778 AS = QPDFObjectHandle::newStream(this->oh.getOwningQPDF(), "/Tx BMC\nEMC\n");
778 AS.replaceDict(dict); 779 AS.replaceDict(dict);
libqpdf/QPDFJob.cc
@@ -614,8 +614,9 @@ QPDFJob::checkConfiguration() @@ -614,8 +614,9 @@ QPDFJob::checkConfiguration()
614 usage("no output file may be given for this option"); 614 usage("no output file may be given for this option");
615 } 615 }
616 if (m->check_requires_password && m->check_is_encrypted) { 616 if (m->check_requires_password && m->check_is_encrypted) {
617 - usage("--requires-password and --is-encrypted may not be given"  
618 - " together"); 617 + usage(
  618 + "--requires-password and --is-encrypted may not be given"
  619 + " together");
619 } 620 }
620 621
621 if (m->encrypt && (!m->allow_insecure) && 622 if (m->encrypt && (!m->allow_insecure) &&
@@ -646,8 +647,9 @@ QPDFJob::checkConfiguration() @@ -646,8 +647,9 @@ QPDFJob::checkConfiguration()
646 } 647 }
647 if ((!m->split_pages) && QUtil::same_file(m->infilename.get(), m->outfilename.get())) { 648 if ((!m->split_pages) && QUtil::same_file(m->infilename.get(), m->outfilename.get())) {
648 QTC::TC("qpdf", "QPDFJob same file error"); 649 QTC::TC("qpdf", "QPDFJob same file error");
649 - usage("input file and output file are the same; use --replace-input to intentionally "  
650 - "overwrite the input file"); 650 + usage(
  651 + "input file and output file are the same; use --replace-input to intentionally "
  652 + "overwrite the input file");
651 } 653 }
652 654
653 if (m->json_version == 1) { 655 if (m->json_version == 1) {
@@ -2243,8 +2245,9 @@ QPDFJob::handleTransformations(QPDF&amp; pdf) @@ -2243,8 +2245,9 @@ QPDFJob::handleTransformations(QPDF&amp; pdf)
2243 } 2245 }
2244 last_page_seen = spec.first_page; 2246 last_page_seen = spec.first_page;
2245 nums.appendItem(QPDFObjectHandle::newInteger(spec.first_page - 1)); 2247 nums.appendItem(QPDFObjectHandle::newInteger(spec.first_page - 1));
2246 - nums.appendItem(QPDFPageLabelDocumentHelper::pageLabelDict(  
2247 - spec.label_type, spec.start_num, spec.prefix)); 2248 + nums.appendItem(
  2249 + QPDFPageLabelDocumentHelper::pageLabelDict(
  2250 + spec.label_type, spec.start_num, spec.prefix));
2248 } 2251 }
2249 auto page_labels = QPDFObjectHandle::newDictionary(); 2252 auto page_labels = QPDFObjectHandle::newDictionary();
2250 page_labels.replaceKey("/Nums", nums); 2253 page_labels.replaceKey("/Nums", nums);
@@ -2497,8 +2500,9 @@ QPDFJob::handlePageSpecs(QPDF&amp; pdf, std::vector&lt;std::unique_ptr&lt;QPDF&gt;&gt;&amp; page_hea @@ -2497,8 +2500,9 @@ QPDFJob::handlePageSpecs(QPDF&amp; pdf, std::vector&lt;std::unique_ptr&lt;QPDF&gt;&gt;&amp; page_hea
2497 auto n_collate = m->collate.size(); 2500 auto n_collate = m->collate.size();
2498 auto n_specs = parsed_specs.size(); 2501 auto n_specs = parsed_specs.size();
2499 if (!(n_collate == 0 || n_collate == 1 || n_collate == n_specs)) { 2502 if (!(n_collate == 0 || n_collate == 1 || n_collate == n_specs)) {
2500 - usage("--pages: if --collate has more than one value, it must have one value per page "  
2501 - "specification"); 2503 + usage(
  2504 + "--pages: if --collate has more than one value, it must have one value per page "
  2505 + "specification");
2502 } 2506 }
2503 if (n_collate > 0 && n_specs > 1) { 2507 if (n_collate > 0 && n_specs > 1) {
2504 // Collate the pages by selecting one page from each spec in order. When a spec runs out of 2508 // 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&amp; password) @@ -2706,8 +2710,9 @@ QPDFJob::maybeFixWritePassword(int R, std::string&amp; password)
2706 std::string encoded; 2710 std::string encoded;
2707 if (!QUtil::utf8_to_pdf_doc(password, encoded)) { 2711 if (!QUtil::utf8_to_pdf_doc(password, encoded)) {
2708 QTC::TC("qpdf", "QPDFJob password not encodable"); 2712 QTC::TC("qpdf", "QPDFJob password not encodable");
2709 - throw std::runtime_error("supplied password cannot be encoded for 40-bit "  
2710 - "or 128-bit encryption formats"); 2713 + throw std::runtime_error(
  2714 + "supplied password cannot be encoded for 40-bit "
  2715 + "or 128-bit encryption formats");
2711 } 2716 }
2712 password = encoded; 2717 password = encoded;
2713 } 2718 }
@@ -2948,13 +2953,15 @@ QPDFJob::setWriterOptions(QPDFWriter&amp; w) @@ -2948,13 +2953,15 @@ QPDFJob::setWriterOptions(QPDFWriter&amp; w)
2948 } 2953 }
2949 if (m->progress) { 2954 if (m->progress) {
2950 if (m->progress_handler) { 2955 if (m->progress_handler) {
2951 - w.registerProgressReporter(std::shared_ptr<QPDFWriter::ProgressReporter>(  
2952 - new QPDFWriter::FunctionProgressReporter(m->progress_handler))); 2956 + w.registerProgressReporter(
  2957 + std::shared_ptr<QPDFWriter::ProgressReporter>(
  2958 + new QPDFWriter::FunctionProgressReporter(m->progress_handler)));
2953 } else { 2959 } else {
2954 char const* outfilename = m->outfilename ? m->outfilename.get() : "standard output"; 2960 char const* outfilename = m->outfilename ? m->outfilename.get() : "standard output";
2955 - w.registerProgressReporter(std::shared_ptr<QPDFWriter::ProgressReporter>(  
2956 - // line-break  
2957 - new ProgressReporter(*m->log->getInfo(), m->message_prefix, outfilename))); 2961 + w.registerProgressReporter(
  2962 + std::shared_ptr<QPDFWriter::ProgressReporter>(
  2963 + // line-break
  2964 + new ProgressReporter(*m->log->getInfo(), m->message_prefix, outfilename)));
2958 } 2965 }
2959 } 2966 }
2960 } 2967 }
@@ -3127,8 +3134,9 @@ QPDFJob::writeJSON(QPDF&amp; pdf) @@ -3127,8 +3134,9 @@ QPDFJob::writeJSON(QPDF&amp; pdf)
3127 fp = std::make_shared<Pl_StdioFile>("json output", fc->f); 3134 fp = std::make_shared<Pl_StdioFile>("json output", fc->f);
3128 } else if ((m->json_stream_data == qpdf_sj_file) && m->json_stream_prefix.empty()) { 3135 } else if ((m->json_stream_data == qpdf_sj_file) && m->json_stream_prefix.empty()) {
3129 QTC::TC("qpdf", "QPDFJob need json-stream-prefix for stdout"); 3136 QTC::TC("qpdf", "QPDFJob need json-stream-prefix for stdout");
3130 - usage("please specify --json-stream-prefix since the input file "  
3131 - "name is unknown"); 3137 + usage(
  3138 + "please specify --json-stream-prefix since the input file "
  3139 + "name is unknown");
3132 } else { 3140 } else {
3133 QTC::TC("qpdf", "QPDFJob write json to stdout"); 3141 QTC::TC("qpdf", "QPDFJob write json to stdout");
3134 m->log->saveToStandardOutput(true); 3142 m->log->saveToStandardOutput(true);
libqpdf/QPDFJob_json.cc
@@ -295,13 +295,15 @@ Handlers::beginEncrypt(JSON j) @@ -295,13 +295,15 @@ Handlers::beginEncrypt(JSON j)
295 }); 295 });
296 if (key_len == 0) { 296 if (key_len == 0) {
297 QTC::TC("qpdf", "QPDFJob json encrypt no key length"); 297 QTC::TC("qpdf", "QPDFJob json encrypt no key length");
298 - usage("exactly one of 40bit, 128bit, or 256bit must be given; an empty dictionary may be "  
299 - "supplied for one of them to set the key length without imposing any restrictions"); 298 + usage(
  299 + "exactly one of 40bit, 128bit, or 256bit must be given; an empty dictionary may be "
  300 + "supplied for one of them to set the key length without imposing any restrictions");
300 } 301 }
301 if (!(user_password_seen && owner_password_seen)) { 302 if (!(user_password_seen && owner_password_seen)) {
302 QTC::TC("qpdf", "QPDFJob json encrypt missing password"); 303 QTC::TC("qpdf", "QPDFJob json encrypt missing password");
303 - usage("the user and owner password are both required; use the empty string for the user "  
304 - "password if you don't want a password"); 304 + usage(
  305 + "the user and owner password are both required; use the empty string for the user "
  306 + "password if you don't want a password");
305 } 307 }
306 this->c_enc = c_main->encrypt(key_len, user_password, owner_password); 308 this->c_enc = c_main->encrypt(key_len, user_password, owner_password);
307 } 309 }
libqpdf/QPDFLogger.cc
@@ -200,8 +200,9 @@ QPDFLogger::setSave(std::shared_ptr&lt;Pipeline&gt; p, bool only_if_not_set) @@ -200,8 +200,9 @@ QPDFLogger::setSave(std::shared_ptr&lt;Pipeline&gt; p, bool only_if_not_set)
200 if (p == m->p_stdout) { 200 if (p == m->p_stdout) {
201 auto pt = dynamic_cast<Pl_Track*>(p.get()); 201 auto pt = dynamic_cast<Pl_Track*>(p.get());
202 if (pt->getUsed()) { 202 if (pt->getUsed()) {
203 - throw std::logic_error("QPDFLogger: called setSave on standard output after standard"  
204 - " output has already been used"); 203 + throw std::logic_error(
  204 + "QPDFLogger: called setSave on standard output after standard"
  205 + " output has already been used");
205 } 206 }
206 if (m->p_info == m->p_stdout) { 207 if (m->p_info == m->p_stdout) {
207 m->p_info = m->p_stderr; 208 m->p_info = m->p_stderr;
libqpdf/QPDFObjectHandle.cc
@@ -1507,8 +1507,9 @@ QPDFObjectHandle::getUniqueResourceName( @@ -1507,8 +1507,9 @@ QPDFObjectHandle::getUniqueResourceName(
1507 // This could only happen if there is a coding error. 1507 // This could only happen if there is a coding error.
1508 // The number of candidates we test is more than the 1508 // The number of candidates we test is more than the
1509 // number of keys we're checking against. 1509 // number of keys we're checking against.
1510 - throw std::logic_error("unable to find unconflicting name in"  
1511 - " QPDFObjectHandle::getUniqueResourceName"); 1510 + throw std::logic_error(
  1511 + "unable to find unconflicting name in"
  1512 + " QPDFObjectHandle::getUniqueResourceName");
1512 } 1513 }
1513 1514
1514 // Dictionary mutators 1515 // Dictionary mutators
@@ -2820,8 +2821,9 @@ QPDFObjectHandle::checkOwnership(QPDFObjectHandle const&amp; item) const @@ -2820,8 +2821,9 @@ QPDFObjectHandle::checkOwnership(QPDFObjectHandle const&amp; item) const
2820 auto item_qpdf = item.getOwningQPDF(); 2821 auto item_qpdf = item.getOwningQPDF();
2821 if ((qpdf != nullptr) && (item_qpdf != nullptr) && (qpdf != item_qpdf)) { 2822 if ((qpdf != nullptr) && (item_qpdf != nullptr) && (qpdf != item_qpdf)) {
2822 QTC::TC("qpdf", "QPDFObjectHandle check ownership"); 2823 QTC::TC("qpdf", "QPDFObjectHandle check ownership");
2823 - throw std::logic_error("Attempting to add an object from a different QPDF. Use "  
2824 - "QPDF::copyForeignObject to add objects from another file."); 2824 + throw std::logic_error(
  2825 + "Attempting to add an object from a different QPDF. Use "
  2826 + "QPDF::copyForeignObject to add objects from another file.");
2825 } 2827 }
2826 } 2828 }
2827 2829
libqpdf/QPDFPageDocumentHelper.cc
@@ -59,8 +59,9 @@ QPDFPageDocumentHelper::flattenAnnotations(int required_flags, int forbidden_fla @@ -59,8 +59,9 @@ QPDFPageDocumentHelper::flattenAnnotations(int required_flags, int forbidden_fla
59 if (afdh.getNeedAppearances()) { 59 if (afdh.getNeedAppearances()) {
60 this->qpdf.getRoot() 60 this->qpdf.getRoot()
61 .getKey("/AcroForm") 61 .getKey("/AcroForm")
62 - .warnIfPossible("document does not have updated appearance streams, so form fields "  
63 - "will not be flattened"); 62 + .warnIfPossible(
  63 + "document does not have updated appearance streams, so form fields "
  64 + "will not be flattened");
64 } 65 }
65 for (auto& ph: getAllPages()) { 66 for (auto& ph: getAllPages()) {
66 QPDFObjectHandle resources = ph.getAttribute("/Resources", true); 67 QPDFObjectHandle resources = ph.getAttribute("/Resources", true);
libqpdf/QPDFPageObjectHelper.cc
@@ -551,9 +551,10 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper( @@ -551,9 +551,10 @@ QPDFPageObjectHelper::removeUnreferencedResourcesHelper(
551 ph.parseContents(&rf); 551 ph.parseContents(&rf);
552 size_t after_nw = (q ? q->numWarnings() : 0); 552 size_t after_nw = (q ? q->numWarnings() : 0);
553 if (after_nw > before_nw) { 553 if (after_nw > before_nw) {
554 - ph.oh.warnIfPossible("Bad token found while scanning content stream; "  
555 - "not attempting to remove unreferenced objects from"  
556 - " this object"); 554 + ph.oh.warnIfPossible(
  555 + "Bad token found while scanning content stream; "
  556 + "not attempting to remove unreferenced objects from"
  557 + " this object");
557 return false; 558 return false;
558 } 559 }
559 } catch (std::exception& e) { 560 } catch (std::exception& e) {
@@ -715,8 +716,9 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations) @@ -715,8 +716,9 @@ QPDFPageObjectHelper::getFormXObjectForPage(bool handle_transformations)
715 newdict.replaceKey("/Group", getAttribute("/Group", false).shallowCopy()); 716 newdict.replaceKey("/Group", getAttribute("/Group", false).shallowCopy());
716 QPDFObjectHandle bbox = getTrimBox(false).shallowCopy(); 717 QPDFObjectHandle bbox = getTrimBox(false).shallowCopy();
717 if (!bbox.isRectangle()) { 718 if (!bbox.isRectangle()) {
718 - this->oh.warnIfPossible("bounding box is invalid; form"  
719 - " XObject created from page will not work"); 719 + this->oh.warnIfPossible(
  720 + "bounding box is invalid; form"
  721 + " XObject created from page will not work");
720 } 722 }
721 newdict.replaceKey("/BBox", bbox); 723 newdict.replaceKey("/BBox", bbox);
722 auto provider = 724 auto provider =
@@ -1018,8 +1020,9 @@ QPDFPageObjectHelper::copyAnnotations( @@ -1018,8 +1020,9 @@ QPDFPageObjectHelper::copyAnnotations(
1018 from_afdh = afdh; 1020 from_afdh = afdh;
1019 } else if (from_afdh) { 1021 } else if (from_afdh) {
1020 if (from_afdh->getQPDF().getUniqueId() != from_qpdf.getUniqueId()) { 1022 if (from_afdh->getQPDF().getUniqueId() != from_qpdf.getUniqueId()) {
1021 - throw std::logic_error("QPDFAcroFormDocumentHelper::copyAnnotations: from_afdh"  
1022 - " is not from the same QPDF as from_page"); 1023 + throw std::logic_error(
  1024 + "QPDFAcroFormDocumentHelper::copyAnnotations: from_afdh"
  1025 + " is not from the same QPDF as from_page");
1023 } 1026 }
1024 } else { 1027 } else {
1025 from_afdhph = std::make_shared<QPDFAcroFormDocumentHelper>(from_qpdf); 1028 from_afdhph = std::make_shared<QPDFAcroFormDocumentHelper>(from_qpdf);
libqpdf/QPDFParser.cc
@@ -160,8 +160,9 @@ QPDFParser::parseRemainder(bool content_stream) @@ -160,8 +160,9 @@ QPDFParser::parseRemainder(bool content_stream)
160 tokenizer.getValue() == "R") { 160 tokenizer.getValue() == "R") {
161 if (context == nullptr) { 161 if (context == nullptr) {
162 QTC::TC("qpdf", "QPDFParser indirect without context"); 162 QTC::TC("qpdf", "QPDFParser indirect without context");
163 - throw std::logic_error("QPDFParser::parse called without context on an object "  
164 - "with indirect references"); 163 + throw std::logic_error(
  164 + "QPDFParser::parse called without context on an object "
  165 + "with indirect references");
165 } 166 }
166 auto id = QIntC::to_int(int_buffer[(int_count - 1) % 2]); 167 auto id = QIntC::to_int(int_buffer[(int_count - 1) % 2]);
167 auto gen = QIntC::to_int(int_buffer[(int_count) % 2]); 168 auto gen = QIntC::to_int(int_buffer[(int_count) % 2]);
@@ -470,8 +471,9 @@ bool @@ -470,8 +471,9 @@ bool
470 QPDFParser::tooManyBadTokens() 471 QPDFParser::tooManyBadTokens()
471 { 472 {
472 if (frame->olist.size() > 5'000 || frame->dict.size() > 5'000) { 473 if (frame->olist.size() > 5'000 || frame->dict.size() > 5'000) {
473 - warn("encountered errors while parsing an array or dictionary with more than 5000 "  
474 - "elements; giving up on reading object"); 474 + warn(
  475 + "encountered errors while parsing an array or dictionary with more than 5000 "
  476 + "elements; giving up on reading object");
475 return true; 477 return true;
476 } 478 }
477 if (--max_bad_count > 0 && good_count > 4) { 479 if (--max_bad_count > 0 && good_count > 4) {
libqpdf/QPDFWriter.cc
@@ -1012,8 +1012,9 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper&amp; pp) @@ -1012,8 +1012,9 @@ QPDFWriter::pushMD5Pipeline(PipelinePopper&amp; pp)
1012 { 1012 {
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("Deterministic ID computation enabled after ID"  
1016 - " generation has already occurred."); 1015 + throw std::logic_error(
  1016 + "Deterministic ID computation enabled after ID"
  1017 + " generation has already occurred.");
1017 } 1018 }
1018 qpdf_assert_debug(m->deterministic_id); 1019 qpdf_assert_debug(m->deterministic_id);
1019 qpdf_assert_debug(m->md5_pipeline == nullptr); 1020 qpdf_assert_debug(m->md5_pipeline == nullptr);
@@ -1081,8 +1082,9 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object) @@ -1081,8 +1082,9 @@ QPDFWriter::enqueueObject(QPDFObjectHandle object)
1081 // original QPDF gets destroyed, which just disconnects the QPDFObjectHandle from its owner. 1082 // original QPDF gets destroyed, which just disconnects the QPDFObjectHandle from its owner.
1082 if (object.getOwningQPDF() != &(m->pdf)) { 1083 if (object.getOwningQPDF() != &(m->pdf)) {
1083 QTC::TC("qpdf", "QPDFWriter foreign object"); 1084 QTC::TC("qpdf", "QPDFWriter foreign object");
1084 - throw std::logic_error("QPDFObjectHandle from different QPDF found while writing. Use "  
1085 - "QPDF::copyForeignObject to add objects from another file."); 1085 + throw std::logic_error(
  1086 + "QPDFObjectHandle from different QPDF found while writing. Use "
  1087 + "QPDF::copyForeignObject to add objects from another file.");
1086 } 1088 }
1087 1089
1088 if (m->qdf_mode && object.isStreamOfType("/XRef")) { 1090 if (m->qdf_mode && object.isStreamOfType("/XRef")) {
@@ -1876,9 +1878,10 @@ QPDFWriter::generateID() @@ -1876,9 +1878,10 @@ QPDFWriter::generateID()
1876 if (m->deterministic_id) { 1878 if (m->deterministic_id) {
1877 if (m->deterministic_id_data.empty()) { 1879 if (m->deterministic_id_data.empty()) {
1878 QTC::TC("qpdf", "QPDFWriter deterministic with no data"); 1880 QTC::TC("qpdf", "QPDFWriter deterministic with no data");
1879 - throw std::runtime_error("INTERNAL ERROR: QPDFWriter::generateID has no data for "  
1880 - "deterministic ID. This may happen if deterministic ID "  
1881 - "and file encryption are requested together."); 1881 + throw std::runtime_error(
  1882 + "INTERNAL ERROR: QPDFWriter::generateID has no data for "
  1883 + "deterministic ID. This may happen if deterministic ID "
  1884 + "and file encryption are requested together.");
1882 } 1885 }
1883 seed += m->deterministic_id_data; 1886 seed += m->deterministic_id_data;
1884 } else { 1887 } else {
libqpdf/QPDF_Stream.cc
@@ -209,8 +209,9 @@ QPDF_Stream::writeStreamJSON( @@ -209,8 +209,9 @@ QPDF_Stream::writeStreamJSON(
209 case qpdf_sj_none: 209 case qpdf_sj_none:
210 case qpdf_sj_inline: 210 case qpdf_sj_inline:
211 if (p != nullptr) { 211 if (p != nullptr) {
212 - throw std::logic_error("QPDF_Stream::writeStreamJSON: pipeline should only be supplied "  
213 - "when json_data is file"); 212 + throw std::logic_error(
  213 + "QPDF_Stream::writeStreamJSON: pipeline should only be supplied "
  214 + "when json_data is file");
214 } 215 }
215 break; 216 break;
216 case qpdf_sj_file: 217 case qpdf_sj_file:
@@ -219,8 +220,9 @@ QPDF_Stream::writeStreamJSON( @@ -219,8 +220,9 @@ QPDF_Stream::writeStreamJSON(
219 "QPDF_Stream::writeStreamJSON: pipeline must be supplied when json_data is file"); 220 "QPDF_Stream::writeStreamJSON: pipeline must be supplied when json_data is file");
220 } 221 }
221 if (data_filename.empty()) { 222 if (data_filename.empty()) {
222 - throw std::logic_error("QPDF_Stream::writeStreamJSON: data_filename must be supplied "  
223 - "when json_data is file"); 223 + throw std::logic_error(
  224 + "QPDF_Stream::writeStreamJSON: data_filename must be supplied "
  225 + "when json_data is file");
224 } 226 }
225 break; 227 break;
226 } 228 }
@@ -617,13 +619,15 @@ QPDF_Stream::pipeStreamData( @@ -617,13 +619,15 @@ QPDF_Stream::pipeStreamData(
617 warn("content normalization encountered bad tokens"); 619 warn("content normalization encountered bad tokens");
618 if (normalizer->lastTokenWasBad()) { 620 if (normalizer->lastTokenWasBad()) {
619 QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize"); 621 QTC::TC("qpdf", "QPDF_Stream bad token at end during normalize");
620 - warn("normalized content ended with a bad token; you may be able to resolve this by "  
621 - "coalescing content streams in combination with normalizing content. From the "  
622 - "command line, specify --coalesce-contents"); 622 + warn(
  623 + "normalized content ended with a bad token; you may be able to resolve this by "
  624 + "coalescing content streams in combination with normalizing content. From the "
  625 + "command line, specify --coalesce-contents");
623 } 626 }
624 - warn("Resulting stream data may be corrupted but is may still useful for manual "  
625 - "inspection. For more information on this warning, search for content normalization "  
626 - "in the manual."); 627 + warn(
  628 + "Resulting stream data may be corrupted but is may still useful for manual "
  629 + "inspection. For more information on this warning, search for content normalization "
  630 + "in the manual.");
627 } 631 }
628 632
629 return success; 633 return success;
libqpdf/QPDF_encryption.cc
@@ -997,8 +997,9 @@ QPDF::decryptString(std::string&amp; str, QPDFObjGen const&amp; og) @@ -997,8 +997,9 @@ QPDF::decryptString(std::string&amp; str, QPDFObjGen const&amp; og)
997 break; 997 break;
998 998
999 default: 999 default:
1000 - warn(damagedPDF("unknown encryption filter for strings (check /StrF in "  
1001 - "/Encrypt dictionary); strings may be decrypted improperly")); 1000 + warn(damagedPDF(
  1001 + "unknown encryption filter for strings (check /StrF in "
  1002 + "/Encrypt dictionary); strings may be decrypted improperly"));
1002 // To avoid repeated warnings, reset cf_string. Assume we'd want to use AES if V == 4. 1003 // To avoid repeated warnings, reset cf_string. Assume we'd want to use AES if V == 4.
1003 m->encp->cf_string = e_aes; 1004 m->encp->cf_string = e_aes;
1004 use_aes = true; 1005 use_aes = true;
libqpdf/QPDF_json.cc
@@ -237,8 +237,9 @@ class QPDF::JSONReactor: public JSON::Reactor @@ -237,8 +237,9 @@ class QPDF::JSONReactor: public JSON::Reactor
237 pdf(pdf), 237 pdf(pdf),
238 is(is), 238 is(is),
239 must_be_complete(must_be_complete), 239 must_be_complete(must_be_complete),
240 - descr(std::make_shared<QPDFValue::Description>(  
241 - QPDFValue::JSON_Descr(std::make_shared<std::string>(is->getName()), ""))) 240 + descr(
  241 + std::make_shared<QPDFValue::Description>(
  242 + QPDFValue::JSON_Descr(std::make_shared<std::string>(is->getName()), "")))
242 { 243 {
243 } 244 }
244 ~JSONReactor() override = default; 245 ~JSONReactor() override = default;
@@ -267,10 +268,10 @@ class QPDF::JSONReactor: public JSON::Reactor @@ -267,10 +268,10 @@ class QPDF::JSONReactor: public JSON::Reactor
267 struct StackFrame 268 struct StackFrame
268 { 269 {
269 StackFrame(state_e state) : 270 StackFrame(state_e state) :
270 - state(state){}; 271 + state(state) {};
271 StackFrame(state_e state, QPDFObjectHandle&& object) : 272 StackFrame(state_e state, QPDFObjectHandle&& object) :
272 state(state), 273 state(state),
273 - object(object){}; 274 + object(object) {};
274 state_e state; 275 state_e state;
275 QPDFObjectHandle object; 276 QPDFObjectHandle object;
276 }; 277 };
libqpdf/QPDF_linearization.cc
@@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
20 template <class T, class int_type> 20 template <class T, class int_type>
21 static void 21 static void
22 load_vector_int( 22 load_vector_int(
23 - BitStream& bit_stream, int nitems, std::vector<T>& vec, int bits_wanted, int_type T::*field) 23 + BitStream& bit_stream, int nitems, std::vector<T>& vec, int bits_wanted, int_type T::* field)
24 { 24 {
25 bool append = vec.empty(); 25 bool append = vec.empty();
26 // nitems times, read bits_wanted from the given bit stream, storing results in the ith vector 26 // nitems times, read bits_wanted from the given bit stream, storing results in the ith vector
@@ -46,9 +46,9 @@ load_vector_vector( @@ -46,9 +46,9 @@ load_vector_vector(
46 BitStream& bit_stream, 46 BitStream& bit_stream,
47 int nitems1, 47 int nitems1,
48 std::vector<T>& vec1, 48 std::vector<T>& vec1,
49 - int T::*nitems2, 49 + int T::* nitems2,
50 int bits_wanted, 50 int bits_wanted,
51 - std::vector<int> T::*vec2) 51 + std::vector<int> T::* vec2)
52 { 52 {
53 // nitems1 times, read nitems2 (from the ith element of vec1) items into the vec2 vector field 53 // nitems1 times, read nitems2 (from the ith element of vec1) items into the vec2 vector field
54 // of the ith item of vec1. 54 // of the ith item of vec1.
@@ -164,8 +164,9 @@ QPDF::readLinearizationData() @@ -164,8 +164,9 @@ QPDF::readLinearizationData()
164 // that prevent loading. 164 // that prevent loading.
165 165
166 if (!isLinearized()) { 166 if (!isLinearized()) {
167 - throw std::logic_error("called readLinearizationData for file"  
168 - " that is not linearized"); 167 + throw std::logic_error(
  168 + "called readLinearizationData for file"
  169 + " that is not linearized");
169 } 170 }
170 171
171 // /L is read and stored in linp by isLinearized() 172 // /L is read and stored in linp by isLinearized()
@@ -478,8 +479,9 @@ QPDF::checkLinearizationInternal() @@ -478,8 +479,9 @@ QPDF::checkLinearizationInternal()
478 // streams are in use. 479 // streams are in use.
479 480
480 if (m->uncompressed_after_compressed) { 481 if (m->uncompressed_after_compressed) {
481 - linearizationWarning("linearized file contains an uncompressed object after a compressed "  
482 - "one in a cross-reference stream"); 482 + linearizationWarning(
  483 + "linearized file contains an uncompressed object after a compressed "
  484 + "one in a cross-reference stream");
483 } 485 }
484 486
485 // Further checking requires optimization and order calculation. Don't allow optimization to 487 // Further checking requires optimization and order calculation. Don't allow optimization to
@@ -689,8 +691,9 @@ QPDF::checkHPageOffset( @@ -689,8 +691,9 @@ QPDF::checkHPageOffset(
689 for (size_t i = 0; i < toS(he.nshared_objects); ++i) { 691 for (size_t i = 0; i < toS(he.nshared_objects); ++i) {
690 int idx = he.shared_identifiers.at(i); 692 int idx = he.shared_identifiers.at(i);
691 if (shared_idx_to_obj.count(idx) == 0) { 693 if (shared_idx_to_obj.count(idx) == 0) {
692 - stopOnError("unable to get object for item in"  
693 - " shared objects hint table"); 694 + stopOnError(
  695 + "unable to get object for item in"
  696 + " shared objects hint table");
694 } 697 }
695 hint_shared.insert(shared_idx_to_obj[idx]); 698 hint_shared.insert(shared_idx_to_obj[idx]);
696 } 699 }
@@ -753,8 +756,9 @@ QPDF::checkHSharedObject(std::vector&lt;QPDFObjectHandle&gt; const&amp; pages, std::map&lt;in @@ -753,8 +756,9 @@ QPDF::checkHSharedObject(std::vector&lt;QPDFObjectHandle&gt; const&amp; pages, std::map&lt;in
753 if (i == so.nshared_first_page) { 756 if (i == so.nshared_first_page) {
754 QTC::TC("qpdf", "QPDF lin check shared past first page"); 757 QTC::TC("qpdf", "QPDF lin check shared past first page");
755 if (m->part8.empty()) { 758 if (m->part8.empty()) {
756 - linearizationWarning("part 8 is empty but nshared_total > "  
757 - "nshared_first_page"); 759 + linearizationWarning(
  760 + "part 8 is empty but nshared_total > "
  761 + "nshared_first_page");
758 } else { 762 } else {
759 int obj = m->part8.at(0).getObjectID(); 763 int obj = m->part8.at(0).getObjectID();
760 if (obj != so.first_shared_obj) { 764 if (obj != so.first_shared_obj) {
@@ -839,8 +843,9 @@ QPDF::checkHOutlines() @@ -839,8 +843,9 @@ QPDF::checkHOutlines()
839 std::to_string(table_length) + "; computed = " + std::to_string(length)); 843 std::to_string(table_length) + "; computed = " + std::to_string(length));
840 } 844 }
841 } else { 845 } else {
842 - linearizationWarning("incorrect first object number in outline "  
843 - "hints table."); 846 + linearizationWarning(
  847 + "incorrect first object number in outline "
  848 + "hints table.");
844 } 849 }
845 } else { 850 } else {
846 linearizationWarning("incorrect object count in outline hint table"); 851 linearizationWarning("incorrect object count in outline hint table");
@@ -1123,8 +1128,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1123,8 +1128,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1123 break; 1128 break;
1124 1129
1125 case ObjUser::ou_bad: 1130 case ObjUser::ou_bad:
1126 - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: "  
1127 - "invalid user type"); 1131 + stopOnError(
  1132 + "INTERNAL ERROR: QPDF::calculateLinearizationData: "
  1133 + "invalid user type");
1128 break; 1134 break;
1129 } 1135 }
1130 } 1136 }
@@ -1187,8 +1193,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1187,8 +1193,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1187 // Part 4: open document objects. We don't care about the order. 1193 // Part 4: open document objects. We don't care about the order.
1188 1194
1189 if (lc_root.size() != 1) { 1195 if (lc_root.size() != 1) {
1190 - stopOnError("found other than one root while"  
1191 - " calculating linearization data"); 1196 + stopOnError(
  1197 + "found other than one root while"
  1198 + " calculating linearization data");
1192 } 1199 }
1193 m->part4.push_back(getObject(*(lc_root.begin()))); 1200 m->part4.push_back(getObject(*(lc_root.begin())));
1194 for (auto const& og: lc_open_document) { 1201 for (auto const& og: lc_open_document) {
@@ -1205,8 +1212,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1205,8 +1212,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1205 } 1212 }
1206 QPDFObjGen first_page_og(pages.at(0).getObjGen()); 1213 QPDFObjGen first_page_og(pages.at(0).getObjGen());
1207 if (!lc_first_page_private.count(first_page_og)) { 1214 if (!lc_first_page_private.count(first_page_og)) {
1208 - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: first page "  
1209 - "object not in lc_first_page_private"); 1215 + stopOnError(
  1216 + "INTERNAL ERROR: QPDF::calculateLinearizationData: first page "
  1217 + "object not in lc_first_page_private");
1210 } 1218 }
1211 lc_first_page_private.erase(first_page_og); 1219 lc_first_page_private.erase(first_page_og);
1212 m->c_linp.first_page_object = pages.at(0).getObjectID(); 1220 m->c_linp.first_page_object = pages.at(0).getObjectID();
@@ -1258,8 +1266,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1258,8 +1266,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1258 1266
1259 ObjUser ou(ObjUser::ou_page, toI(i)); 1267 ObjUser ou(ObjUser::ou_page, toI(i));
1260 if (m->obj_user_to_objects.count(ou) == 0) { 1268 if (m->obj_user_to_objects.count(ou) == 0) {
1261 - stopOnError("found unreferenced page while"  
1262 - " calculating linearization data"); 1269 + stopOnError(
  1270 + "found unreferenced page while"
  1271 + " calculating linearization data");
1263 } 1272 }
1264 for (auto const& og: m->obj_user_to_objects[ou]) { 1273 for (auto const& og: m->obj_user_to_objects[ou]) {
1265 if (lc_other_page_private.count(og)) { 1274 if (lc_other_page_private.count(og)) {
@@ -1271,9 +1280,10 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1271,9 +1280,10 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1271 } 1280 }
1272 // That should have covered all part7 objects. 1281 // That should have covered all part7 objects.
1273 if (!lc_other_page_private.empty()) { 1282 if (!lc_other_page_private.empty()) {
1274 - stopOnError("INTERNAL ERROR:"  
1275 - " QPDF::calculateLinearizationData: lc_other_page_private is "  
1276 - "not empty after generation of part7"); 1283 + stopOnError(
  1284 + "INTERNAL ERROR:"
  1285 + " QPDF::calculateLinearizationData: lc_other_page_private is "
  1286 + "not empty after generation of part7");
1277 } 1287 }
1278 1288
1279 // Part 8: other pages' shared objects 1289 // Part 8: other pages' shared objects
@@ -1294,8 +1304,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1294,8 +1304,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1294 std::set<QPDFObjGen> pages_ogs = 1304 std::set<QPDFObjGen> pages_ogs =
1295 m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")]; 1305 m->obj_user_to_objects[ObjUser(ObjUser::ou_root_key, "/Pages")];
1296 if (pages_ogs.empty()) { 1306 if (pages_ogs.empty()) {
1297 - stopOnError("found empty pages tree while"  
1298 - " calculating linearization data"); 1307 + stopOnError(
  1308 + "found empty pages tree while"
  1309 + " calculating linearization data");
1299 } 1310 }
1300 for (auto const& og: pages_ogs) { 1311 for (auto const& og: pages_ogs) {
1301 if (lc_other.count(og)) { 1312 if (lc_other.count(og)) {
@@ -1331,8 +1342,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1331,8 +1342,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1331 } 1342 }
1332 } 1343 }
1333 if (!lc_thumbnail_private.empty()) { 1344 if (!lc_thumbnail_private.empty()) {
1334 - stopOnError("INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not "  
1335 - "empty after placing thumbnails"); 1345 + stopOnError(
  1346 + "INTERNAL ERROR: QPDF::calculateLinearizationData: lc_thumbnail_private not "
  1347 + "empty after placing thumbnails");
1336 } 1348 }
1337 1349
1338 // Place shared thumbnail objects 1350 // Place shared thumbnail objects
@@ -1403,8 +1415,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data) @@ -1403,8 +1415,9 @@ QPDF::calculateLinearizationData(T const&amp; object_stream_data)
1403 CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i); 1415 CHPageOffsetEntry& pe = m->c_page_offset_data.entries.at(i);
1404 ObjUser ou(ObjUser::ou_page, toI(i)); 1416 ObjUser ou(ObjUser::ou_page, toI(i));
1405 if (m->obj_user_to_objects.count(ou) == 0) { 1417 if (m->obj_user_to_objects.count(ou) == 0) {
1406 - stopOnError("found unreferenced page while"  
1407 - " calculating linearization data"); 1418 + stopOnError(
  1419 + "found unreferenced page while"
  1420 + " calculating linearization data");
1408 } 1421 }
1409 for (auto const& og: m->obj_user_to_objects[ou]) { 1422 for (auto const& og: m->obj_user_to_objects[ou]) {
1410 if ((m->object_to_obj_users[og].size() > 1) && (obj_to_index.count(og.getObj()) > 0)) { 1423 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&amp; new_obj, QPDFWriter::O @@ -1559,8 +1572,9 @@ QPDF::calculateHPageOffset(QPDFWriter::NewObjTable const&amp; new_obj, QPDFWriter::O
1559 // Adjust delta entries 1572 // Adjust delta entries
1560 if ((phe.at(i).delta_nobjects < min_nobjects) || 1573 if ((phe.at(i).delta_nobjects < min_nobjects) ||
1561 (phe.at(i).delta_page_length < min_length)) { 1574 (phe.at(i).delta_page_length < min_length)) {
1562 - stopOnError("found too small delta nobjects or delta page length while writing "  
1563 - "linearization data"); 1575 + stopOnError(
  1576 + "found too small delta nobjects or delta page length while writing "
  1577 + "linearization data");
1564 } 1578 }
1565 phe.at(i).delta_nobjects -= min_nobjects; 1579 phe.at(i).delta_nobjects -= min_nobjects;
1566 phe.at(i).delta_page_length -= min_length; 1580 phe.at(i).delta_page_length -= min_length;
@@ -1636,7 +1650,7 @@ QPDF::calculateHOutline(QPDFWriter::NewObjTable const&amp; new_obj, QPDFWriter::ObjT @@ -1636,7 +1650,7 @@ QPDF::calculateHOutline(QPDFWriter::NewObjTable const&amp; new_obj, QPDFWriter::ObjT
1636 1650
1637 template <class T, class int_type> 1651 template <class T, class int_type>
1638 static void 1652 static void
1639 -write_vector_int(BitWriter& w, int nitems, std::vector<T>& vec, int bits, int_type T::*field) 1653 +write_vector_int(BitWriter& w, int nitems, std::vector<T>& vec, int bits, int_type T::* field)
1640 { 1654 {
1641 // nitems times, write bits bits from the given field of the ith vector to the given bit writer. 1655 // nitems times, write bits bits from the given field of the ith vector to the given bit writer.
1642 1656
@@ -1654,9 +1668,9 @@ write_vector_vector( @@ -1654,9 +1668,9 @@ write_vector_vector(
1654 BitWriter& w, 1668 BitWriter& w,
1655 int nitems1, 1669 int nitems1,
1656 std::vector<T>& vec1, 1670 std::vector<T>& vec1,
1657 - int T::*nitems2, 1671 + int T::* nitems2,
1658 int bits, 1672 int bits,
1659 - std::vector<int> T::*vec2) 1673 + std::vector<int> T::* vec2)
1660 { 1674 {
1661 // nitems1 times, write nitems2 (from the ith element of vec1) items from the vec2 vector field 1675 // nitems1 times, write nitems2 (from the ith element of vec1) items from the vec2 vector field
1662 // of the ith item of vec1. 1676 // of the ith item of vec1.
@@ -1742,8 +1756,9 @@ QPDF::writeHSharedObject(BitWriter&amp; w) @@ -1742,8 +1756,9 @@ QPDF::writeHSharedObject(BitWriter&amp; w)
1742 for (size_t i = 0; i < toS(nitems); ++i) { 1756 for (size_t i = 0; i < toS(nitems); ++i) {
1743 // If signature were present, we'd have to write a 128-bit hash. 1757 // If signature were present, we'd have to write a 128-bit hash.
1744 if (entries.at(i).signature_present != 0) { 1758 if (entries.at(i).signature_present != 0) {
1745 - stopOnError("found unexpected signature present"  
1746 - " while writing linearization data"); 1759 + stopOnError(
  1760 + "found unexpected signature present"
  1761 + " while writing linearization data");
1747 } 1762 }
1748 } 1763 }
1749 write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one); 1764 write_vector_int(w, nitems, entries, t.nbits_nobjects, &HSharedObjectEntry::nobjects_minus_one);
libqpdf/QPDF_optimization.cc
@@ -174,8 +174,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys) @@ -174,8 +174,9 @@ QPDF::pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys)
174 allow_changes, 174 allow_changes,
175 warn_skipped_keys); 175 warn_skipped_keys);
176 if (!key_ancestors.empty()) { 176 if (!key_ancestors.empty()) {
177 - throw std::logic_error("key_ancestors not empty after"  
178 - " pushing inherited attributes to pages"); 177 + throw std::logic_error(
  178 + "key_ancestors not empty after"
  179 + " pushing inherited attributes to pages");
179 } 180 }
180 m->pushed_inherited_attributes_to_pages = true; 181 m->pushed_inherited_attributes_to_pages = true;
181 m->ever_pushed_inherited_attributes_to_pages = true; 182 m->ever_pushed_inherited_attributes_to_pages = true;
libqpdf/QPDF_pages.cc
@@ -55,8 +55,9 @@ QPDF::getAllPages() @@ -55,8 +55,9 @@ QPDF::getAllPages()
55 // Files have been found in the wild where /Pages in the catalog points to the first 55 // Files have been found in the wild where /Pages in the catalog points to the first
56 // page. Try to work around this and similar cases with this heuristic. 56 // page. Try to work around this and similar cases with this heuristic.
57 if (!warned) { 57 if (!warned) {
58 - getRoot().warnIfPossible("document page tree root (root -> /Pages) doesn't point"  
59 - " to the root of the page tree; attempting to correct"); 58 + getRoot().warnIfPossible(
  59 + "document page tree root (root -> /Pages) doesn't point"
  60 + " to the root of the page tree; attempting to correct");
60 warned = true; 61 warned = true;
61 } 62 }
62 changed_pages = true; 63 changed_pages = true;
libqpdf/QUtil.cc
@@ -959,9 +959,10 @@ QUtil::qpdf_time_to_iso8601(QPDFTime const&amp; qtm) @@ -959,9 +959,10 @@ QUtil::qpdf_time_to_iso8601(QPDFTime const&amp; qtm)
959 bool 959 bool
960 QUtil::pdf_time_to_qpdf_time(std::string const& str, QPDFTime* qtm) 960 QUtil::pdf_time_to_qpdf_time(std::string const& str, QPDFTime* qtm)
961 { 961 {
962 - static std::regex pdf_date("^D:([0-9]{4})([0-9]{2})([0-9]{2})"  
963 - "([0-9]{2})([0-9]{2})([0-9]{2})"  
964 - "(?:(Z?)|([\\+\\-])([0-9]{2})'([0-9]{2})')$"); 962 + static std::regex pdf_date(
  963 + "^D:([0-9]{4})([0-9]{2})([0-9]{2})"
  964 + "([0-9]{2})([0-9]{2})([0-9]{2})"
  965 + "(?:(Z?)|([\\+\\-])([0-9]{2})'([0-9]{2})')$");
965 std::smatch m; 966 std::smatch m;
966 if (!std::regex_match(str, m, pdf_date)) { 967 if (!std::regex_match(str, m, pdf_date)) {
967 return false; 968 return false;
libqpdf/SecureRandomDataProvider.cc
@@ -17,8 +17,9 @@ @@ -17,8 +17,9 @@
17 void 17 void
18 SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len) 18 SecureRandomDataProvider::provideRandomData(unsigned char* data, size_t len)
19 { 19 {
20 - throw std::logic_error("SecureRandomDataProvider::provideRandomData called "  
21 - "when support was not compiled in"); 20 + throw std::logic_error(
  21 + "SecureRandomDataProvider::provideRandomData called "
  22 + "when support was not compiled in");
22 } 23 }
23 24
24 RandomDataProvider* 25 RandomDataProvider*
libqpdf/qpdf/QPDFParser.hh
@@ -23,8 +23,9 @@ class QPDFParser @@ -23,8 +23,9 @@ class QPDFParser
23 tokenizer(tokenizer), 23 tokenizer(tokenizer),
24 decrypter(decrypter), 24 decrypter(decrypter),
25 context(context), 25 context(context),
26 - description(std::make_shared<QPDFValue::Description>(  
27 - std::string(input.getName() + ", " + object_description + " at offset $PO"))), 26 + description(
  27 + std::make_shared<QPDFValue::Description>(
  28 + std::string(input.getName() + ", " + object_description + " at offset $PO"))),
28 parse_pdf(parse_pdf) 29 parse_pdf(parse_pdf)
29 { 30 {
30 } 31 }
libqpdf/qpdf/qpdf-c_impl.hh
@@ -16,7 +16,7 @@ struct _qpdf_data @@ -16,7 +16,7 @@ struct _qpdf_data
16 _qpdf_data() = default; 16 _qpdf_data() = default;
17 17
18 _qpdf_data(std::unique_ptr<QPDF>&& qpdf) : 18 _qpdf_data(std::unique_ptr<QPDF>&& qpdf) :
19 - qpdf(std::move(qpdf)){}; 19 + qpdf(std::move(qpdf)) {};
20 20
21 ~_qpdf_data() = default; 21 ~_qpdf_data() = default;
22 22
libtests/md5.cc
@@ -21,10 +21,12 @@ main(int, char*[]) @@ -21,10 +21,12 @@ main(int, char*[])
21 test_string("abc"); 21 test_string("abc");
22 test_string("message digest"); 22 test_string("message digest");
23 test_string("abcdefghijklmnopqrstuvwxyz"); 23 test_string("abcdefghijklmnopqrstuvwxyz");
24 - test_string("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi"  
25 - "jklmnopqrstuvwxyz0123456789");  
26 - test_string("1234567890123456789012345678901234567890"  
27 - "1234567890123456789012345678901234567890"); 24 + test_string(
  25 + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghi"
  26 + "jklmnopqrstuvwxyz0123456789");
  27 + test_string(
  28 + "1234567890123456789012345678901234567890"
  29 + "1234567890123456789012345678901234567890");
28 MD5 a; 30 MD5 a;
29 a.encodeFile("md5.in"); 31 a.encodeFile("md5.in");
30 std::cout << a.unparse() << std::endl; 32 std::cout << a.unparse() << std::endl;
libtests/qutil.cc
@@ -607,8 +607,9 @@ hex_encode_decode_test() @@ -607,8 +607,9 @@ hex_encode_decode_test()
607 std::cout << "begin hex encode/decode\n"; 607 std::cout << "begin hex encode/decode\n";
608 assert_hex_encode("", ""); 608 assert_hex_encode("", "");
609 assert_hex_encode("Potato", "506f7461746f"); 609 assert_hex_encode("Potato", "506f7461746f");
610 - std::string with_null("a\367"  
611 - "00w"); 610 + std::string with_null(
  611 + "a\367"
  612 + "00w");
612 with_null[3] = '\0'; 613 with_null[3] = '\0';
613 assert_hex_encode(with_null, "61f7300077"); 614 assert_hex_encode(with_null, "61f7300077");
614 assert_hex_decode("", ""); 615 assert_hex_decode("", "");
manual/contributing.rst
@@ -27,7 +27,7 @@ The qpdf source code is formatted using clang-format with a @@ -27,7 +27,7 @@ The qpdf source code is formatted using clang-format with a
27 :file:`.clang-format` file at the top of the source tree. The 27 :file:`.clang-format` file at the top of the source tree. The
28 :file:`format-code` script reformats all the source code in the 28 :file:`format-code` script reformats all the source code in the
29 repository. You must have ``clang-format`` in your path, and it must 29 repository. You must have ``clang-format`` in your path, and it must
30 -be at least version 18. 30 +be at least version 20.
31 31
32 For emacs users, the :file:`.dir-locals.el` file configures emacs 32 For emacs users, the :file:`.dir-locals.el` file configures emacs
33 ``cc-mode`` for an indentation style that is similar to but not 33 ``cc-mode`` for an indentation style that is similar to but not
qpdf/pdf_from_scratch.cc
@@ -38,14 +38,15 @@ runtest(int n) @@ -38,14 +38,15 @@ runtest(int n)
38 if (n == 0) { 38 if (n == 0) {
39 // Create a minimal PDF from scratch. 39 // Create a minimal PDF from scratch.
40 40
41 - QPDFObjectHandle font =  
42 - pdf.makeIndirectObject(QPDFObjectHandle::parse("<<"  
43 - " /Type /Font"  
44 - " /Subtype /Type1"  
45 - " /Name /F1"  
46 - " /BaseFont /Helvetica"  
47 - " /Encoding /WinAnsiEncoding"  
48 - ">>")); 41 + QPDFObjectHandle font = pdf.makeIndirectObject(
  42 + QPDFObjectHandle::parse(
  43 + "<<"
  44 + " /Type /Font"
  45 + " /Subtype /Type1"
  46 + " /Name /F1"
  47 + " /BaseFont /Helvetica"
  48 + " /Encoding /WinAnsiEncoding"
  49 + ">>"));
49 50
50 QPDFObjectHandle procset = pdf.makeIndirectObject(QPDFObjectHandle::parse("[/PDF /Text]")); 51 QPDFObjectHandle procset = pdf.makeIndirectObject(QPDFObjectHandle::parse("[/PDF /Text]"));
51 52