From 23051df2c71dd3f9698e01de3cbfab0034c6e50e Mon Sep 17 00:00:00 2001 From: Tobias Kux Date: Wed, 27 May 2020 13:15:31 +0200 Subject: [PATCH] Cast character to unsigned for comparison --- include/nlohmann/detail/input/lexer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index 4a36ab06..cf38a813 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1367,7 +1367,7 @@ scan_number_done: std::string result; for (const auto c : token_string) { - if ('\x00' <= c and c <= '\x1F') + if (static_cast(c) <= '\x1F') { // escape control characters std::array cs{{}}; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 70ce011a..38e51596 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -9456,7 +9456,7 @@ scan_number_done: std::string result; for (const auto c : token_string) { - if ('\x00' <= c and c <= '\x1F') + if (static_cast(c) <= '\x1F') { // escape control characters std::array cs{{}};