diff --git a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp index be9ff1440c0..560589c3602 100644 --- a/src/hotspot/os/linux/cgroupSubsystem_linux.cpp +++ b/src/hotspot/os/linux/cgroupSubsystem_linux.cpp @@ -661,7 +661,7 @@ bool CgroupController::read_numerical_key_value(const char* filename, const char for (; line != nullptr; line = fgets(buf, buf_len, fp)) { char after_key = line[key_len]; if (strncmp(line, key, key_len) == 0 - && isspace(after_key) != 0 + && isspace((unsigned char) after_key) != 0 && after_key != '\n') { // Skip key, skip space const char* value_substr = line + key_len + 1; diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 00ee3519301..b56d4082354 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -1356,7 +1356,7 @@ void os::Linux::capture_initial_stack(size_t max_size) { i = 0; if (s) { // Skip blank chars - do { s++; } while (s && isspace(*s)); + do { s++; } while (s && isspace((unsigned char) *s)); #define _UFM UINTX_FORMAT #define _DFM INTX_FORMAT @@ -5222,7 +5222,7 @@ static jlong slow_thread_cpu_time(Thread *thread, bool user_sys_cpu_time) { if (s == nullptr) return -1; // Skip blank chars - do { s++; } while (s && isspace(*s)); + do { s++; } while (s && isspace((unsigned char) *s)); count = sscanf(s,"%c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu", &cdummy, &idummy, &idummy, &idummy, &idummy, &idummy, diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 10a4c06d53c..5f89384ba66 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -748,7 +748,7 @@ static bool set_bool_flag(JVMFlag* flag, bool value, JVMFlagOrigin origin) { static bool set_fp_numeric_flag(JVMFlag* flag, const char* value, JVMFlagOrigin origin) { // strtod allows leading whitespace, but our flag format does not. - if (*value == '\0' || isspace(*value)) { + if (*value == '\0' || isspace((unsigned char) *value)) { return false; } char* end; @@ -1178,13 +1178,13 @@ bool Arguments::process_settings_file(const char* file_name, bool should_exist, if (c == '\n') in_comment = false; } else { if (c == '#') in_comment = true; - else if (!isspace(c)) { + else if (!isspace((unsigned char) c)) { in_white_space = false; token[pos++] = checked_cast(c); } } } else { - if (c == '\n' || (!in_quote && isspace(c))) { + if (c == '\n' || (!in_quote && isspace((unsigned char) c))) { // token ends at newline, or at unquoted whitespace // this allows a way to include spaces in string-valued options token[pos] = '\0'; @@ -3141,7 +3141,7 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_ // parse all options while (rd < buffer_end) { // skip leading white space from the input string - while (rd < buffer_end && isspace(*rd)) { + while (rd < buffer_end && isspace((unsigned char) *rd)) { rd++; } @@ -3154,7 +3154,7 @@ jint Arguments::parse_options_buffer(const char* name, char* buffer, const size_ // Tokens are strings of non white space characters separated // by one or more white spaces. - while (rd < buffer_end && !isspace(*rd)) { + while (rd < buffer_end && !isspace((unsigned char) *rd)) { if (*rd == '\'' || *rd == '"') { // handle a quoted string int quote = *rd; // matching quote to look for rd++; // don't copy open quote diff --git a/src/hotspot/share/services/diagnosticFramework.cpp b/src/hotspot/share/services/diagnosticFramework.cpp index 006c08cb63f..984122f2777 100644 --- a/src/hotspot/share/services/diagnosticFramework.cpp +++ b/src/hotspot/share/services/diagnosticFramework.cpp @@ -45,7 +45,7 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) line_end = &line[len]; // Skip whitespace in the beginning of the line. - while (_cmd < line_end && isspace((int) _cmd[0])) { + while (_cmd < line_end && isspace((unsigned char) _cmd[0])) { _cmd++; } cmd_end = _cmd; @@ -55,7 +55,7 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) _cmd_len = 0; } else { // Look for end of the command name - while (cmd_end < line_end && !isspace((int) cmd_end[0])) { + while (cmd_end < line_end && !isspace((unsigned char) cmd_end[0])) { cmd_end++; } _cmd_len = cmd_end - _cmd; diff --git a/src/java.base/share/native/libjli/args.c b/src/java.base/share/native/libjli/args.c index 379291fe8ec..1e9b48730a9 100644 --- a/src/java.base/share/native/libjli/args.c +++ b/src/java.base/share/native/libjli/args.c @@ -501,7 +501,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) { // This is retained until the process terminates as it is saved as the args p = JLI_MemAlloc(JLI_StrLen(str) + 1); while (*str != '\0') { - while (*str != '\0' && isspace(*str)) { + while (*str != '\0' && isspace((unsigned char) *str)) { str++; } @@ -511,7 +511,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) { } arg = p; - while (*str != '\0' && !isspace(*str)) { + while (*str != '\0' && !isspace((unsigned char) *str)) { if (inEnvVar && (*str == '"' || *str == '\'')) { quote = *str++; while (*str != quote && *str != '\0') { @@ -577,7 +577,7 @@ static jboolean expand(JLI_List args, const char *str, const char *var_name) { exit(1); } - assert (*str == '\0' || isspace(*str)); + assert (*str == '\0' || isspace((unsigned char) *str)); } return JNI_TRUE; diff --git a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c index 3068f475626..41207b5a9df 100644 --- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c +++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_proc.c @@ -242,7 +242,7 @@ static bool process_doesnt_exist(pid_t pid) { found_state = true; state = buf + state_len; // Skip the spaces - while (isspace(*state)) { + while (isspace((unsigned char) *state)) { state++; } // A state value of 'X' indicates that the thread is dead. 'Z' diff --git a/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c b/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c index a694bba93c4..a0f2687a88c 100644 --- a/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c +++ b/src/jdk.jdwp.agent/unix/native/libjdwp/exec_md.c @@ -35,14 +35,14 @@ #include "error_messages.h" static char *skipWhitespace(char *p) { - while ((*p != '\0') && isspace(*p)) { + while ((*p != '\0') && isspace((unsigned char) *p)) { p++; } return p; } static char *skipNonWhitespace(char *p) { - while ((*p != '\0') && !isspace(*p)) { + while ((*p != '\0') && !isspace((unsigned char) *p)) { p++; } return p; diff --git a/src/jdk.jpackage/share/native/common/ErrorHandling.cpp b/src/jdk.jpackage/share/native/common/ErrorHandling.cpp index b3f7206bfc1..a3a4c2a9dfe 100644 --- a/src/jdk.jpackage/share/native/common/ErrorHandling.cpp +++ b/src/jdk.jpackage/share/native/common/ErrorHandling.cpp @@ -72,7 +72,7 @@ std::string makeMessage(const std::runtime_error& e, const SourceCodePos& pos) { namespace { bool isNotSpace(int chr) { - return isspace(chr) == 0; + return isspace((unsigned char) chr) == 0; }