aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2013-01-25 14:59:55 +0100
committerJay Berkenbilt <ejb@ql.org>2013-03-04 22:45:15 +0100
commit32b62035ce9d5d07f7396cc50a0c38215f19c906 (patch)
treec7ade8bcf294574d731dc2bc7cdf42524ee023d2 /qpdf
parent9f1594656cc4702b4b0e99a2787e18e4b00d54d3 (diff)
downloadqpdf-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 'qpdf')
-rw-r--r--qpdf/test_driver.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc
index d6534abf..a1a467b8 100644
--- a/qpdf/test_driver.cc
+++ b/qpdf/test_driver.cc
@@ -75,16 +75,9 @@ ParserCallbacks::handleObject(QPDFObjectHandle obj)
std::cout << obj.getTypeName() << ": ";
if (obj.isInlineImage())
{
+ // Exercise getTypeCode
assert(obj.getTypeCode() == QPDFObject::ot_inlineimage);
- 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
{