nlohmann JSON: don't use std::snprintf

libintl.h defines a preprocessor define for `snprintf` with the
content of `libintl_snprintf` if the C library isn't GNU's
glibc. Therefore `std::snprintf` actually becomes
`std::libintl_snprintf` which doesn't exist. This affects e.g. mingw
and macOS.
This commit is contained in:
Moritz Bunkus 2018-06-08 23:11:53 +02:00
parent bc12006391
commit 21d09d4bcd
No known key found for this signature in database
GPG Key ID: 74AF00ADF2E32C85

View File

@ -354,15 +354,15 @@ class serializer
{
if (codepoint <= 0xFFFF)
{
std::snprintf(string_buffer.data() + bytes, 7, "\\u%04x",
static_cast<uint16_t>(codepoint));
::snprintf(string_buffer.data() + bytes, 7, "\\u%04x",
static_cast<uint16_t>(codepoint));
bytes += 6;
}
else
{
std::snprintf(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x",
static_cast<uint16_t>(0xD7C0 + (codepoint >> 10)),
static_cast<uint16_t>(0xDC00 + (codepoint & 0x3FF)));
::snprintf(string_buffer.data() + bytes, 13, "\\u%04x\\u%04x",
static_cast<uint16_t>(0xD7C0 + (codepoint >> 10)),
static_cast<uint16_t>(0xDC00 + (codepoint & 0x3FF)));
bytes += 12;
}
}