2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

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.
This commit is contained in:
Jay Berkenbilt 2022-04-03 16:10:27 -04:00
parent 12f1eb15ca
commit 77e889495f
15 changed files with 240 additions and 193 deletions

2
TODO
View File

@ -51,7 +51,7 @@ Use clang-format-15.
done
* Carefully inspect the diff. There are some places where a comment to
force a line break might be in order.
force a line break might be in order. Document use of // line-break
* Update README-maintainer about formatting. Mention

View File

@ -45,25 +45,29 @@ process(
// Create an indirect object for the built-in Helvetica font. This
// uses the qpdf literal syntax introduced in qpdf 10.6.
auto f1 = q.makeIndirectObject("<<"
" /Type /Font"
" /Subtype /Type1"
" /Name /F1"
" /BaseFont /Helvetica"
" /Encoding /WinAnsiEncoding"
">>"_qpdf);
auto f1 = q.makeIndirectObject(
// force line-break
"<<"
" /Type /Font"
" /Subtype /Type1"
" /Name /F1"
" /BaseFont /Helvetica"
" /Encoding /WinAnsiEncoding"
">>"_qpdf);
// Create a resources dictionary with fonts. This uses the new
// parse introduced in qpdf 10.2 that takes a QPDF* and allows
// indirect object references.
auto resources = q.makeIndirectObject(QPDFObjectHandle::parse(
&q,
"<<"
" /Font <<"
" /F1 " +
f1.unparse() +
" >>"
">>"));
auto resources = q.makeIndirectObject(
// line-break
QPDFObjectHandle::parse(
&q,
("<<"
" /Font <<"
" /F1 " +
f1.unparse() +
" >>"
">>")));
// Create a file spec.
std::string key = QUtil::path_basename(attachment);
@ -108,45 +112,45 @@ process(
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"
">>"));
("<<"
" /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 = QPDFObjectHandle::newStream(
&q,
"q\n"
"BT\n"
" 102 700 Td\n"
" /F1 16 Tf\n"
" (Here is an attachment.) Tj\n"
"ET\n"
"Q\n");
("q\n"
"BT\n"
" 102 700 Td\n"
" /F1 16 Tf\n"
" (Here is an attachment.) Tj\n"
"ET\n"
"Q\n"));
// Create the page object.
auto page = QPDFObjectHandle::parse(
&q,
"<<"
" /Annots [ " +
annot.unparse() +
" ]"
" /Contents " +
contents.unparse() +
" /MediaBox [0 0 612 792]"
" /Resources " +
resources.unparse() +
" /Type /Page"
">>");
("<<"
" /Annots [ " +
annot.unparse() +
" ]"
" /Contents " +
contents.unparse() +
" /MediaBox [0 0 612 792]"
" /Resources " +
resources.unparse() +
" /Type /Page"
">>"));
// Add the page.
q.addPage(page, true);

View File

