]> git.cworth.org Git - mnemon/commitdiff
Yet more "unsiged vs. signed" warning cleanups. master
authorCarl Worth <cworth@cworth.org>
Mon, 26 Sep 2011 05:27:47 +0000 (22:27 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 26 Sep 2011 05:27:47 +0000 (22:27 -0700)
I'm not sure how I missed these in the recent commits, but there
you have it.

mnemon.c

index ac31422cba7c4eb2f8757e9ed07425250d07ef78..a27efd4f106042f3ae14be7a626f04b7eadc2b34 100644 (file)
--- a/mnemon.c
+++ b/mnemon.c
@@ -321,7 +321,7 @@ mnemon_init (mnemon_t *mnemon)
 void
 mnemon_fini (mnemon_t *mnemon)
 {
 void
 mnemon_fini (mnemon_t *mnemon)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < mnemon->num_bins; i++)
        bin_fini (&mnemon->bins[i]);
 
     for (i = 0; i < mnemon->num_bins; i++)
        bin_fini (&mnemon->bins[i]);
@@ -351,7 +351,7 @@ category_t *
 mnemon_get_category_if_exists (mnemon_t            *mnemon,
                               const char   *name)
 {
 mnemon_get_category_if_exists (mnemon_t            *mnemon,
                               const char   *name)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < mnemon->num_categories; i++)
        if (strcmp (mnemon->categories[i].name, name) == 0)
 
     for (i = 0; i < mnemon->num_categories; i++)
        if (strcmp (mnemon->categories[i].name, name) == 0)
@@ -396,7 +396,7 @@ static bin_t *
 mnemon_get_bin (mnemon_t       *mnemon,
                int              score)
 {
 mnemon_get_bin (mnemon_t       *mnemon,
                int              score)
 {
-    int i;
+    unsigned int i;
     bin_t *bin;
 
     for (i = 0; i < mnemon->num_bins; i++)
     bin_t *bin;
 
     for (i = 0; i < mnemon->num_bins; i++)
@@ -478,7 +478,7 @@ mnemon_load_category (mnemon_t              *mnemon,
     int line_count = 0;
     char *path;
     category_t *category;
     int line_count = 0;
     char *path;
     category_t *category;
-    int i;
+    unsigned int i;
     struct stat st;
 
     path = xmalloc (strlen (mnemon->dir_name) + 1 + strlen (name) + 1);
     struct stat st;
 
     path = xmalloc (strlen (mnemon->dir_name) + 1 + strlen (name) + 1);
@@ -658,7 +658,8 @@ mnemon_load (mnemon_t *mnemon)
 void
 mnemon_save (mnemon_t *mnemon)
 {
 void
 mnemon_save (mnemon_t *mnemon)
 {
-    int i, err;
+    unsigned int i;
+    int err;
     char *filename, *lock_filename;
     FILE *file;
     category_t *category;
     char *filename, *lock_filename;
     FILE *file;
     category_t *category;
@@ -752,12 +753,12 @@ mnemon_item_category (mnemon_t    *mnemon,
                      item_t    *item)
 {
     category_t *category;
                      item_t    *item)
 {
     category_t *category;
-    int i, item_index;
+    unsigned int i, item_index;
 
     for (i = 0; i < mnemon->num_categories; i++) {
        category = &mnemon->categories[i];
        item_index = item - category->items;
 
     for (i = 0; i < mnemon->num_categories; i++) {
        category = &mnemon->categories[i];
        item_index = item - category->items;
-       if (item_index >= 0 && item_index < category->num_items)
+       if (item_index < category->num_items)
            return category;
     }
 
            return category;
     }