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 /protocols | |
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 'protocols')
-rw-r--r-- | protocols/account.c | 8 | ||||
-rw-r--r-- | protocols/jabber/jabber_util.c | 4 | ||||
-rw-r--r-- | protocols/jabber/sasl.c | 4 | ||||
-rw-r--r-- | protocols/msn/msn.c | 2 | ||||
-rw-r--r-- | protocols/msn/ns.c | 4 | ||||
-rw-r--r-- | protocols/msn/sb.c | 4 | ||||
-rw-r--r-- | protocols/oscar/auth.c | 2 | ||||
-rw-r--r-- | protocols/oscar/oscar.c | 8 | ||||
-rw-r--r-- | protocols/oscar/oscar_util.c | 2 | ||||
-rw-r--r-- | protocols/purple/purple.c | 4 | ||||
-rw-r--r-- | protocols/skype/skype.c | 2 | ||||
-rw-r--r-- | protocols/twitter/twitter.c | 4 | ||||
-rw-r--r-- | protocols/yahoo/yahoo_httplib.c | 2 |
13 files changed, 25 insertions, 25 deletions
diff --git a/protocols/account.c b/protocols/account.c index 3f6fe3a6..188e362e 100644 --- a/protocols/account.c +++ b/protocols/account.c @@ -80,7 +80,7 @@ account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ) strcpy( tag, prpl->name ); if( strcmp( prpl->name, "oscar" ) == 0 ) { - if( isdigit( a->user[0] ) ) + if( g_ascii_isdigit( a->user[0] ) ) strcpy( tag, "icq" ); else strcpy( tag, "aim" ); @@ -416,7 +416,7 @@ int account_reconnect_delay_parse( char *value, struct account_reconnect_delay * p->max = 86400; /* Format: /[0-9]+([*+][0-9]+(<[0-9+])?)?/ */ - while( *value && isdigit( *value ) ) + while( *value && g_ascii_isdigit( *value ) ) p->start = p->start * 10 + *value++ - '0'; /* Sure, call me evil for implementing my own fscanf here, but it's @@ -432,7 +432,7 @@ int account_reconnect_delay_parse( char *value, struct account_reconnect_delay * p->op = *value++; /* + or * the delay by this number every time. */ - while( *value && isdigit( *value ) ) + while( *value && g_ascii_isdigit( *value ) ) p->step = p->step * 10 + *value++ - '0'; if( *value == 0 ) @@ -443,7 +443,7 @@ int account_reconnect_delay_parse( char *value, struct account_reconnect_delay * p->max = 0; value ++; - while( *value && isdigit( *value ) ) + while( *value && g_ascii_isdigit( *value ) ) p->max = p->max * 10 + *value++ - '0'; return p->max > 0; diff --git a/protocols/jabber/jabber_util.c b/protocols/jabber/jabber_util.c index fb68c33d..9d8011f8 100644 --- a/protocols/jabber/jabber_util.c +++ b/protocols/jabber/jabber_util.c @@ -320,7 +320,7 @@ int jabber_compare_jid( const char *jid1, const char *jid2 ) break; return FALSE; } - if( tolower( jid1[i] ) != tolower( jid2[i] ) ) + if( g_ascii_tolower( jid1[i] ) != g_ascii_tolower( jid2[i] ) ) { return FALSE; } @@ -341,7 +341,7 @@ char *jabber_normalize( const char *orig ) /* So it turns out the /resource part is case sensitive. Yeah, and it's Unicode but feck Unicode. :-P So stop once we see a slash. */ for( i = 0; i < len && orig[i] != '/' ; i ++ ) - new[i] = tolower( orig[i] ); + new[i] = g_ascii_tolower( orig[i] ); for( ; orig[i]; i ++ ) new[i] = orig[i]; diff --git a/protocols/jabber/sasl.c b/protocols/jabber/sasl.c index a4d1f6c1..65da529a 100644 --- a/protocols/jabber/sasl.c +++ b/protocols/jabber/sasl.c @@ -186,7 +186,7 @@ char *sasl_get_part( char *data, char *field ) len = strlen( field ); - while( isspace( *data ) || *data == ',' ) + while( g_ascii_isspace( *data ) || *data == ',' ) data ++; if( g_strncasecmp( data, field, len ) == 0 && data[len] == '=' ) @@ -209,7 +209,7 @@ char *sasl_get_part( char *data, char *field ) find the next key after it. */ if( data[i] == ',' ) { - while( isspace( data[i] ) || data[i] == ',' ) + while( g_ascii_isspace( data[i] ) || data[i] == ',' ) i ++; if( g_strncasecmp( data + i, field, len ) == 0 && diff --git a/protocols/msn/msn.c b/protocols/msn/msn.c index 808d41d3..65c19276 100644 --- a/protocols/msn/msn.c +++ b/protocols/msn/msn.c @@ -376,7 +376,7 @@ static void msn_buddy_data_add( bee_user_t *bu ) bd = bu->data = g_new0( struct msn_buddy_data, 1 ); g_tree_insert( md->domaintree, bu->handle, bu ); - for( handle = bu->handle; isdigit( *handle ); handle ++ ); + for( handle = bu->handle; g_ascii_isdigit( *handle ); handle ++ ); if( *handle == ':' ) { /* Pass a nick hint so hopefully the stupid numeric prefix diff --git a/protocols/msn/ns.c b/protocols/msn/ns.c index 5c7e3ff4..c4b6c462 100644 --- a/protocols/msn/ns.c +++ b/protocols/msn/ns.c @@ -580,7 +580,7 @@ static int msn_ns_command( struct msn_handler_data *handler, char **cmd, int num { ic->flags |= OPT_PONGED; } - else if( isdigit( cmd[0][0] ) ) + else if( g_ascii_isdigit( cmd[0][0] ) ) { int num = atoi( cmd[0] ); const struct msn_status_code *err = msn_status_by_number( num ); @@ -996,7 +996,7 @@ int msn_ns_sendmessage( struct im_connection *ic, bee_user_t *bu, const char *te /* This might be a federated contact. Get its network number, prefixed to bu->handle with a colon. Default is 1. */ - for( handle = bu->handle; isdigit( *handle ); handle ++ ) + for( handle = bu->handle; g_ascii_isdigit( *handle ); handle ++ ) type = type * 10 + *handle - '0'; if( *handle == ':' ) handle ++; diff --git a/protocols/msn/sb.c b/protocols/msn/sb.c index ac7182fb..40e4e00d 100644 --- a/protocols/msn/sb.c +++ b/protocols/msn/sb.c @@ -505,7 +505,7 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num } else if( strcmp( cmd[0], "CAL" ) == 0 ) { - if( num_parts < 4 || !isdigit( cmd[3][0] ) ) + if( num_parts < 4 || !g_ascii_isdigit( cmd[3][0] ) ) { msn_sb_destroy( sb ); return( 0 ); @@ -644,7 +644,7 @@ static int msn_sb_command( struct msn_handler_data *handler, char **cmd, int num /* PANIC! */ } } - else if( isdigit( cmd[0][0] ) ) + else if( g_ascii_isdigit( cmd[0][0] ) ) { int num = atoi( cmd[0] ); const struct msn_status_code *err = msn_status_by_number( num ); diff --git a/protocols/oscar/auth.c b/protocols/oscar/auth.c index 0f7c8d0f..7a6b05d4 100644 --- a/protocols/oscar/auth.c +++ b/protocols/oscar/auth.c @@ -124,7 +124,7 @@ int aim_request_login(aim_session_t *sess, aim_conn_t *conn, const char *sn) if (!sess || !conn || !sn) return -EINVAL; - if (isdigit(sn[0]) && set_getbool(&ic->acc->set, "old_icq_auth")) + if (g_ascii_isdigit(sn[0]) && set_getbool(&ic->acc->set, "old_icq_auth")) return goddamnicq(sess, conn, sn); sess->flags |= AIM_SESS_FLAGS_SNACLOGIN; diff --git a/protocols/oscar/oscar.c b/protocols/oscar/oscar.c index 7bf3ac3e..1c74e7a2 100644 --- a/protocols/oscar/oscar.c +++ b/protocols/oscar/oscar.c @@ -367,7 +367,7 @@ static gboolean oscar_login_connect(gpointer data, gint source, b_input_conditio static void oscar_init(account_t *acc) { set_t *s; - gboolean icq = isdigit(acc->user[0]); + gboolean icq = g_ascii_isdigit(acc->user[0]); if (icq) { set_add(&acc->set, "ignore_auth_requests", "false", set_eval_bool, acc); @@ -393,7 +393,7 @@ static void oscar_login(account_t *acc) { struct im_connection *ic = imcb_new(acc); struct oscar_data *odata = ic->proto_data = g_new0(struct oscar_data, 1); - if (isdigit(acc->user[0])) + if (g_ascii_isdigit(acc->user[0])) odata->icq = TRUE; else ic->flags |= OPT_DOES_HTML; @@ -2499,11 +2499,11 @@ struct groupchat *oscar_chat_with(struct im_connection * ic, char *who) static int chat_id = 0; char * chatname, *s; - chatname = g_strdup_printf("%s%s%d", isdigit(*ic->acc->user) ? "icq" : "", + chatname = g_strdup_printf("%s%s%d", g_ascii_isdigit(*ic->acc->user) ? "icq" : "", ic->acc->user, chat_id++); for (s = chatname; *s; s ++) - if (!isalnum(*s)) + if (!g_ascii_isalnum(*s)) *s = '0'; ret = oscar_chat_join_internal(ic, chatname, NULL, NULL, 4); diff --git a/protocols/oscar/oscar_util.c b/protocols/oscar/oscar_util.c index 7d41d383..806632ff 100644 --- a/protocols/oscar/oscar_util.c +++ b/protocols/oscar/oscar_util.c @@ -56,7 +56,7 @@ int aim_sncmp(const char *sn1, const char *sn2) if (*curPtr2 == ' ') curPtr2++; } else { - if ( toupper(*curPtr1) != toupper(*curPtr2)) + if ( g_ascii_toupper(*curPtr1) != g_ascii_toupper(*curPtr2)) return 1; curPtr1++; curPtr2++; diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c index 6e9682ed..97d2a4ae 100644 --- a/protocols/purple/purple.c +++ b/protocols/purple/purple.c @@ -60,7 +60,7 @@ static gboolean purple_menu_cmp( const char *a, const char *b ) { while( *a == '_' ) a ++; while( *b == '_' ) b ++; - if( tolower( *a ) != tolower( *b ) ) + if( g_ascii_tolower( *a ) != g_ascii_tolower( *b ) ) return FALSE; a ++; @@ -1147,7 +1147,7 @@ static void *prplcb_notify_userinfo( PurpleConnection *gc, const char *who, Purp if( value ) { n = strlen( value ) - 1; - while( isspace( value[n] ) ) + while( g_ascii_isspace( value[n] ) ) n --; g_string_append_len( info, value, n + 1 ); } diff --git a/protocols/skype/skype.c b/protocols/skype/skype.c index 8452aff9..20897d99 100644 --- a/protocols/skype/skype.c +++ b/protocols/skype/skype.c @@ -513,7 +513,7 @@ static void skype_parse_user(struct im_connection *ic, char *line) if (strlen(sd->info_sex)) { char *iptr = sd->info_sex; while (*iptr++) - *iptr = tolower(*iptr); + *iptr = g_ascii_tolower(*iptr); g_string_append_printf(st, "Gender: %s\n", sd->info_sex); } diff --git a/protocols/twitter/twitter.c b/protocols/twitter/twitter.c index 2a6ae88f..ca32b3ce 100644 --- a/protocols/twitter/twitter.c +++ b/protocols/twitter/twitter.c @@ -458,9 +458,9 @@ static int twitter_buddy_msg(struct im_connection *ic, char *who, char *message, char pin[strlen(message) + 1], *s; strcpy(pin, message); - for (s = pin + sizeof(pin) - 2; s > pin && isspace(*s); s--) + for (s = pin + sizeof(pin) - 2; s > pin && g_ascii_isspace(*s); s--) *s = '\0'; - for (s = pin; *s && isspace(*s); s++) { + for (s = pin; *s && g_ascii_isspace(*s); s++) { } if (!oauth_access_token(s, td->oauth_info)) { diff --git a/protocols/yahoo/yahoo_httplib.c b/protocols/yahoo/yahoo_httplib.c index eaf319b8..ec153234 100644 --- a/protocols/yahoo/yahoo_httplib.c +++ b/protocols/yahoo/yahoo_httplib.c @@ -151,7 +151,7 @@ static int url_to_host_port_path(const char *url, static int isurlchar(unsigned char c) { - return (isalnum(c)); + return (g_ascii_isalnum(c)); } char *yahoo_urlencode(const char *instr) |