Use g_ascii_strncasecmp() instead of strncasecmp() where applicable.
authorLaurent Monin <geeqie@norz.org>
Thu, 8 May 2008 12:50:25 +0000 (12:50 +0000)
committerLaurent Monin <geeqie@norz.org>
Thu, 8 May 2008 12:50:25 +0000 (12:50 +0000)
Add a FIXME where potential improper usage of strncasecmp() is made.

src/collect-dlg.c
src/collect-io.c
src/filefilter.c
src/rcfile.c
src/ui_fileops.c
src/ui_pathsel.c

index 830f0b1..a527e57 100644 (file)
@@ -103,6 +103,7 @@ static void collection_save_cb(FileDialog *fd, gpointer data)
 
        path = fd->dest_path;
 
+       /* FIXME: utf8 */
        if (!(strlen(path) > 7 && strncasecmp(path + (strlen(path) - 4), ".gqv", 4) == 0))
                {
                gchar *buf;
index 89f764f..643a10c 100644 (file)
@@ -119,7 +119,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle
                if (*p == '#')
                        {
                        if (!need_header) continue;
-                       if (strncasecmp(p, GQ_COLLECTION_MARKER, strlen(GQ_COLLECTION_MARKER)) == 0)
+                       if (g_ascii_strncasecmp(p, GQ_COLLECTION_MARKER, strlen(GQ_COLLECTION_MARKER)) == 0)
                                {
                                /* Looks like an official collection, allow unchecked input.
                                 * All this does is allow adding files that may not exist,
@@ -136,7 +136,7 @@ static gint collection_load_private(CollectionData *cd, const gchar *path, Colle
                                cd->window_read = TRUE;
                                if (only_geometry) break;
                                }
-                       else if (strncasecmp(p, "#GQview collection", strlen("#GQview collection")) == 0)
+                       else if (g_ascii_strncasecmp(p, "#GQview collection", strlen("#GQview collection")) == 0)
                                {
                                /* As 2008/04/15 there is no difference between our collection file format
                                 * and GQview 2.1.5 collection file format so ignore failures as well. */
index c02793a..44bc186 100644 (file)
@@ -330,6 +330,7 @@ gint filter_name_exists(const gchar *name)
 
                if (ln >= lf)
                        {
+                       /* FIXME: utf8 */
                        if (strncasecmp(name + ln - lf, filter, lf) == 0) return TRUE;
                        }
                work = work->next;
@@ -358,6 +359,7 @@ gint filter_file_class(const gchar *name, FileFormatClass file_class)
 
                if (ln >= lf)
                        {
+                       /* FIXME: utf8 */
                        if (strncasecmp(name + ln - lf, filter, lf) == 0) return TRUE;
                        }
                work = work->next;
index b065266..edda5b3 100644 (file)
@@ -776,7 +776,7 @@ void load_options(void)
                READ_BOOL(color_profile.use_image);
                READ_INT(color_profile.input_type);
 
-               if (strncasecmp(option, "color_profile.input_file_", 25) == 0)
+               if (g_ascii_strncasecmp(option, "color_profile.input_file_", 25) == 0)
                        {
                        i = strtol(option + 25, NULL, 0) - 1;
                        if (i >= 0 && i < COLOR_PROFILE_INPUTS)
@@ -784,7 +784,7 @@ void load_options(void)
                                read_char_option(f, option, option, value, &options->color_profile.input_file[i]);
                                }
                        }
-               if (strncasecmp(option, "color_profile.input_name_", 25) == 0)
+               if (g_ascii_strncasecmp(option, "color_profile.input_name_", 25) == 0)
                        {
                        i = strtol(option + 25, NULL, 0) - 1;
                        if (i >= 0 && i < COLOR_PROFILE_INPUTS)
@@ -798,7 +798,7 @@ void load_options(void)
 
                /* External Programs */
 
-               if (strncasecmp(option, "external_", 9) == 0)
+               if (g_ascii_strncasecmp(option, "external_", 9) == 0)
                        {
                        i = strtol(option + 9, NULL, 0);
                        if (i > 0 && i <= GQ_EDITOR_SLOTS)
@@ -814,7 +814,7 @@ void load_options(void)
                        }
 
                /* Exif */
-               if (0 == strncasecmp(option, "exif.display.", 13))
+               if (0 == g_ascii_strncasecmp(option, "exif.display.", 13))
                        {
                        for (i = 0; ExifUIList[i].key; i++)
                                if (0 == g_ascii_strcasecmp(option + 13, ExifUIList[i].key))
index c8efc5f..4b9f1b9 100644 (file)
@@ -645,6 +645,7 @@ gint file_extension_match(const gchar *path, const gchar *ext)
        p = strlen(path);
        e = strlen(ext);
 
+       /* FIXME: utf8 */
        return (p > e && strncasecmp(path + p - e, ext, e) == 0);
 }
 
index cf7a167..d26a108 100644 (file)
@@ -134,6 +134,7 @@ static gint dest_check_filter(const gchar *filter, const gchar *file)
                        }
                if (*f_ptr != '\0' && f_ptr[1] == ' ') f_ptr++; /* skip space immediately after separator */
                f_ptr++;
+               /* FIXME: utf8 */
                if (l >= i && strncasecmp(file + l - i, strt_ptr, i) == 0) return TRUE;
                }
        return FALSE;