Skip to content
Permalink
Browse files
Avoid char index warning by casting to int
  • Loading branch information
uyjulian committed Jun 11, 2021
1 parent e7756f8 commit cde9b0a888019c3823fad2ce58fd60e2f85278ae
Showing with 12 additions and 12 deletions.
  1. +7 −7 src/cheatman.c
  2. +1 −1 src/opl.c
  3. +4 −4 src/ps2cnf.c
@@ -75,7 +75,7 @@ static code_t make_code(const char *s)
int i = 0;

while (*s) {
if (isxdigit(*s))
if (isxdigit((int)*s))
digits[i++] = *s;
s++;
}
@@ -99,10 +99,10 @@ static int is_cheat_code(const char *s)
int i = 0;

while (*s) {
if (isxdigit(*s)) {
if (isxdigit((int)*s)) {
if (++i > CODE_DIGITS)
return 0;
} else if (!isspace(*s)) {
} else if (!isspace((int)*s)) {
return 0;
}
s++;
@@ -178,7 +178,7 @@ static int is_empty_str(const char *s)
size_t slen = strlen(s);

while (slen--) {
if (isgraph(*s++))
if (isgraph((int)*s++))
return 0;
}

@@ -200,13 +200,13 @@ static int trim_str(char *s)
return -1;

/* Get first non-space char */
while (isspace(*t++))
while (isspace((int)*t++))
first++;

/* Get last non-space char */
last = strlen(s) - 1;
t = &s[last];
while (isspace(*t--))
while (isspace((int)*t--))
last--;

/* Kill leading/trailing spaces */
@@ -224,7 +224,7 @@ static int trim_str(char *s)
static int is_empty_substr(const char *s, size_t count)
{
while (count--) {
if (isgraph(*s++))
if (isgraph((int)*s++))
return 0;
}

@@ -401,7 +401,7 @@ int oplPath2Mode(const char *path)
if (blkdevnameend != NULL) {
blkdevnamelen = (int)(blkdevnameend - appsPath);

while ((blkdevnamelen > 0) && isdigit(appsPath[blkdevnamelen - 1]))
while ((blkdevnamelen > 0) && isdigit((int)appsPath[blkdevnamelen - 1]))
blkdevnamelen--; //Ignore the unit number.

if (strncmp(path, appsPath, blkdevnamelen) == 0)
@@ -15,7 +15,7 @@

static const char *CNFGetToken(const char *cnf, const char *key)
{
for (; isspace(*cnf); cnf++) {
for (; isspace((int)*cnf); cnf++) {
}

for (; *key != '\0'; key++, cnf++) {
@@ -45,19 +45,19 @@ static const char *CNFGetKey(const char *line, char *key)
int i;

//Skip leading whitespace
for (; isspace(*line); line++) {
for (; isspace((int)*line); line++) {
}

if (*line == '\0') { //Unexpected end of file
return (const char *)-1;
}

for (i = 0; i < CNF_PATH_LEN_MAX && *line != '\0'; i++) {
if (isgraph(*line)) {
if (isgraph((int)*line)) {
*key = *line;
line++;
key++;
} else if (isspace(*line)) {
} else if (isspace((int)*line)) {
*key = '\0';
break;
} else if (*line == '\0') { //Unexpected end of file. This check exists, along with the other similar check above.

0 comments on commit cde9b0a

Please sign in to comment.