diff options
| author | dequis <dx@dxzone.com.ar> | 2015-01-16 16:50:23 -0300 | 
|---|---|---|
| committer | dequis <dx@dxzone.com.ar> | 2015-01-16 16:50:23 -0300 | 
| commit | 6b13103dad92d505e038c268af66aeb04b7b4d87 (patch) | |
| tree | 42ea01f5040065df60917daca6605318ec4f28df /lib | |
| parent | 6f10697380c620065731a5beece95c0f5bd652a0 (diff) | |
Replace isdigit/isalpha/.../tolower/toupper with glib variants
This fixes warnings about passing signed chars to them (apparently they
are implemented as macros that do array lookups without checks in some
platforms, yay)
Specifically:
    functions=isalnum|isalpha|isdigit|isspace|isxdigit|tolower|toupper
    sed -ir "s/$functions/g_ascii_&/g" **/*.c
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/http_client.c | 4 | ||||
| -rw-r--r-- | lib/ini.c | 4 | ||||
| -rw-r--r-- | lib/json.c | 8 | ||||
| -rw-r--r-- | lib/misc.c | 8 | ||||
| -rw-r--r-- | lib/ssl_gnutls.c | 2 | ||||
| -rw-r--r-- | lib/ssl_openssl.c | 2 | 
6 files changed, 14 insertions, 14 deletions
| diff --git a/lib/http_client.c b/lib/http_client.c index 49498f74..2481997a 100644 --- a/lib/http_client.c +++ b/lib/http_client.c @@ -344,12 +344,12 @@ static http_ret_t http_process_chunked_data( struct http_request *req, const cha  		/* Might be a \r\n from the last chunk. */  		s = chunk; -		while( isspace( *s ) ) +		while( g_ascii_isspace( *s ) )  			s ++;  		/* Chunk length. Might be incomplete. */  		if( s < eos && sscanf( s, "%x", &clen ) != 1 )  			return CR_ERROR; -		while( isxdigit( *s ) ) +		while( g_ascii_isxdigit( *s ) )  			s ++;  		/* If we read anything here, it *must* be \r\n. */ @@ -62,11 +62,11 @@ static char *ini_strip_whitespace( char *in )  {  	char *e; -	while( isspace( *in ) ) +	while( g_ascii_isspace( *in ) )  		in++;  	e = in + strlen( in ) - 1; -	while( e > in && isspace( *e ) ) +	while( e > in && g_ascii_isspace( *e ) )  		e--;  	e[1] = 0; @@ -52,7 +52,7 @@ typedef unsigned int json_uchar;  static unsigned char hex_value (json_char c)  { -   if (isdigit(c)) +   if (g_ascii_isdigit(c))        return c - '0';     switch (c) { @@ -608,14 +608,14 @@ json_value * json_parse_ex (json_settings * settings,                       default: -                        if (isdigit (b) || b == '-') +                        if (g_ascii_isdigit (b) || b == '-')                          {                             if (!new_value (&state, &top, &root, &alloc, json_integer))                                goto e_alloc_failure;                             if (!state.first_pass)                             { -                              while (isdigit (b) || b == '+' || b == '-' +                              while (g_ascii_isdigit (b) || b == '+' || b == '-'                                          || b == 'e' || b == 'E' || b == '.')                                {                                   if ( (++ i) == end) @@ -705,7 +705,7 @@ json_value * json_parse_ex (json_settings * settings,              case json_integer:              case json_double: -               if (isdigit (b)) +               if (g_ascii_isdigit (b))                 {                    ++ num_digits; @@ -162,7 +162,7 @@ void strip_html( char *in )  	while( *in )  	{ -		if( *in == '<' && ( isalpha( *(in+1) ) || *(in+1) == '/' ) ) +		if( *in == '<' && ( g_ascii_isalpha( *(in+1) ) || *(in+1) == '/' ) )  		{  			/* If in points at a < and in+1 points at a letter or a slash, this is probably  			   a HTML-tag. Try to find a closing > and continue there. If the > can't be @@ -197,7 +197,7 @@ void strip_html( char *in )  		else if( *in == '&' )  		{  			cs = ++in; -			while( *in && isalpha( *in ) ) +			while( *in && g_ascii_isalpha( *in ) )  				in ++;  			if( *in == ';' ) in ++; @@ -313,7 +313,7 @@ void http_encode( char *s )  	strcpy( t, s );  	for( i = j = 0; t[i]; i ++, j ++ )  	{ -		/* Warning: isalnum() is locale-aware, so don't use it here! */ +		/* Warning: g_ascii_isalnum() is locale-aware, so don't use it here! */  		if( ( t[i] >= 'A' && t[i] <= 'Z' ) ||  		    ( t[i] >= 'a' && t[i] <= 'z' ) ||  		    ( t[i] >= '0' && t[i] <= '9' ) || @@ -489,7 +489,7 @@ int is_bool( char *value )  		return 1;  	while( *value ) -		if( !isdigit( *value ) ) +		if( !g_ascii_isdigit( *value ) )  			return 0;  		else  			value ++; diff --git a/lib/ssl_gnutls.c b/lib/ssl_gnutls.c index 0aea6b0e..fade7de2 100644 --- a/lib/ssl_gnutls.c +++ b/lib/ssl_gnutls.c @@ -317,7 +317,7 @@ static gboolean ssl_connected( gpointer data, gint source, b_input_condition con  #endif  	gnutls_set_default_priority( conn->session );  	gnutls_credentials_set( conn->session, GNUTLS_CRD_CERTIFICATE, xcred ); -	if( conn->hostname && !isdigit( conn->hostname[0] ) ) +	if( conn->hostname && !g_ascii_isdigit( conn->hostname[0] ) )  		gnutls_server_name_set( conn->session, GNUTLS_NAME_DNS,  		                        conn->hostname, strlen( conn->hostname ) ); diff --git a/lib/ssl_openssl.c b/lib/ssl_openssl.c index 206c73e7..63937380 100644 --- a/lib/ssl_openssl.c +++ b/lib/ssl_openssl.c @@ -158,7 +158,7 @@ static gboolean ssl_connected( gpointer data, gint source, b_input_condition con  	sock_make_nonblocking( conn->fd );  	SSL_set_fd( conn->ssl, conn->fd ); -	if( conn->hostname && !isdigit( conn->hostname[0] ) ) +	if( conn->hostname && !g_ascii_isdigit( conn->hostname[0] ) )  		SSL_set_tlsext_host_name( conn->ssl, conn->hostname );  	return ssl_handshake( data, source, cond ); | 
