changeset 27756:4362f871369c

Using g_convert instead of g_utf16_to_utf8 so that we can explicitly set the input byte order. It should always be little-endian and not depend on the host order.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Fri, 31 Jul 2009 04:04:24 +0000
parents 6c9c6123b942
children a82fec14ac0f
files libpurple/protocols/msn/slpcall.c
diffstat 1 files changed, 7 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/msn/slpcall.c	Fri Jul 31 03:53:00 2009 +0000
+++ b/libpurple/protocols/msn/slpcall.c	Fri Jul 31 04:04:24 2009 +0000
@@ -206,12 +206,12 @@
 		{
 			/* 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(body, body_len / 2, "UTF16-LE", "UTF-8",
+			                     &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 +228,8 @@
 			}
 			g_free(body_str);
 
-			body_str = g_utf16_to_utf8((gunichar2 *)body, body_len / 2,
-			                           &items_read, &items_written, &error);
+			body_str = g_convert(body, body_len / 2, "UTF16-LE", "UTF-8",
+			                     &bytes_read, &bytes_written, &error);
 			if (!body_str)
 			{
 				purple_debug_error("msn",