@ -180,11 +180,13 @@ add_page(
size_t width = p->getWidth();
size_t height = p->getHeight();
QPDFObjectHandle image = QPDFObjectHandle::newStream(&pdf);
auto image_dict = "<<"
" /Type /XObject"
" /Subtype /Image"
" /BitsPerComponent 8"
">>"_qpdf;
auto image_dict =
// line-break
"<<"
" /Type /XObject"
" /Subtype /Image"
" /BitsPerComponent 8"
">>"_qpdf;
image_dict.replaceKey("/ColorSpace", newName(color_space));
image_dict.replaceKey("/Width", newInteger(width));
image_dict.replaceKey("/Height", newInteger(height));
@ -352,13 +354,15 @@ create_pdf(char const* filename)
// Add an indirect object to contain a font descriptor for the
// built-in Helvetica font.
QPDFObjectHandle font = pdf.makeIndirectObject("<<"
" /Type /Font"
" /Subtype /Type1"
" /Name /F1"
" /BaseFont /Helvetica"
" /Encoding /WinAnsiEncoding"
">>"_qpdf);
QPDFObjectHandle font = pdf.makeIndirectObject(
// line-break
"<<"
" /Type /Font"
" /Subtype /Type1"
" /Name /F1"
" /BaseFont /Helvetica"
" /Encoding /WinAnsiEncoding"
">>"_qpdf);
std::vector<std::string> color_spaces;
color_spaces.push_back("/DeviceCMYK");

View File

@ -47,8 +47,10 @@ BitStream::getBitsSigned(size_t nbits)
int
BitStream::getBitsInt(size_t nbits)
{
return static_cast<int>(QIntC::to_uint(
read_bits(this->p, this->bit_offset, this->bits_available, nbits)));
return static_cast<int>(
// line-break
QIntC::to_uint(
read_bits(this->p, this->bit_offset, this->bits_available, nbits)));
}
void

View File

@ -96,9 +96,9 @@ void
FileInputSource::seek(qpdf_offset_t offset, int whence)
{
QUtil::os_wrapper(
std::string("seek to ") + this->m->filename + ", offset " +
QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
")",
(std::string("seek to ") + this->m->filename + ", offset " +
QUtil::int_to_string(offset) + " (" + QUtil::int_to_string(whence) +
")"),
QUtil::seek(this->m->file, offset, whence));
}
@ -120,8 +120,8 @@ FileInputSource::read(char* buffer, size_t length)
this->m->filename,
"",
this->last_offset,
std::string("read ") + QUtil::uint_to_string(length) +
" bytes");
(std::string("read ") + QUtil::uint_to_string(length) +
" bytes"));
} else if (length > 0) {
this->seek(0, SEEK_END);
this->last_offset = this->tell();

View File

@ -121,9 +121,12 @@ InputSource::findFirst(
}
// Search for the first character.
if ((p = static_cast<char*>(memchr(
p, start_chars[0], bytes_read - QIntC::to_size(p - buf)))) !=
0) {
if ((p = static_cast<char*>(
// line-break
memchr(
p,
start_chars[0],
bytes_read - QIntC::to_size(p - buf)))) != 0) {
if (p == buf) {
QTC::TC("libtests", "InputSource found match at buf[0]");
}

View File

@ -21,12 +21,14 @@ warn(QPDF* qpdf, QPDFObjectHandle& node, std::string const& msg)
// ABI: in qpdf 11, change to a reference.
if (qpdf) {
qpdf->warn(QPDFExc(
qpdf_e_damaged_pdf,
qpdf->getFilename(),
get_description(node),
0,
msg));
qpdf->warn(
// line-break
QPDFExc(
qpdf_e_damaged_pdf,
qpdf->getFilename(),
get_description(node),
0,
msg));
}
}
@ -122,8 +124,8 @@ NNTreeIterator::getNextKid(PathElement& pe, bool backward)
warn(
impl.qpdf,
pe.node,
"skipping over invalid kid at index " +
QUtil::int_to_string(pe.kid_number));
("skipping over invalid kid at index " +
QUtil::int_to_string(pe.kid_number)));
}
} else {
result = QPDFObjectHandle::newNull();
@ -179,8 +181,8 @@ NNTreeIterator::increment(bool backward)
warn(
impl.qpdf,
this->node,
"item " + QUtil::int_to_string(this->item_number) +
" has the wrong type");
("item " + QUtil::int_to_string(this->item_number) +
" has the wrong type"));
} else {
found_valid_key = true;
}
@ -708,9 +710,9 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
warn(
impl.qpdf,
node,
"converting kid number " +
QUtil::int_to_string(kid_number) +
" to an indirect object");
("converting kid number " +
QUtil::int_to_string(kid_number) +
" to an indirect object"));
next = impl.qpdf->makeIndirectObject(next);
kids.setArrayItem(kid_number, next);
} else {
@ -718,8 +720,8 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
warn(
impl.qpdf,
node,
"kid number " + QUtil::int_to_string(kid_number) +
" is not an indirect object");
("kid number " + QUtil::int_to_string(kid_number) +
" is not an indirect object"));
}
}
node = next;
@ -732,8 +734,8 @@ NNTreeIterator::deepen(QPDFObjectHandle node, bool first, bool allow_empty)
warn(
impl.qpdf,
node,
"name/number tree node has neither non-empty " +
impl.details.itemsKey() + " nor /Kids");
("name/number tree node has neither non-empty " +
impl.details.itemsKey() + " nor /Kids"));
failed = true;
break;
}
@ -876,8 +878,8 @@ NNTreeImpl::compareKeyItem(
error(
qpdf,
this->oh,
"item at index " + QUtil::int_to_string(2 * idx) +
" is not the right type");
("item at index " + QUtil::int_to_string(2 * idx) +
" is not the right type"));
}
return details.compareKeys(key, items.getArrayItem(2 * idx));
}

