/pidgin/main: cde50837937d: Ifdef some dead code, fixing coverit...

Tomasz Wasilczyk twasilczyk at pidgin.im
Wed Apr 30 19:32:10 EDT 2014


Changeset: cde50837937de2fa273cf1532b13b20ee87a59bb
Author:	 Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date:	 2014-05-01 01:32 +0200
Branch:	 release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/cde50837937d

Description:

Ifdef some dead code, fixing coverity bugs

diffstat:

 pidgin/gtkrequest.c |  30 ++++++++++++++++++++++++++++--
 pidgin/gtkthemes.c  |   2 +-
 2 files changed, 29 insertions(+), 3 deletions(-)

diffs (131 lines):

diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1298,7 +1298,9 @@ pidgin_request_fields(const char *title,
 		size_t field_count = 0;
 		size_t cols = 1;
 		size_t rows;
+#if 0
 		size_t col_num;
+#endif
 		size_t row_num = 0;
 
 		group      = gl->data;
@@ -1313,17 +1315,19 @@ pidgin_request_fields(const char *title,
 			frame = vbox2;
 
 		field_count = g_list_length(field_list);
-/*
+#if 0
 		if (field_count > 9)
 		{
 			rows = field_count / 2;
 			cols++;
 		}
 		else
-		*/
+#endif
 			rows = field_count;
 
+#if 0
 		col_num = 0;
+#endif
 
 		for (fl = field_list; fl != NULL; fl = fl->next)
 		{
@@ -1335,8 +1339,10 @@ pidgin_request_fields(const char *title,
 
 			if (type == PURPLE_REQUEST_FIELD_LABEL)
 			{
+#if 0
 				if (col_num > 0)
 					rows++;
+#endif
 
 				rows++;
 			}
@@ -1344,16 +1350,20 @@ pidgin_request_fields(const char *title,
 				 (type == PURPLE_REQUEST_FIELD_STRING &&
 				  purple_request_field_string_is_multiline(field)))
 			{
+#if 0
 				if (col_num > 0)
 					rows++;
+#endif
 
 				rows += 2;
 			}
 
+#if 0
 			col_num++;
 
 			if (col_num >= cols)
 				col_num = 0;
+#endif
 		}
 
 		table = gtk_table_new(rows, 2 * cols, FALSE);
@@ -1367,11 +1377,21 @@ pidgin_request_fields(const char *title,
 			 row_num < rows && fl != NULL;
 			 row_num++)
 		{
+#if 0
 			for (col_num = 0;
 				 col_num < cols && fl != NULL;
 				 col_num++, fl = fl->next)
+#else
+			gboolean dummy_counter = TRUE;
+			/* it's the same as loop above */
+			for (; dummy_counter && fl != NULL; dummy_counter = FALSE, fl = fl->next)
+#endif
 			{
+#if 0
 				size_t col_offset = col_num * 2;
+#else
+				size_t col_offset = 0;
+#endif
 				PurpleRequestFieldType type;
 				GtkWidget *widget = NULL;
 				const char *field_label;
@@ -1380,7 +1400,9 @@ pidgin_request_fields(const char *title,
 				field = fl->data;
 
 				if (!purple_request_field_is_visible(field)) {
+#if 0
 					col_num--;
+#endif
 					continue;
 				}
 
@@ -1407,15 +1429,19 @@ pidgin_request_fields(const char *title,
 						(type == PURPLE_REQUEST_FIELD_STRING &&
 						 purple_request_field_string_is_multiline(field)))
 					{
+#if 0
 						if(col_num > 0)
 							row_num++;
+#endif
 
 						gtk_table_attach_defaults(GTK_TABLE(table), label,
 												  0, 2 * cols,
 												  row_num, row_num + 1);
 
 						row_num++;
+#if 0
 						col_num=cols;
+#endif
 					}
 					else
 					{
diff --git a/pidgin/gtkthemes.c b/pidgin/gtkthemes.c
--- a/pidgin/gtkthemes.c
+++ b/pidgin/gtkthemes.c
@@ -274,7 +274,7 @@ void pidgin_themes_load_smiley_theme(con
 		}
 
 		if (! g_utf8_validate(buf, -1, NULL)) {
-			purple_debug_error("gtkthemes", "%s:%d is invalid UTF-8\n", file, line_nbr);
+			purple_debug_error("gtkthemes", "%s:%" G_GSIZE_FORMAT " is invalid UTF-8\n", file, line_nbr);
 			continue;
 		}
 



More information about the Commits mailing list