changeset 17082:7ade887fd3f6

Replace strcasecmp() calls with glib equivalents.
author Richard Laager <rlaager@wiktel.com>
date Mon, 14 May 2007 23:35:50 +0000
parents f6dd1f7689ee
children 25ef7db38f28
files libpurple/account.c libpurple/cipher.c libpurple/conversation.c libpurple/protocols/bonjour/jabber.c libpurple/protocols/gg/lib/pubdir50.c libpurple/protocols/oscar/oscar.c libpurple/protocols/simple/simple.c libpurple/protocols/simple/sipmsg.c pidgin/gtkutils.c
diffstat 9 files changed, 25 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/account.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/account.c	Mon May 14 23:35:50 2007 +0000
@@ -548,9 +548,9 @@
 	data = xmlnode_get_attrib(node, "active");
 	if (data == NULL)
 		return;
-	if (strcasecmp(data, "true") == 0)
+	if (g_ascii_strcasecmp(data, "true") == 0)
 		active = TRUE;
-	else if (strcasecmp(data, "false") == 0)
+	else if (g_ascii_strcasecmp(data, "false") == 0)
 		active = FALSE;
 	else
 		return;
--- a/libpurple/cipher.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/cipher.c	Mon May 14 23:35:50 2007 +0000
@@ -2000,8 +2000,8 @@
 	/* Check for a supported algorithm. */
 	g_return_val_if_fail(algorithm == NULL ||
 						 *algorithm == '\0' ||
-						 strcasecmp(algorithm, "MD5") ||
-						 strcasecmp(algorithm, "MD5-sess"), NULL);
+						 g_ascii_strcasecmp(algorithm, "MD5") ||
+						 g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL);
 
 	cipher = purple_ciphers_find_cipher("md5");
 	g_return_val_if_fail(cipher != NULL, NULL);
@@ -2014,7 +2014,7 @@
 	purple_cipher_context_append(context, (guchar *)":", 1);
 	purple_cipher_context_append(context, (guchar *)password, strlen(password));
 
-	if (algorithm != NULL && !strcasecmp(algorithm, "MD5-sess"))
+	if (algorithm != NULL && !g_ascii_strcasecmp(algorithm, "MD5-sess"))
 	{
 		guchar digest[16];
 
@@ -2065,14 +2065,14 @@
 	/* Check for a supported algorithm. */
 	g_return_val_if_fail(algorithm == NULL ||
 						 *algorithm == '\0' ||
-						 strcasecmp(algorithm, "MD5") ||
-						 strcasecmp(algorithm, "MD5-sess"), NULL);
+						 g_ascii_strcasecmp(algorithm, "MD5") ||
+						 g_ascii_strcasecmp(algorithm, "MD5-sess"), NULL);
 
 	/* Check for a supported "quality of protection". */
 	g_return_val_if_fail(qop == NULL ||
 						 *qop == '\0' ||
-						 strcasecmp(qop, "auth") ||
-						 strcasecmp(qop, "auth-int"), NULL);
+						 g_ascii_strcasecmp(qop, "auth") ||
+						 g_ascii_strcasecmp(qop, "auth-int"), NULL);
 
 	cipher = purple_ciphers_find_cipher("md5");
 	g_return_val_if_fail(cipher != NULL, NULL);
@@ -2083,7 +2083,7 @@
 	purple_cipher_context_append(context, (guchar *)":", 1);
 	purple_cipher_context_append(context, (guchar *)digest_uri, strlen(digest_uri));
 
-	if (qop != NULL && !strcasecmp(qop, "auth-int"))
+	if (qop != NULL && !g_ascii_strcasecmp(qop, "auth-int"))
 	{
 		PurpleCipherContext *context2;
 		gchar entity_hash[33];
--- a/libpurple/conversation.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/conversation.c	Mon May 14 23:35:50 2007 +0000
@@ -1497,7 +1497,7 @@
 	} else if (a->buddy != b->buddy) {
 		ret = a->buddy ? -1 : 1;
 	} else {
-		ret = strcasecmp(user1, user2);
+		ret = purple_utf8_strcasecmp(user1, user2);
 	}
 
 	return ret;
