From 02836b3c3f6aec8216c1c5a03f8a4b6c9e50b7ee Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 11 Mar 2019 00:26:37 +0100 Subject: [PATCH] - fixed: The command line parser of the console was incapable of handling non-ASCII characters. --- src/c_dispatch.cpp | 6 +++--- src/utility/zstring.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/c_dispatch.cpp b/src/c_dispatch.cpp index a826216fc..abd851b35 100644 --- a/src/c_dispatch.cpp +++ b/src/c_dispatch.cpp @@ -563,7 +563,7 @@ void C_DoCommand (const char *cmd, int keynum) const char *beg; // Skip any beginning whitespace - while (*cmd && *cmd <= ' ') + while (*cmd > 0 && *cmd <= ' ') cmd++; // Find end of the command name @@ -575,7 +575,7 @@ void C_DoCommand (const char *cmd, int keynum) else { beg = cmd; - for (end = cmd+1; *end > ' '; ++end) + for (end = cmd+1; *end > ' ' || *end < 0; ++end) ; } @@ -728,7 +728,7 @@ void AddCommandString (const char *text, int keynum) more = 0; } // Intercept wait commands here. Note: wait must be lowercase - while (*cmd && *cmd <= ' ') + while (*cmd > 0 && *cmd <= ' ') cmd++; if (*cmd) { diff --git a/src/utility/zstring.cpp b/src/utility/zstring.cpp index 51c3a1ffe..c3863387e 100644 --- a/src/utility/zstring.cpp +++ b/src/utility/zstring.cpp @@ -828,12 +828,12 @@ void FString::StripLeftRight () if (max == 0) return; for (i = 0; i < max; ++i) { - if (!isspace((unsigned char)Chars[i])) + if (Chars[i] < 0 || !isspace((unsigned char)Chars[i])) break; } for (j = max - 1; j >= i; --j) { - if (!isspace((unsigned char)Chars[j])) + if (Chars[i] < 0 || !isspace((unsigned char)Chars[j])) break; } if (i == 0 && j == max - 1)