comparison libpurple/protocols/oscar/oscar.c @ 17095:7ade887fd3f6

Replace strcasecmp() calls with glib equivalents.
author Richard Laager <rlaager@wiktel.com>
date Mon, 14 May 2007 23:35:50 +0000
parents 84b7a625512e
children 2e4e3c3028ae
comparison
equal deleted inserted replaced
17094:f6dd1f7689ee 17095:7ade887fd3f6
302 { 302 {
303 gchar *utf8 = NULL; 303 gchar *utf8 = NULL;
304 304
305 if ((encoding == NULL) || encoding[0] == '\0') { 305 if ((encoding == NULL) || encoding[0] == '\0') {
306 purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n"); 306 purple_debug_info("oscar", "Empty encoding, assuming UTF-8\n");
307 } else if (!strcasecmp(encoding, "iso-8859-1")) { 307 } else if (!g_ascii_strcasecmp(encoding, "iso-8859-1")) {
308 utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL); 308 utf8 = g_convert(text, textlen, "UTF-8", "iso-8859-1", NULL, NULL, NULL);
309 } else if (!strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") || 309 } else if (!g_ascii_strcasecmp(encoding, "ISO-8859-1-Windows-3.1-Latin-1") ||
310 !strcasecmp(encoding, "us-ascii")) 310 !g_ascii_strcasecmp(encoding, "us-ascii"))
311 { 311 {
312 utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL); 312 utf8 = g_convert(text, textlen, "UTF-8", "Windows-1252", NULL, NULL, NULL);
313 } else if (!strcasecmp(encoding, "unicode-2-0")) { 313 } else if (!g_ascii_strcasecmp(encoding, "unicode-2-0")) {
314 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL); 314 utf8 = g_convert(text, textlen, "UTF-8", "UCS-2BE", NULL, NULL, NULL);
315 } else if (strcasecmp(encoding, "utf-8")) { 315 } else if (g_ascii_strcasecmp(encoding, "utf-8")) {
316 purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", " 316 purple_debug_warning("oscar", "Unrecognized character encoding \"%s\", "
317 "attempting to convert to UTF-8 anyway\n", encoding); 317 "attempting to convert to UTF-8 anyway\n", encoding);
318 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL); 318 utf8 = g_convert(text, textlen, "UTF-8", encoding, NULL, NULL, NULL);
319 } 319 }
320 320
360 GError *err = NULL; 360 GError *err = NULL;
361 361
362 if ((charsetstr == NULL) || (*charsetstr == '\0')) 362 if ((charsetstr == NULL) || (*charsetstr == '\0'))
363 return NULL; 363 return NULL;
364 364
365 if (strcasecmp("UTF-8", charsetstr)) { 365 if (g_ascii_strcasecmp("UTF-8", charsetstr)) {
366 if (fallback) 366 if (fallback)
367 ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err); 367 ret = g_convert_with_fallback(data, datalen, "UTF-8", charsetstr, "?", NULL, NULL, &err);
368 else 368 else
369 ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err); 369 ret = g_convert(data, datalen, "UTF-8", charsetstr, NULL, NULL, &err);
370 if (err != NULL) { 370 if (err != NULL) {