mirror of
https://github.com/nlohmann/json.git
synced 2026-10-14 10:17:12 +00:00
Use data() instead of c_str() in the multi-byte decimal point path
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
a9b0e6b843
commit
af711143a0
2 files changed
+4
-4
No files matched your search
@@ -986,8 +986,8 @@ void convert_float_locale_aware(StringType& token, std::size_t decimal_point_pos
|
|||||||
{
|
{
|
||||||
std::string buffer(token.data(), token.size());
|
std::string buffer(token.data(), token.size());
|
||||||
buffer.replace(decimal_point_position, 1, decimal_point);
|
buffer.replace(decimal_point_position, 1, decimal_point);
|
||||||
strtof_by_type(value, buffer.c_str(), &endptr);
|
strtof_by_type(value, buffer.data(), &endptr);
|
||||||
complete = endptr == buffer.c_str() + buffer.size();
|
complete = endptr == buffer.data() + buffer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JSON_HEDLEY_LIKELY(complete))
|
if (JSON_HEDLEY_LIKELY(complete))
|
||||||
|
|||||||
Generated
+2
-2
@@ -10432,8 +10432,8 @@ void convert_float_locale_aware(StringType& token, std::size_t decimal_point_pos
|
|||||||
{
|
{
|
||||||
std::string buffer(token.data(), token.size());
|
std::string buffer(token.data(), token.size());
|
||||||
buffer.replace(decimal_point_position, 1, decimal_point);
|
buffer.replace(decimal_point_position, 1, decimal_point);
|
||||||
strtof_by_type(value, buffer.c_str(), &endptr);
|
strtof_by_type(value, buffer.data(), &endptr);
|
||||||
complete = endptr == buffer.c_str() + buffer.size();
|
complete = endptr == buffer.data() + buffer.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (JSON_HEDLEY_LIKELY(complete))
|
if (JSON_HEDLEY_LIKELY(complete))
|
||||||
|
|||||||
Reference in new issue
Block a user