diff --git a/src/json.hpp b/src/json.hpp index ed96c49b4..72e9ef065 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6267,10 +6267,7 @@ class basic_json // remove '+' sign from the exponent if necessary if (not m_type.bits.exp_plus) { - if (len > static_cast(sizeof(buf))) - { - len = sizeof(buf); - } + len = std::min(len, static_cast(sizeof(buf))); for (int i = 0; i < len; i++) { if (buf[i] == '+') diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 1a986f1ad..5fc8c0413 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -6267,10 +6267,7 @@ class basic_json // remove '+' sign from the exponent if necessary if (not m_type.bits.exp_plus) { - if (len > static_cast(sizeof(buf))) - { - len = sizeof(buf); - } + len = std::min(len, static_cast(sizeof(buf))); for (int i = 0; i < len; i++) { if (buf[i] == '+')