Skip to content

Commit 8fb0f71

Browse files
authored
Merge pull request #18750 from victoryforce/tiff-loader-maint
[imageio] Some TIFF loader maintenance
2 parents 86ffe54 + d6797e1 commit 8fb0f71

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/imageio/imageio_tiff.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,13 @@ static void _warning_error_handler(const char *type,
337337
const char* fmt,
338338
va_list ap)
339339
{
340-
fprintf(stderr, "[tiff_open] %s: %s: ", type, module);
340+
// We prepend the wall time from the program start to output line
341+
// to be consistent with dt_print
342+
fprintf(stderr,
343+
"%11.4f [tiff_open] %s: %s: ",
344+
dt_get_wtime() - darktable.start_wtime,
345+
type,
346+
module);
341347
vfprintf(stderr, fmt, ap);
342348
fprintf(stderr, "\n");
343349
}
@@ -364,10 +370,8 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img,
364370
TIFFSetWarningHandler(_warning_handler);
365371
TIFFSetErrorHandler(_error_handler);
366372

367-
const char *ext = filename + strlen(filename);
368-
while(*ext != '.' && ext > filename) ext--;
369-
if(strncmp(ext, ".tif", 4) && strncmp(ext, ".TIF", 4) && strncmp(ext, ".tiff", 5)
370-
&& strncmp(ext, ".TIFF", 5))
373+
char *ext = g_strrstr(filename, ".");
374+
if(ext && g_ascii_strcasecmp(ext, ".tif") && g_ascii_strcasecmp(ext, ".tiff"))
371375
return DT_IMAGEIO_UNSUPPORTED_FORMAT;
372376

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

0 commit comments

Comments
 (0)