changeset 1177:5a20c47e7a14

Fix up unsigned expression always true/false warnings.
author zas_
date Tue, 25 Nov 2008 17:01:03 +0000
parents d3e51e1a02f8
children f6449c17306b
files src/filefilter.c src/image-overlay.c src/info.c src/layout.c src/print.c
diffstat 5 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/filefilter.c	Sun Nov 23 22:05:27 2008 +0000
+++ b/src/filefilter.c	Tue Nov 25 17:01:03 2008 +0000
@@ -304,7 +304,7 @@
 			ext = filter_to_list(fe->extensions);
 			if (ext) extension_list = g_list_concat(extension_list, ext);
 
-			if (fe->file_class >= 0 && fe->file_class < FILE_FORMAT_CLASSES)
+			if (fe->file_class < FILE_FORMAT_CLASSES)
 				{
 				ext = filter_to_list(fe->extensions);
 				if (ext) file_class_extension_list[fe->file_class] = g_list_concat(file_class_extension_list[fe->file_class], ext);
@@ -347,7 +347,7 @@
 	GList *work;
 	guint ln;
 
-	if (file_class < 0 || file_class >= FILE_FORMAT_CLASSES)
+	if (file_class >= FILE_FORMAT_CLASSES)
 		{
 		log_printf("WARNING: invalid file class %d\n", file_class);
 		return FALSE;
--- a/src/image-overlay.c	Sun Nov 23 22:05:27 2008 +0000
+++ b/src/image-overlay.c	Tue Nov 25 17:01:03 2008 +0000
@@ -1079,7 +1079,7 @@
 
 	if (!osd) return;
 
-	if (flag < IMAGE_OSD_NONE || flag >= IMAGE_OSD_COUNT) return;
+	if (flag >= IMAGE_OSD_COUNT) return;
 	if (duration < 0) duration = IMAGE_OSD_DEFAULT_DURATION;
 	if (duration > 1) duration += 1;
 
--- a/src/info.c	Sun Nov 23 22:05:27 2008 +0000
+++ b/src/info.c	Tue Nov 25 17:01:03 2008 +0000
@@ -527,7 +527,7 @@
 			{
 			if (t->func == info_tab_new_funcs[i])
 				{
-				g_assert(t->pos >= 0 && t->pos < G_N_ELEMENTS(info_tab_new_funcs));
+				g_assert(t->pos < G_N_ELEMENTS(info_tab_new_funcs));
 				str[t->pos] = i + '1';
 				}
 			}
--- a/src/layout.c	Sun Nov 23 22:05:27 2008 +0000
+++ b/src/layout.c	Tue Nov 25 17:01:03 2008 +0000
@@ -1922,8 +1922,10 @@
 
 	layout_config_parse(options->layout.style, options->layout.order,
 			    &lw->dir_location,  &lw->file_location, &lw->image_location);
-	lw->dir_view_type = CLAMP(options->layout.dir_view_type, 0, VIEW_DIR_TYPES_COUNT - 1);
-	lw->file_view_type = CLAMP(options->layout.file_view_type, 0, VIEW_FILE_TYPES_COUNT - 1);
+	lw->dir_view_type = options->layout.dir_view_type;
+    if (lw->dir_view_type >= VIEW_DIR_TYPES_COUNT) lw->dir_view_type = 0;
+	lw->file_view_type = options->layout.file_view_type;
+    if (lw->file_view_type >= VIEW_FILE_TYPES_COUNT) lw->file_view_type = 0;
 
 	/* divider positions */
 
--- a/src/print.c	Sun Nov 23 22:05:27 2008 +0000
+++ b/src/print.c	Tue Nov 25 17:01:03 2008 +0000
@@ -332,7 +332,7 @@
 
 static const gchar *print_output_name(PrintOutput output)
 {
-	if (output < 0 || output >= PRINT_OUTPUT_COUNT) return "";
+	if (output >= PRINT_OUTPUT_COUNT) return "";
 
 	return _(print_output_text[output]);
 }
@@ -2809,7 +2809,7 @@
 {
 	PaperUnits old_units;
 
-	if (units < 0 || units >= PAPER_UNIT_COUNT) return;
+	if (units >= PAPER_UNIT_COUNT) return;
 
 	old_units = pw->paper_units;
 	pw->paper_units = units;