/pidgin/main: ea58ad0e2414: Gadu-Gadu: fix clang warnings

Tomasz Wasilczyk twasilczyk at pidgin.im
Fri Jan 10 16:20:12 EST 2014


Changeset: ea58ad0e2414e7b6d5361d04311886771fbdccb9
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-01-10 22:20 +0100
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/ea58ad0e2414

Description:

Gadu-Gadu: fix clang warnings

diffstat:

 libpurple/protocols/gg/edisc.c       |  24 ++++++++++++++++++++++++
 libpurple/protocols/gg/pubdir-prpl.c |   3 ++-
 2 files changed, 26 insertions(+), 1 deletions(-)

diffs (138 lines):

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
@@ -124,6 +124,8 @@ void ggp_edisc_cleanup(PurpleConnection 
 {
 	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(gc);
 
+	g_return_if_fail(sdata != NULL);
+
 	purple_http_conn_cancel(sdata->auth_request);
 	g_list_free_full(sdata->auth_pending, g_free);
 	g_free(sdata->security_token);
@@ -196,6 +198,7 @@ static void ggp_edisc_xfer_free(PurpleXf
 	purple_http_conn_cancel(edisc_xfer->hc);
 
 	sdata = ggp_edisc_get_sdata(edisc_xfer->gc);
+	g_return_if_fail(sdata != NULL);
 	if (edisc_xfer->ticket_id != NULL)
 		g_hash_table_remove(sdata->xfers_initialized,
 			edisc_xfer->ticket_id);
@@ -230,6 +233,8 @@ void ggp_edisc_xfer_ticket_changed(Purpl
 	ggp_edisc_xfer_ack_status ack_status;
 	gboolean is_completed;
 
+	g_return_if_fail(sdata != NULL);
+
 	parser = ggp_json_parse(data);
 	ticket = json_node_get_object(json_parser_get_root(parser));
 	ticket_id = json_object_get_string_member(ticket, "id");
@@ -397,6 +402,8 @@ static void ggp_edisc_xfer_send_init_aut
 		return;
 	}
 
+	g_return_if_fail(sdata != NULL);
+
 	req = purple_http_request_new("https://drive.mpa.gg.pl/send_ticket");
 	purple_http_request_set_method(req, "PUT");
 
@@ -437,6 +444,8 @@ static void ggp_edisc_xfer_send_init_tic
 	if (purple_xfer_is_cancelled(xfer))
 		return;
 
+	g_return_if_fail(sdata != NULL);
+
 	edisc_xfer->hc = NULL;
 
 	if (!purple_http_response_is_successful(response)) {
@@ -558,6 +567,7 @@ static void ggp_edisc_xfer_send_start(Pu
 	edisc_xfer = purple_xfer_get_protocol_data(xfer);
 	g_return_if_fail(edisc_xfer != NULL);
 	sdata = ggp_edisc_get_sdata(edisc_xfer->gc);
+	g_return_if_fail(sdata != NULL);
 
 	filename_e = purple_strreplace(edisc_xfer->filename, " ", "%20");
 	upload_url = g_strdup_printf("https://drive.mpa.gg.pl/me/file/outbox/"
@@ -692,6 +702,8 @@ static void ggp_edisc_xfer_recv_ticket_g
 {
 	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(gc);
 
+	g_return_if_fail(sdata != NULL);
+
 	if (g_hash_table_lookup(sdata->xfers_history, ticket_id))
 		return;
 
@@ -706,6 +718,8 @@ static void ggp_edisc_xfer_recv_ticket_u
 	PurpleHttpRequest *req;
 	gchar *ticket = _ticket;
 
+	g_return_if_fail(sdata != NULL);
+
 	if (!success) {
 		purple_debug_warning("gg",
 			"ggp_edisc_xfer_recv_ticket_update_authenticated: "
@@ -753,6 +767,7 @@ static void ggp_edisc_xfer_recv_ticket_u
 	}
 
 	sdata = ggp_edisc_get_sdata(gc);
+	g_return_if_fail(sdata != NULL);
 
 	parser = ggp_json_parse(purple_http_response_get_data(response, NULL));
 	result = json_node_get_object(json_parser_get_root(parser));
@@ -869,6 +884,8 @@ static void ggp_edisc_xfer_recv_ack(Purp
 	ggp_edisc_session_data *sdata = ggp_edisc_get_sdata(edisc_xfer->gc);
 	PurpleHttpRequest *req;
 
+	g_return_if_fail(sdata != NULL);
+
 	edisc_xfer->allowed = accept;
 
 	req = purple_http_request_new(ggp_edisc_xfer_ticket_url(
@@ -936,6 +953,7 @@ static void ggp_edisc_xfer_recv_start(Pu
 	edisc_xfer = purple_xfer_get_protocol_data(xfer);
 	g_return_if_fail(edisc_xfer != NULL);
 	sdata = ggp_edisc_get_sdata(edisc_xfer->gc);
+	g_return_if_fail(sdata != NULL);
 
 	upload_url = g_strdup_printf("https://drive.mpa.gg.pl/me/file/inbox/"
 		"%s,%s?api_version=%s&security_token=%s",
@@ -1050,6 +1068,8 @@ static void ggp_ggdrive_auth(PurpleConne
 	gchar *metadata;
 	PurpleHttpRequest *req;
 
+	g_return_if_fail(sdata != NULL);
+
 	imtoken = ggp_get_imtoken(gc);
 	if (!imtoken)
 	{
@@ -1109,6 +1129,8 @@ static void ggp_ggdrive_auth_results(Pur
 	purple_debug_info("gg", "ggp_ggdrive_auth_results(gc=%p): %d\n",
 		gc, success);
 
+	g_return_if_fail(sdata != NULL);
+
 	it = g_list_first(sdata->auth_pending);
 	while (it) {
 		ggp_edisc_auth_data *auth = it->data;
@@ -1131,6 +1153,8 @@ static void ggp_ggdrive_auth_done(Purple
 	JsonObject *result;
 	int status = -1;
 
+	g_return_if_fail(sdata != NULL);
+
 	sdata->auth_request = NULL;
 
 	if (!purple_http_response_is_successful(response)) {
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
@@ -826,7 +826,8 @@ static void ggp_pubdir_set_info_dialog(P
 	purple_request_field_group_add_field(group, field);
 
 	field = purple_request_field_choice_new("gender", _("Gender"),
-		GINT_TO_POINTER(record->gender));
+		record ? GINT_TO_POINTER(record->gender) :
+			GGP_PUBDIR_GENDER_UNSPECIFIED);
 	purple_request_field_set_required(field, TRUE);
 	purple_request_field_choice_add(field, _("Male"),
 		GINT_TO_POINTER(GGP_PUBDIR_GENDER_MALE));



More information about the Commits mailing list