Commit 77e889495f7c513ba8677df5fe662f08053709eb

Authored by Jay Berkenbilt
1 parent 12f1eb15

Update some code manually to get better formatting results

Add comments to force line breaks, parenthesize function arguments
that are contatenated strings, etc. -- these kinds of changes improve
clang-format's results and also cause emacs cc-mode to match
clang-format. After this type of change, most of the time, when
clang-format and emacs disagree, clang-format is better.
... ... @@ -51,7 +51,7 @@ Use clang-format-15.
51 51 done
52 52  
53 53 * Carefully inspect the diff. There are some places where a comment to
54   - force a line break might be in order.
  54 + force a line break might be in order. Document use of // line-break
55 55  
56 56 * Update README-maintainer about formatting. Mention
57 57  
... ...
examples/pdf-attach-file.cc
... ... @@ -45,25 +45,29 @@ process(
45 45  
46 46 // Create an indirect object for the built-in Helvetica font. This
47 47 // uses the qpdf literal syntax introduced in qpdf 10.6.
48   - auto f1 = q.makeIndirectObject("<<"
49   - " /Type /Font"
50   - " /Subtype /Type1"
51   - " /Name /F1"
52   - " /BaseFont /Helvetica"
53   - " /Encoding /WinAnsiEncoding"
54   - ">>"_qpdf);
  48 + auto f1 = q.makeIndirectObject(
  49 + // force line-break
  50 + "<<"
  51 + " /Type /Font"
  52 + " /Subtype /Type1"
  53 + " /Name /F1"
  54 + " /BaseFont /Helvetica"
  55 + " /Encoding /WinAnsiEncoding"
  56 + ">>"_qpdf);
55 57  
56 58 // Create a resources dictionary with fonts. This uses the new
57 59 // parse introduced in qpdf 10.2 that takes a QPDF* and allows
58 60 // indirect object references.
59   - auto resources = q.makeIndirectObject(QPDFObjectHandle::parse(
60   - &q,
61   - "<<"
62   - " /Font <<"
63   - " /F1 " +
64   - f1.unparse() +
65   - " >>"
66   - ">>"));
  61 + auto resources = q.makeIndirectObject(
  62 + // line-break
  63 + QPDFObjectHandle::parse(
  64 + &q,
  65 + ("<<"
  66 + " /Font <<"
  67 + " /F1 " +
  68 + f1.unparse() +
  69 + " >>"
  70 + ">>")));
67 71  
68 72 // Create a file spec.
69 73 std::string key = QUtil::path_basename(attachment);
... ... @@ -108,45 +112,45 @@ process(
108 112 apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf);
109 113 auto annot = q.makeIndirectObject(QPDFObjectHandle::parse(
110 114 &q,
111   - "<<"
112   - " /AP <<"
113   - " /N " +
114   - ap.unparse() +
115   - " >>"
116   - " /Contents " +
117   - QPDFObjectHandle::newUnicodeString(attachment).unparse() +
118   - " /FS " + fs.getObjectHandle().unparse() + " /NM " +
119   - QPDFObjectHandle::newUnicodeString(attachment).unparse() +
120   - " /Rect [ 72 700 92 720 ]"
121   - " /Subtype /FileAttachment"
122   - " /Type /Annot"
123   - ">>"));
  115 + ("<<"
  116 + " /AP <<"
  117 + " /N " +
  118 + ap.unparse() +
  119 + " >>"
  120 + " /Contents " +
  121 + QPDFObjectHandle::newUnicodeString(attachment).unparse() + " /FS " +
  122 + fs.getObjectHandle().unparse() + " /NM " +
  123 + QPDFObjectHandle::newUnicodeString(attachment).unparse() +
  124 + " /Rect [ 72 700 92 720 ]"
  125 + " /Subtype /FileAttachment"
  126 + " /Type /Annot"
  127 + ">>")));
124 128  
125 129 // Generate contents for the page.
126 130 auto contents = QPDFObjectHandle::newStream(
127 131 &q,
128   - "q\n"
129   - "BT\n"
130   - " 102 700 Td\n"
131   - " /F1 16 Tf\n"
132   - " (Here is an attachment.) Tj\n"
133   - "ET\n"
134   - "Q\n");
  132 + ("q\n"
  133 + "BT\n"
  134 + " 102 700 Td\n"
  135 + " /F1 16 Tf\n"
  136 + " (Here is an attachment.) Tj\n"
  137 + "ET\n"
  138 + "Q\n"));
