comparison src/image.c @ 1356:681e79dd0820

Slightly modify access_file() and use it to test profile files existence and read access.
author zas_
date Sun, 01 Mar 2009 15:41:51 +0000
parents c9949c19a6d0
children 4ca837d74999
comparison
equal deleted inserted replaced
1355:5a61fb9adc05 1356:681e79dd0820
202 if (imd->cm) return FALSE; 202 if (imd->cm) return FALSE;
203 203
204 if (imd->color_profile_input >= COLOR_PROFILE_FILE && 204 if (imd->color_profile_input >= COLOR_PROFILE_FILE &&
205 imd->color_profile_input < COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS) 205 imd->color_profile_input < COLOR_PROFILE_FILE + COLOR_PROFILE_INPUTS)
206 { 206 {
207 gint n; 207 const gchar *file = options->color_profile.input_file[imd->color_profile_input - COLOR_PROFILE_FILE];
208 208
209 n = imd->color_profile_input - COLOR_PROFILE_FILE; 209 if (!access_file(file, R_OK)) return FALSE;
210 if (!options->color_profile.input_file[n] || !options->color_profile.input_file[n][0]) return FALSE;
211 210
212 input_type = COLOR_PROFILE_FILE; 211 input_type = COLOR_PROFILE_FILE;
213 input_file = options->color_profile.input_file[n]; 212 input_file = file;
214 } 213 }
215 else if (imd->color_profile_input >= COLOR_PROFILE_SRGB && 214 else if (imd->color_profile_input >= COLOR_PROFILE_SRGB &&
216 imd->color_profile_input < COLOR_PROFILE_FILE) 215 imd->color_profile_input < COLOR_PROFILE_FILE)
217 { 216 {
218 input_type = imd->color_profile_input; 217 input_type = imd->color_profile_input;
222 { 221 {
223 return FALSE; 222 return FALSE;
224 } 223 }
225 224
226 if (imd->color_profile_screen == 1 && 225 if (imd->color_profile_screen == 1 &&
227 options->color_profile.screen_file && 226 access_file(options->color_profile.screen_file, R_OK))
228 options->color_profile.screen_file[0])
229 { 227 {
230 screen_type = COLOR_PROFILE_FILE; 228 screen_type = COLOR_PROFILE_FILE;
231 screen_file = options->color_profile.screen_file; 229 screen_file = options->color_profile.screen_file;
232 } 230 }
233 else if (imd->color_profile_screen == 0) 231 else if (imd->color_profile_screen == 0)