mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Fix warnings reported by -Wshadow=local (fixes #431)
This commit is contained in:
parent
66198f447f
commit
92d3cbecd4
@ -160,11 +160,9 @@ int main(int argc, char* argv[])
|
||||
// Get all images on the page.
|
||||
std::map<std::string, QPDFObjectHandle> images =
|
||||
page.getPageImages();
|
||||
for (std::map<std::string, QPDFObjectHandle>::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");
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
||||
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
|
||||
{
|
||||
|
@ -302,8 +302,9 @@ Pl_DCT::compress(void* cinfo_p, Buffer* b)
|
||||
unsigned int width = cinfo->image_width *
|
||||
QIntC::to_uint(cinfo->input_components);
|
||||
size_t expected_size =
|
||||
cinfo->image_height * cinfo->image_width *
|
||||
QIntC::to_uint(cinfo->input_components);
|
||||
QIntC::to_size(cinfo->image_height) *
|
||||
QIntC::to_size(cinfo->image_width) *
|
||||
QIntC::to_size(cinfo->input_components);
|
||||
if (b->getSize() != expected_size)
|
||||
{
|
||||
throw std::runtime_error(
|
||||
|
@ -1607,12 +1607,12 @@ QPDFObjectHandle::pipeContentStreams(
|
||||
std::string og =
|
||||
QUtil::int_to_string(stream.getObjectID()) + " " +
|
||||
QUtil::int_to_string(stream.getGeneration());
|
||||
std::string description = "content stream object " + og;
|
||||
std::string w_description = "content stream object " + og;
|
||||
if (! stream.pipeStreamData(p, 0, qpdf_dl_specialized))
|
||||
{
|
||||
QTC::TC("qpdf", "QPDFObjectHandle errors in parsecontent");
|
||||
throw QPDFExc(qpdf_e_damaged_pdf, "content stream",
|
||||
description, 0,
|
||||
w_description, 0,
|
||||
"errors while decoding content stream");
|
||||
}
|
||||
}
|
||||
@ -1685,13 +1685,13 @@ QPDFObjectHandle::parseContentStream_data(
|
||||
ParserCallbacks* callbacks,
|
||||
QPDF* context)
|
||||
{
|
||||
size_t length = stream_data->getSize();
|
||||
size_t stream_length = stream_data->getSize();
|
||||
PointerHolder<InputSource> input =
|
||||
new BufferInputSource(description, stream_data.getPointer());
|
||||
QPDFTokenizer tokenizer;
|
||||
tokenizer.allowEOF();
|
||||
bool empty = false;
|
||||
while (QIntC::to_size(input->tell()) < length)
|
||||
while (QIntC::to_size(input->tell()) < stream_length)
|
||||
{
|
||||
// Read a token and seek to the beginning. The offset we get
|
||||
// from this process is the beginning of the next
|
||||
|
@ -76,10 +76,8 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
|
||||
dict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
|
||||
dict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Image"));
|
||||
std::set<std::string> keys = odict.getKeys();
|
||||
for (std::set<std::string>::iterator iter = keys.begin();
|
||||
iter != keys.end(); ++iter)
|
||||
for (auto key: keys)
|
||||
{
|
||||
std::string key = *iter;
|
||||
QPDFObjectHandle value = odict.getKey(key);
|
||||
if (key == "/BPC")
|
||||
{
|
||||
@ -176,14 +174,12 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
|
||||
{
|
||||
filters = value.getArrayAsVector();
|
||||
}
|
||||
for (std::vector<QPDFObjectHandle>::iterator iter =
|
||||
filters.begin();
|
||||
iter != filters.end(); ++iter)
|
||||
for (auto& iter: filters)
|
||||
{
|
||||
std::string name;
|
||||
if ((*iter).isName())
|
||||
if (iter.isName())
|
||||
{
|
||||
name = (*iter).getName();
|
||||
name = iter.getName();
|
||||
}
|
||||
if (name == "/AHx")
|
||||
{
|
||||
@ -219,7 +215,7 @@ InlineImageTracker::convertIIDict(QPDFObjectHandle odict)
|
||||
}
|
||||
if (! name.empty())
|
||||
{
|
||||
*iter = QPDFObjectHandle::newName(name);
|
||||
iter = QPDFObjectHandle::newName(name);
|
||||
}
|
||||
}
|
||||
if (value.isName() && (filters.size() == 1))
|
||||
|
@ -175,8 +175,8 @@ QPDFTokenizer::resolveLiteral()
|
||||
num[0] = this->m->val.at(i+1);
|
||||
num[1] = this->m->val.at(i+2);
|
||||
num[2] = '\0';
|
||||
char ch = static_cast<char>(strtol(num, 0, 16));
|
||||
if (ch == '\0')
|
||||
char ch2 = static_cast<char>(strtol(num, 0, 16));
|
||||
if (ch2 == '\0')
|
||||
{
|
||||
this->m->type = tt_bad;
|
||||
QTC::TC("qpdf", "QPDFTokenizer null in name");
|
||||
@ -186,7 +186,7 @@ QPDFTokenizer::resolveLiteral()
|
||||
}
|
||||
else
|
||||
{
|
||||
nval.append(1, ch);
|
||||
nval.append(1, ch2);
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
@ -719,7 +719,7 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input)
|
||||
for (std::string::iterator iter = value.begin();
|
||||
iter != value.end(); ++iter)
|
||||
{
|
||||
char ch = *iter;
|
||||
signed char ch = *iter;
|
||||
if (((ch >= 'a') && (ch <= 'z')) ||
|
||||
((ch >= 'A') && (ch <= 'Z')) ||
|
||||
(ch == '*'))
|
||||
@ -729,8 +729,10 @@ QPDFTokenizer::findEI(PointerHolder<InputSource> input)
|
||||
// alphabetic characters.
|
||||
found_alpha = true;
|
||||
}
|
||||
else if (((ch < 32) && (! isSpace(ch))) || (ch > 127))
|
||||
else if ((ch < 32) && (! isSpace(ch)))
|
||||
{
|
||||
// ch is signed, so characters outside of
|
||||
// 7-bit will be < 0.
|
||||
found_non_printable = true;
|
||||
break;
|
||||
}
|
||||
|
@ -1790,14 +1790,14 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
|
||||
}
|
||||
}
|
||||
bool normalize = false;
|
||||
bool compress = false;
|
||||
bool compress_stream = false;
|
||||
bool uncompress = false;
|
||||
if (is_metadata &&
|
||||
((! this->m->encrypted) || (this->m->encrypt_metadata == false)))
|
||||
{
|
||||
QTC::TC("qpdf", "QPDFWriter not compressing metadata");
|
||||
filter = true;
|
||||
compress = false;
|
||||
compress_stream = false;
|
||||
uncompress = true;
|
||||
}
|
||||
else if (this->m->normalize_content &&
|
||||
@ -1808,7 +1808,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
|
||||
}
|
||||
else if (filter && this->m->compress_streams)
|
||||
{
|
||||
compress = true;
|
||||
compress_stream = true;
|
||||
QTC::TC("qpdf", "QPDFWriter compressing uncompressed stream");
|
||||
}
|
||||
|
||||
@ -1825,7 +1825,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
|
||||
object.pipeStreamData(
|
||||
this->m->pipeline,
|
||||
(((filter && normalize) ? qpdf_ef_normalize : 0) |
|
||||
((filter && compress) ? qpdf_ef_compress : 0)),
|
||||
((filter && compress_stream) ? qpdf_ef_compress : 0)),
|
||||
(filter
|
||||
? (uncompress ? qpdf_dl_all : this->m->stream_decode_level)
|
||||
: qpdf_dl_none), false, (attempt == 1));
|
||||
@ -1845,7 +1845,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
|
||||
}
|
||||
else
|
||||
{
|
||||
compress = false;
|
||||
compress_stream = false;
|
||||
}
|
||||
|
||||
this->m->cur_stream_length = stream_data->getSize();
|
||||
@ -1856,7 +1856,7 @@ QPDFWriter::unparseObject(QPDFObjectHandle object, int level,
|
||||
}
|
||||
adjustAESStreamLength(this->m->cur_stream_length);
|
||||
unparseObject(stream_dict, 0, flags,
|
||||
this->m->cur_stream_length, compress);
|
||||
this->m->cur_stream_length, compress_stream);
|
||||
unsigned char last_char = '\0';
|
||||
writeString("\nstream\n");
|
||||
{
|
||||
@ -2330,11 +2330,10 @@ QPDFWriter::initializeSpecialStreams()
|
||||
contents_objects.push_back(contents.getObjGen());
|
||||
}
|
||||
|
||||
for (std::vector<QPDFObjGen>::iterator iter = contents_objects.begin();
|
||||
iter != contents_objects.end(); ++iter)
|
||||
for (auto const& c: contents_objects)
|
||||
{
|
||||
this->m->contents_to_page_seq[*iter] = num;
|
||||
this->m->normalized_streams.insert(*iter);
|
||||
this->m->contents_to_page_seq[c] = num;
|
||||
this->m->normalized_streams.insert(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3462,9 +3461,9 @@ QPDFWriter::writeLinearized()
|
||||
else
|
||||
{
|
||||
// Make the file size the same.
|
||||
qpdf_offset_t pos = this->m->pipeline->getCount();
|
||||
writePad(
|
||||
QIntC::to_int(second_xref_end + hint_length - 1 - pos));
|
||||
QIntC::to_int(second_xref_end + hint_length -
|
||||
1 - this->m->pipeline->getCount()));
|
||||
writeString("\n");
|
||||
|
||||
// If this assertion fails, maybe we didn't have
|
||||
@ -3507,7 +3506,7 @@ QPDFWriter::writeLinearized()
|
||||
|
||||
// Save hint offset since it will be set to zero by
|
||||
// calling openObject.
|
||||
qpdf_offset_t hint_offset = this->m->xref[hint_id].getOffset();
|
||||
qpdf_offset_t hint_offset1 = this->m->xref[hint_id].getOffset();
|
||||
|
||||
// Write hint stream to a buffer
|
||||
{
|
||||
@ -3519,12 +3518,12 @@ QPDFWriter::writeLinearized()
|
||||
hint_length = QIntC::to_offset(hint_buffer->getSize());
|
||||
|
||||
// Restore hint offset
|
||||
this->m->xref[hint_id] = QPDFXRefEntry(1, hint_offset, 0);
|
||||
this->m->xref[hint_id] = QPDFXRefEntry(1, hint_offset1, 0);
|
||||
if (lin_pass1_file)
|
||||
{
|
||||
// Write some debugging information
|
||||
fprintf(lin_pass1_file, "%% hint_offset=%s\n",
|
||||
QUtil::int_to_string(hint_offset).c_str());
|
||||
QUtil::int_to_string(hint_offset1).c_str());
|
||||
fprintf(lin_pass1_file, "%% hint_length=%s\n",
|
||||
QUtil::int_to_string(hint_length).c_str());
|
||||
fprintf(lin_pass1_file, "%% second_xref_offset=%s\n",
|
||||
|
@ -555,12 +555,14 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
|
||||
for (std::vector<std::string>::reverse_iterator iter = filters.rbegin();
|
||||
iter != filters.rend(); ++iter)
|
||||
for (std::vector<std::string>::reverse_iterator f_iter =
|
||||
filters.rbegin();
|
||||
f_iter != filters.rend(); ++f_iter)
|
||||
{
|
||||
std::string const& filter = *iter;
|
||||
std::string const& filter_name = *f_iter;
|
||||
|
||||
if ((filter == "/FlateDecode") || (filter == "/LZWDecode"))
|
||||
if ((filter_name == "/FlateDecode") ||
|
||||
(filter_name == "/LZWDecode"))
|
||||
{
|
||||
if ((predictor >= 10) && (predictor <= 15))
|
||||
{
|
||||
@ -584,39 +586,39 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, bool* filterp,
|
||||
}
|
||||
}
|
||||
|
||||
if (filter == "/Crypt")
|
||||
if (filter_name == "/Crypt")
|
||||
{
|
||||
// Ignore -- handled by pipeStreamData
|
||||
}
|
||||
else if (filter == "/FlateDecode")
|
||||
else if (filter_name == "/FlateDecode")
|
||||
{
|
||||
pipeline = new Pl_Flate("stream inflate",
|
||||
pipeline, Pl_Flate::a_inflate);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (filter == "/ASCII85Decode")
|
||||
else if (filter_name == "/ASCII85Decode")
|
||||
{
|
||||
pipeline = new Pl_ASCII85Decoder("ascii85 decode", pipeline);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (filter == "/ASCIIHexDecode")
|
||||
else if (filter_name == "/ASCIIHexDecode")
|
||||
{
|
||||
pipeline = new Pl_ASCIIHexDecoder("asciiHex decode", pipeline);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (filter == "/LZWDecode")
|
||||
else if (filter_name == "/LZWDecode")
|
||||
{
|
||||
pipeline = new Pl_LZWDecoder("lzw decode", pipeline,
|
||||
early_code_change);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (filter == "/RunLengthDecode")
|
||||
else if (filter_name == "/RunLengthDecode")
|
||||
{
|
||||
pipeline = new Pl_RunLength("runlength decode", pipeline,
|
||||
Pl_RunLength::a_decode);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (filter == "/DCTDecode")
|
||||
else if (filter_name == "/DCTDecode")
|
||||
{
|
||||
pipeline = new Pl_DCT("DCT decode", pipeline);
|
||||
to_delete.push_back(pipeline);
|
||||
|
@ -322,10 +322,10 @@ hash_V5(std::string const& password,
|
||||
int next_hash = ((E_mod_3 == 0) ? 256 :
|
||||
(E_mod_3 == 1) ? 384 :
|
||||
512);
|
||||
Pl_SHA2 hash(next_hash);
|
||||
hash.write(QUtil::unsigned_char_pointer(E), E.length());
|
||||
hash.finish();
|
||||
K = hash.getRawDigest();
|
||||
Pl_SHA2 sha2(next_hash);
|
||||
sha2.write(QUtil::unsigned_char_pointer(E), E.length());
|
||||
sha2.finish();
|
||||
K = sha2.getRawDigest();
|
||||
|
||||
if (round_number >= 64)
|
||||
{
|
||||
|
@ -374,9 +374,9 @@ QPDF::readHintStream(Pipeline& pl, qpdf_offset_t offset, size_t length)
|
||||
QTC::TC("qpdf", "QPDF hint table length indirect");
|
||||
// Force resolution
|
||||
(void) length_obj.getIntValue();
|
||||
ObjCache& oc = this->m->obj_cache[length_obj.getObjGen()];
|
||||
min_end_offset = oc.end_before_space;
|
||||
max_end_offset = oc.end_after_space;
|
||||
ObjCache& oc2 = this->m->obj_cache[length_obj.getObjGen()];
|
||||
min_end_offset = oc2.end_before_space;
|
||||
max_end_offset = oc2.end_after_space;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -812,7 +812,7 @@ QUtil::toUTF8(unsigned long uval)
|
||||
// maximum value that will fit in the current number of bytes
|
||||
unsigned char maxval = 0x3f; // six bits
|
||||
|
||||
while (uval > maxval)
|
||||
while (uval > QIntC::to_ulong(maxval))
|
||||
{
|
||||
// Assign low six bits plus 10000000 to lowest unused
|
||||
// byte position, then shift
|
||||
@ -2163,12 +2163,12 @@ QUtil::win_ansi_to_utf8(std::string const& val)
|
||||
for (unsigned int i = 0; i < len; ++i)
|
||||
{
|
||||
unsigned char ch = static_cast<unsigned char>(val.at(i));
|
||||
unsigned short val = ch;
|
||||
unsigned short ch_short = ch;
|
||||
if ((ch >= 128) && (ch <= 160))
|
||||
{
|
||||
val = win_ansi_to_unicode[ch - 128];
|
||||
ch_short = win_ansi_to_unicode[ch - 128];
|
||||
}
|
||||
result += QUtil::toUTF8(val);
|
||||
result += QUtil::toUTF8(ch_short);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -2181,12 +2181,12 @@ QUtil::mac_roman_to_utf8(std::string const& val)
|
||||
for (unsigned int i = 0; i < len; ++i)
|
||||
{
|
||||
unsigned char ch = static_cast<unsigned char>(val.at(i));
|
||||
unsigned short val = ch;
|
||||
unsigned short ch_short = ch;
|
||||
if (ch >= 128)
|
||||
{
|
||||
val = mac_roman_to_unicode[ch - 128];
|
||||
ch_short = mac_roman_to_unicode[ch - 128];
|
||||
}
|
||||
result += QUtil::toUTF8(val);
|
||||
result += QUtil::toUTF8(ch_short);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -2199,12 +2199,12 @@ QUtil::pdf_doc_to_utf8(std::string const& val)
|
||||
for (unsigned int i = 0; i < len; ++i)
|
||||
{
|
||||
unsigned char ch = static_cast<unsigned char>(val.at(i));
|
||||
unsigned short val = ch;
|
||||
unsigned short ch_short = ch;
|
||||
if ((ch >= 128) && (ch <= 160))
|
||||
{
|
||||
val = pdf_doc_to_unicode[ch - 128];
|
||||
ch_short = pdf_doc_to_unicode[ch - 128];
|
||||
}
|
||||
result += QUtil::toUTF8(val);
|
||||
result += QUtil::toUTF8(ch_short);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
36
qpdf/qpdf.cc
36
qpdf/qpdf.cc
@ -3610,13 +3610,10 @@ static void do_show_pages(QPDF& pdf, Options& o)
|
||||
if (! images.empty())
|
||||
{
|
||||
std::cout << " images:" << std::endl;
|
||||
for (std::map<std::string,
|
||||
QPDFObjectHandle>::iterator
|
||||
iter = images.begin();
|
||||
iter != images.end(); ++iter)
|
||||
for (auto const& iter2: images)
|
||||
{
|
||||
std::string const& name = (*iter).first;
|
||||
QPDFObjectHandle image = (*iter).second;
|
||||
std::string const& name = iter2.first;
|
||||
QPDFObjectHandle image = iter2.second;
|
||||
QPDFObjectHandle dict = image.getDict();
|
||||
int width =
|
||||
dict.getKey("/Width").getIntValueAsInt();
|
||||
@ -3633,11 +3630,9 @@ static void do_show_pages(QPDF& pdf, Options& o)
|
||||
std::cout << " content:" << std::endl;
|
||||
std::vector<QPDFObjectHandle> content =
|
||||
ph.getPageContents();
|
||||
for (std::vector<QPDFObjectHandle>::iterator iter =
|
||||
content.begin();
|
||||
iter != content.end(); ++iter)
|
||||
for (auto& iter2: content)
|
||||
{
|
||||
std::cout << " " << (*iter).unparse() << std::endl;
|
||||
std::cout << " " << iter2.unparse() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3738,14 +3733,12 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j)
|
||||
"images", JSON::makeArray());
|
||||
std::map<std::string, QPDFObjectHandle> images =
|
||||
ph.getPageImages();
|
||||
for (std::map<std::string, QPDFObjectHandle>::iterator iter =
|
||||
images.begin();
|
||||
iter != images.end(); ++iter)
|
||||
for (auto const& iter2: images)
|
||||
{
|
||||
JSON j_image = j_images.addArrayElement(JSON::makeDictionary());
|
||||
j_image.addDictionaryMember(
|
||||
"name", JSON::makeString((*iter).first));
|
||||
QPDFObjectHandle image = (*iter).second;
|
||||
"name", JSON::makeString(iter2.first));
|
||||
QPDFObjectHandle image = iter2.second;
|
||||
QPDFObjectHandle dict = image.getDict();
|
||||
j_image.addDictionaryMember("object", image.getJSON());
|
||||
j_image.addDictionaryMember(
|
||||
@ -3783,10 +3776,9 @@ static void do_json_pages(QPDF& pdf, Options& o, JSON& j)
|
||||
JSON j_contents = j_page.addDictionaryMember(
|
||||
"contents", JSON::makeArray());
|
||||
std::vector<QPDFObjectHandle> content = ph.getPageContents();
|
||||
for (std::vector<QPDFObjectHandle>::iterator iter = content.begin();
|
||||
iter != content.end(); ++iter)
|
||||
for (auto& iter2: content)
|
||||
{
|
||||
j_contents.addArrayElement((*iter).getJSON());
|
||||
j_contents.addArrayElement(iter2.getJSON());
|
||||
}
|
||||
j_page.addDictionaryMember(
|
||||
"label", pldh.getLabelForPage(pageno).getJSON());
|
||||
@ -4761,12 +4753,10 @@ static void handle_transformations(QPDF& pdf, Options& o)
|
||||
QPDFObjectHandle page = ph.getObjectHandle();
|
||||
std::map<std::string, QPDFObjectHandle> images =
|
||||
ph.getPageImages();
|
||||
for (std::map<std::string, QPDFObjectHandle>::iterator iter =
|
||||
images.begin();
|
||||
iter != images.end(); ++iter)
|
||||
for (auto& iter2: images)
|
||||
{
|
||||
std::string name = (*iter).first;
|
||||
QPDFObjectHandle& image = (*iter).second;
|
||||
std::string name = iter2.first;
|
||||
QPDFObjectHandle& image = iter2.second;
|
||||
ImageOptimizer* io = new ImageOptimizer(o, image);
|
||||
PointerHolder<QPDFObjectHandle::StreamDataProvider> sdp(io);
|
||||
if (io->evaluate("image " + name + " on page " +
|
||||
|
@ -347,10 +347,10 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
else if (qtest.isArray())
|
||||
{
|
||||
QTC::TC("qpdf", "main QTest array");
|
||||
int n = qtest.getArrayNItems();
|
||||
int nitems = qtest.getArrayNItems();
|
||||
std::cout << "/QTest is an array with "
|
||||
<< n << " items" << std::endl;
|
||||
for (int i = 0; i < n; ++i)
|
||||
<< nitems << " items" << std::endl;
|
||||
for (int i = 0; i < nitems; ++i)
|
||||
{
|
||||
QTC::TC("qpdf", "main QTest array indirect",
|
||||
qtest.getArrayItem(i).isIndirect() ? 1 : 0);
|
||||
@ -510,11 +510,10 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
std::cout << " images:" << std::endl;
|
||||
std::map<std::string, QPDFObjectHandle> images =
|
||||
page.getPageImages();
|
||||
for (std::map<std::string, QPDFObjectHandle>::iterator iter =
|
||||
images.begin(); iter != images.end(); ++iter)
|
||||
for (auto const& iter2: images)
|
||||
{
|
||||
std::string const& name = (*iter).first;
|
||||
QPDFObjectHandle image = (*iter).second;
|
||||
std::string const& name = iter2.first;
|
||||
QPDFObjectHandle image = iter2.second;
|
||||
QPDFObjectHandle dict = image.getDict();
|
||||
long long width = dict.getKey("/Width").getIntValue();
|
||||
long long height = dict.getKey("/Height").getIntValue();
|
||||
@ -525,10 +524,9 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
|
||||
std::cout << " content:" << std::endl;
|
||||
std::vector<QPDFObjectHandle> content = page.getPageContents();
|
||||
for (std::vector<QPDFObjectHandle>::iterator iter = content.begin();
|
||||
iter != content.end(); ++iter)
|
||||
for (auto& iter2: content)
|
||||
{
|
||||
std::cout << " " << (*iter).unparse() << std::endl;
|
||||
std::cout << " " << iter2.unparse() << std::endl;
|
||||
}
|
||||
|
||||
std::cout << "end page " << pageno << std::endl;
|
||||
@ -539,8 +537,8 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
if (qstrings.isArray())
|
||||
{
|
||||
std::cout << "QStrings:" << std::endl;
|
||||
int n = qstrings.getArrayNItems();
|
||||
for (int i = 0; i < n; ++i)
|
||||
int nitems = qstrings.getArrayNItems();
|
||||
for (int i = 0; i < nitems; ++i)
|
||||
{
|
||||
std::cout << qstrings.getArrayItem(i).getUTF8Value()
|
||||
<< std::endl;
|
||||
@ -551,8 +549,8 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
if (qnumbers.isArray())
|
||||
{
|
||||
std::cout << "QNumbers:" << std::endl;
|
||||
int n = qnumbers.getArrayNItems();
|
||||
for (int i = 0; i < n; ++i)
|
||||
int nitems = qnumbers.getArrayNItems();
|
||||
for (int i = 0; i < nitems; ++i)
|
||||
{
|
||||
std::cout << QUtil::double_to_string(
|
||||
qnumbers.getArrayItem(i).getNumericValue(), 3)
|
||||
@ -1853,8 +1851,8 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
// button-set*.pdf are designed for this test case.
|
||||
QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm");
|
||||
QPDFObjectHandle fields = acroform.getKey("/Fields");
|
||||
int n = fields.getArrayNItems();
|
||||
for (int i = 0; i < n; ++i)
|
||||
int nitems = fields.getArrayNItems();
|
||||
for (int i = 0; i < nitems; ++i)
|
||||
{
|
||||
QPDFObjectHandle field = fields.getArrayItem(i);
|
||||
QPDFObjectHandle T = field.getKey("/T");
|
||||
@ -1900,8 +1898,8 @@ void runtest(int n, char const* filename1, char const* arg2)
|
||||
// generating testing.
|
||||
QPDFObjectHandle acroform = pdf.getRoot().getKey("/AcroForm");
|
||||
QPDFObjectHandle fields = acroform.getKey("/Fields");
|
||||
int n = fields.getArrayNItems();
|
||||
for (int i = 0; i < n; ++i)
|
||||
int nitems = fields.getArrayNItems();
|
||||
for (int i = 0; i < nitems; ++i)
|
||||
{
|
||||
QPDFObjectHandle field = fields.getArrayItem(i);
|
||||
QPDFObjectHandle T = field.getKey("/T");
|
||||
|
Loading…
Reference in New Issue
Block a user