135 139  
136 140 // Create the page object.
137 141 auto page = QPDFObjectHandle::parse(
138 142 &q,
139   - "<<"
140   - " /Annots [ " +
141   - annot.unparse() +
142   - " ]"
143   - " /Contents " +
144   - contents.unparse() +
145   - " /MediaBox [0 0 612 792]"
146   - " /Resources " +
147   - resources.unparse() +
148   - " /Type /Page"
149   - ">>");
  143 + ("<<"
  144 + " /Annots [ " +
  145 + annot.unparse() +
  146 + " ]"
  147 + " /Contents " +
  148 + contents.unparse() +
  149 + " /MediaBox [0 0 612 792]"
  150 + " /Resources " +
  151 + resources.unparse() +
  152 + " /Type /Page"
  153 + ">>"));
150 154  
151 155 // Add the page.
152 156 q.addPage(page, true);
... ...
examples/pdf-create.cc
... ... @@ -180,11 +180,13 @@ add_page(
180 180 size_t width = p->getWidth();
181 181 size_t height = p->getHeight();
182 182 QPDFObjectHandle image = QPDFObjectHandle::newStream(&pdf);
183   - auto image_dict = "<<"
184   - " /Type /XObject"
185   - " /Subtype /Image"
186   - " /BitsPerComponent 8"
187   - ">>"_qpdf;
  183 + auto image_dict =
  184 + // line-break
  185 + "<<"
  186 + " /Type /XObject"
  187 + " /Subtype /Image"
  188 + " /BitsPerComponent 8"
  189 + ">>"_qpdf;
188 190 image_dict.replaceKey("/ColorSpace", newName(color_space));
189 191 image_dict.replaceKey("/Width", newInteger(width));
190 192 image_dict.replaceKey("/Height", newInteger(height));
... ... @@ -352,13 +354,15 @@ create_pdf(char const* filename)
352 354  
353 355 // Add an indirect object to contain a font descriptor for the
354 356 // built-in Helvetica font.
355   - QPDFObjectHandle font = pdf.makeIndirectObject("<<"
356   - " /Type /Font"
357   - " /Subtype /Type1"
358   - " /Name /F1"
359   - " /BaseFont /Helvetica"
360   - " /Encoding /WinAnsiEncoding"
361   - ">>"_qpdf);
  357 + QPDFObjectHandle font = pdf.makeIndirectObject(
  358 + // line-break
  359 + "<<"
  360 + " /Type /Font"
  361 + " /Subtype /Type1"
  362 + " /Name /F1"
  363 + " /BaseFont /Helvetica"
  364 + " /Encoding /WinAnsiEncoding"
  365 + ">>"_qpdf);
362 366  
363 367 std::vector<std::string> color_spaces;
364 368 color_spaces.push_back("/DeviceCMYK");
... ...
libqpdf/BitStream.cc
... ... @@ -47,8 +47,10 @@ BitStream::getBitsSigned(size_t nbits)
47 47 int
48 48 BitStream::getBitsInt(size_t nbits)
49 49 {
50   - return static_cast<int>(QIntC::to_uint(
51   - read_bits(this->p, this->bit_offset, this->bits_available, nbits)));
  50 + return static_cast<int>(
  51 + // line-break
  52 + QIntC::to_uint(
  53 + read_bits(this->p, this->bit_offset, this->bits_available, nbits)));
52 54 }
53 55  
54 56 void
... ...
libqpdf/FileInputSource.cc
... ... @@ -96,9 +96,9 @@ void
96 96 FileInputSource::seek(qpdf_offset_t offset, int whence)
97 97 {
98 98 QUtil::os_wrapper(
99   - std::string("seek to ") + this->m->filename + ", offset " +
100   - QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
101   - ")",
  99 + (std::string("seek to ") + this->m->filename + ", offset " +
  100 + QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
  101 + ")"),
102 102 QUtil::seek(this->m->file, offset, whence));
103 103 }
104 104  
... ... @@ -120,8 +120,8 @@ FileInputSource::read(char* buffer, size_t length)
120 120 this->m->filename,
121 121 "",
122 122 this->last_offset,
123   - std::string("read ") + QUtil::uint_to_string(length) +
124   - " bytes");
  123 + (std::string("read ") + QUtil::uint_to_string(length) +
  124 + " bytes"));
