From: Hallvard Furuseth Date: Sat, 1 Apr 2006 23:44:42 +0000 (+0000) Subject: Cast ctype.h char arguments to unsigned char X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~55 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=581c1ff6c74f5eb281b5e0052b2a5ca84a7679bd;p=openldap Cast ctype.h char arguments to unsigned char --- diff --git a/clients/tools/common.c b/clients/tools/common.c index ac9c300afb..613bfb7b1a 100644 --- a/clients/tools/common.c +++ b/clients/tools/common.c @@ -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; } diff --git a/libraries/libldap/cyrus.c b/libraries/libldap/cyrus.c index 296e633731..154fe80e57 100644 --- a/libraries/libldap/cyrus.c +++ b/libraries/libldap/cyrus.c @@ -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 ) { diff --git a/libraries/libldap/url.c b/libraries/libldap/url.c index c86e80e9ab..4c27ed33f2 100644 --- a/libraries/libldap/url.c +++ b/libraries/libldap/url.c @@ -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; diff --git a/libraries/liblutil/ldif.c b/libraries/liblutil/ldif.c index 32e52d1ca7..defc1932d3 100644 --- a/libraries/liblutil/ldif.c +++ b/libraries/liblutil/ldif.c @@ -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 )); diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 77baee98c6..cb92e59f24 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -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++; } diff --git a/servers/slapd/aclparse.c b/servers/slapd/aclparse.c index 230dcdace2..96d8e4a88c 100644 --- a/servers/slapd/aclparse.c +++ b/servers/slapd/aclparse.c @@ -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; } diff --git a/servers/slapd/back-bdb/config.c b/servers/slapd/back-bdb/config.c index dd7feee8d1..34530f38f2 100644 --- a/servers/slapd/back-bdb/config.c +++ b/servers/slapd/back-bdb/config.c @@ -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 ) { diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index a00d820b64..3bda48fbea 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -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; diff --git a/servers/slapd/bconfig.c b/servers/slapd/bconfig.c index 69c2da6664..b390fc990f 100644 --- a/servers/slapd/bconfig.c +++ b/servers/slapd/bconfig.c @@ -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", diff --git a/servers/slapd/config.c b/servers/slapd/config.c index 8e8558c053..2598291bc5 100644 --- a/servers/slapd/config.c +++ b/servers/slapd/config.c @@ -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; diff --git a/servers/slapd/main.c b/servers/slapd/main.c index 46d24ba1db..119e24a955 100644 --- a/servers/slapd/main.c +++ b/servers/slapd/main.c @@ -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;