2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 02:49:00 +00:00

In ContentNormalizer::handleToken refactor handling of string and name tokens

This commit is contained in:
m-holger 2024-07-27 16:45:58 +01:00
parent 959ae4b4da
commit ffe462e67e
2 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
#include <qpdf/ContentNormalizer.hh>
#include <qpdf/QPDF_Name.hh>
#include <qpdf/QUtil.hh>
ContentNormalizer::ContentNormalizer() :
@ -43,11 +44,11 @@ ContentNormalizer::handleToken(QPDFTokenizer::Token const& token)
case QPDFTokenizer::tt_string:
// Replacing string and name tokens in this way normalizes their representation as this will
// automatically handle quoting of unprintable characters, etc.
writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_string, token.getValue()));
write(QPDFObjectHandle::newString(token.getValue()).unparse());
break;
case QPDFTokenizer::tt_name:
writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_name, token.getValue()));
write(QPDF_Name::normalizeName(token.getValue()));
break;
default:

View File

@ -71,7 +71,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
m->dest_dict = qpdf.getRoot().getKey("/Dests");
}
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
result= m->dest_dict.getKeyIfDict(name.getName());
result = m->dest_dict.getKeyIfDict(name.getName());
} else if (name.isString()) {
if (!m->names_dest) {
auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");