diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-04-02 23:14:10 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-04-04 14:10:40 +0200 |
commit | 12f1eb15ca3fed6310402847559a7c99d3c77847 (patch) | |
tree | 8935675b623c6f3b4914b8b44f7fa5f2816a9241 /libqpdf/QPDF_Name.cc | |
parent | f20fa61eb4c323eb1642c69c236b3d9a1f8b2cdb (diff) | |
download | qpdf-12f1eb15ca3fed6310402847559a7c99d3c77847.tar.zst |
Programmatically apply new formatting to code
Run this:
for i in **/*.cc **/*.c **/*.h **/*.hh; do
clang-format < $i >| $i.new && mv $i.new $i
done
Diffstat (limited to 'libqpdf/QPDF_Name.cc')
-rw-r--r-- | libqpdf/QPDF_Name.cc | 21 |
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; } } |