Mercurial > pidgin
changeset 18398:16bdcffb1c62
Use the glib strcasecmp functions everywhere, as we've had reports of
problems on Windows (with Visual Studio) and the Maemo platform. This way
we don't need to worry about where to include <strings.h>.
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 01 Jul 2007 01:41:57 +0000 |
parents | e122b631a657 |
children | 959091d9c345 |
files | libpurple/plugins/filectl.c libpurple/protocols/gg/lib/http.c libpurple/protocols/gg/lib/pubdir50.c libpurple/protocols/msn/msn-utils.c libpurple/protocols/oscar/odc.c libpurple/protocols/silc/buddy.c libpurple/protocols/silc/util.c libpurple/protocols/silc10/buddy.c libpurple/protocols/simple/simple.c libpurple/protocols/yahoo/yahoo_picture.c libpurple/protocols/zephyr/ZVariables.c pidgin/gtkimhtml.c pidgin/plugins/spellchk.c |
diffstat | 13 files changed, 30 insertions(+), 33 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/filectl.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/plugins/filectl.c Sun Jul 01 01:41:57 2007 +0000 @@ -56,7 +56,7 @@ purple_debug_misc("filectl", "read: %s\n", buffer); command = getarg(buffer, 0, 0); - if (!strncasecmp(command, "login", 6)) { + if (!g_ascii_strncasecmp(command, "login", 6)) { PurpleAccount *account; arg1 = getarg(buffer, 1, 0); @@ -69,7 +69,7 @@ free(arg1); free(arg2); - } else if (!strncasecmp(command, "logout", 7)) { + } else if (!g_ascii_strncasecmp(command, "logout", 7)) { PurpleAccount *account; arg1 = getarg(buffer, 1, 1); @@ -88,7 +88,7 @@ /* purple_find_conversation() is gone in 2.0.0. */ #if 0 - } else if (!strncasecmp(command, "send", 4)) { + } else if (!g_ascii_strncasecmp(command, "send", 4)) { PurpleConversation *conv; arg1 = getarg(buffer, 1, 0); @@ -107,21 +107,21 @@ free(arg2); #endif - } else if (!strncasecmp(command, "away", 4)) { + } else if (!g_ascii_strncasecmp(command, "away", 4)) { arg1 = getarg(buffer, 1, 1); /* serv_set_away_all(arg1); */ free(arg1); - } else if (!strncasecmp(command, "hide", 4)) { + } else if (!g_ascii_strncasecmp(command, "hide", 4)) { purple_blist_set_visible(FALSE); - } else if (!strncasecmp(command, "unhide", 6)) { + } else if (!g_ascii_strncasecmp(command, "unhide", 6)) { purple_blist_set_visible(TRUE); - } else if (!strncasecmp(command, "back", 4)) { + } else if (!g_ascii_strncasecmp(command, "back", 4)) { /* do_im_back(); */ - } else if (!strncasecmp(command, "quit", 4)) { + } else if (!g_ascii_strncasecmp(command, "quit", 4)) { purple_core_quit(); }
--- a/libpurple/protocols/gg/lib/http.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/gg/lib/http.c Sun Jul 01 01:41:57 2007 +0000 @@ -349,7 +349,7 @@ gg_debug(GG_DEBUG_MISC, "=> -----BEGIN-HTTP-HEADER-----\n%s\n=> -----END-HTTP-HEADER-----\n", h->header); while (line) { - if (!strncasecmp(line, "Content-length: ", 16)) { + if (!g_ascii_strncasecmp(line, "Content-length: ", 16)) { h->body_size = atoi(line + 16); } line = strchr(line, '\n');
--- a/libpurple/protocols/gg/lib/pubdir50.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/gg/lib/pubdir50.c Sun Jul 01 01:41:57 2007 +0000 @@ -347,7 +347,7 @@ /* jeśli dostaliśmy namier na następne wyniki, to znaczy że * mamy koniec wyników i nie jest to kolejna osoba. */ - if (!strcasecmp(field, "nextstart")) { + if (!g_ascii_strcasecmp(field, "nextstart")) { res->next = atoi(value); num--; } else { @@ -390,7 +390,7 @@ } for (i = 0; i < res->entries_count; i++) { - if (res->entries[i].num == num && !strcasecmp(res->entries[i].field, field)) { + if (res->entries[i].num == num && !g_ascii_strcasecmp(res->entries[i].field, field)) { value = res->entries[i].value; break; }
--- a/libpurple/protocols/msn/msn-utils.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/msn/msn-utils.c Sun Jul 01 01:41:57 2007 +0000 @@ -296,7 +296,7 @@ char *attr_dir; attributes = g_strndup(c, attr_len); attr_dir = purple_markup_get_css_property(attributes, "direction"); - if (attr_dir && (!strncasecmp(attr_dir, "RTL", 3))) + if (attr_dir && (!g_ascii_strncasecmp(attr_dir, "RTL", 3))) direction = '1'; g_free(attr_dir); g_free(attributes);
--- a/libpurple/protocols/oscar/odc.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/oscar/odc.c Sun Jul 01 01:41:57 2007 +0000 @@ -314,7 +314,7 @@ tmp += size; /* Skip past the closing </data> tag */ - if (strncasecmp(tmp, "</data>", 7)) + if (g_ascii_strncasecmp(tmp, "</data>", 7)) { g_free(embedded_data); break;
--- a/libpurple/protocols/silc/buddy.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/silc/buddy.c Sun Jul 01 01:41:57 2007 +0000 @@ -1252,7 +1252,7 @@ SilcClientEntry entry; silc_dlist_start(clients); while ((entry = silc_dlist_get(clients))) { - if (!strncasecmp(b->name, entry->nickname, + if (!g_ascii_strncasecmp(b->name, entry->nickname, strlen(b->name))) { client_entry = entry; break;
--- a/libpurple/protocols/silc/util.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/silc/util.c Sun Jul 01 01:41:57 2007 +0000 @@ -623,15 +623,15 @@ ct = strrchr(filename, '.'); if (!ct) return NULL; - else if (!strcasecmp(".png", ct)) + else if (!g_ascii_strcasecmp(".png", ct)) return strdup("image/png"); - else if (!strcasecmp(".jpg", ct)) + else if (!g_ascii_strcasecmp(".jpg", ct)) return strdup("image/jpeg"); - else if (!strcasecmp(".jpeg", ct)) + else if (!g_ascii_strcasecmp(".jpeg", ct)) return strdup("image/jpeg"); - else if (!strcasecmp(".gif", ct)) + else if (!g_ascii_strcasecmp(".gif", ct)) return strdup("image/gif"); - else if (!strcasecmp(".tiff", ct)) + else if (!g_ascii_strcasecmp(".tiff", ct)) return strdup("image/tiff"); return NULL;
--- a/libpurple/protocols/silc10/buddy.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/silc10/buddy.c Sun Jul 01 01:41:57 2007 +0000 @@ -1246,7 +1246,7 @@ buddy nickname. */ int i; for (i = 0; i < clients_count; i++) { - if (!strncasecmp(b->name, clients[i]->nickname, + if (!g_ascii_strncasecmp(b->name, clients[i]->nickname, strlen(b->name))) { clients[0] = clients[i]; break;
--- a/libpurple/protocols/simple/simple.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/simple/simple.c Sun Jul 01 01:41:57 2007 +0000 @@ -337,7 +337,7 @@ return; } - if(!g_strncasecmp(hdr, "NTLM", 4)) { + if(!g_ascii_strncasecmp(hdr, "NTLM", 4)) { purple_debug_info("simple", "found NTLM\n"); auth->type = 2; parts = g_strsplit(hdr+5, "\", ", 0);
--- a/libpurple/protocols/yahoo/yahoo_picture.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/yahoo/yahoo_picture.c Sun Jul 01 01:41:57 2007 +0000 @@ -110,7 +110,7 @@ } /* Yahoo IM 6 spits out 0.png as the URL if the buddy icon is not set */ - if (who && got_icon_info && url && !strncasecmp(url, "http://", 7)) { + if (who && got_icon_info && url && !g_ascii_strncasecmp(url, "http://", 7)) { /* TODO: make this work p2p, try p2p before the url */ PurpleUtilFetchUrlData *url_data; struct yahoo_fetch_picture_data *data;
--- a/libpurple/protocols/zephyr/ZVariables.c Sun Jul 01 01:25:02 2007 +0000 +++ b/libpurple/protocols/zephyr/ZVariables.c Sun Jul 01 01:41:57 2007 +0000 @@ -186,7 +186,7 @@ #define max(a,b) ((a > b) ? (a) : (b)) #endif - if (strncasecmp(bfr, var, max(strlen(var),cp - bfr))) + if (g_strncasecmp(bfr, var, max(strlen(var), cp - bfr))) return(0); /* var is not the var in bfr ==> no match */
--- a/pidgin/gtkimhtml.c Sun Jul 01 01:25:02 2007 +0000 +++ b/pidgin/gtkimhtml.c Sun Jul 01 01:41:57 2007 +0000 @@ -2162,7 +2162,7 @@ gint i; for(i=0; i<accepted_protocols_size; i++){ - if( strncasecmp(text, accepted_protocols[i], strlen(accepted_protocols[i])) == 0 ){ + if( g_ascii_strncasecmp(text, accepted_protocols[i], strlen(accepted_protocols[i])) == 0 ){ return strlen(accepted_protocols[i]); } } @@ -2735,7 +2735,7 @@ /* NEW_BIT (NEW_TEXT_BIT); */ /* Bi-Directional text support */ - if (direction && (!strncasecmp(direction, "RTL", 3))) { + if (direction && (!g_ascii_strncasecmp(direction, "RTL", 3))) { rtl_direction = TRUE; /* insert RLE character to set direction */ ws[wpos++] = 0xE2; @@ -2747,7 +2747,7 @@ } g_free(direction); - if (alignment && (!strncasecmp(alignment, "RIGHT", 5))) { + if (alignment && (!g_ascii_strncasecmp(alignment, "RIGHT", 5))) { align_right = TRUE; align_line = gtk_text_iter_get_line(iter); }
--- a/pidgin/plugins/spellchk.c Sun Jul 01 01:25:02 2007 +0000 +++ b/pidgin/plugins/spellchk.c Sun Jul 01 01:41:57 2007 +0000 @@ -45,9 +45,6 @@ #include <stdio.h> #include <string.h> -#ifndef _WIN32 -#include <strings.h> -#endif #include <sys/types.h> #include <sys/stat.h> @@ -1787,19 +1784,19 @@ while (buf_get_line(ibuf, &buf, &pnt, size)) { if (*buf != '#') { - if (!strncasecmp(buf, "BAD ", 4)) + if (!g_ascii_strncasecmp(buf, "BAD ", 4)) { strncpy(bad, buf + 4, 81); } - else if(!strncasecmp(buf, "CASE ", 5)) + else if(!g_ascii_strncasecmp(buf, "CASE ", 5)) { case_sensitive = *(buf+5) == '0' ? FALSE : TRUE; } - else if(!strncasecmp(buf, "COMPLETE ", 9)) + else if(!g_ascii_strncasecmp(buf, "COMPLETE ", 9)) { complete = *(buf+9) == '0' ? FALSE : TRUE; } - else if (!strncasecmp(buf, "GOOD ", 5)) + else if (!g_ascii_strncasecmp(buf, "GOOD ", 5)) { strncpy(good, buf + 5, 255);