View File

@ -185,8 +185,9 @@ static void
jpeg_pipeline_dest(
j_compress_ptr cinfo, unsigned char* outbuffer, size_t size, Pipeline* next)
{
cinfo->dest =
static_cast<struct jpeg_destination_mgr*>((*cinfo->mem->alloc_small)(
cinfo->dest = static_cast<struct jpeg_destination_mgr*>(
// line-break
(*cinfo->mem->alloc_small)(
reinterpret_cast<j_common_ptr>(cinfo),
JPOOL_PERMANENT,
sizeof(dct_pipeline_dest)));
@ -239,10 +240,12 @@ term_buffer_source(j_decompress_ptr)
static void
jpeg_buffer_src(j_decompress_ptr cinfo, Buffer* buffer)
{
cinfo->src = reinterpret_cast<jpeg_source_mgr*>((*cinfo->mem->alloc_small)(
reinterpret_cast<j_common_ptr>(cinfo),
JPOOL_PERMANENT,
sizeof(jpeg_source_mgr)));
cinfo->src = reinterpret_cast<jpeg_source_mgr*>(
// line-break
(*cinfo->mem->alloc_small)(
reinterpret_cast<j_common_ptr>(cinfo),
JPOOL_PERMANENT,
sizeof(jpeg_source_mgr)));
jpeg_source_mgr* src = cinfo->src;
src->init_source = init_buffer_source;

View File

@ -44,8 +44,10 @@ void
Pl_QPDFTokenizer::finish()
{
this->m->buf.finish();
auto input = PointerHolder<InputSource>(new BufferInputSource(
"tokenizer data", this->m->buf.getBuffer(), true));
auto input = PointerHolder<InputSource>(
// line-break
new BufferInputSource(
"tokenizer data", this->m->buf.getBuffer(), true));
while (true) {
QPDFTokenizer::Token token = this->m->tokenizer.readToken(
@ -59,8 +61,10 @@ Pl_QPDFTokenizer::finish()
// Read the space after the ID.
char ch = ' ';
input->read(&ch, 1);
this->m->filter->handleToken(QPDFTokenizer::Token(
QPDFTokenizer::tt_space, std::string(1, ch)));
this->m->filter->handleToken(
// line-break
QPDFTokenizer::Token(
QPDFTokenizer::tt_space, std::string(1, ch)));
QTC::TC("qpdf", "Pl_QPDFTokenizer found ID");
this->m->tokenizer.expectInlineImage(input);
}

View File

@ -31,22 +31,24 @@
// it, and the C API relies on its being static as well.
std::string const QPDF::qpdf_version(QPDF_VERSION);
static char const* EMPTY_PDF = "%PDF-1.3\n"
"1 0 obj\n"
"<< /Type /Catalog /Pages 2 0 R >>\n"
"endobj\n"
"2 0 obj\n"
"<< /Type /Pages /Kids [] /Count 0 >>\n"
"endobj\n"
"xref\n"
"0 3\n"
"0000000000 65535 f \n"
"0000000009 00000 n \n"
"0000000058 00000 n \n"
"trailer << /Size 3 /Root 1 0 R >>\n"
"startxref\n"
"110\n"
"%%EOF\n";
static char const* EMPTY_PDF = (
// force line break
"%PDF-1.3\n"
"1 0 obj\n"
"<< /Type /Catalog /Pages 2 0 R >>\n"
"endobj\n"
"2 0 obj\n"
"<< /Type /Pages /Kids [] /Count 0 >>\n"
"endobj\n"
"xref\n"
"0 3\n"
"0000000000 65535 f \n"
"0000000009 00000 n \n"
"0000000058 00000 n \n"
"trailer << /Size 3 /Root 1 0 R >>\n"
"startxref\n"
"110\n"
"%%EOF\n");
class InvalidInputSource: public InputSource
{
@ -292,10 +294,12 @@ QPDF::processMemoryFile(
char const* password)
{
processInputSource(
PointerHolder<InputSource>(new BufferInputSource(
description,
new Buffer(QUtil::unsigned_char_pointer(buf), length),
true)),
PointerHolder<InputSource>(
// line-break
new BufferInputSource(
description,
new Buffer(QUtil::unsigned_char_pointer(buf), length),
true)),
password);
}
@ -753,10 +757,10 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
this->m->file->getName(),
"",
0,
std::string("reported number of objects (") +
QUtil::int_to_string(size) +
") is not one plus the highest object number (" +
QUtil::int_to_string(max_obj) + ")"));
(std::string("reported number of objects (") +
QUtil::int_to_string(size) +
") is not one plus the highest object number (" +
QUtil::int_to_string(max_obj) + ")")));
}
// We no longer need the deleted_objects table, so go ahead and
@ -1145,8 +1149,8 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle& xref_obj)
this->m->file->getName(),
"xref stream",
xref_offset,
"Cross-reference stream's /Index's item " +
QUtil::int_to_string(i) + " is not an integer");
("Cross-reference stream's /Index's item " +
QUtil::int_to_string(i) + " is not an integer"));
}
}
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& xref_obj)
this->m->file->getName(),
"xref stream",
xref_offset,
"Cross-reference stream claims to contain"
" too many entries: " +
QUtil::int_to_string(indx.at(i)) + " " +
QUtil::uint_to_string(max_num_entries) + " " +
QUtil::uint_to_string(num_entries));
("Cross-reference stream claims to contain"
" too many entries: " +
QUtil::int_to_string(indx.at(i)) + " " +
QUtil::uint_to_string(max_num_entries) + " " +
QUtil::uint_to_string(num_entries)));
}
num_entries += toS(indx.at(i));
}
@ -1187,10 +1191,10 @@ QPDF::processXRefStream(qpdf_offset_t xref_offset, QPDFObjectHandle& xref_obj)
this->m->file->getName(),
"xref stream",
xref_offset,
"Cross-reference stream data has the wrong size;"
" expected = " +
QUtil::uint_to_string(expected_size) +
"; actual = " + QUtil::uint_to_string(actual_size));
("Cross-reference stream data has the wrong size;"
" expected = " +
QUtil::uint_to_string(expected_size) +
"; actual = " + QUtil::uint_to_string(actual_size)));
if (expected_size > actual_size) {
throw x;
} else {
@ -1484,8 +1488,10 @@ QPDF::getAllObjects()
iter != this->m->obj_cache.end();
++iter) {
QPDFObjGen const& og = (*iter).first;
result.push_back(QPDFObjectHandle::Factory::newIndirect(
this, og.getObj(), og.getGen()));
result.push_back(
// line-break
QPDFObjectHandle::Factory::newIndirect(
this, og.getObj(), og.getGen()));
}
return result;
}
@ -1860,8 +1866,8 @@ QPDF::readObjectAtOffset(
this->m->file->getName(),
this->m->last_object_description,
offset,
std::string("expected ") + QUtil::int_to_string(exp_objid) +
" " + QUtil::int_to_string(exp_generation) + " obj");
(std::string("expected ") + QUtil::int_to_string(exp_objid) +
" " + QUtil::int_to_string(exp_generation) + " obj"));
if (try_recovery) {
// Will be retried below
throw e;
@ -2003,8 +2009,8 @@ QPDF::resolve(int objid, int generation)
this->m->file->getName(),
"",
this->m->file->getLastOffset(),
"loop detected resolving object " + QUtil::int_to_string(objid) +
" " + QUtil::int_to_string(generation)));
("loop detected resolving object " + QUtil::int_to_string(objid) +
" " + QUtil::int_to_string(generation))));
return PointerHolder<QPDFObject>(new QPDF_Null);
}
ResolveRecorder rr(this, og);
@ -2040,9 +2046,9 @@ QPDF::resolve(int objid, int generation)
this->m->file->getName(),
"",
0,
"object " + QUtil::int_to_string(objid) + "/" +
QUtil::int_to_string(generation) +
" has unexpected xref entry type");
("object " + QUtil::int_to_string(objid) + "/" +
QUtil::int_to_string(generation) +
" has unexpected xref entry type"));
}
} catch (QPDFExc& e) {
warn(e);
@ -2052,9 +2058,9 @@ QPDF::resolve(int objid, int generation)
this->m->file->getName(),
"",
0,
"object " + QUtil::int_to_string(objid) + "/" +
QUtil::int_to_string(generation) +
": error reading object: " + e.what()));
("object " + QUtil::int_to_string(objid) + "/" +
QUtil::int_to_string(generation) +
": error reading object: " + e.what())));
}
}
if (this->m->obj_cache.count(og) == 0) {
@ -2069,8 +2075,8 @@ QPDF::resolve(int objid, int generation)
if (!result->hasDescription()) {
result->setDescription(
this,
"object " + QUtil::int_to_string(objid) + " " +
QUtil::int_to_string(generation));
("object " + QUtil::int_to_string(objid) + " " +
QUtil::int_to_string(generation)));
}
return result;
}
@ -2090,8 +2096,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
"supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " is not a stream");
("supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " is not a stream"));
}
// For linearization data in the object, use the data from the
@ -2110,8 +2116,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
"supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " has wrong type"));
("supposed object stream " +
QUtil::int_to_string(obj_stream_number) + " has wrong type")));
}
if (!(dict.getKey("/N").isInteger() && dict.getKey("/First").isInteger())) {
@ -2120,8 +2126,8 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
this->m->file->getName(),
this->m->last_object_description,
this->m->file->getLastOffset(),
"object stream " + QUtil::int_to_string(obj_stream_number) +
" has incorrect keys");
("object stream " + QUtil::int_to_string(obj_stream_number) +
" has incorrect keys"));
}
int n = dict.getKey("/N").getIntValueAsInt();
@ -2130,10 +2136,12 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
std::map<int, int> offsets;
PointerHolder<Buffer> bp = obj_stream.getStreamData(qpdf_dl_specialized);
auto input = PointerHolder<InputSource>(new BufferInputSource(
this->m->file->getName() + " object stream " +
QUtil::int_to_string(obj_stream_number),
bp.get()));
auto input = PointerHolder<InputSource>(
// line-break
new BufferInputSource(
(this->m->file->getName() + " object stream " +
QUtil::int_to_string(obj_stream_number)),
bp.get()));
for (int i = 0; i < n; ++i) {
QPDFTokenizer::Token tnum = readToken(input);
@ -2428,8 +2436,10 @@ QPDF::replaceForeignIndirectObjects(
result = QPDFObjectHandle::newArray();
int n = foreign.getArrayNItems();
for (int i = 0; i < n; ++i) {
result.appendItem(replaceForeignIndirectObjects(
foreign.getArrayItem(i), obj_copier, false));
result.appendItem(
// line-break
replaceForeignIndirectObjects(
foreign.getArrayItem(i), obj_copier, false));
}
} else if (foreign.isDictionary()) {
QTC::TC("qpdf", "QPDF replace dictionary");
@ -2800,22 +2810,26 @@ QPDF::pipeStreamData(
} catch (std::exception& e) {
if (!suppress_warnings) {
QTC::TC("qpdf", "QPDF decoding error warning");
qpdf_for_warning.warn(QPDFExc(
qpdf_e_damaged_pdf,
file->getName(),
"",
file->getLastOffset(),
"error decoding stream data for object " +
QUtil::int_to_string(objid) + " " +
QUtil::int_to_string(generation) + ": " + e.what()));
if (will_retry) {
qpdf_for_warning.warn(QPDFExc(
qpdf_for_warning.warn(
// line-break
QPDFExc(
qpdf_e_damaged_pdf,
file->getName(),
"",
file->getLastOffset(),
"stream will be re-processed without"
" filtering to avoid data loss"));
("error decoding stream data for object " +
QUtil::int_to_string(objid) + " " +
QUtil::int_to_string(generation) + ": " + e.what())));
if (will_retry) {
qpdf_for_warning.warn(
// line-break
QPDFExc(
qpdf_e_damaged_pdf,
file->getName(),
"",
file->getLastOffset(),
"stream will be re-processed without"
" filtering to avoid data loss"));
}
}
}

View File

@ -1110,8 +1110,10 @@ QPDFAcroFormDocumentHelper::transformAnnotations(
} else if (ap.second.isDictionary()) {
for (auto& ap2 : ap.second.ditems()) {
if (ap2.second.isStream()) {
streams.push_back(replace_stream(
ap.second, ap2.first, ap2.second));
streams.push_back(
// line-break
replace_stream(
ap.second, ap2.first, ap2.second));
}
}
}

View File

@ -208,8 +208,10 @@ QPDFCrypto_openssl::rijndael_init(
}
check_openssl(EVP_CIPHER_CTX_reset(cipher_ctx));
check_openssl(EVP_CipherInit_ex(
cipher_ctx, cipher, nullptr, key_data, cbc_block, encrypt));
check_openssl(
// line-break
EVP_CipherInit_ex(
cipher_ctx, cipher, nullptr, key_data, cbc_block, encrypt));
check_openssl(EVP_CIPHER_CTX_set_padding(cipher_ctx, 0));
}

View File

@ -913,6 +913,8 @@ QPDFFormFieldObjectHelper::generateTextAppearance(
opt.at(i) = (*encoder)(opt.at(i), '?');
}
AS.addTokenFilter(PointerHolder<QPDFObjectHandle::TokenFilter>(
new ValueSetter(DA, V, opt, tf, bbox)));
AS.addTokenFilter(
// line-break
PointerHolder<QPDFObjectHandle::TokenFilter>(
new ValueSetter(DA, V, opt, tf, bbox)));
}

View File

@ -2519,10 +2519,12 @@ QPDFJob::handlePageSpecs(
// Read original pages from the PDF, and parse the page range
// associated with this occurrence of the file.
parsed_specs.push_back(QPDFPageData(
page_spec.filename,
page_spec_qpdfs[page_spec.filename],
page_spec.range));
parsed_specs.push_back(
// line-break
QPDFPageData(
page_spec.filename,
page_spec_qpdfs[page_spec.filename],
page_spec.range));
}
std::map<unsigned long long, bool> remove_unreferenced;
@ -2581,9 +2583,11 @@ QPDFJob::handlePageSpecs(
for (size_t j = 0; j < m->collate; ++j) {
if (cur_page + j < page_data.selected_pages.size()) {
got_pages = true;
new_parsed_specs.push_back(QPDFPageData(
page_data,
page_data.selected_pages.at(cur_page + j)));
new_parsed_specs.push_back(
// line-break
QPDFPageData(
page_data,
page_data.selected_pages.at(cur_page + j)));
}
}
}
@ -2684,9 +2688,9 @@ QPDFJob::handlePageSpecs(
pdf.getFilename(),
"",
0,
"Exception caught while fixing copied"
" annotations. This may be a qpdf bug. " +
std::string("Exception: ") + e.what()));
("Exception caught while fixing copied"
" annotations. This may be a qpdf bug. " +
std::string("Exception: ") + e.what())));
}
}
}
@ -3060,8 +3064,9 @@ QPDFJob::setWriterOptions(QPDF& pdf, QPDFWriter& w)
w.forcePDFVersion(version, extension_level);
}
if (m->progress && m->outfilename) {
w.registerProgressReporter(
PointerHolder<QPDFWriter::ProgressReporter>(new ProgressReporter(
w.registerProgressReporter(PointerHolder<QPDFWriter::ProgressReporter>(
// line-break
new ProgressReporter(
*(this->m->cout),
this->m->message_prefix,
m->outfilename.get())));

View File

@ -257,8 +257,8 @@ QPDFObjectHandle::setObjectDescriptionFromInput(
{
object.setObjectDescription(
context,
input->getName() + ", " + description + " at offset " +
QUtil::int_to_string(offset));
(input->getName() + ", " + description + " at offset " +
QUtil::int_to_string(offset)));
}
bool
@ -1018,8 +1018,8 @@ QPDFObjectHandle::getKey(std::string const& key)
if (this->obj->getDescription(qpdf, description)) {
result.setObjectDescription(
qpdf,
description + " -> null returned from getting key " + key +
" from non-Dictionary");
(description + " -> null returned from getting key " + key +
" from non-Dictionary"));
}
}
return result;