Commit 92d3cbecd4ea375d8de95bffc0fe8651c698f568
1 parent
66198f44
Fix warnings reported by -Wshadow=local (fixes #431)
Showing
14 changed files
with
98 additions
and
114 deletions
examples/pdf-invert-images.cc
| @@ -160,11 +160,9 @@ int main(int argc, char* argv[]) | @@ -160,11 +160,9 @@ int main(int argc, char* argv[]) | ||
| 160 | // Get all images on the page. | 160 | // Get all images on the page. |
| 161 | std::map<std::string, QPDFObjectHandle> images = | 161 | std::map<std::string, QPDFObjectHandle> images = |
| 162 | page.getPageImages(); | 162 | page.getPageImages(); |
| 163 | - for (std::map<std::string, QPDFObjectHandle>::iterator iter = | ||
| 164 | - images.begin(); | ||
| 165 | - iter != images.end(); ++iter) | 163 | + for (auto& iter2: images) |
| 166 | { | 164 | { |
| 167 | - QPDFObjectHandle& image = (*iter).second; | 165 | + QPDFObjectHandle& image = iter2.second; |
| 168 | QPDFObjectHandle image_dict = image.getDict(); | 166 | QPDFObjectHandle image_dict = image.getDict(); |
| 169 | QPDFObjectHandle color_space = | 167 | QPDFObjectHandle color_space = |
| 170 | image_dict.getKey("/ColorSpace"); | 168 | image_dict.getKey("/ColorSpace"); |
examples/pdf-mod-info.cc
| @@ -46,8 +46,7 @@ void dumpInfoDict(QPDF& pdf, | @@ -46,8 +46,7 @@ void dumpInfoDict(QPDF& pdf, | ||
| 46 | { | 46 | { |
| 47 | QPDFObjectHandle elt = info.getKey(*it); | 47 | QPDFObjectHandle elt = info.getKey(*it); |
| 48 | std::string val; | 48 | std::string val; |
| 49 | - if (false) {} | ||
| 50 | - else if (elt.isString()) | 49 | + if (elt.isString()) |
| 51 | { | 50 | { |
| 52 | val = elt.getStringValue(); | 51 | val = elt.getStringValue(); |
| 53 | } | 52 | } |
examples/pdf-split-pages.cc
| @@ -15,7 +15,6 @@ | @@ -15,7 +15,6 @@ | ||
| 15 | #include <string> | 15 | #include <string> |
| 16 | #include <cstring> | 16 | #include <cstring> |
| 17 | 17 | ||
| 18 | -static char const* whoami = 0; | ||
| 19 | static bool static_id = false; | 18 | static bool static_id = false; |
| 20 | 19 | ||
| 21 | static void process(char const* whoami, | 20 | static void process(char const* whoami, |
| @@ -50,7 +49,7 @@ static void process(char const* whoami, | @@ -50,7 +49,7 @@ static void process(char const* whoami, | ||
| 50 | } | 49 | } |
| 51 | } | 50 | } |
| 52 | 51 | ||
| 53 | -void usage() | 52 | +void usage(char const* whoami) |
| 54 | { | 53 | { |
| 55 | std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; | 54 | std::cerr << "Usage: " << whoami << " infile outprefix" << std::endl; |
| 56 | exit(2); | 55 | exit(2); |
| @@ -58,7 +57,7 @@ void usage() | @@ -58,7 +57,7 @@ void usage() | ||
| 58 | 57 | ||
| 59 | int main(int argc, char* argv[]) | 58 | int main(int argc, char* argv[]) |
| 60 | { | 59 | { |
| 61 | - whoami = QUtil::getWhoami(argv[0]); | 60 | + char const* whoami = QUtil::getWhoami(argv[0]); |
| 62 | 61 | ||
| 63 | // For libtool's sake.... | 62 | // For libtool's sake.... |
| 64 | if (strncmp(whoami, "lt-", 3) == 0) | 63 | if (strncmp(whoami, "lt-", 3) == 0) |
| @@ -75,7 +74,7 @@ int main(int argc, char* argv[]) | @@ -75,7 +74,7 @@ int main(int argc, char* argv[]) | ||
| 75 | 74 | ||
| 76 | if (argc != 3) | 75 | if (argc != 3) |
| 77 | { | 76 | { |
| 78 | - usage(); | 77 | + usage(whoami); |
| 79 | } | 78 | } |
| 80 | try | 79 | try |
| 81 | { | 80 | { |
libqpdf/Pl_DCT.cc
| @@ -302,8 +302,9 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) | @@ -302,8 +302,9 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b) | ||
| 302 | unsigned int width = cinfo->image_width * | 302 | unsigned int width = cinfo->image_width * |
| 303 | QIntC::to_uint(cinfo->input_components); | 303 | QIntC::to_uint(cinfo->input_components); |
| 304 | size_t expected_size = | 304 | size_t expected_size = |
| 305 | - cinfo->image_height * cinfo->image_width * | ||
| 306 | - QIntC::to_uint(cinfo->input_components); | 305 | + QIntC::to_size(cinfo->image_height) * |
| 306 | + QIntC::to_size(cinfo->image_width) * | ||
| 307 | + QIntC::to_size(cinfo->input_components); | ||
| 307 | if (b->getSize() != expected_size) | 308 | if (b->getSize() != expected_size) |
| 308 | { | 309 | { |
| 309 | throw std::runtime_error( | 310 | throw std::runtime_error( |
libqpdf/QPDFObjectHandle.cc
| @@ -1607,12 +1607,12 @@ QPDFObjectHandle::pipeContentStreams( | @@ -1607,12 +1607,12 @@ QPDFObjectHandle::pipeContentStreams( | ||
| 1607 | std::string og = | 1607 | std::string og = |
| 1608 | QUtil::int_to_string(stream.getObjectID()) + " " + | 1608 | QUtil::int_to_string(stream.getObjectID()) + " " + |
| 1609 | QUtil::int_to_string(stream.getGeneration()); | 1609 | QUtil::int_to_string(stream.getGeneration()); |
| 1610 | - std::string description = "content stream object " + og; | 1610 | + std::string w_description = "content stream object " + og; |
| 1611 | if (! stream.pipeStreamData(p, 0, qpdf_dl_specialized)) | 1611 | if (! stream.pipeStreamData(p, 0, qpdf_dl_specialized)) |
| 1612 | { | 1612 | { |
| 1613 | QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent"); | 1613 | QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent"); |
| 1614 | throw QPDFExc(qpdf_e_damaged_pdf, "content stream", | 1614 | throw QPDFExc(qpdf_e_damaged_pdf, "content stream", |
| 1615 | - description, 0, | 1615 | + w_description, 0, |
| 1616 | "errors while decoding content stream"); | 1616 | "errors while decoding content stream"); |
| 1617 | } | 1617 | } |
| 1618 | } | 1618 | } |
| @@ -1685,13 +1685,13 @@ QPDFObjectHandle::parseContentStream_data( | @@ -1685,13 +1685,13 @@ QPDFObjectHandle::parseContentStream_data( | ||
| 1685 | ParserCallbacks* callbacks, | 1685 | ParserCallbacks* callbacks, |
| 1686 | QPDF* context) | 1686 | QPDF* context) |
| 1687 | { | 1687 | { |
| 1688 | - size_t length = stream_data->getSize(); | 1688 | + size_t stream_length = stream_data->getSize(); |
| 1689 | PointerHolder<InputSource> input = | 1689 | PointerHolder<InputSource> input = |
| 1690 | new BufferInputSource(description, stream_data.getPointer()); | 1690 | new BufferInputSource(description, stream_data.getPointer()); |
| 1691 | QPDFTokenizer tokenizer; | 1691 | QPDFTokenizer tokenizer; |
| 1692 | tokenizer.allowEOF(); | 1692 | tokenizer.allowEOF(); |
| 1693 | bool empty = false; | 1693 | bool empty = false; |
| 1694 | - while (QIntC::to_size(input->tell()) < length) | 1694 | + while (QIntC::to_size(input->tell()) < stream_length) |
| 1695 | { | 1695 | { |
| 1696 | // Read a token and seek to the beginning. The offset we get | 1696 | // Read a token and seek to the beginning. The offset we get |
| 1697 | // from this process is the beginning of the next | 1697 | // from this process is the beginning of the next |
libqpdf/QPDFPageObjectHelper.cc
| @@ -76,10 +76,8 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | @@ -76,10 +76,8 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | ||
| 76 | dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject")); | 76 | dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject")); |
| 77 | dict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Image")); | 77 | dict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Image")); |
| 78 | std::set<std::string> keys = odict.getKeys(); | 78 | std::set<std::string> keys = odict.getKeys(); |
| 79 | - for (std::set<std::string>::iterator iter = keys.begin(); | ||
| 80 | - iter != keys.end(); ++iter) | 79 | + for (auto key: keys) |
| 81 | { | 80 | { |
| 82 | - std::string key = *iter; | ||
| 83 | QPDFObjectHandle value = odict.getKey(key); | 81 | QPDFObjectHandle value = odict.getKey(key); |
| 84 | if (key == "/BPC") | 82 | if (key == "/BPC") |
| 85 | { | 83 | { |
| @@ -176,14 +174,12 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | @@ -176,14 +174,12 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | ||
| 176 | { | 174 | { |
| 177 | filters = value.getArrayAsVector(); | 175 | filters = value.getArrayAsVector(); |
| 178 | } | 176 | } |
| 179 | - for (std::vector<QPDFObjectHandle>::iterator iter = | ||
| 180 | - filters.begin(); | ||
| 181 | - iter != filters.end(); ++iter) | 177 | + for (auto& iter: filters) |
| 182 | { | 178 | { |
| 183 | std::string name; | 179 | std::string name; |
| 184 | - if ((*iter).isName()) | 180 | + if (iter.isName()) |
| 185 | { | 181 | { |
| 186 | - name = (*iter).getName(); | 182 | + name = iter.getName(); |
| 187 | } | 183 | } |
| 188 | if (name == "/AHx") | 184 | if (name == "/AHx") |
| 189 | { | 185 | { |
| @@ -219,7 +215,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | @@ -219,7 +215,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict) | ||
| 219 | } | 215 | } |
| 220 | if (! name.empty()) | 216 | if (! name.empty()) |
| 221 | { | 217 | { |
| 222 | - *iter = QPDFObjectHandle::newName(name); | 218 | + iter = QPDFObjectHandle::newName(name); |
| 223 | } | 219 | } |
| 224 | } | 220 | } |
| 225 | if (value.isName() && (filters.size() == 1)) | 221 | if (value.isName() && (filters.size() == 1)) |
libqpdf/QPDFTokenizer.cc
| @@ -175,8 +175,8 @@ QPDFTokenizer::resolveLiteral() | @@ -175,8 +175,8 @@ QPDFTokenizer::resolveLiteral() | ||
| 175 | num[0] = this->m->val.at(i+1); | 175 | num[0] = this->m->val.at(i+1); |
| 176 | num[1] = this->m->val.at(i+2); | 176 | num[1] = this->m->val.at(i+2); |
| 177 | num[2] = '\0'; | 177 | num[2] = '\0'; |
| 178 | - char ch = static_cast<char>(strtol(num, 0, 16)); | ||
| 179 | - if (ch == '\0') | 178 | + char ch2 = static_cast<char>(strtol(num, 0, 16)); |
| 179 | + if (ch2 == '\0') | ||
| 180 | { | 180 | { |
| 181 | this->m->type = tt_bad; | 181 | this->m->type = tt_bad; |
| 182 | QTC::TC("qpdf", "QPDFTokenizer null in name"); | 182 | QTC::TC("qpdf", "QPDFTokenizer null in name"); |
| @@ -186,7 +186,7 @@ QPDFTokenizer::resolveLiteral() | @@ -186,7 +186,7 @@ QPDFTokenizer::resolveLiteral() | ||
| 186 | } | 186 | } |
| 187 | else | 187 | else |
| 188 | { | 188 | { |
| 189 | - nval.append(1, ch); | 189 | + nval.append(1, ch2); |
| 190 | } | 190 | } |
| 191 | i += 2; | 191 | i += 2; |
| 192 | } | 192 | } |
| @@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | @@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | ||
| 719 | for (std::string::iterator iter = value.begin(); | 719 | for (std::string::iterator iter = value.begin(); |
| 720 | iter != value.end(); ++iter) | 720 | iter != value.end(); ++iter) |
| 721 | { | 721 | { |
| 722 | - char ch = *iter; | 722 | + signed char ch = *iter; |
| 723 | if (((ch >= 'a') && (ch <= 'z')) || | 723 | if (((ch >= 'a') && (ch <= 'z')) || |
| 724 | ((ch >= 'A') && (ch <= 'Z')) || | 724 | ((ch >= 'A') && (ch <= 'Z')) || |
| 725 | (ch == '*')) | 725 | (ch == '*')) |
| @@ -729,8 +729,10 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | @@ -729,8 +729,10 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input) | ||
| 729 | // alphabetic characters. | 729 | // alphabetic characters. |
| 730 | found_alpha = true; | 730 | found_alpha = true; |
| 731 | } | 731 | } |
| 732 | - else if (((ch < 32) && (! isSpace(ch))) || (ch > 127)) | 732 | + else if ((ch < 32) && (! isSpace(ch))) |
| 733 | { | 733 | { |
| 734 | + // ch is signed, so characters outside of | ||
| 735 | + // 7-bit will be < 0. | ||
| 734 | found_non_printable = true; | 736 | found_non_printable = true; |
| 735 | break; | 737 | break; |
| 736 | } | 738 | } |
libqpdf/QPDFWriter.cc
| @@ -1790,14 +1790,14 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1790,14 +1790,14 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1790 | } | 1790 | } |
| 1791 | } | 1791 | } |
| 1792 | bool normalize = false; | 1792 | bool normalize = false; |
| 1793 | - bool compress = false; | 1793 | + bool compress_stream = false; |
| 1794 | bool uncompress = false; | 1794 | bool uncompress = false; |
| 1795 | if (is_metadata && | 1795 | if (is_metadata && |
| 1796 | ((! this->m->encrypted) || (this->m->encrypt_metadata == false))) | 1796 | ((! this->m->encrypted) || (this->m->encrypt_metadata == false))) |
| 1797 | { | 1797 | { |
| 1798 | QTC::TC("qpdf", "QPDFWriter not compressing metadata"); | 1798 | QTC::TC("qpdf", "QPDFWriter not compressing metadata"); |
| 1799 | filter = true; | 1799 | filter = true; |
| 1800 | - compress = false; | 1800 | + compress_stream = false; |
| 1801 | uncompress = true; | 1801 | uncompress = true; |
| 1802 | } | 1802 | } |
| 1803 | else if (this->m->normalize_content && | 1803 | else if (this->m->normalize_content && |
| @@ -1808,7 +1808,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1808,7 +1808,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1808 | } | 1808 | } |
| 1809 | else if (filter && this->m->compress_streams) | 1809 | else if (filter && this->m->compress_streams) |
| 1810 | { | 1810 | { |
| 1811 | - compress = true; | 1811 | + compress_stream = true; |
| 1812 | QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream"); | 1812 | QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream"); |
| 1813 | } | 1813 | } |
| 1814 | 1814 | ||
| @@ -1825,7 +1825,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1825,7 +1825,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1825 | object.pipeStreamData( | 1825 | object.pipeStreamData( |
| 1826 | this->m->pipeline, | 1826 | this->m->pipeline, |
| 1827 | (((filter && normalize) ? qpdf_ef_normalize : 0) | | 1827 | (((filter && normalize) ? qpdf_ef_normalize : 0) | |
| 1828 | - ((filter && compress) ? qpdf_ef_compress : 0)), | 1828 | + ((filter && compress_stream) ? qpdf_ef_compress : 0)), |
| 1829 | (filter | 1829 | (filter |
| 1830 | ? (uncompress ? qpdf_dl_all : this->m->stream_decode_level) | 1830 | ? (uncompress ? qpdf_dl_all : this->m->stream_decode_level) |
| 1831 | : qpdf_dl_none), false, (attempt == 1)); | 1831 | : qpdf_dl_none), false, (attempt == 1)); |
| @@ -1845,7 +1845,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1845,7 +1845,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1845 | } | 1845 | } |
| 1846 | else | 1846 | else |
| 1847 | { | 1847 | { |
| 1848 | - compress = false; | 1848 | + compress_stream = false; |
| 1849 | } | 1849 | } |
| 1850 | 1850 | ||
| 1851 | this->m->cur_stream_length = stream_data->getSize(); | 1851 | this->m->cur_stream_length = stream_data->getSize(); |
| @@ -1856,7 +1856,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | @@ -1856,7 +1856,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level, | ||
| 1856 | } | 1856 | } |
| 1857 | adjustAESStreamLength(this->m->cur_stream_length); | 1857 | adjustAESStreamLength(this->m->cur_stream_length); |
| 1858 | unparseObject(stream_dict, 0, flags, | 1858 | unparseObject(stream_dict, 0, flags, |
| 1859 | - this->m->cur_stream_length, compress); | 1859 | + this->m->cur_stream_length, compress_stream); |
| 1860 | unsigned char last_char = '\0'; | 1860 | unsigned char last_char = '\0'; |
| 1861 | writeString("\nstream\n"); | 1861 | writeString("\nstream\n"); |
| 1862 | { | 1862 | { |
| @@ -2330,11 +2330,10 @@ QPDFWriter::initializeSpecialStreams() | @@ -2330,11 +2330,10 @@ QPDFWriter::initializeSpecialStreams() | ||
| 2330 | contents_objects.push_back(contents.getObjGen()); | 2330 | contents_objects.push_back(contents.getObjGen()); |
| 2331 | } | 2331 | } |
| 2332 | 2332 | ||
| 2333 | - for (std::vector<QPDFObjGen>::iterator iter = contents_objects.begin(); | ||
| 2334 | - iter != contents_objects.end(); ++iter) | 2333 | + for (auto const& c: contents_objects) |
| 2335 | { | 2334 | { |
| 2336 | - this->m->contents_to_page_seq[*iter] = num; | ||
| 2337 | - this->m->normalized_streams.insert(*iter); | 2335 | + this->m->contents_to_page_seq[c] = num; |
| 2336 | + this->m->normalized_streams.insert(c); | ||
| 2338 | } | 2337 | } |
| 2339 | } | 2338 | } |
| 2340 | } | 2339 | } |
| @@ -3462,9 +3461,9 @@ QPDFWriter::writeLinearized() | @@ -3462,9 +3461,9 @@ QPDFWriter::writeLinearized() | ||
| 3462 | else | 3461 | else |
| 3463 | { | 3462 | { |
| 3464 | // Make the file size the same. | 3463 | // Make the file size the same. |
| 3465 | - qpdf_offset_t pos = this->m->pipeline->getCount(); | ||
| 3466 | writePad( | 3464 | writePad( |
| 3467 | - QIntC::to_int(second_xref_end + hint_length - 1 - pos)); | 3465 | + QIntC::to_int(second_xref_end + hint_length - |
| 3466 | + 1 - this->m->pipeline->getCount())); | ||
| 3468 | writeString("\n"); | 3467 | writeString("\n"); |
| 3469 | 3468 | ||
| 3470 | // If this assertion fails, maybe we didn't have | 3469 | // If this assertion fails, maybe we didn't have |
| @@ -3507,7 +3506,7 @@ QPDFWriter::writeLinearized() | @@ -3507,7 +3506,7 @@ QPDFWriter::writeLinearized() | ||
| 3507 | 3506 | ||
| 3508 | // Save hint offset since it will be set to zero by | 3507 | // Save hint offset since it will be set to zero by |
| 3509 | // calling openObject. | 3508 | // calling openObject. |
| 3510 | - qpdf_offset_t hint_offset = this->m->xref[hint_id].getOffset(); | 3509 | + qpdf_offset_t hint_offset1 = this->m->xref[hint_id].getOffset(); |
| 3511 | 3510 | ||
| 3512 | // Write hint stream to a buffer | 3511 | // Write hint stream to a buffer |
| 3513 | { | 3512 | { |
| @@ -3519,12 +3518,12 @@ QPDFWriter::writeLinearized() | @@ -3519,12 +3518,12 @@ QPDFWriter::writeLinearized() | ||
| 3519 | hint_length = QIntC::to_offset(hint_buffer->getSize()); | 3518 | hint_length = QIntC::to_offset(hint_buffer->getSize()); |
| 3520 | 3519 | ||
| 3521 | // Restore hint offset | 3520 | // Restore hint offset |
| 3522 | - this->m->xref[hint_id] = QPDFXRefEntry(1, hint_offset, 0); | 3521 | + this->m->xref[hint_id] = QPDFXRefEntry(1, hint_offset1, 0); |
| 3523 | if (lin_pass1_file) | 3522 | if (lin_pass1_file) |
| 3524 | { | 3523 | { |
| 3525 | // Write some debugging information | 3524 | // Write some debugging information |
| 3526 | fprintf(lin_pass1_file, "%% hint_offset=%s\n", | 3525 | fprintf(lin_pass1_file, "%% hint_offset=%s\n", |
| 3527 | - QUtil::int_to_string(hint_offset).c_str()); | 3526 | + QUtil::int_to_string(hint_offset1).c_str()); |
| 3528 | fprintf(lin_pass1_file, "%% hint_length=%s\n", | 3527 | fprintf(lin_pass1_file, "%% hint_length=%s\n", |
| 3529 | QUtil::int_to_string(hint_length).c_str()); | 3528 | QUtil::int_to_string(hint_length).c_str()); |
| 3530 | fprintf(lin_pass1_file, "%% second_xref_offset=%s\n", | 3529 | fprintf(lin_pass1_file, "%% second_xref_offset=%s\n", |
libqpdf/QPDF_Stream.cc
| @@ -555,12 +555,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, | @@ -555,12 +555,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, | ||
| 555 | to_delete.push_back(pipeline); | 555 | to_delete.push_back(pipeline); |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | - for (std::vector<std::string>::reverse_iterator iter = filters.rbegin(); | ||
| 559 | - iter != filters.rend(); ++iter) | 558 | + for (std::vector<std::string>::reverse_iterator f_iter = |
| 559 | + filters.rbegin(); | ||
| 560 | + f_iter != filters.rend(); ++f_iter) | ||
| 560 | { | 561 | { |
| 561 | - std::string const& filter = *iter; | 562 | + std::string const& filter_name = *f_iter; |
| 562 | 563 | ||
| 563 | - if ((filter == "/FlateDecode") || (filter == "/LZWDecode")) | 564 | + if ((filter_name == "/FlateDecode") || |
| 565 | + (filter_name == "/LZWDecode")) | ||
| 564 | { | 566 | { |
| 565 | if ((predictor >= 10) && (predictor <= 15)) | 567 | if ((predictor >= 10) && (predictor <= 15)) |
| 566 | { | 568 | { |
| @@ -584,39 +586,39 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, | @@ -584,39 +586,39 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp, | ||
| 584 | } | 586 | } |
| 585 | } | 587 | } |
| 586 | 588 | ||
| 587 | - if (filter == "/Crypt") | 589 | + if (filter_name == "/Crypt") |
| 588 | { | 590 | { |
| 589 | // Ignore -- handled by pipeStreamData | 591 | // Ignore -- handled by pipeStreamData |
| 590 | } | 592 | } |
| 591 | - else if (filter == "/FlateDecode") | 593 | + else if (filter_name == "/FlateDecode") |
| 592 | { | 594 | { |
| 593 | pipeline = new Pl_Flate("stream inflate", | 595 | pipeline = new Pl_Flate("stream inflate", |
| 594 | pipeline, Pl_Flate::a_inflate); | 596 | pipeline, Pl_Flate::a_inflate); |
| 595 | to_delete.push_back(pipeline); | 597 | to_delete.push_back(pipeline); |
| 596 | } | 598 | } |
| 597 | - else if (filter == "/ASCII85Decode") | 599 | + else if (filter_name == "/ASCII85Decode") |
| 598 | { | 600 | { |
| 599 | pipeline = new Pl_ASCII85Decoder("ascii85 decode", pipeline); | 601 | pipeline = new Pl_ASCII85Decoder("ascii85 decode", pipeline); |
| 600 | to_delete.push_back(pipeline); | 602 | to_delete.push_back(pipeline); |
| 601 | } | 603 | } |
| 602 | - else if (filter == "/ASCIIHexDecode") | 604 | + else if (filter_name == "/ASCIIHexDecode") |
| 603 | { | 605 | { |
| 604 | pipeline = new Pl_ASCIIHexDecoder("asciiHex decode", pipeline); | 606 | pipeline = new Pl_ASCIIHexDecoder("asciiHex decode", pipeline); |
| 605 | to_delete.push_back(pipeline); | 607 | to_delete.push_back(pipeline); |
| 606 | } | 608 | } |
| 607 | - else if (filter == "/LZWDecode") | 609 | + else if (filter_name == "/LZWDecode") |
| 608 | { | 610 | { |
| 609 | pipeline = new Pl_LZWDecoder("lzw decode", pipeline, | 611 | pipeline = new Pl_LZWDecoder("lzw decode", pipeline, |
| 610 | early_code_change); | 612 | early_code_change); |
| 611 | to_delete.push_back(pipeline); | 613 | to_delete.push_back(pipeline); |
| 612 | } | 614 | } |
| 613 | - else if (filter == "/RunLengthDecode") | 615 | + else if (filter_name == "/RunLengthDecode") |
| 614 | { | 616 | { |
| 615 | pipeline = new Pl_RunLength("runlength decode", pipeline, | 617 | pipeline = new Pl_RunLength("runlength decode", pipeline, |
| 616 | Pl_RunLength::a_decode); | 618 | Pl_RunLength::a_decode); |
| 617 | to_delete.push_back(pipeline); | 619 | to_delete.push_back(pipeline); |
| 618 | } | 620 | } |
| 619 | - else if (filter == "/DCTDecode") | 621 | + else if (filter_name == "/DCTDecode") |
| 620 | { | 622 | { |
| 621 | pipeline = new Pl_DCT("DCT decode", pipeline); | 623 | pipeline = new Pl_DCT("DCT decode", pipeline); |
| 622 | to_delete.push_back(pipeline); | 624 | to_delete.push_back(pipeline); |
libqpdf/QPDF_encryption.cc
| @@ -322,10 +322,10 @@ hash_V5(std::string const& password, | @@ -322,10 +322,10 @@ hash_V5(std::string const& password, | ||
| 322 | int next_hash = ((E_mod_3 == 0) ? 256 : | 322 | int next_hash = ((E_mod_3 == 0) ? 256 : |
| 323 | (E_mod_3 == 1) ? 384 : | 323 | (E_mod_3 == 1) ? 384 : |
| 324 | 512); | 324 | 512); |
| 325 | - Pl_SHA2 hash(next_hash); | ||
| 326 | - hash.write(QUtil::unsigned_char_pointer(E), E.length()); | ||
| 327 | - hash.finish(); | ||
| 328 | - K = hash.getRawDigest(); | 325 | + Pl_SHA2 sha2(next_hash); |
| 326 | + sha2.write(QUtil::unsigned_char_pointer(E), E.length()); | ||
| 327 | + sha2.finish(); | ||
| 328 | + K = sha2.getRawDigest(); | ||
| 329 | 329 | ||
| 330 | if (round_number >= 64) | 330 | if (round_number >= 64) |
| 331 | { | 331 | { |
libqpdf/QPDF_linearization.cc
| @@ -374,9 +374,9 @@ QPDF::readHintStream(Pipeline& pl, qpdf_offset_t offset, size_t length) | @@ -374,9 +374,9 @@ QPDF::readHintStream(Pipeline& pl, qpdf_offset_t offset, size_t length) | ||
| 374 | QTC::TC("qpdf", "QPDF hint table length indirect"); | 374 | QTC::TC("qpdf", "QPDF hint table length indirect"); |
| 375 | // Force resolution | 375 | // Force resolution |
| 376 | (void) length_obj.getIntValue(); | 376 | (void) length_obj.getIntValue(); |
| 377 | - ObjCache& oc = this->m->obj_cache[length_obj.getObjGen()]; | ||
| 378 | - min_end_offset = oc.end_before_space; | ||
| 379 | - max_end_offset = oc.end_after_space; | 377 | + ObjCache& oc2 = this->m->obj_cache[length_obj.getObjGen()]; |
| 378 | + min_end_offset = oc2.end_before_space; | ||
| 379 | + max_end_offset = oc2.end_after_space; | ||
| 380 | } | 380 | } |
| 381 | else | 381 | else |
| 382 | { | 382 | { |
libqpdf/QUtil.cc
| @@ -812,7 +812,7 @@ QUtil::toUTF8(unsigned long uval) | @@ -812,7 +812,7 @@ QUtil::toUTF8(unsigned long uval) | ||
| 812 | // maximum value that will fit in the current number of bytes | 812 | // maximum value that will fit in the current number of bytes |
| 813 | unsigned char maxval = 0x3f; // six bits | 813 | unsigned char maxval = 0x3f; // six bits |
| 814 | 814 | ||
| 815 | - while (uval > maxval) | 815 | + while (uval > QIntC::to_ulong(maxval)) |
| 816 | { | 816 | { |
| 817 | // Assign low six bits plus 10000000 to lowest unused | 817 | // Assign low six bits plus 10000000 to lowest unused |
| 818 | // byte position, then shift | 818 | // byte position, then shift |
| @@ -2163,12 +2163,12 @@ QUtil::win_ansi_to_utf8(std::string const& val) | @@ -2163,12 +2163,12 @@ QUtil::win_ansi_to_utf8(std::string const& val) | ||
| 2163 | for (unsigned int i = 0; i < len; ++i) | 2163 | for (unsigned int i = 0; i < len; ++i) |
| 2164 | { | 2164 | { |
| 2165 | unsigned char ch = static_cast<unsigned char>(val.at(i)); | 2165 | unsigned char ch = static_cast<unsigned char>(val.at(i)); |
| 2166 | - unsigned short val = ch; | 2166 | + unsigned short ch_short = ch; |
| 2167 | if ((ch >= 128) && (ch <= 160)) | 2167 | if ((ch >= 128) && (ch <= 160)) |
| 2168 | { | 2168 | { |
| 2169 | - val = win_ansi_to_unicode[ch - 128]; | 2169 | + ch_short = win_ansi_to_unicode[ch - 128]; |
| 2170 | } | 2170 | } |
| 2171 | - result += QUtil::toUTF8(val); | 2171 | + result += QUtil::toUTF8(ch_short); |
| 2172 | } | 2172 | } |
| 2173 | return result; | 2173 | return result; |
| 2174 | } | 2174 | } |
| @@ -2181,12 +2181,12 @@ QUtil::mac_roman_to_utf8(std::string const& val) | @@ -2181,12 +2181,12 @@ QUtil::mac_roman_to_utf8(std::string const& val) | ||
| 2181 | for (unsigned int i = 0; i < len; ++i) | 2181 | for (unsigned int i = 0; i < len; ++i) |
| 2182 | { | 2182 | { |
| 2183 | unsigned char ch = static_cast<unsigned char>(val.at(i)); | 2183 | unsigned char ch = static_cast<unsigned char>(val.at(i)); |
| 2184 | - unsigned short val = ch; | 2184 | + unsigned short ch_short = ch; |
| 2185 | if (ch >= 128) | 2185 | if (ch >= 128) |
| 2186 | { | 2186 | { |
| 2187 | - val = mac_roman_to_unicode[ch - 128]; | 2187 | + ch_short = mac_roman_to_unicode[ch - 128]; |
| 2188 | } | 2188 | } |
| 2189 | - result += QUtil::toUTF8(val); | 2189 | + result += QUtil::toUTF8(ch_short); |
| 2190 | } | 2190 | } |
| 2191 | return result; | 2191 | return result; |
| 2192 | } | 2192 | } |
| @@ -2199,12 +2199,12 @@ QUtil::pdf_doc_to_utf8(std::string const& val) | @@ -2199,12 +2199,12 @@ QUtil::pdf_doc_to_utf8(std::string const& val) | ||
| 2199 | for (unsigned int i = 0; i < len; ++i) | 2199 | for (unsigned int i = 0; i < len; ++i) |
| 2200 | { | 2200 | { |
| 2201 | unsigned char ch = static_cast<unsigned char>(val.at(i)); | 2201 | unsigned char ch = static_cast<unsigned char>(val.at(i)); |
| 2202 | - unsigned short val = ch; | 2202 | + unsigned short ch_short = ch; |
| 2203 | if ((ch >= 128) && (ch <= 160)) | 2203 | if ((ch >= 128) && (ch <= 160)) |
| 2204 | { | 2204 | { |
| 2205 | - val = pdf_doc_to_unicode[ch - 128]; | 2205 | + ch_short = pdf_doc_to_unicode[ch - 128]; |
| 2206 | } | 2206 | } |
| 2207 | - result += QUtil::toUTF8(val); | 2207 | + result += QUtil::toUTF8(ch_short); |
| 2208 | } | 2208 | } |
| 2209 | return result; | 2209 | return result; |
| 2210 | } | 2210 | } |
qpdf/qpdf.cc
| @@ -3610,13 +3610,10 @@ static void do_show_pages(QPDF& pdf, Options& o) | @@ -3610,13 +3610,10 @@ static void do_show_pages(QPDF& pdf, Options& o) | ||
| 3610 | if (! images.empty()) | 3610 | if (! images.empty()) |
| 3611 | { | 3611 | { |
| 3612 | std::cout << " images:" << std::endl; | 3612 | std::cout << " images:" << std::endl; |
| 3613 | - for (std::map<std::string, | ||
| 3614 | - QPDFObjectHandle>::iterator | ||
| 3615 | - iter = images.begin(); | ||
| 3616 | - iter != images.end(); ++iter) | 3613 | + for (auto const& iter2: images) |
| 3617 | { | 3614 | { |
| 3618 | - std::string const& name = (*iter).first; | ||
| 3619 | - QPDFObjectHandle image = (*iter).second; | 3615 | + std::string const& name = iter2.first; |
| 3616 | + QPDFObjectHandle image = iter2.second; | ||
| 3620 | QPDFObjectHandle dict = image.getDict(); | 3617 | QPDFObjectHandle dict = image.getDict(); |
| 3621 | int width = | 3618 | int width = |
| 3622 | dict.getKey("/Width").getIntValueAsInt(); | 3619 | dict.getKey("/Width").getIntValueAsInt(); |
| @@ -3633,11 +3630,9 @@ static void do_show_pages(QPDF& pdf, Options& o) | @@ -3633,11 +3630,9 @@ static void do_show_pages(QPDF& pdf, Options& o) | ||
| 3633 | std::cout << " content:" << std::endl; | 3630 | std::cout << " content:" << std::endl; |
| 3634 | std::vector<QPDFObjectHandle> content = | 3631 | std::vector<QPDFObjectHandle> content = |
| 3635 | ph.getPageContents(); | 3632 | ph.getPageContents(); |
| 3636 | - for (std::vector<QPDFObjectHandle>::iterator iter = | ||
| 3637 | - content.begin(); | ||
| 3638 | - iter != content.end(); ++iter) | 3633 | + for (auto& iter2: content) |
| 3639 | { | 3634 | { |
| 3640 | - std::cout << " " << (*iter).unparse() << std::endl; | 3635 | + std::cout << " " << iter2.unparse() << std::endl; |
| 3641 | } | 3636 | } |
| 3642 | } | 3637 | } |
| 3643 | } | 3638 | } |
| @@ -3738,14 +3733,12 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j) | @@ -3738,14 +3733,12 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j) | ||
| 3738 | "images", JSON::makeArray()); | 3733 | "images", JSON::makeArray()); |
| 3739 | std::map<std::string, QPDFObjectHandle> images = | 3734 | std::map<std::string, QPDFObjectHandle> images = |
| 3740 | ph.getPageImages(); | 3735 | ph.getPageImages(); |
| 3741 | - for (std::map<std::string, QPDFObjectHandle>::iterator iter = | ||
| 3742 | - images.begin(); | ||
| 3743 | - iter != images.end(); ++iter) | 3736 | + for (auto const& iter2: images) |
| 3744 | { | 3737 | { |
| 3745 | JSON j_image = j_images.addArrayElement(JSON::makeDictionary()); | 3738 | JSON j_image = j_images.addArrayElement(JSON::makeDictionary()); |
| 3746 | j_image.addDictionaryMember( | 3739 | j_image.addDictionaryMember( |
| 3747 | - "name", JSON::makeString((*iter).first)); | ||
| 3748 | - QPDFObjectHandle image = (*iter).second; | 3740 | + "name", JSON::makeString(iter2.first)); |
| 3741 | + QPDFObjectHandle image = iter2.second; | ||
| 3749 | QPDFObjectHandle dict = image.getDict(); | 3742 | QPDFObjectHandle dict = image.getDict(); |
| 3750 | j_image.addDictionaryMember("object", image.getJSON()); | 3743 | j_image.addDictionaryMember("object", image.getJSON()); |
| 3751 | j_image.addDictionaryMember( | 3744 | j_image.addDictionaryMember( |
| @@ -3783,10 +3776,9 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j) | @@ -3783,10 +3776,9 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j) | ||
| 3783 | JSON j_contents = j_page.addDictionaryMember( | 3776 | JSON j_contents = j_page.addDictionaryMember( |
| 3784 | "contents", JSON::makeArray()); | 3777 | "contents", JSON::makeArray()); |
| 3785 | std::vector<QPDFObjectHandle> content = ph.getPageContents(); | 3778 | std::vector<QPDFObjectHandle> content = ph.getPageContents(); |
| 3786 | - for (std::vector<QPDFObjectHandle>::iterator iter = content.begin(); | ||
| 3787 | - iter != content.end(); ++iter) | 3779 | + for (auto& iter2: content) |
| 3788 | { | 3780 | { |
| 3789 | - j_contents.addArrayElement((*iter).getJSON()); | 3781 | + j_contents.addArrayElement(iter2.getJSON()); |
| 3790 | } | 3782 | } |
| 3791 | j_page.addDictionaryMember( | 3783 | j_page.addDictionaryMember( |
| 3792 | "label", pldh.getLabelForPage(pageno).getJSON()); | 3784 | "label", pldh.getLabelForPage(pageno).getJSON()); |
| @@ -4761,12 +4753,10 @@ static void handle_transformations(QPDF& pdf, Options& o) | @@ -4761,12 +4753,10 @@ static void handle_transformations(QPDF& pdf, Options& o) | ||
| 4761 | QPDFObjectHandle page = ph.getObjectHandle(); | 4753 | QPDFObjectHandle page = ph.getObjectHandle(); |
| 4762 | std::map<std::string, QPDFObjectHandle> images = | 4754 | std::map<std::string, QPDFObjectHandle> images = |
| 4763 | ph.getPageImages(); | 4755 | ph.getPageImages(); |
| 4764 | - for (std::map<std::string, QPDFObjectHandle>::iterator iter = | ||
| 4765 | - images.begin(); | ||
| 4766 | - iter != images.end(); ++iter) | 4756 | + for (auto& iter2: images) |
| 4767 | { | 4757 | { |
| 4768 | - std::string name = (*iter).first; | ||
| 4769 | - QPDFObjectHandle& image = (*iter).second; | 4758 | + std::string name = iter2.first; |
| 4759 | + QPDFObjectHandle& image = iter2.second; | ||
| 4770 | ImageOptimizer* io = new ImageOptimizer(o, image); | 4760 | ImageOptimizer* io = new ImageOptimizer(o, image); |
| 4771 | PointerHolder<QPDFObjectHandle::StreamDataProvider> sdp(io); | 4761 | PointerHolder<QPDFObjectHandle::StreamDataProvider> sdp(io); |
| 4772 | if (io->evaluate("image " + name + " on page " + | 4762 | if (io->evaluate("image " + name + " on page " + |
qpdf/test_driver.cc
| @@ -347,10 +347,10 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -347,10 +347,10 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 347 | else if (qtest.isArray()) | 347 | else if (qtest.isArray()) |
| 348 | { | 348 | { |
| 349 | QTC::TC("qpdf", "main QTest array"); | 349 | QTC::TC("qpdf", "main QTest array"); |
| 350 | - int n = qtest.getArrayNItems(); | 350 | + int nitems = qtest.getArrayNItems(); |
| 351 | std::cout << "/QTest is an array with " | 351 | std::cout << "/QTest is an array with " |
| 352 | - << n << " items" << std::endl; | ||
| 353 | - for (int i = 0; i < n; ++i) | 352 | + << nitems << " items" << std::endl; |
| 353 | + for (int i = 0; i < nitems; ++i) | ||
| 354 | { | 354 | { |
| 355 | QTC::TC("qpdf", "main QTest array indirect", | 355 | QTC::TC("qpdf", "main QTest array indirect", |
| 356 | qtest.getArrayItem(i).isIndirect() ? 1 : 0); | 356 | qtest.getArrayItem(i).isIndirect() ? 1 : 0); |
| @@ -510,11 +510,10 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -510,11 +510,10 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 510 | std::cout << " images:" << std::endl; | 510 | std::cout << " images:" << std::endl; |
| 511 | std::map<std::string, QPDFObjectHandle> images = | 511 | std::map<std::string, QPDFObjectHandle> images = |
| 512 | page.getPageImages(); | 512 | page.getPageImages(); |
| 513 | - for (std::map<std::string, QPDFObjectHandle>::iterator iter = | ||
| 514 | - images.begin(); iter != images.end(); ++iter) | 513 | + for (auto const& iter2: images) |
| 515 | { | 514 | { |
| 516 | - std::string const& name = (*iter).first; | ||
| 517 | - QPDFObjectHandle image = (*iter).second; | 515 | + std::string const& name = iter2.first; |
| 516 | + QPDFObjectHandle image = iter2.second; | ||
| 518 | QPDFObjectHandle dict = image.getDict(); | 517 | QPDFObjectHandle dict = image.getDict(); |
| 519 | long long width = dict.getKey("/Width").getIntValue(); | 518 | long long width = dict.getKey("/Width").getIntValue(); |
| 520 | long long height = dict.getKey("/Height").getIntValue(); | 519 | long long height = dict.getKey("/Height").getIntValue(); |
| @@ -525,10 +524,9 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -525,10 +524,9 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 525 | 524 | ||
| 526 | std::cout << " content:" << std::endl; | 525 | std::cout << " content:" << std::endl; |
| 527 | std::vector<QPDFObjectHandle> content = page.getPageContents(); | 526 | std::vector<QPDFObjectHandle> content = page.getPageContents(); |
| 528 | - for (std::vector<QPDFObjectHandle>::iterator iter = content.begin(); | ||
| 529 | - iter != content.end(); ++iter) | 527 | + for (auto& iter2: content) |
| 530 | { | 528 | { |
| 531 | - std::cout << " " << (*iter).unparse() << std::endl; | 529 | + std::cout << " " << iter2.unparse() << std::endl; |
| 532 | } | 530 | } |
| 533 | 531 | ||
| 534 | std::cout << "end page " << pageno << std::endl; | 532 | std::cout << "end page " << pageno << std::endl; |
| @@ -539,8 +537,8 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -539,8 +537,8 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 539 | if (qstrings.isArray()) | 537 | if (qstrings.isArray()) |
| 540 | { | 538 | { |
| 541 | std::cout << "QStrings:" << std::endl; | 539 | std::cout << "QStrings:" << std::endl; |
| 542 | - int n = qstrings.getArrayNItems(); | ||
| 543 | - for (int i = 0; i < n; ++i) | 540 | + int nitems = qstrings.getArrayNItems(); |
| 541 | + for (int i = 0; i < nitems; ++i) | ||
| 544 | { | 542 | { |
| 545 | std::cout << qstrings.getArrayItem(i).getUTF8Value() | 543 | std::cout << qstrings.getArrayItem(i).getUTF8Value() |
| 546 | << std::endl; | 544 | << std::endl; |
| @@ -551,8 +549,8 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -551,8 +549,8 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 551 | if (qnumbers.isArray()) | 549 | if (qnumbers.isArray()) |
| 552 | { | 550 | { |
| 553 | std::cout << "QNumbers:" << std::endl; | 551 | std::cout << "QNumbers:" << std::endl; |
| 554 | - int n = qnumbers.getArrayNItems(); | ||
| 555 | - for (int i = 0; i < n; ++i) | 552 | + int nitems = qnumbers.getArrayNItems(); |
| 553 | + for (int i = 0; i < nitems; ++i) | ||
| 556 | { | 554 | { |
| 557 | std::cout << QUtil::double_to_string( | 555 | std::cout << QUtil::double_to_string( |
| 558 | qnumbers.getArrayItem(i).getNumericValue(), 3) | 556 | qnumbers.getArrayItem(i).getNumericValue(), 3) |
| @@ -1853,8 +1851,8 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -1853,8 +1851,8 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 1853 | // button-set*.pdf are designed for this test case. | 1851 | // button-set*.pdf are designed for this test case. |
| 1854 | QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm"); | 1852 | QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm"); |
| 1855 | QPDFObjectHandle fields = acroform.getKey("/Fields"); | 1853 | QPDFObjectHandle fields = acroform.getKey("/Fields"); |
| 1856 | - int n = fields.getArrayNItems(); | ||
| 1857 | - for (int i = 0; i < n; ++i) | 1854 | + int nitems = fields.getArrayNItems(); |
| 1855 | + for (int i = 0; i < nitems; ++i) | ||
| 1858 | { | 1856 | { |
| 1859 | QPDFObjectHandle field = fields.getArrayItem(i); | 1857 | QPDFObjectHandle field = fields.getArrayItem(i); |
| 1860 | QPDFObjectHandle T = field.getKey("/T"); | 1858 | QPDFObjectHandle T = field.getKey("/T"); |
| @@ -1900,8 +1898,8 @@ void runtest(int n, char const* filename1, char const* arg2) | @@ -1900,8 +1898,8 @@ void runtest(int n, char const* filename1, char const* arg2) | ||
| 1900 | // generating testing. | 1898 | // generating testing. |
| 1901 | QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm"); | 1899 | QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm"); |
| 1902 | QPDFObjectHandle fields = acroform.getKey("/Fields"); | 1900 | QPDFObjectHandle fields = acroform.getKey("/Fields"); |
| 1903 | - int n = fields.getArrayNItems(); | ||
| 1904 | - for (int i = 0; i < n; ++i) | 1901 | + int nitems = fields.getArrayNItems(); |
| 1902 | + for (int i = 0; i < nitems; ++i) | ||
| 1905 | { | 1903 | { |
| 1906 | QPDFObjectHandle field = fields.getArrayItem(i); | 1904 | QPDFObjectHandle field = fields.getArrayItem(i); |
| 1907 | QPDFObjectHandle T = field.getKey("/T"); | 1905 | QPDFObjectHandle T = field.getKey("/T"); |