From cfe2b3ba31e60ed9863f7f9af807b2f936893ef7 Mon Sep 17 00:00:00 2001 From: Laurent Monin Date: Thu, 8 May 2008 12:50:25 +0000 Subject: [PATCH] Use g_ascii_strncasecmp() instead of strncasecmp() where applicable. Add a FIXME where potential improper usage of strncasecmp() is made. --- src/collect-dlg.c | 1 + src/collect-io.c | 4 ++-- src/filefilter.c | 2 ++ src/rcfile.c | 8 ++++---- src/ui_fileops.c | 1 + src/ui_pathsel.c | 1 + 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/collect-dlg.c b/src/collect-dlg.c index 830f0b16..a527e570 100644 --- a/src/collect-dlg.c +++ b/src/collect-dlg.c @@ -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; diff --git a/src/collect-io.c b/src/collect-io.c index 89f764f9..643a10c9 100644 --- a/src/collect-io.c +++ b/src/collect-io.c @@ -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. */ diff --git a/src/filefilter.c b/src/filefilter.c index c02793a3..44bc186d 100644 --- a/src/filefilter.c +++ b/src/filefilter.c @@ -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; diff --git a/src/rcfile.c b/src/rcfile.c index b0652666..edda5b3a 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -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)) diff --git a/src/ui_fileops.c b/src/ui_fileops.c index c8efc5f0..4b9f1b98 100644 --- a/src/ui_fileops.c +++ b/src/ui_fileops.c @@ -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); } diff --git a/src/ui_pathsel.c b/src/ui_pathsel.c index cf7a1674..d26a1088 100644 --- a/src/ui_pathsel.c +++ b/src/ui_pathsel.c @@ -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; -- 2.20.1