summaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Name.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDF_Name.cc')
-rw-r--r--libqpdf/QPDF_Name.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc
index 19610bff..9adb25b5 100644
--- a/libqpdf/QPDF_Name.cc
+++ b/libqpdf/QPDF_Name.cc
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdio.h>
+#include <qpdf/QUtil.hh>
QPDF_Name::QPDF_Name(std::string const& name) :
name(name)
@@ -16,7 +17,6 @@ std::string
QPDF_Name::normalizeName(std::string const& name)
{
std::string result;
- char num[4];
result += name[0];
for (unsigned int i = 1; i < name.length(); ++i)
{
@@ -24,8 +24,7 @@ QPDF_Name::normalizeName(std::string const& name)
// Don't use locale/ctype here; follow PDF spec guidelines.
if (strchr("#()<>[]{}/%", ch) || (ch < 33) || (ch > 126))
{
- sprintf(num, "#%02x", (unsigned char) ch);
- result += num;
+ result += "#" + QUtil::hex_encode(std::string(&ch, 1));
}
else
{