diff options
author | Roger Leigh <rleigh@codelibre.net> | 2021-01-01 20:14:07 +0000 |
---|---|---|
committer | Roger Leigh <rleigh@codelibre.net> | 2021-01-21 23:14:13 +0000 |
commit | 39a74eede0455ec8ee334dcddf71f5354d508d8b (patch) | |
tree | 3f6515dfaa192da54d5dd731b9f90d32908b3cd5 /tools/tiffinfo.c | |
parent | af604f119a7b23d0b14dc5940fc84e45616dee69 (diff) | |
download | libtiff-git-39a74eede0455ec8ee334dcddf71f5354d508d8b.tar.gz |
Use standard C99 integer types
Diffstat (limited to 'tools/tiffinfo.c')
-rw-r--r-- | tools/tiffinfo.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/tools/tiffinfo.c b/tools/tiffinfo.c index a7c5f767..f61142ad 100644 --- a/tools/tiffinfo.c +++ b/tools/tiffinfo.c @@ -55,7 +55,7 @@ static int readdata = 0; /* read data in file */ static int stoponerr = 1; /* stop on first read error */ static void usage(int); -static void tiffinfo(TIFF*, uint16, long, int); +static void tiffinfo(TIFF*, uint16_t, long, int); static void PrivateErrorHandler(const char* module, const char* fmt, va_list ap) @@ -69,14 +69,14 @@ int main(int argc, char* argv[]) { int dirnum = -1, multiplefiles, c; - uint16 order = 0; + uint16_t order = 0; TIFF* tif; #if !HAVE_DECL_OPTARG extern int optind; extern char* optarg; #endif long flags = 0; - uint64 diroff = 0; + uint64_t diroff = 0; int chopstrips = 0; /* disable strip chopping */ while ((c = getopt(argc, argv, "f:o:cdDSjilmrsvwz0123456789h")) != -1) @@ -198,7 +198,7 @@ usage(int code) } static void -ShowStrip(tstrip_t strip, unsigned char* pp, uint32 nrow, tsize_t scanline) +ShowStrip(tstrip_t strip, unsigned char* pp, uint32_t nrow, tsize_t scanline) { register tsize_t cc; @@ -221,13 +221,13 @@ TIFFReadContigStripData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif)); if (buf) { - uint32 row, h=0; - uint32 rowsperstrip = (uint32)-1; + uint32_t row, h=0; + uint32_t rowsperstrip = (uint32_t)-1; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); for (row = 0; row < h; row += rowsperstrip) { - uint32 nrow = (row+rowsperstrip > h ? + uint32_t nrow = (row + rowsperstrip > h ? h-row : rowsperstrip); tstrip_t strip = TIFFComputeStrip(tif, row, 0); if (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) { @@ -248,8 +248,8 @@ TIFFReadSeparateStripData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(TIFFStripSize(tif)); if (buf) { - uint32 row, h=0; - uint32 rowsperstrip = (uint32)-1; + uint32_t row, h=0; + uint32_t rowsperstrip = (uint32_t)-1; tsample_t s, samplesperpixel=0; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); @@ -257,7 +257,7 @@ TIFFReadSeparateStripData(TIFF* tif) TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel); for (row = 0; row < h; row += rowsperstrip) { for (s = 0; s < samplesperpixel; s++) { - uint32 nrow = (row+rowsperstrip > h ? + uint32_t nrow = (row + rowsperstrip > h ? h-row : rowsperstrip); tstrip_t strip = TIFFComputeStrip(tif, row, s); if (TIFFReadEncodedStrip(tif, strip, buf, nrow*scanline) < 0) { @@ -272,17 +272,17 @@ TIFFReadSeparateStripData(TIFF* tif) } static void -ShowTile(uint32 row, uint32 col, tsample_t sample, - unsigned char* pp, uint32 nrow, tsize_t rowsize) +ShowTile(uint32_t row, uint32_t col, tsample_t sample, + unsigned char* pp, uint32_t nrow, tsize_t rowsize) { - uint32 cc; + uint32_t cc; printf("Tile (%lu,%lu", (unsigned long) row, (unsigned long) col); if (sample != (tsample_t) -1) printf(",%u", sample); printf("):\n"); while (nrow-- > 0) { - for (cc = 0; cc < (uint32) rowsize; cc++) { + for (cc = 0; cc < (uint32_t) rowsize; cc++) { printf(" %02x", *pp++); if (((cc+1) % 24) == 0) putchar('\n'); @@ -300,8 +300,8 @@ TIFFReadContigTileData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(tilesize); if (buf) { - uint32 tw=0, th=0, w=0, h=0; - uint32 row, col; + uint32_t tw=0, th=0, w=0, h=0; + uint32_t row, col; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); @@ -335,8 +335,8 @@ TIFFReadSeparateTileData(TIFF* tif) buf = (unsigned char *)_TIFFmalloc(tilesize); if (buf) { - uint32 tw=0, th=0, w=0, h=0; - uint32 row, col; + uint32_t tw=0, th=0, w=0, h=0; + uint32_t row, col; tsample_t s, samplesperpixel=0; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w); @@ -368,7 +368,7 @@ TIFFReadSeparateTileData(TIFF* tif) void TIFFReadData(TIFF* tif) { - uint16 config = PLANARCONFIG_CONTIG; + uint16_t config = PLANARCONFIG_CONTIG; TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &config); if (TIFFIsTiled(tif)) { @@ -385,9 +385,9 @@ TIFFReadData(TIFF* tif) } static void -ShowRawBytes(unsigned char* pp, uint32 n) +ShowRawBytes(unsigned char* pp, uint32_t n) { - uint32 i; + uint32_t i; for (i = 0; i < n; i++) { printf(" %02x", *pp++); @@ -398,9 +398,9 @@ ShowRawBytes(unsigned char* pp, uint32 n) } static void -ShowRawWords(uint16* pp, uint32 n) +ShowRawWords(uint16_t* pp, uint32_t n) { - uint32 i; + uint32_t i; for (i = 0; i < n; i++) { printf(" %04x", *pp++); @@ -415,18 +415,18 @@ TIFFReadRawDataStriped(TIFF* tif, int bitrev) { tstrip_t nstrips = TIFFNumberOfStrips(tif); const char* what = "Strip"; - uint64* stripbc=NULL; + uint64_t* stripbc=NULL; TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &stripbc); if (stripbc != NULL && nstrips > 0) { - uint32 bufsize = (uint32) stripbc[0]; + uint32_t bufsize = (uint32_t) stripbc[0]; tdata_t buf = _TIFFmalloc(bufsize); tstrip_t s; for (s = 0; s < nstrips; s++) { if (stripbc[s] > bufsize) { buf = _TIFFrealloc(buf, (tmsize_t)stripbc[s]); - bufsize = (uint32) stripbc[s]; + bufsize = (uint32_t) stripbc[s]; } if (buf == NULL) { fprintf(stderr, @@ -448,9 +448,9 @@ TIFFReadRawDataStriped(TIFF* tif, int bitrev) printf("%s %lu:\n ", what, (unsigned long) s); if (showwords) - ShowRawWords((uint16*) buf, (uint32) stripbc[s]>>1); + ShowRawWords((uint16_t*) buf, (uint32_t) stripbc[s] >> 1); else - ShowRawBytes((unsigned char*) buf, (uint32) stripbc[s]); + ShowRawBytes((unsigned char*) buf, (uint32_t) stripbc[s]); } } if (buf != NULL) @@ -462,14 +462,14 @@ static void TIFFReadRawDataTiled(TIFF* tif, int bitrev) { const char* what = "Tile"; - uint32 ntiles = TIFFNumberOfTiles(tif); - uint64 *tilebc; + uint32_t ntiles = TIFFNumberOfTiles(tif); + uint64_t *tilebc; TIFFGetField(tif, TIFFTAG_TILEBYTECOUNTS, &tilebc); if (tilebc != NULL && ntiles > 0) { - uint64 bufsize = 0; + uint64_t bufsize = 0; tdata_t buf = NULL; - uint32 t; + uint32_t t; for (t = 0; t < ntiles; t++) { if (buf == NULL || tilebc[t] > bufsize) { @@ -497,9 +497,9 @@ TIFFReadRawDataTiled(TIFF* tif, int bitrev) (unsigned long) t); } if (showwords) { - ShowRawWords((uint16*) buf, (uint32)(tilebc[t]>>1)); + ShowRawWords((uint16_t*) buf, (uint32_t)(tilebc[t] >> 1)); } else { - ShowRawBytes((unsigned char*) buf, (uint32) tilebc[t]); + ShowRawBytes((unsigned char*) buf, (uint32_t) tilebc[t]); } } } @@ -519,14 +519,14 @@ TIFFReadRawData(TIFF* tif, int bitrev) } static void -tiffinfo(TIFF* tif, uint16 order, long flags, int is_image) +tiffinfo(TIFF* tif, uint16_t order, long flags, int is_image) { TIFFPrintDirectory(tif, stdout, flags); if (!readdata || !is_image) return; if (rawdata) { if (order) { - uint16 o; + uint16_t o; TIFFGetFieldDefaulted(tif, TIFFTAG_FILLORDER, &o); TIFFReadRawData(tif, o != order); |