/pidgin/main: bd15903d0d89: Gadu-Gadu: fix compilation on 64bit ...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Wed Aug 22 06:00:24 EDT 2012


Changeset: bd15903d0d8909011b423429016eec06ba1df94d
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-08-22 12:00 +0200
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/bd15903d0d89

Description:

Gadu-Gadu: fix compilation on 64bit targets

diffstat:

 libpurple/protocols/gg/Makefile.am          |   5 +++--
 libpurple/protocols/gg/account.c            |  13 ++++++-------
 libpurple/protocols/gg/avatar.c             |   2 +-
 libpurple/protocols/gg/image.c              |   2 +-
 libpurple/protocols/gg/libgadu-events.c     |   2 +-
 libpurple/protocols/gg/libgaduw.c           |   9 ++++-----
 libpurple/protocols/gg/oauth/oauth-purple.c |   2 +-
 libpurple/protocols/gg/pubdir-prpl.c        |  27 ++++++++++++++++-----------
 libpurple/protocols/gg/resolver-purple.c    |  12 ++++++------
 9 files changed, 39 insertions(+), 35 deletions(-)

diffs (251 lines):

diff --git a/libpurple/protocols/gg/Makefile.am b/libpurple/protocols/gg/Makefile.am
--- a/libpurple/protocols/gg/Makefile.am
+++ b/libpurple/protocols/gg/Makefile.am
@@ -1,4 +1,5 @@
-V=0
+#V=0
+#GADU_EXTRA_WARNINGS = -Wall -Wextra -Werror
 
 pkgdir = $(libdir)/purple-$(PURPLE_MAJOR_VERSION)
 
