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-bookmarks.cc | 144 +++++++++++++++++++++++----------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'examples/pdf-bookmarks.cc') diff --git a/examples/pdf-bookmarks.cc b/examples/pdf-bookmarks.cc index d4501728..e343c541 100644 --- a/examples/pdf-bookmarks.cc +++ b/examples/pdf-bookmarks.cc @@ -20,16 +20,16 @@ static std::map page_map; void usage() { std::cerr << "Usage: " << whoami << " [options] file.pdf [password]" - << std::endl - << "Options:" << std::endl - << " --numbers give bookmarks outline-style numbers" - << std::endl - << " --lines draw lines to show bookmark hierarchy" - << std::endl - << " --show-open indicate whether a bookmark is initially open" - << std::endl - << " --show-targets show target if possible" - << std::endl; + << std::endl + << "Options:" << std::endl + << " --numbers give bookmarks outline-style numbers" + << std::endl + << " --lines draw lines to show bookmark hierarchy" + << std::endl + << " --show-open indicate whether a bookmark is initially open" + << std::endl + << " --show-targets show target if possible" + << std::endl; exit(2); } @@ -37,14 +37,14 @@ void print_lines(std::vector& numbers) { for (unsigned int i = 0; i < numbers.size() - 1; ++i) { - if (numbers.at(i)) - { - std::cout << "| "; - } - else - { - std::cout << " "; - } + if (numbers.at(i)) + { + std::cout << "| "; + } + else + { + std::cout << " "; + } } } @@ -54,10 +54,10 @@ void generate_page_map(QPDF& qpdf) std::vector pages = dh.getAllPages(); int n = 0; for (std::vector::iterator iter = pages.begin(); - iter != pages.end(); ++iter) + iter != pages.end(); ++iter) { - QPDFObjectHandle oh = (*iter).getObjectHandle(); - page_map[oh.getObjGen()] = ++n; + QPDFObjectHandle oh = (*iter).getObjectHandle(); + page_map[oh.getObjGen()] = ++n; } } @@ -163,50 +163,50 @@ int main(int argc, char* argv[]) // For libtool's sake.... if (strncmp(whoami, "lt-", 3) == 0) { - whoami += 3; + whoami += 3; } if ((argc == 2) && (strcmp(argv[1], "--version") == 0)) { - std::cout << whoami << " version 1.5" << std::endl; - exit(0); + std::cout << whoami << " version 1.5" << std::endl; + exit(0); } int arg; for (arg = 1; arg < argc; ++arg) { - if (argv[arg][0] == '-') - { - if (strcmp(argv[arg], "--numbers") == 0) - { - style = st_numbers; - } - else if (strcmp(argv[arg], "--lines") == 0) - { - style = st_lines; - } - else if (strcmp(argv[arg], "--show-open") == 0) - { - show_open = true; - } - else if (strcmp(argv[arg], "--show-targets") == 0) - { - show_targets = true; - } - else - { - usage(); - } - } - else - { - break; - } + if (argv[arg][0] == '-') + { + if (strcmp(argv[arg], "--numbers") == 0) + { + style = st_numbers; + } + else if (strcmp(argv[arg], "--lines") == 0) + { + style = st_lines; + } + else if (strcmp(argv[arg], "--show-open") == 0) + { + show_open = true; + } + else if (strcmp(argv[arg], "--show-targets") == 0) + { + show_targets = true; + } + else + { + usage(); + } + } + else + { + break; + } } if (arg >= argc) { - usage(); + usage(); } char const* filename = argv[arg++]; @@ -214,38 +214,38 @@ int main(int argc, char* argv[]) if (arg < argc) { - password = argv[arg++]; + password = argv[arg++]; } if (arg != argc) { - usage(); + usage(); } try { - QPDF qpdf; - qpdf.processFile(filename, password); + QPDF qpdf; + qpdf.processFile(filename, password); QPDFOutlineDocumentHelper odh(qpdf); - if (odh.hasOutlines()) - { - std::vector numbers; - if (show_targets) - { - generate_page_map(qpdf); - } - extract_bookmarks(odh.getTopLevelOutlines(), numbers); - } - else - { - std::cout << filename << " has no bookmarks" << std::endl; - } + if (odh.hasOutlines()) + { + std::vector numbers; + if (show_targets) + { + generate_page_map(qpdf); + } + extract_bookmarks(odh.getTopLevelOutlines(), numbers); + } + else + { + std::cout << filename << " has no bookmarks" << std::endl; + } } catch (std::exception &e) { - std::cerr << whoami << " processing file " << filename << ": " - << e.what() << std::endl; - exit(2); + std::cerr << whoami << " processing file " << filename << ": " + << e.what() << std::endl; + exit(2); } return 0; -- cgit v1.2.3-70-g09d2