From 93f93de4489709285971c0a9505653b00bda2ef1 Mon Sep 17 00:00:00 2001 From: Kenneth Geisshirt Date: Fri, 24 Nov 2017 15:06:53 +0100 Subject: [PATCH] localeconv() doesn't exist on Android API < 21. --- CHANGELOG.md | 14 ++++++++++++++ vendor/json.hpp | 14 +++++++------- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 566d66f2..1d691aef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +X.Y.Z Release notes +============================================================= +### Breaking changes +* None. + +### Enchancements +* None + +### Bug fixes +* Fixed a bug in 3rd party JSON parser: `localeconv()` does not exist on Android API < 21 and should not be called. + +### Internal +* None. + 2.0.11 Release notes (2017-11-23) ============================================================= ### Breaking changes diff --git a/vendor/json.hpp b/vendor/json.hpp index b20cc48d..a3e2d380 100644 --- a/vendor/json.hpp +++ b/vendor/json.hpp @@ -8333,15 +8333,15 @@ class basic_json // check if buffer was large enough assert(static_cast(written_bytes) < m_buf.size()); + #if defined(ANDROID) + // Android NDK doesn't have access to locale info yet; API < 21 doesn't have localeconv() + const char thousands_sep = ','; + const char decimal_point = '.'; + #else // read information from locale const auto loc = localeconv(); assert(loc != nullptr); - #if defined(ANDROID) - // Android NDK doesn't have access to locale info yet - const char thousands_sep = ','; - const char decimal_point = '.'; - #else const char thousands_sep = !loc->thousands_sep ? '\0' : loc->thousands_sep[0]; @@ -11176,11 +11176,11 @@ basic_json_parser_74: // since dealing with strtod family of functions, we're // getting the decimal point char from the C locale facilities // instead of C++'s numpunct facet of the current std::locale - const auto loc = localeconv(); - assert(loc != nullptr); #if defined(ANDROID) const char decimal_point_char = '.'; #else + const auto loc = localeconv(); + assert(loc != nullptr); const char decimal_point_char = (loc->decimal_point == nullptr) ? '.' : loc->decimal_point[0]; #endif