Permalink
Browse files

Fix assertion failure in Visual Studio

isspace() in Visual Studio only accepts 0 ~ 255. However, the char in Visual
Studio is signed char, thus it causes assertion failure when calling isspace().
To prevent it, we must convert char to unsigned char before calling isspace().
  • Loading branch information...
1 parent d09dcb7 commit 80252c176d8ab27afdce9a85469fa6ec13e6a57c @czchen czchen committed Mar 21, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/tools/sort.c
View
2 src/tools/sort.c
@@ -100,7 +100,7 @@ void strip(char *line)
/* remove tailing space */
end = line + strlen(line) - 1;
- while (end >= line && isspace(*end)) {
+ while (end >= line && isspace((unsigned char)*end)) {
*end = 0;
--end;
}

0 comments on commit 80252c1

Please sign in to comment.