mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 10:58:58 +00:00
Merge pull request #1262 from m-holger/i1261
Fix writing reals with trailing '.' as JSON (fixes #1261)
This commit is contained in:
commit
77d1a0cf24
@ -1,3 +1,8 @@
|
||||
2024-08-06 M Holger <m.holger@qpdf.org>
|
||||
|
||||
* Bug fix: when writing real numbers as JSON ensure that they don't
|
||||
have a trailing decimal point. Fixes #1261.
|
||||
|
||||
2024-07-14 M Holger <m.holger@qpdf.org>
|
||||
|
||||
* Bug fix: handle named destinations where the entry is a
|
||||
|
@ -52,4 +52,7 @@ QPDF_Real::writeJSON(int json_version, JSON::Writer& p)
|
||||
} else {
|
||||
p << this->val;
|
||||
}
|
||||
if (val.back() == '.') {
|
||||
p << "0";
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ test_main()
|
||||
check(QPDFObjectHandle::newReal(".34").getJSON(i), "0.34");
|
||||
check(QPDFObjectHandle::newReal("-0.56").getJSON(i), "-0.56");
|
||||
check(QPDFObjectHandle::newReal("-.78").getJSON(i), "-0.78");
|
||||
check(QPDFObjectHandle::newReal("-78.").getJSON(i), "-78.0");
|
||||
}
|
||||
JSON jmap2 = JSON::parse(R"({"a": 1, "b": "two", "c": [true]})");
|
||||
std::map<std::string, std::string> dvalue;
|
||||
|
Loading…
Reference in New Issue
Block a user