/pidgin/main: ef97228bc5f0: Fix most of warnings for gtk2 and linux

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Sun Apr 14 18:48:25 EDT 2013


Changeset: ef97228bc5f01af4ccfeb4da1b9cef50daf9ccf0
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-04-15 00:48 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/ef97228bc5f0

Description:

Fix most of warnings for gtk2 and linux

diffstat:

 finch/gntnotify.c                            |   6 +-
 finch/libgnt/gntwm.c                         |  16 +++++---
 libpurple/plugins/perl/common/BuddyList.xs   |   3 +-
 libpurple/plugins/perl/common/Certificate.xs |   1 -
 libpurple/plugins/perl/common/Util.xs        |   3 +-
 libpurple/plugins/perl/perl-common.c         |   3 +-
 libpurple/plugins/ssl/ssl-gnutls.c           |  42 ++++++++++++------------
 libpurple/protocols/bonjour/jabber.c         |   3 +-
 libpurple/protocols/jabber/jingle/jingle.c   |   3 +-
 libpurple/protocols/myspace/user.c           |   6 ++-
 libpurple/protocols/oscar/family_auth.c      |   3 +-
 libpurple/protocols/oscar/family_bart.c      |  12 ++----
 libpurple/protocols/oscar/family_chatnav.c   |   7 +--
 libpurple/protocols/oscar/family_icbm.c      |   3 +-
 libpurple/protocols/oscar/family_locate.c    |   3 +-
 libpurple/protocols/oscar/family_oservice.c  |   3 +
 libpurple/protocols/oscar/oscar.c            |  27 ++++++--------
 libpurple/protocols/sametime/sametime.c      |  49 ++++------------------------
 libpurple/protocols/yahoo/libymsg.c          |  12 ++----
 libpurple/protocols/yahoo/yahoo_filexfer.c   |  26 +++-----------
 libpurple/protocols/yahoo/yahoo_picture.c    |   5 +-
 libpurple/protocols/yahoo/yahoochat.c        |  13 ++-----
 libpurple/protocols/zephyr/ZParseNot.c       |   3 +
 libpurple/protocols/zephyr/zephyr.c          |  17 +++++++--
 libpurple/proxy.c                            |   4 +-
 pidgin/gtk3compat.h                          |   7 +++-
 pidgin/gtkconv-theme.c                       |   2 +
 pidgin/gtkimhtml.c                           |   2 +-
 pidgin/gtkprefs.c                            |   3 +-
 pidgin/gtkrequest.c                          |  18 ++++++----
 30 files changed, 135 insertions(+), 170 deletions(-)

diffs (truncated from 1152 to 300 lines):

