/pidgin/main: cdb187c27360: Fix the rest of Pidgin's warnings ab...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Thu Aug 22 08:57:57 EDT 2013


Changeset: cdb187c27360009a66f1191802cbd240420cc04b
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2013-08-22 14:57 +0200
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/cdb187c27360

Description:

Fix the rest of Pidgin's warnings about -Wsign-compare; remove -Wno-sign-compare from cflags

diffstat:

 configure.ac               |   5 +----
 pidgin/gtkconv.c           |   4 ++--
 pidgin/gtkdebug.c          |   2 +-
 pidgin/gtkft.c             |   2 +-
 pidgin/gtkimhtml.c         |   2 +-
 pidgin/gtkmain.c           |   2 +-
 pidgin/gtkprefs.c          |   2 +-
 pidgin/gtkprivacy.c        |  15 ++++++++-------
 pidgin/gtkrequest.c        |   8 ++++----
 pidgin/gtkstatusbox.c      |   6 +++---
 pidgin/gtkthemes.c         |   2 +-
 pidgin/gtkutils.c          |   2 +-
 pidgin/gtkwebview.c        |   4 ++--
 pidgin/gtkwebviewtoolbar.c |   4 ++--
 pidgin/pidginstock.c       |   4 ++--
 15 files changed, 31 insertions(+), 33 deletions(-)

diffs (truncated from 315 to 300 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -1429,16 +1429,13 @@ if test "x$GCC" = "xyes"; then
 	dnl		Perhaps we could write ugly configure magic and pass -Wno-float-equal down to that subdirectory.
 	dnl		On the other hand, it's probably actually broken, so maybe the Perl folks should fix that?
 	dnl
-	dnl Consider removing -Wno-sign-compare (from the -Wextra set) and fixing all those cases.
-	dnl	This is likely non-trivial.
-	dnl
 	for newflag in \
 			"-Waggregate-return" \
 			"-Wcast-align" \
 			"-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/pidgin/gtkconv.c b/pidgin/gtkconv.c
--- a/pidgin/gtkconv.c
+++ b/pidgin/gtkconv.c
@@ -209,7 +209,7 @@ static void update_typing_icon(PidginCon
 static void update_typing_message(PidginConversation *gtkconv, const char *message);
 gboolean pidgin_conv_has_focus(PurpleConversation *conv);
 static GArray* generate_nick_colors(guint numcolors, GdkColor background);
-static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast);
+static gboolean color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast);
 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who, PurpleMessageFlags flag, gboolean create);
 static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields);
 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win);
