| 989 |
989 |
| 990 return g_strdup(inet_ntoa(((struct sockaddr_in *)&addr)->sin_addr)); |
990 return g_strdup(inet_ntoa(((struct sockaddr_in *)&addr)->sin_addr)); |
| 991 } |
991 } |
| 992 |
992 |
| 993 gint gaim_utf8_strcasecmp(const gchar *a, const gchar *b) { |
993 gint gaim_utf8_strcasecmp(const gchar *a, const gchar *b) { |
| 994 gchar *a_norm = g_utf8_casefold(a, -1); |
994 gchar *a_norm=NULL; |
| 995 gchar *b_norm = g_utf8_casefold(b, -1); |
995 gchar *b_norm=NULL; |
| 996 gint ret = g_utf8_collate(a_norm, b_norm); |
996 gint ret=-1; |
| |
997 |
| |
998 if(!g_utf8_validate(a, -1, NULL) || !g_utf8_validate(b, -1, NULL)) { |
| |
999 gaim_debug(GAIM_DEBUG_ERROR, "gaim_utf8_strcasecmp", "One or both parameters are invalid UTF8\n"); |
| |
1000 return ret; |
| |
1001 } |
| |
1002 |
| |
1003 a_norm = g_utf8_casefold(a, -1); |
| |
1004 b_norm = g_utf8_casefold(b, -1); |
| |
1005 ret = g_utf8_collate(a_norm, b_norm); |
| 997 g_free(a_norm); |
1006 g_free(a_norm); |
| 998 g_free(b_norm); |
1007 g_free(b_norm); |
| 999 return ret; |
1008 return ret; |
| 1000 } |
1009 } |
| 1001 |
1010 |