From cb769c62e55599e9f980001830bc61d9fcaa64a9 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 8 Feb 2022 09:18:08 -0500 Subject: WHITESPACE ONLY -- expand tabs in source code This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon. --- examples/pdf-double-page-size.cc | 82 ++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'examples/pdf-double-page-size.cc') diff --git a/examples/pdf-double-page-size.cc b/examples/pdf-double-page-size.cc index 6c5e5913..c14b3dc5 100644 --- a/examples/pdf-double-page-size.cc +++ b/examples/pdf-double-page-size.cc @@ -13,9 +13,9 @@ static char const* whoami = 0; void usage() { std::cerr << "Usage: " << whoami << " infile.pdf outfile.pdf [in-password]" - << std::endl - << "Double size of all pages in infile.pdf;" - << " write output to outfile.pdf" << std::endl; + << std::endl + << "Double size of all pages in infile.pdf;" + << " write output to outfile.pdf" << std::endl; exit(2); } @@ -26,18 +26,18 @@ static void doubleBoxSize(QPDFObjectHandle& page, char const* box_name) QPDFObjectHandle box = page.getKey(box_name); if (box.isNull()) { - return; + return; } if (! (box.isArray() && (box.getArrayNItems() == 4))) { - throw std::runtime_error(std::string("box ") + box_name + - " is not an array of four elements"); + throw std::runtime_error(std::string("box ") + box_name + + " is not an array of four elements"); } std::vector doubled; for (int i = 0; i < 4; ++i) { - doubled.push_back( - QPDFObjectHandle::newReal( + doubled.push_back( + QPDFObjectHandle::newReal( box.getArrayItem(i).getNumericValue() * 2.0, 2)); } page.replaceKey(box_name, QPDFObjectHandle::newArray(doubled)); @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) // For libtool's sake.... if (strncmp(whoami, "lt-", 3) == 0) { - whoami += 3; + whoami += 3; } // For test suite @@ -64,7 +64,7 @@ int main(int argc, char* argv[]) if (! ((argc == 3) || (argc == 4))) { - usage(); + usage(); } char const* infilename = argv[1]; @@ -76,48 +76,48 @@ int main(int argc, char* argv[]) try { - QPDF qpdf; - qpdf.processFile(infilename, password); + QPDF qpdf; + qpdf.processFile(infilename, password); - std::vector pages = + std::vector pages = QPDFPageDocumentHelper(qpdf).getAllPages(); - for (std::vector::iterator iter = + for (std::vector::iterator iter = pages.begin(); - iter != pages.end(); ++iter) - { + iter != pages.end(); ++iter) + { QPDFPageObjectHelper& ph(*iter); - QPDFObjectHandle page = ph.getObjectHandle(); + QPDFObjectHandle page = ph.getObjectHandle(); - // Prepend the buffer to the page's contents - ph.addPageContents( + // Prepend the buffer to the page's contents + ph.addPageContents( QPDFObjectHandle::newStream(&qpdf, content), true); - // Double the size of each of the content boxes - doubleBoxSize(page, "/MediaBox"); - doubleBoxSize(page, "/CropBox"); - doubleBoxSize(page, "/BleedBox"); - doubleBoxSize(page, "/TrimBox"); - doubleBoxSize(page, "/ArtBox"); - } + // Double the size of each of the content boxes + doubleBoxSize(page, "/MediaBox"); + doubleBoxSize(page, "/CropBox"); + doubleBoxSize(page, "/BleedBox"); + doubleBoxSize(page, "/TrimBox"); + doubleBoxSize(page, "/ArtBox"); + } - // Write out a new file - QPDFWriter w(qpdf, outfilename); - if (static_id) - { - // For the test suite, uncompress streams and use static - // IDs. - w.setStaticID(true); // for testing only - w.setStreamDataMode(qpdf_s_uncompress); - } - w.write(); - std::cout << whoami << ": new file written to " << outfilename - << std::endl; + // Write out a new file + QPDFWriter w(qpdf, outfilename); + if (static_id) + { + // For the test suite, uncompress streams and use static + // IDs. + w.setStaticID(true); // for testing only + w.setStreamDataMode(qpdf_s_uncompress); + } + w.write(); + std::cout << whoami << ": new file written to " << outfilename + << std::endl; } catch (std::exception &e) { - std::cerr << whoami << " processing file " << infilename << ": " - << e.what() << std::endl; - exit(2); + std::cerr << whoami << " processing file " << infilename << ": " + << e.what() << std::endl; + exit(2); } return 0; -- cgit v1.2.3-54-g00ecf