From ac72178f1ab11064deda8c4d0e6153ccda2f0f12 Mon Sep 17 00:00:00 2001
From: Timothy Lyanguzov <[EMAIL REDACTED]>
Date: Thu, 20 Jul 2023 13:30:59 +1200
Subject: [PATCH] Automatically format with clang-format
---
tools/raw2tiff.c | 16 ++++++++++------
tools/tiffcp.c | 7 ++++---
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
index 0d6b0b66..307e4be8 100644
--- a/tools/raw2tiff.c
+++ b/tools/raw2tiff.c
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
int fd;
char *outfilename = NULL;
TIFF *out;
- uint32_t temp_limit_check = 0; /* temp for integer overflow checking*/
+ uint32_t temp_limit_check = 0; /* temp for integer overflow checking*/
uint32_t row, col, band;
int c;
@@ -225,26 +225,30 @@ int main(int argc, char *argv[])
/* check for integer overflow in */
/* hdr_size + (*width) * (*length) * nbands * depth */
- if ((width == 0) || (length == 0) ){
+ if ((width == 0) || (length == 0))
+ {
fprintf(stderr, "Too large nbands value specified.\n");
return (EXIT_FAILURE);
}
-
+
temp_limit_check = nbands * depth;
- if ( !temp_limit_check || length > ( UINT_MAX / temp_limit_check ) ) {
+ if (!temp_limit_check || length > (UINT_MAX / temp_limit_check))
+ {
fprintf(stderr, "Too large length size specified.\n");
return (EXIT_FAILURE);
}
temp_limit_check = temp_limit_check * length;
- if ( !temp_limit_check || width > ( UINT_MAX / temp_limit_check ) ) {
+ if (!temp_limit_check || width > (UINT_MAX / temp_limit_check))
+ {
fprintf(stderr, "Too large width size specified.\n");
return (EXIT_FAILURE);
}
temp_limit_check = temp_limit_check * width;
- if ( !temp_limit_check || hdr_size > ( UINT_MAX - temp_limit_check ) ) {
+ if (!temp_limit_check || hdr_size > (UINT_MAX - temp_limit_check))
+ {
fprintf(stderr, "Too large header size specified.\n");
return (EXIT_FAILURE);
}
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index 80b39829..42b5510c 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -1755,11 +1755,12 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer)
return 0;
}
- if ( (imagew - tilew * spp) > INT_MAX ){
+ if ((imagew - tilew * spp) > INT_MAX)
+ {
TIFFError(TIFFFileName(in),
"Error, image raster scan line size is too large");
- return 0;
- }
+ return 0;
+ }
iskew = imagew - tilew * spp;
tilebuf = limitMalloc(tilesize);