casting from (signed) char to int does not one whit of good towards avoiding

the problems associated with signed chars being used to index arrays. must
cast to usigned char so the bit expansion is done on an unsigned value to
avoid the sign extension.
This commit is contained in:
Bill Currie 2002-08-02 03:22:32 +00:00
parent 5c6463a0cc
commit 5f4c21d796
4 changed files with 10 additions and 8 deletions

View file

@ -621,10 +621,10 @@ qstrcmp (char **os1, char **os2)
while (1) {
in1 = in2 = n1 = n2 = 0;
if ((in1 = isdigit ((int) *s1)))
if ((in1 = isdigit ((byte) *s1)))
n1 = strtol (s1, &s1, 10);
if ((in2 = isdigit ((int) *s2)))
if ((in2 = isdigit ((byte) *s2)))
n2 = strtol (s2, &s2, 10);
if (in1 && in2) {

View file

@ -57,11 +57,13 @@ ver_compare (const char *value, const char *reference)
for (;;) {
valptr = value;
while (*valptr && !isdigit ((int) *valptr)) // Scan past any non-digits
// Scan past any non-digits
while (*valptr && !isdigit ((byte) *valptr))
valptr++;
refptr = reference;
while (*refptr && !isdigit ((int) *refptr)) // get past non-digits
// get past non-digits
while (*refptr && !isdigit ((byte) *refptr))
refptr++;
for (;;) {
@ -85,10 +87,10 @@ ver_compare (const char *value, const char *reference)
vl = rl = 0;
if (isdigit ((int) *valptr))
if (isdigit ((byte) *valptr))
vl = strtol (value, (char **) &value, 10);
if (isdigit ((int) *refptr))
if (isdigit ((byte) *refptr))
rl = strtol (reference, (char **) &reference, 10);
if (vl != rl)

View file

@ -927,7 +927,7 @@ CL_ConnectionlessPacket (void)
s = MSG_ReadString (net_message);
while (*s && isspace ((int) *s))
while (*s && isspace ((byte) *s))
s++;
len = strlen (s);
while (len && isspace ((byte) s[len - 1]))

View file

@ -735,7 +735,7 @@ SV_BeginDownload_f (ucmd_t *cmd)
char *n = p;
while (*name)
*p++ = tolower ((int) *name++);
*p++ = tolower ((byte) *name++);
*p = 0;
name = n;
}