aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_String.cc
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 /libqpdf/QPDF_String.cc
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 'libqpdf/QPDF_String.cc')
-rw-r--r--libqpdf/QPDF_String.cc9
1 files changed, 1 insertions, 8 deletions
diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc
index 3a8e7074..619adef6 100644
--- a/libqpdf/QPDF_String.cc
+++ b/libqpdf/QPDF_String.cc
@@ -90,14 +90,7 @@ QPDF_String::unparse(bool force_binary)
std::string result;
if (use_hexstring)
{
- result += "<";
- char num[3];
- for (unsigned int i = 0; i < this->val.length(); ++i)
- {
- sprintf(num, "%02x", (unsigned char) this->val[i]);
- result += num;
- }
- result += ">";
+ result += "<" + QUtil::hex_encode(this->val) + ">";
}
else
{