Skip to content

Commit

Permalink
MSYS|libcore|Legacy: Fixed warnings about char subscripts
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Aug 7, 2021
1 parent 8a2d5c1 commit db4bb26
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions doomsday/libs/core/src/filesys/nativefile.cpp
Expand Up @@ -26,6 +26,7 @@
#include <the_Foundation/thread.h> // debug prints
#include <iostream>
#include <deque>
#include <atomic>

namespace de {

Expand Down
8 changes: 4 additions & 4 deletions doomsday/libs/core/src/legacy/str.c
Expand Up @@ -487,7 +487,7 @@ ddstring_t *Str_StripLeft2(ddstring_t *str, int *count)
num = 0;
while (i < (int)str->length && !isDone)
{
if (isspace(str->str[i]))
if (isspace((int)str->str[i]))
{
num++;
i++;
Expand Down Expand Up @@ -528,14 +528,14 @@ ddstring_t *Str_StripRight2(ddstring_t *str, int *count)

i = str->length - 1;
num = 0;
if (isspace(str->str[i]))
if (isspace((int)str->str[i]))
do
{
// Remove this char.
num++;
str->str[i] = '\0';
str->length--;
} while (i != 0 && isspace(str->str[--i]));
} while (i != 0 && isspace((int)str->str[--i]));

if (count) *count = num;
return str;
Expand Down Expand Up @@ -645,7 +645,7 @@ char const *Str_CopyDelim2(ddstring_t *str, char const *src, char delimiter, int
ddstring_t buf; Str_Init(&buf);
for (cursor = src; *cursor && *cursor != delimiter; ++cursor)
{
if ((cdflags & CDF_OMIT_WHITESPACE) && isspace(*cursor))
if ((cdflags & CDF_OMIT_WHITESPACE) && isspace((int)*cursor))
continue;
Str_PartAppend(&buf, cursor, 0, 1);
}
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/core/src/legacy/strutil.c
Expand Up @@ -109,7 +109,7 @@ void M_StripLeft(char* str)
len = strlen(str);
// Count leading whitespace characters.
num = 0;
while (num < len && isspace(str[num]))
while (num < len && isspace((int)str[num]))
++num;
if (0 == num) return;

Expand All @@ -125,7 +125,7 @@ void M_StripRight(char* str, size_t len)
if (NULL == str || 0 == len) return;

end = str + strlen(str) - 1;
while (end >= str && isspace(*end))
while (end >= str && isspace((int)*end))
{
end--;
numZeroed++;
Expand Down

0 comments on commit db4bb26

Please sign in to comment.