mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Fix writing reals with trailing '.' as JSON (fixes #1261)
This commit is contained in:
parent
2856b288e4
commit
7a1ec75ee1
@ -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>
|
2024-07-14 M Holger <m.holger@qpdf.org>
|
||||||
|
|
||||||
* Bug fix: handle named destinations where the entry is a
|
* Bug fix: handle named destinations where the entry is a
|
||||||
|
@ -52,4 +52,7 @@ QPDF_Real::writeJSON(int json_version, JSON::Writer& p)
|
|||||||
} else {
|
} else {
|
||||||
p << this->val;
|
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(".34").getJSON(i), "0.34");
|
||||||
check(QPDFObjectHandle::newReal("-0.56").getJSON(i), "-0.56");
|
check(QPDFObjectHandle::newReal("-0.56").getJSON(i), "-0.56");
|
||||||
check(QPDFObjectHandle::newReal("-.78").getJSON(i), "-0.78");
|
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]})");
|
JSON jmap2 = JSON::parse(R"({"a": 1, "b": "two", "c": [true]})");
|
||||||
std::map<std::string, std::string> dvalue;
|
std::map<std::string, std::string> dvalue;
|
||||||
|
Loading…
Reference in New Issue
Block a user