Commit ffe462e67eca12a728bf11a2a6f2034e82c2d496
1 parent
959ae4b4
In ContentNormalizer::handleToken refactor handling of string and name tokens
Showing
2 changed files
with
4 additions
and
3 deletions
libqpdf/ContentNormalizer.cc
| 1 | 1 | #include <qpdf/ContentNormalizer.hh> |
| 2 | 2 | |
| 3 | +#include <qpdf/QPDF_Name.hh> | |
| 3 | 4 | #include <qpdf/QUtil.hh> |
| 4 | 5 | |
| 5 | 6 | ContentNormalizer::ContentNormalizer() : |
| ... | ... | @@ -43,11 +44,11 @@ ContentNormalizer::handleToken(QPDFTokenizer::Token const& token) |
| 43 | 44 | case QPDFTokenizer::tt_string: |
| 44 | 45 | // Replacing string and name tokens in this way normalizes their representation as this will |
| 45 | 46 | // automatically handle quoting of unprintable characters, etc. |
| 46 | - writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_string, token.getValue())); | |
| 47 | + write(QPDFObjectHandle::newString(token.getValue()).unparse()); | |
| 47 | 48 | break; |
| 48 | 49 | |
| 49 | 50 | case QPDFTokenizer::tt_name: |
| 50 | - writeToken(QPDFTokenizer::Token(QPDFTokenizer::tt_name, token.getValue())); | |
| 51 | + write(QPDF_Name::normalizeName(token.getValue())); | |
| 51 | 52 | break; |
| 52 | 53 | |
| 53 | 54 | default: | ... | ... |
libqpdf/QPDFOutlineDocumentHelper.cc
| ... | ... | @@ -71,7 +71,7 @@ QPDFOutlineDocumentHelper::resolveNamedDest(QPDFObjectHandle name) |
| 71 | 71 | m->dest_dict = qpdf.getRoot().getKey("/Dests"); |
| 72 | 72 | } |
| 73 | 73 | QTC::TC("qpdf", "QPDFOutlineDocumentHelper name named dest"); |
| 74 | - result= m->dest_dict.getKeyIfDict(name.getName()); | |
| 74 | + result = m->dest_dict.getKeyIfDict(name.getName()); | |
| 75 | 75 | } else if (name.isString()) { |
| 76 | 76 | if (!m->names_dest) { |
| 77 | 77 | auto dests = qpdf.getRoot().getKey("/Names").getKeyIfDict("/Dests"); | ... | ... |