@@ -11032,7 +11032,7 @@ pidgin_conv_is_hidden(PidginConversation
 
 /* Algorithm from http://www.w3.org/TR/AERT#color-contrast */
 static gboolean
-color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast)
+color_is_visible(GdkColor foreground, GdkColor background, guint color_contrast, guint brightness_contrast)
 {
 	gulong fg_brightness;
 	gulong bg_brightness;
diff --git a/pidgin/gtkdebug.c b/pidgin/gtkdebug.c
--- a/pidgin/gtkdebug.c
+++ b/pidgin/gtkdebug.c
@@ -413,7 +413,7 @@ toolbar_context(GtkWidget *toolbar, GdkE
 		item = gtk_check_menu_item_new_with_mnemonic(text[i]);
 		g_object_set_data(G_OBJECT(item), "user_data", GINT_TO_POINTER(value[i]));
 		g_signal_connect(G_OBJECT(item), "activate", G_CALLBACK(toolbar_icon_pref_changed), toolbar);
-		if (value[i] == purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style"))
+		if (value[i] == (GtkToolbarStyle)purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/style"))
 			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE);
 		gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
 	}
diff --git a/pidgin/gtkft.c b/pidgin/gtkft.c
--- a/pidgin/gtkft.c
+++ b/pidgin/gtkft.c
@@ -636,7 +636,7 @@ make_info_table(PidginXferDialog *dialog
 {
 	GtkWidget *table;
 	GtkWidget *label;
-	int i;
+	gsize i;
 
 	struct
 	{
diff --git a/pidgin/gtkimhtml.c b/pidgin/gtkimhtml.c
--- a/pidgin/gtkimhtml.c
+++ b/pidgin/gtkimhtml.c
@@ -1528,7 +1528,7 @@ imhtml_find_protocol(const char *url, gb
 	GtkIMHtmlClass *klass;
 	GList *iter;
 	GtkIMHtmlProtocol *proto = NULL;
-	int length = reverse ? strlen(url) : -1;
+	gssize length = reverse ? (gssize)strlen(url) : -1;
 
 	klass = g_type_class_ref(GTK_TYPE_IMHTML);
 	for (iter = klass->protocols; iter; iter = iter->next) {
diff --git a/pidgin/gtkmain.c b/pidgin/gtkmain.c
--- a/pidgin/gtkmain.c
+++ b/pidgin/gtkmain.c
@@ -204,7 +204,7 @@ ui_main(void)
 	GList *icons = NULL;
 	GdkPixbuf *icon = NULL;
 	char *icon_path;
-	int i;
+	gsize i;
 	struct {
 		const char *dir;
 		const char *filename;
diff --git a/pidgin/gtkprefs.c b/pidgin/gtkprefs.c
--- a/pidgin/gtkprefs.c
+++ b/pidgin/gtkprefs.c
@@ -3461,7 +3461,7 @@ get_vv_element_devices(const gchar *elem
 #if !GST_CHECK_VERSION(1,0,0)
 	GstPropertyProbe *probe;
 	const GParamSpec *pspec;
-	gint i;
+	guint i;
 	GValueArray *array;
 	enum {
 		PROBE_NONE,
diff --git a/pidgin/gtkprivacy.c b/pidgin/gtkprivacy.c
--- a/pidgin/gtkprivacy.c
+++ b/pidgin/gtkprivacy.c
@@ -76,7 +76,7 @@ typedef struct
 static struct
 {
 	const char *text;
-	int num;
+	PurplePrivacyType type;
 
 } const menu_entries[] =
 {
@@ -208,12 +208,12 @@ static void
 select_account_cb(GtkWidget *dropdown, PurpleAccount *account,
 				  PidginPrivacyDialog *dialog)
 {
-	int i;
+	gsize i;
 
 	dialog->account = account;
 
 	for (i = 0; i < menu_entry_count; i++) {
-		if (menu_entries[i].num == purple_account_get_privacy_type(account)) {
+		if (menu_entries[i].type == purple_account_get_privacy_type(account)) {
 			gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->type_menu), i);
 			break;
 		}
@@ -230,7 +230,8 @@ select_account_cb(GtkWidget *dropdown, P
 static void
 type_changed_cb(GtkComboBox *combo, PidginPrivacyDialog *dialog)
 {
-	int new_type = menu_entries[gtk_combo_box_get_active(combo)].num;
+	PurplePrivacyType new_type =
+		menu_entries[gtk_combo_box_get_active(combo)].type;
 
 	purple_account_set_privacy_type(dialog->account, new_type);
 	serv_set_permit_deny(purple_account_get_connection(dialog->account));
@@ -337,8 +338,8 @@ privacy_dialog_new(void)
 	GtkWidget *button;
 	GtkWidget *dropdown;
 	GtkWidget *label;
-	int selected = -1;
-	int i;
+	gssize selected = -1;
+	gsize i;
 
 	dialog = g_new0(PidginPrivacyDialog, 1);
 
@@ -373,7 +374,7 @@ privacy_dialog_new(void)
 		gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(dialog->type_menu),
 		                          _(menu_entries[i].text));
 
-		if (menu_entries[i].num == purple_account_get_privacy_type(dialog->account))
+		if (menu_entries[i].type == purple_account_get_privacy_type(dialog->account))
 			selected = i;
 	}
 
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -153,7 +153,7 @@ input_response_cb(GtkDialog *dialog, gin
 	else
 		value = gtk_entry_get_text(GTK_ENTRY(data->u.input.entry));
 
-	if (id < data->cb_count && data->cbs[id] != NULL)
+	if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL)
 		((PurpleRequestInputCb)data->cbs[id])(data->user_data, value);
 	else if (data->cbs[1] != NULL)
 		((PurpleRequestInputCb)data->cbs[1])(data->user_data, value);
@@ -169,7 +169,7 @@ action_response_cb(GtkDialog *dialog, gi
 {
 	generic_response_start(data);
 
-	if (id < data->cb_count && data->cbs[id] != NULL)
+	if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL)
 		((PurpleRequestActionCb)data->cbs[id])(data->user_data, id);
 
 	purple_request_close(PURPLE_REQUEST_INPUT, data);
@@ -184,7 +184,7 @@ choice_response_cb(GtkDialog *dialog, gi
 
 	generic_response_start(data);
 
-	if (id < data->cb_count && data->cbs[id] != NULL)
+	if (id >= 0 && (gsize)id < data->cb_count && data->cbs[id] != NULL)
 		while (group) {
 			if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(group->data))) {
 				((PurpleRequestChoiceCb)data->cbs[id])(data->user_data, GPOINTER_TO_INT(g_object_get_data(G_OBJECT(group->data), "choice_id")));
@@ -595,7 +595,7 @@ pidgin_request_action_with_icon(const ch
 	void **buttons;
 	char *label_text;
 	char *primary_esc, *secondary_esc;
-	int i;
+	gsize i;
 
 	data            = g_new0(PidginRequestData, 1);
 	data->type      = PURPLE_REQUEST_ACTION;
diff --git a/pidgin/gtkstatusbox.c b/pidgin/gtkstatusbox.c
--- a/pidgin/gtkstatusbox.c
+++ b/pidgin/gtkstatusbox.c
@@ -527,7 +527,7 @@ static void
 pidgin_status_box_finalize(GObject *obj)
 {
 	PidginStatusBox *statusbox = PIDGIN_STATUS_BOX(obj);
-	int i;
+	gsize i;
 
 	purple_signals_disconnect_by_handle(statusbox);
 	purple_prefs_disconnect_by_handle(statusbox);
@@ -831,7 +831,7 @@ status_menu_refresh_iter(PidginStatusBox
 				/* This is a special case because Primitives for the token_status_account are actually
 				 * saved statuses with substatuses for the enabled accounts */
 				if (status_box->token_status_account && purple_savedstatus_is_transient(saved_status)
-					&& type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == GPOINTER_TO_INT(data))
+					&& type == PIDGIN_STATUS_BOX_TYPE_PRIMITIVE && primitive == (PurpleStatusPrimitive)GPOINTER_TO_INT(data))
 				{
 					char *name;
 					const char *acct_status_name = purple_status_get_name(
@@ -1157,7 +1157,7 @@ static void
 cache_pixbufs(PidginStatusBox *status_box)
 {
 	GtkIconSize icon_size;
-	int i;
+	gsize i;
 
 	g_object_set(G_OBJECT(status_box->icon_rend), "xpad", 3, NULL);
 	icon_size = gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c
--- a/pidgin/gtkthemes.c
+++ b/pidgin/gtkthemes.c
@@ -295,7 +295,7 @@ void pidgin_themes_load_smiley_theme(con
 			}
 			while  (*i) {
 				char l[64];
-				int li = 0;
+				gsize li = 0;
 				while (*i && !isspace(*i) && li < sizeof(l) - 1) {
 					if (*i == '\\' && *(i+1) != '\0')
 						i++;
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -294,7 +294,7 @@ pidgin_toggle_sensitive_array(GtkWidget 
 {
 	gboolean sensitivity;
 	gpointer element;
-	int i;
+	guint i;
 
 	for (i=0; i < data->len; i++) {
 		element = g_ptr_array_index(data,i);
diff --git a/pidgin/gtkwebview.c b/pidgin/gtkwebview.c
--- a/pidgin/gtkwebview.c
+++ b/pidgin/gtkwebview.c
@@ -882,7 +882,7 @@ webview_find_protocol(const char *url, g
 	GtkWebViewClass *klass;
 	GList *iter;
 	GtkWebViewProtocol *proto = NULL;
-	int length = reverse ? strlen(url) : -1;
+	gssize length = reverse ? (gssize)strlen(url) : -1;
 
 	klass = g_type_class_ref(GTK_TYPE_WEBVIEW);
 	for (iter = klass->protocols; iter; iter = iter->next) {
@@ -992,7 +992,7 @@ get_unicode_menu(WebKitWebView *webview)
 	gboolean show = TRUE;
 	GtkWidget *menuitem;
 	GtkWidget *menu;
-	int i;
+	gsize i;
 
 	settings = webview ? gtk_widget_get_settings(GTK_WIDGET(webview)) : gtk_settings_get_default();
 
diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c
--- a/pidgin/gtkwebviewtoolbar.c
+++ b/pidgin/gtkwebviewtoolbar.c
@@ -1316,7 +1316,7 @@ gtk_webviewtoolbar_create_actions(GtkWeb
 {
 	GtkWebViewToolbarPriv *priv = GTK_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
 	GtkActionGroup *action_group;
-	int i;
+	gsize i;
 	struct {
 		GtkAction **action;
 		char *name;
@@ -1397,7 +1397,7 @@ gtk_webviewtoolbar_create_wide_view(GtkW
 		priv->smiley,
 		priv->attention
 	};
-	int i;
+	gsize i;
 	GtkToolItem *item;
 
 	priv->wide_view = gtk_toolbar_new();
diff --git a/pidgin/pidginstock.c b/pidgin/pidginstock.c
--- a/pidgin/pidginstock.c
+++ b/pidgin/pidginstock.c
@@ -403,7 +403,7 @@ void
 pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme)
 {



More information about the Commits mailing list