From 32b62035ce9d5d07f7396cc50a0c38215f19c906 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Fri, 25 Jan 2013 08:59:55 -0500 Subject: 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. --- libqpdf/QPDF_String.cc | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'libqpdf/QPDF_String.cc') 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 { -- cgit v1.2.3-54-g00ecf