summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2023-12-23 03:45:10 +0100
committerJay Berkenbilt <ejb@ql.org>2023-12-23 03:45:10 +0100
commit7c0fdf8510fbc09a6a8f872d1c95f1d6e1709f28 (patch)
tree27e95477224c614b8da1d15380903c49bc527ee7
parentc0c7cef16cb666524e4809834063cfee5262eca1 (diff)
downloadqpdf-7c0fdf8510fbc09a6a8f872d1c95f1d6e1709f28.tar.zst
Format code, bump clang-format version to 18
-rw-r--r--examples/pdf-invert-images.cc3
-rw-r--r--examples/pdf-overlay-page.cc4
-rw-r--r--examples/qpdf-job.cc10
-rw-r--r--examples/qpdfjob-c.c2
-rwxr-xr-xformat-code2
-rw-r--r--include/qpdf/QPDF.hh3
-rw-r--r--libqpdf/QPDF.cc5
-rw-r--r--libqpdf/QPDFJob.cc7
-rw-r--r--libqpdf/QPDFPageObjectHelper.cc4
-rw-r--r--libtests/bits.cc3
-rw-r--r--manual/contributing.rst2
-rw-r--r--qpdf/fix-qdf.cc3
-rw-r--r--zlib-flate/zlib-flate.cc7
13 files changed, 25 insertions, 30 deletions
diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc
index 4ec83b84..d3037984 100644
--- a/examples/pdf-invert-images.cc
+++ b/examples/pdf-invert-images.cc
@@ -15,8 +15,7 @@ void
usage()
{
std::cerr << "Usage: " << whoami << " infile.pdf outfile.pdf [in-password]" << std::endl
- << "Invert some images in infile.pdf;"
- << " write output to outfile.pdf" << std::endl;
+ << "Invert some images in infile.pdf; write output to outfile.pdf" << std::endl;
exit(2);
}
diff --git a/examples/pdf-overlay-page.cc b/examples/pdf-overlay-page.cc
index 75577094..97ee8024 100644
--- a/examples/pdf-overlay-page.cc
+++ b/examples/pdf-overlay-page.cc
@@ -16,8 +16,8 @@ void
usage()
{
std::cerr << "Usage: " << whoami << " infile pagefile outfile" << std::endl
- << "Stamp page 1 of pagefile on every page of infile,"
- << " writing to outfile" << std::endl;
+ << "Stamp page 1 of pagefile on every page of infile, writing to outfile"
+ << std::endl;
exit(2);
}
diff --git a/examples/qpdf-job.cc b/examples/qpdf-job.cc
index 99b853ea..3e6e99bd 100644
--- a/examples/qpdf-job.cc
+++ b/examples/qpdf-job.cc
@@ -11,10 +11,10 @@ static void
usage()
{
std::cerr << "Usage: " << whoami << std::endl
- << "This program linearizes the first page of in.pdf to out1.pdf,"
- << " out2.pdf, and" << std::endl
- << " out3.pdf, each demonstrating a different way to use the"
- << " QPDFJob API" << std::endl;
+ << "This program linearizes the first page of in.pdf to out1.pdf, out2.pdf, and"
+ << std::endl
+ << " out3.pdf, each demonstrating a different way to use the QPDFJob API"
+ << std::endl;
exit(2);
}
@@ -43,7 +43,7 @@ main(int argc, char* argv[])
->pageSpec(".", "1")
->endPages()
->linearize()
- ->staticId() // for testing only
+ ->staticId() // for testing only
->compressStreams("n") // avoid dependency on zlib output
->checkConfiguration();
j.run();
diff --git a/examples/qpdfjob-c.c b/examples/qpdfjob-c.c
index 6dd68283..e4f6fdf1 100644
--- a/examples/qpdfjob-c.c
+++ b/examples/qpdfjob-c.c
@@ -42,7 +42,7 @@ main(int argc, char* argv[])
new_argv[1] = infile;
new_argv[2] = outfile;
new_argv[3] = "--linearize";
- new_argv[4] = "--static-id"; /* for testing only */
+ new_argv[4] = "--static-id"; /* for testing only */
new_argv[5] = "--compress-streams=n"; /* avoid dependency on zlib output */
new_argv[6] = NULL;
diff --git a/format-code b/format-code
index 295c5d05..b2e72364 100755
--- a/format-code
+++ b/format-code
@@ -23,7 +23,7 @@
# are improvements, bump the minimum required version of clang-format
# here, and update manual/contributing.rst. There's a comment there
# that refers to this comment. See also .clang-format.
-min_version=16
+min_version=18
clang_version=$(clang-format --version | \
awk '{for (i=1; i<=NF; i++) if ($i == "version") {print int($(i+1)); exit}}')
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 392a153a..0d8b5f91 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -748,7 +748,8 @@ class QPDF
int& O,
bool compressed)
{
- return qpdf.generateHintStream(xref, lengths, obj_renumber, hint_stream, S, O, compressed);
+ return qpdf.generateHintStream(
+ xref, lengths, obj_renumber, hint_stream, S, O, compressed);
}
static void
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index f6badc35..af3db080 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -2423,8 +2423,7 @@ QPDF::pipeStreamData(
file->seek(offset, SEEK_SET);
auto buf = std::make_unique<char[]>(length);
if (auto read = file->read(buf.get(), length); read != length) {
- throw damagedPDF(
- file, "", offset + toO(read), "unexpected EOF reading stream data");
+ throw damagedPDF(file, "", offset + toO(read), "unexpected EOF reading stream data");
}
pipeline->write(buf.get(), length);
attempted_finish = true;
@@ -2463,7 +2462,7 @@ QPDF::pipeStreamData(
// ignore
}
}
- return false ;
+ return false;
}
bool
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 5296b7b3..ad186e13 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -3018,10 +3018,9 @@ QPDFJob::writeOutfile(QPDF& pdf)
try {
QUtil::remove_file(backup.c_str());
} catch (QPDFSystemError& e) {
- *m->log->getError()
- << m->message_prefix << ": unable to delete original file (" << e.what() << ");"
- << " original file left in " << backup
- << ", but the input was successfully replaced\n";
+ *m->log->getError() << m->message_prefix << ": unable to delete original file ("
+ << e.what() << ");" << " original file left in " << backup
+ << ", but the input was successfully replaced\n";
}
}
}
diff --git a/libqpdf/QPDFPageObjectHelper.cc b/libqpdf/QPDFPageObjectHelper.cc
index 54bb5cac..c250db8e 100644
--- a/libqpdf/QPDFPageObjectHelper.cc
+++ b/libqpdf/QPDFPageObjectHelper.cc
@@ -178,8 +178,8 @@ InlineImageTracker::handleToken(QPDFTokenizer::Token const& token)
QPDFObjectHandle dict = convertIIDict(QPDFObjectHandle::parse(dict_str));
dict.replaceKey("/Length", QPDFObjectHandle::newInteger(QIntC::to_longlong(len)));
std::string name = resources.getUniqueResourceName("/IIm", this->min_suffix);
- QPDFObjectHandle image =
- QPDFObjectHandle::newStream(this->qpdf, std::make_shared<Buffer>(std::move(image_data)));
+ QPDFObjectHandle image = QPDFObjectHandle::newStream(
+ this->qpdf, std::make_shared<Buffer>(std::move(image_data)));
image.replaceDict(dict);
resources.getKey("/XObject").replaceKey(name, image);
write(name);
diff --git a/libtests/bits.cc b/libtests/bits.cc
index 96c9ff02..bba1fd40 100644
--- a/libtests/bits.cc
+++ b/libtests/bits.cc
@@ -15,8 +15,7 @@
static void
print_values(long long byte_offset, size_t bit_offset, size_t bits_available)
{
- std::cout << "byte offset = " << byte_offset << ", "
- << "bit offset = " << bit_offset << ", "
+ std::cout << "byte offset = " << byte_offset << ", " << "bit offset = " << bit_offset << ", "
<< "bits available = " << bits_available << std::endl;
}
diff --git a/manual/contributing.rst b/manual/contributing.rst
index e0565872..d54378b0 100644
--- a/manual/contributing.rst
+++ b/manual/contributing.rst
@@ -27,7 +27,7 @@ The qpdf source code is formatted using clang-format with a
:file:`.clang-format` file at the top of the source tree. The
:file:`format-code` script reformats all the source code in the
repository. You must have ``clang-format`` in your path, and it must
-be at least version 16.
+be at least version 18.
For emacs users, the :file:`.dir-locals.el` file configures emacs
``cc-mode`` for an indentation style that is similar to but not
diff --git a/qpdf/fix-qdf.cc b/qpdf/fix-qdf.cc
index 5a399b48..510bb462 100644
--- a/qpdf/fix-qdf.cc
+++ b/qpdf/fix-qdf.cc
@@ -167,8 +167,7 @@ QdfFixer::processLines(std::string const& input)
xref_size = 1 + xref.size();
auto length = xref_size * esize;
std::cout << " /Length " << length << "\n"
- << " /W [ 1 " << xref_f1_nbytes << " " << xref_f2_nbytes << " ]"
- << "\n";
+ << " /W [ 1 " << xref_f1_nbytes << " " << xref_f2_nbytes << " ]\n";
state = st_in_xref_stream_dict;
}
} else if (state == st_in_ostream_dict) {
diff --git a/zlib-flate/zlib-flate.cc b/zlib-flate/zlib-flate.cc
index 1b1743b0..198ef07b 100644
--- a/zlib-flate/zlib-flate.cc
+++ b/zlib-flate/zlib-flate.cc
@@ -15,10 +15,9 @@ void
usage()
{
std::cerr << "Usage: " << whoami << " { -uncompress | -compress[=n] }" << std::endl
- << "If n is specified with -compress, it is a"
- << " zlib compression level from" << std::endl
- << "1 to 9 where lower numbers are faster and"
- << " less compressed and higher" << std::endl
+ << "If n is specified with -compress, it is a zlib compression level from"
+ << std::endl
+ << "1 to 9 where lower numbers are faster and less compressed and higher" << std::endl
<< "numbers are slower and more compressed" << std::endl;
exit(2);
}