@@ -117,7 +118,7 @@ libgg_la_LIBADD  = $(GLIB_LIBS) $(GADU_L
 endif
 
 AM_CPPFLAGS = \
-	-Wall -Wextra -Werror \
+	$(GADU_EXTRA_WARNINGS) \
 	-I$(top_srcdir)/libpurple \
 	-I$(top_builddir)/libpurple \
 	$(INTGG_CFLAGS) \
diff --git a/libpurple/protocols/gg/account.c b/libpurple/protocols/gg/account.c
--- a/libpurple/protocols/gg/account.c
+++ b/libpurple/protocols/gg/account.c
@@ -197,9 +197,8 @@ static void ggp_account_register_dialog(
 	PurpleRequestField *field, *field_password;
 	ggp_account_register_data *register_data = _register_data;
 	
-	purple_debug_info("gg", "ggp_account_register_dialog(%x, %x, %x)\n",
-		(unsigned int)gc, (unsigned int)token,
-		(unsigned int)_register_data);
+	purple_debug_info("gg", "ggp_account_register_dialog(%p, %p, %p)\n",
+		gc, token, _register_data);
 	if (!token)
 	{
 		ggp_account_register_completed(register_data, FALSE);
@@ -269,8 +268,8 @@ static void ggp_account_register_dialog(
 static void ggp_account_register_dialog_cancel(
 	ggp_account_register_data *register_data, PurpleRequestFields *fields)
 {
-	purple_debug_info("gg", "ggp_account_register_dialog_cancel(%x, %x)\n",
-		(unsigned int)register_data, (unsigned int)fields);
+	purple_debug_info("gg", "ggp_account_register_dialog_cancel(%p, %p)\n",
+		register_data, fields);
 
 	ggp_account_register_completed(register_data, FALSE);
 }
@@ -280,8 +279,8 @@ static void ggp_account_register_dialog_
 {
 	struct gg_http *h;
 
-	purple_debug_misc("gg", "ggp_account_register_dialog_ok(%x, %x)\n",
-		(unsigned int)register_data, (unsigned int)fields);
+	purple_debug_misc("gg", "ggp_account_register_dialog_ok(%p, %p)\n",
+		register_data, fields);
 
 	g_free(register_data->email);
 	g_free(register_data->password);
diff --git a/libpurple/protocols/gg/avatar.c b/libpurple/protocols/gg/avatar.c
--- a/libpurple/protocols/gg/avatar.c
+++ b/libpurple/protocols/gg/avatar.c
@@ -360,7 +360,7 @@ static void ggp_avatar_own_got_token(Pur
 		"Host: avatars.nowe.gg\r\n"
 		"Authorization: %s\r\n"
 		"From: avatars to avatars\r\n"
-		"Content-Length: %u\r\n"
+		"Content-Length: %zu\r\n"
 		"Content-Type: application/x-www-form-urlencoded\r\n"
 		"\r\n%s",
 		token, strlen(request_data), request_data);
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
@@ -151,7 +151,7 @@ ggp_image_prepare_result ggp_image_prepa
 	image_crc = gg_crc32(0, image_data, image_size);
 	
 	purple_debug_info("gg", "ggp_image_prepare_to_send: image prepared "
-		"[id=%d, crc=%u, size=%d, filename=%s]\n",
+		"[id=%d, crc=%u, size=%zu, filename=%s]\n",
 		id, image_crc, image_size, image_filename);
 	
 	pending_image = g_new(ggp_image_pending_image, 1);
diff --git a/libpurple/protocols/gg/libgadu-events.c b/libpurple/protocols/gg/libgadu-events.c
--- a/libpurple/protocols/gg/libgadu-events.c
+++ b/libpurple/protocols/gg/libgadu-events.c
@@ -38,7 +38,7 @@ void ggp_events_user_data(PurpleConnecti
 	int user_idx;
 	gboolean is_update;
 	
-	purple_debug_info("gg", "GG_EVENT_USER_DATA [type=%d, user_count=%d]\n",
+	purple_debug_info("gg", "GG_EVENT_USER_DATA [type=%d, user_count=%zu]\n",
 		data->type, data->user_count);
 	
 	/*
diff --git a/libpurple/protocols/gg/libgaduw.c b/libpurple/protocols/gg/libgaduw.c
--- a/libpurple/protocols/gg/libgaduw.c
+++ b/libpurple/protocols/gg/libgaduw.c
@@ -53,8 +53,8 @@ ggp_libgaduw_http_req * ggp_libgaduw_htt
 	gpointer user_data, gboolean show_processing)
 {
 	ggp_libgaduw_http_req *req;
-	purple_debug_misc("gg", "ggp_libgaduw_http_watch(h=%x, "
-		"show_processing=%d)\n", (unsigned int)h, show_processing);
+	purple_debug_misc("gg", "ggp_libgaduw_http_watch(h=%p, "
+		"show_processing=%d)\n", h, show_processing);
 	
 	req = g_new(ggp_libgaduw_http_req, 1);
 	req->user_data = user_data;
@@ -126,9 +126,8 @@ void ggp_libgaduw_http_cancel(ggp_libgad
 static void ggp_libgaduw_http_finish(ggp_libgaduw_http_req *req,
 	gboolean success)
 {
-	purple_debug_misc("gg", "ggp_libgaduw_http_finish(h=%x, processing=%x):"
-		" success=%d\n", (unsigned int)req->h,
-		(unsigned int)req->processing, success);
+	purple_debug_misc("gg", "ggp_libgaduw_http_finish(h=%p, processing=%p):"
+		" success=%d\n", req->h, req->processing, success);
 	if (req->processing)
 	{
 		ggp_purplew_request_processing_done(req->processing);
diff --git a/libpurple/protocols/gg/oauth/oauth-purple.c b/libpurple/protocols/gg/oauth/oauth-purple.c
--- a/libpurple/protocols/gg/oauth/oauth-purple.c
+++ b/libpurple/protocols/gg/oauth/oauth-purple.c
@@ -168,7 +168,7 @@ static void ggp_oauth_request_token_got(
 	request = g_strdup_printf(
 		"POST /authorize HTTP/1.1\r\n"
 		"Host: login.gadu-gadu.pl\r\n"
-		"Content-Length: %d\r\n"
+		"Content-Length: %zu\r\n"
 		"Content-Type: application/x-www-form-urlencoded\r\n"
 		"\r\n%s",
 		strlen(request_data), request_data);
diff --git a/libpurple/protocols/gg/pubdir-prpl.c b/libpurple/protocols/gg/pubdir-prpl.c
--- a/libpurple/protocols/gg/pubdir-prpl.c
+++ b/libpurple/protocols/gg/pubdir-prpl.c
@@ -68,11 +68,11 @@ static void ggp_pubdir_got_data(PurpleUt
 
 static void ggp_pubdir_get_info_prpl_got(PurpleConnection *gc,
 	int records_count, const ggp_pubdir_record *records, int next_offset,
-	void *_uin);
+	void *_uin_p);
 
 static void ggp_pubdir_request_buddy_alias_got(PurpleConnection *gc,
 	int records_count, const ggp_pubdir_record *records, int next_offset,
-	void *_uin);
+	void *user_data);
 
 // Searching for buddies.
 
@@ -359,21 +359,26 @@ static void ggp_pubdir_got_data(PurpleUt
 void ggp_pubdir_get_info_prpl(PurpleConnection *gc, const char *name)
 {
 	uin_t uin = ggp_str_to_uin(name);
+	uin_t *uin_p = g_new0(uin_t, 1);
+
+	*uin_p = uin;
 
 	purple_debug_info("gg", "ggp_pubdir_get_info_prpl: %u\n", uin);
 
-	ggp_pubdir_get_info(gc, uin, ggp_pubdir_get_info_prpl_got, (void*)uin);
+	ggp_pubdir_get_info(gc, uin, ggp_pubdir_get_info_prpl_got, uin_p);
 }
 
 static void ggp_pubdir_get_info_prpl_got(PurpleConnection *gc,
 	int records_count, const ggp_pubdir_record *records, int next_offset,
-	void *_uin)
+	void *_uin_p)
 {
-	uin_t uin = (uin_t)_uin;
+	uin_t uin = *((uin_t*)_uin_p);
 	PurpleNotifyUserInfo *info = purple_notify_user_info_new();
 	const ggp_pubdir_record *record = &records[0];
 	PurpleBuddy *buddy;
 	
+	g_free(_uin_p);
+	
 	if (records_count < 1)
 	{
 		purple_debug_error("gg", "ggp_pubdir_get_info_prpl_got: "
@@ -450,23 +455,23 @@ void ggp_pubdir_request_buddy_alias(Purp
 
 	purple_debug_info("gg", "ggp_pubdir_request_buddy_alias: %u\n", uin);
 
-	ggp_pubdir_get_info(gc, uin, ggp_pubdir_request_buddy_alias_got, (void*)uin);
+	ggp_pubdir_get_info(gc, uin, ggp_pubdir_request_buddy_alias_got, NULL);
 }
 
 static void ggp_pubdir_request_buddy_alias_got(PurpleConnection *gc,
 	int records_count, const ggp_pubdir_record *records, int next_offset,
-	void *_uin)
+	void *user_data)
 {
-	uin_t uin = (uin_t)_uin;
+	uin_t uin;
 	const gchar *alias;
 	
 	if (records_count < 0)
 	{
 		purple_debug_error("gg", "ggp_pubdir_request_buddy_alias_got: "
-			"couldn't get info for %u\n", uin);
+			"couldn't get info for user\n");
 		return;
 	}
-	g_assert(uin == records[0].uin);
+	uin = records[0].uin;
 	
 	alias = records[0].label;
 	if (!alias)
@@ -967,7 +972,7 @@ static void ggp_pubdir_set_info_got_toke
 		"PUT /users/%u.xml HTTP/1.1\r\n"
 		"Host: api.gadu-gadu.pl\r\n"
 		"%s\r\n"
-		"Content-Length: %d\r\n"
+		"Content-Length: %zu\r\n"
 		"Content-Type: application/x-www-form-urlencoded\r\n"
 		"\r\n%s",
 		uin, token, strlen(request_data), request_data);
diff --git a/libpurple/protocols/gg/resolver-purple.c b/libpurple/protocols/gg/resolver-purple.c
--- a/libpurple/protocols/gg/resolver-purple.c
+++ b/libpurple/protocols/gg/resolver-purple.c
@@ -72,8 +72,8 @@ void ggp_resolver_purple_cb(GSList *host
 	int ipv4_count, all_count, write_size;
 	struct in_addr *addresses;
 	
-	purple_debug_misc("gg", "ggp_resolver_purple_cb(%x, %x, \"%s\")\n",
-		(unsigned int)hosts, (unsigned int)cbdata, error_message);
+	purple_debug_misc("gg", "ggp_resolver_purple_cb(%p, %p, \"%s\")\n",
+		hosts, cbdata, error_message);
 	
 	if (error_message)
 	{
@@ -137,8 +137,8 @@ int ggp_resolver_purple_start(int *fd, v
 	const char *hostname)
 {
 	ggp_resolver_purple_data *data;
-	purple_debug_misc("gg", "ggp_resolver_purple_start(%x, %x, \"%s\")\n",
-		(unsigned int)fd, (unsigned int)private_data, hostname);
+	purple_debug_misc("gg", "ggp_resolver_purple_start(%p, %p, \"%s\")\n",
+		fd, private_data, hostname);
 	
 	data = malloc(sizeof(ggp_resolver_purple_data));
 	*private_data = (void*)data;
@@ -176,8 +176,8 @@ void ggp_resolver_purple_cleanup(void **
 	ggp_resolver_purple_data *data =
 		(ggp_resolver_purple_data*)(*private_data);
 	
-	purple_debug_misc("gg", "ggp_resolver_purple_cleanup(%x, %d)\n",
-		(unsigned int)private_data, force);
+	purple_debug_misc("gg", "ggp_resolver_purple_cleanup(%p, %d)\n",
+		private_data, force);
 	
 	if (!data)
 		return;



More information about the Commits mailing list