/pidgin/main: a437550a9308: Remove -Wno-sign-compare and backpor...

Elliott Sales de Andrade qulogic at pidgin.im
Thu Nov 13 01:15:40 EST 2014


Changeset: a437550a930841b193013c7b76568880db1f48ee
Author:	 Elliott Sales de Andrade <qulogic at pidgin.im>
Date:	 2014-11-13 00:56 -0500
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/a437550a9308

Description:

Remove -Wno-sign-compare and backport fixes from default.

diffstat:

 configure.ac                               |   2 +-
 finch/gntrequest.c                         |   4 ++--
 finch/libgnt/gntcolors.c                   |   2 +-
 finch/libgnt/gntentry.c                    |  11 +++++++----
 finch/libgnt/gntmenu.c                     |   2 +-
 finch/libgnt/gntstyle.c                    |   2 +-
 finch/libgnt/gnttextview.c                 |   2 +-
 finch/libgnt/gntwm.c                       |   2 +-
 libpurple/account.c                        |   3 ++-
 libpurple/cipher.c                         |   3 +--
 libpurple/circbuffer.c                     |  17 +++++++----------
 libpurple/dnsquery.c                       |   4 ++--
 libpurple/dnssrv.c                         |   2 +-
 libpurple/ft.c                             |   8 ++++----
 libpurple/media/backend-fs2.c              |   2 +-
 libpurple/plugins/joinpart.c               |   2 +-
 libpurple/plugins/perl/perl-handlers.h     |   4 ++--
 libpurple/plugins/signals-test.c           |   6 +++---
 libpurple/plugins/ssl/ssl-gnutls.c         |   2 +-
 libpurple/plugins/tcl/tcl_purple.h         |   2 +-
 libpurple/plugins/tcl/tcl_ref.c            |   4 ++--
 libpurple/protocols/bonjour/jabber.c       |   2 +-
 libpurple/protocols/irc/parse.c            |   2 +-
 libpurple/protocols/jabber/auth_scram.c    |   2 +-
 libpurple/protocols/jabber/bosh.c          |   2 +-
 libpurple/protocols/jabber/jabber.c        |   2 +-
 libpurple/protocols/jabber/jutil.c         |  10 +++++-----
 libpurple/protocols/jabber/oob.c           |   3 ++-
 libpurple/protocols/jabber/presence.c      |   2 +-
 libpurple/protocols/jabber/si.c            |   8 ++++----
 libpurple/protocols/msn/command.c          |   2 +-
 libpurple/protocols/msn/command.h          |   2 +-
 libpurple/protocols/msn/directconn.c       |   6 +++---
 libpurple/protocols/msn/history.c          |   2 +-
 libpurple/protocols/msn/httpconn.c         |   4 ++--
 libpurple/protocols/msn/msg.c              |   2 +-
 libpurple/protocols/msn/nexus.c            |  10 +++++-----
 libpurple/protocols/msn/nexus.h            |   2 +-
 libpurple/protocols/msn/notification.c     |   2 +-
 libpurple/protocols/msn/p2p.c              |   8 +++++---
 libpurple/protocols/msn/servconn.c         |   5 +++--
 libpurple/protocols/msn/slplink.c          |   6 +++---
 libpurple/protocols/msn/slpmsg.h           |   2 +-
 libpurple/protocols/msn/slpmsg_part.c      |   2 +-
 libpurple/protocols/msn/tlv.c              |   4 ++--
 libpurple/protocols/msn/tlv.h              |   2 +-
 libpurple/protocols/msn/transaction.c      |   2 +-
 libpurple/protocols/msn/transaction.h      |   2 +-
 libpurple/protocols/myspace/myspace.c      |  10 +++++-----
 libpurple/protocols/myspace/user.c         |   8 ++++----
 libpurple/protocols/oscar/bstream.c        |   4 ++--
 libpurple/protocols/oscar/family_feedbag.c |   2 +-
 libpurple/protocols/oscar/oscar.c          |  22 ++++++++++------------
 libpurple/protocols/oscar/oscar.h          |   6 +++---
 libpurple/protocols/oscar/tlv.c            |   2 +-
 libpurple/protocols/oscar/util.c           |   2 +-
 libpurple/protocols/silc/buddy.c           |   2 +-
 libpurple/protocols/silc/chat.c            |  22 +++++++++++-----------
 libpurple/protocols/silc/ops.c             |   2 +-
 libpurple/protocols/silc/pk.c              |   2 +-
 libpurple/protocols/yahoo/libymsg.c        |   4 +++-
 libpurple/protocols/yahoo/libymsg.h        |   2 +-
 libpurple/protocols/yahoo/util.c           |   4 ++--
 libpurple/protocols/yahoo/yahoo_filexfer.c |   2 +-
 libpurple/protocols/yahoo/yahoo_packet.c   |   4 ++--
 libpurple/protocols/yahoo/yahoo_packet.h   |   2 +-
 libpurple/protocols/yahoo/yahoo_picture.c  |   2 +-
 libpurple/protocols/yahoo/ycht.c           |   2 +-
 libpurple/protocols/zephyr/ZReadAscii.c    |   2 +-
 libpurple/protocols/zephyr/ZVariables.c    |   2 +-
 libpurple/protocols/zephyr/Zinternal.c     |   4 ++--
 libpurple/protocols/zephyr/internal.h      |   2 +-
 libpurple/protocols/zephyr/zephyr.c        |   6 ++----
 libpurple/proxy.c                          |   6 +++---
 libpurple/purple-client.c                  |   4 ++--
 libpurple/stun.c                           |  10 +++++-----
 libpurple/upnp.c                           |  10 +++++-----
 libpurple/util.c                           |  29 ++++++++++++++---------------
 libpurple/xmlnode.c                        |   4 ++--
 pidgin/gtkconv.c                           |   6 +++---
 pidgin/gtkdebug.c                          |   8 ++++----
 pidgin/gtkft.c                             |   2 +-
 pidgin/gtkimhtml.c                         |   2 +-
 pidgin/gtkmain.c                           |   2 +-
 pidgin/gtkprivacy.c                        |  17 +++++++++--------
 pidgin/gtkrequest.c                        |   8 ++++----
 pidgin/gtkstatusbox.c                      |   6 +++---
 pidgin/gtkthemes.c                         |   4 ++--
 pidgin/gtkutils.c                          |   2 +-
 pidgin/pidginstock.c                       |   4 ++--
 pidgin/plugins/pidginrc.c                  |  10 +++++-----
 pidgin/plugins/spellchk.c                  |  11 ++++++-----
 pidgin/plugins/vvconfig.c                  |   2 +-
 93 files changed, 228 insertions(+), 225 deletions(-)

