changeset 28096:1a6c2144ba08

merge of 'a6c4b3ed3fdfcd5eafd45342656fed541020f353' and 'ae28e0b0bf4488cc755ccad2b98841440ad6fe70'
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 31 Jul 2009 04:09:41 +0000
parents 6c4e816873f7 (diff) 9580364f155f (current diff)
children ae86b03162aa
files
diffstat 2 files changed, 11 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slp.c	Fri Jul 31 03:47:58 2009 +0000
+++ b/libpurple/protocols/msn/slp.c	Fri Jul 31 04:09:41 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-8", "UTF-16LE",
+			                      NULL, NULL, NULL);
 
 			g_free(bin);
 
--- a/libpurple/protocols/msn/slpcall.c	Fri Jul 31 03:47:58 2009 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Jul 31 04:09:41 2009 +0000
@@ -206,12 +206,13 @@
 		{
 			/* This is for handwritten messages (Ink) */
 			GError *error;
-			glong items_read, items_written;
+			gsize bytes_read, bytes_written;
 
-			body_str = g_utf16_to_utf8((gunichar2 *)body, body_len / 2,
-			                           &items_read, &items_written, &error);
-			body_len -= items_read * 2 + 2;
-			body += items_read * 2 + 2;
+			body_str = g_convert((const gchar *)body, body_len / 2,
+			                     "UTF-8", "UTF16-LE",
+			                     &bytes_read, &bytes_written, &error);
+			body_len -= bytes_read + 2;
+			body += bytes_read + 2;
 			if (body_str == NULL
 			 || body_len <= 0
 			 || strstr(body_str, "image/gif") == NULL)
@@ -228,8 +229,9 @@
 			}
 			g_free(body_str);
 
-			body_str = g_utf16_to_utf8((gunichar2 *)body, body_len / 2,
-			                           &items_read, &items_written, &error);
+			body_str = g_convert((const gchar *)body, body_len / 2,
+			                     "UTF-8", "UTF16-LE",
+			                     &bytes_read, &bytes_written, &error);
 			if (!body_str)
 			{
 				purple_debug_error("msn",