125 125 } else if (length > 0) {
126 126 this->seek(0, SEEK_END);
127 127 this->last_offset = this->tell();
... ...
libqpdf/InputSource.cc
... ... @@ -121,9 +121,12 @@ InputSource::findFirst(
121 121 }
122 122  
123 123 // Search for the first character.
124   - if ((p = static_cast<char*>(memchr(
125   - p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) !=
126   - 0) {
  124 + if ((p = static_cast<char*>(
  125 + // line-break
  126 + memchr(
  127 + p,
  128 + start_chars[0],
  129 + bytes_read - QIntC::to_size(p - buf)))) != 0) {
127 130 if (p == buf) {
128 131 QTC::TC("libtests", "InputSource found match at buf[0]");
129 132 }
... ...
libqpdf/NNTree.cc
... ... @@ -21,12 +21,14 @@ warn(QPDF* qpdf, QPDFObjectHandle&amp; node, std::string const&amp; msg)
21 21 // ABI: in qpdf 11, change to a reference.
22 22  
23 23 if (qpdf) {
24   - qpdf->warn(QPDFExc(
25   - qpdf_e_damaged_pdf,
26   - qpdf->getFilename(),
27   - get_description(node),
28   - 0,
29   - msg));
  24 + qpdf->warn(
  25 + // line-break
  26 + QPDFExc(
  27 + qpdf_e_damaged_pdf,
  28 + qpdf->getFilename(),
  29 + get_description(node),
  30 + 0,
  31 + msg));
30 32 }
31 33 }
32 34  
... ... @@ -122,8 +124,8 @@ NNTreeIterator::getNextKid(PathElement&amp; pe, bool backward)
122 124 warn(
123 125 impl.qpdf,
124 126 pe.node,
125   - "skipping over invalid kid at index " +
126   - QUtil::int_to_string(pe.kid_number));
  127 + ("skipping over invalid kid at index " +
  128 + QUtil::int_to_string(pe.kid_number)));
127 129 }
128 130 } else {
129 131 result = QPDFObjectHandle::newNull();
... ... @@ -179,8 +181,8 @@ NNTreeIterator::increment(bool backward)
179 181 warn(
180 182 impl.qpdf,
181 183 this->node,
182   - "item " + QUtil::int_to_string(this->item_number) +
183   - " has the wrong type");
  184 + ("item " + QUtil::int_to_string(this->item_number) +
  185 + " has the wrong type"));
184 186 } else {
185 187 found_valid_key = true;
186 188 }
... ... @@ -708,9 +710,9 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
708 710 warn(
709 711 impl.qpdf,
710 712 node,
711   - "converting kid number " +
712   - QUtil::int_to_string(kid_number) +
713   - " to an indirect object");
  713 + ("converting kid number " +
  714 + QUtil::int_to_string(kid_number) +
  715 + " to an indirect object"));
714 716 next = impl.qpdf->makeIndirectObject(next);
715 717 kids.setArrayItem(kid_number, next);
716 718 } else {
... ... @@ -718,8 +720,8 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
718 720 warn(
719 721 impl.qpdf,
720 722 node,
721   - "kid number " + QUtil::int_to_string(kid_number) +
722   - " is not an indirect object");
  723 + ("kid number " + QUtil::int_to_string(kid_number) +
  724 + " is not an indirect object"));
723 725 }
724 726 }
725 727 node = next;
... ... @@ -732,8 +734,8 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
732 734 warn(
733 735 impl.qpdf,
734 736 node,
735   - "name/number tree node has neither non-empty " +
736   - impl.details.itemsKey() + " nor /Kids");
  737 + ("name/number tree node has neither non-empty " +
  738 + impl.details.itemsKey() + " nor /Kids"));
737 739 failed = true;
738 740 break;
739 741 }
... ... @@ -876,8 +878,8 @@ NNTreeImpl::compareKeyItem(
876 878 error(
877 879 qpdf,
878 880 this->oh,
879   - "item at index " + QUtil::int_to_string(2 * idx) +
880   - " is not the right type");
  881 + ("item at index " + QUtil::int_to_string(2 * idx) +
  882 + " is not the right type"));
