merge of 'bdc788d3215b77774940854f52aa6d9e16192d7a'

Fri, 31 Jul 2009 04:09:41 +0000

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 31 Jul 2009 04:09:41 +0000
changeset 28025
23f8518f6240
parent 28024
bdc788d3215b (diff)
parent 28019
9fbe6f412d24 (current diff)
child 28026
bbb51b6744ec

merge of 'bdc788d3215b77774940854f52aa6d9e16192d7a'
and '9fbe6f412d249c1507939feec779ef1840cef174'

--- 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",

mercurial