[gnome-commander] src/imageloader.cc: fix for -Wsign-compare



commit 72f6013f04f0789bfd37c5c3b9ce3f6ad11b646a
Author: Mamoru TASAKA <mtasaka fedoraproject org>
Date:   Tue Apr 25 14:33:17 2017 +0900

    src/imageloader.cc: fix for -Wsign-compare
    
    src/imageloader.cc:123:22: error: comparison between signed and unsigned integer expressions 
[-Werror=sign-compare]
          for (gint i=0; i<NUM_FILE_TYPE_PIXMAPS; i++)
    
    src/imageloader.cc:256:21: error: comparison between signed and unsigned integer expressions 
[-Werror=sign-compare]
         for (gint i=0; i<G_N_ELEMENTS(categories); i++)
    
    NUM_FILE_TYPE_PIXMAPS = G_N_ELEMENTS(file_type_pixmap_files) (line 54)
    #define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) (GLib)
    
    so both have size_t.

 src/imageloader.cc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/imageloader.cc b/src/imageloader.cc
index ed84460..a080186 100644
--- a/src/imageloader.cc
+++ b/src/imageloader.cc
@@ -120,7 +120,7 @@ void IMAGE_init ()
 
      // Load file type icons
 
-     for (gint i=0; i<NUM_FILE_TYPE_PIXMAPS; i++)
+     for (size_t i=0; i<NUM_FILE_TYPE_PIXMAPS; i++)
     {
         CacheEntry *e = &file_type_pixmaps[i];
         gchar *path = g_build_filename (PIXMAPS_DIR, file_type_pixmap_files[i], NULL);
@@ -253,7 +253,7 @@ inline gchar *get_mime_document_type_icon_path (const gchar *mime_type, const gc
  */
 inline gchar *get_category_icon_path (const gchar *mime_type, const gchar *icon_dir)
 {
-    for (gint i=0; i<G_N_ELEMENTS(categories); i++)
+    for (size_t i=0; i<G_N_ELEMENTS(categories); i++)
         if (g_str_has_prefix (mime_type, categories[i][0]))
             return g_build_filename (icon_dir, categories[i][1], NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]