Commit 33b639a0df142f9f405878774cb15a8927a9e013

Authored by m-holger
Committed by GitHub
2 parents 0cf109a0 e1ea18bd

Merge pull request #1370 from m-holger/js

Tune JSON::JSON_string
include/qpdf/JSON.hh
... ... @@ -329,7 +329,6 @@ class JSON
329 329 ~JSON_string() override = default;
330 330 void write(Pipeline*, size_t depth) const override;
331 331 std::string utf8;
332   - std::string encoded;
333 332 };
334 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 120  
121 121 JSON::JSON_string::JSON_string(std::string const& utf8) :
122 122 JSON_value(vt_string),
123   - utf8(utf8),
124   - encoded(Writer::encode_string(utf8))
  123 + utf8(utf8)
125 124 {
126 125 }
127 126  
128 127 void
129 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 133 JSON::JSON_number::JSON_number(long long value) :
... ...