Cast "char" values to "guchar" before passing them to <ctype.h> macros,

so that characters with the 8th bit set don't get sign-extended and
cause the macros not to return the right answer.

svn path=/trunk/; revision=10036
This commit is contained in:
Guy Harris 2004-02-11 09:19:54 +00:00
parent 8177fbd550
commit f99bb93e55
4 changed files with 10 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.393 2004/02/11 03:55:48 guy Exp $
* $Id: main.c,v 1.394 2004/02/11 09:19:54 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -1461,7 +1461,7 @@ set_autostop_criterion(const char *autostoparg)
* as we allow it in the preferences file, we might as well
* allow it here).
*/
while (isspace(*p))
while (isspace((guchar)*p))
p++;
if (*p == '\0') {
/*

View File

@ -3,7 +3,7 @@
* Copyright 2004, Anders Broman <anders.broman[at]ericsson.com>
* Copyright 2004, Olivier Biot <olivier.biot[at]siemens.com>
*
* $Id: packet-multipart.c,v 1.6 2004/02/06 01:07:51 obiot Exp $
* $Id: packet-multipart.c,v 1.7 2004/02/11 09:19:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -318,7 +318,7 @@ get_multipart_info(packet_info *pinfo)
if (p == NULL)
return NULL;
p++; /* Skip semicolon */
while ((*p) && isspace(*p))
while ((*p) && isspace((guchar)*p))
p++; /* Skip white space */
}
start = p + 9;
@ -347,7 +347,7 @@ get_multipart_info(packet_info *pinfo)
*/
p = start;
while (*p) {
if (*p == ';' || isspace(*p))
if (*p == ';' || isspace((guchar)*p))
break;
p++;
len++;

View File

@ -18,7 +18,7 @@
* Copyright 2000, Heikki Vatiainen <hessu@cs.tut.fi>
* Copyright 2001, Jean-Francois Mule <jfm@cablelabs.com>
*
* $Id: packet-sip.c,v 1.58 2004/02/03 20:39:58 guy Exp $
* $Id: packet-sip.c,v 1.59 2004/02/11 09:19:02 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -654,7 +654,7 @@ dissect_sip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
/* Extract method name from value */
for (value_offset = 0; value_offset < (gint)strlen(value); value_offset++)
{
if (isalpha(value[value_offset]))
if (isalpha((guchar)value[value_offset]))
{
strcpy(csec_method,value+value_offset);
break;

View File

@ -1,7 +1,7 @@
/* range.c
* Packet range routines (save, print, ...)
*
* $Id: range.c,v 1.8 2004/01/09 18:10:40 ulfl Exp $
* $Id: range.c,v 1.9 2004/02/11 09:19:54 guy Exp $
*
* Dick Gooris <gooris@lucent.com>
* Ulf Lamping <ulf.lamping@web.de>
@ -288,7 +288,7 @@ void packet_range_convert_str(packet_range_t *range, const gchar *es)
/* Only keep digits, commas, and hyphens. */
for (i=0; i<=strlen(OrgStr); i++) {
if ( isdigit(OrgStr[i]) || OrgStr[i] == '-' || OrgStr[i] == ',' ) {
if ( isdigit((guchar)OrgStr[i]) || OrgStr[i] == '-' || OrgStr[i] == ',' ) {
EntryStr[j++] = OrgStr[i];
}
}
@ -349,7 +349,7 @@ void packet_range_convert_str(packet_range_t *range, const gchar *es)
for (i=0; i<=strlen(EntryStr);i++) {
/* Copy the digit string until a no-digit character is seen */
if (isdigit(EntryStr[i])) {
if (isdigit((guchar)EntryStr[i])) {
value[j++] = EntryStr[i];
continue;
}