/cpw/tomkiewicz/gg11: c27e31267e8d: Gadu-Gadu: fix compilation o...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Wed Feb 6 07:39:58 EST 2013


Changeset: c27e31267e8dfdba33f11aab1cd8e6f3834040e9
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-02-06 13:39 +0100
Branch:	 default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/c27e31267e8d

Description:

Gadu-Gadu: fix compilation on 64-bit targets

diffstat:

 libpurple/protocols/gg/chat.c         |  24 +++++++++++++++---------
 libpurple/protocols/gg/edisc.c        |   2 +-
 libpurple/protocols/gg/image.c        |  15 +++++++++------
 libpurple/protocols/gg/image.h        |   1 +
 libpurple/protocols/gg/message-prpl.c |  17 ++++++++++-------
 5 files changed, 36 insertions(+), 23 deletions(-)

diffs (228 lines):

diff --git a/libpurple/protocols/gg/chat.c b/libpurple/protocols/gg/chat.c
--- a/libpurple/protocols/gg/chat.c
+++ b/libpurple/protocols/gg/chat.c
@@ -181,7 +181,8 @@ void ggp_chat_got_event(PurpleConnection
 		if (!chat)
 		{
 			purple_debug_error("gg", "ggp_chat_got_event: "
-				"chat %llu not found\n", eciu->id);
+				"chat %" G_GUINT64_FORMAT " not found\n",
+				eciu->id);
 			return;
 		}
 		if (eciu->type == GG_CHAT_INFO_UPDATE_ENTERED)
@@ -228,8 +229,8 @@ static void ggp_chat_joined(ggp_chat_loc
 	if (idx >= 0)
 	{
 		purple_debug_warning("gg", "ggp_chat_joined: "
-			"user %u is already present in chat %llu\n",
-			uin, chat->id);
+			"user %u is already present in chat %" G_GUINT64_FORMAT
+			"\n", uin, chat->id);
 		return;
 	}
 	chat->participants_count++;
@@ -251,7 +252,8 @@ static void ggp_chat_left(ggp_chat_local
 	if (idx < 0)
 	{
 		purple_debug_warning("gg", "ggp_chat_joined: "
-			"user %u isn't present in chat %llu\n", uin, chat->id);
+			"user %u isn't present in chat %" G_GUINT64_FORMAT "\n",
+			uin, chat->id);
 		return;
 	}
 	chat->participants[idx] =
