From 0edc80bf9b7622866e752258dba66fbfa53e151a Mon Sep 17 00:00:00 2001 From: su8 Date: Tue, 14 Aug 2018 12:07:16 +0000 Subject: [PATCH] Arguments to character-handling functions must be representable as an unsigned char --- src/conky.cc | 2 +- src/core.cc | 2 +- src/libmpdclient.cc | 4 ++-- src/proc.cc | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/conky.cc b/src/conky.cc index 52422ce5..73a8f34f 100644 --- a/src/conky.cc +++ b/src/conky.cc @@ -951,7 +951,7 @@ static void generate_text() { tmp_p = text_buffer; while (*tmp_p != 0) { - *tmp_p = toupper(*tmp_p); + *tmp_p = toupper((unsigned char)*tmp_p); tmp_p++; } } diff --git a/src/core.cc b/src/core.cc index 5217f94a..7a438b2e 100644 --- a/src/core.cc +++ b/src/core.cc @@ -2076,7 +2076,7 @@ int extract_variable_text_internal(struct text_object *retval, /* lowercase variable name */ tmp_p = buf; while (*tmp_p != 0) { - *tmp_p = tolower(*tmp_p); + *tmp_p = tolower((unsigned char)*tmp_p); tmp_p++; } diff --git a/src/libmpdclient.cc b/src/libmpdclient.cc index ab729d89..299609f1 100644 --- a/src/libmpdclient.cc +++ b/src/libmpdclient.cc @@ -1876,7 +1876,7 @@ void mpd_startFieldSearch(mpd_Connection *connection, int type) { len = 5 + strlen(strtype) + 1; connection->request = static_cast(malloc(len)); - snprintf(connection->request, len, "list %c%s", tolower(strtype[0]), + snprintf(connection->request, len, "list %c%s", tolower((unsigned char)strtype[0]), strtype + 1); } @@ -1914,7 +1914,7 @@ void mpd_addConstraintSearch(mpd_Connection *connection, int type, len = strlen(string) + 1 + strlen(strtype) + 2 + strlen(arg) + 2; connection->request = static_cast(realloc(connection->request, len)); snprintf(connection->request, len, "%s %c%s \"%s\"", string, - tolower(strtype[0]), strtype + 1, arg); + tolower((unsigned char)strtype[0]), strtype + 1, arg); free(string); free(arg); diff --git a/src/proc.cc b/src/proc.cc index 666ee2e1..e6d80068 100644 --- a/src/proc.cc +++ b/src/proc.cc @@ -168,7 +168,7 @@ void print_pid_environ(struct text_object *obj, char *p, unsigned int p_max_size generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub); if (sscanf(objbuf.get(), "%d %s", &pid, var) == 2) { for (i = 0; var[i] != 0; i++) { - var[i] = toupper(var[i]); + var[i] = toupper((unsigned char)var[i]); } pathstream << PROCDIR "/" << pid << "/cwd"; buf = readfile(pathstream.str().c_str(), &total_read, 1);