From 09ab3efddd5483e64af5d374631048ec8352944e Mon Sep 17 00:00:00 2001 From: hexkyz Date: Mon, 1 Jul 2019 20:29:43 +0100 Subject: [PATCH] Fix argument type for isspace --- sept/sept-secondary/src/lib/vsprintf.c | 10 +++++----- .../ams_mitm/source/set_mitm/setsys_settings_items.cpp | 2 +- stratosphere/dmnt/source/dmnt_cheat_manager.cpp | 8 ++++---- thermosphere/src/lib/vsprintf.c | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sept/sept-secondary/src/lib/vsprintf.c b/sept/sept-secondary/src/lib/vsprintf.c index 7927c83a2..e0393f4c0 100644 --- a/sept/sept-secondary/src/lib/vsprintf.c +++ b/sept/sept-secondary/src/lib/vsprintf.c @@ -71,7 +71,7 @@ static inline char *pack_hex_byte(char *buf, uint8_t byte) */ static char *skip_spaces(const char *str) { - while (isspace(*str)) + while (isspace((unsigned char)*str)) ++str; return (char *)str; } @@ -1456,7 +1456,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) /* white space in format matchs any amount of * white space, including none, in the input. */ - if (isspace(*fmt)) { + if (isspace((unsigned char)*fmt)) { fmt = skip_spaces(++fmt); str = skip_spaces(str); } @@ -1476,9 +1476,9 @@ int vsscanf(const char *buf, const char *fmt, va_list args) * advance both strings to next white space */ if (*fmt == '*') { - while (!isspace(*fmt) && *fmt != '%' && *fmt) + while (!isspace((unsigned char)*fmt) && *fmt != '%' && *fmt) fmt++; - while (!isspace(*str) && *str) + while (!isspace((unsigned char)*str) && *str) str++; continue; } @@ -1531,7 +1531,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) str = skip_spaces(str); /* now copy until next white space */ - while (*str && !isspace(*str) && field_width--) + while (*str && !isspace((unsigned char)*str) && field_width--) *s++ = *str++; *s = '\0'; num++; diff --git a/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp b/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp index 34a00ce5b..4f2cff9f6 100644 --- a/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp +++ b/stratosphere/ams_mitm/source/set_mitm/setsys_settings_items.cpp @@ -141,7 +141,7 @@ static Result ParseValue(const char *name, const char *key, const char *val_tup) return ResultSettingsItemValueInvalidFormat; } - while (isspace(*type) && type != delimiter) { + while (isspace((unsigned char)*type) && type != delimiter) { type++; } diff --git a/stratosphere/dmnt/source/dmnt_cheat_manager.cpp b/stratosphere/dmnt/source/dmnt_cheat_manager.cpp index aaa1ee41c..3441b393b 100644 --- a/stratosphere/dmnt/source/dmnt_cheat_manager.cpp +++ b/stratosphere/dmnt/source/dmnt_cheat_manager.cpp @@ -298,7 +298,7 @@ bool DmntCheatManager::ParseCheats(const char *s, size_t len) { g_needs_reload_vm_program = true; while (i < len) { - if (isspace(s[i])) { + if (isspace((unsigned char)s[i])) { /* Just ignore space. */ i++; } else if (s[i] == '[') { @@ -445,7 +445,7 @@ bool DmntCheatManager::ParseCheatToggles(const char *s, size_t len) { char toggle[8]; while (i < len) { - if (isspace(s[i])) { + if (isspace((unsigned char)s[i])) { /* Just ignore space. */ i++; } else if (s[i] == '[') { @@ -468,13 +468,13 @@ bool DmntCheatManager::ParseCheatToggles(const char *s, size_t len) { i = j + 1; /* Skip whitespace. */ - while (isspace(s[i])) { + while (isspace((unsigned char)s[i])) { i++; } /* Parse whether to toggle. */ j = i + 1; - while (!isspace(s[j])) { + while (!isspace((unsigned char)s[j])) { j++; if (j >= len || (j - i) >= sizeof(toggle)) { return false; diff --git a/thermosphere/src/lib/vsprintf.c b/thermosphere/src/lib/vsprintf.c index 7927c83a2..e0393f4c0 100644 --- a/thermosphere/src/lib/vsprintf.c +++ b/thermosphere/src/lib/vsprintf.c @@ -71,7 +71,7 @@ static inline char *pack_hex_byte(char *buf, uint8_t byte) */ static char *skip_spaces(const char *str) { - while (isspace(*str)) + while (isspace((unsigned char)*str)) ++str; return (char *)str; } @@ -1456,7 +1456,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) /* white space in format matchs any amount of * white space, including none, in the input. */ - if (isspace(*fmt)) { + if (isspace((unsigned char)*fmt)) { fmt = skip_spaces(++fmt); str = skip_spaces(str); } @@ -1476,9 +1476,9 @@ int vsscanf(const char *buf, const char *fmt, va_list args) * advance both strings to next white space */ if (*fmt == '*') { - while (!isspace(*fmt) && *fmt != '%' && *fmt) + while (!isspace((unsigned char)*fmt) && *fmt != '%' && *fmt) fmt++; - while (!isspace(*str) && *str) + while (!isspace((unsigned char)*str) && *str) str++; continue; } @@ -1531,7 +1531,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args) str = skip_spaces(str); /* now copy until next white space */ - while (*str && !isspace(*str) && field_width--) + while (*str && !isspace((unsigned char)*str) && field_width--) *s++ = *str++; *s = '\0'; num++;