From 7daa6b93704a1b267f204fad456fab1463878664 Mon Sep 17 00:00:00 2001 From: Greg Hewgill Date: Mon, 7 Mar 2011 07:50:48 +1300 Subject: [PATCH] Always pass unsigned char to ::isspace to prevent runtime error in MSVC --- lib/preprocessor.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index fd072e33f..7650039e9 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -307,7 +307,13 @@ static bool isFallThroughComment(std::string comment) { // convert comment to lower case without whitespace std::transform(comment.begin(), comment.end(), comment.begin(), ::tolower); - comment.erase(std::remove_if(comment.begin(), comment.end(), ::isspace), comment.end()); + for (std::string::iterator i = comment.begin(); i != comment.end(); ) + { + if (::isspace(static_cast(*i))) + comment.erase(i); + else + ++i; + } return comment.find("fallthr") != std::string::npos || comment.find("fallsthr") != std::string::npos ||