Cast the arguments to <ctype.h> macros to "guchar", to squelch

"subscript has type `char'" warnings and to make the code work correctly
if there are characters with the 8th bit set.

svn path=/trunk/; revision=10010
This commit is contained in:
Guy Harris 2004-02-09 00:06:30 +00:00
parent a2d69c6fae
commit 31c636ff4a
3 changed files with 16 additions and 15 deletions

View File

@ -1,6 +1,6 @@
/* cosine.c
*
* $Id: cosine.c,v 1.8 2004/01/25 21:55:12 guy Exp $
* $Id: cosine.c,v 1.9 2004/02/09 00:06:30 guy Exp $
*
* CoSine IPNOS L2 debug output parsing
* Copyright (c) 2002 by Motonori Shindo <mshindo@mshindo.net>
@ -186,7 +186,7 @@ static int parse_single_hex_dump_line(char* rec, guint8 *buf,
static gboolean empty_line(const gchar *line)
{
while (*line) {
if (isspace(*line)) {
if (isspace((guchar)*line)) {
line++;
continue;
} else {

View File

@ -1,6 +1,6 @@
/* dbs-etherwatch.c
*
* $Id: dbs-etherwatch.c,v 1.15 2004/01/25 21:55:13 guy Exp $
* $Id: dbs-etherwatch.c,v 1.16 2004/02/09 00:06:30 guy Exp $
*
* Wiretap Library
* Copyright (c) 2001 by Marc Milgram <ethereal@mmilgram.NOSPAMmail.net>
@ -360,7 +360,7 @@ parse_dbs_etherwatch_packet(wtap *wth, FILE_T fh, guint8* buf, int *err,
* 'HEX' character
*/
p = line;
while(!isxdigit(*p)) {
while(!isxdigit((guchar)*p)) {
p++;
}
if(parse_hex_dump(p, &buf[eth_hdr_len], HEX_HDR_SPR,
@ -581,8 +581,8 @@ parse_single_hex_dump_line(char* rec, guint8 *buf, int byte_offset) {
/* Get the byte_offset directly from the record */
value = 0;
for(i = 0; i < COUNT_SIZE; i++) {
if(!isspace(rec[pos])) {
if(isdigit(rec[pos])) {
if(!isspace((guchar)rec[pos])) {
if(isdigit((guchar)rec[pos])) {
value *= 10;
value += rec[pos] - '0';
} else {
@ -617,17 +617,18 @@ parse_hex_dump(char* dump, guint8 *buf, char seperator, char end) {
count = 0;
while(dump[pos] != end) {
/* Check the hex value */
if(!(isxdigit(dump[pos]) && isxdigit(dump[pos + 1]))) {
if(!(isxdigit((guchar)dump[pos]) &&
isxdigit((guchar)dump[pos + 1]))) {
return 0;
}
/* Get the hex value value */
if(isdigit(dump[pos])) {
if(isdigit((guchar)dump[pos])) {
buf[count] = (dump[pos] - '0') << 4;
} else {
buf[count] = (toupper(dump[pos]) - 'A' + 10) << 4;
}
pos++;
if(isdigit(dump[pos])) {
if(isdigit((guchar)dump[pos])) {
buf[count] += dump[pos] - '0';
} else {
buf[count] += toupper(dump[pos]) - 'A' + 10;

View File

@ -1,6 +1,6 @@
/* vms.c
*
* $Id: vms.c,v 1.21 2004/01/25 21:55:17 guy Exp $
* $Id: vms.c,v 1.22 2004/02/09 00:06:30 guy Exp $
*
* Wiretap Library
* Copyright (c) 2001 by Marc Milgram <ethereal@mmilgram.NOSPAMmail.net>
@ -344,12 +344,12 @@ isdumpline( gchar *line )
{
int i, j;
while (*line && !isalnum(*line))
while (*line && !isalnum((guchar)*line))
line++;
for (j=0; j<4; j++) {
for (i=0; i<8; i++, line++)
if (! isxdigit(*line))
if (! isxdigit((guchar)*line))
return FALSE;
for (i=0; i<3; i++, line++)
@ -357,7 +357,7 @@ isdumpline( gchar *line )
return FALSE;
}
return isspace(*line);
return isspace((guchar)*line);
}
/* Parses a packet record header. */
@ -418,7 +418,7 @@ parse_vms_rec_hdr(wtap *wth, FILE_T fh, int *err, gchar **err_info)
}
if ( (! pkt_len) && (p = strstr(line, "Length"))) {
p += sizeof("Length ");
while (*p && ! isdigit(*p))
while (*p && ! isdigit((guchar)*p))
p++;
if ( !*p ) {
@ -479,7 +479,7 @@ parse_vms_hex_dump(FILE_T fh, int pkt_len, guint8* buf, int *err,
}
line[VMS_LINE_LENGTH] = '\0';
}
while (line[offset] && !isxdigit(line[offset]))
while (line[offset] && !isxdigit((guchar)line[offset]))
offset++;
}
if (!parse_single_hex_dump_line(line, buf, i,