aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_String.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-05-27 19:19:52 +0200
committerm-holger <m-holger@kubitscheck.org>2023-06-02 17:00:40 +0200
commit3c5700c255f4603b5df9c6d183d13dd71a083cc3 (patch)
tree0f01c62c54b56d009b341922fa3441907a2e560b /libqpdf/QPDF_String.cc
parent6e6a73d28f5f61f038209a61a3e85995dc71aa32 (diff)
downloadqpdf-3c5700c255f4603b5df9c6d183d13dd71a083cc3.tar.zst
Code tidy - reflow comments and strings
Diffstat (limited to 'libqpdf/QPDF_String.cc')
-rw-r--r--libqpdf/QPDF_String.cc17
1 files changed, 7 insertions, 10 deletions
diff --git a/libqpdf/QPDF_String.cc b/libqpdf/QPDF_String.cc
index 386d7672..3886b399 100644
--- a/libqpdf/QPDF_String.cc
+++ b/libqpdf/QPDF_String.cc
@@ -2,9 +2,8 @@
#include <qpdf/QUtil.hh>
-// DO NOT USE ctype -- it is locale dependent for some things, and
-// it's not worth the risk of including it in case it may accidentally
-// be used.
+// DO NOT USE ctype -- it is locale dependent for some things, and it's not worth the risk of
+// including it in case it may accidentally be used.
static bool
is_iso_latin1_printable(char ch)
@@ -62,8 +61,7 @@ QPDF_String::getJSON(int json_version)
} else if (!useHexString()) {
std::string test;
if (QUtil::utf8_to_pdf_doc(candidate, test, '?') && (test == this->val)) {
- // This is a PDF-doc string that can be losslessly encoded
- // as Unicode.
+ // This is a PDF-doc string that can be losslessly encoded as Unicode.
is_unicode = true;
result = candidate;
}
@@ -79,9 +77,8 @@ QPDF_String::getJSON(int json_version)
bool
QPDF_String::useHexString() const
{
- // Heuristic: use the hexadecimal representation of a string if
- // there are any non-printable (in PDF Doc encoding) characters or
- // if too large of a proportion of the string consists of
+ // Heuristic: use the hexadecimal representation of a string if there are any non-printable (in
+ // PDF Doc encoding) characters or if too large of a proportion of the string consists of
// non-ASCII characters.
unsigned int non_ascii = 0;
for (auto const ch: this->val) {
@@ -172,8 +169,8 @@ QPDF_String::getUTF8Val() const
if (QUtil::is_utf16(this->val)) {
return QUtil::utf16_to_utf8(this->val);
} else if (QUtil::is_explicit_utf8(this->val)) {
- // PDF 2.0 allows UTF-8 strings when explicitly prefixed with
- // the three-byte representation of U+FEFF.
+ // PDF 2.0 allows UTF-8 strings when explicitly prefixed with the three-byte representation
+ // of U+FEFF.
return this->val.substr(3);
} else {
return QUtil::pdf_doc_to_utf8(this->val);