pidgin: 93e391d8: Using g_convert instead of g_utf16_to_ut...

qulogic at pidgin.im qulogic at pidgin.im
Fri Jul 31 00:15:41 EDT 2009


-----------------------------------------------------------------
Revision: 93e391d8405307e56bf2d3abdc6f300531a8b7d4
Ancestor: 755ed2299261658aaaf5351e8561db35bf2df935
Author: qulogic at pidgin.im
Date: 2009-07-31T04:04:24
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/93e391d8405307e56bf2d3abdc6f300531a8b7d4

Modified files:
        libpurple/protocols/msn/slpcall.c

ChangeLog: 

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.

-------------- next part --------------
============================================================
--- libpurple/protocols/msn/slpcall.c	b0e9b07b1c4bf797fc2fe77b2cc2f961544e9b4d
+++ libpurple/protocols/msn/slpcall.c	842011034157f07b297f7c51cddaac3b01561c09
@@ -206,12 +206,12 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 		{
 			/* 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 @@ msn_slp_process_msg(MsnSlpLink *slplink,
 			}
 			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",


More information about the Commits mailing list