diff --git a/finch/gntnotify.c b/finch/gntnotify.c
--- a/finch/gntnotify.c
+++ b/finch/gntnotify.c
@@ -88,13 +88,13 @@ finch_notify_message(PurpleNotifyMsgType
 		 * PurpleNotifyType.  Also, the if() followed by the
 		 * inner switch doesn't make much sense.
 		 */
-		if (type == PURPLE_NOTIFY_FORMATTED) {
+		if ((int)type == (int)PURPLE_NOTIFY_FORMATTED) {
 			int width = -1, height = -1;
 			char *plain = (char*)secondary;
 			msg = gnt_text_view_new();
 			gnt_text_view_set_flag(GNT_TEXT_VIEW(msg), GNT_TEXT_VIEW_TOP_ALIGN | GNT_TEXT_VIEW_NO_SCROLL);
-			switch (type) {
-				case PURPLE_NOTIFY_FORMATTED:
+			switch ((int)type) {
+				case (int)PURPLE_NOTIFY_FORMATTED:
 					plain = purple_markup_strip_html(secondary);
 					if (gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
 						break;
diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -767,14 +767,16 @@ dump_file_save(GntFileSel *fs, const cha
 			if ((now & A_COLOR) != (old & A_COLOR) ||
 				(now & A_REVERSE) != (old & A_REVERSE))
 			{
-				int ret;
 				short fgp, bgp, r, g, b;
 				struct
 				{
 					int r, g, b;
 				} fg, bg;
 
-				ret = pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp);
+				if (pair_content(PAIR_NUMBER(now & A_COLOR), &fgp, &bgp) != OK) {
+					fgp = -1;
+					bgp = -1;
+				}
 				if (fgp == -1)
 					fgp = COLOR_BLACK;
 				if (bgp == -1)
@@ -785,9 +787,13 @@ dump_file_save(GntFileSel *fs, const cha
 					fgp = bgp;
 					bgp = tmp;
 				}
-				ret = color_content(fgp, &r, &g, &b);
+				if (color_content(fgp, &r, &g, &b) != OK) {
+					r = g = b = 0;
+				}
 				fg.r = r; fg.b = b; fg.g = g;
-				ret = color_content(bgp, &r, &g, &b);
+				if (color_content(bgp, &r, &g, &b) != OK) {
+					r = g = b = 255;
+				}
 				bg.r = r; bg.b = b; bg.g = g;
 #define ADJUST(x) (x = x * 255 / 1000)
 				ADJUST(fg.r);
@@ -1135,13 +1141,11 @@ toggle_clipboard(GntBindable *bindable, 
 {
 	static GntWidget *clip;
 	gchar *text;
-	int maxx, maxy;
 	if (clip) {
 		gnt_widget_destroy(clip);
 		clip = NULL;
 		return TRUE;
 	}
-	getmaxyx(stdscr, maxy, maxx);
 	text = gnt_get_clipboard_string();
 	clip = gnt_hwindow_new(FALSE);
 	GNT_WIDGET_SET_FLAGS(clip, GNT_WIDGET_TRANSIENT);
diff --git a/libpurple/plugins/perl/common/BuddyList.xs b/libpurple/plugins/perl/common/BuddyList.xs
--- a/libpurple/plugins/perl/common/BuddyList.xs
+++ b/libpurple/plugins/perl/common/BuddyList.xs
@@ -6,7 +6,8 @@ static void
 chat_components_foreach(gpointer key, gpointer value, gpointer user_data)
 {
 	HV *hv = user_data;
-	hv_store(hv, key, strlen(key), newSVpv(value, 0), 0);
+	if (hv_store(hv, key, strlen(key), newSVpv(value, 0), 0) == NULL)
+		purple_debug_error("perl", "hv_store failed\n");
 }
 
 MODULE = Purple::BuddyList  PACKAGE = Purple  PREFIX = purple_
diff --git a/libpurple/plugins/perl/common/Certificate.xs b/libpurple/plugins/perl/common/Certificate.xs
--- a/libpurple/plugins/perl/common/Certificate.xs
+++ b/libpurple/plugins/perl/common/Certificate.xs
@@ -232,7 +232,6 @@ purple_certificate_verify(verifier, subj
 	Purple::Certificate::Verifier verifier
 	const gchar* subject_name
 	AV* cert_chain
-	CV *cb
 	SV *cb_data
 	PREINIT:
 		GList *l = NULL;
diff --git a/libpurple/plugins/perl/common/Util.xs b/libpurple/plugins/perl/common/Util.xs
--- a/libpurple/plugins/perl/common/Util.xs
+++ b/libpurple/plugins/perl/common/Util.xs
@@ -3,7 +3,8 @@
 static void markup_find_tag_foreach(GQuark key_id, char *data, HV *hv) {
 	const char *key = NULL;
 	key = g_quark_to_string(key_id);
-	hv_store(hv, key, strlen(key), newSVpv(data, 0), 0);
+	if (hv_store(hv, key, strlen(key), newSVpv(data, 0), 0) == NULL)
+		purple_debug_error("perl", "hv_store failed\n");
 }
 
 MODULE = Purple::Util  PACKAGE = Purple::Util  PREFIX = purple_
diff --git a/libpurple/plugins/perl/perl-common.c b/libpurple/plugins/perl/perl-common.c
--- a/libpurple/plugins/perl/perl-common.c
+++ b/libpurple/plugins/perl/perl-common.c
@@ -83,7 +83,8 @@ purple_perl_bless_object(void *object, c
 	stash = gv_stashpv(stash_name, 1);
 
 	hv = newHV();
-	hv_store(hv, "_purple", 7, create_sv_ptr(object), 0);
+	if (hv_store(hv, "_purple", 7, create_sv_ptr(object), 0) == NULL)
+		purple_debug_error("perl", "hv_store failed\n");
 
 	return sv_bless(newRV_noinc((SV *)hv), stash);
 }
diff --git a/libpurple/plugins/ssl/ssl-gnutls.c b/libpurple/plugins/ssl/ssl-gnutls.c
--- a/libpurple/plugins/ssl/ssl-gnutls.c
+++ b/libpurple/plugins/ssl/ssl-gnutls.c
@@ -34,7 +34,7 @@
 
 typedef struct
 {
-	gnutls_session session;
+	gnutls_session_t session;
 	guint handshake_handler;
 	guint handshake_timer;
 } PurpleSslGnutlsData;
@@ -284,9 +284,9 @@ static void ssl_gnutls_handshake_cb(gpoi
 		g_list_free(peers);
 
 		{
-			const gnutls_datum *cert_list;
+			const gnutls_datum_t *cert_list;
 			unsigned int cert_list_size = 0;
-			gnutls_session session=gnutls_data->session;
+			gnutls_session_t session=gnutls_data->session;
 			int i;
 
 			cert_list =
@@ -303,7 +303,7 @@ static void ssl_gnutls_handshake_cb(gpoi
 				gchar tbuf[256];
 				gsize tsz=sizeof(tbuf);
 				gchar * tasc = NULL;
-				gnutls_x509_crt cert;
+				gnutls_x509_crt_t cert;
 
 				gnutls_x509_crt_init(&cert);
 				gnutls_x509_crt_import (cert, &cert_list[i],
@@ -519,7 +519,7 @@ ssl_gnutls_write(PurpleSslConnection *gs
 
 /* Forward declarations are fun! */
 static PurpleCertificate *
-x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode);
+x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode);
 /* indeed! */
 static gboolean
 x509_certificate_signed_by(PurpleCertificate * crt,
@@ -537,7 +537,7 @@ ssl_gnutls_get_peer_certificates(PurpleS
 	GList * peer_certs = NULL;
 
 	/* List of raw certificates as given by GnuTLS */
-	const gnutls_datum *cert_list;
+	const gnutls_datum_t *cert_list;
 	unsigned int cert_list_size = 0;
 
 	unsigned int i;
@@ -585,7 +585,7 @@ static PurpleCertificateScheme x509_gnut
 /** Refcounted GnuTLS certificate data instance */
 typedef struct {
 	gint refcount;
-	gnutls_x509_crt crt;
+	gnutls_x509_crt_t crt;
 } x509_crtdata_t;
 
 /** Helper functions for reference counting */
@@ -617,7 +617,7 @@ x509_crtdata_delref(x509_crtdata_t *cd)
 /** Helper macro to retrieve the GnuTLS crt_t from a PurpleCertificate */
 #define X509_GET_GNUTLS_DATA(pcrt) ( ((x509_crtdata_t *) (pcrt->data))->crt)
 
-/** Transforms a gnutls_datum containing an X.509 certificate into a Certificate instance under the x509_gnutls scheme
+/** Transforms a gnutls_datum_t containing an X.509 certificate into a Certificate instance under the x509_gnutls scheme
  *
  * @param dt   Datum to transform
  * @param mode GnuTLS certificate format specifier (GNUTLS_X509_FMT_PEM for
@@ -627,7 +627,7 @@ x509_crtdata_delref(x509_crtdata_t *cd)
  * @return A newly allocated Certificate structure of the x509_gnutls scheme
  */
 static PurpleCertificate *
-x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode)
+x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode)
 {
 	/* Internal certificate data structure */
 	x509_crtdata_t *certdat;
@@ -662,7 +662,7 @@ x509_import_from_file(const gchar * file
 	PurpleCertificate *crt;  /* Certificate being constructed */
 	gchar *buf;        /* Used to load the raw file data */
 	gsize buf_sz;      /* Size of the above */
-	gnutls_datum dt; /* Struct to pass down to GnuTLS */
+	gnutls_datum_t dt; /* Struct to pass down to GnuTLS */
 
 	purple_debug_info("gnutls",
 			  "Attempting to load X.509 certificate from %s\n",
@@ -705,7 +705,7 @@ x509_importcerts_from_file(const gchar *
 	gchar *begin, *end;
 	GSList *crts = NULL;
 	gsize buf_sz;      /* Size of the above */
-	gnutls_datum dt; /* Struct to pass down to GnuTLS */
+	gnutls_datum_t dt; /* Struct to pass down to GnuTLS */
 
 	purple_debug_info("gnutls",
 			  "Attempting to load X.509 certificates from %s\n",
@@ -751,7 +751,7 @@ x509_importcerts_from_file(const gchar *
 static gboolean
 x509_export_certificate(const gchar *filename, PurpleCertificate *crt)
 {
-	gnutls_x509_crt crt_dat; /* GnuTLS cert struct */
+	gnutls_x509_crt_t crt_dat; /* GnuTLS cert struct */
 	int ret;
 	gchar * out_buf; /* Data to output */
 	size_t out_size; /* Output size */
@@ -857,8 +857,8 @@ static gboolean
 x509_certificate_signed_by(PurpleCertificate * crt,
 			   PurpleCertificate * issuer)
 {
-	gnutls_x509_crt crt_dat;
-	gnutls_x509_crt issuer_dat;
+	gnutls_x509_crt_t crt_dat;
+	gnutls_x509_crt_t issuer_dat;
 	unsigned int verify; /* used to store result from GnuTLS verifier */
 	int ret;
 	gchar *crt_id = NULL;
@@ -963,7 +963,7 @@ x509_sha1sum(PurpleCertificate *crt)
 {
 	size_t hashlen = 20; /* SHA1 hashes are 20 bytes */
 	size_t tmpsz = hashlen; /* Throw-away variable for GnuTLS to stomp on*/
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 	GByteArray *hash; /**< Final hash container */
 	guchar hashbuf[hashlen]; /**< Temporary buffer to contain hash */
 
@@ -990,7 +990,7 @@ x509_sha1sum(PurpleCertificate *crt)
 static gchar *
 x509_cert_dn (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *dn = NULL;
 	size_t dn_size;
 
@@ -1023,7 +1023,7 @@ x509_cert_dn (PurpleCertificate *crt)
 static gchar *
 x509_issuer_dn (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *dn = NULL;
 	size_t dn_size;
 
@@ -1057,7 +1057,7 @@ x509_issuer_dn (PurpleCertificate *crt)
 static gchar *
 x509_common_name (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *cn = NULL;
 	size_t cn_size;
 	int ret;
@@ -1100,7 +1100,7 @@ x509_common_name (PurpleCertificate *crt
 static gboolean
 x509_check_name (PurpleCertificate *crt, const gchar *name)
 {
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 
 	g_return_val_if_fail(crt, FALSE);
 	g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE);
@@ -1118,7 +1118,7 @@ x509_check_name (PurpleCertificate *crt,
 static gboolean
 x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration)
 {
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 	/* GnuTLS time functions return this on error */
 	const time_t errval = (time_t) (-1);
 	gboolean success = TRUE;
@@ -1145,7 +1145,7 @@ x509_times (PurpleCertificate *crt, time
 static GByteArray *
 x509_get_der_data(PurpleCertificate *crt)
 {
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 	GByteArray *data;
 	size_t len;



More information about the Commits mailing list