From 92d3cbecd4ea375d8de95bffc0fe8651c698f568 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Thu, 16 Apr 2020 11:43:37 -0400 Subject: Fix warnings reported by -Wshadow=local (fixes #431) --- examples/pdf-invert-images.cc | 6 ++---- examples/pdf-mod-info.cc | 3 +-- examples/pdf-split-pages.cc | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'examples') diff --git a/examples/pdf-invert-images.cc b/examples/pdf-invert-images.cc index 418598c7..3a0afca4 100644 --- a/examples/pdf-invert-images.cc +++ b/examples/pdf-invert-images.cc @@ -160,11 +160,9 @@ int main(int argc, char* argv[]) // Get all images on the page. std::map images = page.getPageImages(); - for (std::map::iterator iter = - images.begin(); - iter != images.end(); ++iter) + for (auto& iter2: images) { - QPDFObjectHandle& image = (*iter).second; + QPDFObjectHandle& image = iter2.second; QPDFObjectHandle image_dict = image.getDict(); QPDFObjectHandle color_space = image_dict.getKey("/ColorSpace"); diff --git a/examples/pdf-mod-info.cc b/examples/pdf-mod-info.cc index 0585e9fd..9ffd4ede 100644 --- a/examples/pdf-mod-info.cc +++ b/examples/pdf-mod-info.cc @@ -46,8 +46,7 @@ void dumpInfoDict(QPDF& pdf, { QPDFObjectHandle elt = info.getKey(*it); std::string val; - if (false) {} - else if (elt.isString()) + if (elt.isString()) { val = elt.getStringValue(); } diff --git a/examples/pdf-split-pages.cc b/examples/pdf-split-pages.cc index f8997bbe..ea1c92bc 100644 --- a/examples/pdf-split-pages.cc +++ b/examples/pdf-split-pages.cc @@ -15,7 +15,6 @@ #include #include -static char const* whoami = 0; static bool static_id = false; static void process(char const* whoami, @@ -50,7 +49,7 @@ static void process(char const* whoami, } } -void usage() +void usage(char const* whoami) { std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; exit(2); @@ -58,7 +57,7 @@ void usage() int main(int argc, char* argv[]) { - whoami = QUtil::getWhoami(argv[0]); + char const* whoami = QUtil::getWhoami(argv[0]); // For libtool's sake.... if (strncmp(whoami, "lt-", 3) == 0) @@ -75,7 +74,7 @@ int main(int argc, char* argv[]) if (argc != 3) { - usage(); + usage(whoami); } try { -- cgit v1.2.3-54-g00ecf