aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/MD5.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/MD5.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/MD5.cc')
-rw-r--r--libqpdf/MD5.cc11
1 files changed, 1 insertions, 10 deletions
diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc
index 70be696d..57bcc45f 100644
--- a/libqpdf/MD5.cc
+++ b/libqpdf/MD5.cc
@@ -386,16 +386,7 @@ void MD5::print()
std::string MD5::unparse()
{
final();
-
- char result[33];
- char* p = result;
- unsigned int i;
- for (i = 0; i < 16; ++i)
- {
- sprintf(p, "%02x", digest_val[i]);
- p += 2;
- }
- return result;
+ return QUtil::hex_encode(std::string((char*)digest_val, 16));
}
std::string