From 6c4537885e89f69b9368251759f75127e6dcc4d6 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 25 Jun 2022 08:29:07 -0400 Subject: [PATCH] Reformat code --- examples/qpdfjob-c-save-attachment.c | 3 +-- libqpdf/QPDFJob.cc | 7 ++++--- libqpdf/QPDFObjectHandle.cc | 2 +- libqpdf/qpdfjob-c.cc | 9 ++++++--- libtests/pl_function.cc | 16 +++++++--------- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/examples/qpdfjob-c-save-attachment.c b/examples/qpdfjob-c-save-attachment.c index 950e297b..6f67e25b 100644 --- a/examples/qpdfjob-c-save-attachment.c +++ b/examples/qpdfjob-c-save-attachment.c @@ -88,8 +88,7 @@ main(int argc, char* argv[]) l, qpdf_log_dest_custom, save_to_file, (void*)outfile, 0); qpdflogger_cleanup(&l); j = qpdfjob_init(); - status = (qpdfjob_initialize_from_argv(j, j_argv) || - qpdfjob_run(j)); + status = (qpdfjob_initialize_from_argv(j, j_argv) || qpdfjob_run(j)); qpdfjob_cleanup(&j); free(attachment_arg); fclose(outfile); diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc index 7227bd1b..c5f0eb2d 100644 --- a/libqpdf/QPDFJob.cc +++ b/libqpdf/QPDFJob.cc @@ -465,7 +465,8 @@ QPDFJob::setOutputStreams(std::ostream* out, std::ostream* err) } void -QPDFJob::registerProgressReporter(std::function handler) { +QPDFJob::registerProgressReporter(std::function handler) +{ this->m->progress_handler = handler; } @@ -1239,8 +1240,8 @@ QPDFJob::doJSONPageLabels(Pipeline* p, bool& first, QPDF& pdf) { JSON j_labels = JSON::makeArray(); QPDFPageLabelDocumentHelper pldh(pdf); - long long npages = QIntC::to_longlong( - QPDFPageDocumentHelper(pdf).getAllPages().size()); + long long npages = + QIntC::to_longlong(QPDFPageDocumentHelper(pdf).getAllPages().size()); if (pldh.hasPageLabels()) { std::vector labels; pldh.getLabelsForPageRange(0, npages - 1, 0, labels); diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc index 62739675..b3f21a27 100644 --- a/libqpdf/QPDFObjectHandle.cc +++ b/libqpdf/QPDFObjectHandle.cc @@ -1552,7 +1552,7 @@ QPDFObjectHandle::getObjGen() const std::string QPDFObjectHandle::getObjGenAsStr() const { - return QUtil::int_to_string(this->objid) + " " + + return QUtil::int_to_string(this->objid) + " " + QUtil::int_to_string(this->generation); } diff --git a/libqpdf/qpdfjob-c.cc b/libqpdf/qpdfjob-c.cc index 4f7bd92c..9367547c 100644 --- a/libqpdf/qpdfjob-c.cc +++ b/libqpdf/qpdfjob-c.cc @@ -85,7 +85,8 @@ qpdfjob_run(qpdfjob_handle j) }); } -static int run_with_handle(std::function fn) +static int +run_with_handle(std::function fn) { auto j = qpdfjob_init(); int status = fn(j); @@ -96,7 +97,8 @@ static int run_with_handle(std::function fn) return status; } -int qpdfjob_run_from_argv(char const* const argv[]) +int +qpdfjob_run_from_argv(char const* const argv[]) { return run_with_handle([argv](qpdfjob_handle j) { return qpdfjob_initialize_from_argv(j, argv); @@ -113,7 +115,8 @@ qpdfjob_run_from_wide_argv(wchar_t const* const argv[]) } #endif /* QPDF_NO_WCHAR_T */ -int qpdfjob_run_from_json(char const* json) +int +qpdfjob_run_from_json(char const* json) { return run_with_handle([json](qpdfjob_handle j) { return qpdfjob_initialize_from_json(j, json); diff --git a/libtests/pl_function.cc b/libtests/pl_function.cc index 960ad5cb..101ec02e 100644 --- a/libtests/pl_function.cc +++ b/libtests/pl_function.cc @@ -1,26 +1,24 @@ #include +#include #include #include -#include #include int main(int argc, char* argv[]) { - Pl_Function p1( - "p1", nullptr, [](unsigned char const* data, size_t len) { - std::cout << "p1: " << len << ": " << data << std::endl; - }); + Pl_Function p1("p1", nullptr, [](unsigned char const* data, size_t len) { + std::cout << "p1: " << len << ": " << data << std::endl; + }); p1.write(reinterpret_cast("potato"), 6); std::string s; Pl_String ps("string", nullptr, s); Pl_Base64 b("base64", &ps, Pl_Base64::a_encode); - Pl_Function p2( - "p2", &b, [](unsigned char const* data, size_t len) { - std::cout << "p2: " << len << ": " << data << std::endl; - }); + Pl_Function p2("p2", &b, [](unsigned char const* data, size_t len) { + std::cout << "p2: " << len << ": " << data << std::endl; + }); p2.write(reinterpret_cast("salad"), 5); p2.finish(); assert(s == "c2FsYWQ=");