Commit 7a1ec75ee1010942c873258fb7a786e677dee9df
1 parent
2856b288
Fix writing reals with trailing '.' as JSON (fixes #1261)
Showing
3 changed files
with
9 additions
and
0 deletions
ChangeLog
| 1 | +2024-08-06 M Holger <m.holger@qpdf.org> | ||
| 2 | + | ||
| 3 | + * Bug fix: when writing real numbers as JSON ensure that they don't | ||
| 4 | + have a trailing decimal point. Fixes #1261. | ||
| 5 | + | ||
| 1 | 2024-07-14 M Holger <m.holger@qpdf.org> | 6 | 2024-07-14 M Holger <m.holger@qpdf.org> |
| 2 | 7 | ||
| 3 | * Bug fix: handle named destinations where the entry is a | 8 | * Bug fix: handle named destinations where the entry is a |
libqpdf/QPDF_Real.cc
libtests/json.cc
| @@ -111,6 +111,7 @@ test_main() | @@ -111,6 +111,7 @@ test_main() | ||
| 111 | check(QPDFObjectHandle::newReal(".34").getJSON(i), "0.34"); | 111 | check(QPDFObjectHandle::newReal(".34").getJSON(i), "0.34"); |
| 112 | check(QPDFObjectHandle::newReal("-0.56").getJSON(i), "-0.56"); | 112 | check(QPDFObjectHandle::newReal("-0.56").getJSON(i), "-0.56"); |
| 113 | check(QPDFObjectHandle::newReal("-.78").getJSON(i), "-0.78"); | 113 | check(QPDFObjectHandle::newReal("-.78").getJSON(i), "-0.78"); |
| 114 | + check(QPDFObjectHandle::newReal("-78.").getJSON(i), "-78.0"); | ||
| 114 | } | 115 | } |
| 115 | JSON jmap2 = JSON::parse(R"({"a": 1, "b": "two", "c": [true]})"); | 116 | JSON jmap2 = JSON::parse(R"({"a": 1, "b": "two", "c": [true]})"); |
| 116 | std::map<std::string, std::string> dvalue; | 117 | std::map<std::string, std::string> dvalue; |