diff --git a/DEPENDENCIES b/DEPENDENCIES index 2ebc5351..a8795d7c 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,3 +1,3 @@ vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02 -core https://github.com/sourcemeta/core 63f8b0fc592fc78694ae59e0b6cbdf009a65b135 +core https://github.com/sourcemeta/core 56eab6ef118e9731df539d3a507db1c23241f911 jsonschema-test-suite https://github.com/json-schema-org/JSON-Schema-Test-Suite 06481b143722c8c06671bd40dcde99b422ffd531 diff --git a/vendor/core/src/core/json/stringify.h b/vendor/core/src/core/json/stringify.h index d3b03d33..77c91a2e 100644 --- a/vendor/core/src/core/json/stringify.h +++ b/vendor/core/src/core/json/stringify.h @@ -6,6 +6,9 @@ #include "grammar.h" #include // std::transform, std::sort +#include // std::array +#include // assert +#include // std::to_chars #include // std::size_t #include // std::int64_t #include // std::setprecision @@ -82,11 +85,12 @@ auto stringify( stream.flags(flags); stream.precision(precision); } else { - const auto flags{stream.flags()}; - const auto precision{stream.precision()}; - stream << std::noshowpoint << value; - stream.flags(flags); - stream.precision(precision); + std::array buffer{}; + const auto result{ + std::to_chars(buffer.data(), buffer.data() + buffer.size(), value)}; + // This can't realistically happen on production given the buffer size + assert(result.ec == std::errc{}); + stream.write(buffer.data(), result.ptr - buffer.data()); } }