881 883 }
882 884 return details.compareKeys(key, items.getArrayItem(2 * idx));
883 885 }
... ...
libqpdf/Pl_DCT.cc
... ... @@ -185,8 +185,9 @@ static void
185 185 jpeg_pipeline_dest(
186 186 j_compress_ptr cinfo, unsigned char* outbuffer, size_t size, Pipeline* next)
187 187 {
188   - cinfo->dest =
189   - static_cast<struct jpeg_destination_mgr*>((*cinfo->mem->alloc_small)(
  188 + cinfo->dest = static_cast<struct jpeg_destination_mgr*>(
  189 + // line-break
  190 + (*cinfo->mem->alloc_small)(
190 191 reinterpret_cast<j_common_ptr>(cinfo),
191 192 JPOOL_PERMANENT,
192 193 sizeof(dct_pipeline_dest)));
... ... @@ -239,10 +240,12 @@ term_buffer_source(j_decompress_ptr)
239 240 static void
240 241 jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
241 242 {
242   - cinfo->src = reinterpret_cast<jpeg_source_mgr*>((*cinfo->mem->alloc_small)(
243   - reinterpret_cast<j_common_ptr>(cinfo),
244   - JPOOL_PERMANENT,
245   - sizeof(jpeg_source_mgr)));
  243 + cinfo->src = reinterpret_cast<jpeg_source_mgr*>(
  244 + // line-break
  245 + (*cinfo->mem->alloc_small)(
  246 + reinterpret_cast<j_common_ptr>(cinfo),
  247 + JPOOL_PERMANENT,
  248 + sizeof(jpeg_source_mgr)));
246 249  
247 250 jpeg_source_mgr* src = cinfo->src;
248 251 src->init_source = init_buffer_source;
... ...
libqpdf/Pl_QPDFTokenizer.cc
... ... @@ -44,8 +44,10 @@ void
44 44 Pl_QPDFTokenizer::finish()
45 45 {
46 46 this->m->buf.finish();
47   - auto input = PointerHolder<InputSource>(new BufferInputSource(
48   - "tokenizer data", this->m->buf.getBuffer(), true));
  47 + auto input = PointerHolder<InputSource>(
  48 + // line-break
  49 + new BufferInputSource(
  50 + "tokenizer data", this->m->buf.getBuffer(), true));
49 51  
50 52 while (true) {
51 53 QPDFTokenizer::Token token = this->m->tokenizer.readToken(
... ... @@ -59,8 +61,10 @@ Pl_QPDFTokenizer::finish()
59 61 // Read the space after the ID.
60 62 char ch = ' ';
61 63 input->read(&ch, 1);
62   - this->m->filter->handleToken(QPDFTokenizer::Token(
63   - QPDFTokenizer::tt_space, std::string(1, ch)));
  64 + this->m->filter->handleToken(
  65 + // line-break
  66 + QPDFTokenizer::Token(
  67 + QPDFTokenizer::tt_space, std::string(1, ch)));
64 68 QTC::TC("qpdf", "Pl_QPDFTokenizer found ID");
65 69 this->m->tokenizer.expectInlineImage(input);
66 70 }
... ...
libqpdf/QPDF.cc
... ... @@ -31,22 +31,24 @@
31 31 // it, and the C API relies on its being static as well.
32 32 std::string const QPDF::qpdf_version(QPDF_VERSION);
33 33  
34   -static char const* EMPTY_PDF = "%PDF-1.3\n"
35   - "1 0 obj\n"
36   - "<< /Type /Catalog /Pages 2 0 R >>\n"
37   - "endobj\n"
38   - "2 0 obj\n"
39   - "<< /Type /Pages /Kids [] /Count 0 >>\n"
40   - "endobj\n"
41   - "xref\n"
42   - "0 3\n"
43   - "0000000000 65535 f \n"
44   - "0000000009 00000 n \n"
45   - "0000000058 00000 n \n"
46   - "trailer << /Size 3 /Root 1 0 R >>\n"
47   - "startxref\n"
48   - "110\n"
49   - "%%EOF\n";
  34 +static char const* EMPTY_PDF = (
  35 + // force line break
  36 + "%PDF-1.3\n"
  37 + "1 0 obj\n"
  38 + "<< /Type /Catalog /Pages 2 0 R >>\n"
  39 + "endobj\n"
  40 + "2 0 obj\n"
  41 + "<< /Type /Pages /Kids [] /Count 0 >>\n"
  42 + "endobj\n"
  43 + "xref\n"
  44 + "0 3\n"
  45 + "0000000000 65535 f \n"
  46 + "0000000009 00000 n \n"
  47 + "0000000058 00000 n \n"
  48 + "trailer << /Size 3 /Root 1 0 R >>\n"
  49 + "startxref\n"
  50 + "110\n"
  51 + "%%EOF\n");
50 52  
51 53 class InvalidInputSource: public InputSource
52 54 {
... ... @@ -292,10 +294,12 @@ QPDF::processMemoryFile(
292 294 char const* password)
293 295 {
294 296 processInputSource(
295   - PointerHolder<InputSource>(new BufferInputSource(
296   - description,
297   - new Buffer(QUtil::unsigned_char_pointer(buf), length),
298   - true)),
  297 + PointerHolder<InputSource>(
  298 + // line-break
  299 + new BufferInputSource(
  300 + description,
  301 + new Buffer(QUtil::unsigned_char_pointer(buf), length),
  302 + true)),
299 303 password);
300 304 }
301 305  
... ... @@ -753,10 +757,10 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
753 757 this->m->file->getName(),
754 758 "",
755 759 0,
756   - std::string("reported number of objects (") +
757   - QUtil::int_to_string(size) +
758   - ") is not one plus the highest object number (" +
759   - QUtil::int_to_string(max_obj) + ")"));
  760 + (std::string("reported number of objects (") +
  761 + QUtil::int_to_string(size) +
  762 + ") is not one plus the highest object number (" +
  763 + QUtil::int_to_string(max_obj) + ")")));
760 764 }
761 765  
762 766 // We no longer need the deleted_objects table, so go ahead and
... ... @@ -1145,8 +1149,8 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle&amp; xref_obj)
1145 1149 this->m->file->getName(),
1146 1150 "xref stream",
1147 1151 xref_offset,
1148   - "Cross-reference stream's /Index's item " +
1149   - QUtil::int_to_string(i) + " is not an integer");
  1152 + ("Cross-reference stream's /Index's item " +
  1153 + QUtil::int_to_string(i) + " is not an integer"));
