aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_Name.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-08 15:18:08 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-08 17:51:15 +0100
commitcb769c62e55599e9f980001830bc61d9fcaa64a9 (patch)
tree0bf980c385a61cbc8720cf990762ffc1200f9d6a /libqpdf/QPDF_Name.cc
parent716381f65a2b2dc72f8da2426ba71aeab02c507f (diff)
downloadqpdf-cb769c62e55599e9f980001830bc61d9fcaa64a9.tar.zst
WHITESPACE ONLY -- expand tabs in source code
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
Diffstat (limited to 'libqpdf/QPDF_Name.cc')
-rw-r--r--libqpdf/QPDF_Name.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/libqpdf/QPDF_Name.cc b/libqpdf/QPDF_Name.cc
index ffd21af2..7972210c 100644
--- a/libqpdf/QPDF_Name.cc
+++ b/libqpdf/QPDF_Name.cc
@@ -18,28 +18,28 @@ QPDF_Name::normalizeName(std::string const& name)
{
if (name.empty())
{
- return name;
+ return name;
}
std::string result;
result += name.at(0);
for (size_t i = 1; i < name.length(); ++i)
{
- char ch = name.at(i);
- // Don't use locale/ctype here; follow PDF spec guidelines.
+ char ch = name.at(i);
+ // Don't use locale/ctype here; follow PDF spec guidelines.
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
- {
- result += ch;
- }
+ }
+ else
+ {
+ result += ch;
+ }
}
return result;
}