Quite a few instances of the Cardinal Error of Ctype were turned up

by a grep I just did. Oops.

[originally from svn r6113]
This commit is contained in:
Simon Tatham
2005-07-17 17:10:11 +00:00
parent 8ac92e8607
commit e33a57b703
9 changed files with 17 additions and 17 deletions

2
cube.c
View File

@ -285,7 +285,7 @@ static void decode_params(game_params *ret, char const *string)
default: break; default: break;
} }
ret->d1 = ret->d2 = atoi(string); ret->d1 = ret->d2 = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') { if (*string == 'x') {
string++; string++;
ret->d2 = atoi(string); ret->d2 = atoi(string);

View File

@ -76,7 +76,7 @@ static game_params *dup_params(game_params *params)
static void decode_params(game_params *ret, char const *string) static void decode_params(game_params *ret, char const *string)
{ {
ret->w = ret->h = atoi(string); ret->w = ret->h = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') { if (*string == 'x') {
string++; string++;
ret->h = atoi(string); ret->h = atoi(string);

4
flip.c
View File

@ -116,11 +116,11 @@ static game_params *dup_params(game_params *params)
static void decode_params(game_params *ret, char const *string) static void decode_params(game_params *ret, char const *string)
{ {
ret->w = ret->h = atoi(string); ret->w = ret->h = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') { if (*string == 'x') {
string++; string++;
ret->h = atoi(string); ret->h = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
} }
if (*string == 'r') { if (*string == 'r') {
string++; string++;

View File

@ -213,16 +213,16 @@ static void decode_params(game_params *ret, char const *string)
ret->movetarget = 0; ret->movetarget = 0;
ret->width = atoi(p); ret->width = atoi(p);
while (*p && isdigit(*p)) p++; while (*p && isdigit((unsigned char)*p)) p++;
if (*p == 'x') { if (*p == 'x') {
p++; p++;
ret->height = atoi(p); ret->height = atoi(p);
while (*p && isdigit(*p)) p++; while (*p && isdigit((unsigned char)*p)) p++;
if ( (ret->wrapping = (*p == 'w')) != 0 ) if ( (ret->wrapping = (*p == 'w')) != 0 )
p++; p++;
if (*p == 'b') { if (*p == 'b') {
ret->barrier_probability = atof(++p); ret->barrier_probability = atof(++p);
while (*p && (isdigit(*p) || *p == '.')) p++; while (*p && (isdigit((unsigned char)*p) || *p == '.')) p++;
} }
if (*p == 'm') { if (*p == 'm') {
ret->movetarget = atoi(++p); ret->movetarget = atoi(++p);

View File

@ -106,11 +106,11 @@ static void decode_params(game_params *ret, char const *string)
char const *p = string; char const *p = string;
ret->w = atoi(p); ret->w = atoi(p);
while (*p && isdigit(*p)) p++; while (*p && isdigit((unsigned char)*p)) p++;
if (*p == 'x') { if (*p == 'x') {
p++; p++;
ret->h = atoi(p); ret->h = atoi(p);
while (*p && isdigit(*p)) p++; while (*p && isdigit((unsigned char)*p)) p++;
} else { } else {
ret->h = ret->w; ret->h = ret->w;
} }

View File

@ -291,9 +291,9 @@ static char *validate_desc(game_params *params, char *desc)
char *q = p; char *q = p;
int n; int n;
if (!isdigit(*p)) if (!isdigit((unsigned char)*p))
return "Not enough numbers in string"; return "Not enough numbers in string";
while (isdigit(*p)) p++; while (isdigit((unsigned char)*p)) p++;
if (i < area-1 && *p != ',') if (i < area-1 && *p != ',')
return "Expected comma after number"; return "Expected comma after number";

View File

@ -100,7 +100,7 @@ static void decode_params(game_params *ret, char const *string)
{ {
ret->w = ret->h = atoi(string); ret->w = ret->h = atoi(string);
ret->movetarget = 0; ret->movetarget = 0;
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') { if (*string == 'x') {
string++; string++;
ret->h = atoi(string); ret->h = atoi(string);

View File

@ -108,16 +108,16 @@ static void decode_params(game_params *ret, char const *string)
ret->n = 2; ret->n = 2;
ret->rowsonly = ret->orientable = FALSE; ret->rowsonly = ret->orientable = FALSE;
ret->movetarget = 0; ret->movetarget = 0;
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
if (*string == 'x') { if (*string == 'x') {
string++; string++;
ret->h = atoi(string); ret->h = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
} }
if (*string == 'n') { if (*string == 'n') {
string++; string++;
ret->n = atoi(string); ret->n = atoi(string);
while (*string && isdigit(*string)) string++; while (*string && isdigit((unsigned char)*string)) string++;
} }
while (*string) { while (*string) {
if (*string == 'r') { if (*string == 'r') {
@ -127,7 +127,7 @@ static void decode_params(game_params *ret, char const *string)
} else if (*string == 'm') { } else if (*string == 'm') {
string++; string++;
ret->movetarget = atoi(string); ret->movetarget = atoi(string);
while (string[1] && isdigit(string[1])) string++; while (string[1] && isdigit((unsigned char)string[1])) string++;
} }
string++; string++;
} }

View File

@ -1690,7 +1690,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
RegisterClass(&wndclass); RegisterClass(&wndclass);
} }
while (*cmdline && isspace(*cmdline)) while (*cmdline && isspace((unsigned char)*cmdline))
cmdline++; cmdline++;
if (!new_window(inst, *cmdline ? cmdline : NULL, &error)) { if (!new_window(inst, *cmdline ? cmdline : NULL, &error)) {