1150 1154 }
1151 1155 }
1152 1156 QTC::TC("qpdf", "QPDF xref /Index is array", n_index == 2 ? 0 : 1);
... ... @@ -1165,11 +1169,11 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle&amp; xref_obj)
1165 1169 this->m->file->getName(),
1166 1170 "xref stream",
1167 1171 xref_offset,
1168   - "Cross-reference stream claims to contain"
1169   - " too many entries: " +
1170   - QUtil::int_to_string(indx.at(i)) + " " +
1171   - QUtil::uint_to_string(max_num_entries) + " " +
1172   - QUtil::uint_to_string(num_entries));
  1172 + ("Cross-reference stream claims to contain"
  1173 + " too many entries: " +
  1174 + QUtil::int_to_string(indx.at(i)) + " " +
  1175 + QUtil::uint_to_string(max_num_entries) + " " +
  1176 + QUtil::uint_to_string(num_entries)));
1173 1177 }
1174 1178 num_entries += toS(indx.at(i));
1175 1179 }
... ... @@ -1187,10 +1191,10 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle&amp; xref_obj)
1187 1191 this->m->file->getName(),
1188 1192 "xref stream",
1189 1193 xref_offset,
1190   - "Cross-reference stream data has the wrong size;"
1191   - " expected = " +
1192   - QUtil::uint_to_string(expected_size) +
1193   - "; actual = " + QUtil::uint_to_string(actual_size));
  1194 + ("Cross-reference stream data has the wrong size;"
  1195 + " expected = " +
  1196 + QUtil::uint_to_string(expected_size) +
  1197 + "; actual = " + QUtil::uint_to_string(actual_size)));
1194 1198 if (expected_size > actual_size) {
1195 1199 throw x;
1196 1200 } else {
... ... @@ -1484,8 +1488,10 @@ QPDF::getAllObjects()
1484 1488 iter != this->m->obj_cache.end();
1485 1489 ++iter) {
1486 1490 QPDFObjGen const& og = (*iter).first;
1487   - result.push_back(QPDFObjectHandle::Factory::newIndirect(
1488   - this, og.getObj(), og.getGen()));
  1491 + result.push_back(
  1492 + // line-break
  1493 + QPDFObjectHandle::Factory::newIndirect(
  1494 + this, og.getObj(), og.getGen()));
1489 1495 }
1490 1496 return result;
1491 1497 }
... ... @@ -1860,8 +1866,8 @@ QPDF::readObjectAtOffset(
1860 1866 this->m->file->getName(),
1861 1867 this->m->last_object_description,
1862 1868 offset,
1863   - std::string("expected ") + QUtil::int_to_string(exp_objid) +
1864   - " " + QUtil::int_to_string(exp_generation) + " obj");
  1869 + (std::string("expected ") + QUtil::int_to_string(exp_objid) +
  1870 + " " + QUtil::int_to_string(exp_generation) + " obj"));
