Skip to content

Commit d6797e1

Browse files
committed
Simplify extension check
1 parent 796bf59 commit d6797e1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/imageio/imageio_tiff.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,10 +370,8 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img,
370370
TIFFSetWarningHandler(_warning_handler);
371371
TIFFSetErrorHandler(_error_handler);
372372

373-
const char *ext = filename + strlen(filename);
374-
while(*ext != '.' && ext > filename) ext--;
375-
if(strncmp(ext, ".tif", 4) && strncmp(ext, ".TIF", 4) && strncmp(ext, ".tiff", 5)
376-
&& strncmp(ext, ".TIFF", 5))
373+
char *ext = g_strrstr(filename, ".");
374+
if(ext && g_ascii_strcasecmp(ext, ".tif") && g_ascii_strcasecmp(ext, ".tiff"))
377375
return DT_IMAGEIO_UNSUPPORTED_FORMAT;
378376

379377
if(!img->exif_inited) (void)dt_exif_read(img, filename);

0 commit comments

Comments
 (0)