Merged r2979:2980 from branches/SDL-1.2: unsigned char in ctype funcs.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 15 Feb 2007 11:14:24 +0000
changeset 2092 8e761d6af583
parent 2091 b8bee470f737
child 2093 cdaeb26ed66a
Merged r2979:2980 from branches/SDL-1.2: unsigned char in ctype funcs.
src/stdlib/SDL_string.c
--- a/src/stdlib/SDL_string.c	Wed Feb 14 10:41:55 2007 +0000
+++ b/src/stdlib/SDL_string.c	Thu Feb 15 11:14:24 2007 +0000
@@ -46,7 +46,7 @@
     }
     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');
@@ -82,7 +82,7 @@
     }
     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');
@@ -114,7 +114,7 @@
     }
     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');
@@ -152,7 +152,7 @@
     }
     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');
@@ -188,7 +188,7 @@
     }
     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');
@@ -227,7 +227,7 @@
     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;
@@ -411,7 +411,7 @@
 {
     char *bufp = string;
     while (*bufp) {
-        *bufp = SDL_toupper(*bufp);
+        *bufp = SDL_toupper((unsigned char) *bufp);
         ++bufp;
     }
     return string;
@@ -424,7 +424,7 @@
 {
     char *bufp = string;
     while (*bufp) {
-        *bufp = SDL_tolower(*bufp);
+        *bufp = SDL_tolower((unsigned char) *bufp);
         ++bufp;
     }
     return string;
@@ -743,8 +743,8 @@
     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;
@@ -763,8 +763,8 @@
     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;
@@ -787,7 +787,7 @@
     va_start(ap, fmt);
     while (*fmt) {
         if (*fmt == ' ') {
-            while (SDL_isspace(*text)) {
+            while (SDL_isspace((unsigned char) *text)) {
                 ++text;
             }
             ++fmt;
@@ -839,7 +839,7 @@
                 continue;
             }
 
-            while (SDL_isspace(*text)) {
+            while (SDL_isspace((unsigned char) *text)) {
                 ++text;
             }
 
@@ -872,7 +872,7 @@
                             ++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;
@@ -1005,7 +1005,7 @@
                     break;
                 case 's':
                     if (suppress) {
-                        while (!SDL_isspace(*text)) {
+                        while (!SDL_isspace((unsigned char) *text)) {
                             ++text;
                             if (count) {
                                 if (--count == 0) {
@@ -1015,7 +1015,7 @@
                         }
                     } else {
                         char *valuep = va_arg(ap, char *);
-                        while (!SDL_isspace(*text)) {
+                        while (!SDL_isspace((unsigned char) *text)) {
                             *valuep++ = *text++;
                             if (count) {
                                 if (--count == 0) {