diffs (truncated from 2062 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1254,7 +1254,7 @@ if test "x$GCC" = "xyes"; then
 			"-Wdeclaration-after-statement" \
 			"-Wendif-labels" \
 			"-Werror-implicit-function-declaration" \
-			"-Wextra -Wno-sign-compare -Wno-unused-parameter" \
+			"-Wextra -Wno-unused-parameter" \
 			"-Wformat-security" \
 				"-Werror=format-security" \
 			"-Winit-self" \
diff --git a/finch/gntrequest.c b/finch/gntrequest.c
--- a/finch/gntrequest.c
+++ b/finch/gntrequest.c
@@ -268,7 +268,7 @@ finch_request_action(const char *title, 
 		va_list actions)
 {
 	GntWidget *window, *box, *button, *focus = NULL;
-	int i;
+	gsize i;
 
 	window = setup_request_window(title, primary, secondary, PURPLE_REQUEST_ACTION);
 
@@ -287,7 +287,7 @@ finch_request_action(const char *title, 
 		g_object_set_data(G_OBJECT(button), "activate-id", GINT_TO_POINTER(i));
 		g_signal_connect(G_OBJECT(button), "activate", G_CALLBACK(request_action_cb), window);
 
-		if (i == default_value)
+		if (default_value >= 0 && i == (gsize)default_value)
 			focus = button;
 	}
 
diff --git a/finch/libgnt/gntcolors.c b/finch/libgnt/gntcolors.c
--- a/finch/libgnt/gntcolors.c
+++ b/finch/libgnt/gntcolors.c
@@ -299,7 +299,7 @@ int gnt_color_pair(int pair)
 {
 	return (hascolors ? COLOR_PAIR(pair) :
 		((pair == GNT_COLOR_NORMAL || pair == GNT_COLOR_HIGHLIGHT_D ||
-		  pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : A_STANDOUT));
+		  pair == GNT_COLOR_TITLE_D || pair == GNT_COLOR_DISABLED) ? 0 : (int)A_STANDOUT));
 }
 
 int gnt_color_add_pair(int fg, int bg)
