diff --git a/src/json.hpp b/src/json.hpp index 57a8f4c72..65ced7305 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6078,9 +6078,11 @@ class basic_json { // convert a number 0..15 to its hex representation // (0..f) - auto hexify = [](const char v) -> char + const auto hexify = [](const int v) -> char { - return (v < 10) ? ('0' + v) : ('a' + v - 10); + return (v < 10) + ? ('0' + static_cast(v)) + : ('a' + static_cast(v - 10)); }; // print character c as \uxxxx diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index cdd96ee91..0aa8321e5 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -6078,9 +6078,11 @@ class basic_json { // convert a number 0..15 to its hex representation // (0..f) - auto hexify = [](const char v) -> char + const auto hexify = [](const int v) -> char { - return (v < 10) ? ('0' + v) : ('a' + v - 10); + return (v < 10) + ? ('0' + static_cast(v)) + : ('a' + static_cast(v - 10)); }; // print character c as \uxxxx