1865 1871 if (try_recovery) {
1866 1872 // Will be retried below
1867 1873 throw e;
... ... @@ -2003,8 +2009,8 @@ QPDF::resolve(int objid, int generation)
2003 2009 this->m->file->getName(),
2004 2010 "",
2005 2011 this->m->file->getLastOffset(),
2006   - "loop detected resolving object " + QUtil::int_to_string(objid) +
2007   - " " + QUtil::int_to_string(generation)));
  2012 + ("loop detected resolving object " + QUtil::int_to_string(objid) +
  2013 + " " + QUtil::int_to_string(generation))));
2008 2014 return PointerHolder<QPDFObject>(new QPDF_Null);
2009 2015 }
2010 2016 ResolveRecorder rr(this, og);
... ... @@ -2040,9 +2046,9 @@ QPDF::resolve(int objid, int generation)
2040 2046 this->m->file->getName(),
2041 2047 "",
2042 2048 0,
2043   - "object " + QUtil::int_to_string(objid) + "/" +
2044   - QUtil::int_to_string(generation) +
2045   - " has unexpected xref entry type");
  2049 + ("object " + QUtil::int_to_string(objid) + "/" +
  2050 + QUtil::int_to_string(generation) +
  2051 + " has unexpected xref entry type"));
2046 2052 }
2047 2053 } catch (QPDFExc& e) {
2048 2054 warn(e);
... ... @@ -2052,9 +2058,9 @@ QPDF::resolve(int objid, int generation)
2052 2058 this->m->file->getName(),
2053 2059 "",
2054 2060 0,
2055   - "object " + QUtil::int_to_string(objid) + "/" +
2056   - QUtil::int_to_string(generation) +
2057   - ": error reading object: " + e.what()));
  2061 + ("object " + QUtil::int_to_string(objid) + "/" +
  2062 + QUtil::int_to_string(generation) +
  2063 + ": error reading object: " + e.what())));
2058 2064 }
2059 2065 }
2060 2066 if (this->m->obj_cache.count(og) == 0) {
... ... @@ -2069,8 +2075,8 @@ QPDF::resolve(int objid, int generation)
2069 2075 if (!result->hasDescription()) {
2070 2076 result->setDescription(
2071 2077 this,
2072   - "object " + QUtil::int_to_string(objid) + " " +
2073   - QUtil::int_to_string(generation));
  2078 + ("object " + QUtil::int_to_string(objid) + " " +
  2079 + QUtil::int_to_string(generation)));
2074 2080 }
2075 2081 return result;
2076 2082 }
... ... @@ -2090,8 +2096,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2090 2096 this->m->file->getName(),
2091 2097 this->m->last_object_description,
2092 2098 this->m->file->getLastOffset(),
2093   - "supposed object stream " +
2094   - QUtil::int_to_string(obj_stream_number) + " is not a stream");
  2099 + ("supposed object stream " +
  2100 + QUtil::int_to_string(obj_stream_number) + " is not a stream"));
2095 2101 }
2096 2102  
2097 2103 // For linearization data in the object, use the data from the
... ... @@ -2110,8 +2116,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2110 2116 this->m->file->getName(),
2111 2117 this->m->last_object_description,
2112 2118 this->m->file->getLastOffset(),
2113   - "supposed object stream " +
2114   - QUtil::int_to_string(obj_stream_number) + " has wrong type"));
  2119 + ("supposed object stream " +
  2120 + QUtil::int_to_string(obj_stream_number) + " has wrong type")));
2115 2121 }
2116 2122  
2117 2123 if (!(dict.getKey("/N").isInteger() && dict.getKey("/First").isInteger())) {
... ... @@ -2120,8 +2126,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2120 2126 this->m->file->getName(),
2121 2127 this->m->last_object_description,
2122 2128 this->m->file->getLastOffset(),
2123   - "object stream " + QUtil::int_to_string(obj_stream_number) +
2124   - " has incorrect keys");
  2129 + ("object stream " + QUtil::int_to_string(obj_stream_number) +
  2130 + " has incorrect keys"));