@@ -313,7 +315,7 @@ char * ggp_chat_get_name(GHashTable *com
 static const gchar * ggp_chat_get_name_from_id(uint64_t id)
 {
 	static gchar buff[30];
-	g_snprintf(buff, sizeof(buff), "%llu", id);
+	g_snprintf(buff, sizeof(buff), "%" G_GUINT64_FORMAT, id);
 	return buff;
 }
 
@@ -394,8 +396,10 @@ static void ggp_chat_join_id(PurpleConne
 	
 	if (!chat)
 	{
+		char *id_s = g_strdup_printf("%" G_GUINT64_FORMAT, id);
 		char *buff = g_strdup_printf(
-			_("%llu is not a valid room identifier"), id);
+			_("%s is not a valid room identifier"), id_s);
+		g_free(id_s);
 		purple_notify_error(gc, _("Invalid Room Identifier"),
 			_("Invalid Room Identifier"), buff);
 		g_free(buff);
@@ -430,7 +434,8 @@ void ggp_chat_leave(PurpleConnection *gc
 	if (gg_chat_leave(info->session, chat->id) < 0)
 	{
 		purple_debug_error("gg", "ggp_chat_leave: "
-			"unable to leave chat %llu\n", chat->id);
+			"unable to leave chat %" G_GUINT64_FORMAT "\n",
+			chat->id);
 	}
 	chat->conv = NULL;
 
@@ -460,7 +465,8 @@ void ggp_chat_invite(PurpleConnection *g
 	if (gg_chat_invite(info->session, chat->id, &invited, 1) < 0)
 	{
 		purple_debug_error("gg", "ggp_chat_invite: "
-			"unable to invite %s to chat %llu\n", who, chat->id);
+			"unable to invite %s to chat %" G_GUINT64_FORMAT "\n",
+			who, chat->id);
 	}
 }
 
@@ -511,7 +517,7 @@ void ggp_chat_got_message(PurpleConnecti
 	if (!chat)
 	{
 		purple_debug_error("gg", "ggp_chat_got_message: "
-			"chat %llu doesn't exists\n", chat_id);
+			"chat %" G_GUINT64_FORMAT " doesn't exists\n", chat_id);
 		return;
 	}
 
diff --git a/libpurple/protocols/gg/edisc.c b/libpurple/protocols/gg/edisc.c
--- a/libpurple/protocols/gg/edisc.c
+++ b/libpurple/protocols/gg/edisc.c
@@ -528,7 +528,7 @@ static void ggp_edisc_xfer_send_reader(P
 
 	if (edisc_xfer->already_read != offset) {
 		purple_debug_error("gg", "ggp_edisc_xfer_send_reader: "
-			"Invalid offset (%d != %d)\n",
+			"Invalid offset (%d != %" G_GSIZE_FORMAT ")\n",
 			edisc_xfer->already_read, offset);
 		ggp_edisc_xfer_error(xfer, _("Error while reading a file"));
 		return;
diff --git a/libpurple/protocols/gg/image.c b/libpurple/protocols/gg/image.c
--- a/libpurple/protocols/gg/image.c
+++ b/libpurple/protocols/gg/image.c
@@ -183,7 +183,8 @@ void ggp_image_recv(PurpleConnection *gc
 	id = ggp_image_params_to_id(image_reply->crc32, image_reply->size);
 	
 	purple_debug_info("gg", "ggp_image_recv: got image "
-		"[stored_id=%d, crc=%u, size=%u, filename=%s, id=%016llx]\n",
+		"[stored_id=%d, crc=%u, size=%u, filename=%s, id="
+		GGP_IMAGE_ID_FORMAT "]\n",
 		stored_id,
 		image_reply->crc32,
 		image_reply->size,
@@ -197,7 +198,8 @@ void ggp_image_recv(PurpleConnection *gc
 	if (!req)
 	{
 		purple_debug_warning("gg", "ggp_image_recv: "
-			"image %016llx wasn't requested\n", id);
+			"image " GGP_IMAGE_ID_FORMAT " wasn't requested\n",
+			id);
 		return;
 	}
 
@@ -248,7 +250,7 @@ void ggp_image_send(PurpleConnection *gc
 	}
 	
 	purple_debug_misc("gg", "ggp_image_send: requested image found "
-		"[id=%016llx, stored id=%d, conv=%s]\n",
+		"[id=" GGP_IMAGE_ID_FORMAT ", stored id=%d, conv=%s]\n",
 		id,
 		sent_image->id,
 		sent_image->conv_name);
@@ -265,7 +267,7 @@ void ggp_image_send(PurpleConnection *gc
 	}
 	
 	//TODO: check allowed recipients
-	gg_filename = g_strdup_printf("%016llx", id);
+	gg_filename = g_strdup_printf(GGP_IMAGE_ID_FORMAT, id);
 	gg_image_reply(accdata->session, image_request->sender,
 		gg_filename,
 		purple_imgstore_get_data(image),
@@ -313,14 +315,15 @@ void ggp_image_request(PurpleConnection 
 		g_hash_table_insert(sdata->incoming_images,
 			ggp_uint64dup(id), req);
 		purple_debug_info("gg", "ggp_image_request: "
-			"requesting image %016llx\n", id);
+			"requesting image " GGP_IMAGE_ID_FORMAT "\n", id);
 		if (gg_image_request(accdata->session, uin, size, crc) != 0)
 			purple_debug_error("gg", "ggp_image_request: failed\n");
 	}
 	else
 	{
 		purple_debug_info("gg", "ggp_image_request: "
-			"image %016llx already requested\n", id);
+			"image " GGP_IMAGE_ID_FORMAT " already requested\n",
+			id);
 	}
 	
 	listener = g_new0(ggp_image_requested_listener, 1);
diff --git a/libpurple/protocols/gg/image.h b/libpurple/protocols/gg/image.h
--- a/libpurple/protocols/gg/image.h
+++ b/libpurple/protocols/gg/image.h
@@ -34,6 +34,7 @@
 #include <libgadu.h>
 
 #define GGP_IMAGE_SIZE_MAX 255000
+#define GGP_IMAGE_ID_FORMAT "%016" G_GINT64_MODIFIER "x"
 
 typedef struct _ggp_image_session_data ggp_image_session_data;
 
diff --git a/libpurple/protocols/gg/message-prpl.c b/libpurple/protocols/gg/message-prpl.c
--- a/libpurple/protocols/gg/message-prpl.c
+++ b/libpurple/protocols/gg/message-prpl.c
@@ -12,7 +12,7 @@
 #define GGP_GG10_DEFAULT_FORMAT_REPLACEMENT "<span>"
 #define GGP_GG11_FORCE_COMPAT FALSE
 
-#define GGP_IMAGE_REPLACEMENT "<img id=\"gg-pending-image-%016llx\">"
+#define GGP_IMAGE_REPLACEMENT "<img id=\"gg-pending-image-" GGP_IMAGE_ID_FORMAT "\">"
 #define GGP_IMAGE_DESTINATION "<img src=\"" PURPLE_STORED_IMAGE_PROTOCOL "%u\">"
 
 typedef struct
@@ -183,7 +183,8 @@ static void ggp_message_request_images_g
 	if (!i_it)
 	{
 		purple_debug_error("gg", "ggp_message_request_images_got: "
-			"image %016llx is not present in this message\n", id);
+			"image " GGP_IMAGE_ID_FORMAT " is not present in this "
+			"message\n", id);
 		return;
 	}
 
@@ -202,8 +203,8 @@ static void ggp_message_request_images_g
 	if (msg->pending_images != NULL)
 	{
 		purple_debug_info("gg", "ggp_message_request_images_got: "
-			"got image %016llx, but the message contains more "
-			"of them\n", id);
+			"got image " GGP_IMAGE_ID_FORMAT ", but the message "
+			"contains more of them\n", id);
 		return;
 	}
 
@@ -323,7 +324,7 @@ static gboolean ggp_message_format_from_
 	int stored_id;
 
 	name = g_match_info_fetch(info, 1);
-	if (sscanf(name, "%llx", &id) != 1)
+	if (sscanf(name, "%" G_GINT64_MODIFIER "x", &id) != 1)
 		id = 0;
 	g_free(name);
 	if (!id)
@@ -339,7 +340,8 @@ static gboolean ggp_message_format_from_
 	if (stored_id > 0)
 	{
 		purple_debug_info("gg", "ggp_message_format_from_gg_found_img: "
-			"getting image %016llx from cache\n", id);
+			"getting image " GGP_IMAGE_ID_FORMAT " from cache\n",
+			id);
 		replacement = g_strdup_printf(GGP_IMAGE_DESTINATION, stored_id);
 		g_string_append(res, replacement);
 		g_free(replacement);
@@ -583,7 +585,8 @@ gchar * ggp_message_format_to_gg(PurpleC
 			{
 				pending_objects = g_list_prepend(
 					pending_objects, g_strdup_printf(
-					"<img name=\"%016llx\">", id));
+					"<img name=\"" GGP_IMAGE_ID_FORMAT
+					"\">", id));
 			}
 			else if (res == GGP_IMAGE_PREPARE_TOO_BIG)
 			{



More information about the Commits mailing list