mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-08 14:21:06 +00:00
In ContentNormalizer::handleToken refactor handling of string and name tokens
This commit is contained in:
parent
959ae4b4da
commit
ffe462e67e
@ -1,5 +1,6 @@
|
|||||||
#include <qpdf/ContentNormalizer.hh>
|
#include <qpdf/ContentNormalizer.hh>
|
||||||
|
|
||||||
|
#include <qpdf/QPDF_Name.hh>
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
ContentNormalizer::ContentNormalizer() :
|
ContentNormalizer::ContentNormalizer() :
|
||||||
@ -43,11 +44,11 @@ ContentNormalizer::handleToken(QPDFTokenizer::Token const& token)
|
|||||||
case QPDFTokenizer::tt_string:
|
case QPDFTokenizer::tt_string:
|
||||||
// Replacing string and name tokens in this way normalizes their representation as this will
|
// Replacing string and name tokens in this way normalizes their representation as this will
|
||||||
// automatically handle quoting of unprintable characters, etc.
|
// automatically handle quoting of unprintable characters, etc.
|
||||||
writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_string, token.getValue()));
|
write(QPDFObjectHandle::newString(token.getValue()).unparse());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QPDFTokenizer::tt_name:
|
case QPDFTokenizer::tt_name:
|
||||||
writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_name, token.getValue()));
|
write(QPDF_Name::normalizeName(token.getValue()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -71,7 +71,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name)
|
|||||||
m->dest_dict = qpdf.getRoot().getKey("/Dests");
|
m->dest_dict = qpdf.getRoot().getKey("/Dests");
|
||||||
}
|
}
|
||||||
QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest");
|
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()) {
|
} else if (name.isString()) {
|
||||||
if (!m->names_dest) {
|
if (!m->names_dest) {
|
||||||
auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
|
auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests");
|
||||||
|
Loading…
Reference in New Issue
Block a user