2125 2131 }
2126 2132  
2127 2133 int n = dict.getKey("/N").getIntValueAsInt();
... ... @@ -2130,10 +2136,12 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
2130 2136 std::map<int, int> offsets;
2131 2137  
2132 2138 PointerHolder<Buffer> bp = obj_stream.getStreamData(qpdf_dl_specialized);
2133   - auto input = PointerHolder<InputSource>(new BufferInputSource(
2134   - this->m->file->getName() + " object stream " +
2135   - QUtil::int_to_string(obj_stream_number),
2136   - bp.get()));
  2139 + auto input = PointerHolder<InputSource>(
  2140 + // line-break
  2141 + new BufferInputSource(
  2142 + (this->m->file->getName() + " object stream " +
  2143 + QUtil::int_to_string(obj_stream_number)),
  2144 + bp.get()));
2137 2145  
2138 2146 for (int i = 0; i < n; ++i) {
2139 2147 QPDFTokenizer::Token tnum = readToken(input);
... ... @@ -2428,8 +2436,10 @@ QPDF::replaceForeignIndirectObjects(
2428 2436 result = QPDFObjectHandle::newArray();
2429 2437 int n = foreign.getArrayNItems();
2430 2438 for (int i = 0; i < n; ++i) {
2431   - result.appendItem(replaceForeignIndirectObjects(
2432   - foreign.getArrayItem(i), obj_copier, false));
  2439 + result.appendItem(
  2440 + // line-break
  2441 + replaceForeignIndirectObjects(
  2442 + foreign.getArrayItem(i), obj_copier, false));
2433 2443 }
2434 2444 } else if (foreign.isDictionary()) {
2435 2445 QTC::TC("qpdf", "QPDF replace dictionary");
... ... @@ -2800,22 +2810,26 @@ QPDF::pipeStreamData(
2800 2810 } catch (std::exception& e) {
2801 2811 if (!suppress_warnings) {
2802 2812 QTC::TC("qpdf", "QPDF decoding error warning");
2803   - qpdf_for_warning.warn(QPDFExc(
2804   - qpdf_e_damaged_pdf,
2805   - file->getName(),
2806   - "",
2807   - file->getLastOffset(),
2808   - "error decoding stream data for object " +
2809   - QUtil::int_to_string(objid) + " " +
2810   - QUtil::int_to_string(generation) + ": " + e.what()));
2811   - if (will_retry) {
2812   - qpdf_for_warning.warn(QPDFExc(
  2813 + qpdf_for_warning.warn(
  2814 + // line-break
  2815 + QPDFExc(
2813 2816 qpdf_e_damaged_pdf,
2814 2817 file->getName(),
2815 2818 "",
2816 2819 file->getLastOffset(),
2817   - "stream will be re-processed without"
2818   - " filtering to avoid data loss"));
  2820 + ("error decoding stream data for object " +
  2821 + QUtil::int_to_string(objid) + " " +
  2822 + QUtil::int_to_string(generation) + ": " + e.what())));
  2823 + if (will_retry) {
  2824 + qpdf_for_warning.warn(
  2825 + // line-break
  2826 + QPDFExc(
  2827 + qpdf_e_damaged_pdf,
  2828 + file->getName(),
  2829 + "",
  2830 + file->getLastOffset(),
  2831 + "stream will be re-processed without"
  2832 + " filtering to avoid data loss"));
2819 2833 }
2820 2834 }
2821 2835 }
... ...
libqpdf/QPDFAcroFormDocumentHelper.cc
... ... @@ -1110,8 +1110,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
1110 1110 } else if (ap.second.isDictionary()) {
1111 1111 for (auto& ap2 : ap.second.ditems()) {
1112 1112 if (ap2.second.isStream()) {
1113   - streams.push_back(replace_stream(
1114   - ap.second, ap2.first, ap2.second));
  1113 + streams.push_back(
  1114 + // line-break
  1115 + replace_stream(
  1116 + ap.second, ap2.first, ap2.second));
1115 1117 }
1116 1118 }
1117 1119 }
... ...
libqpdf/QPDFCrypto_openssl.cc
... ... @@ -208,8 +208,10 @@ QPDFCrypto_openssl::rijndael_init(
208 208 }
209 209  
210 210 check_openssl(EVP_CIPHER_CTX_reset(cipher_ctx));
211   - check_openssl(EVP_CipherInit_ex(
212   - cipher_ctx, cipher, nullptr, key_data, cbc_block, encrypt));
  211 + check_openssl(
  212 + // line-break
  213 + EVP_CipherInit_ex(
  214 + cipher_ctx, cipher, nullptr, key_data, cbc_block, encrypt));
213 215 check_openssl(EVP_CIPHER_CTX_set_padding(cipher_ctx, 0));
214 216 }
215 217  
... ...
libqpdf/QPDFFormFieldObjectHelper.cc
... ... @@ -913,6 +913,8 @@ QPDFFormFieldObjectHelper::generateTextAppearance(
913 913 opt.at(i) = (*encoder)(opt.at(i), '?');
914 914 }
915 915  
916   - AS.addTokenFilter(PointerHolder<QPDFObjectHandle::TokenFilter>(
917   - new ValueSetter(DA, V, opt, tf, bbox)));
  916 + AS.addTokenFilter(
  917 + // line-break
  918 + PointerHolder<QPDFObjectHandle::TokenFilter>(
  919 + new ValueSetter(DA, V, opt, tf, bbox)));
918 920 }
... ...
libqpdf/QPDFJob.cc
... ... @@ -2519,10 +2519,12 @@ QPDFJob::handlePageSpecs(
2519 2519  
2520 2520 // Read original pages from the PDF, and parse the page range
2521 2521 // associated with this occurrence of the file.
2522   - parsed_specs.push_back(QPDFPageData(
2523   - page_spec.filename,
2524   - page_spec_qpdfs[page_spec.filename],
2525   - page_spec.range));
  2522 + parsed_specs.push_back(
  2523 + // line-break
  2524 + QPDFPageData(
  2525 + page_spec.filename,
  2526 + page_spec_qpdfs[page_spec.filename],
  2527 + page_spec.range));
2526 2528 }
2527 2529  
2528 2530 std::map<unsigned long long, bool> remove_unreferenced;
... ... @@ -2581,9 +2583,11 @@ QPDFJob::handlePageSpecs(
2581 2583 for (size_t j = 0; j < m->collate; ++j) {
2582 2584 if (cur_page + j < page_data.selected_pages.size()) {
2583 2585 got_pages = true;
2584   - new_parsed_specs.push_back(QPDFPageData(
2585   - page_data,
2586   - page_data.selected_pages.at(cur_page + j)));
  2586 + new_parsed_specs.push_back(
  2587 + // line-break
  2588 + QPDFPageData(
  2589 + page_data,
  2590 + page_data.selected_pages.at(cur_page + j)));
2587 2591 }
2588 2592 }
2589 2593 }
... ... @@ -2684,9 +2688,9 @@ QPDFJob::handlePageSpecs(
2684 2688 pdf.getFilename(),
2685 2689 "",
2686 2690 0,
2687   - "Exception caught while fixing copied"
2688   - " annotations. This may be a qpdf bug. " +
2689   - std::string("Exception: ") + e.what()));
  2691 + ("Exception caught while fixing copied"
  2692 + " annotations. This may be a qpdf bug. " +
  2693 + std::string("Exception: ") + e.what())));
