Commit 413aba5bf2ef239d3abf024de3c819e153171035
1 parent
4f54508f
Add comment to QPDF_Name::writeJSON
Showing
1 changed file
with
3 additions
and
1 deletions
libqpdf/QPDF_Name.cc
| @@ -60,7 +60,7 @@ QPDF_Name::analyzeJSONEncoding(const std::string& name) | @@ -60,7 +60,7 @@ QPDF_Name::analyzeJSONEncoding(const std::string& name) | ||
| 60 | std::basic_string_view<unsigned char> view{ | 60 | std::basic_string_view<unsigned char> view{ |
| 61 | reinterpret_cast<const unsigned char*>(name.data()), name.size()}; | 61 | reinterpret_cast<const unsigned char*>(name.data()), name.size()}; |
| 62 | 62 | ||
| 63 | - int tail = 0; // Number of continuation characters expected. | 63 | + int tail = 0; // Number of continuation characters expected. |
| 64 | bool tail2 = false; // Potential overlong 3 octet utf-8. | 64 | bool tail2 = false; // Potential overlong 3 octet utf-8. |
| 65 | bool tail3 = false; // potential overlong 4 octet | 65 | bool tail3 = false; // potential overlong 4 octet |
| 66 | bool needs_escaping = false; | 66 | bool needs_escaping = false; |
| @@ -106,6 +106,8 @@ QPDF_Name::analyzeJSONEncoding(const std::string& name) | @@ -106,6 +106,8 @@ QPDF_Name::analyzeJSONEncoding(const std::string& name) | ||
| 106 | void | 106 | void |
| 107 | QPDF_Name::writeJSON(int json_version, JSON::Writer& p) | 107 | QPDF_Name::writeJSON(int json_version, JSON::Writer& p) |
| 108 | { | 108 | { |
| 109 | + // For performance reasons this code is duplicated in QPDF_Dictionary::writeJSON. When updating | ||
| 110 | + // this method make sure QPDF_Dictionary is also update. | ||
| 109 | if (json_version == 1) { | 111 | if (json_version == 1) { |
| 110 | p << "\"" << JSON::Writer::encode_string(normalizeName(name)) << "\""; | 112 | p << "\"" << JSON::Writer::encode_string(normalizeName(name)) << "\""; |
| 111 | } else { | 113 | } else { |