Skip to content

Commit 3425fb2

Browse files
committed
Minor code reformatting
1 parent a10bfab commit 3425fb2

File tree

1 file changed

+44
-10
lines changed

1 file changed

+44
-10
lines changed

src/imageio/imageio_tiff.c

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,10 @@ static inline int _read_chunky_16_Lab(tiff_t *t, uint16_t photometric)
332332
}
333333

334334

335-
static void _warning_error_handler(const char *type, const char* module, const char* fmt, va_list ap)
335+
static void _warning_error_handler(const char *type,
336+
const char* module,
337+
const char* fmt,
338+
va_list ap)
336339
{
337340
fprintf(stderr, "[tiff_open] %s: %s: ", type, module);
338341
vfprintf(stderr, fmt, ap);
@@ -352,7 +355,9 @@ static void _error_handler(const char* module, const char* fmt, va_list ap)
352355
_warning_error_handler("error", module, fmt, ap);
353356
}
354357

355-
dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename, dt_mipmap_buffer_t *mbuf)
358+
dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img,
359+
const char *filename,
360+
dt_mipmap_buffer_t *mbuf)
356361
{
357362
// doing this once would be enough, but our imageio reading code is
358363
// compiled into dt's core and doesn't have an init routine.
@@ -364,6 +369,7 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
364369
if(strncmp(ext, ".tif", 4) && strncmp(ext, ".TIF", 4) && strncmp(ext, ".tiff", 5)
365370
&& strncmp(ext, ".TIFF", 5))
366371
return DT_IMAGEIO_UNSUPPORTED_FORMAT;
372+
367373
if(!img->exif_inited) (void)dt_exif_read(img, filename);
368374

369375
tiff_t t;
@@ -403,7 +409,9 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
403409

404410
if(inkset == INKSET_CMYK || inkset == INKSET_MULTIINK)
405411
{
406-
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: unsupported CMYK (or multi-ink) in '%s'", filename);
412+
dt_print(DT_DEBUG_ALWAYS,
413+
"[tiff_open] error: unsupported CMYK (or multi-ink) in '%s'",
414+
filename);
407415
TIFFClose(t.tiff);
408416
return DT_IMAGEIO_UNSUPPORTED_FEATURE;
409417
}
@@ -416,20 +424,26 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
416424

417425
t.scanlinesize = TIFFScanlineSize(t.tiff);
418426

419-
dt_print(DT_DEBUG_IMAGEIO, "[tiff_open] %dx%d %dbpp, %d samples per pixel", t.width, t.height, t.bpp, t.spp);
427+
dt_print(DT_DEBUG_IMAGEIO,
428+
"[tiff_open] %dx%d %dbpp, %d samples per pixel",
429+
t.width, t.height, t.bpp, t.spp);
420430

421431
// we only support 8, 16 and 32 bits per pixel formats.
422432
if(t.bpp != 8 && t.bpp != 16 && t.bpp != 32)
423433
{
424434
TIFFClose(t.tiff);
425-
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: unsupported bit depth other than 8, 16 or 32 in '%s'", filename);
435+
dt_print(DT_DEBUG_ALWAYS,
436+
"[tiff_open] error: unsupported bit depth other than 8, 16 or 32 in '%s'",
437+
filename);
426438
return DT_IMAGEIO_UNSUPPORTED_FEATURE;
427439
}
428440

429441
/* don't depend on planar config if spp == 1 */
430442
if(t.spp > 1 && config != PLANARCONFIG_CONTIG)
431443
{
432-
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: unsupported non-chunky PlanarConfiguration in '%s'", filename);
444+
dt_print(DT_DEBUG_ALWAYS,
445+
"[tiff_open] error: unsupported non-chunky PlanarConfiguration in '%s'",
446+
filename);
433447
TIFFClose(t.tiff);
434448
return DT_IMAGEIO_UNSUPPORTED_FEATURE;
435449
}
@@ -446,7 +460,9 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
446460
t.mipbuf = (float *)dt_mipmap_cache_alloc(mbuf, t.image);
447461
if(!t.mipbuf)
448462
{
449-
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: could not alloc full buffer for '%s'", t.image->filename);
463+
dt_print(DT_DEBUG_ALWAYS,
464+
"[tiff_open] error: could not alloc full buffer for '%s'",
465+
t.image->filename);
450466
TIFFClose(t.tiff);
451467
return DT_IMAGEIO_CACHE_FULL;
452468
}
@@ -474,21 +490,39 @@ dt_imageio_retval_t dt_imageio_open_tiff(dt_image_t *img, const char *filename,
474490
int ok = 1;
475491
dt_imageio_retval_t ret = DT_IMAGEIO_LOAD_FAILED;
476492

477-
if((photometric == PHOTOMETRIC_CIELAB || photometric == PHOTOMETRIC_ICCLAB) && t.bpp == 8 && t.sampleformat == SAMPLEFORMAT_UINT)
493+
if((photometric == PHOTOMETRIC_CIELAB || photometric == PHOTOMETRIC_ICCLAB)
494+
&& t.bpp == 8
495+
&& t.sampleformat == SAMPLEFORMAT_UINT)
496+
{
478497
ok = _read_chunky_8_Lab(&t, photometric);
479-
else if((photometric == PHOTOMETRIC_CIELAB || photometric == PHOTOMETRIC_ICCLAB) && t.bpp == 16 && t.sampleformat == SAMPLEFORMAT_UINT)
498+
}
499+
else if((photometric == PHOTOMETRIC_CIELAB || photometric == PHOTOMETRIC_ICCLAB)
500+
&& t.bpp == 16
501+
&& t.sampleformat == SAMPLEFORMAT_UINT)
502+
{
480503
ok = _read_chunky_16_Lab(&t, photometric);
504+
}
481505
else if(t.bpp == 8 && t.sampleformat == SAMPLEFORMAT_UINT)
506+
{
482507
ok = _read_chunky_8(&t);
508+
}
483509
else if(t.bpp == 16 && t.sampleformat == SAMPLEFORMAT_UINT)
510+
{
484511
ok = _read_chunky_16(&t);
512+
}
485513
else if(t.bpp == 16 && t.sampleformat == SAMPLEFORMAT_IEEEFP)
514+
{
486515
ok = _read_chunky_h(&t);
516+
}
487517
else if(t.bpp == 32 && t.sampleformat == SAMPLEFORMAT_IEEEFP)
518+
{
488519
ok = _read_chunky_f(&t);
520+
}
489521
else
490522
{
491-
dt_print(DT_DEBUG_ALWAYS, "[tiff_open] error: unsupported TIFF format feature in '%s'", filename);
523+
dt_print(DT_DEBUG_ALWAYS,
524+
"[tiff_open] error: unsupported TIFF format feature in '%s'",
525+
filename);
492526
ok = 0;
493527
ret = DT_IMAGEIO_UNSUPPORTED_FEATURE;
494528
}

0 commit comments

Comments
 (0)