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. --- include/qpdf/QUtil.hh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index ddba97de..9639917d 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -56,6 +56,12 @@ namespace QUtil QPDF_DLL char* copy_string(std::string const&); + // Returns lower-case hex-encoded version of the string, treating + // each character in the input string as unsigned. The output + // string will be twice as long as the input string. + QPDF_DLL + std::string hex_encode(std::string const&); + // Set stdin, stdout to binary mode QPDF_DLL void binary_stdout(); -- cgit v1.2.3-70-g09d2