From 8833b848d33e3bf1ac67a25fa7481e4ba5181a4f Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Fri, 17 May 2024 15:01:50 +0200
Subject: [PATCH] Code formatting fixes
Result of running ``pre-commit run --all``
---
libtiff/tif_getimage.c | 5 ++---
tools/rgb2ycbcr.c | 4 ++--
tools/tiffcrop.c | 13 +++++++------
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
index 0ada2697..6c7b5031 100644
--- a/libtiff/tif_getimage.c
+++ b/libtiff/tif_getimage.c
@@ -766,7 +766,6 @@ static int gtTileContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
return (0);
}
-
/*
* Leftmost tile is clipped on left side if col_offset > 0.
*/
@@ -1111,7 +1110,6 @@ static int gtStripContig(TIFFRGBAImage *img, uint32_t *raster, uint32_t w,
return (0);
}
-
scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += nrow)
@@ -3323,7 +3321,8 @@ int TIFFReadRGBATileExt(TIFF *tif, uint32_t col, uint32_t row, uint32_t *raster,
TIFFGetFieldDefaulted(tif, TIFFTAG_TILELENGTH, &tile_ysize);
if (tile_xsize == 0 || tile_ysize == 0)
{
- TIFFErrorExtR(tif, TIFFFileName(tif), "tile_xsize or tile_ysize is zero");
+ TIFFErrorExtR(tif, TIFFFileName(tif),
+ "tile_xsize or tile_ysize is zero");
return (0);
}
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index ad51a178..a4b9cb37 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -273,7 +273,7 @@ static int cvtRaster(TIFF *tif, uint32_t *raster, uint32_t width,
uint32_t nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);
uint32_t rnrows = roundup(nrows, vertSubSampling);
- cc = (tsize_t) rnrows * rwidth +
+ cc = (tsize_t)rnrows * rwidth +
2 * ((rnrows * rwidth) / (horizSubSampling * vertSubSampling));
buf = (unsigned char *)_TIFFmalloc(cc);
// FIXME unchecked malloc
@@ -282,7 +282,7 @@ static int cvtRaster(TIFF *tif, uint32_t *raster, uint32_t width,
uint32_t nr = (y > nrows ? nrows : y);
cvtStrip(buf, raster + (y - 1) * width, nr, width);
nr = roundup(nr, vertSubSampling);
- acc = (tsize_t) nr * rwidth +
+ acc = (tsize_t)nr * rwidth +
2 * ((nr * rwidth) / (horizSubSampling * vertSubSampling));
if (!TIFFWriteEncodedStrip(tif, strip++, buf, acc))
{
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 95983479..b11fec93 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -1366,7 +1366,7 @@ static int writeBufferToSeparateStrips(TIFF *out, uint8_t *buf, uint32_t length,
"bytes_per_sample * (width + 1)");
return 1;
}
- rowstripsize = (tsize_t) rowsperstrip * bytes_per_sample * (width + 1);
+ rowstripsize = (tsize_t)rowsperstrip * bytes_per_sample * (width + 1);
/* Add 3 padding bytes for extractContigSamples32bits */
obuf = limitMalloc(rowstripsize + NUM_BUFF_OVERSIZE_BYTES);
@@ -1398,11 +1398,12 @@ static int writeBufferToSeparateStrips(TIFF *out, uint8_t *buf, uint32_t length,
"might be wrong.",
(uint64_t)scanlinesize);
}
- dump_info(dump->outfile, dump->format, "",
- "Sample %2d, Strip: %2d, bytes: %4zd, Row %4d, bytes: "
- "%4d, Input offset: %6zd",
- s + 1, strip + 1, stripsize, row + 1,
- (uint32_t)scanlinesize, src - buf);
+ dump_info(
+ dump->outfile, dump->format, "",
+ "Sample %2d, Strip: %2d, bytes: %4zd, Row %4d, bytes: "
+ "%4d, Input offset: %6zd",
+ s + 1, strip + 1, stripsize, row + 1,
+ (uint32_t)scanlinesize, src - buf);
dump_buffer(dump->outfile, dump->format, nrows,
(uint32_t)scanlinesize, row, obuf);
}