# HG changeset patch # User Daniel Atallah # Date 1186884665 0 # Node ID 47942d19f301364688299b25a4e58d16e50618ac # Parent e1afc0e009d27396280ebd25fcc9ba630763ab28 Use -1 as length with g_convert() functions instead of strlen() diff -r e1afc0e009d2 -r 47942d19f301 libpurple/protocols/jabber/auth.c --- a/libpurple/protocols/jabber/auth.c Sun Aug 12 01:52:10 2007 +0000 +++ b/libpurple/protocols/jabber/auth.c Sun Aug 12 02:11:05 2007 +0000 @@ -682,11 +682,11 @@ gchar *a1, *convnode=NULL, *convpasswd = NULL, *ha1, *ha2, *kd, *x, *z; - if((convnode = g_convert(jid->node, strlen(jid->node), "iso-8859-1", "utf-8", + if((convnode = g_convert(jid->node, -1, "iso-8859-1", "utf-8", NULL, NULL, NULL)) == NULL) { convnode = g_strdup(jid->node); } - if(passwd && ((convpasswd = g_convert(passwd, strlen(passwd), "iso-8859-1", + if(passwd && ((convpasswd = g_convert(passwd, -1, "iso-8859-1", "utf-8", NULL, NULL, NULL)) == NULL)) { convpasswd = g_strdup(passwd); } diff -r e1afc0e009d2 -r 47942d19f301 libpurple/protocols/oscar/oscar.c --- a/libpurple/protocols/oscar/oscar.c Sun Aug 12 01:52:10 2007 +0000 +++ b/libpurple/protocols/oscar/oscar.c Sun Aug 12 02:11:05 2007 +0000 @@ -482,7 +482,7 @@ /* Attempt to send as ASCII */ if (oscar_charset_check(from) == AIM_CHARSET_ASCII) { - *msg = g_convert(from, strlen(from), "ASCII", "UTF-8", NULL, &msglen, NULL); + *msg = g_convert(from, -1, "ASCII", "UTF-8", NULL, &msglen, NULL); *charset = AIM_CHARSET_ASCII; *charsubset = 0x0000; *msglen_int = msglen; @@ -504,7 +504,7 @@ b = purple_find_buddy(account, destsn); if ((b != NULL) && (PURPLE_BUDDY_IS_ONLINE(b))) { - *msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, NULL); + *msg = g_convert(from, -1, "UCS-2BE", "UTF-8", NULL, &msglen, NULL); if (*msg != NULL) { *charset = AIM_CHARSET_UNICODE; @@ -527,7 +527,7 @@ * XXX - We need a way to only attempt to convert if we KNOW "from" * can be converted to "charsetstr" */ - *msg = g_convert(from, strlen(from), charsetstr, "UTF-8", NULL, &msglen, NULL); + *msg = g_convert(from, -1, charsetstr, "UTF-8", NULL, &msglen, NULL); if (*msg != NULL) { *charset = AIM_CHARSET_CUSTOM; *charsubset = 0x0000; @@ -538,7 +538,7 @@ /* * Nothing else worked, so send as UCS-2BE. */ - *msg = g_convert(from, strlen(from), "UCS-2BE", "UTF-8", NULL, &msglen, &err); + *msg = g_convert(from, -1, "UCS-2BE", "UTF-8", NULL, &msglen, &err); if (*msg != NULL) { *charset = AIM_CHARSET_UNICODE; *charsubset = 0x0000; @@ -4348,10 +4348,10 @@ charset = oscar_charset_check(str); if (charset == AIM_CHARSET_UNICODE) { - encoded = g_convert(str, strlen(str), "UCS-2BE", "UTF-8", NULL, ret_len, NULL); + encoded = g_convert(str, -1, "UCS-2BE", "UTF-8", NULL, ret_len, NULL); *encoding = "unicode-2-0"; } else if (charset == AIM_CHARSET_CUSTOM) { - encoded = g_convert(str, strlen(str), "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); + encoded = g_convert(str, -1, "ISO-8859-1", "UTF-8", NULL, ret_len, NULL); *encoding = "iso-8859-1"; } else { encoded = g_strdup(str); diff -r e1afc0e009d2 -r 47942d19f301 libpurple/protocols/yahoo/util.c --- a/libpurple/protocols/yahoo/util.c Sun Aug 12 01:52:10 2007 +0000 +++ b/libpurple/protocols/yahoo/util.c Sun Aug 12 02:11:05 2007 +0000 @@ -61,7 +61,7 @@ else to_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - ret = g_convert_with_fallback(str, strlen(str), to_codeset, "UTF-8", "?", NULL, NULL, NULL); + ret = g_convert_with_fallback(str, -1, to_codeset, "UTF-8", "?", NULL, NULL, NULL); if (ret) return ret; else @@ -92,7 +92,7 @@ else from_codeset = purple_account_get_string(purple_connection_get_account(gc), "local_charset", "ISO-8859-1"); - ret = g_convert_with_fallback(str, strlen(str), "UTF-8", from_codeset, NULL, NULL, NULL, NULL); + ret = g_convert_with_fallback(str, -1, "UTF-8", from_codeset, NULL, NULL, NULL, NULL); if (ret) return ret;