From b0784ae25ed90652fc6bf17b3b64f6dc290b741f Mon Sep 17 00:00:00 2001 From: PushpadantK Date: Fri, 3 Apr 2026 14:34:45 -0700 Subject: [PATCH] fix build break in PSX for iswspace --- Include/json_cpp/details/json_parsing.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Include/json_cpp/details/json_parsing.hpp b/Include/json_cpp/details/json_parsing.hpp index e465eebb8..2d56eb5fd 100644 --- a/Include/json_cpp/details/json_parsing.hpp +++ b/Include/json_cpp/details/json_parsing.hpp @@ -11,8 +11,11 @@ * =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- ****/ +#include #include #include +#include +#include #include "../json.h" #if defined(_MSC_VER) @@ -198,6 +201,17 @@ typename std::char_traits::int_type eof() return std::char_traits::eof(); } +template +bool is_whitespace_character(typename std::char_traits::int_type ch) +{ + if constexpr (std::is_same::value) + { + return std::iswspace(static_cast(ch)) != 0; + } + + return std::isspace(static_cast(ch)) != 0; +} + template class JSON_StreamParser : public JSON_Parser { @@ -305,7 +319,7 @@ typename JSON_Parser::int_type JSON_Parser::EatWhitespace() { auto ch = NextCharacter(); - while ( ch != eof() && iswspace(static_cast(ch))) + while ( ch != eof() && is_whitespace_character(ch)) { ch = NextCharacter(); }