Mercurial > pidgin
changeset 27755:6c9c6123b942
Using g_convert instead of g_utf16_to_utf8 means we don't need to go
through the whole buffer converting it first.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 31 Jul 2009 03:53:00 +0000 |
parents | 46a6465491ac |
children | 4362f871369c |
files | libpurple/protocols/msn/slp.c |
diffstat | 1 files changed, 2 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c Fri Jul 31 03:27:47 2009 +0000 +++ b/libpurple/protocols/msn/slp.c Fri Jul 31 03:53:00 2009 +0000 @@ -324,7 +324,6 @@ gsize bin_len; guint32 file_size; char *file_name; - gunichar2 *uni_name; account = slpcall->slplink->session->account; @@ -342,14 +341,8 @@ bin = (char *)purple_base64_decode(context, &bin_len); file_size = GUINT32_FROM_LE(*(gsize *)(bin + 8)); - uni_name = (gunichar2 *)(bin + 20); - while(*uni_name != 0 && ((char *)uni_name - (bin + 20)) < MAX_FILE_NAME_LEN) { - *uni_name = GUINT16_FROM_LE(*uni_name); - uni_name++; - } - - file_name = g_utf16_to_utf8((const gunichar2 *)(bin + 20), -1, - NULL, NULL, NULL); + file_name = g_convert(bin + 20, -1, "UTF-16LE", "UTF-8", + NULL, NULL, NULL); g_free(bin);