Mercurial > geeqie.yaz
comparison src/rcfile.c @ 604:0b203af63dbf
Use g_ascii_strcasecmp() instead of strcasecmp() where ascii-only strings
are used.
author | zas_ |
---|---|
date | Thu, 08 May 2008 12:38:34 +0000 |
parents | 4cfce4ed35e0 |
children | 651ae2be1031 |
comparison
equal
deleted
inserted
replaced
603:e8b28413ffbf | 604:0b203af63dbf |
---|---|
115 g_free(escval); | 115 g_free(escval); |
116 } | 116 } |
117 | 117 |
118 static void read_char_option(FILE *f, gchar *option, gchar *label, gchar *value, gchar **text) | 118 static void read_char_option(FILE *f, gchar *option, gchar *label, gchar *value, gchar **text) |
119 { | 119 { |
120 if (text && strcasecmp(option, label) == 0) | 120 if (text && g_ascii_strcasecmp(option, label) == 0) |
121 { | 121 { |
122 g_free(*text); | 122 g_free(*text); |
123 *text = quoted_value(value, NULL); | 123 *text = quoted_value(value, NULL); |
124 } | 124 } |
125 } | 125 } |
144 secure_fprintf(ssi, "%s: \n", label); | 144 secure_fprintf(ssi, "%s: \n", label); |
145 } | 145 } |
146 | 146 |
147 static void read_color_option(FILE *f, gchar *option, gchar *label, gchar *value, GdkColor *color) | 147 static void read_color_option(FILE *f, gchar *option, gchar *label, gchar *value, GdkColor *color) |
148 { | 148 { |
149 if (color && strcasecmp(option, label) == 0) | 149 if (color && g_ascii_strcasecmp(option, label) == 0) |
150 { | 150 { |
151 gchar *colorstr = quoted_value(value, NULL); | 151 gchar *colorstr = quoted_value(value, NULL); |
152 if (colorstr) gdk_color_parse(colorstr, color); | 152 if (colorstr) gdk_color_parse(colorstr, color); |
153 g_free(colorstr); | 153 g_free(colorstr); |
154 } | 154 } |
160 secure_fprintf(ssi, "%s: %d\n", label, n); | 160 secure_fprintf(ssi, "%s: %d\n", label, n); |
161 } | 161 } |
162 | 162 |
163 static void read_int_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n) | 163 static void read_int_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n) |
164 { | 164 { |
165 if (n && strcasecmp(option, label) == 0) | 165 if (n && g_ascii_strcasecmp(option, label) == 0) |
166 { | 166 { |
167 *n = strtol(value, NULL, 10); | 167 *n = strtol(value, NULL, 10); |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
173 secure_fprintf(ssi, "%s: %u\n", label, n); | 173 secure_fprintf(ssi, "%s: %u\n", label, n); |
174 } | 174 } |
175 | 175 |
176 static void read_uint_option(FILE *f, gchar *option, gchar *label, gchar *value, guint *n) | 176 static void read_uint_option(FILE *f, gchar *option, gchar *label, gchar *value, guint *n) |
177 { | 177 { |
178 if (n && strcasecmp(option, label) == 0) | 178 if (n && g_ascii_strcasecmp(option, label) == 0) |
179 { | 179 { |
180 *n = strtoul(value, NULL, 10); | 180 *n = strtoul(value, NULL, 10); |
181 } | 181 } |
182 } | 182 } |
183 | 183 |
184 | 184 |
185 | 185 |
186 static void read_int_option_clamp(FILE *f, gchar *option, gchar *label, gchar *value, gint *n, gint min, gint max) | 186 static void read_int_option_clamp(FILE *f, gchar *option, gchar *label, gchar *value, gint *n, gint min, gint max) |
187 { | 187 { |
188 if (n && strcasecmp(option, label) == 0) | 188 if (n && g_ascii_strcasecmp(option, label) == 0) |
189 { | 189 { |
190 *n = CLAMP(strtol(value, NULL, 10), min, max); | 190 *n = CLAMP(strtol(value, NULL, 10), min, max); |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
210 secure_fprintf(ssi, "%s: %d.%d\n", label, l, r); | 210 secure_fprintf(ssi, "%s: %d.%d\n", label, l, r); |
211 } | 211 } |
212 | 212 |
213 static void read_int_unit_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n, gint subunits) | 213 static void read_int_unit_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n, gint subunits) |
214 { | 214 { |
215 if (n && strcasecmp(option, label) == 0) | 215 if (n && g_ascii_strcasecmp(option, label) == 0) |
216 { | 216 { |
217 gint l, r; | 217 gint l, r; |
218 gchar *ptr; | 218 gchar *ptr; |
219 | 219 |
220 ptr = value; | 220 ptr = value; |
243 if (n) secure_fprintf(ssi, "true\n"); else secure_fprintf(ssi, "false\n"); | 243 if (n) secure_fprintf(ssi, "true\n"); else secure_fprintf(ssi, "false\n"); |
244 } | 244 } |
245 | 245 |
246 static void read_bool_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n) | 246 static void read_bool_option(FILE *f, gchar *option, gchar *label, gchar *value, gint *n) |
247 { | 247 { |
248 if (n && strcasecmp(option, label) == 0) | 248 if (n && g_ascii_strcasecmp(option, label) == 0) |
249 { | 249 { |
250 if (strcasecmp(value, "true") == 0 || strcmp(value, "1") == 0) | 250 if (g_ascii_strcasecmp(value, "true") == 0 || strcmp(value, "1") == 0) |
251 *n = TRUE; | 251 *n = TRUE; |
252 else | 252 else |
253 *n = FALSE; | 253 *n = FALSE; |
254 } | 254 } |
255 } | 255 } |
677 READ_INT(panels.sort.action_state); | 677 READ_INT(panels.sort.action_state); |
678 READ_INT(panels.sort.mode_state); | 678 READ_INT(panels.sort.mode_state); |
679 READ_INT(panels.sort.selection_state); | 679 READ_INT(panels.sort.selection_state); |
680 | 680 |
681 /* image options */ | 681 /* image options */ |
682 if (strcasecmp(option, "image.zoom_mode") == 0) | 682 if (g_ascii_strcasecmp(option, "image.zoom_mode") == 0) |
683 { | 683 { |
684 if (strcasecmp(value, "original") == 0) | 684 if (g_ascii_strcasecmp(value, "original") == 0) |
685 options->image.zoom_mode = ZOOM_RESET_ORIGINAL; | 685 options->image.zoom_mode = ZOOM_RESET_ORIGINAL; |
686 else if (strcasecmp(value, "fit") == 0) | 686 else if (g_ascii_strcasecmp(value, "fit") == 0) |
687 options->image.zoom_mode = ZOOM_RESET_FIT_WINDOW; | 687 options->image.zoom_mode = ZOOM_RESET_FIT_WINDOW; |
688 else if (strcasecmp(value, "dont_change") == 0) | 688 else if (g_ascii_strcasecmp(value, "dont_change") == 0) |
689 options->image.zoom_mode = ZOOM_RESET_NONE; | 689 options->image.zoom_mode = ZOOM_RESET_NONE; |
690 } | 690 } |
691 READ_BOOL(image.zoom_2pass); | 691 READ_BOOL(image.zoom_2pass); |
692 READ_BOOL(image.zoom_to_fit_allow_expand); | 692 READ_BOOL(image.zoom_to_fit_allow_expand); |
693 READ_BOOL(image.fit_window_to_image); | 693 READ_BOOL(image.fit_window_to_image); |
758 | 758 |
759 READ_BOOL(file_filter.show_hidden_files); | 759 READ_BOOL(file_filter.show_hidden_files); |
760 READ_BOOL(file_filter.show_dot_directory); | 760 READ_BOOL(file_filter.show_dot_directory); |
761 READ_BOOL(file_filter.disable); | 761 READ_BOOL(file_filter.disable); |
762 | 762 |
763 if (strcasecmp(option, "file_filter.ext") == 0) | 763 if (g_ascii_strcasecmp(option, "file_filter.ext") == 0) |
764 { | 764 { |
765 filter_parse(value_all); | 765 filter_parse(value_all); |
766 } | 766 } |
767 | 767 |
768 if (strcasecmp(option, "sidecar.ext") == 0) | 768 if (g_ascii_strcasecmp(option, "sidecar.ext") == 0) |
769 { | 769 { |
770 sidecar_ext_parse(value_all, TRUE); | 770 sidecar_ext_parse(value_all, TRUE); |
771 } | 771 } |
772 | 772 |
773 /* Color Profiles */ | 773 /* Color Profiles */ |
815 | 815 |
816 /* Exif */ | 816 /* Exif */ |
817 if (0 == strncasecmp(option, "exif.display.", 13)) | 817 if (0 == strncasecmp(option, "exif.display.", 13)) |
818 { | 818 { |
819 for (i = 0; ExifUIList[i].key; i++) | 819 for (i = 0; ExifUIList[i].key; i++) |
820 if (0 == strcasecmp(option + 13, ExifUIList[i].key)) | 820 if (0 == g_ascii_strcasecmp(option + 13, ExifUIList[i].key)) |
821 ExifUIList[i].current = strtol(value, NULL, 10); | 821 ExifUIList[i].current = strtol(value, NULL, 10); |
822 } | 822 } |
823 } | 823 } |
824 | 824 |
825 fclose(f); | 825 fclose(f); |