diff options
author | Jay Berkenbilt <ejb@ql.org> | 2013-01-25 14:59:55 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2013-03-04 22:45:15 +0100 |
commit | 32b62035ce9d5d07f7396cc50a0c38215f19c906 (patch) | |
tree | c7ade8bcf294574d731dc2bc7cdf42524ee023d2 /examples | |
parent | 9f1594656cc4702b4b0e99a2787e18e4b00d54d3 (diff) | |
download | qpdf-32b62035ce9d5d07f7396cc50a0c38215f19c906.tar.zst |
Replace many calls to sprintf with QUtil::hex_encode
Add QUtil::hex_encode to encode binary data has a hexadecimal string,
and use it in place of sprintf where possible.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pdf-parse-content.cc | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/examples/pdf-parse-content.cc b/examples/pdf-parse-content.cc index 430c0a06..29a989e7 100644 --- a/examples/pdf-parse-content.cc +++ b/examples/pdf-parse-content.cc @@ -33,15 +33,7 @@ ParserCallbacks::handleObject(QPDFObjectHandle obj) std::cout << obj.getTypeName() << ": "; if (obj.isInlineImage()) { - std::string val = obj.getInlineImageValue(); - char buf[3]; - buf[2] = '\0'; - for (size_t i = 0; i < val.length(); ++i) - { - sprintf(buf, "%02x", (unsigned char)(val[i])); - std::cout << buf; - } - std::cout << std::endl; + std::cout << QUtil::hex_encode(obj.getInlineImageValue()) << std::endl; } else { |