--- a/libpurple/protocols/bonjour/jabber.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/protocols/bonjour/jabber.c	Mon May 14 23:35:50 2007 +0000
@@ -242,7 +242,7 @@
 	if (cbba->bj->account == gb->account)
 	{
 		bb = gb->proto_data;
-		if ((bb != NULL) && (g_strcasecmp(bb->ip, cbba->address) == 0))
+		if ((bb != NULL) && (g_ascii_strcasecmp(bb->ip, cbba->address) == 0))
 			*(cbba->gb) = gb;
 	}
 }
--- a/libpurple/protocols/gg/lib/pubdir50.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/protocols/gg/lib/pubdir50.c	Mon May 14 23:35:50 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/oscar/oscar.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Mon May 14 23:35:50 2007 +0000
@@ -304,15 +304,15 @@
 
 	if ((encoding == NULL) || encoding[0] == '\0') {
 		purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n");
-	} else if (!strcasecmp(encoding, "iso-8859-1")) {
+	} else if (!g_ascii_strcasecmp(encoding, "iso-8859-1")) {
 		utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL);
-	} else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") ||
-	           !strcasecmp(encoding, "us-ascii"))
+	} else if (!g_ascii_strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") ||
+	           !g_ascii_strcasecmp(encoding, "us-ascii"))
 	{
 		utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL);
-	} else if (!strcasecmp(encoding, "unicode-2-0")) {
+	} else if (!g_ascii_strcasecmp(encoding, "unicode-2-0")) {
 		utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
-	} else if (strcasecmp(encoding, "utf-8")) {
+	} else if (g_ascii_strcasecmp(encoding, "utf-8")) {
 		purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
 						   "attempting to convert to UTF-8 anyway\n", encoding);
 		utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL);
@@ -362,7 +362,7 @@
 	if ((charsetstr == NULL) || (*charsetstr == '\0'))
 		return NULL;
 
-	if (strcasecmp("UTF-8", charsetstr)) {
+	if (g_ascii_strcasecmp("UTF-8", charsetstr)) {
 		if (fallback)
 			ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err);
 		else
--- a/libpurple/protocols/simple/simple.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/protocols/simple/simple.c	Mon May 14 23:35:50 2007 +0000
@@ -1239,9 +1239,9 @@
 			while(tmp && tmp < acceptheader + strlen(acceptheader)) {
 				gchar *tmp2 = strchr(tmp, ',');
 				if(tmp2) *tmp2 = '\0';
-				if(!strcasecmp("application/pidf+xml", tmp))
+				if(!g_ascii_strcasecmp("application/pidf+xml", tmp))
 					foundpidf = TRUE;
-				if(!strcasecmp("application/xpidf+xml", tmp))
+				if(!g_ascii_strcasecmp("application/xpidf+xml", tmp))
 					foundxpidf = TRUE;
 				if(tmp2) {
 					*tmp2 = ',';
--- a/libpurple/protocols/simple/sipmsg.c	Mon May 14 23:35:28 2007 +0000
+++ b/libpurple/protocols/simple/sipmsg.c	Mon May 14 23:35:50 2007 +0000
@@ -180,7 +180,7 @@
 	GSList *tmp = msg->headers;
 	while(tmp) {
 		elem = tmp->data;
-		if(strcasecmp(elem->name, name)==0) {
+		if(g_ascii_strcasecmp(elem->name, name)==0) {
 			msg->headers = g_slist_remove(msg->headers, elem);
 			g_free(elem->name);
 			g_free(elem->value);
@@ -198,7 +198,7 @@
 	tmp = msg->headers;
 	while(tmp) {
 		elem = tmp->data;
-		if(strcasecmp(elem->name, name)==0) {
+		if(g_ascii_strcasecmp(elem->name, name)==0) {
 			return elem->value;
 		}
 		tmp = g_slist_next(tmp);
--- a/pidgin/gtkutils.c	Mon May 14 23:35:28 2007 +0000
+++ b/pidgin/gtkutils.c	Mon May 14 23:35:50 2007 +0000
@@ -3017,7 +3017,7 @@
 	PangoLogAttr *log_attrs;
 	gchar *word;
 
-	if (strcasecmp(key, "Global Thermonuclear War") == 0)
+	if (g_ascii_strcasecmp(key, "Global Thermonuclear War") == 0)
 	{
 		purple_notify_info(NULL, "WOPR",
 				"Wouldn't you prefer a nice game of chess?", NULL);