Patch: ctype functions require 'unsigned char' args (ITS#1678) ================ Written by Hallvard B. Furuseth and placed into the public domain. This software is not subject to any license of the University of Oslo. ================ ctype.h functions require an argument in the range of 'unsigned char'. (The integer type of the argument is irrelevant.) Negative 'char' values (when 'char' is signed) are not legal arguments, though some C libraries partly support them since it is such a common error. Hallvard B. Furuseth , March 2002. diff -r -u2 libraries/liblber/bprint.c~ libraries/liblber/bprint.c --- libraries/liblber/bprint.c~ Fri Jan 4 21:17:36 2002 +++ libraries/liblber/bprint.c Sat Mar 23 20:07:46 2002 @@ -211,5 +211,5 @@ off = BP_GRAPH + n + ((n >= 8)?1:0); - if ( isprint( data[i] )) { + if ( isprint( (unsigned char) data[i] )) { line[ BP_GRAPH + n ] = data[i]; } else { diff -r -u2 libraries/libldif/line64.c~ libraries/libldif/line64.c --- libraries/libldif/line64.c~ Fri Jan 4 21:17:42 2002 +++ libraries/libldif/line64.c Sat Mar 23 20:07:14 2002 @@ -412,6 +412,6 @@ if ( type == LDIF_PUT_VALUE - && isgraph( val[0] ) && val[0] != ':' && val[0] != '<' - && isgraph( val[vlen-1] ) + && isgraph( (unsigned char) val[0] ) && val[0] != ':' && val[0] != '<' + && isgraph( (unsigned char) val[vlen-1] ) #ifndef LDAP_BINARY_DEBUG && strstr( name, ";binary" ) == NULL @@ -543,6 +543,6 @@ } - if( isgraph( val[0] ) && val[0] != ':' && val[0] != '<' && - isgraph( val[vlen-1] ) ) + if( isgraph( (unsigned char) val[0] ) && val[0] != ':' && val[0] != '<' && + isgraph( (unsigned char) val[vlen-1] ) ) { ber_len_t i; diff -r -u2 libraries/librewrite/map.c~ libraries/librewrite/map.c --- libraries/librewrite/map.c~ Wed Jan 2 17:06:58 2002 +++ libraries/librewrite/map.c Sat Mar 23 20:25:05 2002 @@ -254,5 +254,5 @@ * of an old map */ - } else if ( isdigit( p[ 1 ] ) && p[ 2 ] == '{' ) { + } else if ( isdigit( (unsigned char) p[ 1 ] ) && p[ 2 ] == '{' ) { cnt++; p++; @@ -330,10 +330,10 @@ * Check the syntax of the variable name */ - if ( !isalpha( p[ 0 ] ) ) { + if ( !isalpha( (unsigned char) p[ 0 ] ) ) { free( s ); return NULL; } for ( p++; p[ 0 ] != '\0'; p++ ) { - if ( !isalnum( p[ 0 ] ) ) { + if ( !isalnum( (unsigned char) p[ 0 ] ) ) { free( s ); return NULL; diff -r -u2 libraries/librewrite/parse.c~ libraries/librewrite/parse.c --- libraries/librewrite/parse.c~ Wed Jan 2 23:31:44 2002 +++ libraries/librewrite/parse.c Sat Mar 23 20:27:30 2002 @@ -39,5 +39,5 @@ char quote = '\0'; - for ( p = buf; isspace( p[ 0 ] ); p++ ); + for ( p = buf; isspace( (unsigned char) p[ 0 ] ); p++ ); if ( p[ 0 ] == '#' ) { @@ -58,5 +58,5 @@ return 1; } - for ( p++; isspace( p[ 0 ] ); p++ ); + for ( p++; isspace( (unsigned char) p[ 0 ] ); p++ ); begin = p; p--; @@ -70,5 +70,5 @@ quote = p[ 0 ]; } - } else if ( isspace( p[ 0 ] ) && !in_quoted_field ) { + } else if ( isspace( (unsigned char) p[ 0 ] ) && !in_quoted_field ) { p[ 0 ] = '\0'; argv[ cnt ] = begin; @@ -79,5 +79,5 @@ } - for ( p++; isspace( p[ 0 ] ); p++ ); + for ( p++; isspace( (unsigned char) p[ 0 ] ); p++ ); begin = p; p--; diff -r -u2 libraries/librewrite/subst.c~ libraries/librewrite/subst.c --- libraries/librewrite/subst.c~ Wed Jan 2 17:06:58 2002 +++ libraries/librewrite/subst.c Sat Mar 23 20:26:14 2002 @@ -102,5 +102,5 @@ * Substitution pattern */ - if ( isdigit( p[ 1 ] ) ) { + if ( isdigit( (unsigned char) p[ 1 ] ) ) { int d = p[ 1 ] - '0'; struct rewrite_submatch **tmpsm;