From 6b13103dad92d505e038c268af66aeb04b7b4d87 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 16 Jan 2015 16:50:23 -0300 Subject: 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 --- lib/misc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/misc.c') diff --git a/lib/misc.c b/lib/misc.c index 8196879d..02b1814c 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -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 ++; -- cgit v1.2.3