aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Name.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libqpdf/QPDF_Name.cc')
-rw-r--r--libqpdf/QPDF_Name.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc
index 7972210c..85ca3059 100644
--- a/libqpdf/QPDF_Name.cc
+++ b/libqpdf/QPDF_Name.cc
@@ -1,8 +1,8 @@
#include <qpdf/QPDF_Name.hh>
-#include <string.h>
-#include <stdio.h>
#include <qpdf/QUtil.hh>
+#include <stdio.h>
+#include <string.h>
QPDF_Name::QPDF_Name(std::string const& name) :
name(name)
@@ -16,28 +16,21 @@ QPDF_Name::~QPDF_Name()
std::string
QPDF_Name::normalizeName(std::string const& name)
{
- if (name.empty())
- {
+ if (name.empty()) {
return name;
}
std::string result;
result += name.at(0);
- for (size_t i = 1; i < name.length(); ++i)
- {
+ for (size_t i = 1; i < name.length(); ++i) {
char ch = name.at(i);
// Don't use locale/ctype here; follow PDF spec guidelines.
- if (ch == '\0')
- {
+ if (ch == '\0') {
// QPDFTokenizer embeds a null character to encode an
// invalid #.
result += "#";
- }
- else if (strchr("#()<>[]{}/%", ch) || (ch < 33) || (ch > 126))
- {
+ } else if (strchr("#()<>[]{}/%", ch) || (ch < 33) || (ch > 126)) {
result += "#" + QUtil::hex_encode(std::string(&ch, 1));
- }
- else
- {
+ } else {
result += ch;
}
}