Commit 33b639a0df142f9f405878774cb15a8927a9e013
Committed by
GitHub
Merge pull request #1370 from m-holger/js
Tune JSON::JSON_string
Showing
2 changed files
with
2 additions
and
4 deletions
include/qpdf/JSON.hh
| @@ -329,7 +329,6 @@ class JSON | @@ -329,7 +329,6 @@ class JSON | ||
| 329 | ~JSON_string() override = default; | 329 | ~JSON_string() override = default; |
| 330 | void write(Pipeline*, size_t depth) const override; | 330 | void write(Pipeline*, size_t depth) const override; |
| 331 | std::string utf8; | 331 | std::string utf8; |
| 332 | - std::string encoded; | ||
| 333 | }; | 332 | }; |
| 334 | struct JSON_number: public JSON_value | 333 | struct JSON_number: public JSON_value |
| 335 | { | 334 | { |
libqpdf/JSON.cc
| @@ -120,15 +120,14 @@ JSON::JSON_array::write(Pipeline* p, size_t depth) const | @@ -120,15 +120,14 @@ JSON::JSON_array::write(Pipeline* p, size_t depth) const | ||
| 120 | 120 | ||
| 121 | JSON::JSON_string::JSON_string(std::string const& utf8) : | 121 | JSON::JSON_string::JSON_string(std::string const& utf8) : |
| 122 | JSON_value(vt_string), | 122 | JSON_value(vt_string), |
| 123 | - utf8(utf8), | ||
| 124 | - encoded(Writer::encode_string(utf8)) | 123 | + utf8(utf8) |
| 125 | { | 124 | { |
| 126 | } | 125 | } |
| 127 | 126 | ||
| 128 | void | 127 | void |
| 129 | JSON::JSON_string::write(Pipeline* p, size_t) const | 128 | JSON::JSON_string::write(Pipeline* p, size_t) const |
| 130 | { | 129 | { |
| 131 | - *p << std::string("\"") + encoded + "\""; | 130 | + *p << std::string("\"") + Writer::encode_string(utf8) + "\""; |
| 132 | } | 131 | } |
| 133 | 132 | ||
| 134 | JSON::JSON_number::JSON_number(long long value) : | 133 | JSON::JSON_number::JSON_number(long long value) : |