Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Merged r2979:2980 from branches/SDL-1.2: unsigned char in ctype funcs.
  • Loading branch information
icculus committed Feb 15, 2007
1 parent bf7e800 commit c05c966
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/stdlib/SDL_string.c
Expand Up @@ -46,7 +46,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep)
}
for (;;) {
int v;
if (SDL_isdigit(*text)) {
if (SDL_isdigit((unsigned char) *text)) {
v = *text - '0';
} else if (radix == 16 && SDL_isupperhex(*text)) {
v = 10 + (*text - 'A');
Expand Down Expand Up @@ -82,7 +82,7 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep)
}
for (;;) {
int v;
if (SDL_isdigit(*text)) {
if (SDL_isdigit((unsigned char) *text)) {
v = *text - '0';
} else if (radix == 16 && SDL_isupperhex(*text)) {
v = 10 + (*text - 'A');
Expand Down Expand Up @@ -114,7 +114,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep)
}
for (;;) {
int v;
if (SDL_isdigit(*text)) {
if (SDL_isdigit((unsigned char) *text)) {
v = *text - '0';
} else if (radix == 16 && SDL_isupperhex(*text)) {
v = 10 + (*text - 'A');
Expand Down Expand Up @@ -152,7 +152,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep)
}
for (;;) {
int v;
if (SDL_isdigit(*text)) {
if (SDL_isdigit((unsigned char) *text)) {
v = *text - '0';
} else if (radix == 16 && SDL_isupperhex(*text)) {
v = 10 + (*text - 'A');
Expand Down Expand Up @@ -188,7 +188,7 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep)
}
for (;;) {
int v;
if (SDL_isdigit(*text)) {
if (SDL_isdigit((unsigned char) *text)) {
v = *text - '0';
} else if (radix == 16 && SDL_isupperhex(*text)) {
v = 10 + (*text - 'A');
Expand Down Expand Up @@ -227,7 +227,7 @@ SDL_ScanFloat(const char *text, double *valuep)
if (*text == '.') {
int mult = 10;
++text;
while (SDL_isdigit(*text)) {
while (SDL_isdigit((unsigned char) *text)) {
lvalue = *text - '0';
value += (double) lvalue / mult;
mult *= 10;
Expand Down Expand Up @@ -411,7 +411,7 @@ SDL_strupr(char *string)
{
char *bufp = string;
while (*bufp) {
*bufp = SDL_toupper(*bufp);
*bufp = SDL_toupper((unsigned char) *bufp);
++bufp;
}
return string;
Expand All @@ -424,7 +424,7 @@ SDL_strlwr(char *string)
{
char *bufp = string;
while (*bufp) {
*bufp = SDL_tolower(*bufp);
*bufp = SDL_tolower((unsigned char) *bufp);
++bufp;
}
return string;
Expand Down Expand Up @@ -743,8 +743,8 @@ SDL_strcasecmp(const char *str1, const char *str2)
char a = 0;
char b = 0;
while (*str1 && *str2) {
a = SDL_tolower(*str1);
b = SDL_tolower(*str2);
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
if (a != b)
break;
++str1;
Expand All @@ -763,8 +763,8 @@ SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
char a = 0;
char b = 0;
while (*str1 && *str2 && maxlen) {
a = SDL_tolower(*str1);
b = SDL_tolower(*str2);
a = SDL_tolower((unsigned char) *str1);
b = SDL_tolower((unsigned char) *str2);
if (a != b)
break;
++str1;
Expand All @@ -787,7 +787,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
va_start(ap, fmt);
while (*fmt) {
if (*fmt == ' ') {
while (SDL_isspace(*text)) {
while (SDL_isspace((unsigned char) *text)) {
++text;
}
++fmt;
Expand Down Expand Up @@ -839,7 +839,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
continue;
}

while (SDL_isspace(*text)) {
while (SDL_isspace((unsigned char) *text)) {
++text;
}

Expand Down Expand Up @@ -872,7 +872,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
++index;
}
if (text[index] == '0') {
if (SDL_tolower(text[index + 1]) == 'x') {
if (SDL_tolower((unsigned char) text[index + 1]) == 'x') {
radix = 16;
} else {
radix = 8;
Expand Down Expand Up @@ -1005,7 +1005,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
break;
case 's':
if (suppress) {
while (!SDL_isspace(*text)) {
while (!SDL_isspace((unsigned char) *text)) {
++text;
if (count) {
if (--count == 0) {
Expand All @@ -1015,7 +1015,7 @@ SDL_sscanf(const char *text, const char *fmt, ...)
}
} else {
char *valuep = va_arg(ap, char *);
while (!SDL_isspace(*text)) {
while (!SDL_isspace((unsigned char) *text)) {
*valuep++ = *text++;
if (count) {
if (--count == 0) {
Expand Down

0 comments on commit c05c966

Please sign in to comment.