2690 2694 }
2691 2695 }
2692 2696 }
... ... @@ -3060,8 +3064,9 @@ QPDFJob::setWriterOptions(QPDF&amp; pdf, QPDFWriter&amp; w)
3060 3064 w.forcePDFVersion(version, extension_level);
3061 3065 }
3062 3066 if (m->progress && m->outfilename) {
3063   - w.registerProgressReporter(
3064   - PointerHolder<QPDFWriter::ProgressReporter>(new ProgressReporter(
  3067 + w.registerProgressReporter(PointerHolder<QPDFWriter::ProgressReporter>(
  3068 + // line-break
  3069 + new ProgressReporter(
3065 3070 *(this->m->cout),
3066 3071 this->m->message_prefix,
3067 3072 m->outfilename.get())));
... ...
libqpdf/QPDFObjectHandle.cc
... ... @@ -257,8 +257,8 @@ QPDFObjectHandle::setObjectDescriptionFromInput(
257 257 {
258 258 object.setObjectDescription(
259 259 context,
260   - input->getName() + ", " + description + " at offset " +
261   - QUtil::int_to_string(offset));
  260 + (input->getName() + ", " + description + " at offset " +
  261 + QUtil::int_to_string(offset)));
262 262 }
263 263  
264 264 bool
... ... @@ -1018,8 +1018,8 @@ QPDFObjectHandle::getKey(std::string const&amp; key)
1018 1018 if (this->obj->getDescription(qpdf, description)) {
1019 1019 result.setObjectDescription(
1020 1020 qpdf,
1021   - description + " -> null returned from getting key " + key +
1022   - " from non-Dictionary");
  1021 + (description + " -> null returned from getting key " + key +
  1022 + " from non-Dictionary"));
1023 1023 }
1024 1024 }
1025 1025 return result;
... ...