From 12f1eb15ca3fed6310402847559a7c99d3c77847 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sat, 2 Apr 2022 17:14:10 -0400 Subject: Programmatically apply new formatting to code Run this: for i in **/*.cc **/*.c **/*.h **/*.hh; do clang-format < $i >| $i.new && mv $i.new $i done --- examples/pdf-split-pages.cc | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'examples/pdf-split-pages.cc') diff --git a/examples/pdf-split-pages.cc b/examples/pdf-split-pages.cc index c79177ee..a8e65260 100644 --- a/examples/pdf-split-pages.cc +++ b/examples/pdf-split-pages.cc @@ -4,22 +4,21 @@ // does. // +#include #include #include #include #include -#include +#include #include #include #include -#include static bool static_id = false; -static void process(char const* whoami, - char const* infile, - std::string outprefix) +static void +process(char const* whoami, char const* infile, std::string outprefix) { QPDF inpdf; inpdf.processFile(infile); @@ -29,8 +28,8 @@ static void process(char const* whoami, QIntC::to_int(QUtil::uint_to_string(pages.size()).length()); int pageno = 0; for (std::vector::iterator iter = pages.begin(); - iter != pages.end(); ++iter) - { + iter != pages.end(); + ++iter) { QPDFPageObjectHelper& page(*iter); std::string outfile = outprefix + QUtil::int_to_string(++pageno, pageno_len) + ".pdf"; @@ -38,8 +37,7 @@ static void process(char const* whoami, outpdf.emptyPDF(); QPDFPageDocumentHelper(outpdf).addPage(page, false); QPDFWriter outpdfw(outpdf, outfile.c_str()); - if (static_id) - { + if (static_id) { // For the test suite, uncompress streams and use static // IDs. outpdfw.setStaticID(true); // for testing only @@ -49,34 +47,31 @@ static void process(char const* whoami, } } -void usage(char const* whoami) +void +usage(char const* whoami) { std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; exit(2); } -int main(int argc, char* argv[]) +int +main(int argc, char* argv[]) { char const* whoami = QUtil::getWhoami(argv[0]); // For test suite - if ((argc > 1) && (strcmp(argv[1], " --static-id") == 0)) - { + if ((argc > 1) && (strcmp(argv[1], " --static-id") == 0)) { static_id = true; --argc; ++argv; } - if (argc != 3) - { + if (argc != 3) { usage(whoami); } - try - { + try { process(whoami, argv[1], argv[2]); - } - catch (std::exception const& e) - { + } catch (std::exception const& e) { std::cerr << whoami << ": exception: " << e.what() << std::endl; return 2; } -- cgit v1.2.3-54-g00ecf