diff --git a/finch/libgnt/gntentry.c b/finch/libgnt/gntentry.c
--- a/finch/libgnt/gntentry.c
+++ b/finch/libgnt/gntentry.c
@@ -184,7 +184,7 @@ static gboolean
 show_suggest_dropdown(GntEntry *entry)
 {
 	char *suggest = NULL;
-	int len;
+	gsize len;
 	int offset = 0, x, y;
 	int count = 0;
 	GList *iter;
@@ -815,7 +815,7 @@ gnt_entry_key_pressed(GntWidget *widget,
 
 		for (str = text; *str; str = next)
 		{
-			int len;
+			gsize len;
 			next = g_utf8_find_next_char(str, NULL);
 			len = next - str;
 
@@ -834,7 +834,7 @@ gnt_entry_key_pressed(GntWidget *widget,
 			if (entry->max && g_utf8_pointer_to_offset(entry->start, entry->end) >= entry->max)
 				continue;
 
-			if (entry->end + len - entry->start >= entry->buffer)
+			if ((gsize)(entry->end + len - entry->start) >= entry->buffer)
 			{
 				/* This will cause the buffer to grow */
 				char *tmp = g_strdup(entry->start);
@@ -1184,8 +1184,11 @@ void gnt_entry_add_to_history(GntEntry *
 {
 	g_return_if_fail(entry->history != NULL);   /* Need to set_history_length first */
 
-	if (g_list_length(entry->history) >= entry->histlength)
+	if (entry->histlength >= 0 &&
+		g_list_length(entry->history) >= (gsize)entry->histlength)
+	{
 		return;
+	}
 
 	entry->history = g_list_first(entry->history);
 	g_free(entry->history->data);
diff --git a/finch/libgnt/gntmenu.c b/finch/libgnt/gntmenu.c
--- a/finch/libgnt/gntmenu.c
+++ b/finch/libgnt/gntmenu.c
@@ -309,7 +309,7 @@ gnt_menu_key_pressed(GntWidget *widget, 
 				menu->selected = g_list_length(menu->list) - 1;
 		} else if (strcmp(text, GNT_KEY_RIGHT) == 0) {
 			menu->selected++;
-			if (menu->selected >= g_list_length(menu->list))
+			if ((guint)menu->selected >= g_list_length(menu->list))
 				menu->selected = 0;
 		} else if (strcmp(text, GNT_KEY_ENTER) == 0 ||
 				strcmp(text, GNT_KEY_DOWN) == 0) {
diff --git a/finch/libgnt/gntstyle.c b/finch/libgnt/gntstyle.c
--- a/finch/libgnt/gntstyle.c
+++ b/finch/libgnt/gntstyle.c
@@ -185,7 +185,7 @@ void gnt_style_read_workspaces(GntWM *wm
 	gsize c;
 
 	for (i = 1; i < MAX_WORKSPACES; ++i) {
-		int j;
+		gsize j;
 		GntWS *ws;
 		gchar **titles;
 		char group[32];
diff --git a/finch/libgnt/gnttextview.c b/finch/libgnt/gnttextview.c
--- a/finch/libgnt/gnttextview.c
+++ b/finch/libgnt/gnttextview.c
@@ -513,7 +513,7 @@ void gnt_text_view_append_text_with_tag(
 			GntTextFormatFlags flags, const char *tagname)
 {
 	GntWidget *widget = GNT_WIDGET(view);
-	int fl = 0;
+	chtype fl = 0;
 	const char *start, *end;
 	GList *list = view->list;
 	GntTextLine *line;
diff --git a/finch/libgnt/gntwm.c b/finch/libgnt/gntwm.c
--- a/finch/libgnt/gntwm.c
+++ b/finch/libgnt/gntwm.c
@@ -443,7 +443,7 @@ switch_window(GntWM *wm, int direction, 
 		if (pos < 0) {
 			wid = g_list_last(wm->cws->list)->data;
 			pos = g_list_length(wm->cws->list) - 1;
-		} else if (pos >= g_list_length(wm->cws->list)) {
+		} else if ((guint)pos >= g_list_length(wm->cws->list)) {
 			wid = wm->cws->list->data;
 			pos = 0;
 		} else
diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -3038,7 +3038,8 @@ purple_accounts_reorder(PurpleAccount *a
 	GList *l;
 
 	g_return_if_fail(account != NULL);
-	g_return_if_fail(new_index <= g_list_length(accounts));
+	g_return_if_fail(new_index >= 0);
+	g_return_if_fail((guint)new_index <= g_list_length(accounts));
 
 	index = g_list_index(accounts, account);
 
diff --git a/libpurple/cipher.c b/libpurple/cipher.c
--- a/libpurple/cipher.c
+++ b/libpurple/cipher.c
@@ -444,8 +444,7 @@ purple_cipher_context_digest_to_str(Purp
 {
 	/* 8k is a bit excessive, will tweak later. */
 	guchar digest[BUF_LEN * 4];
-	gint n = 0;
-	size_t dlen = 0;
+	size_t n, dlen = 0;
 
 	g_return_val_if_fail(context, FALSE);
 	g_return_val_if_fail(digest_s, FALSE);
diff --git a/libpurple/circbuffer.c b/libpurple/circbuffer.c
--- a/libpurple/circbuffer.c
+++ b/libpurple/circbuffer.c
@@ -42,8 +42,8 @@ void purple_circ_buffer_destroy(PurpleCi
 }
 
 static void grow_circ_buffer(PurpleCircBuffer *buf, gsize len) {
-	int in_offset = 0, out_offset = 0;
-	int start_buflen;
+	gsize in_offset = 0, out_offset = 0;
+	gsize start_buflen;
 
 	g_return_if_fail(buf != NULL);
 
@@ -70,10 +70,8 @@ static void grow_circ_buffer(PurpleCircB
 	 * pointer, we need to shift the data */
 	if (in_offset < out_offset
 			|| (in_offset == out_offset && buf->bufused > 0)) {
-		int shift_n = MIN(buf->buflen - start_buflen,
-			in_offset);
-		memcpy(buf->buffer + start_buflen, buf->buffer,
-			shift_n);
+		gsize shift_n = MIN(buf->buflen - start_buflen, in_offset);
+		memcpy(buf->buffer + start_buflen, buf->buffer, shift_n);
 
 		/* If we couldn't fit the wrapped read buffer
 		 * at the end */
@@ -92,7 +90,7 @@ static void grow_circ_buffer(PurpleCircB
 
 void purple_circ_buffer_append(PurpleCircBuffer *buf, gconstpointer src, gsize len) {
 
-	int len_stored;
+	gsize len_stored;
 
 	g_return_if_fail(buf != NULL);
 
@@ -105,8 +103,7 @@ void purple_circ_buffer_append(PurpleCir
 	 * One copy from inptr to the end of the buffer, and the
 	 * second copy from the start of the buffer to the end of src. */
 	if (buf->inptr >= buf->outptr)
-		len_stored = MIN(len, buf->buflen
-			- (buf->inptr - buf->buffer));
+		len_stored = MIN(len, buf->buflen - (buf->inptr - buf->buffer));
 	else
 		len_stored = len;
 
@@ -145,7 +142,7 @@ gboolean purple_circ_buffer_mark_read(Pu
 	buf->outptr += len;
 	buf->bufused -= len;
 	/* wrap to the start if we're at the end */
-	if ((buf->outptr - buf->buffer) == buf->buflen)
+	if ((gsize)(buf->outptr - buf->buffer) == buf->buflen)
 		buf->outptr = buf->buffer;
 
 	return TRUE;
diff --git a/libpurple/dnsquery.c b/libpurple/dnsquery.c
--- a/libpurple/dnsquery.c
+++ b/libpurple/dnsquery.c
@@ -245,7 +245,7 @@ write_to_parent(int fd, const void *buf,
 	ssize_t written;
 
 	written = write(fd, buf, count);
-	if (written != count) {
+	if (written < 0 || (gsize)written != count) {
 		if (written < 0)
 			fprintf(stderr, "dns[%d]: Error writing data to "
 					"parent: %s\n", getpid(), strerror(errno));
@@ -554,7 +554,7 @@ send_dns_request_to_child(PurpleDnsQuery
 		purple_dnsquery_resolver_destroy(resolver);
 		return FALSE;
 	}
-	if (rc < sizeof(dns_params)) {
+	if ((gsize)rc < sizeof(dns_params)) {
 		purple_debug_error("dns", "Tried to write %" G_GSSIZE_FORMAT
 				" bytes to child but only wrote %" G_GSSIZE_FORMAT "\n",
 				sizeof(dns_params), rc);
diff --git a/libpurple/dnssrv.c b/libpurple/dnssrv.c
--- a/libpurple/dnssrv.c
+++ b/libpurple/dnssrv.c
@@ -557,7 +557,7 @@ resolved(gpointer data, gint source, Pur
 						res->content = g_new0(gchar, len);
 
 						red = read(source, res->content, len);
-						if (red != len) {
+						if (red < 0 || (gsize)red != len) {
 							purple_debug_error("dnssrv","unable to read txt "
 									"response: %s\n", g_strerror(errno));
 							size = 0;
diff --git a/libpurple/ft.c b/libpurple/ft.c
--- a/libpurple/ft.c
+++ b/libpurple/ft.c
@@ -98,7 +98,7 @@ purple_xfer_status_type_to_string(Purple
 		{ PURPLE_XFER_STATUS_CANCEL_LOCAL, "cancelled locally" },
 		{ PURPLE_XFER_STATUS_CANCEL_REMOTE, "cancelled remotely" }
 	};
-	int i;
+	gsize i;
 
 	for (i = 0; i < G_N_ELEMENTS(type_names); ++i)
 		if (type_names[i].type == type)
@@ -1073,7 +1073,7 @@ purple_xfer_read(PurpleXfer *xfer, gucha
 			r = -1;
 	}
 
-	if (r == xfer->current_buffer_size)
+	if (r >= 0 && (gsize)r == xfer->current_buffer_size)
 		/*
 		 * We managed to read the entire buffer.  This means our this
 		 * network is fast and our buffer is too small, so make it
@@ -1128,7 +1128,7 @@ do_transfer(PurpleXfer *xfer)
 			else
 				wc = fwrite(buffer, 1, r, xfer->dest_fp);
 
-			if (wc != r) {
+			if (wc != (gsize)r) {
 				purple_debug_error("filetransfer", "Unable to write whole buffer.\n");
 				purple_xfer_cancel_local(xfer);
 				g_free(buffer);
@@ -1221,7 +1221,7 @@ do_transfer(PurpleXfer *xfer)
 				   that case buffer doesn't belong to us. */
 				g_free(buffer);
 			return;
-		} else if (r == result) {
+		} else if (r >= 0 && (gsize)r == result) {
 			/*
 			 * We managed to write the entire buffer.  This means our
 			 * network is fast and our buffer is too small, so make it
diff --git a/libpurple/media/backend-fs2.c b/libpurple/media/backend-fs2.c
--- a/libpurple/media/backend-fs2.c
+++ b/libpurple/media/backend-fs2.c
@@ -1950,7 +1950,7 @@ create_stream(PurpleMediaBackendFs2 *sel
 	  we need to do this to allow them to override when using non-standard
 	  TURN modes, like Google f.ex. */
 	gboolean got_turn_from_prpl = FALSE;
-	int i;
+	guint i;
 
 	session = get_session(self, sess_id);



More information about the Commits mailing list