Cast ctype.h char arguments to unsigned char

This commit is contained in:
Hallvard Furuseth 2006-04-01 23:44:42 +00:00
parent 7ead463927
commit 581c1ff6c7
11 changed files with 27 additions and 26 deletions

View File

@ -1687,7 +1687,7 @@ tool_is_oid( const char *s )
{
int first = 1;
if ( !isdigit( s[ 0 ] ) ) {
if ( !isdigit( (unsigned char) s[ 0 ] ) ) {
return 0;
}
@ -1700,7 +1700,7 @@ tool_is_oid( const char *s )
continue;
}
if ( !isdigit( s[ 0 ] ) ) {
if ( !isdigit( (unsigned char) s[ 0 ] ) ) {
return 0;
}

View File

@ -1051,7 +1051,8 @@ int ldap_pvt_sasl_secprops(
if ( sprops[j].ival ) {
unsigned v;
char *next = NULL;
if ( !isdigit( props[i][sprops[j].key.bv_len] )) continue;
if ( !isdigit( (unsigned char)props[i][sprops[j].key.bv_len] ))
continue;
v = strtoul( &props[i][sprops[j].key.bv_len], &next, 10 );
if ( next == &props[i][sprops[j].key.bv_len] || next[0] != '\0' ) continue;
switch( sprops[j].ival ) {

View File

@ -346,7 +346,7 @@ hex_escape_len( const char *s, unsigned list )
/* RFC 2396: unreserved alphanum */
default:
if ( !isalnum( s[0] ) ) {
if ( !isalnum( (unsigned char) s[0] ) ) {
len += 3;
} else {
len++;
@ -411,7 +411,7 @@ hex_escape( char *buf, int len, const char *s, unsigned list )
/* RFC 2396: unreserved alphanum */
default:
if ( !isalnum( s[i] ) ) {
if ( !isalnum( (unsigned char) s[i] ) ) {
escape = 1;
}
break;

View File

@ -734,7 +734,7 @@ int ldif_is_not_printable(
ber_len_t i;
for ( i = 0; val[i]; i++ ) {
if ( !isascii( val[i] ) || !isprint( val[i] ) ) {
if ( !isascii( val[i] ) || !isprint( (unsigned char) val[i] ) ) {
return 1;
}
}
@ -858,7 +858,7 @@ ldif_read_record(
}
ptr = line + STRLENOF("include:");
while (isspace(*ptr)) ptr++;
while (isspace((unsigned char) *ptr)) ptr++;
fp2 = ldif_open_url( ptr );
if ( fp2 ) {
LDIFFP *lnew = ber_memalloc( sizeof( LDIFFP ));

View File

@ -207,7 +207,7 @@ int lutil_parsetime( char *atm, struct lutil_tm *tm )
unsigned i, fracs;
/* Is the stamp reasonably long? */
for (i=0; isdigit(atm[i]); i++);
for (i=0; isdigit((unsigned char) atm[i]); i++);
if (i < sizeof("00000101000000")-1)
break;
@ -247,7 +247,7 @@ int lutil_parsetime( char *atm, struct lutil_tm *tm )
if (tm->tm_sec < 0 || tm->tm_sec > 61) break;
/* Fractions of seconds */
for (i = 0, fracs = 0;isdigit(*ptr);) {
for (i = 0, fracs = 0; isdigit((unsigned char) *ptr); ) {
i*=10; i+= *ptr++ - '0';
fracs++;
}

View File

@ -994,7 +994,7 @@ parse_acl(
< bdn->a_pat.bv_len;
exp = strchr( exp, '$' ) )
{
if ( isdigit( exp[ 1 ] ) ) {
if ( isdigit( (unsigned char) exp[ 1 ] ) ) {
gotit = 1;
break;
}

View File

@ -490,7 +490,7 @@ bdb_cf_gen(ConfigArgs *c)
struct berval bv, def = BER_BVC("default");
char *ptr;
for (ptr = c->line; !isspace( *ptr ); ptr++);
for (ptr = c->line; !isspace( (unsigned char) *ptr ); ptr++);
bv.bv_val = c->line;
bv.bv_len = ptr - bv.bv_val;
@ -578,8 +578,8 @@ bdb_cf_gen(ConfigArgs *c)
if ( c->op == SLAP_CONFIG_ADD ) {
ptr += STRLENOF("dbconfig");
while (!isspace(*ptr)) ptr++;
while (isspace(*ptr)) ptr++;
while (!isspace((unsigned char)*ptr)) ptr++;
while (isspace((unsigned char)*ptr)) ptr++;
}
if ( bdb->bi_flags & BDB_IS_OPEN ) {

View File

@ -353,7 +353,7 @@ ldap_back_cf_gen( ConfigArgs *c )
bindconf_unparse( &li->li_acl, &bv );
for ( i = 0; isspace( bv.bv_val[ i ] ); i++ )
for ( i = 0; isspace( (unsigned char) bv.bv_val[ i ] ); i++ )
/* count spaces */ ;
if ( i ) {
@ -488,7 +488,7 @@ ldap_back_cf_gen( ConfigArgs *c )
bv.bv_len = ptr - bv.bv_val;
} else {
for ( i = 0; isspace( bc.bv_val[ i ] ); i++ )
for ( i = 0; isspace( (unsigned char) bc.bv_val[ i ] ); i++ )
/* count spaces */ ;
if ( i ) {
@ -547,7 +547,7 @@ ldap_back_cf_gen( ConfigArgs *c )
return 1;
}
for ( i = 0; isspace( bv.bv_val[ i ] ); i++ )
for ( i = 0; isspace( (unsigned char) bv.bv_val[ i ] ); i++ )
/* count spaces */ ;
if ( i ) {
@ -1157,7 +1157,7 @@ done_url:;
case LDAP_BACK_CFG_TIMEOUT:
for ( i = 1; i < c->argc; i++ ) {
if ( isdigit( c->argv[ i ][ 0 ] ) ) {
if ( isdigit( (unsigned char) c->argv[ i ][ 0 ] ) ) {
int j;
unsigned u;

View File

@ -851,7 +851,7 @@ config_generic(ConfigArgs *c) {
AC_MEMCPY( abv.bv_val, ibuf, abv.bv_len );
/* Turn TAB / EOL into plain space */
for (src=bv.bv_val,dst=abv.bv_val+abv.bv_len; *src; src++) {
if (isspace(*src)) *dst++ = ' ';
if (isspace((unsigned char)*src)) *dst++ = ' ';
else *dst++ = *src;
}
*dst = '\0';
@ -1416,8 +1416,8 @@ config_generic(ConfigArgs *c) {
char *ptr;
if ( c->op == SLAP_CONFIG_ADD ) {
ptr = c->line + STRLENOF("moduleload");
while (!isspace(*ptr)) ptr++;
while (isspace(*ptr)) ptr++;
while (!isspace((unsigned char) *ptr)) ptr++;
while (isspace((unsigned char) *ptr)) ptr++;
} else {
ptr = c->line;
}
@ -2305,7 +2305,7 @@ config_loglevel(ConfigArgs *c) {
for( i=1; i < c->argc; i++ ) {
int level;
if ( isdigit( c->argv[i][0] ) || c->argv[i][0] == '-' ) {
if ( isdigit((unsigned char)c->argv[i][0]) || c->argv[i][0] == '-' ) {
if( lutil_atoi( &level, c->argv[i] ) != 0 ) {
snprintf( c->msg, sizeof( c->msg ), "<%s> unable to parse level", c->argv[0] );
Debug( LDAP_DEBUG_ANY, "%s: %s \"%s\"\n",

View File

@ -552,7 +552,7 @@ strtok_quote_ldif( char **line )
if ( !ptr || !*ptr )
return NULL;
while( isspace( *ptr )) ptr++;
while( isspace( (unsigned char) *ptr )) ptr++;
if ( *ptr == '"' ) {
inquote = 1;
@ -563,7 +563,7 @@ strtok_quote_ldif( char **line )
for (;*ptr;ptr++) {
if ( *ptr == '"' ) {
if ( inquote && ( !ptr[1] || isspace(ptr[1]))) {
if ( inquote && ( !ptr[1] || isspace((unsigned char) ptr[1]))) {
*ptr++ = '\0';
break;
}
@ -573,7 +573,7 @@ strtok_quote_ldif( char **line )
}
if ( inquote )
continue;
if ( isspace( *ptr )) {
if ( isspace( (unsigned char) *ptr )) {
*ptr++ = '\0';
break;
}
@ -587,7 +587,7 @@ strtok_quote_ldif( char **line )
if ( !*ptr ) {
*line = NULL;
} else {
while ( isspace( *ptr )) ptr++;
while ( isspace( (unsigned char) *ptr )) ptr++;
*line = ptr;
}
return beg;

View File

@ -244,7 +244,7 @@ parse_debug_level( const char *arg, int *levelp, char ***unknowns )
{
int level;
if ( arg != NULL && arg[ 0 ] != '-' && !isdigit( arg[ 0 ] ) )
if ( arg && arg[ 0 ] != '-' && !isdigit( (unsigned char) arg[ 0 ] ) )
{
int i;
char **levels;