summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2021-01-01 20:14:07 +0000
committerRoger Leigh <rleigh@codelibre.net>2021-01-21 23:14:13 +0000
commit39a74eede0455ec8ee334dcddf71f5354d508d8b (patch)
tree3f6515dfaa192da54d5dd731b9f90d32908b3cd5
parentaf604f119a7b23d0b14dc5940fc84e45616dee69 (diff)
downloadlibtiff-git-39a74eede0455ec8ee334dcddf71f5354d508d8b.tar.gz
Use standard C99 integer types
-rw-r--r--CMakeLists.txt150
-rw-r--r--archive/tools/bmp2tiff.c122
-rw-r--r--archive/tools/gif2tiff.c10
-rw-r--r--archive/tools/ras2tiff.c54
-rw-r--r--archive/tools/rasterfile.h14
-rw-r--r--archive/tools/sgi2tiff.c28
-rw-r--r--archive/tools/sgisv.c36
-rw-r--r--configure.ac290
-rw-r--r--contrib/addtiffo/tif_overview.c104
-rw-r--r--contrib/addtiffo/tif_ovrcache.c6
-rw-r--r--contrib/addtiffo/tif_ovrcache.h28
-rw-r--r--contrib/dbs/tiff-grayscale.c6
-rw-r--r--contrib/dbs/tiff-palette.c8
-rw-r--r--contrib/dbs/tiff-rgb.c4
-rw-r--r--contrib/dbs/xtiff/xtiff.c40
-rw-r--r--contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc20
-rw-r--r--contrib/pds/tif_imageiter.c76
-rw-r--r--contrib/pds/tif_imageiter.h36
-rw-r--r--contrib/pds/tif_pdsdirread.c188
-rw-r--r--contrib/pds/tif_pdsdirwrite.c136
-rw-r--r--contrib/tags/maketif.c2
-rw-r--r--contrib/tags/xtif_dir.c10
-rw-r--r--contrib/tags/xtiffiop.h6
-rw-r--r--contrib/win_dib/Tiffile.cpp66
-rw-r--r--contrib/win_dib/tiff2dib.c12
-rw-r--r--html/addingtags.html2
-rw-r--r--html/internals.html26
-rw-r--r--html/libtiff.html30
-rw-r--r--html/man/TIFFFieldPassCount.3tiff.html4
-rw-r--r--html/man/TIFFFieldReadCount.3tiff.html4
-rw-r--r--html/man/TIFFFieldTag.3tiff.html2
-rw-r--r--html/man/TIFFFieldWriteCount.3tiff.html4
-rw-r--r--html/man/TIFFGetField.3tiff.html98
-rw-r--r--html/man/TIFFRGBAImage.3tiff.html10
-rw-r--r--html/man/TIFFReadRGBAImage.3tiff.html8
-rw-r--r--html/man/TIFFReadRGBAStrip.3tiff.html2
-rw-r--r--html/man/TIFFReadRGBATile.3tiff.html2
-rw-r--r--html/man/TIFFReadScanline.3tiff.html2
-rw-r--r--html/man/TIFFReadTile.3tiff.html4
-rw-r--r--html/man/TIFFSetDirectory.3tiff.html2
-rw-r--r--html/man/TIFFSetField.3tiff.html92
-rw-r--r--html/man/TIFFWriteScanline.3tiff.html2
-rw-r--r--html/man/TIFFWriteTile.3tiff.html4
-rw-r--r--html/man/TIFFcodec.3tiff.html6
-rw-r--r--html/man/TIFFcolor.3tiff.html40
-rw-r--r--html/man/TIFFquery.3tiff.html2
-rw-r--r--html/man/TIFFstrip.3tiff.html8
-rw-r--r--html/man/TIFFswab.3tiff.html8
-rw-r--r--html/man/TIFFtile.3tiff.html12
-rw-r--r--html/man/libtiff.3tiff.html18
-rw-r--r--libtiff/mkg3states.c4
-rw-r--r--libtiff/tif_aux.c102
-rw-r--r--libtiff/tif_close.c4
-rw-r--r--libtiff/tif_codec.c2
-rw-r--r--libtiff/tif_color.c42
-rw-r--r--libtiff/tif_compress.c26
-rw-r--r--libtiff/tif_config.h.cmake.in45
-rw-r--r--libtiff/tif_config.vc.h47
-rw-r--r--libtiff/tif_dir.c444
-rw-r--r--libtiff/tif_dir.h88
-rw-r--r--libtiff/tif_dirinfo.c22
-rw-r--r--libtiff/tif_dirread.c1995
-rw-r--r--libtiff/tif_dirwrite.c980
-rw-r--r--libtiff/tif_dumpmode.c6
-rw-r--r--libtiff/tif_extension.c4
-rw-r--r--libtiff/tif_fax3.c274
-rw-r--r--libtiff/tif_fax3.h14
-rw-r--r--libtiff/tif_getimage.c470
-rw-r--r--libtiff/tif_jbig.c6
-rw-r--r--libtiff/tif_jpeg.c126
-rw-r--r--libtiff/tif_luv.c266
-rw-r--r--libtiff/tif_lzma.c20
-rw-r--r--libtiff/tif_lzw.c46
-rw-r--r--libtiff/tif_next.c14
-rw-r--r--libtiff/tif_ojpeg.c626
-rw-r--r--libtiff/tif_open.c36
-rw-r--r--libtiff/tif_packbits.c52
-rw-r--r--libtiff/tif_pixarlog.c218
-rw-r--r--libtiff/tif_predict.c124
-rw-r--r--libtiff/tif_predict.h2
-rw-r--r--libtiff/tif_print.c64
-rw-r--r--libtiff/tif_read.c212
-rw-r--r--libtiff/tif_stream.cxx68
-rw-r--r--libtiff/tif_strip.c104
-rw-r--r--libtiff/tif_swab.c28
-rw-r--r--libtiff/tif_thunder.c12
-rw-r--r--libtiff/tif_tile.c82
-rw-r--r--libtiff/tif_unix.c18
-rw-r--r--libtiff/tif_webp.c40
-rw-r--r--libtiff/tif_win32.c26
-rw-r--r--libtiff/tif_write.c110
-rw-r--r--libtiff/tif_zip.c56
-rw-r--r--libtiff/tif_zstd.c18
-rw-r--r--libtiff/tiff.h46
-rw-r--r--libtiff/tiffconf.h.cmake.in16
-rw-r--r--libtiff/tiffconf.h.in13
-rw-r--r--libtiff/tiffconf.vc.h38
-rw-r--r--libtiff/tiffio.h254
-rw-r--r--libtiff/tiffiop.h141
-rw-r--r--man/TIFFFieldPassCount.3tiff4
-rw-r--r--man/TIFFFieldReadCount.3tiff4
-rw-r--r--man/TIFFFieldTag.3tiff2
-rw-r--r--man/TIFFFieldWriteCount.3tiff4
-rw-r--r--man/TIFFGetField.3tiff98
-rw-r--r--man/TIFFRGBAImage.3tiff8
-rw-r--r--man/TIFFReadEncodedStrip.3tiff2
-rw-r--r--man/TIFFReadRGBAImage.3tiff4
-rw-r--r--man/TIFFReadRGBAStrip.3tiff2
-rw-r--r--man/TIFFReadRGBATile.3tiff2
-rw-r--r--man/TIFFReadScanline.3tiff2
-rw-r--r--man/TIFFReadTile.3tiff2
-rw-r--r--man/TIFFSetDirectory.3tiff2
-rw-r--r--man/TIFFSetField.3tiff92
-rw-r--r--man/TIFFWriteScanline.3tiff2
-rw-r--r--man/TIFFWriteTile.3tiff2
-rw-r--r--man/TIFFcodec.3tiff6
-rw-r--r--man/TIFFcolor.3tiff34
-rw-r--r--man/TIFFquery.3tiff2
-rw-r--r--man/TIFFstrip.3tiff8
-rw-r--r--man/TIFFswab.3tiff8
-rw-r--r--man/TIFFtile.3tiff8
-rw-r--r--man/libtiff.3tiff20
-rw-r--r--test/check_tag.c12
-rw-r--r--test/custom_dir.c20
-rw-r--r--test/custom_dir_EXIF_231.c22
-rw-r--r--test/long_tag.c10
-rw-r--r--test/rational_precision2double.c22
-rw-r--r--test/raw_decode.c38
-rw-r--r--test/rewrite_tag.c24
-rw-r--r--test/short_tag.c16
-rw-r--r--test/strip.c26
-rw-r--r--test/strip_rw.c18
-rw-r--r--test/testtypes.c19
-rw-r--r--test/tifftest.h6
-rw-r--r--tools/fax2ps.c36
-rw-r--r--tools/fax2tiff.c32
-rw-r--r--tools/pal2rgb.c98
-rw-r--r--tools/ppm2tiff.c43
-rw-r--r--tools/raw2tiff.c66
-rw-r--r--tools/rgb2ycbcr.c52
-rw-r--r--tools/thumbnail.c198
-rw-r--r--tools/tiff2bw.c112
-rw-r--r--tools/tiff2pdf.c418
-rw-r--r--tools/tiff2ps.c146
-rw-r--r--tools/tiff2rgba.c86
-rw-r--r--tools/tiffcmp.c72
-rw-r--r--tools/tiffcp.c352
-rw-r--r--tools/tiffcrop.c1554
-rw-r--r--tools/tiffdither.c20
-rw-r--r--tools/tiffdump.c144
-rw-r--r--tools/tiffgt.c26
-rw-r--r--tools/tiffinfo.c72
-rw-r--r--tools/tiffmedian.c48
-rw-r--r--tools/tiffset.c22
-rw-r--r--tools/tiffsplit.c20
155 files changed, 6467 insertions, 6996 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 10799493..fdb33aa6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,6 +62,7 @@ message(STATUS "Building tiff version ${LIBTIFF_MAJOR_VERSION}.${LIBTIFF_MINOR_V
message(STATUS "libtiff library version ${SO_MAJOR}.${SO_MINOR}.${SO_REVISION}")
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries")
+set(CMAKE_C_STANDARD 99)
# Project version
project(tiff C)
@@ -208,9 +209,7 @@ endif()
check_include_file(assert.h HAVE_ASSERT_H)
check_include_file(fcntl.h HAVE_FCNTL_H)
-check_include_file(inttypes.h TIFF_HAVE_INTTYPES_H)
check_include_file(io.h HAVE_IO_H)
-check_include_file(stdint.h TIFF_HAVE_STDINT_H)
check_include_file(strings.h HAVE_STRINGS_H)
check_include_file(sys/time.h HAVE_SYS_TIME_H)
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
@@ -262,19 +261,9 @@ int main(void){
TM_IN_SYS_TIME)
# Check type sizes
-# NOTE: Could be replaced with C99 <stdint.h>
-check_type_size("signed int" SIZEOF_SIGNED_INT)
-check_type_size("unsigned int" SIZEOF_UNSIGNED_INT)
-check_type_size("signed long" SIZEOF_SIGNED_LONG)
-check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
-check_type_size("signed long long" SIZEOF_SIGNED_LONG_LONG)
-check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
-check_type_size("unsigned char *" SIZEOF_UNSIGNED_CHAR_P)
-
set(CMAKE_EXTRA_INCLUDE_FILES_SAVE ${CMAKE_EXTRA_INCLUDE_FILES})
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} "stddef.h")
check_type_size("size_t" SIZEOF_SIZE_T)
-check_type_size("ptrdiff_t" SIZEOF_PTRDIFF_T)
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES_SAVE})
macro(report_values)
@@ -283,134 +272,29 @@ macro(report_values)
endforeach()
endmacro()
-if (TIFF_HAVE_STDINT_H AND TIFF_HAVE_INTTYPES_H)
- # C99 fixed-size integer types
- set(TIFF_INT8_T "int8_t")
- set(TIFF_UINT8_T "uint8_t")
-
- set(TIFF_INT16_T "int16_t")
- set(TIFF_UINT16_T "uint16_t")
-
- set(TIFF_INT32_T "int32_t")
- set(TIFF_UINT32_T "uint32_t")
- set(TIFF_INT32_FORMAT "PRId32")
- set(TIFF_UINT32_FORMAT "PRIu32")
-
- set(TIFF_INT64_T "int64_t")
- set(TIFF_UINT64_T "uint64_t")
- set(TIFF_INT64_FORMAT "PRId64")
- set(TIFF_UINT64_FORMAT "PRIu64")
-
- set(TIFF_SIZE_T "size_t")
- set(TIFF_SIZE_FORMAT "\"zu\"")
- if(SIZEOF_SIZE_T EQUAL 4)
- set(TIFF_SSIZE_T "int32_t")
- set(TIFF_SSIZE_FORMAT "PRId32")
- elseif(SIZEOF_SIZE_T EQUAL 8)
- set(TIFF_SSIZE_T "int64_t")
- set(TIFF_SSIZE_FORMAT "PRId64")
- else()
- message(FATAL_ERROR "Unsupported size_t size ${SIZEOF_SIZE_T}; please add support")
- endif()
+# C99 fixed-size integer types
+set(TIFF_INT8_T "int8_t")
+set(TIFF_UINT8_T "uint8_t")
- if(NOT SIZEOF_PTRDIFF_T)
- set(TIFF_PTRDIFF_T "${TIFF_SSIZE_T}")
- set(TIFF_PTRDIFF_FORMAT "${SSIZE_FORMAT}")
- else()
- set(TIFF_PTRDIFF_T "ptrdiff_t")
- set(TIFF_PTRDIFF_FORMAT "\"td\"")
- endif()
+set(TIFF_INT16_T "int16_t")
+set(TIFF_UINT16_T "uint16_t")
-else()
- # Fallback to pre-C99 basic types
- set(TIFF_INT8_T "signed char")
- set(TIFF_UINT8_T "unsigned char")
-
- set(TIFF_INT16_T "signed short")
- set(TIFF_UINT16_T "unsigned short")
-
- if(SIZEOF_SIGNED_INT EQUAL 4)
- set(TIFF_INT32_T "signed int")
- set(TIFF_INT32_FORMAT "\"d\"")
- elseif(SIZEOF_SIGNED_LONG EQUAL 4)
- set(TIFF_INT32_T "signed long")
- set(TIFF_INT32_FORMAT "\"ld\"")
- endif()
+set(TIFF_INT32_T "int32_t")
+set(TIFF_UINT32_T "uint32_t")
- if(SIZEOF_UNSIGNED_INT EQUAL 4)
- set(TIFF_UINT32_T "unsigned int")
- set(TIFF_UINT32_FORMAT "\"u\"")
- elseif(SIZEOF_UNSIGNED_LONG EQUAL 4)
- set(TIFF_UINT32_T "unsigned long")
- set(TIFF_UINT32_FORMAT "\"lu\"")
- endif()
+set(TIFF_INT64_T "int64_t")
+set(TIFF_UINT64_T "uint64_t")
- if(SIZEOF_SIGNED_LONG EQUAL 8)
- set(TIFF_INT64_T "signed long")
- set(TIFF_INT64_FORMAT "\"ld\"")
- elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8)
- set(TIFF_INT64_T "signed long long")
- if (MINGW)
- set(TIFF_INT64_FORMAT "\"I64d\"")
- else()
- set(TIFF_INT64_FORMAT "\"lld\"")
- endif()
- endif()
- if(SIZEOF_UNSIGNED_LONG EQUAL 8)
- set(TIFF_UINT64_T "unsigned long")
- set(TIFF_UINT64_FORMAT "\"lu\"")
- elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8)
- set(TIFF_UINT64_T "unsigned long long")
- if (MINGW)
- set(TIFF_UINT64_FORMAT "\"I64u\"")
- else()
- set(TIFF_UINT64_FORMAT "\"llu\"")
- endif()
- endif()
-
- if(SIZEOF_UNSIGNED_INT EQUAL SIZEOF_SIZE_T)
- set(TIFF_SIZE_T "unsigned int")
- set(TIFF_SIZE_FORMAT "\"u\"")
- set(TIFF_SSIZE_T "signed int")
- set(TIFF_SSIZE_FORMAT "\"d\"")
- elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
- set(TIFF_SIZE_T "unsigned long")
- set(TIFF_SIZE_FORMAT "\"lu\"")
- set(TIFF_SSIZE_T "signed long")
- set(TIFF_SSIZE_FORMAT "\"ld\"")
- elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
- set(TIFF_SIZE_T "unsigned long long")
- set(TIFF_SSIZE_T "signed long long")
- if (MINGW)
- set(TIFF_SIZE_FORMAT "\"I64u\"")
- set(TIFF_SSIZE_FORMAT "\"I64d\"")
- else()
- set(TIFF_SIZE_FORMAT "\"llu\"")
- set(TIFF_SSIZE_FORMAT "\"lld\"")
- endif()
- endif()
-
- if(NOT SIZEOF_PTRDIFF_T)
- set(TIFF_PTRDIFF_T "${TIFF_SSIZE_T}")
- set(TIFF_PTRDIFF_FORMAT "${SSIZE_FORMAT}")
- else()
- set(TIFF_PTRDIFF_T "ptrdiff_t")
- set(TIFF_PTRDIFF_FORMAT "\"ld\"")
- endif()
+if(SIZEOF_SIZE_T EQUAL 4)
+ set(TIFF_SSIZE_T "int32_t")
+elseif(SIZEOF_SIZE_T EQUAL 8)
+ set(TIFF_SSIZE_T "int64_t")
+else()
+ message(FATAL_ERROR "Unsupported size_t size ${SIZEOF_SIZE_T}; please add support")
endif()
-report_values(TIFF_INT8_T
- TIFF_UINT8_T
- TIFF_INT16_T
- TIFF_UINT16_T
- TIFF_INT32_T TIFF_INT32_FORMAT
- TIFF_UINT32_T TIFF_UINT32_FORMAT
- TIFF_INT64_T TIFF_INT64_FORMAT
- TIFF_UINT64_T TIFF_UINT64_FORMAT
- TIFF_SIZE_T TIFF_SIZE_FORMAT
- TIFF_SSIZE_T TIFF_SSIZE_FORMAT
- TIFF_PTRDIFF_T TIFF_PTRDIFF_FORMAT)
+report_values(TIFF_SSIZE_T)
check_symbol_exists(mmap "sys/mman.h" HAVE_MMAP)
check_symbol_exists(setmode "unistd.h" HAVE_SETMODE)
diff --git a/archive/tools/bmp2tiff.c b/archive/tools/bmp2tiff.c
index 704244b7..6779bb05 100644
--- a/archive/tools/bmp2tiff.c
+++ b/archive/tools/bmp2tiff.c
@@ -117,9 +117,9 @@ enum BMPLCSType /* Type of logical color space. */
typedef struct
{
- int32 iCIEX;
- int32 iCIEY;
- int32 iCIEZ;
+ int32_t iCIEX;
+ int32_t iCIEY;
+ int32_t iCIEZ;
} BMPCIEXYZ;
typedef struct /* This structure contains the x, y, and z */
@@ -133,13 +133,13 @@ typedef struct /* This structure contains the x, y, and z */
typedef struct
{
char bType[2]; /* Signature "BM" */
- uint32 iSize; /* Size in bytes of the bitmap file. Should
+ uint32_t iSize; /* Size in bytes of the bitmap file. Should
* always be ignored while reading because
* of error in Windows 3.0 SDK's description
* of this field */
- uint16 iReserved1; /* Reserved, set as 0 */
- uint16 iReserved2; /* Reserved, set as 0 */
- uint32 iOffBits; /* Offset of the image from file start in bytes */
+ uint16_t iReserved1; /* Reserved, set as 0 */
+ uint16_t iReserved2; /* Reserved, set as 0 */
+ uint32_t iOffBits; /* Offset of the image from file start in bytes */
} BMPFileHeader;
/* File header size in bytes: */
@@ -147,29 +147,29 @@ const int BFH_SIZE = 14;
typedef struct
{
- uint32 iSize; /* Size of BMPInfoHeader structure in bytes.
+ uint32_t iSize; /* Size of BMPInfoHeader structure in bytes.
* Should be used to determine start of the
* colour table */
- int32 iWidth; /* Image width */
- int32 iHeight; /* Image height. If positive, image has bottom
+ int32_t iWidth; /* Image width */
+ int32_t iHeight; /* Image height. If positive, image has bottom
* left origin, if negative --- top left. */
- int16 iPlanes; /* Number of image planes (must be set to 1) */
- int16 iBitCount; /* Number of bits per pixel (1, 4, 8, 16, 24
+ int16_t iPlanes; /* Number of image planes (must be set to 1) */
+ int16_t iBitCount; /* Number of bits per pixel (1, 4, 8, 16, 24
* or 32). If 0 then the number of bits per
* pixel is specified or is implied by the
* JPEG or PNG format. */
- uint32 iCompression; /* Compression method */
- uint32 iSizeImage; /* Size of uncomressed image in bytes. May
+ uint32_t iCompression; /* Compression method */
+ uint32_t iSizeImage; /* Size of uncomressed image in bytes. May
* be 0 for BMPC_RGB bitmaps. If iCompression
* is BI_JPEG or BI_PNG, iSizeImage indicates
* the size of the JPEG or PNG image buffer. */
- int32 iXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */
- int32 iYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */
- uint32 iClrUsed; /* Size of colour table. If 0, iBitCount should
+ int32_t iXPelsPerMeter; /* X resolution, pixels per meter (0 if not used) */
+ int32_t iYPelsPerMeter; /* Y resolution, pixels per meter (0 if not used) */
+ uint32_t iClrUsed; /* Size of colour table. If 0, iBitCount should
* be used to calculate this value
* (1<<iBitCount). This value should be
* unsigned for proper shifting. */
- int32 iClrImportant; /* Number of important colours. If 0, all
+ int32_t iClrImportant; /* Number of important colours. If 0, all
* colours are required */
/*
@@ -177,23 +177,23 @@ typedef struct
* and earlier. Windows 98/Me, Windows 2000/XP introduces additional fields:
*/
- int32 iRedMask; /* Colour mask that specifies the red component
+ int32_t iRedMask; /* Colour mask that specifies the red component
* of each pixel, valid only if iCompression
* is set to BI_BITFIELDS. */
- int32 iGreenMask; /* The same for green component */
- int32 iBlueMask; /* The same for blue component */
- int32 iAlphaMask; /* Colour mask that specifies the alpha
+ int32_t iGreenMask; /* The same for green component */
+ int32_t iBlueMask; /* The same for blue component */
+ int32_t iAlphaMask; /* Colour mask that specifies the alpha
* component of each pixel. */
- uint32 iCSType; /* Colour space of the DIB. */
+ uint32_t iCSType; /* Colour space of the DIB. */
BMPCIEXYZTriple sEndpoints; /* This member is ignored unless the iCSType
* member specifies BMPLT_CALIBRATED_RGB. */
- int32 iGammaRed; /* Toned response curve for red. This member
+ int32_t iGammaRed; /* Toned response curve for red. This member
* is ignored unless color values are
* calibrated RGB values and iCSType is set to
* BMPLT_CALIBRATED_RGB. Specified
* in 16^16 format. */
- int32 iGammaGreen; /* Toned response curve for green. */
- int32 iGammaBlue; /* Toned response curve for blue. */
+ int32_t iGammaGreen; /* Toned response curve for green. */
+ int32_t iGammaBlue; /* Toned response curve for blue. */
} BMPInfoHeader;
/*
@@ -216,23 +216,23 @@ typedef struct
char bReserved; /* Must be 0 */
} BMPColorEntry;
-static uint16 compression = (uint16) -1;
+static uint16_t compression = (uint16_t) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
-static uint16 predictor = 0;
+static uint16_t predictor = 0;
static void usage(void);
static int processCompressOptions(char*);
-static void rearrangePixels(char *, uint32, uint32);
+static void rearrangePixels(char *, uint32_t, uint32_t);
int
main(int argc, char* argv[])
{
- uint32 width, length;
- uint16 nbands = 1; /* number of bands in input image */
- uint16 depth = 8; /* bits per pixel in input image */
- uint32 rowsperstrip = (uint32) -1;
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
+ uint32_t width, length;
+ uint16_t nbands = 1; /* number of bands in input image */
+ uint16_t depth = 8; /* bits per pixel in input image */
+ uint32_t rowsperstrip = (uint32_t) -1;
+ uint16_t photometric = PHOTOMETRIC_MINISBLACK;
int fd = 0;
_TIFF_stat_s instat;
char *outfilename = NULL, *infilename = NULL;
@@ -241,10 +241,10 @@ main(int argc, char* argv[])
BMPFileHeader file_hdr;
BMPInfoHeader info_hdr;
int bmp_type;
- uint32 clr_tbl_size, n_clr_elems = 3;
+ uint32_t clr_tbl_size, n_clr_elems = 3;
unsigned char *clr_tbl;
unsigned short *red_tbl = NULL, *green_tbl = NULL, *blue_tbl = NULL;
- uint32 row, clr;
+ uint32_t row, clr;
int c;
#if !HAVE_DECL_OPTARG
@@ -370,16 +370,16 @@ main(int argc, char* argv[])
goto bad;
}
#ifdef WORDS_BIGENDIAN
- TIFFSwabLong((uint32*) &info_hdr.iWidth);
- TIFFSwabLong((uint32*) &info_hdr.iHeight);
- TIFFSwabShort((uint16*) &info_hdr.iPlanes);
- TIFFSwabShort((uint16*) &info_hdr.iBitCount);
- TIFFSwabLong((uint32*) &info_hdr.iCompression);
- TIFFSwabLong((uint32*) &info_hdr.iSizeImage);
- TIFFSwabLong((uint32*) &info_hdr.iXPelsPerMeter);
- TIFFSwabLong((uint32*) &info_hdr.iYPelsPerMeter);
- TIFFSwabLong((uint32*) &info_hdr.iClrUsed);
- TIFFSwabLong((uint32*) &info_hdr.iClrImportant);
+ TIFFSwabLong((uint32_t*) &info_hdr.iWidth);
+ TIFFSwabLong((uint32_t*) &info_hdr.iHeight);
+ TIFFSwabShort((uint16_t*) &info_hdr.iPlanes);
+ TIFFSwabShort((uint16_t*) &info_hdr.iBitCount);
+ TIFFSwabLong((uint32_t*) &info_hdr.iCompression);
+ TIFFSwabLong((uint32_t*) &info_hdr.iSizeImage);
+ TIFFSwabLong((uint32_t*) &info_hdr.iXPelsPerMeter);
+ TIFFSwabLong((uint32_t*) &info_hdr.iYPelsPerMeter);
+ TIFFSwabLong((uint32_t*) &info_hdr.iClrUsed);
+ TIFFSwabLong((uint32_t*) &info_hdr.iClrImportant);
#endif
n_clr_elems = 4;
}
@@ -393,7 +393,7 @@ main(int argc, char* argv[])
}
if (bmp_type == BMPT_OS21) {
- int16 iShort;
+ int16_t iShort;
if ( read(fd, &iShort, 2) != 2 ) {
TIFFError(infilename, "Failed to read from file (%s)",
@@ -401,7 +401,7 @@ main(int argc, char* argv[])
goto bad;
}
#ifdef WORDS_BIGENDIAN
- TIFFSwabShort((uint16*) &iShort);
+ TIFFSwabShort((uint16_t*) &iShort);
#endif
info_hdr.iWidth = iShort;
if ( read(fd, &iShort, 2) != 2 ) {
@@ -410,7 +410,7 @@ main(int argc, char* argv[])
goto bad;
}
#ifdef WORDS_BIGENDIAN
- TIFFSwabShort((uint16*) &iShort);
+ TIFFSwabShort((uint16_t*) &iShort);
#endif
info_hdr.iHeight = iShort;
if (read(fd, &iShort, 2) != 2 ) {
@@ -419,7 +419,7 @@ main(int argc, char* argv[])
goto bad;
}
#ifdef WORDS_BIGENDIAN
- TIFFSwabShort((uint16*) &iShort);
+ TIFFSwabShort((uint16_t*) &iShort);
#endif
info_hdr.iPlanes = iShort;
if ( read(fd, &iShort, 2) != 2 ) {
@@ -428,7 +428,7 @@ main(int argc, char* argv[])
goto bad;
}
#ifdef WORDS_BIGENDIAN
- TIFFSwabShort((uint16*) &iShort);
+ TIFFSwabShort((uint16_t*) &iShort);
#endif
info_hdr.iBitCount = iShort;
info_hdr.iCompression = BMPC_RGB;
@@ -466,8 +466,8 @@ main(int argc, char* argv[])
/* Allocate memory for colour table and read it. */
if (info_hdr.iClrUsed)
clr_tbl_size =
- ((uint32)(1<<depth)<info_hdr.iClrUsed)
- ? (uint32) (1 << depth)
+ ((uint32_t)(1<<depth)<info_hdr.iClrUsed)
+ ? (uint32_t) (1 << depth)
: info_hdr.iClrUsed;
else
clr_tbl_size = 1 << depth;
@@ -557,7 +557,7 @@ main(int argc, char* argv[])
red_tbl, green_tbl, blue_tbl);
}
- if (compression == (uint16) -1)
+ if (compression == (uint16_t) -1)
compression = COMPRESSION_PACKBITS;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
switch (compression) {
@@ -580,7 +580,7 @@ main(int argc, char* argv[])
/* -------------------------------------------------------------------- */
if (info_hdr.iCompression == BMPC_RGB) {
- uint32 offset, size;
+ uint32_t offset, size;
char *scanbuf;
/* XXX: Avoid integer overflow. We can calculate size
@@ -645,8 +645,8 @@ main(int argc, char* argv[])
} else if ( info_hdr.iCompression == BMPC_RLE8
|| info_hdr.iCompression == BMPC_RLE4 ) {
- uint32 i, j, k, runlength;
- uint32 compr_size, uncompr_size;
+ uint32_t i, j, k, runlength;
+ uint32_t compr_size, uncompr_size;
unsigned char *comprbuf;
unsigned char *uncomprbuf;
@@ -660,9 +660,9 @@ main(int argc, char* argv[])
return -1;
}
if ( (compr_size == 0) ||
- (compr_size > ((uint32) ~0) >> 1) ||
+ (compr_size > ((uint32_t) ~0) >> 1) ||
(uncompr_size == 0) ||
- (uncompr_size > ((uint32) ~0) >> 1) ) {
+ (uncompr_size > ((uint32_t) ~0) >> 1) ) {
TIFFError(infilename,
"Invalid dimensions of BMP file" );
close(fd);
@@ -819,10 +819,10 @@ main(int argc, char* argv[])
* pixels to RGB (RGBA) format.
*/
static void
-rearrangePixels(char *buf, uint32 width, uint32 bit_count)
+rearrangePixels(char *buf, uint32_t width, uint32_t bit_count)
{
char tmp;
- uint32 i;
+ uint32_t i;
switch(bit_count) {
case 16: /* FIXME: need a sample file */
diff --git a/archive/tools/gif2tiff.c b/archive/tools/gif2tiff.c
index 394d0794..20392f50 100644
--- a/archive/tools/gif2tiff.c
+++ b/archive/tools/gif2tiff.c
@@ -117,9 +117,9 @@ unsigned short green[COLSIZE];
unsigned short blue[COLSIZE];
char *filename, *imagename;
-static uint16 compression = COMPRESSION_PACKBITS;
-static uint16 predictor = 0;
-static uint32 rowsperstrip = (uint32) -1;
+static uint16_t compression = COMPRESSION_PACKBITS;
+static uint16_t predictor = 0;
+static uint32_t rowsperstrip = (uint32_t) -1;
static int processCompressOptions(char*);
int convert(void);
@@ -545,8 +545,8 @@ rasterize(int interleaved, char* mode)
TIFFError(imagename,"Can not open output image");
exit(-1);
}
- TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) width);
- TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) height);
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t) width);
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t) height);
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE);
TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL, 1);
diff --git a/archive/tools/ras2tiff.c b/archive/tools/ras2tiff.c
index ff116c61..96fe74bd 100644
--- a/archive/tools/ras2tiff.c
+++ b/archive/tools/ras2tiff.c
@@ -47,10 +47,10 @@
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
-static uint16 compression = (uint16) -1;
+static uint16_t compression = (uint16_t) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
-static uint16 predictor = 0;
+static uint16_t predictor = 0;
static void usage(void);
static int processCompressOptions(char*);
@@ -64,9 +64,9 @@ main(int argc, char* argv[])
TIFF *out;
FILE *in;
struct rasterfile h;
- uint16 photometric;
- uint16 config = PLANARCONFIG_CONTIG;
- uint32 rowsperstrip = (uint32) -1;
+ uint16_t photometric;
+ uint16_t config = PLANARCONFIG_CONTIG;
+ uint32_t rowsperstrip = (uint32_t) -1;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
@@ -100,23 +100,23 @@ main(int argc, char* argv[])
}
if (strcmp(h.ras_magic, RAS_MAGIC) == 0) {
#ifndef WORDS_BIGENDIAN
- TIFFSwabLong((uint32 *)&h.ras_width);
- TIFFSwabLong((uint32 *)&h.ras_height);
- TIFFSwabLong((uint32 *)&h.ras_depth);
- TIFFSwabLong((uint32 *)&h.ras_length);
- TIFFSwabLong((uint32 *)&h.ras_type);
- TIFFSwabLong((uint32 *)&h.ras_maptype);
- TIFFSwabLong((uint32 *)&h.ras_maplength);
+ TIFFSwabLong((uint32_t *)&h.ras_width);
+ TIFFSwabLong((uint32_t *)&h.ras_height);
+ TIFFSwabLong((uint32_t *)&h.ras_depth);
+ TIFFSwabLong((uint32_t *)&h.ras_length);
+ TIFFSwabLong((uint32_t *)&h.ras_type);
+ TIFFSwabLong((uint32_t *)&h.ras_maptype);
+ TIFFSwabLong((uint32_t *)&h.ras_maplength);
#endif
} else if (strcmp(h.ras_magic, RAS_MAGIC_INV) == 0) {
#ifdef WORDS_BIGENDIAN
- TIFFSwabLong((uint32 *)&h.ras_width);
- TIFFSwabLong((uint32 *)&h.ras_height);
- TIFFSwabLong((uint32 *)&h.ras_depth);
- TIFFSwabLong((uint32 *)&h.ras_length);
- TIFFSwabLong((uint32 *)&h.ras_type);
- TIFFSwabLong((uint32 *)&h.ras_maptype);
- TIFFSwabLong((uint32 *)&h.ras_maplength);
+ TIFFSwabLong((uint32_t *)&h.ras_width);
+ TIFFSwabLong((uint32_t *)&h.ras_height);
+ TIFFSwabLong((uint32_t *)&h.ras_depth);
+ TIFFSwabLong((uint32_t *)&h.ras_length);
+ TIFFSwabLong((uint32_t *)&h.ras_type);
+ TIFFSwabLong((uint32_t *)&h.ras_maptype);
+ TIFFSwabLong((uint32_t *)&h.ras_maplength);
#endif
} else {
fprintf(stderr, "%s: Not a rasterfile.\n", argv[optind]);
@@ -148,15 +148,15 @@ main(int argc, char* argv[])
fclose(in);
return (-4);
}
- TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) h.ras_width);
- TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h.ras_height);
+ TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t) h.ras_width);
+ TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t) h.ras_height);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, h.ras_depth > 8 ? 3 : 1);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, h.ras_depth > 1 ? 8 : 1);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (h.ras_maptype != RMT_NONE) {
- uint16* red;
- register uint16* map;
+ uint16_t* red;
+ register uint16_t* map;
register int i, j;
int mapsize;
@@ -177,7 +177,7 @@ main(int argc, char* argv[])
argv[optind], h.ras_maplength, mapsize*3);
return (-7);
}
- red = (uint16*)_TIFFmalloc(mapsize * 3 * sizeof (uint16));
+ red = (uint16_t*)_TIFFmalloc(mapsize * 3 * sizeof (uint16_t));
if (red == NULL) {
fprintf(stderr, "No space for colormap.\n");
return (-8);
@@ -189,21 +189,21 @@ main(int argc, char* argv[])
*map++ = SCALE(*buf++);
if ((i = h.ras_maplength/3) < mapsize) {
i = mapsize - i;
- _TIFFmemset(map, 0, i*sizeof (uint16));
+ _TIFFmemset(map, 0, i*sizeof (uint16_t));
map += i;
}
}
TIFFSetField(out, TIFFTAG_COLORMAP,
red, red + mapsize, red + 2*mapsize);
photometric = PHOTOMETRIC_PALETTE;
- if (compression == (uint16) -1)
+ if (compression == (uint16_t) -1)
compression = COMPRESSION_PACKBITS;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
} else {
/* XXX this is bogus... */
photometric = h.ras_depth == 24 ?
PHOTOMETRIC_RGB : PHOTOMETRIC_MINISBLACK;
- if (compression == (uint16) -1)
+ if (compression == (uint16_t) -1)
compression = COMPRESSION_LZW;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
}
diff --git a/archive/tools/rasterfile.h b/archive/tools/rasterfile.h
index e7d9680b..0572ec84 100644
--- a/archive/tools/rasterfile.h
+++ b/archive/tools/rasterfile.h
@@ -5,13 +5,13 @@
*/
struct rasterfile {
char ras_magic[4]; /* magic number */
- int32 ras_width; /* width (pixels) of image */
- int32 ras_height; /* height (pixels) of image */
- int32 ras_depth; /* depth (1, 8, or 24 bits) of pixel */
- int32 ras_length; /* length (bytes) of image */
- int32 ras_type; /* type of file; see RT_* below */
- int32 ras_maptype; /* type of colormap; see RMT_* below */
- int32 ras_maplength; /* length (bytes) of following map */
+ int32_t ras_width; /* width (pixels) of image */
+ int32_t ras_height; /* height (pixels) of image */
+ int32_t ras_depth; /* depth (1, 8, or 24 bits) of pixel */
+ int32_t ras_length; /* length (bytes) of image */
+ int32_t ras_type; /* type of file; see RT_* below */
+ int32_t ras_maptype; /* type of colormap; see RMT_* below */
+ int32_t ras_maplength; /* length (bytes) of following map */
/* color map follows for ras_maplength bytes, followed by image */
};
#define RAS_MAGIC "\x59\xa6\x6a\x95"
diff --git a/archive/tools/sgi2tiff.c b/archive/tools/sgi2tiff.c
index 36ee0cf0..66a10a7c 100644
--- a/archive/tools/sgi2tiff.c
+++ b/archive/tools/sgi2tiff.c
@@ -34,13 +34,13 @@
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
static short config = PLANARCONFIG_CONTIG;
-static uint16 compression = COMPRESSION_PACKBITS;
-static uint16 predictor = 0;
-static uint16 fillorder = 0;
-static uint32 rowsperstrip = (uint32) -1;
+static uint16_t compression = COMPRESSION_PACKBITS;
+static uint16_t predictor = 0;
+static uint16_t fillorder = 0;
+static uint32_t rowsperstrip = (uint32_t) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
-static uint16 photometric;
+static uint16_t photometric;
static void usage(void);
static int cpContig(IMAGE*, TIFF*);
@@ -100,8 +100,8 @@ main(int argc, char* argv[])
out = TIFFOpen(argv[optind+1], "w");
if (out == NULL)
return (-2);
- TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) in->xsize);
- TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) in->ysize);
+ TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t) in->xsize);
+ TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t) in->ysize);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
if (in->zsize == 1)
@@ -127,12 +127,12 @@ main(int argc, char* argv[])
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, in->zsize);
if (in->zsize > 3) {
- uint16 v[1];
+ uint16_t v[1];
v[0] = EXTRASAMPLE_UNASSALPHA;
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, v);
}
- TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16) in->min);
- TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16) in->max);
+ TIFFSetField(out, TIFFTAG_MINSAMPLEVALUE, (uint16_t) in->min);
+ TIFFSetField(out, TIFFTAG_MAXSAMPLEVALUE, (uint16_t) in->max);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
if (config != PLANARCONFIG_SEPARATE)
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
@@ -201,7 +201,7 @@ cpContig(IMAGE* in, TIFF* out)
g = r + in->xsize;
b = g + in->xsize;
for (y = in->ysize-1; y >= 0; y--) {
- uint8* pp = (uint8*) buf;
+ uint8_t* pp = (uint8_t*) buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
@@ -223,7 +223,7 @@ cpContig(IMAGE* in, TIFF* out)
b = g + in->xsize;
a = b + in->xsize;
for (y = in->ysize-1; y >= 0; y--) {
- uint8* pp = (uint8*) buf;
+ uint8_t* pp = (uint8_t*) buf;
getrow(in, r, y, 0);
getrow(in, g, y, 1);
@@ -240,7 +240,7 @@ cpContig(IMAGE* in, TIFF* out)
goto bad;
}
} else {
- uint8* pp = (uint8*) buf;
+ uint8_t* pp = (uint8_t*) buf;
r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
for (y = in->ysize-1; y >= 0; y--) {
@@ -267,7 +267,7 @@ cpSeparate(IMAGE* in, TIFF* out)
{
tdata_t buf = _TIFFmalloc(TIFFScanlineSize(out));
short *r = (short *)_TIFFmalloc(in->xsize * sizeof (short));
- uint8* pp = (uint8*) buf;
+ uint8_t* pp = (uint8_t*) buf;
int x, y, z;
for (z = 0; z < in->zsize; z++) {
diff --git a/archive/tools/sgisv.c b/archive/tools/sgisv.c
index 42818bba..10ce2e60 100644
--- a/archive/tools/sgisv.c
+++ b/archive/tools/sgisv.c
@@ -32,18 +32,18 @@
#include "tiffio.h"
typedef unsigned char unsigned char;
-typedef unsigned long uint32;
+typedef unsigned long uint32_t;
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
-uint32 rowsperstrip = (uint32) -1;
-uint16 compression = COMPRESSION_PACKBITS;
-uint16 config = PLANARCONFIG_CONTIG;
-uint16 predictor = 0;
+uint32_t rowsperstrip = (uint32_t) -1;
+uint16_t compression = COMPRESSION_PACKBITS;
+uint16_t config = PLANARCONFIG_CONTIG;
+uint16_t predictor = 0;
int xmaxscreen;
int ymaxscreen;
-uint16 photometric = PHOTOMETRIC_RGB;
+uint16_t photometric = PHOTOMETRIC_RGB;
int jpegcolormode = JPEGCOLORMODE_RGB;
int quality = 75; /* JPEG quality */
@@ -151,7 +151,7 @@ usage(void)
}
static void
-svRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)
+svRGBSeparate(TIFF* tif, uint32_t* ss, int xsize, int ysize)
{
tsize_t stripsize = TIFFStripSize(tif);
unsigned char *rbuf = (unsigned char *)_TIFFmalloc(3*stripsize);
@@ -162,7 +162,7 @@ svRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)
for (y = 0; y <= ysize; y += rowsperstrip) {
unsigned char *rp, *gp, *bp;
register int x;
- register uint32 n;
+ register uint32_t n;
n = rowsperstrip;
if (n > ysize-y+1)
@@ -170,7 +170,7 @@ svRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)
rp = rbuf; gp = gbuf; bp = bbuf;
do {
for (x = 0; x <= xsize; x++) {
- uint32 v = ss[x];
+ uint32_t v = ss[x];
rp[x] = v;
gp[x] = v >> 8;
bp[x] = v >> 16;
@@ -192,7 +192,7 @@ svRGBSeparate(TIFF* tif, uint32* ss, int xsize, int ysize)
}
static void
-svRGBContig(TIFF* tif, uint32* ss, int xsize, int ysize)
+svRGBContig(TIFF* tif, uint32_t* ss, int xsize, int ysize)
{
register int x, y;
tsize_t stripsize = TIFFStripSize(tif);
@@ -200,14 +200,14 @@ svRGBContig(TIFF* tif, uint32* ss, int xsize, int ysize)
for (y = 0; y <= ysize; y += rowsperstrip) {
register unsigned char *pp = strip;
- register uint32 n;
+ register uint32_t n;
n = rowsperstrip;
if (n > ysize-y+1)
n = ysize-y+1;
do {
for (x = 0; x <= xsize; x++) {
- uint32 v = ss[x];
+ uint32_t v = ss[x];
pp[0] = v;
pp[1] = v >> 8;
pp[2] = v >> 16;
@@ -231,7 +231,7 @@ svRGBContig(TIFF* tif, uint32* ss, int xsize, int ysize)
#define BLUE CVT(11) /* 11% */
static void
-svGrey(TIFF* tif, uint32* ss, int xsize, int ysize)
+svGrey(TIFF* tif, uint32_t* ss, int xsize, int ysize)
{
register int x, y;
unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(tif));
@@ -241,7 +241,7 @@ svGrey(TIFF* tif, uint32* ss, int xsize, int ysize)
unsigned char *cp = (unsigned char *)&ss[x];
buf[x] = (RED*cp[3] + GREEN*cp[2] + BLUE*cp[1]) >> 8;
}
- if (TIFFWriteScanline(tif, buf, (uint32) y, 0) < 0)
+ if (TIFFWriteScanline(tif, buf, (uint32_t) y, 0) < 0)
break;
ss += xsize+1;
}
@@ -257,7 +257,7 @@ tiffsv(char* name, int x1, int x2, int y1, int y2)
TIFF *tif;
int xsize, ysize;
int xorg, yorg;
- uint32 *scrbuf;
+ uint32_t *scrbuf;
xorg = MIN(x1,x2);
yorg = MIN(y1,y2);
@@ -272,8 +272,8 @@ tiffsv(char* name, int x1, int x2, int y1, int y2)
if (yorg+ysize > ymaxscreen)
ysize = ymaxscreen-yorg;
tif = TIFFOpen(name, "w");
- TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32) (xsize+1));
- TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32) (ysize+1));
+ TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, (uint32_t) (xsize+1));
+ TIFFSetField(tif, TIFFTAG_IMAGELENGTH, (uint32_t) (ysize+1));
TIFFSetField(tif, TIFFTAG_BITSPERSAMPLE, 8);
TIFFSetField(tif, TIFFTAG_SAMPLESPERPIXEL,
photometric == PHOTOMETRIC_RGB ? 3 : 1);
@@ -295,7 +295,7 @@ tiffsv(char* name, int x1, int x2, int y1, int y2)
TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_BOTLEFT);
rowsperstrip = TIFFDefaultStripSize(tif, rowsperstrip);
TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
- scrbuf = (uint32 *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (uint32));
+ scrbuf = (uint32_t *)_TIFFmalloc((xsize+1)*(ysize+1)*sizeof (uint32_t));
readdisplay(xorg, yorg, xorg+xsize, yorg+ysize, scrbuf, RD_FREEZE);
if (photometric == PHOTOMETRIC_RGB) {
if (config == PLANARCONFIG_SEPARATE)
diff --git a/configure.ac b/configure.ac
index 794b887d..d2033740 100644
--- a/configure.ac
+++ b/configure.ac
@@ -103,7 +103,7 @@ AC_SUBST(LIBTIFF_VERSION_INFO)
AC_SUBST(LIBTIFF_RELEASE_DATE)
dnl Checks for programs.
-AC_PROG_CC
+AC_PROG_CC_C99
AM_PROG_CC_C_O
dnl We want warnings. As many warnings as possible.
@@ -174,13 +174,7 @@ case "${host_os}" in
esac
dnl Checks for header files.
-AC_CHECK_HEADERS([assert.h fcntl.h inttypes.h io.h search.h stdint.h unistd.h])
-
-AC_CHECK_HEADER([inttypes.h], [TIFF_HAVE_INTTYPES_H=1], [TIFF_HAVE_INTTYPES_H=0])
-AC_CHECK_HEADER([stdint.h], [TIFF_HAVE_STDINT_H=1], [TIFF_HAVE_STDINT_H=0])
-
-AC_DEFINE_UNQUOTED([TIFF_HAVE_INTTYPES_H], [$TIFF_HAVE_INTTYPES_H], [Define to 1 if you have the <inttypes.h> header file.])
-AC_DEFINE_UNQUOTED([TIFF_HAVE_STDINT_H], [$TIFF_HAVE_STDINT_H], [Define to 1 if you have the <stdint.h> header file.])
+AC_CHECK_HEADERS([assert.h fcntl.h io.h search.h unistd.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
@@ -202,282 +196,40 @@ dnl ---------------------------------------------------------------------------
dnl Compute sized types for current CPU and compiler options
dnl ---------------------------------------------------------------------------
-# Obtain size of an 'signed int' and define as SIZEOF_SIGNED_INT
-AC_CHECK_SIZEOF(signed int)
-
-# Obtain size of an 'unsigned int' and define as SIZEOF_UNSIGNED_INT
-AC_CHECK_SIZEOF(unsigned int)
-
-# Obtain size of a 'signed long' and define as SIZEOF_SIGNED_LONG
-AC_CHECK_SIZEOF(signed long)
-
-# Obtain size of a 'unsigned long' and define as SIZEOF_UNSIGNED_LONG
-AC_CHECK_SIZEOF(unsigned long)
-
-# Obtain size of a 'long long' and define as SIZEOF_SIGNED_LONG_LONG.
-# If 'long long' is not supported then the value defined is zero.
-AC_CHECK_SIZEOF(signed long long)
-
-# Obtain size of a 'unsigned long long' and define as
-# SIZEOF_UNSIGNED_LONG_LONG. If 'unsigned long long' is not
-# supported then the value defined is zero.
-AC_CHECK_SIZEOF(unsigned long long)
-
-# Obtain the size of an 'unsigned char *' and define as
-# SIZEOF_UNSIGNED_CHAR_P. Result is available in
-# ac_cv_sizeof_unsigned_char_p.
-AC_CHECK_SIZEOF(unsigned char *)
-
# Obtain the size of 'size_t' and define as SIZEOF_SIZE_T. Result is
# available in ac_cv_sizeof_size_t
AC_CHECK_SIZEOF([size_t])
-# Check if ptrdiff_t type exists.
-AC_CHECK_TYPE(ptrdiff_t,[PTRDIFF_T=ptrdiff_t])
-if test $TIFF_HAVE_INTTYPES_H -eq 1 -a $TIFF_HAVE_STDINT_H -eq 1
-then
- # C99 fixed-size integer types
- INT8_T='int8_t'
- UINT8_T='uint8_t'
-
- INT16_T='int16_t'
- UINT16_T='uint16_t'
-
- INT32_T='int32_t'
- UINT32_T='uint32_t'
- INT32_FORMAT='PRId32'
- UINT32_FORMAT='PRIu32'
-
- INT64_T='int64_t'
- UINT64_T='uint64_t'
- INT64_FORMAT='PRId64'
- UINT64_FORMAT='PRIu64'
-
- SIZE_T='size_t'
- SIZE_FORMAT='"zu"'
- if test $ac_cv_sizeof_size_t -eq 4
- then
- SSIZE_T='int32_t'
- SSIZE_FORMAT='PRId32'
- elif test $ac_cv_sizeof_size_t -eq 8
- then
- SSIZE_T='int64_t'
- SSIZE_FORMAT='PRId64'
- else
- AC_MSG_ERROR([Unsupported size_t size ${ac_cv_sizeof_size_t}; please add support])
- fi
+# C99 fixed-size integer types
+INT8_T='int8_t'
+UINT8_T='uint8_t'
- PTRDIFF_FORMAT='"td"'
-else
- # Fallback to pre-C99 basic types
- INT8_T='signed char'
- UINT8_T='unsigned char'
-
- INT16_T='signed short'
- UINT16_T='unsigned short'
-
- INT32_T='none'
- INT32_FORMAT='none'
- if test $ac_cv_sizeof_signed_int -eq 4
- then
- INT32_T='signed int'
- INT32_FORMAT='"d"'
- elif test $ac_cv_sizeof_signed_long -eq 4
- then
- INT32_T='signed long'
- INT32_FORMAT='"ld"'
- fi
+INT16_T='int16_t'
+UINT16_T='uint16_t'
- UINT32_T='none'
- UINT32_FORMAT='none'
- if test $ac_cv_sizeof_unsigned_int -eq 4
- then
- UINT32_T='unsigned int'
- UINT32_FORMAT='"u"'
- elif test $ac_cv_sizeof_unsigned_long -eq 4
- then
- UINT32_T='unsigned long'
- UINT32_FORMAT='"lu"'
- fi
+INT32_T='int32_t'
+UINT32_T='uint32_t'
- INT64_T='none'
- INT64_FORMAT='none'
- if test $ac_cv_sizeof_signed_long -eq 8
- then
- INT64_T='signed long'
- INT64_FORMAT='"ld"'
- elif test $ac_cv_sizeof_signed_long_long -eq 8
- then
- INT64_T='signed long long'
- case "${host_os}" in
- mingw32*)
- # MinGW32 understands 'long long', but uses printf from WIN32 CRT
- INT64_FORMAT='"I64d"'
- ;;
- *)
- INT64_FORMAT='"lld"'
- ;;
- esac
- fi
-
- UINT64_T='none'
- UINT64_FORMAT='none'
- if test $ac_cv_sizeof_unsigned_long -eq 8
- then
- UINT64_T='unsigned long'
- UINT64_FORMAT='"lu"'
- elif test $ac_cv_sizeof_unsigned_long_long -eq 8
- then
- UINT64_T='unsigned long long'
- case "${host_os}" in
- mingw32*)
- # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
- UINT64_FORMAT='"I64u"'
- ;;
- *)
- UINT64_FORMAT='"llu"'
- ;;
- esac
- fi
+INT64_T='int64_t'
+UINT64_T='uint64_t'
- # Determine formatting specifier for 'size_t'. While the size should
- # be precise, the type determined may not match the system definition.
- # A named type is provided to allow casting to the type we determined
- # without changing the actual size.
- SIZE_T='unknown'
- SIZE_FORMAT='unknown'
- if test $ac_cv_sizeof_unsigned_int -eq $ac_cv_sizeof_size_t
- then
- SIZE_T='unsigned int'
- SIZE_FORMAT='"u"'
- elif test $ac_cv_sizeof_unsigned_long -eq $ac_cv_sizeof_size_t
- then
- SIZE_T='unsigned long'
- SIZE_FORMAT='"lu"'
- elif test $ac_cv_sizeof_unsigned_long_long -eq $ac_cv_sizeof_size_t
- then
- SIZE_T='unsigned long long'
- case "${host_os}" in
- mingw32*)
- # MinGW32 understands 'unsigned long long', but uses printf from WIN32 CRT
- SIZE_FORMAT='"I64u"'
- ;;
- *)
- SIZE_FORMAT='"llu"'
- ;;
- esac
- fi
-
- SSIZE_T='unknown'
- SSIZE_FORMAT='unknown'
- if test $ac_cv_sizeof_signed_int -eq $ac_cv_sizeof_size_t
- then
- SSIZE_T='signed int'
- SSIZE_FORMAT='"d"'
- elif test $ac_cv_sizeof_signed_long -eq $ac_cv_sizeof_size_t
- then
- SSIZE_T='signed long'
- SSIZE_FORMAT='"ld"'
- elif test $ac_cv_sizeof_signed_long_long -eq $ac_cv_sizeof_size_t
- then
- SSIZE_T='signed long long'
- case "${host_os}" in
- mingw32*)
- # MinGW32 understands 'long long', but uses printf from WIN32 CRT
- SSIZE_FORMAT='"I64d"'
- ;;
- *)
- SSIZE_FORMAT='"lld"'
- ;;
- esac
- fi
-
- PTRDIFF_FORMAT='"ld"'
+if test $ac_cv_sizeof_size_t -eq 4
+then
+ SSIZE_T='int32_t'
+elif test $ac_cv_sizeof_size_t -eq 8
+then
+ SSIZE_T='int64_t'
+else
+ AC_MSG_ERROR([Unsupported size_t size ${ac_cv_sizeof_size_t}; please add support])
fi
-AC_MSG_CHECKING(for signed 8-bit type)
-AC_MSG_RESULT($INT8_T)
-AC_DEFINE_UNQUOTED(TIFF_INT8_T,$INT8_T,[Signed 8-bit type])
-
-AC_MSG_CHECKING(for unsigned 8-bit type)
-AC_MSG_RESULT($UINT8_T)
-AC_DEFINE_UNQUOTED(TIFF_UINT8_T,$UINT8_T,[Unsigned 8-bit type])
-
-AC_MSG_CHECKING(for signed 16-bit type)
-AC_MSG_RESULT($INT16_T)
-AC_DEFINE_UNQUOTED(TIFF_INT16_T,$INT16_T,[Signed 16-bit type])
-
-AC_MSG_CHECKING(for unsigned 16-bit type)
-AC_MSG_RESULT($UINT16_T)
-AC_DEFINE_UNQUOTED(TIFF_UINT16_T,$UINT16_T,[Unsigned 16-bit type])
-
-AC_MSG_CHECKING(for signed 32-bit type)
-AC_MSG_RESULT($INT32_T)
-AC_DEFINE_UNQUOTED(TIFF_INT32_T,$INT32_T,[Signed 32-bit type])
-
-AC_MSG_CHECKING(for signed 32-bit format)
-AC_MSG_RESULT($INT32_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_INT32_FORMAT,$INT32_FORMAT,[Signed 32-bit type formatter])
-
-AC_MSG_CHECKING(for unsigned 32-bit type)
-AC_MSG_RESULT($UINT32_T)
-AC_DEFINE_UNQUOTED(TIFF_UINT32_T,$UINT32_T,[Unsigned 32-bit type])
-
-AC_MSG_CHECKING(for unsigned 32-bit format)
-AC_MSG_RESULT($UINT32_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_UINT32_FORMAT,$UINT32_FORMAT,[Unsigned 32-bit type formatter])
-
-AC_MSG_CHECKING(for signed 64-bit type)
-AC_MSG_RESULT($INT64_T)
-AC_DEFINE_UNQUOTED(TIFF_INT64_T,$INT64_T,[Signed 64-bit type])
-
-AC_MSG_CHECKING(for signed 64-bit format)
-AC_MSG_RESULT($INT64_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_INT64_FORMAT,$INT64_FORMAT,[Signed 64-bit type formatter])
-
-AC_MSG_CHECKING(for unsigned 64-bit type)
-AC_MSG_RESULT($UINT64_T)
-AC_DEFINE_UNQUOTED(TIFF_UINT64_T,$UINT64_T,[Unsigned 64-bit type])
-
-AC_MSG_CHECKING(for unsigned 64-bit format)
-AC_MSG_RESULT($UINT64_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_UINT64_FORMAT,$UINT64_FORMAT,[Unsigned 64-bit type formatter])
-
-AC_MSG_CHECKING([for 'size_t' type])
-AC_MSG_RESULT([$SIZE_T])
-AC_DEFINE_UNQUOTED([TIFF_SIZE_T],[$SIZE_T],[Unsigned size type])
-
-AC_MSG_CHECKING([for 'size_t' format])
-AC_MSG_RESULT([$SIZE_FORMAT])
-AC_DEFINE_UNQUOTED([TIFF_SIZE_FORMAT],[$SIZE_FORMAT],[Unsigned size type formatter])
-
# Determine TIFF equivalent of ssize_t
AC_MSG_CHECKING(for signed size type)
AC_MSG_RESULT($SSIZE_T)
AC_DEFINE_UNQUOTED(TIFF_SSIZE_T,$SSIZE_T,[Signed size type])
-AC_MSG_CHECKING(for signed size format)
-AC_MSG_RESULT($SSIZE_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_SSIZE_FORMAT,$SSIZE_FORMAT,[Signed size type formatter])
-
-# Determine the type to use for the difference between two pointers.
-# We will default to the POSIX ptrdiff_t if it is available, but will
-# be prepared for the case when it is not.
-AC_MSG_CHECKING(for pointer difference type)
-if test $PTRDIFF_T = unknown
-then
- PTRDIFF_T=$SSIZE_T
- PTRDIFF_FORMAT=$SSIZE_FORMAT
-fi
-AC_MSG_RESULT($PTRDIFF_T)
-AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_T,$PTRDIFF_T,[Pointer difference type])
-
-AC_MSG_CHECKING(for pointer difference format)
-AC_MSG_RESULT($PTRDIFF_FORMAT)
-AC_DEFINE_UNQUOTED(TIFF_PTRDIFF_FORMAT,$PTRDIFF_FORMAT,[Pointer difference type formatter])
-
dnl Checks for library functions.
AC_CHECK_FUNCS([mmap setmode snprintf])
@@ -559,6 +311,8 @@ fi
AC_SUBST(LIBTIFF_DOCDIR)
+
+
dnl ---------------------------------------------------------------------------
dnl Switch on/off internal codecs.
dnl ---------------------------------------------------------------------------
@@ -1306,7 +1060,7 @@ LOC_MSG([ C++ compiler: ${CXX} ${CXXFLAGS}])
LOC_MSG([ Enable runtime linker paths: ${HAVE_RPATH}])
LOC_MSG([ Enable linker symbol versioning: ${have_ld_version_script}])
LOC_MSG([ Support Microsoft Document Imaging: ${HAVE_MDI}])
-LOC_MSG([ Use win32 IO: ${win32_io_ok}])
+LOC_MSG([ Use Win32 IO: ${win32_io_ok}])
LOC_MSG()
LOC_MSG([ Support for internal codecs:])
LOC_MSG([ CCITT Group 3 & 4 algorithms: ${HAVE_CCITT}])
diff --git a/contrib/addtiffo/tif_overview.c b/contrib/addtiffo/tif_overview.c
index 591a2aaa..6e837d10 100644
--- a/contrib/addtiffo/tif_overview.c
+++ b/contrib/addtiffo/tif_overview.c
@@ -79,16 +79,16 @@ void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
/* function is called. */
/************************************************************************/
-uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
- int nBitsPerPixel, int nPlanarConfig, int nSamples,
- int nBlockXSize, int nBlockYSize,
- int bTiled, int nCompressFlag, int nPhotometric,
- int nSampleFormat,
- unsigned short *panRed,
- unsigned short *panGreen,
- unsigned short *panBlue,
- int bUseSubIFDs,
- int nHorSubsampling, int nVerSubsampling )
+uint32_t TIFF_WriteOverview( TIFF *hTIFF, uint32_t nXSize, uint32_t nYSize,
+ int nBitsPerPixel, int nPlanarConfig, int nSamples,
+ int nBlockXSize, int nBlockYSize,
+ int bTiled, int nCompressFlag, int nPhotometric,
+ int nSampleFormat,
+ unsigned short *panRed,
+ unsigned short *panGreen,
+ unsigned short *panBlue,
+ int bUseSubIFDs,
+ int nHorSubsampling, int nVerSubsampling )
{
toff_t nBaseDirOffset;
@@ -173,13 +173,13 @@ uint32 TIFF_WriteOverview( TIFF *hTIFF, uint32 nXSize, uint32 nYSize,
/************************************************************************/
static void
-TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc,
- int nPixelBytes, int nSampleFormat,
- uint32 nXSize, uint32 nYSize,
+TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc,
+ int nPixelBytes, int nSampleFormat,
+ uint32_t nXSize, uint32_t nYSize,
int nPixelOffset, int nLineOffset )
{
- uint32 iXOff, iYOff;
- int iSample;
+ uint32_t iXOff, iYOff;
+ int iSample;
iSample = 0;
@@ -197,19 +197,19 @@ TIFF_GetSourceSamples( double * padfSamples, unsigned char *pabySrc,
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
{
- padfSamples[iSample++] = ((uint16 *) pabyData)[0];
+ padfSamples[iSample++] = ((uint16_t *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
{
- padfSamples[iSample++] = ((uint32 *) pabyData)[0];
+ padfSamples[iSample++] = ((uint32_t *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
{
- padfSamples[iSample++] = ((int16 *) pabyData)[0];
+ padfSamples[iSample++] = ((int16_t *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
{
- padfSamples[iSample++] = ((int32 *) pabyData)[0];
+ padfSamples[iSample++] = ((int32_t *) pabyData)[0];
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
{
@@ -238,19 +238,19 @@ TIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat,
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 2 )
{
- *((uint16 *)pabyData) = (uint16) MAX(0,MIN(65535,dfValue));
+ *((uint16_t *)pabyData) = (uint16_t) MAX(0, MIN(65535, dfValue));
}
else if( nSampleFormat == SAMPLEFORMAT_UINT && nPixelBytes == 4 )
{
- *((uint32 *)pabyData) = (uint32) dfValue;
+ *((uint32_t *)pabyData) = (uint32_t) dfValue;
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 2 )
{
- *((int16 *)pabyData) = (int16) MAX(-32768,MIN(32767,dfValue));
+ *((int16_t *)pabyData) = (int16_t) MAX(-32768, MIN(32767, dfValue));
}
else if( nSampleFormat == SAMPLEFORMAT_INT && nPixelBytes == 32 )
{
- *((int32 *)pabyData) = (int32) dfValue;
+ *((int32_t *)pabyData) = (int32_t) dfValue;
}
else if( nSampleFormat == SAMPLEFORMAT_IEEEFP && nPixelBytes == 4 )
{
@@ -271,15 +271,15 @@ TIFF_SetSample( unsigned char * pabyData, int nPixelBytes, int nSampleFormat,
static
void TIFF_DownSample( unsigned char *pabySrcTile,
- uint32 nBlockXSize, uint32 nBlockYSize,
+ uint32_t nBlockXSize, uint32_t nBlockYSize,
int nPixelSkewBits, int nBitsPerPixel,
unsigned char * pabyOTile,
- uint32 nOBlockXSize, uint32 nOBlockYSize,
- uint32 nTXOff, uint32 nTYOff, int nOMult,
+ uint32_t nOBlockXSize, uint32_t nOBlockYSize,
+ uint32_t nTXOff, uint32_t nTYOff, int nOMult,
int nSampleFormat, const char * pszResampling )
{
- uint32 i, j;
+ uint32_t i, j;
int k, nPixelBytes = (nBitsPerPixel) / 8;
int nPixelGroupBytes = (nBitsPerPixel+nPixelSkewBits)/8;
unsigned char *pabySrc, *pabyDst;
@@ -357,13 +357,13 @@ void TIFF_DownSample( unsigned char *pabySrcTile,
for( i = 0; i*nOMult < nBlockXSize; i++ )
{
double dfTotal;
- uint32 nXSize, nYSize, iSample;
+ uint32_t nXSize, nYSize, iSample;
if( i + nTXOff >= nOBlockXSize )
break;
- nXSize = MIN((uint32)nOMult,nBlockXSize-i);
- nYSize = MIN((uint32)nOMult,nBlockYSize-j);
+ nXSize = MIN((uint32_t)nOMult, nBlockXSize - i);
+ nYSize = MIN((uint32_t)nOMult, nBlockYSize - j);
TIFF_GetSourceSamples( padfSamples, pabySrc,
nPixelBytes, nSampleFormat,
@@ -394,10 +394,10 @@ void TIFF_DownSample( unsigned char *pabySrcTile,
/************************************************************************/
static
void TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,
- uint32 nBlockXSize, uint32 nBlockYSize,
+ uint32_t nBlockXSize, uint32_t nBlockYSize,
unsigned char * pabyOTile,
- uint32 nOBlockXSize, uint32 nOBlockYSize,
- uint32 nTXOff, uint32 nTYOff, int nOMult,
+ uint32_t nOBlockXSize, uint32_t nOBlockYSize,
+ uint32_t nTXOff, uint32_t nTYOff, int nOMult,
const char *pszResampling,
int nHorSubsampling, int nVerSubsampling )
{
@@ -405,10 +405,10 @@ void TIFF_DownSample_Subsampled( unsigned char *pabySrcTile, int nSample,
int nSampleBlockSize;
int nSourceSampleRowSize;
int nDestSampleRowSize;
- uint32 nSourceX, nSourceY;
- uint32 nSourceXSec, nSourceYSec;
- uint32 nSourceXSecEnd, nSourceYSecEnd;
- uint32 nDestX, nDestY;
+ uint32_t nSourceX, nSourceY;
+ uint32_t nSourceXSec, nSourceYSec;
+ uint32_t nSourceXSecEnd, nSourceYSecEnd;
+ uint32_t nDestX, nDestY;
int nSampleOffsetInSampleBlock;
unsigned int nCummulator;
unsigned int nCummulatorCount;
@@ -572,9 +572,9 @@ void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
int nOverviews, int * panOvList,
int nBitsPerPixel,
int nSamples, TIFFOvrCache ** papoRawBIs,
- uint32 nSXOff, uint32 nSYOff,
+ uint32_t nSXOff, uint32_t nSYOff,
unsigned char *pabySrcTile,
- uint32 nBlockXSize, uint32 nBlockYSize,
+ uint32_t nBlockXSize, uint32_t nBlockYSize,
int nSampleFormat, const char * pszResampling )
{
@@ -614,10 +614,10 @@ void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
{
TIFFOvrCache *poRBI = papoRawBIs[iOverview];
unsigned char *pabyOTile;
- uint32 nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
- uint32 nOBlockXSize = poRBI->nBlockXSize;
- uint32 nOBlockYSize = poRBI->nBlockYSize;
- int nSkewBits, nSampleByteOffset;
+ uint32_t nTXOff, nTYOff, nOXOff, nOYOff, nOMult;
+ uint32_t nOBlockXSize = poRBI->nBlockXSize;
+ uint32_t nOBlockYSize = poRBI->nBlockYSize;
+ int nSkewBits, nSampleByteOffset;
/*
* Fetch the destination overview tile
@@ -718,14 +718,14 @@ void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
{
TIFFOvrCache **papoRawBIs;
- uint32 nXSize, nYSize, nBlockXSize, nBlockYSize;
- uint16 nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
+ uint32_t nXSize, nYSize, nBlockXSize, nBlockYSize;
+ uint16_t nBitsPerPixel, nPhotometric, nCompressFlag, nSamples,
nPlanarConfig, nSampleFormat;
int bSubsampled;
- uint16 nHorSubsampling, nVerSubsampling;
+ uint16_t nHorSubsampling, nVerSubsampling;
int bTiled, nSXOff, nSYOff, i;
unsigned char *pabySrcTile;
- uint16 *panRedMap, *panGreenMap, *panBlueMap;
+ uint16_t *panRedMap, *panGreenMap, *panBlueMap;
TIFFErrorHandler pfnWarning;
(void) pfnProgress;
@@ -808,12 +808,12 @@ void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
if( TIFFGetField( hTIFF, TIFFTAG_COLORMAP,
&panRedMap, &panGreenMap, &panBlueMap ) )
{
- uint16 *panRed2, *panGreen2, *panBlue2;
+ uint16_t *panRed2, *panGreen2, *panBlue2;
int nColorCount = 1 << nBitsPerPixel;
- panRed2 = (uint16 *) _TIFFmalloc(2*nColorCount);
- panGreen2 = (uint16 *) _TIFFmalloc(2*nColorCount);
- panBlue2 = (uint16 *) _TIFFmalloc(2*nColorCount);
+ panRed2 = (uint16_t *) _TIFFmalloc(2 * nColorCount);
+ panGreen2 = (uint16_t *) _TIFFmalloc(2 * nColorCount);
+ panBlue2 = (uint16_t *) _TIFFmalloc(2 * nColorCount);
memcpy( panRed2, panRedMap, 2 * nColorCount );
memcpy( panGreen2, panGreenMap, 2 * nColorCount );
@@ -835,7 +835,7 @@ void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
for( i = 0; i < nOverviews; i++ )
{
- uint32 nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
+ uint32_t nOXSize, nOYSize, nOBlockXSize, nOBlockYSize;
toff_t nDirOffset;
nOXSize = (nXSize + panOvList[i] - 1) / panOvList[i];
diff --git a/contrib/addtiffo/tif_ovrcache.c b/contrib/addtiffo/tif_ovrcache.c
index ac500ab4..75b6436a 100644
--- a/contrib/addtiffo/tif_ovrcache.c
+++ b/contrib/addtiffo/tif_ovrcache.c
@@ -138,7 +138,7 @@ static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
int nRet, iTileX, iTileY = psCache->nBlockOffset;
unsigned char *pabyData;
toff_t nBaseDirOffset;
- uint32 RowsInStrip;
+ uint32_t RowsInStrip;
/* -------------------------------------------------------------------- */
/* If the output cache is multi-byte per sample, and the file */
@@ -148,11 +148,11 @@ static void TIFFWriteOvrRow( TIFFOvrCache * psCache )
if( TIFFIsByteSwapped(psCache->hTIFF) )
{
if( psCache->nBitsPerPixel == 16 )
- TIFFSwabArrayOfShort( (uint16 *) psCache->pabyRow1Blocks,
+ TIFFSwabArrayOfShort( (uint16_t *) psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 2 );
else if( psCache->nBitsPerPixel == 32 )
- TIFFSwabArrayOfLong( (uint32 *) psCache->pabyRow1Blocks,
+ TIFFSwabArrayOfLong( (uint32_t *) psCache->pabyRow1Blocks,
(psCache->nBytesPerBlock * psCache->nSamples) / 4 );
else if( psCache->nBitsPerPixel == 64 )
diff --git a/contrib/addtiffo/tif_ovrcache.h b/contrib/addtiffo/tif_ovrcache.h
index 0ad10829..83c97bf0 100644
--- a/contrib/addtiffo/tif_ovrcache.h
+++ b/contrib/addtiffo/tif_ovrcache.h
@@ -43,14 +43,14 @@ extern "C" {
typedef struct
{
- uint32 nXSize;
- uint32 nYSize;
+ uint32_t nXSize;
+ uint32_t nYSize;
- uint16 nBitsPerPixel;
- uint16 nSamples;
- uint16 nPlanarConfig;
- uint32 nBlockXSize;
- uint32 nBlockYSize;
+ uint16_t nBitsPerPixel;
+ uint16_t nSamples;
+ uint16_t nPlanarConfig;
+ uint32_t nBlockXSize;
+ uint32_t nBlockYSize;
toff_t nBytesPerBlock;
toff_t nBytesPerRow;
@@ -76,15 +76,15 @@ void TIFFDestroyOvrCache( TIFFOvrCache * );
void TIFFBuildOverviews( TIFF *, int, int *, int, const char *,
int (*)(double,void*), void * );
-void TIFF_ProcessFullResBlock( TIFF *, int, int, int, int, int, int *, int,
- int, TIFFOvrCache **, uint32, uint32,
- unsigned char *, uint32, uint32,
+void TIFF_ProcessFullResBlock( TIFF *, int, int, int, int, int, int *, int,
+ int, TIFFOvrCache **, uint32_t, uint32_t,
+ unsigned char *, uint32_t, uint32_t,
int, const char * );
-uint32 TIFF_WriteOverview( TIFF *, uint32, uint32, int, int, int, int, int,
- int, int, int, int, unsigned short *,
- unsigned short *, unsigned short *, int,
- int, int);
+uint32_t TIFF_WriteOverview( TIFF *, uint32_t, uint32_t, int, int, int, int, int,
+ int, int, int, int, unsigned short *,
+ unsigned short *, unsigned short *, int,
+ int, int);
diff --git a/contrib/dbs/tiff-grayscale.c b/contrib/dbs/tiff-grayscale.c
index 92c7b904..644eb9ee 100644
--- a/contrib/dbs/tiff-grayscale.c
+++ b/contrib/dbs/tiff-grayscale.c
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
int bits_per_pixel = 8, cmsize, i, j, k,
gray_index, chunk_size = 32, nchunks = 16;
unsigned char * scan_line;
- uint16 * gray;
+ uint16_t * gray;
float refblackwhite[2*1];
TIFF * tif;
@@ -73,11 +73,11 @@ int main(int argc, char **argv)
}
cmsize = nchunks * nchunks;
- gray = (uint16 *) malloc(cmsize * sizeof(uint16));
+ gray = (uint16_t *) malloc(cmsize * sizeof(uint16_t));
gray[0] = 3000;
for (i = 1; i < cmsize; i++)
- gray[i] = (uint16) (-log10((double) i / (cmsize - 1)) * 1000);
+ gray[i] = (uint16_t) (-log10((double) i / (cmsize - 1)) * 1000);
refblackwhite[0] = 0.0;
refblackwhite[1] = (float)((1L<<bits_per_pixel) - 1);
diff --git a/contrib/dbs/tiff-palette.c b/contrib/dbs/tiff-palette.c
index 7b3d433f..9f8ea105 100644
--- a/contrib/dbs/tiff-palette.c
+++ b/contrib/dbs/tiff-palette.c
@@ -40,7 +40,7 @@ int main(int argc, char **argv)
int bits_per_pixel = 8, cmsize, i, j, k,
cmap_index, chunk_size = 32, nchunks = 16;
unsigned char * scan_line;
- uint16 *red, *green, *blue;
+ uint16_t *red, *green, *blue;
TIFF * tif;
programName = argv[0];
@@ -79,9 +79,9 @@ int main(int argc, char **argv)
} else {
cmsize = 2;
}
- red = (uint16 *) malloc(cmsize * sizeof(uint16));
- green = (uint16 *) malloc(cmsize * sizeof(uint16));
- blue = (uint16 *) malloc(cmsize * sizeof(uint16));
+ red = (uint16_t *) malloc(cmsize * sizeof(uint16_t));
+ green = (uint16_t *) malloc(cmsize * sizeof(uint16_t));
+ blue = (uint16_t *) malloc(cmsize * sizeof(uint16_t));
switch (bits_per_pixel) {
case 8:
diff --git a/contrib/dbs/tiff-rgb.c b/contrib/dbs/tiff-rgb.c
index d14ed005..f912cb99 100644
--- a/contrib/dbs/tiff-rgb.c
+++ b/contrib/dbs/tiff-rgb.c
@@ -29,7 +29,7 @@
#include "tiffio.h"
-#define ROUND(x) (uint16) ((x) + 0.5)
+#define ROUND(x) (uint16_t) ((x) + 0.5)
#define CMSIZE 256
#define WIDTH 525
#define HEIGHT 512
@@ -45,7 +45,7 @@ int main(int argc, char **argv)
int i, j;
TIFF * tif;
unsigned char * scan_line;
- uint16 red[CMSIZE], green[CMSIZE], blue[CMSIZE];
+ uint16_t red[CMSIZE], green[CMSIZE], blue[CMSIZE];
float refblackwhite[2*3];
programName = argv[0];
diff --git a/contrib/dbs/xtiff/xtiff.c b/contrib/dbs/xtiff/xtiff.c
index bc10b670..a9518f83 100644
--- a/contrib/dbs/xtiff/xtiff.c
+++ b/contrib/dbs/xtiff/xtiff.c
@@ -70,7 +70,7 @@
#include "xtifficon.h"
#define TIFF_GAMMA "2.2" /* default gamma from the TIFF 5.0 spec */
-#define ROUND(x) (uint16) ((x) + 0.5)
+#define ROUND(x) (uint16_t) ((x) + 0.5)
#define SCALE(x, s) (((x) * 65535L) / (s))
#define MCHECK(m) if (!m) { fprintf(stderr, "malloc failed\n"); exit(0); }
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
@@ -131,8 +131,8 @@ typedef struct {
Boolean help;
float gamma;
Boolean usePixmap;
- uint32 viewportWidth;
- uint32 viewportHeight;
+ uint32_t viewportWidth;
+ uint32_t viewportHeight;
int translate;
Boolean verbose;
} AppData, *AppDataPtr;
@@ -236,8 +236,8 @@ unsigned char basePixel = 0;
* TIFF data structures
*/
TIFF * tfFile = NULL;
-uint32 tfImageWidth, tfImageHeight;
-uint16 tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
+uint32_t tfImageWidth, tfImageHeight;
+uint16_t tfBitsPerSample, tfSamplesPerPixel, tfPlanarConfiguration,
tfPhotometricInterpretation, tfGrayResponseUnit,
tfImageDepth, tfBytesPerRow;
int tfDirectory = 0, tfMultiPage = False;
@@ -253,7 +253,7 @@ double *dRed, *dGreen, *dBlue;
/*
* shared data structures
*/
-uint16 * redMap = NULL, *greenMap = NULL, *blueMap = NULL,
+uint16_t * redMap = NULL, *greenMap = NULL, *blueMap = NULL,
*grayMap = NULL, colormapSize;
char * imageMemory;
char * fileName;
@@ -451,9 +451,9 @@ GetTIFFHeader()
*/
switch (tfPhotometricInterpretation) {
case PHOTOMETRIC_RGB:
- redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ redMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ greenMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ blueMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
for (i = 0; i < colormapSize; i++)
dRed[i] = dGreen[i] = dBlue[i]
@@ -462,9 +462,9 @@ GetTIFFHeader()
case PHOTOMETRIC_PALETTE:
if (!TIFFGetField(tfFile, TIFFTAG_COLORMAP,
&redMap, &greenMap, &blueMap)) {
- redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ redMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ greenMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ blueMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
for (i = 0; i < colormapSize; i++)
dRed[i] = dGreen[i] = dBlue[i]
@@ -479,18 +479,18 @@ GetTIFFHeader()
}
break;
case PHOTOMETRIC_MINISWHITE:
- redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ redMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ greenMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ blueMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
for (i = 0; i < colormapSize; i++)
dRed[i] = dGreen[i] = dBlue[i] = (double)
SCALE(colormapSize-1-i, colormapSize-1);
break;
case PHOTOMETRIC_MINISBLACK:
- redMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- greenMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
- blueMap = (uint16 *) malloc(colormapSize * sizeof(uint16));
+ redMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ greenMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
+ blueMap = (uint16_t *) malloc(colormapSize * sizeof(uint16_t));
MCHECK(redMap); MCHECK(greenMap); MCHECK(blueMap);
for (i = 0; i < colormapSize; i++)
dRed[i] = dGreen[i] = dBlue[i] = (double) SCALE(i, colormapSize-1);
@@ -736,8 +736,8 @@ GetTIFFImage()
{
int pixel_map[3], red_shift, green_shift, blue_shift;
char *scan_line, *output_p, *input_p;
- uint32 i, j;
- uint16 s;
+ uint32_t i, j;
+ uint16_t s;
scan_line = (char *) malloc(tfBytesPerRow = TIFFScanlineSize(tfFile));
MCHECK(scan_line);
diff --git a/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc b/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc
index dd17b5d8..e37650af 100644
--- a/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc
+++ b/contrib/oss-fuzz/tiff_read_rgba_fuzzer.cc
@@ -33,7 +33,7 @@
/* safe multiply returns either the multiplied value or 0 if it overflowed */
#define __TIFFSafeMultiply(t,v,m) ((((t)(m) != (t)0) && (((t)(((v)*(m))/(m))) == (t)(v))) ? (t)((v)*(m)) : (t)0)
-const uint64 MAX_SIZE = 500000000;
+const uint64_t MAX_SIZE = 500000000;
extern "C" void handle_error(const char *unused, const char *unused2, va_list unused3) {
return;
@@ -57,8 +57,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
if (!tif) {
return 0;
}
- uint32 w, h;
- uint32* raster;
+ uint32_t w, h;
+ uint32_t* raster;
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
@@ -67,29 +67,29 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
TIFFClose(tif);
return 0;
}
- uint64 bufsize = TIFFTileSize64(tif);
+ uint64_t bufsize = TIFFTileSize64(tif);
/* don't continue if the buffer size greater than the max allowed by the fuzzer */
if (bufsize > MAX_SIZE || bufsize == 0) {
TIFFClose(tif);
return 0;
}
/* another hack to work around an OOM in tif_fax3.c */
- uint32 tilewidth = 0;
- uint32 imagewidth = 0;
+ uint32_t tilewidth = 0;
+ uint32_t imagewidth = 0;
TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tilewidth);
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &imagewidth);
- tilewidth = __TIFFSafeMultiply(uint32, tilewidth, 2);
- imagewidth = __TIFFSafeMultiply(uint32, imagewidth, 2);
+ tilewidth = __TIFFSafeMultiply(uint32_t, tilewidth, 2);
+ imagewidth = __TIFFSafeMultiply(uint32_t, imagewidth, 2);
if (tilewidth * 2 > MAX_SIZE || imagewidth * 2 > MAX_SIZE || tilewidth == 0 || imagewidth == 0) {
TIFFClose(tif);
return 0;
}
- uint32 size = __TIFFSafeMultiply(uint32, w, h);
+ uint32_t size = __TIFFSafeMultiply(uint32_t, w, h);
if (size > MAX_SIZE || size == 0) {
TIFFClose(tif);
return 0;
}
- raster = (uint32*) _TIFFmalloc(size * sizeof (uint32));
+ raster = (uint32_t*) _TIFFmalloc(size * sizeof (uint32_t));
if (raster != NULL) {
TIFFReadRGBAImage(tif, w, h, raster, 0);
_TIFFfree(raster);
diff --git a/contrib/pds/tif_imageiter.c b/contrib/pds/tif_imageiter.c
index 243cfd65..7ecf61a0 100644
--- a/contrib/pds/tif_imageiter.c
+++ b/contrib/pds/tif_imageiter.c
@@ -49,17 +49,17 @@
#include <assert.h>
#include <stdio.h>
-static int gtTileContig(TIFFImageIter*, void *udata, uint32, uint32);
-static int gtTileSeparate(TIFFImageIter*, void *udata, uint32, uint32);
-static int gtStripContig(TIFFImageIter*, void *udata, uint32, uint32);
-static int gtStripSeparate(TIFFImageIter*, void *udata, uint32, uint32);
+static int gtTileContig(TIFFImageIter*, void *udata, uint32_t, uint32_t);
+static int gtTileSeparate(TIFFImageIter*, void *udata, uint32_t, uint32_t);
+static int gtStripContig(TIFFImageIter*, void *udata, uint32_t, uint32_t);
+static int gtStripSeparate(TIFFImageIter*, void *udata, uint32_t, uint32_t);
static const char photoTag[] = "PhotometricInterpretation";
static int
isCCITTCompression(TIFF* tif)
{
- uint16 compress;
+ uint16_t compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
return (compress == COMPRESSION_CCITTFAX3 ||
compress == COMPRESSION_CCITTFAX4 ||
@@ -70,9 +70,9 @@ isCCITTCompression(TIFF* tif)
int
TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
{
- uint16* sampleinfo;
- uint16 extrasamples;
- uint16 planarconfig;
+ uint16_t* sampleinfo;
+ uint16_t extrasamples;
+ uint16_t planarconfig;
int colorchannels;
img->tif = tif;
@@ -134,7 +134,7 @@ TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
return (0);
}
/* It would probably be nice to have a reality check here. */
- { uint16 compress;
+ { uint16_t compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
if (compress == COMPRESSION_JPEG && planarconfig == PLANARCONFIG_CONTIG) {
/* can rely on libjpeg to convert to RGB */
@@ -152,7 +152,7 @@ TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
}
break;
case PHOTOMETRIC_SEPARATED: {
- uint16 inkset;
+ uint16_t inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
@@ -206,7 +206,7 @@ TIFFImageIterBegin(TIFFImageIter* img, TIFF* tif, int stop, char emsg[1024])
}
int
-TIFFImageIterGet(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+TIFFImageIterGet(TIFFImageIter* img, void *udata, uint32_t w, uint32_t h)
{
if (img->get == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
@@ -230,7 +230,7 @@ TIFFImageIterEnd(TIFFImageIter* img)
*/
int
TIFFReadImageIter(TIFF* tif,
- uint32 rwidth, uint32 rheight, uint8* raster, int stop)
+ uint32_t rwidth, uint32_t rheight, uint8_t* raster, int stop)
{
char emsg[1024];
TIFFImageIter img;
@@ -255,16 +255,16 @@ TIFFReadImageIter(TIFF* tif,
* SamplesPerPixel == 1
*/
static int
-gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+gtTileContig(TIFFImageIter* img, void *udata, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
ImageIterTileContigRoutine callback = img->callback.contig;
- uint16 orientation;
- uint32 col, row;
- uint32 tw, th;
+ uint16_t orientation;
+ uint32_t col, row;
+ uint32_t tw, th;
u_char* buf;
- int32 fromskew;
- uint32 nrow;
+ int32_t fromskew;
+ uint32_t nrow;
buf = (u_char*) _TIFFmalloc(TIFFTileSize(tif));
if (buf == 0) {
@@ -284,7 +284,7 @@ gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
- uint32 npix = w - col;
+ uint32_t npix = w - col;
fromskew = tw - npix;
(*callback)(img, udata, col, row, npix, nrow, fromskew, buf);
} else {
@@ -303,22 +303,22 @@ gtTileContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
* We assume that all such images are RGB.
*/
static int
-gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+gtTileSeparate(TIFFImageIter* img, void *udata, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
ImageIterTileSeparateRoutine callback = img->callback.separate;
- uint16 orientation;
- uint32 col, row;
- uint32 tw, th;
+ uint16_t orientation;
+ uint32_t col, row;
+ uint32_t tw, th;
u_char* buf;
u_char* r;
u_char* g;
u_char* b;
u_char* a;
tsize_t tilesize;
- int32 fromskew;
+ int32_t fromskew;
int alpha = img->alpha;
- uint32 nrow;
+ uint32_t nrow;
tilesize = TIFFTileSize(tif);
buf = (u_char*) _TIFFmalloc(4*tilesize);
@@ -351,7 +351,7 @@ gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
* Tile is clipped horizontally. Calculate
* visible portion and skewing factors.
*/
- uint32 npix = w - col;
+ uint32_t npix = w - col;
fromskew = tw - npix;
(*callback)(img, udata, col, row, npix, nrow, fromskew, r, g, b, a);
} else {
@@ -370,17 +370,17 @@ gtTileSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
* SamplesPerPixel == 1
*/
static int
-gtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+gtStripContig(TIFFImageIter* img, void *udata, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
ImageIterTileContigRoutine callback = img->callback.contig;
- uint16 orientation;
- uint32 row, nrow;
+ uint16_t orientation;
+ uint32_t row, nrow;
u_char* buf;
- uint32 rowsperstrip;
- uint32 imagewidth = img->width;
+ uint32_t rowsperstrip;
+ uint32_t imagewidth = img->width;
tsize_t scanline;
- int32 fromskew;
+ int32_t fromskew;
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
if (buf == 0) {
@@ -409,19 +409,19 @@ gtStripContig(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
* We assume that all such images are RGB.
*/
static int
-gtStripSeparate(TIFFImageIter* img, void *udata, uint32 w, uint32 h)
+gtStripSeparate(TIFFImageIter* img, void *udata, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
ImageIterTileSeparateRoutine callback = img->callback.separate;
- uint16 orientation;
+ uint16_t orientation;
u_char *buf;
u_char *r, *g, *b, *a;
- uint32 row, nrow;
+ uint32_t row, nrow;
tsize_t scanline;
- uint32 rowsperstrip;
- uint32 imagewidth = img->width;
+ uint32_t rowsperstrip;
+ uint32_t imagewidth = img->width;
tsize_t stripsize;
- int32 fromskew;
+ int32_t fromskew;
int alpha = img->alpha;
stripsize = TIFFStripSize(tif);
diff --git a/contrib/pds/tif_imageiter.h b/contrib/pds/tif_imageiter.h
index 4f4fd279..4f09c1d2 100644
--- a/contrib/pds/tif_imageiter.h
+++ b/contrib/pds/tif_imageiter.h
@@ -8,28 +8,28 @@ typedef struct _TIFFImageIter TIFFImageIter;
bits of data. The array pp is ordered in h consecutive rows of w+fromskew
pixels each. */
typedef void (*ImageIterTileContigRoutine)
- (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+ (TIFFImageIter*, void *, uint32_t, uint32_t, uint32_t, uint32_t, int32_t,
unsigned char*);
#define DECLAREContigCallbackFunc(name) \
static void name(\
TIFFImageIter* img, \
void* user_data, \
- uint32 x, uint32 y, \
- uint32 w, uint32 h, \
- int32 fromskew, \
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h, \
+ int32_t fromskew, \
u_char* pp \
)
typedef void (*ImageIterTileSeparateRoutine)
- (TIFFImageIter*, void *, uint32, uint32, uint32, uint32, int32,
+ (TIFFImageIter*, void *, uint32_t, uint32_t, uint32_t, uint32_t, int32_t,
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
#define DECLARESepCallbackFunc(name) \
static void name(\
TIFFImageIter* img, \
void* user_data, \
- uint32 x, uint32 y, \
- uint32 w, uint32 h,\
- int32 fromskew, \
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h,\
+ int32_t fromskew, \
u_char* r, u_char* g, u_char* b, u_char* a\
)
@@ -38,17 +38,17 @@ struct _TIFFImageIter {
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
- uint32 width; /* image width */
- uint32 height; /* image height */
- uint16 bitspersample; /* image bits/sample */
- uint16 samplesperpixel; /* image samples/pixel */
- uint16 orientation; /* image orientation */
- uint16 photometric; /* image photometric interp */
- uint16* redcmap; /* colormap palette */
- uint16* greencmap;
- uint16* bluecmap;
+ uint32_t width; /* image width */
+ uint32_t height; /* image height */
+ uint16_t bitspersample; /* image bits/sample */
+ uint16_t samplesperpixel; /* image samples/pixel */
+ uint16_t orientation; /* image orientation */
+ uint16_t photometric; /* image photometric interp */
+ uint16_t* redcmap; /* colormap palette */
+ uint16_t* greencmap;
+ uint16_t* bluecmap;
/* get image data routine */
- int (*get)(TIFFImageIter*, void *udata, uint32, uint32);
+ int (*get)(TIFFImageIter*, void *udata, uint32_t, uint32_t);
union {
void (*any)(TIFFImageIter*);
ImageIterTileContigRoutine contig;
diff --git a/contrib/pds/tif_pdsdirread.c b/contrib/pds/tif_pdsdirread.c
index cc6231da..19fccb38 100644
--- a/contrib/pds/tif_pdsdirread.c
+++ b/contrib/pds/tif_pdsdirread.c
@@ -55,13 +55,13 @@
#define TIFFCvtIEEEFloatToNative(tif, n, fp)
#define TIFFCvtIEEEDoubleToNative(tif, n, dp)
#else
-extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);
-extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);
+extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32_t, float*);
+extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32_t, double*);
#endif
-static void EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16);
+static void EstimateStripByteCounts(TIFF*, TIFFDirEntry*, uint16_t);
static void MissingRequired(TIFF*, const char*);
-static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);
+static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32_t);
static tsize_t TIFFFetchData(TIFF*, TIFFDirEntry*, char*);
static tsize_t TIFFFetchString(TIFF*, TIFFDirEntry*, char*);
static float TIFFFetchRational(TIFF*, TIFFDirEntry*);
@@ -69,8 +69,8 @@ static int TIFFFetchNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
static int TIFFFetchPerSampleShorts(TIFF*, TIFFDirEntry*, int*);
static int TIFFFetchPerSampleAnys(TIFF*, TIFFDirEntry*, double*);
-static int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16*);
-static int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32**);
+static int TIFFFetchShortArray(TIFF*, TIFFDirEntry*, uint16_t*);
+static int TIFFFetchStripThing(TIFF*, TIFFDirEntry*, long, uint32_t**);
static int TIFFFetchExtraSamples(TIFF*, TIFFDirEntry*);
static int TIFFFetchRefBlackWhite(TIFF*, TIFFDirEntry*);
static float TIFFFetchFloat(TIFF*, TIFFDirEntry*);
@@ -126,8 +126,8 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
double dv;
const TIFFFieldInfo* fip;
int fix;
- uint16 dircount;
- uint32 nextdiroff;
+ uint16_t dircount;
+ uint32_t nextdiroff;
char* cp;
int diroutoforderwarning = 0;
@@ -139,7 +139,7 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
"Seek error accessing TIFF private subdirectory");
return (0);
}
- if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+ if (!ReadOK(tif, &dircount, sizeof (uint16_t))) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Can not read TIFF private subdirectory count");
return (0);
@@ -157,7 +157,7 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
/*
* Read offset to next directory for sequential scans.
*/
- (void) ReadOK(tif, &nextdiroff, sizeof (uint32));
+ (void) ReadOK(tif, &nextdiroff, sizeof (uint32_t));
} else {
toff_t off = pdir_offset;
@@ -166,8 +166,8 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
"Can not read TIFF private subdirectory count");
return (0);
} else
- _TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16));
- off += sizeof (uint16);
+ _TIFFmemcpy(&dircount, tif->tif_base + off, sizeof (uint16_t));
+ off += sizeof (uint16_t);
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabShort(&dircount);
dir = (TIFFDirEntry *)CheckMalloc(tif,
@@ -181,8 +181,8 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
_TIFFmemcpy(dir, tif->tif_base + off,
dircount*sizeof (TIFFDirEntry));
off += dircount* sizeof (TIFFDirEntry);
- if (off + sizeof (uint32) < tif->tif_size)
- _TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32));
+ if (off + sizeof (uint32_t) < tif->tif_size)
+ _TIFFmemcpy(&nextdiroff, tif->tif_base+off, sizeof (uint32_t));
}
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&nextdiroff);
@@ -260,9 +260,9 @@ TIFFReadPrivateDataSubDirectory(TIFF* tif, toff_t pdir_offset,
* Check count if known in advance.
*/
if (fip->field_readcount != TIFF_VARIABLE) {
- uint32 expected = (fip->field_readcount == TIFF_SPP) ?
- (uint32) td->td_samplesperpixel :
- (uint32) fip->field_readcount;
+ uint32_t expected = (fip->field_readcount == TIFF_SPP) ?
+ (uint32_t) td->td_samplesperpixel :
+ (uint32_t) fip->field_readcount;
if (!CheckDirCount(tif, dp, expected))
goto ignore;
}
@@ -283,29 +283,29 @@ bad:
}
static void
-EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount)
{
register TIFFDirEntry *dp;
register TIFFDirectory *td = &tif->tif_dir;
- uint16 i;
+ uint16_t i;
if (td->td_stripbytecount)
_TIFFfree(td->td_stripbytecount);
- td->td_stripbytecount = (uint32*)
- CheckMalloc(tif, td->td_nstrips * sizeof (uint32),
+ td->td_stripbytecount = (uint32_t*)
+ CheckMalloc(tif, td->td_nstrips * sizeof (uint32_t),
"for \"StripByteCounts\" array");
if (td->td_compression != COMPRESSION_NONE) {
- uint32 space = (uint32)(sizeof (TIFFHeader)
- + sizeof (uint16)
+ uint32_t space = (uint32_t)(sizeof (TIFFHeader)
+ + sizeof (uint16_t)
+ (dircount * sizeof (TIFFDirEntry))
- + sizeof (uint32));
+ + sizeof (uint32_t));
toff_t filesize = TIFFGetFileSize(tif);
- uint16 n;
+ uint16_t n;
/* calculate amount of space used by indirect values */
for (dp = dir, n = dircount; n > 0; n--, dp++) {
- uint32 cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
- if (cc > sizeof (uint32))
+ uint32_t cc = dp->tdir_count*TIFFDataWidth(dp->tdir_type);
+ if (cc > sizeof (uint32_t))
space += cc;
}
space = (filesize - space) / td->td_samplesperpixel;
@@ -323,8 +323,8 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
td->td_stripbytecount[i] =
filesize - td->td_stripoffset[i];
} else {
- uint32 rowbytes = TIFFScanlineSize(tif);
- uint32 rowsperstrip = td->td_imagelength / td->td_nstrips;
+ uint32_t rowbytes = TIFFScanlineSize(tif);
+ uint32_t rowsperstrip = td->td_imagelength / td->td_nstrips;
for (i = 0; i < td->td_nstrips; i++)
td->td_stripbytecount[i] = rowbytes*rowsperstrip;
}
@@ -347,7 +347,7 @@ MissingRequired(TIFF* tif, const char* tagname)
* there is a mismatch.
*/
static int
-CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
+CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32_t count)
{
if (count != dir->tdir_count) {
TIFFWarning(tif->tif_name,
@@ -382,16 +382,16 @@ TIFFFetchData(TIFF* tif, TIFFDirEntry* dir, char* cp)
switch (dir->tdir_type) {
case TIFF_SHORT:
case TIFF_SSHORT:
- TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+ TIFFSwabArrayOfShort((uint16_t*) cp, dir->tdir_count);
break;
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
- TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+ TIFFSwabArrayOfLong((uint32_t*) cp, dir->tdir_count);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
- TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+ TIFFSwabArrayOfLong((uint32_t*) cp, 2*dir->tdir_count);
break;
case TIFF_DOUBLE:
TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
@@ -412,7 +412,7 @@ static tsize_t
TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)
{
if (dir->tdir_count <= 4) {
- uint32 l = dir->tdir_offset;
+ uint32_t l = dir->tdir_offset;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&l);
_TIFFmemcpy(cp, &l, dir->tdir_count);
@@ -425,7 +425,7 @@ TIFFFetchString(TIFF* tif, TIFFDirEntry* dir, char* cp)
* Convert numerator+denominator to float.
*/
static int
-cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
+cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32_t num, uint32_t denom, float* rv)
{
if (denom == 0) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
@@ -436,7 +436,7 @@ cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
if (dir->tdir_type == TIFF_RATIONAL)
*rv = ((float)num / (float)denom);
else
- *rv = ((float)(int32)num / (float)(int32)denom);
+ *rv = ((float)(int32_t)num / (float)(int32_t)denom);
return (1);
}
}
@@ -449,7 +449,7 @@ cvtRational(TIFF* tif, TIFFDirEntry* dir, uint32 num, uint32 denom, float* rv)
static float
TIFFFetchRational(TIFF* tif, TIFFDirEntry* dir)
{
- uint32 l[2];
+ uint32_t l[2];
float v;
return (!TIFFFetchData(tif, dir, (char *)l) ||
@@ -473,12 +473,12 @@ TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)
TIFFCvtIEEEFloatToNative(tif, 1, &v);
#else
float v;
- /* This is a little bit tricky - if we just cast the uint32 to a float,
+ /* This is a little bit tricky - if we just cast the uint32_t to a float,
C will perform a numerical conversion, which is not what we want.
- We want to take the actual bit pattern in the uint32 and interpret
- it as a float. Thus we cast a uint32 * into a float * and then
+ We want to take the actual bit pattern in the uint32_t and interpret
+ it as a float. Thus we cast a uint32_t * into a float * and then
dereference to get v. */
- uint32 l = (uint32)
+ uint32_t l = (uint32_t)
TIFFExtractData(tif, dir->tdir_type, dir->tdir_offset);
v = * (float *) &l;
TIFFCvtIEEEFloatToNative(tif, 1, &v);
@@ -491,7 +491,7 @@ TIFFFetchFloat(TIFF* tif, TIFFDirEntry* dir)
* Fetch an array of BYTE or SBYTE values.
*/
static int
-TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16_t* v)
{
if (dir->tdir_count <= 4) {
/*
@@ -521,7 +521,7 @@ TIFFFetchByteArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
* Fetch an array of SHORT or SSHORT values.
*/
static int
-TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
+TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16_t* v)
{
if (dir->tdir_count <= 2) {
if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
@@ -546,7 +546,7 @@ TIFFFetchShortArray(TIFF* tif, TIFFDirEntry* dir, uint16* v)
static int
TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
{
- uint16 v[2];
+ uint16_t v[2];
int ok = 0;
switch (dir->tdir_type) {
@@ -568,7 +568,7 @@ TIFFFetchShortPair(TIFF* tif, TIFFDirEntry* dir)
* Fetch an array of LONG or SLONG values.
*/
static int
-TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32* v)
+TIFFFetchLongArray(TIFF* tif, TIFFDirEntry* dir, uint32_t* v)
{
if (dir->tdir_count == 1) {
v[0] = dir->tdir_offset;
@@ -584,14 +584,14 @@ static int
TIFFFetchRationalArray(TIFF* tif, TIFFDirEntry* dir, float* v)
{
int ok = 0;
- uint32* l;
+ uint32_t* l;
- l = (uint32*)CheckMalloc(tif,
+ l = (uint32_t*)CheckMalloc(tif,
dir->tdir_count*TIFFDataWidth(dir->tdir_type),
"to fetch array of rationals");
if (l) {
if (TIFFFetchData(tif, dir, (char *)l)) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < dir->tdir_count; i++) {
ok = cvtRational(tif, dir,
l[2*i+0], l[2*i+1], &v[i]);
@@ -654,42 +654,42 @@ TIFFFetchAnyArray(TIFF* tif, TIFFDirEntry* dir, double* v)
switch (dir->tdir_type) {
case TIFF_BYTE:
case TIFF_SBYTE:
- if (!TIFFFetchByteArray(tif, dir, (uint16*) v))
+ if (!TIFFFetchByteArray(tif, dir, (uint16_t*) v))
return (0);
if (dir->tdir_type == TIFF_BYTE) {
- uint16* vp = (uint16*) v;
+ uint16_t* vp = (uint16_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
} else {
- int16* vp = (int16*) v;
+ int16_t* vp = (int16_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
}
break;
case TIFF_SHORT:
case TIFF_SSHORT:
- if (!TIFFFetchShortArray(tif, dir, (uint16*) v))
+ if (!TIFFFetchShortArray(tif, dir, (uint16_t*) v))
return (0);
if (dir->tdir_type == TIFF_SHORT) {
- uint16* vp = (uint16*) v;
+ uint16_t* vp = (uint16_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
} else {
- int16* vp = (int16*) v;
+ int16_t* vp = (int16_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
}
break;
case TIFF_LONG:
case TIFF_SLONG:
- if (!TIFFFetchLongArray(tif, dir, (uint32*) v))
+ if (!TIFFFetchLongArray(tif, dir, (uint32_t*) v))
return (0);
if (dir->tdir_type == TIFF_LONG) {
- uint32* vp = (uint32*) v;
+ uint32_t* vp = (uint32_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
} else {
- int32* vp = (int32*) v;
+ int32_t* vp = (int32_t*) v;
for (i = dir->tdir_count-1; i >= 0; i--)
v[i] = vp[i];
}
@@ -747,20 +747,20 @@ TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
case TIFF_SBYTE:
/* NB: always expand BYTE values to shorts */
cp = CheckMalloc(tif,
- dp->tdir_count * sizeof (uint16), mesg);
- ok = cp && TIFFFetchByteArray(tif, dp, (uint16*) cp);
+ dp->tdir_count * sizeof (uint16_t), mesg);
+ ok = cp && TIFFFetchByteArray(tif, dp, (uint16_t*) cp);
break;
case TIFF_SHORT:
case TIFF_SSHORT:
cp = CheckMalloc(tif,
- dp->tdir_count * sizeof (uint16), mesg);
- ok = cp && TIFFFetchShortArray(tif, dp, (uint16*) cp);
+ dp->tdir_count * sizeof (uint16_t), mesg);
+ ok = cp && TIFFFetchShortArray(tif, dp, (uint16_t*) cp);
break;
case TIFF_LONG:
case TIFF_SLONG:
cp = CheckMalloc(tif,
- dp->tdir_count * sizeof (uint32), mesg);
- ok = cp && TIFFFetchLongArray(tif, dp, (uint32*) cp);
+ dp->tdir_count * sizeof (uint32_t), mesg);
+ ok = cp && TIFFFetchLongArray(tif, dp, (uint32_t*) cp);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
@@ -804,9 +804,9 @@ TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
case TIFF_SSHORT:
/*
* If the tag is also acceptable as a LONG or SLONG
- * then (*setFieldFn) will expect an uint32 parameter
+ * then (*setFieldFn) will expect an uint32_t parameter
* passed to it (through varargs). Thus, for machines
- * where sizeof (int) != sizeof (uint32) we must do
+ * where sizeof (int) != sizeof (uint32_t) we must do
* a careful check here. It's hard to say if this
* is worth optimizing.
*
@@ -817,7 +817,7 @@ TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
*/
{ TIFFDataType type = fip->field_type;
if (type != TIFF_LONG && type != TIFF_SLONG) {
- uint16 v = (uint16)
+ uint16_t v = (uint16_t)
TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
ok = (fip->field_passcount ?
(*setFieldFn)(tif, dp->tdir_tag, 1, &v)
@@ -828,7 +828,7 @@ TIFFFetchNormalSubTag(TIFF* tif, TIFFDirEntry* dp, const TIFFFieldInfo* fip,
/* fall through... */
case TIFF_LONG:
case TIFF_SLONG:
- { uint32 v32 =
+ { uint32_t v32 =
TIFFExtractData(tif, dp->tdir_type, dp->tdir_offset);
ok = (fip->field_passcount ?
(*setFieldFn)(tif, dp->tdir_tag, 1, &v32)
@@ -885,12 +885,12 @@ TIFFFetchPerSampleShorts(TIFF* tif, TIFFDirEntry* dir, int* pl)
int samples = tif->tif_dir.td_samplesperpixel;
int status = 0;
- if (CheckDirCount(tif, dir, (uint32) samples)) {
- uint16 buf[10];
- uint16* v = buf;
+ if (CheckDirCount(tif, dir, (uint32_t) samples)) {
+ uint16_t buf[10];
+ uint16_t* v = buf;
if (samples > NITEMS(buf))
- v = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+ v = (uint16_t*) _TIFFmalloc(samples * sizeof (uint16_t));
if (TIFFFetchShortArray(tif, dir, v)) {
int i;
for (i = 1; i < samples; i++)
@@ -921,7 +921,7 @@ TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
int samples = (int) tif->tif_dir.td_samplesperpixel;
int status = 0;
- if (CheckDirCount(tif, dir, (uint32) samples)) {
+ if (CheckDirCount(tif, dir, (uint32_t) samples)) {
double buf[10];
double* v = buf;
@@ -953,31 +953,31 @@ TIFFFetchPerSampleAnys(TIFF* tif, TIFFDirEntry* dir, double* pl)
* in fact it's also used for tiles.
*/
static int
-TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
+TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32_t** lpp)
{
- register uint32* lp;
+ register uint32_t* lp;
int status;
- if (!CheckDirCount(tif, dir, (uint32) nstrips))
+ if (!CheckDirCount(tif, dir, (uint32_t) nstrips))
return (0);
/*
* Allocate space for strip information.
*/
if (*lpp == NULL &&
- (*lpp = (uint32 *)CheckMalloc(tif,
- nstrips * sizeof (uint32), "for strip array")) == NULL)
+ (*lpp = (uint32_t *)CheckMalloc(tif,
+ nstrips * sizeof (uint32_t), "for strip array")) == NULL)
return (0);
lp = *lpp;
if (dir->tdir_type == (int)TIFF_SHORT) {
/*
- * Handle uint16->uint32 expansion.
+ * Handle uint16_t->uint32_t expansion.
*/
- uint16* dp = (uint16*) CheckMalloc(tif,
- dir->tdir_count* sizeof (uint16), "to fetch strip tag");
+ uint16_t* dp = (uint16_t*) CheckMalloc(tif,
+ dir->tdir_count* sizeof (uint16_t), "to fetch strip tag");
if (dp == NULL)
return (0);
if (status = TIFFFetchShortArray(tif, dir, dp)) {
- register uint16* wp = dp;
+ register uint16_t* wp = dp;
while (nstrips-- > 0)
*lp++ = *wp++;
}
@@ -994,12 +994,12 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, long nstrips, uint32** lpp)
static int
TIFFFetchExtraSamples(TIFF* tif, TIFFDirEntry* dir)
{
- uint16 buf[10];
- uint16* v = buf;
+ uint16_t buf[10];
+ uint16_t* v = buf;
int status;
if (dir->tdir_count > NITEMS(buf))
- v = (uint16*) _TIFFmalloc(dir->tdir_count * sizeof (uint16));
+ v = (uint16_t*) _TIFFmalloc(dir->tdir_count * sizeof (uint16_t));
if (dir->tdir_type == TIFF_BYTE)
status = TIFFFetchByteArray(tif, dir, v);
else
@@ -1028,14 +1028,14 @@ TIFFFetchRefBlackWhite(TIFF* tif, TIFFDirEntry* dir)
/*
* Handle LONG's for backward compatibility.
*/
- cp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32), mesg);
- if (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32*) cp))) {
+ cp = CheckMalloc(tif, dir->tdir_count * sizeof (uint32_t), mesg);
+ if (ok = (cp && TIFFFetchLongArray(tif, dir, (uint32_t*) cp))) {
float* fp = (float*)
CheckMalloc(tif, dir->tdir_count * sizeof (float), mesg);
if (ok = (fp != NULL)) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < dir->tdir_count; i++)
- fp[i] = (float)((uint32*) cp)[i];
+ fp[i] = (float)((uint32_t*) cp)[i];
ok = TIFFSetField(tif, dir->tdir_tag, fp);
_TIFFfree((char*) fp);
}
@@ -1058,12 +1058,12 @@ static void
ChopUpSingleUncompressedStrip(TIFF* tif)
{
register TIFFDirectory *td = &tif->tif_dir;
- uint32 bytecount = td->td_stripbytecount[0];
- uint32 offset = td->td_stripoffset[0];
+ uint32_t bytecount = td->td_stripbytecount[0];
+ uint32_t offset = td->td_stripoffset[0];
tsize_t rowbytes = TIFFVTileSize(tif, 1), stripbytes;
tstrip_t strip, nstrips, rowsperstrip;
- uint32* newcounts;
- uint32* newoffsets;
+ uint32_t* newcounts;
+ uint32_t* newoffsets;
/*
* Make the rows hold at least one
@@ -1080,9 +1080,9 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
if (rowsperstrip >= td->td_rowsperstrip)
return;
nstrips = (tstrip_t) TIFFhowmany(bytecount, stripbytes);
- newcounts = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+ newcounts = (uint32_t*) CheckMalloc(tif, nstrips * sizeof (uint32_t),
"for chopped \"StripByteCounts\" array");
- newoffsets = (uint32*) CheckMalloc(tif, nstrips * sizeof (uint32),
+ newoffsets = (uint32_t*) CheckMalloc(tif, nstrips * sizeof (uint32_t),
"for chopped \"StripOffsets\" array");
if (newcounts == NULL || newoffsets == NULL) {
/*
diff --git a/contrib/pds/tif_pdsdirwrite.c b/contrib/pds/tif_pdsdirwrite.c
index 5c161b79..9e51bfbd 100644
--- a/contrib/pds/tif_pdsdirwrite.c
+++ b/contrib/pds/tif_pdsdirwrite.c
@@ -63,31 +63,31 @@
#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
#define TIFFCvtNativeToIEEEDouble(tif, n, dp)
#else
-extern void TIFFCvtNativeToIEEEFloat(TIFF*, uint32, float*);
-extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32, double*);
+extern void TIFFCvtNativeToIEEEFloat(TIFF*, uint32_t, float*);
+extern void TIFFCvtNativeToIEEEDouble(TIFF*, uint32_t, double*);
#endif
static int TIFFWriteNormalTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*);
static int TIFFWriteNormalSubTag(TIFF*, TIFFDirEntry*, const TIFFFieldInfo*,
int (*getFieldFn)(TIFF *tif,ttag_t tag,...));
-static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32);
+static void TIFFSetupShortLong(TIFF*, ttag_t, TIFFDirEntry*, uint32_t);
static int TIFFSetupShortPair(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleShorts(TIFF*, ttag_t, TIFFDirEntry*);
static int TIFFWritePerSampleAnys(TIFF*, TIFFDataType, ttag_t, TIFFDirEntry*);
-static int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32, uint16**);
+static int TIFFWriteShortTable(TIFF*, ttag_t, TIFFDirEntry*, uint32_t, uint16_t**);
static int TIFFWriteShortArray(TIFF*,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint16*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, uint16_t*);
static int TIFFWriteLongArray(TIFF *,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, uint32*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, uint32_t*);
static int TIFFWriteRationalArray(TIFF *,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, float*);
static int TIFFWriteFloatArray(TIFF *,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, float*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, float*);
static int TIFFWriteDoubleArray(TIFF *,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, double*);
static int TIFFWriteByteArray(TIFF*, TIFFDirEntry*, char*);
static int TIFFWriteAnyArray(TIFF*,
- TIFFDataType, ttag_t, TIFFDirEntry*, uint32, double*);
+ TIFFDataType, ttag_t, TIFFDirEntry*, uint32_t, double*);
#ifdef COLORIMETRY_SUPPORT
static int TIFFWriteTransferFunction(TIFF*, TIFFDirEntry*);
#endif
@@ -138,14 +138,14 @@ static int TIFFWriteRational(TIFF*,
*/
toff_t
TIFFWritePrivateDataSubDirectory(TIFF* tif,
- uint32 pdir_fieldsset[], int pdir_fields_last,
+ uint32_t pdir_fieldsset[], int pdir_fields_last,
TIFFFieldInfo *field_info,
int (*getFieldFn)(TIFF *tif, ttag_t tag, ...))
{
- uint16 dircount;
- uint32 diroff, nextdiroff;
+ uint16_t dircount;
+ uint32_t diroff, nextdiroff;
ttag_t tag;
- uint32 nfields;
+ uint32_t nfields;
tsize_t dirsize;
char* data;
TIFFDirEntry* dir;
@@ -188,7 +188,7 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
tif->tif_dataoff =(TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
diroff = tif->tif_dataoff;
tif->tif_dataoff = (toff_t)(
- diroff + sizeof (uint16) + dirsize + sizeof (toff_t));
+ diroff + sizeof (uint16_t) + dirsize + sizeof (toff_t));
if (tif->tif_dataoff & 1)
tif->tif_dataoff++;
(void) TIFFSeekFile(tif, tif->tif_dataoff, SEEK_SET);
@@ -204,9 +204,9 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
* why the original code calls ResetFieldBit(), since we're already
* going through the fields in order...
*
- * fields_size is the number of uint32's we will need to hold the
+ * fields_size is the number of uint32_t's we will need to hold the
* bit-mask for all of the fields. If our highest field number is
- * 100, then we'll need 100 / (8*4)+1 == 4 uint32's to hold the
+ * 100, then we'll need 100 / (8*4)+1 == 4 uint32_t's to hold the
* fieldset.
*
* Unlike the original code, we allocate fields dynamically based
@@ -214,9 +214,9 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
* data subdirectories to contain more than the built-in code's limit
* of 95 tags in a directory.
*/
- fields_size = pdir_fields_last / (8*sizeof(uint32)) + 1;
- fields = _TIFFmalloc(fields_size*sizeof(uint32));
- _TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32));
+ fields_size = pdir_fields_last / (8*sizeof(uint32_t)) + 1;
+ fields = _TIFFmalloc(fields_size*sizeof(uint32_t));
+ _TIFFmemcpy(fields, pdir_fieldsset, fields_size * sizeof(uint32_t));
/* Deleted "write out extra samples tag" code here. */
@@ -243,7 +243,7 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
/*
* Write directory.
*/
- dircount = (uint16) nfields;
+ dircount = (uint16_t) nfields;
/* Deleted code to link to the next directory - we set it to zero! */
nextdiroff = 0;
if (tif->tif_flags & TIFF_SWAB) {
@@ -261,7 +261,7 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
TIFFSwabArrayOfShort(&dir->tdir_tag, 2);
TIFFSwabArrayOfLong(&dir->tdir_count, 2);
}
- dircount = (uint16) nfields;
+ dircount = (uint16_t) nfields;
TIFFSwabShort(&dircount);
TIFFSwabLong(&nextdiroff);
}
@@ -296,7 +296,7 @@ TIFFWritePrivateDataSubDirectory(TIFF* tif,
*/
TIFFDefaultDirectory(tif);
tif->tif_curoff = 0;
- tif->tif_row = (uint32) -1;
+ tif->tif_row = (uint32_t) -1;
tif->tif_curstrip = (tstrip_t) -1;
#endif
@@ -328,7 +328,7 @@ TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
case TIFF_SHORT:
case TIFF_SSHORT:
if (wc > 1) {
- uint16* wp;
+ uint16_t* wp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &wp);
dir->tdir_count = wc;
@@ -337,7 +337,7 @@ TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
if (!WRITEF(TIFFWriteShortArray, wp))
return (0);
} else {
- uint16 sv;
+ uint16_t sv;
(*getFieldFn)(tif, fip->field_tag, &sv);
dir->tdir_offset =
TIFFInsertData(tif, dir->tdir_type, sv);
@@ -346,7 +346,7 @@ TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
case TIFF_LONG:
case TIFF_SLONG:
if (wc > 1) {
- uint32* lp;
+ uint32_t* lp;
if (wc == (u_short) TIFF_VARIABLE) {
(*getFieldFn)(tif, fip->field_tag, &wc, &lp);
dir->tdir_count = wc;
@@ -445,7 +445,7 @@ TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
case TIFF_ASCII:
{ char* cp;
(*getFieldFn)(tif, fip->field_tag, &cp);
- dir->tdir_count = (uint32) (strlen(cp) + 1);
+ dir->tdir_count = (uint32_t) (strlen(cp) + 1);
if (!TIFFWriteByteArray(tif, dir, cp))
return (0);
}
@@ -475,7 +475,7 @@ TIFFWriteNormalSubTag(TIFF* tif, TIFFDirEntry* dir, const TIFFFieldInfo* fip,
* or LONG type according to the value.
*/
static void
-TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32 v)
+TIFFSetupShortLong(TIFF* tif, ttag_t tag, TIFFDirEntry* dir, uint32_t v)
{
dir->tdir_tag = tag;
dir->tdir_count = 1;
@@ -512,12 +512,12 @@ TIFFWriteRational(TIFF* tif,
static int
TIFFWritePerSampleShorts(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
{
- uint16 buf[10], v;
- uint16* w = buf;
+ uint16_t buf[10], v;
+ uint16_t* w = buf;
int i, status, samples = tif->tif_dir.td_samplesperpixel;
if (samples > NITEMS(buf))
- w = (uint16*) _TIFFmalloc(samples * sizeof (uint16));
+ w = (uint16_t*) _TIFFmalloc(samples * sizeof (uint16_t));
TIFFGetField(tif, tag, &v);
for (i = 0; i < samples; i++)
w[i] = v;
@@ -560,7 +560,7 @@ TIFFWritePerSampleAnys(TIFF* tif,
static int
TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
{
- uint16 v[2];
+ uint16_t v[2];
TIFFGetField(tif, tag, &v[0], &v[1]);
return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));
@@ -573,14 +573,14 @@ TIFFSetupShortPair(TIFF* tif, ttag_t tag, TIFFDirEntry* dir)
*/
static int
TIFFWriteShortTable(TIFF* tif,
- ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16** table)
+ ttag_t tag, TIFFDirEntry* dir, uint32_t n, uint16_t** table)
{
- uint32 i, off;
+ uint32_t i, off;
dir->tdir_tag = tag;
dir->tdir_type = (short) TIFF_SHORT;
/* XXX -- yech, fool TIFFWriteData */
- dir->tdir_count = (uint32) (1L<<tif->tif_dir.td_bitspersample);
+ dir->tdir_count = (uint32_t) (1L<<tif->tif_dir.td_bitspersample);
off = tif->tif_dataoff;
for (i = 0; i < n; i++)
if (!TIFFWriteData(tif, dir, (char *)table[i]))
@@ -610,14 +610,14 @@ TIFFWriteByteArray(TIFF* tif, TIFFDirEntry* dir, char* cp)
*/
static int
TIFFWriteShortArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint16* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, uint16_t* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
if (n <= 2) {
if (tif->tif_header.tiff_magic == TIFF_BIGENDIAN) {
- dir->tdir_offset = (uint32) ((long) v[0] << 16);
+ dir->tdir_offset = (uint32_t) ((long) v[0] << 16);
if (n == 2)
dir->tdir_offset |= v[1] & 0xffff;
} else {
@@ -636,7 +636,7 @@ TIFFWriteShortArray(TIFF* tif,
*/
static int
TIFFWriteLongArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, uint32* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, uint32_t* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
@@ -654,20 +654,20 @@ TIFFWriteLongArray(TIFF* tif,
*/
static int
TIFFWriteRationalArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, float* v)
{
- uint32 i;
- uint32* t;
+ uint32_t i;
+ uint32_t* t;
int status;
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
- t = (uint32*) _TIFFmalloc(2*n * sizeof (uint32));
+ t = (uint32_t*) _TIFFmalloc(2*n * sizeof (uint32_t));
for (i = 0; i < n; i++) {
float fv = v[i];
int sign = 1;
- uint32 den;
+ uint32_t den;
if (fv < 0) {
if (type == TIFF_RATIONAL) {
@@ -693,14 +693,14 @@ TIFFWriteRationalArray(TIFF* tif,
static int
TIFFWriteFloatArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, float* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, float* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
dir->tdir_count = n;
TIFFCvtNativeToIEEEFloat(tif, n, v);
if (n == 1) {
- dir->tdir_offset = *(uint32*) &v[0];
+ dir->tdir_offset = *(uint32_t*) &v[0];
return (1);
} else
return (TIFFWriteData(tif, dir, (char*) v));
@@ -708,7 +708,7 @@ TIFFWriteFloatArray(TIFF* tif,
static int
TIFFWriteDoubleArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, double* v)
{
dir->tdir_tag = tag;
dir->tdir_type = (short) type;
@@ -728,7 +728,7 @@ TIFFWriteDoubleArray(TIFF* tif,
*/
static int
TIFFWriteAnyArray(TIFF* tif,
- TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32 n, double* v)
+ TIFFDataType type, ttag_t tag, TIFFDirEntry* dir, uint32_t n, double* v)
{
char buf[10 * sizeof(double)];
char* w = buf;
@@ -760,34 +760,34 @@ TIFFWriteAnyArray(TIFF* tif,
}
break;
case TIFF_SHORT:
- { uint16* bp = (uint16*) w;
+ { uint16_t* bp = (uint16_t*) w;
for (i = 0; i < n; i++)
- bp[i] = (uint16) v[i];
- if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+ bp[i] = (uint16_t) v[i];
+ if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16_t*)bp))
goto out;
}
break;
case TIFF_SSHORT:
- { int16* bp = (int16*) w;
+ { int16_t* bp = (int16_t*) w;
for (i = 0; i < n; i++)
- bp[i] = (int16) v[i];
- if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16*)bp))
+ bp[i] = (int16_t) v[i];
+ if (!TIFFWriteShortArray(tif, type, tag, dir, n, (uint16_t*)bp))
goto out;
}
break;
case TIFF_LONG:
- { uint32* bp = (uint32*) w;
+ { uint32_t* bp = (uint32_t*) w;
for (i = 0; i < n; i++)
- bp[i] = (uint32) v[i];
+ bp[i] = (uint32_t) v[i];
if (!TIFFWriteLongArray(tif, type, tag, dir, n, bp))
goto out;
}
break;
case TIFF_SLONG:
- { int32* bp = (int32*) w;
+ { int32_t* bp = (int32_t*) w;
for (i = 0; i < n; i++)
- bp[i] = (int32) v[i];
- if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32*) bp))
+ bp[i] = (int32_t) v[i];
+ if (!TIFFWriteLongArray(tif, type, tag, dir, n, (uint32_t*) bp))
goto out;
}
break;
@@ -821,8 +821,8 @@ static int
TIFFWriteTransferFunction(TIFF* tif, TIFFDirEntry* dir)
{
TIFFDirectory* td = &tif->tif_dir;
- tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16);
- uint16** tf = td->td_transferfunction;
+ tsize_t n = (1L<<td->td_bitspersample) * sizeof (uint16_t);
+ uint16_t** tf = td->td_transferfunction;
int ncols;
/*
@@ -853,16 +853,16 @@ TIFFWriteData(TIFF* tif, TIFFDirEntry* dir, char* cp)
switch (dir->tdir_type) {
case TIFF_SHORT:
case TIFF_SSHORT:
- TIFFSwabArrayOfShort((uint16*) cp, dir->tdir_count);
+ TIFFSwabArrayOfShort((uint16_t*) cp, dir->tdir_count);
break;
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
- TIFFSwabArrayOfLong((uint32*) cp, dir->tdir_count);
+ TIFFSwabArrayOfLong((uint32_t*) cp, dir->tdir_count);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
- TIFFSwabArrayOfLong((uint32*) cp, 2*dir->tdir_count);
+ TIFFSwabArrayOfLong((uint32_t*) cp, 2*dir->tdir_count);
break;
case TIFF_DOUBLE:
TIFFSwabArrayOfDouble((double*) cp, dir->tdir_count);
@@ -889,11 +889,11 @@ static int
TIFFLinkDirectory(TIFF* tif)
{
static const char module[] = "TIFFLinkDirectory";
- uint32 nextdir;
- uint32 diroff;
+ uint32_t nextdir;
+ uint32_t diroff;
tif->tif_diroff = (TIFFSeekFile(tif, (toff_t) 0, SEEK_END)+1) &~ 1;
- diroff = (uint32) tif->tif_diroff;
+ diroff = (uint32_t) tif->tif_diroff;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&diroff);
#if SUBIFD_SUPPORT
@@ -921,7 +921,7 @@ TIFFLinkDirectory(TIFF* tif)
/*
* First directory, overwrite offset in header.
*/
- tif->tif_header.tiff_diroff = (uint32) tif->tif_diroff;
+ tif->tif_header.tiff_diroff = (uint32_t) tif->tif_diroff;
#define HDROFF(f) ((toff_t) &(((TIFFHeader*) 0)->f))
(void) TIFFSeekFile(tif, HDROFF(tiff_diroff), SEEK_SET);
if (!WriteOK(tif, &diroff, sizeof (diroff))) {
@@ -935,7 +935,7 @@ TIFFLinkDirectory(TIFF* tif)
*/
nextdir = tif->tif_header.tiff_diroff;
do {
- uint16 dircount;
+ uint16_t dircount;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount, sizeof (dircount))) {
diff --git a/contrib/tags/maketif.c b/contrib/tags/maketif.c
index e965201a..41ca8859 100644
--- a/contrib/tags/maketif.c
+++ b/contrib/tags/maketif.c
@@ -36,7 +36,7 @@ failure:
void SetUpTIFFDirectory(TIFF *tif)
{
double mymulti[6]={0.0,1.0,2.0, 3.1415926, 5.0,1.0};
- uint32 mysingle=3456;
+ uint32_t mysingle=3456;
char *ascii="This file was produced by Steven Spielberg. NOT";
TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,WIDTH);
diff --git a/contrib/tags/xtif_dir.c b/contrib/tags/xtif_dir.c
index 35295526..628bc415 100644
--- a/contrib/tags/xtif_dir.c
+++ b/contrib/tags/xtif_dir.c
@@ -91,7 +91,7 @@ _XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
xtiff *xt = XTIFFDIR(tif);
XTIFFDirectory* xd = &xt->xtif_dir;
int status = 1;
- uint32 v32=0;
+ uint32_t v32=0;
int i=0, v=0;
va_list ap1 = ap;
@@ -104,12 +104,12 @@ _XTIFFVSetField(TIFF* tif, ttag_t tag, va_list ap)
*/
case TIFFTAG_EXAMPLE_MULTI:
/* multi-valued tags need to store the count as well */
- xd->xd_num_multi = (uint16) va_arg(ap, int);
+ xd->xd_num_multi = (uint16_t) va_arg(ap, int);
_TIFFsetDoubleArray(&xd->xd_example_multi, va_arg(ap, double*),
(long) xd->xd_num_multi);
break;
case TIFFTAG_EXAMPLE_SINGLE:
- xd->xd_example_single = va_arg(ap, uint32);
+ xd->xd_example_single = va_arg(ap, uint32_t);
break;
case TIFFTAG_EXAMPLE_ASCII:
_TIFFsetString(&xd->xd_example_ascii, va_arg(ap, char*));
@@ -162,14 +162,14 @@ _XTIFFVGetField(TIFF* tif, ttag_t tag, va_list ap)
* example tags with your own.
*/
case TIFFTAG_EXAMPLE_MULTI:
- *va_arg(ap, uint16*) = xd->xd_num_multi;
+ *va_arg(ap, uint16_t*) = xd->xd_num_multi;
*va_arg(ap, double**) = xd->xd_example_multi;
break;
case TIFFTAG_EXAMPLE_ASCII:
*va_arg(ap, char**) = xd->xd_example_ascii;
break;
case TIFFTAG_EXAMPLE_SINGLE:
- *va_arg(ap, uint32*) = xd->xd_example_single;
+ *va_arg(ap, uint32_t*) = xd->xd_example_single;
break;
default:
/* return inherited method */
diff --git a/contrib/tags/xtiffiop.h b/contrib/tags/xtiffiop.h
index 9d534a83..5220e20d 100644
--- a/contrib/tags/xtiffiop.h
+++ b/contrib/tags/xtiffiop.h
@@ -32,9 +32,9 @@
/* XXX - Define Private directory tag structure here */
struct XTIFFDirectory {
- uint16 xd_num_multi; /* dir-count for the multi tag */
+ uint16_t xd_num_multi; /* dir-count for the multi tag */
double* xd_example_multi;
- uint32 xd_example_single;
+ uint32_t xd_example_single;
char* xd_example_ascii;
};
typedef struct XTIFFDirectory XTIFFDirectory;
@@ -45,7 +45,7 @@ typedef struct XTIFFDirectory XTIFFDirectory;
struct xtiff {
TIFF *xtif_tif; /* parent TIFF pointer */
- uint32 xtif_flags;
+ uint32_t xtif_flags;
#define XTIFFP_PRINT 0x00000001
XTIFFDirectory xtif_dir; /* internal rep of current directory */
TIFFVSetMethod xtif_vsetfield; /* inherited tag set routine */
diff --git a/contrib/win_dib/Tiffile.cpp b/contrib/win_dib/Tiffile.cpp
index ca2acd43..27e29b5f 100644
--- a/contrib/win_dib/Tiffile.cpp
+++ b/contrib/win_dib/Tiffile.cpp
@@ -40,7 +40,7 @@ struct TIFFDibImage {
HANDLE LoadTIFFinDIB(LPCTSTR lpFileName);
-HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster) ;
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32_t* raster) ;
static void
MyWarningHandler(const char* module, const char* fmt, va_list ap)
@@ -99,12 +99,12 @@ PVOID ReadTIFF ( LPCTSTR lpszPath )
if (TIFFRGBAImageBegin(&img.tif, tif, -1, emsg)) {
size_t npixels;
- uint32* raster;
+ uint32_t* raster;
DibInstallHack(&img);
npixels = img.tif.width * img.tif.height;
- raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
+ raster = (uint32_t*) _TIFFmalloc(npixels * sizeof (uint32_t));
if (raster != NULL) {
if (TIFFRGBAImageGet(&img.tif, raster, img.tif.width, img.tif.height)) {
pDIB = TIFFRGBA2DIB(&img, raster);
@@ -128,17 +128,17 @@ PVOID ReadTIFF ( LPCTSTR lpszPath )
-HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32* raster)
+HANDLE TIFFRGBA2DIB(TIFFDibImage* dib, uint32_t* raster)
{
void* pDIB = 0;
TIFFRGBAImage* img = &dib->tif;
- uint32 imageLength;
- uint32 imageWidth;
- uint16 BitsPerSample;
- uint16 SamplePerPixel;
- uint32 RowsPerStrip;
- uint16 PhotometricInterpretation;
+ uint32_t imageLength;
+ uint32_t imageWidth;
+ uint16_t BitsPerSample;
+ uint16_t SamplePerPixel;
+ uint32_t RowsPerStrip;
+ uint16_t PhotometricInterpretation;
BITMAPINFOHEADER bi;
int dwDIBSize ;
@@ -273,25 +273,25 @@ typedef unsigned char u_char;
#define DECLAREContigPutFunc(name) \
static void name(\
TIFFRGBAImage* img, \
- uint32* cp, \
- uint32 x, uint32 y, \
- uint32 w, uint32 h, \
- int32 fromskew, int32 toskew, \
+ uint32_t* cp, \
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h, \
+ int32_t fromskew, int32_t toskew, \
u_char* pp \
)
#define DECLARESepPutFunc(name) \
static void name(\
TIFFRGBAImage* img,\
- uint32* cp,\
- uint32 x, uint32 y, \
- uint32 w, uint32 h,\
- int32 fromskew, int32 toskew,\
+ uint32_t* cp,\
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h,\
+ int32_t fromskew, int32_t toskew,\
u_char* r, u_char* g, u_char* b, u_char* a\
)
DECLAREContigPutFunc(putContig1bitTile);
-static int getStripContig1Bit(TIFFRGBAImage* img, uint32* uraster, uint32 w, uint32 h);
+static int getStripContig1Bit(TIFFRGBAImage* img, uint32_t* uraster, uint32_t w, uint32_t h);
//typdef struct TIFFDibImage {
// TIFFRGBAImage tif;
@@ -348,11 +348,11 @@ DECLAREContigPutFunc(putContig1bitTile)
/*
* Hacked from the tif_getimage.c file.
*/
-static uint32
-setorientation(TIFFRGBAImage* img, uint32 h)
+static uint32_t
+setorientation(TIFFRGBAImage* img, uint32_t h)
{
TIFF* tif = img->tif;
- uint32 y;
+ uint32_t y;
switch (img->orientation) {
case ORIENTATION_BOTRIGHT:
@@ -390,22 +390,22 @@ setorientation(TIFFRGBAImage* img, uint32 h)
* for 1-bit bitmaps
*/
static int
-getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+getStripContig1Bit(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
tileContigRoutine put = img->put.contig;
- uint16 orientation;
- uint32 row, y, nrow, rowstoread;
- uint32 pos;
+ uint16_t orientation;
+ uint32_t row, y, nrow, rowstoread;
+ uint32_t pos;
u_char* buf;
- uint32 rowsperstrip;
- uint32 imagewidth = img->width;
+ uint32_t rowsperstrip;
+ uint32_t imagewidth = img->width;
tsize_t scanline;
- int32 fromskew, toskew;
+ int32_t fromskew, toskew;
tstrip_t strip;
tsize_t stripsize;
u_char* braster = (u_char*)raster; // byte wide raster
- uint32 wb = WIDTHBYTES(w);
+ uint32_t wb = WIDTHBYTES(w);
int ret = 1;
buf = (u_char*) _TIFFmalloc(TIFFStripSize(tif));
@@ -415,7 +415,7 @@ getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
}
y = setorientation(img, h);
orientation = img->orientation;
- toskew = -(int32) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);
+ toskew = -(int32_t) (orientation == ORIENTATION_TOPLEFT ? wb+wb : wb-wb);
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
scanline = TIFFScanlineSize(tif);
fromskew = (w < imagewidth ? imagewidth - w : 0)/8;
@@ -433,8 +433,8 @@ getStripContig1Bit(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
}
pos = ((row + img->row_offset) % rowsperstrip) * scanline;
- (*put)(img, (uint32*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);
- y += (orientation == ORIENTATION_TOPLEFT ?-(int32) nrow : (int32) nrow);
+ (*put)(img, (uint32_t*)(braster+y*wb), 0, y, w, nrow, fromskew, toskew, buf + pos);
+ y += (orientation == ORIENTATION_TOPLEFT ?-(int32_t) nrow : (int32_t) nrow);
}
_TIFFfree(buf);
return (ret);
diff --git a/contrib/win_dib/tiff2dib.c b/contrib/win_dib/tiff2dib.c
index 02c29060..5b9e1747 100644
--- a/contrib/win_dib/tiff2dib.c
+++ b/contrib/win_dib/tiff2dib.c
@@ -30,7 +30,7 @@ static HDIB CreateDIB(DWORD dwWidth, DWORD dwHeight, WORD wBitCount);
static LPSTR FindDIBBits(LPSTR lpDIB);
static WORD PaletteSize(LPSTR lpDIB);
static WORD DIBNumColors(LPSTR lpDIB);
-static int checkcmap(int n, uint16* r, uint16* g, uint16* b);
+static int checkcmap(int n, uint16_t* r, uint16_t* g, uint16_t* b);
@@ -127,10 +127,10 @@ HDIB LoadTIFFinDIB(LPSTR lpFileName)
//PhotometricInterpretation = 3 image have a color palette
if (PhotometricInterpretation == 3)
{
- uint16* red;
- uint16* green;
- uint16* blue;
- int16 i;
+ uint16_t* red;
+ uint16_t* green;
+ uint16_t* blue;
+ int16_t i;
LPBITMAPINFO lpbmi;
int Palette16Bits;
@@ -220,7 +220,7 @@ imageWidth*SamplePerPixel);
}
-static int checkcmap(int n, uint16* r, uint16* g, uint16* b)
+static int checkcmap(int n, uint16_t* r, uint16_t* g, uint16_t* b)
{
while (n-- > 0)
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
diff --git a/html/addingtags.html b/html/addingtags.html
index bd4b972a..7e197e25 100644
--- a/html/addingtags.html
+++ b/html/addingtags.html
@@ -239,7 +239,7 @@ add appropriate handling as follows:
<P>
If you want to maintain portability, beware of making assumptions
-about data types. Use the typedefs (<TT>uint16</TT>, etc. when dealing with
+about data types. Use the typedefs (<TT>uint16_t</TT>, etc. when dealing with
data on disk and <TT>t*_t</TT> when stuff is in memory) and be careful about
passing items through printf or similar vararg interfaces.
diff --git a/html/internals.html b/html/internals.html
index 55b14da4..da2998ae 100644
--- a/html/internals.html
+++ b/html/internals.html
@@ -327,37 +327,37 @@ purely by fiddling with the following machine-dependent typedefs:
<TABLE BORDER CELLPADDING=3 WIDTH="100%">
<TR>
-<TD>uint8</TD>
+<TD>uint8_t</TD>
<TD>8-bit unsigned integer</TD>
<TD>tiff.h</TD>
</TR>
<TR>
-<TD>int8</TD>
+<TD>int8_t</TD>
<TD>8-bit signed integer</TD>
<TD>tiff.h</TD>
</TR>
<TR>
-<TD>uint16</TD>
+<TD>uint16_t</TD>
<TD>16-bit unsigned integer</TD>
<TD>tiff.h</TD>
</TR>
<TR>
-<TD>int16</TD>
+<TD>int16_t</TD>
<TD>16-bit signed integer</TD>
<TD>tiff.h</TD>
</TR>
<TR>
-<TD>uint32</TD>
+<TD>uint32_t</TD>
<TD>32-bit unsigned integer</TD>
<TD>tiff.h</TD>
</TR>
<TR>
-<TD>int32</TD>
+<TD>int32_t</TD>
<TD>32-bit signed integer</TD>
<TD>tiff.h</TD>
</TR>
@@ -388,23 +388,23 @@ structure:
</TR>
<TR>
-<TD>typedef uint16 tdir_t;</TD> <TD>directory index</TD>
+<TD>typedef uint16_t tdir_t;</TD> <TD>directory index</TD>
</TR>
<TR>
-<TD>typedef uint16 tsample_t;</TD> <TD>sample number</TD>
+<TD>typedef uint16_t tsample_t;</TD> <TD>sample number</TD>
</TR>
<TR>
-<TD>typedef uint32 tstrip_t;</TD> <TD>strip number</TD>
+<TD>typedef uint32_t tstrip_t;</TD> <TD>strip number</TD>
</TR>
<TR>
-<TD>typedef uint32 ttile_t;</TD> <TD>tile number</TD>
+<TD>typedef uint32_t ttile_t;</TD> <TD>tile number</TD>
</TR>
<TR>
-<TD>typedef int32 tsize_t;</TD> <TD>i/o size in bytes</TD>
+<TD>typedef int32_t tsize_t;</TD> <TD>i/o size in bytes</TD>
</TR>
<TR>
@@ -416,7 +416,7 @@ structure:
</TR>
<TR>
-<TD>typedef int32 toff_t;</TD> <TD>file offset (should be off_t)</TD>
+<TD>typedef int32_t toff_t;</TD> <TD>file offset (should be off_t)</TD>
</TR>
<TR>
@@ -438,7 +438,7 @@ be an arbitrary size (without penalty). <TT>ttag_t</TT> must be either
because the library uses a varargs
interface and ANSI C restricts the type of the parameter before an
ellipsis to be a promoted type. <TT>toff_t</TT> is defined as
-<TT>int32</TT> because
+<TT>int32_t</TT> because
TIFF file offsets are (unsigned) 32-bit quantities. A signed
value is used because some interfaces return -1 on error (sigh).
Finally, note that <TT>tidata_t</TT> is used internally to the library to
diff --git a/html/libtiff.html b/html/libtiff.html
index c673b4ff..7698ef54 100644
--- a/html/libtiff.html
+++ b/html/libtiff.html
@@ -375,14 +375,14 @@
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen(argv[1], "r");<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 w, h;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t w, h;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t* raster;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;w);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;h);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = w * h;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32_t*) _TIFFmalloc(npixels * sizeof (uint32_t));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFReadRGBAImage(tif, w, h, raster, 0)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>
@@ -417,10 +417,10 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageBegin(&amp;img, tif, 0, emsg)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;size_t npixels;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* raster;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t* raster;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;npixels = img.width * img.height;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;raster = (uint32_t*) _TIFFmalloc(npixels * sizeof (uint32_t));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (raster != NULL) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (TIFFRGBAImageGet(&amp;img, raster, img.width, img.height)) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;...process raster data...<br>
@@ -511,9 +511,9 @@
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t imagelength;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t row;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;buf = _TIFFmalloc(TIFFScanlineSize(tif));<br>
@@ -538,9 +538,9 @@
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imagelength;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t imagelength;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 row;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t row;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;imagelength);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &amp;config);<br>
@@ -549,7 +549,7 @@
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (row = 0; row &lt; imagelength; row++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFReadScanline(tif, buf, row, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else if (config == planarconfig_separate) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint16 s, nsamples;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint16_t s, nsamples;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tiffgetfield(tif, tifftag_samplesperpixel, &amp;nsamples);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (s = 0; s &lt; nsamples; s++)<br>
@@ -635,8 +635,8 @@
&nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tstrip_t strip;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32* bc;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 stripsize;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t* bc;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t stripsize;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_STRIPBYTECOUNTS, &amp;bc);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stripsize = bc[0];<br>
@@ -689,9 +689,9 @@
{<br>
&nbsp;&nbsp;&nbsp;&nbsp;TIFF* tif = TIFFOpen("myfile.tif", "r");<br>
&nbsp;&nbsp;&nbsp;&nbsp;if (tif) {<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 imageWidth, imageLength;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 tileWidth, tileLength;<br>
- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32 x, y;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t imageWidth, imageLength;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t tileWidth, tileLength;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;uint32_t x, y;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tdata_t buf;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;imageWidth);<br>
diff --git a/html/man/TIFFFieldPassCount.3tiff.html b/html/man/TIFFFieldPassCount.3tiff.html
index 5dc31262..4f6c6ad3 100644
--- a/html/man/TIFFFieldPassCount.3tiff.html
+++ b/html/man/TIFFFieldPassCount.3tiff.html
@@ -67,9 +67,9 @@ field information pointer previously returned by
<b>TIFFFieldWithName</b>.</p>
<p style="margin-left:11%; margin-top: 1em">When a
-<i>count</i> is required, it will be of type <b>uint32</b>
+<i>count</i> is required, it will be of type <b>uint32_t</b>
when <b>TIFFFieldReadCount</b> reports
-<b>TIFF_VARIABLE2</b>, and of type <b>uint16</b> otherwise.
+<b>TIFF_VARIABLE2</b>, and of type <b>uint16_t</b> otherwise.
(This distinction is critical for use of
<b>TIFFGetField</b>, but normally not so for use of
<b>TIFFSetField</b>.)</p>
diff --git a/html/man/TIFFFieldReadCount.3tiff.html b/html/man/TIFFFieldReadCount.3tiff.html
index d800a861..6a0b1359 100644
--- a/html/man/TIFFFieldReadCount.3tiff.html
+++ b/html/man/TIFFFieldReadCount.3tiff.html
@@ -63,12 +63,12 @@ should be supplied to <b>TIFFGetField</b>. For most field
types this is a small positive integer, typically 1 or 2,
but there are some special values: <b><br>
TIFF_VARIABLE</b> indicates that a variable number of values
-is possible; then, a <b>uint16</b> <i>count</i> argument and
+is possible; then, a <b>uint16_t</b> <i>count</i> argument and
a pointer <i>data</i> argument must be supplied to
<b>TIFFGetField</b>. <b><br>
TIFF_VARIABLE2</b> is the same as <b>TIFF_VARIABLE</b>
except that the <i>count</i> argument must have type
-<b>uint32</b>. <b><br>
+<b>uint32_t</b>. <b><br>
TIFF_SPP</b> indicates that the number of arguments is equal
to the image&rsquo;s number of samples per pixel.</p>
diff --git a/html/man/TIFFFieldTag.3tiff.html b/html/man/TIFFFieldTag.3tiff.html
index b1fdea0f..05a13a71 100644
--- a/html/man/TIFFFieldTag.3tiff.html
+++ b/html/man/TIFFFieldTag.3tiff.html
@@ -45,7 +45,7 @@
<p style="margin-left:11%; margin-top: 1em"><b>#include
&lt;tiffio.h&gt;</b></p>
-<p style="margin-left:11%; margin-top: 1em"><b>uint32
+<p style="margin-left:11%; margin-top: 1em"><b>uint32_t
TIFFFieldTag(const TIFFField*</b> <i>fip</i><b>)</b></p>
<h2>DESCRIPTION
diff --git a/html/man/TIFFFieldWriteCount.3tiff.html b/html/man/TIFFFieldWriteCount.3tiff.html
index 0d446bc7..31f27f51 100644
--- a/html/man/TIFFFieldWriteCount.3tiff.html
+++ b/html/man/TIFFFieldWriteCount.3tiff.html
@@ -63,12 +63,12 @@ should be supplied to <b>TIFFSetField</b>. For most field
types this is a small positive integer, typically 1 or 2,
but there are some special values: <b><br>
TIFF_VARIABLE</b> indicates that a variable number of values
-is possible; then, a <b>uint16</b> <i>count</i> argument and
+is possible; then, a <b>uint16_t</b> <i>count</i> argument and
a pointer <i>data</i> argument must be supplied to
<b>TIFFSetField</b>. <b><br>
TIFF_VARIABLE2</b> is the same as <b>TIFF_VARIABLE</b>
except that the <i>count</i> argument must have type
-<b>uint32</b>. (On most modern machines, this makes no
+<b>uint32_t</b>. (On most modern machines, this makes no
practical difference, and the <i>count</i> argument can
simply be an <b>int</b> in either case.) <b><br>
TIFF_SPP</b> indicates that the number of arguments must be
diff --git a/html/man/TIFFGetField.3tiff.html b/html/man/TIFFGetField.3tiff.html
index cbbb8be7..ac2ca912 100644
--- a/html/man/TIFFGetField.3tiff.html
+++ b/html/man/TIFFGetField.3tiff.html
@@ -183,7 +183,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -206,7 +206,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -229,7 +229,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -252,7 +252,7 @@ values.</p>
<td width="28%">
-<p>uint16**</p></td>
+<p>uint16_t**</p></td>
<td width="12%">
@@ -277,7 +277,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -300,7 +300,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -346,7 +346,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -415,7 +415,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -438,7 +438,7 @@ values.</p>
<td width="28%">
-<p>uint16*,uint16**</p></td>
+<p>uint16_t*,uint16_t**</p></td>
<td width="12%">
@@ -513,7 +513,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -536,7 +536,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -559,7 +559,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -582,7 +582,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -628,7 +628,7 @@ values.</p>
<td width="28%">
-<p>uint32*,void**</p></td>
+<p>uint32_t*,void**</p></td>
<td width="12%">
@@ -653,7 +653,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -699,7 +699,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -722,7 +722,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -768,7 +768,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -841,7 +841,7 @@ values.</p>
<td width="28%">
-<p>uint32*,void**</p></td>
+<p>uint32_t*,void**</p></td>
<td width="12%">
@@ -914,7 +914,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -937,7 +937,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -960,7 +960,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1006,7 +1006,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1052,7 +1052,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1075,7 +1075,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1098,7 +1098,7 @@ values.</p>
<td width="28%">
-<p>uint32*,void**</p></td>
+<p>uint32_t*,void**</p></td>
<td width="12%">
@@ -1123,7 +1123,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1146,7 +1146,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1219,7 +1219,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1242,7 +1242,7 @@ values.</p>
<td width="28%">
-<p>uint32*,void**</p></td>
+<p>uint32_t*,void**</p></td>
<td width="12%">
@@ -1267,7 +1267,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1290,7 +1290,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1313,7 +1313,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1428,7 +1428,7 @@ values.</p>
<td width="28%">
-<p>uint32**</p></td>
+<p>uint32_t**</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1451,7 +1451,7 @@ values.</p>
<td width="28%">
-<p>uint32**</p></td>
+<p>uint32_t**</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1474,7 +1474,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1497,7 +1497,7 @@ values.</p>
<td width="28%">
-<p>uint16*,uint32**</p></td>
+<p>uint16_t*,uint32_t**</p></td>
<td width="12%">
@@ -1545,7 +1545,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1568,7 +1568,7 @@ values.</p>
<td width="28%">
-<p>uint32**</p></td>
+<p>uint32_t**</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1591,7 +1591,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1614,7 +1614,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1637,7 +1637,7 @@ values.</p>
<td width="28%">
-<p>uint32**</p></td>
+<p>uint32_t**</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1660,7 +1660,7 @@ values.</p>
<td width="28%">
-<p>uint32*</p></td>
+<p>uint32_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1677,7 +1677,7 @@ values.</p>
<td width="12%">
-<p>uint16**1&lt;&lt;BitsPerSample entry arrays</p></td></tr>
+<p>uint16_t**1&lt;&lt;BitsPerSample entry arrays</p></td></tr>
<tr valign="top" align="left">
<td width="11%"></td>
<td width="38%">
@@ -1723,7 +1723,7 @@ values.</p>
<td width="28%">
-<p>uint32*,void**</p></td>
+<p>uint32_t*,void**</p></td>
<td width="12%">
@@ -1819,7 +1819,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1842,7 +1842,7 @@ values.</p>
<td width="28%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="12%">
</td></tr>
<tr valign="top" align="left">
@@ -1914,14 +1914,14 @@ you want to read the LONG value from the tag 33424 and ASCII
string from the tag 36867 you can use the following
code:</p>
-<p style="margin-left:22%; margin-top: 1em">uint16 count;
+<p style="margin-left:22%; margin-top: 1em">uint16_t count;
<br>
void *data;</p>
<p style="margin-left:22%; margin-top: 1em">TIFFGetField(tiff,
33424, &amp;count, &amp;data); <br>
-printf(&quot;Tag %d: %d, count %d0, 33424, *(uint32 *)data,
+printf(&quot;Tag %d: %d, count %d0, 33424, *(uint32_t *)data,
count); <br>
TIFFGetField(tiff, 36867, &amp;count, &amp;data); <br>
printf(&quot;Tag %d: %s, count %d0, 36867, (char *)data,
diff --git a/html/man/TIFFRGBAImage.3tiff.html b/html/man/TIFFRGBAImage.3tiff.html
index 83581f11..1d97e53e 100644
--- a/html/man/TIFFRGBAImage.3tiff.html
+++ b/html/man/TIFFRGBAImage.3tiff.html
@@ -53,8 +53,8 @@ int TIFFRGBAImageBegin(TIFFRGBAImage *</b><i>img</i><b>,
TIFF*</b> <i>tif</i><b>, int</b> <i>stopOnError</i><b>,
char</b> <i>emsg[1024]</i><b>)<br>
int TIFFRGBAImageGet(TIFFRGBAImage *</b><i>img</i><b>,
-uint32*</b> <i>raster</i><b>, uint32</b> <i>width</i> <b>,
-uint32</b> <i>height</i><b>)<br>
+uint32_t*</b> <i>raster</i><b>, uint32_t</b> <i>width</i> <b>,
+uint32_t</b> <i>height</i><b>)<br>
void TIFFRGBAImageEnd(TIFFRGBAImage
*</b><i>img</i><b>)</b></p>
</td>
@@ -169,9 +169,9 @@ after each display operation. For example, the
update the display as the raster is being filled:</p>
<!-- INDENTATION -->
<pre>static void
-putContigAndDraw(TIFFRGBAImage* img, uint32* raster,
- uint32 x, uint32 y, uint32 w, uint32 h,
- int32 fromskew, int32 toskew,
+putContigAndDraw(TIFFRGBAImage* img, uint32_t* raster,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+ int32_t fromskew, int32_t toskew,
unsigned char* cp)
{
(*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);
diff --git a/html/man/TIFFReadRGBAImage.3tiff.html b/html/man/TIFFReadRGBAImage.3tiff.html
index 5bf6527f..37578bc5 100644
--- a/html/man/TIFFReadRGBAImage.3tiff.html
+++ b/html/man/TIFFReadRGBAImage.3tiff.html
@@ -47,12 +47,12 @@ and decode an image into a fixed-format raster</p>
0xff)</b></p>
<!-- INDENTATION -->
<p><b>int TIFFReadRGBAImage(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>width</i><b>, uint32</b> <i>height</i><b>,
-uint32 *</b><i>raster</i><b>, int</b>
+uint32_t</b> <i>width</i><b>, uint32_t</b> <i>height</i><b>,
+uint32_t *</b><i>raster</i><b>, int</b>
<i>stopOnError</i><b>)<br>
int TIFFReadRGBAImageOriented(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>width</i><b>, uint32</b> <i>height</i><b>,
-uint32 *</b><i>raster</i><b>, int</b> <i>orientation</i><b>,
+uint32_t</b> <i>width</i><b>, uint32_t</b> <i>height</i><b>,
+uint32_t *</b><i>raster</i><b>, int</b> <i>orientation</i><b>,
int</b> <i>stopOnError</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFReadRGBAStrip.3tiff.html b/html/man/TIFFReadRGBAStrip.3tiff.html
index 3358df7d..2d6caeb7 100644
--- a/html/man/TIFFReadRGBAStrip.3tiff.html
+++ b/html/man/TIFFReadRGBAStrip.3tiff.html
@@ -47,7 +47,7 @@ into a fixed-format raster</p>
0xff)</b></p>
<!-- INDENTATION -->
<p><b>int TIFFReadRGBAStrip(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>row</i><b>, uint32
+uint32_t</b> <i>row</i><b>, uint32_t
*</b><i>raster</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFReadRGBATile.3tiff.html b/html/man/TIFFReadRGBATile.3tiff.html
index bdbb43cc..ea37f7e1 100644
--- a/html/man/TIFFReadRGBATile.3tiff.html
+++ b/html/man/TIFFReadRGBATile.3tiff.html
@@ -100,7 +100,7 @@ into a fixed-format raster</p>
<td width="8%"></td>
<td width="91%">
<p><b>int TIFFReadRGBATile(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>x</i><b>, uint32</b> <i>y</i><b>, uint32
+uint32_t</b> <i>x</i><b>, uint32_t</b> <i>y</i><b>, uint32_t
*</b><i>raster</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFReadScanline.3tiff.html b/html/man/TIFFReadScanline.3tiff.html
index 79f17fcd..11d60c45 100644
--- a/html/man/TIFFReadScanline.3tiff.html
+++ b/html/man/TIFFReadScanline.3tiff.html
@@ -42,7 +42,7 @@ data from an open <small>TIFF</small> file</p>
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
<p><b>int TIFFReadScanline(TIFF *</b><i>tif</i><b>,
-tdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32_t</b> <i>row</i><b>,
tsample_t</b> <i>sample</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFReadTile.3tiff.html b/html/man/TIFFReadTile.3tiff.html
index 26054803..11db5ed6 100644
--- a/html/man/TIFFReadTile.3tiff.html
+++ b/html/man/TIFFReadTile.3tiff.html
@@ -41,8 +41,8 @@ an open <small>TIFF</small> file</p>
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
<p><b>tsize_t TIFFReadTile(TIFF *</b><i>tif</i><b>,
-tdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,
-uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32_t</b> <i>x</i><b>,
+uint32_t</b> <i>y</i><b>, uint32_t</b> <i>z</i><b>,
tsample_t</b> <i>sample</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFSetDirectory.3tiff.html b/html/man/TIFFSetDirectory.3tiff.html
index c3434056..be90c933 100644
--- a/html/man/TIFFSetDirectory.3tiff.html
+++ b/html/man/TIFFSetDirectory.3tiff.html
@@ -41,7 +41,7 @@ current directory for an open <small>TIFF</small> file</p>
<!-- INDENTATION -->
<p><b>int TIFFSetDirectory(TIFF *</b><i>tif</i><b>,
tdir_t</b> <i>dirnum</i><b>)<br>
-int TIFFSetSubDirectory(TIFF *</b><i>tif</i><b>, uint32</b>
+int TIFFSetSubDirectory(TIFF *</b><i>tif</i><b>, uint32_t</b>
<i>diroff</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFSetField.3tiff.html b/html/man/TIFFSetField.3tiff.html
index ce6a88b0..be4de304 100644
--- a/html/man/TIFFSetField.3tiff.html
+++ b/html/man/TIFFSetField.3tiff.html
@@ -93,9 +93,9 @@ understood by <i>libtiff</i>, the number of parameter
values, and the expected types for the parameter values are
shown below. The data types are: <i>char*</i> is
null-terminated string and corresponds to the
-<small>ASCII</small> data type; <i>uint16</i> is an unsigned
-16-bit value; <i>uint32</i> is an unsigned 32-bit value;
-<i>uint16*</i> is an array of unsigned 16-bit values.
+<small>ASCII</small> data type; <i>uint16_t</i> is an unsigned
+16-bit value; <i>uint32_t</i> is an unsigned 32-bit value;
+<i>uint16_t*</i> is an array of unsigned 16-bit values.
<i>void*</i> is an array of data values of unspecified
type.</p>
@@ -173,7 +173,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -196,7 +196,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -221,7 +221,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -244,7 +244,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16*</p></td>
+<p>uint16_t*</p></td>
<td width="11%">
@@ -269,7 +269,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -294,7 +294,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -386,7 +386,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -409,7 +409,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16,uint16*</p></td>
+<p>uint16_t,uint16_t*</p></td>
<td width="11%">
@@ -484,7 +484,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -509,7 +509,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -534,7 +534,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -559,7 +559,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -605,7 +605,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32,void*</p></td>
+<p>uint32_t,void*</p></td>
<td width="11%">
@@ -630,7 +630,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -678,7 +678,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -701,7 +701,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -726,7 +726,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16, char*</p></td>
+<p>uint16_t, char*</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -749,7 +749,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -824,7 +824,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32*,void*</p></td>
+<p>uint32_t*,void*</p></td>
<td width="11%">
@@ -897,7 +897,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -922,7 +922,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -945,7 +945,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -991,7 +991,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1037,7 +1037,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1060,7 +1060,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1083,7 +1083,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32,void*</p></td>
+<p>uint32_t,void*</p></td>
<td width="11%">
@@ -1108,7 +1108,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -1133,7 +1133,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -1208,7 +1208,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1231,7 +1231,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32,void*</p></td>
+<p>uint32_t,void*</p></td>
<td width="11%">
@@ -1256,7 +1256,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -1281,7 +1281,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -1306,7 +1306,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -1425,7 +1425,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1448,7 +1448,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16,uint32*</p></td>
+<p>uint16_t,uint32_t*</p></td>
<td width="11%">
@@ -1496,7 +1496,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
</td></tr>
<tr valign="top" align="left">
@@ -1519,7 +1519,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -1544,7 +1544,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -1569,7 +1569,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32</p></td>
+<p>uint32_t</p></td>
<td width="11%">
@@ -1584,7 +1584,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>1 or 3&Dagger; uint16*</p></td>
+<p>1 or 3&Dagger; uint16_t*</p></td>
<td width="11%">
@@ -1634,7 +1634,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint32,void*</p></td>
+<p>uint32_t,void*</p></td>
<td width="11%">
@@ -1730,7 +1730,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
@@ -1755,7 +1755,7 @@ meaning of each tag.</p>
<td width="29%">
-<p>uint16</p></td>
+<p>uint16_t</p></td>
<td width="11%">
diff --git a/html/man/TIFFWriteScanline.3tiff.html b/html/man/TIFFWriteScanline.3tiff.html
index 8f300217..7b5dfea7 100644
--- a/html/man/TIFFWriteScanline.3tiff.html
+++ b/html/man/TIFFWriteScanline.3tiff.html
@@ -42,7 +42,7 @@
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
<p><b>int TIFFWriteScanline(TIFF *</b><i>tif</i><b>,
-tdata_t</b> <i>buf</i><b>, uint32</b> <i>row</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32_t</b> <i>row</i><b>,
tsample_t</b> <i>sample</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFWriteTile.3tiff.html b/html/man/TIFFWriteTile.3tiff.html
index d450ee12..d4f520b6 100644
--- a/html/man/TIFFWriteTile.3tiff.html
+++ b/html/man/TIFFWriteTile.3tiff.html
@@ -40,8 +40,8 @@ an open <small>TIFF</small> file</p>
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
<p><b>tsize_t TIFFWriteTile(TIFF *</b><i>tif</i><b>,
-tdata_t</b> <i>buf</i><b>, uint32</b> <i>x</i><b>,
-uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+tdata_t</b> <i>buf</i><b>, uint32_t</b> <i>x</i><b>,
+uint32_t</b> <i>y</i><b>, uint32_t</b> <i>z</i><b>,
tsample_t</b> <i>sample</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFcodec.3tiff.html b/html/man/TIFFcodec.3tiff.html
index e18c0ed4..e7a52460 100644
--- a/html/man/TIFFcodec.3tiff.html
+++ b/html/man/TIFFcodec.3tiff.html
@@ -39,14 +39,14 @@ routines</p>
<td width="91%">
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
-<p><b>const TIFFCodec* TIFFFindCODEC(uint16</b>
+<p><b>const TIFFCodec* TIFFFindCODEC(uint16_t</b>
<i>scheme</i><b>);<br>
-TIFFCodec* TIFFRegisterCODEC(uint16</b> <i>scheme</i><b>,
+TIFFCodec* TIFFRegisterCODEC(uint16_t</b> <i>scheme</i><b>,
const char *</b><i>method</i><b>, TIFFInitMethod</b>
<i>init</i><b>);<br>
void TIFFUnRegisterCODEC(TIFFCodec
*</b><i>codec</i><b>);<br>
-int TIFFIsCODECConfigured(uint16</b>
+int TIFFIsCODECConfigured(uint16_t</b>
<i>scheme</i><b>);</b></p>
</td>
</table>
diff --git a/html/man/TIFFcolor.3tiff.html b/html/man/TIFFcolor.3tiff.html
index e598ae6e..d4c5a58a 100644
--- a/html/man/TIFFcolor.3tiff.html
+++ b/html/man/TIFFcolor.3tiff.html
@@ -42,21 +42,21 @@ routines.</p>
*</b><i>ycbcr</i><b>, float *</b><i>luma</i><b>, float
*</b><i>refBlackWhite&quot;</i><b>);&quot;<br>
void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *</b><i>ycbcr</i><b>,
-uint32</b> <i>Y</i><b>, int32</b> <i>Cb</i><b>, int32</b>
-<i>Cr</i><b>, uint32 *</b><i>R</i><b>, uint32
-*</b><i>G</i><b>, uint32 *</b><i>B</i> <b>);</b></p>
+uint32_t</b> <i>Y</i><b>, int32_t</b> <i>Cb</i><b>, int32_t</b>
+<i>Cr</i><b>, uint32_t *</b><i>R</i><b>, uint32_t
+*</b><i>G</i><b>, uint32_t *</b><i>B</i> <b>);</b></p>
<!-- INDENTATION -->
<p><b>int TIFFCIELabToRGBInit(TIFFCIELabToRGB
*</b><i>cielab</i><b>, TIFFDisplay *</b><i>display</i><b>,
float *</b><i>refWhite</i><b>);<br>
void TIFFCIELabToXYZ(TIFFCIELabToRGB *</b><i>cielab</i><b>,
-uint32</b> <i>L</i><b>, int32</b> <i>a</i><b>, int32</b>
+uint32_t</b> <i>L</i><b>, int32_t</b> <i>a</i><b>, int32_t</b>
<i>b</i><b>, float *</b><i>X</i><b>, float *</b><i>Y</i><b>,
float *</b><i>Z</i><b>);<br>
void TIFFXYZToRGB(TIFFCIELabToRGB *</b><i>cielab</i><b>,
float</b> <i>X</i><b>, float</b> <i>Y</i><b>, float</b>
-<i>Z&quot;</i><b>,</b><i>uint32</i><b>*&quot;</b><i>R</i><b>,
-uint32 *</b><i>G</i><b>, uint32 *</b><i>B</i><b>);</b></p>
+<i>Z&quot;</i><b>,</b><i>uint32_t</i><b>*&quot;</b><i>R</i><b>,
+uint32_t *</b><i>G</i><b>, uint32_t *</b><i>B</i><b>);</b></p>
</td>
</table>
<a name="DESCRIPTION"></a>
@@ -116,7 +116,7 @@ int*</p>
<td width="6%">
<p>Cb_b_tab;<br>
-int32*</p>
+int32_t*</p>
</td>
<td width="56%">
</td>
@@ -127,7 +127,7 @@ int32*</p>
<td width="6%">
<p>Cr_g_tab;<br>
-int32*</p>
+int32_t*</p>
</td>
<td width="56%">
</td>
@@ -148,7 +148,7 @@ int32*</p>
<tr valign="top" align="left">
<td width="17%"></td>
<td width="82%">
-<p>int32* Y_tab;<br>
+<p>int32_t* Y_tab;<br>
} TIFFYCbCrToRGB;</p></td>
</table>
<!-- INDENTATION -->
@@ -178,7 +178,7 @@ should helps to understand the the technique:</p>
<td width="17%"></td>
<td width="82%">
<pre>float *luma, *refBlackWhite;
-uint16 hs, vs;
+uint16_t hs, vs;
/* Initialize structures */
ycbcr = (TIFFYCbCrToRGB*)
@@ -212,7 +212,7 @@ sizeof(long))</p>
<td width="24%"></td>
<td width="75%">
-<p>+ 3*256*sizeof(int32));</p>
+<p>+ 3*256*sizeof(int32_t));</p>
</td>
</table>
<!-- INDENTATION -->
@@ -272,9 +272,9 @@ if (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) &lt;
<td width="17%"></td>
<td width="82%">
<p>/* Start conversion */<br>
-uint32 r, g, b;<br>
-uint32 Y;<br>
-int32 Cb, Cr;</p>
+uint32_t r, g, b;<br>
+uint32_t Y;<br>
+int32_t Cb, Cr;</p>
<!-- INDENTATION -->
<p>for each pixel in image</p></td>
</table>
@@ -535,19 +535,19 @@ as</p>
<td width="24%"></td>
<td width="75%">
-<p>uint32 d_Vrwr; /* Pixel values for ref. white */</p>
+<p>uint32_t d_Vrwr; /* Pixel values for ref. white */</p>
</td>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="75%">
-<p>uint32 d_Vrwg;</p>
+<p>uint32_t d_Vrwg;</p>
</td>
<tr valign="top" align="left">
<td width="24%"></td>
<td width="75%">
-<p>uint32 d_Vrwb;</p>
+<p>uint32_t d_Vrwb;</p>
</td>
<tr valign="top" align="left">
<td width="24%"></td>
@@ -922,9 +922,9 @@ state.&quot;);</p>
<p>}</p>
<!-- INDENTATION -->
<p>/* Now we can start to convert */<br>
-uint32 r, g, b;<br>
-uint32 L;<br>
-int32 a, b;<br>
+uint32_t r, g, b;<br>
+uint32_t L;<br>
+int32_t a, b;<br>
float X, Y, Z;</p>
<!-- INDENTATION -->
<p>for each pixel in image</p></td>
diff --git a/html/man/TIFFquery.3tiff.html b/html/man/TIFFquery.3tiff.html
index 2b47fc3d..9fabecca 100644
--- a/html/man/TIFFquery.3tiff.html
+++ b/html/man/TIFFquery.3tiff.html
@@ -41,7 +41,7 @@ routines</p>
<td width="91%">
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
-<p><b>uint32 TIFFCurrentRow(TIFF*</b> <i>tif</i><b>)<br>
+<p><b>uint32_t TIFFCurrentRow(TIFF*</b> <i>tif</i><b>)<br>
tstrip_t TIFFCurrentStrip(TIFF*</b> <i>tif</i><b>)<br>
ttile_t TIFFCurrentTile(TIFF*</b> <i>tif</i><b>)<br>
tdir_t TIFFCurrentDirectory(TIFF*</b> <i>tif</i><b>)<br>
diff --git a/html/man/TIFFstrip.3tiff.html b/html/man/TIFFstrip.3tiff.html
index ae6b7903..80cdc748 100644
--- a/html/man/TIFFstrip.3tiff.html
+++ b/html/man/TIFFstrip.3tiff.html
@@ -39,15 +39,15 @@ TIFFRawStripSize, TIFFComputeStrip, TIFFNumberOfStrips
<td width="91%">
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
-<p><b>uint32 TIFFDefaultStripSize(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>estimate</i><b>)<br>
+<p><b>uint32_t TIFFDefaultStripSize(TIFF *</b><i>tif</i><b>,
+uint32_t</b> <i>estimate</i><b>)<br>
tsize_t TIFFStripSize(TIFF *</b><i>tif</i><b>)<br>
-tsize_t TIFFVStripSize(TIFF *</b><i>tif</i><b>, uint32</b>
+tsize_t TIFFVStripSize(TIFF *</b><i>tif</i><b>, uint32_t</b>
<i>nrows</i><b>)<br>
tsize_t TIFFRawStripSize(TIFF *</b><i>tif</i><b>,
tstrip_t</b> <i>strip</i><b>)<br>
tstrip_t TIFFComputeStrip(TIFF *</b><i>tif</i><b>,
-uint32</b> <i>row</i><b>, tsample_t</b>
+uint32_t</b> <i>row</i><b>, tsample_t</b>
<i>sample</i><b>)<br>
tstrip_t TIFFNumberOfStrips(TIFF *</b><i>tif</i><b>)</b></p>
</td>
diff --git a/html/man/TIFFswab.3tiff.html b/html/man/TIFFswab.3tiff.html
index 3f7ebfef..dcbf6012 100644
--- a/html/man/TIFFswab.3tiff.html
+++ b/html/man/TIFFswab.3tiff.html
@@ -43,11 +43,11 @@ TIFFSwabLong, TIFFSwabArrayOfShort, TIFFSwabArrayOfLong
<i>reversed</i><b>)<br>
void TIFFReverseBits(u_char *</b><i>data</i><b>, unsigned
long</b> <i>nbytes</i><b>)<br>
-void TIFFSwabShort(uint16 *</b><i>data</i><b>)<br>
-void TIFFSwabLong(uint32 *</b><i>data</i><b>)<br>
-void TIFFSwabArrayOfShort(uint16 *</b><i>data</i><b>,
+void TIFFSwabShort(uint16_t *</b><i>data</i><b>)<br>
+void TIFFSwabLong(uint32_t *</b><i>data</i><b>)<br>
+void TIFFSwabArrayOfShort(uint16_t *</b><i>data</i><b>,
unsigned long</b> <i>nshorts</i><b>)<br>
-void TIFFSwabArrayOfLong(uint32 *</b><i>data</i><b>,
+void TIFFSwabArrayOfLong(uint32_t *</b><i>data</i><b>,
unsigned long</b> <i>nlongs</i><b>)</b></p>
</td>
</table>
diff --git a/html/man/TIFFtile.3tiff.html b/html/man/TIFFtile.3tiff.html
index b69cc919..2d1bb576 100644
--- a/html/man/TIFFtile.3tiff.html
+++ b/html/man/TIFFtile.3tiff.html
@@ -40,16 +40,16 @@ TIFFNumberOfTiles &minus; tile-related utility routines</p>
<p><b>#include &lt;tiffio.h&gt;</b></p>
<!-- INDENTATION -->
<p><b>void TIFFDefaultTileSize(TIFF *</b><i>tif</i><b>,
-uint32 *</b><i>tw</i><b>, uint32 *</b><i>th</i><b>)<br>
+uint32_t *</b><i>tw</i><b>, uint32_t *</b><i>th</i><b>)<br>
tsize_t TIFFTileSize(TIFF *</b><i>tif</i><b>)<br>
tsize_t TIFFTileRowSize(TIFF *</b><i>tif</i><b>)<br>
-tsize_t TIFFVTileSize(TIFF *</b><i>tif</i><b>, uint32</b>
+tsize_t TIFFVTileSize(TIFF *</b><i>tif</i><b>, uint32_t</b>
<i>nrows</i><b>)<br>
-ttile_t TIFFComputeTile(TIFF *</b><i>tif</i><b>, uint32</b>
-<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+ttile_t TIFFComputeTile(TIFF *</b><i>tif</i><b>, uint32_t</b>
+<i>x</i><b>, uint32_t</b> <i>y</i><b>, uint32_t</b> <i>z</i><b>,
tsample_t</b> <i>sample</i><b>)<br>
-int TIFFCheckTile(TIFF *</b><i>tif</i><b>, uint32</b>
-<i>x</i><b>, uint32</b> <i>y</i><b>, uint32</b> <i>z</i><b>,
+int TIFFCheckTile(TIFF *</b><i>tif</i><b>, uint32_t</b>
+<i>x</i><b>, uint32_t</b> <i>y</i><b>, uint32_t</b> <i>z</i><b>,
tsample_t</b> <i>sample</i><b>)<br>
ttile_t TIFFNumberOfTiles(TIFF *</b><i>tif</i><b>)</b></p>
</td>
diff --git a/html/man/libtiff.3tiff.html b/html/man/libtiff.3tiff.html
index 931ae94b..5ca38dfe 100644
--- a/html/man/libtiff.3tiff.html
+++ b/html/man/libtiff.3tiff.html
@@ -113,7 +113,7 @@ passed through the varargs interfaces.</big></p></td>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef unsigned short uint16;</big></p>
+<p><big>typedef unsigned short uint16_t;</big></p>
</td>
<td width="38%">
@@ -124,7 +124,7 @@ passed through the varargs interfaces.</big></p></td>
<td width="46%">
<p><big>typedef unsigned &lt;<i>thing</i>&gt;
-uint32;</big></p>
+uint32_t;</big></p>
</td>
<td width="38%">
@@ -144,7 +144,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef uint16 tdir_t;</big></p>
+<p><big>typedef uint16_t tdir_t;</big></p>
</td>
<td width="38%">
@@ -154,7 +154,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef uint16 tsample_t;</big></p>
+<p><big>typedef uint16_t tsample_t;</big></p>
</td>
<td width="38%">
@@ -164,7 +164,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef uint32 tstrip_t;</big></p>
+<p><big>typedef uint32_t tstrip_t;</big></p>
</td>
<td width="38%">
@@ -174,7 +174,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef uint32 ttile_t;</big></p>
+<p><big>typedef uint32_t ttile_t;</big></p>
</td>
<td width="38%">
@@ -184,7 +184,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef int32 tsize_t;</big></p>
+<p><big>typedef int32_t tsize_t;</big></p>
</td>
<td width="38%">
@@ -214,7 +214,7 @@ uint32;</big></p>
<td width="15%"></td>
<td width="46%">
-<p><big>typedef int32 toff_t;</big></p>
+<p><big>typedef int32_t toff_t;</big></p>
</td>
<td width="38%">
@@ -238,7 +238,7 @@ size (w/o penalty). <i>ttag_t</i> must be either int,
unsigned int, pointer, or double because the library uses a
varargs interface and</big> ANSI C <big>restricts the type
of the parameter before an ellipsis to be a promoted type.
-<i>toff_t</i> is defined as int32 because TIFF file offsets
+<i>toff_t</i> is defined as int32_t because TIFF file offsets
are (unsigned) 32-bit quantities. A signed value is used
because some interfaces return &minus;1 on error. Finally,
note that user-specified data references are passed as
diff --git a/libtiff/mkg3states.c b/libtiff/mkg3states.c
index f3421d67..44653255 100644
--- a/libtiff/mkg3states.c
+++ b/libtiff/mkg3states.c
@@ -48,8 +48,8 @@ TIFFFaxTabEnt WhiteTable[4096];
TIFFFaxTabEnt BlackTable[8192];
struct proto {
- uint16 code; /* right justified, lsb-first, zero filled */
- uint16 val; /* (pixel count)<<4 + code width */
+ uint16_t code; /* right justified, lsb-first, zero filled */
+ uint16_t val; /* (pixel count)<<4 + code width */
};
static struct proto Pass[] = {
diff --git a/libtiff/tif_aux.c b/libtiff/tif_aux.c
index c9f19054..96f1f55a 100644
--- a/libtiff/tif_aux.c
+++ b/libtiff/tif_aux.c
@@ -32,10 +32,10 @@
#include <math.h>
#include <float.h>
-uint32
-_TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where)
+uint32_t
+_TIFFMultiply32(TIFF* tif, uint32_t first, uint32_t second, const char* where)
{
- if (second && first > TIFF_UINT32_MAX / second) {
+ if (second && first > UINT32_MAX / second) {
TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
return 0;
}
@@ -43,10 +43,10 @@ _TIFFMultiply32(TIFF* tif, uint32 first, uint32 second, const char* where)
return first * second;
}
-uint64
-_TIFFMultiply64(TIFF* tif, uint64 first, uint64 second, const char* where)
+uint64_t
+_TIFFMultiply64(TIFF* tif, uint64_t first, uint64_t second, const char* where)
{
- if (second && first > TIFF_UINT64_MAX / second) {
+ if (second && first > UINT64_MAX / second) {
TIFFErrorExt(tif->tif_clientdata, where, "Integer overflow in %s", where);
return 0;
}
@@ -79,9 +79,9 @@ _TIFFMultiplySSize(TIFF* tif, tmsize_t first, tmsize_t second, const char* where
return first * second;
}
-tmsize_t _TIFFCastUInt64ToSSize(TIFF* tif, uint64 val, const char* module)
+tmsize_t _TIFFCastUInt64ToSSize(TIFF* tif, uint64_t val, const char* module)
{
- if( val > (uint64)TIFF_TMSIZE_T_MAX )
+ if( val > (uint64_t)TIFF_TMSIZE_T_MAX )
{
if( tif != NULL && module != NULL )
{
@@ -125,7 +125,7 @@ _TIFFCheckMalloc(TIFF* tif, tmsize_t nmemb, tmsize_t elem_size, const char* what
static int
TIFFDefaultTransferFunction(TIFFDirectory* td)
{
- uint16 **tf = td->td_transferfunction;
+ uint16_t **tf = td->td_transferfunction;
tmsize_t i, n, nbytes;
tf[0] = tf[1] = tf[2] = 0;
@@ -133,22 +133,22 @@ TIFFDefaultTransferFunction(TIFFDirectory* td)
return 0;
n = ((tmsize_t)1)<<td->td_bitspersample;
- nbytes = n * sizeof (uint16);
- tf[0] = (uint16 *)_TIFFmalloc(nbytes);
+ nbytes = n * sizeof (uint16_t);
+ tf[0] = (uint16_t *)_TIFFmalloc(nbytes);
if (tf[0] == NULL)
return 0;
tf[0][0] = 0;
for (i = 1; i < n; i++) {
double t = (double)i/((double) n-1.);
- tf[0][i] = (uint16)floor(65535.*pow(t, 2.2) + .5);
+ tf[0][i] = (uint16_t)floor(65535. * pow(t, 2.2) + .5);
}
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
- tf[1] = (uint16 *)_TIFFmalloc(nbytes);
+ tf[1] = (uint16_t *)_TIFFmalloc(nbytes);
if(tf[1] == NULL)
goto bad;
_TIFFmemcpy(tf[1], tf[0], nbytes);
- tf[2] = (uint16 *)_TIFFmalloc(nbytes);
+ tf[2] = (uint16_t *)_TIFFmalloc(nbytes);
if (tf[2] == NULL)
goto bad;
_TIFFmemcpy(tf[2], tf[0], nbytes);
@@ -205,7 +205,7 @@ TIFFDefaultRefBlackWhite(TIFFDirectory* td)
* place in the library -- in TIFFDefaultDirectory.
*/
int
-TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
+TIFFVGetFieldDefaulted(TIFF* tif, uint32_t tag, va_list ap)
{
TIFFDirectory *td = &tif->tif_dir;
@@ -213,37 +213,37 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
return (1);
switch (tag) {
case TIFFTAG_SUBFILETYPE:
- *va_arg(ap, uint32 *) = td->td_subfiletype;
+ *va_arg(ap, uint32_t *) = td->td_subfiletype;
return (1);
case TIFFTAG_BITSPERSAMPLE:
- *va_arg(ap, uint16 *) = td->td_bitspersample;
+ *va_arg(ap, uint16_t *) = td->td_bitspersample;
return (1);
case TIFFTAG_THRESHHOLDING:
- *va_arg(ap, uint16 *) = td->td_threshholding;
+ *va_arg(ap, uint16_t *) = td->td_threshholding;
return (1);
case TIFFTAG_FILLORDER:
- *va_arg(ap, uint16 *) = td->td_fillorder;
+ *va_arg(ap, uint16_t *) = td->td_fillorder;
return (1);
case TIFFTAG_ORIENTATION:
- *va_arg(ap, uint16 *) = td->td_orientation;
+ *va_arg(ap, uint16_t *) = td->td_orientation;
return (1);
case TIFFTAG_SAMPLESPERPIXEL:
- *va_arg(ap, uint16 *) = td->td_samplesperpixel;
+ *va_arg(ap, uint16_t *) = td->td_samplesperpixel;
return (1);
case TIFFTAG_ROWSPERSTRIP:
- *va_arg(ap, uint32 *) = td->td_rowsperstrip;
+ *va_arg(ap, uint32_t *) = td->td_rowsperstrip;
return (1);
case TIFFTAG_MINSAMPLEVALUE:
- *va_arg(ap, uint16 *) = td->td_minsamplevalue;
+ *va_arg(ap, uint16_t *) = td->td_minsamplevalue;
return (1);
case TIFFTAG_MAXSAMPLEVALUE:
- *va_arg(ap, uint16 *) = td->td_maxsamplevalue;
+ *va_arg(ap, uint16_t *) = td->td_maxsamplevalue;
return (1);
case TIFFTAG_PLANARCONFIG:
- *va_arg(ap, uint16 *) = td->td_planarconfig;
+ *va_arg(ap, uint16_t *) = td->td_planarconfig;
return (1);
case TIFFTAG_RESOLUTIONUNIT:
- *va_arg(ap, uint16 *) = td->td_resolutionunit;
+ *va_arg(ap, uint16_t *) = td->td_resolutionunit;
return (1);
case TIFFTAG_PREDICTOR:
{
@@ -252,42 +252,42 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
{
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Cannot get \"Predictor\" tag as plugin is not configured");
- *va_arg(ap, uint16*) = 0;
+ *va_arg(ap, uint16_t*) = 0;
return 0;
}
- *va_arg(ap, uint16*) = (uint16) sp->predictor;
+ *va_arg(ap, uint16_t*) = (uint16_t) sp->predictor;
return 1;
}
case TIFFTAG_DOTRANGE:
- *va_arg(ap, uint16 *) = 0;
- *va_arg(ap, uint16 *) = (1<<td->td_bitspersample)-1;
+ *va_arg(ap, uint16_t *) = 0;
+ *va_arg(ap, uint16_t *) = (1 << td->td_bitspersample) - 1;
return (1);
case TIFFTAG_INKSET:
- *va_arg(ap, uint16 *) = INKSET_CMYK;
+ *va_arg(ap, uint16_t *) = INKSET_CMYK;
return 1;
case TIFFTAG_NUMBEROFINKS:
- *va_arg(ap, uint16 *) = 4;
+ *va_arg(ap, uint16_t *) = 4;
return (1);
case TIFFTAG_EXTRASAMPLES:
- *va_arg(ap, uint16 *) = td->td_extrasamples;
- *va_arg(ap, const uint16 **) = td->td_sampleinfo;
+ *va_arg(ap, uint16_t *) = td->td_extrasamples;
+ *va_arg(ap, const uint16_t **) = td->td_sampleinfo;
return (1);
case TIFFTAG_MATTEING:
- *va_arg(ap, uint16 *) =
+ *va_arg(ap, uint16_t *) =
(td->td_extrasamples == 1 &&
td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
return (1);
case TIFFTAG_TILEDEPTH:
- *va_arg(ap, uint32 *) = td->td_tiledepth;
+ *va_arg(ap, uint32_t *) = td->td_tiledepth;
return (1);
case TIFFTAG_DATATYPE:
- *va_arg(ap, uint16 *) = td->td_sampleformat-1;
+ *va_arg(ap, uint16_t *) = td->td_sampleformat - 1;
return (1);
case TIFFTAG_SAMPLEFORMAT:
- *va_arg(ap, uint16 *) = td->td_sampleformat;
+ *va_arg(ap, uint16_t *) = td->td_sampleformat;
return(1);
case TIFFTAG_IMAGEDEPTH:
- *va_arg(ap, uint32 *) = td->td_imagedepth;
+ *va_arg(ap, uint32_t *) = td->td_imagedepth;
return (1);
case TIFFTAG_YCBCRCOEFFICIENTS:
{
@@ -297,11 +297,11 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
return 1;
}
case TIFFTAG_YCBCRSUBSAMPLING:
- *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[0];
- *va_arg(ap, uint16 *) = td->td_ycbcrsubsampling[1];
+ *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[0];
+ *va_arg(ap, uint16_t *) = td->td_ycbcrsubsampling[1];
return (1);
case TIFFTAG_YCBCRPOSITIONING:
- *va_arg(ap, uint16 *) = td->td_ycbcrpositioning;
+ *va_arg(ap, uint16_t *) = td->td_ycbcrpositioning;
return (1);
case TIFFTAG_WHITEPOINT:
{
@@ -321,10 +321,10 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "No space for \"TransferFunction\" tag");
return (0);
}
- *va_arg(ap, const uint16 **) = td->td_transferfunction[0];
+ *va_arg(ap, const uint16_t **) = td->td_transferfunction[0];
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
- *va_arg(ap, const uint16 **) = td->td_transferfunction[1];
- *va_arg(ap, const uint16 **) = td->td_transferfunction[2];
+ *va_arg(ap, const uint16_t **) = td->td_transferfunction[1];
+ *va_arg(ap, const uint16_t **) = td->td_transferfunction[2];
}
return (1);
case TIFFTAG_REFERENCEBLACKWHITE:
@@ -341,7 +341,7 @@ TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap)
* value if the tag is not present in the directory.
*/
int
-TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...)
+TIFFGetFieldDefaulted(TIFF* tif, uint32_t tag, ...)
{
int ok;
va_list ap;
@@ -353,16 +353,16 @@ TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...)
}
struct _Int64Parts {
- int32 low, high;
+ int32_t low, high;
};
typedef union {
struct _Int64Parts part;
- int64 value;
+ int64_t value;
} _Int64;
float
-_TIFFUInt64ToFloat(uint64 ui64)
+_TIFFUInt64ToFloat(uint64_t ui64)
{
_Int64 i;
@@ -378,7 +378,7 @@ _TIFFUInt64ToFloat(uint64 ui64)
}
double
-_TIFFUInt64ToDouble(uint64 ui64)
+_TIFFUInt64ToDouble(uint64_t ui64)
{
_Int64 i;
@@ -406,7 +406,7 @@ int _TIFFSeekOK(TIFF* tif, toff_t off)
{
/* Huge offsets, especially -1 / UINT64_MAX, can cause issues */
/* See http://bugzilla.maptools.org/show_bug.cgi?id=2726 */
- return off <= (~(uint64)0)/2 && TIFFSeekFile(tif,off,SEEK_SET)==off;
+ return off <= (~(uint64_t)0) / 2 && TIFFSeekFile(tif, off, SEEK_SET) == off;
}
/* vim: set ts=8 sts=8 sw=8 noet: */
diff --git a/libtiff/tif_close.c b/libtiff/tif_close.c
index e4228df9..674518a1 100644
--- a/libtiff/tif_close.c
+++ b/libtiff/tif_close.c
@@ -76,7 +76,7 @@ TIFFCleanup(TIFF* tif)
* Clean up custom fields.
*/
if (tif->tif_fields && tif->tif_nfields > 0) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < tif->tif_nfields; i++) {
TIFFField *fld = tif->tif_fields[i];
@@ -91,7 +91,7 @@ TIFFCleanup(TIFF* tif)
}
if (tif->tif_nfieldscompat > 0) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < tif->tif_nfieldscompat; i++) {
if (tif->tif_fieldscompat[i].allocated_size)
diff --git a/libtiff/tif_codec.c b/libtiff/tif_codec.c
index f698926d..03fe7930 100644
--- a/libtiff/tif_codec.c
+++ b/libtiff/tif_codec.c
@@ -142,7 +142,7 @@ NotConfigured(TIFF* tif, int scheme)
*/
int
-TIFFIsCODECConfigured(uint16 scheme)
+TIFFIsCODECConfigured(uint16_t scheme)
{
const TIFFCodec* codec = TIFFFindCODEC(scheme);
diff --git a/libtiff/tif_color.c b/libtiff/tif_color.c
index 8fae40ea..2b962af9 100644
--- a/libtiff/tif_color.c
+++ b/libtiff/tif_color.c
@@ -41,8 +41,8 @@
* Convert color value from the CIE L*a*b* 1976 space to CIE XYZ.
*/
void
-TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,
- float *X, float *Y, float *Z)
+TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32_t l, int32_t a, int32_t b,
+ float *X, float *Y, float *Z)
{
float L = (float)l * 100.0F / 255.0F;
float cby, tmp;
@@ -68,13 +68,13 @@ TIFFCIELabToXYZ(TIFFCIELabToRGB *cielab, uint32 l, int32 a, int32 b,
*Z = cielab->Z0 * tmp * tmp * tmp;
}
-#define RINT(R) ((uint32)((R)>0?((R)+0.5):((R)-0.5)))
+#define RINT(R) ((uint32_t)((R)>0?((R)+0.5):((R)-0.5)))
/*
* Convert color value from the XYZ space to RGB.
*/
void
TIFFXYZToRGB(TIFFCIELabToRGB *cielab, float X, float Y, float Z,
- uint32 *r, uint32 *g, uint32 *b)
+ uint32_t *r, uint32_t *g, uint32_t *b)
{
int i;
float Yr, Yg, Yb;
@@ -171,17 +171,17 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
* see below for more information on how it works.
*/
#define SHIFT 16
-#define FIX(x) ((int32)((x) * (1L<<SHIFT) + 0.5))
-#define ONE_HALF ((int32)(1<<(SHIFT-1)))
-#define Code2V(c, RB, RW, CR) ((((c)-(int32)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
+#define FIX(x) ((int32_t)((x) * (1L<<SHIFT) + 0.5))
+#define ONE_HALF ((int32_t)(1<<(SHIFT-1)))
+#define Code2V(c, RB, RW, CR) ((((c)-(int32_t)(RB))*(float)(CR))/(float)(((RW)-(RB)!=0) ? ((RW)-(RB)) : 1))
#define CLAMP(f,min,max) ((f)<(min)?(min):(f)>(max)?(max):(f))
#define HICLAMP(f,max) ((f)>(max)?(max):(f))
void
-TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32 Y, int32 Cb, int32 Cr,
- uint32 *r, uint32 *g, uint32 *b)
+TIFFYCbCrtoRGB(TIFFYCbCrToRGB *ycbcr, uint32_t Y, int32_t Cb, int32_t Cr,
+ uint32_t *r, uint32_t *g, uint32_t *b)
{
- int32 i;
+ int32_t i;
/* XXX: Only 8-bit YCbCr input supported for now */
Y = HICLAMP(Y, 255);
@@ -241,7 +241,7 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
#define LumaBlue luma[2]
clamptab = (TIFFRGBValue*)(
- (uint8*) ycbcr+TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long)));
+ (uint8_t*) ycbcr + TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long)));
_TIFFmemset(clamptab, 0, 256); /* v < 0 => 0 */
ycbcr->clamptab = (clamptab += 256);
for (i = 0; i < 256; i++)
@@ -249,14 +249,14 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
_TIFFmemset(clamptab+256, 255, 2*256); /* v > 255 => 255 */
ycbcr->Cr_r_tab = (int*) (clamptab + 3*256);
ycbcr->Cb_b_tab = ycbcr->Cr_r_tab + 256;
- ycbcr->Cr_g_tab = (int32*) (ycbcr->Cb_b_tab + 256);
+ ycbcr->Cr_g_tab = (int32_t*) (ycbcr->Cb_b_tab + 256);
ycbcr->Cb_g_tab = ycbcr->Cr_g_tab + 256;
ycbcr->Y_tab = ycbcr->Cb_g_tab + 256;
- { float f1 = 2-2*LumaRed; int32 D1 = FIX(CLAMP(f1,0.0F,2.0F));
- float f2 = LumaRed*f1/LumaGreen; int32 D2 = -FIX(CLAMP(f2,0.0F,2.0F));
- float f3 = 2-2*LumaBlue; int32 D3 = FIX(CLAMP(f3,0.0F,2.0F));
- float f4 = LumaBlue*f3/LumaGreen; int32 D4 = -FIX(CLAMP(f4,0.0F,2.0F));
+ { float f1 = 2-2*LumaRed; int32_t D1 = FIX(CLAMP(f1, 0.0F, 2.0F));
+ float f2 = LumaRed*f1/LumaGreen; int32_t D2 = -FIX(CLAMP(f2, 0.0F, 2.0F));
+ float f3 = 2-2*LumaBlue; int32_t D3 = FIX(CLAMP(f3, 0.0F, 2.0F));
+ float f4 = LumaBlue*f3/LumaGreen; int32_t D4 = -FIX(CLAMP(f4, 0.0F, 2.0F));
int x;
#undef LumaBlue
@@ -271,19 +271,19 @@ TIFFYCbCrToRGBInit(TIFFYCbCrToRGB* ycbcr, float *luma, float *refBlackWhite)
* constructing tables indexed by the raw pixel data.
*/
for (i = 0, x = -128; i < 256; i++, x++) {
- int32 Cr = (int32)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F,
+ int32_t Cr = (int32_t)CLAMPw(Code2V(x, refBlackWhite[4] - 128.0F,
refBlackWhite[5] - 128.0F, 127),
-128.0F * 32, 128.0F * 32);
- int32 Cb = (int32)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F,
+ int32_t Cb = (int32_t)CLAMPw(Code2V(x, refBlackWhite[2] - 128.0F,
refBlackWhite[3] - 128.0F, 127),
-128.0F * 32, 128.0F * 32);
- ycbcr->Cr_r_tab[i] = (int32)((D1*Cr + ONE_HALF)>>SHIFT);
- ycbcr->Cb_b_tab[i] = (int32)((D3*Cb + ONE_HALF)>>SHIFT);
+ ycbcr->Cr_r_tab[i] = (int32_t)((D1 * Cr + ONE_HALF) >> SHIFT);
+ ycbcr->Cb_b_tab[i] = (int32_t)((D3 * Cb + ONE_HALF) >> SHIFT);
ycbcr->Cr_g_tab[i] = D2*Cr;
ycbcr->Cb_g_tab[i] = D4*Cb + ONE_HALF;
ycbcr->Y_tab[i] =
- (int32)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
+ (int32_t)CLAMPw(Code2V(x + 128, refBlackWhite[0], refBlackWhite[1], 255),
-128.0F * 32, 128.0F * 32);
}
}
diff --git a/libtiff/tif_compress.c b/libtiff/tif_compress.c
index 915478f5..19a1ff1c 100644
--- a/libtiff/tif_compress.c
+++ b/libtiff/tif_compress.c
@@ -47,21 +47,21 @@ TIFFNoEncode(TIFF* tif, const char* method)
}
int
-_TIFFNoRowEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoRowEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoEncode(tif, "scanline"));
}
int
-_TIFFNoStripEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoStripEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoEncode(tif, "strip"));
}
int
-_TIFFNoTileEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoTileEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoEncode(tif, "tile"));
@@ -91,28 +91,28 @@ _TIFFNoFixupTags(TIFF* tif)
}
int
-_TIFFNoRowDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoRowDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoDecode(tif, "scanline"));
}
int
-_TIFFNoStripDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoStripDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoDecode(tif, "strip"));
}
int
-_TIFFNoTileDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+_TIFFNoTileDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) pp; (void) cc; (void) s;
return (TIFFNoDecode(tif, "tile"));
}
int
-_TIFFNoSeek(TIFF* tif, uint32 off)
+_TIFFNoSeek(TIFF* tif, uint32_t off)
{
(void) off;
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
@@ -121,7 +121,7 @@ _TIFFNoSeek(TIFF* tif, uint32 off)
}
int
-_TIFFNoPreCode(TIFF* tif, uint16 s)
+_TIFFNoPreCode(TIFF* tif, uint16_t s)
{
(void) tif; (void) s;
return (1);
@@ -158,7 +158,7 @@ _TIFFSetDefaultCompressionState(TIFF* tif)
int
TIFFSetCompressionScheme(TIFF* tif, int scheme)
{
- const TIFFCodec *c = TIFFFindCODEC((uint16) scheme);
+ const TIFFCodec *c = TIFFFindCODEC((uint16_t) scheme);
_TIFFSetDefaultCompressionState(tif);
/*
@@ -182,7 +182,7 @@ typedef struct _codec {
static codec_t* registeredCODECS = NULL;
const TIFFCodec*
-TIFFFindCODEC(uint16 scheme)
+TIFFFindCODEC(uint16_t scheme)
{
const TIFFCodec* c;
codec_t* cd;
@@ -197,15 +197,15 @@ TIFFFindCODEC(uint16 scheme)
}
TIFFCodec*
-TIFFRegisterCODEC(uint16 scheme, const char* name, TIFFInitMethod init)
+TIFFRegisterCODEC(uint16_t scheme, const char* name, TIFFInitMethod init)
{
codec_t* cd = (codec_t*)
_TIFFmalloc((tmsize_t)(sizeof (codec_t) + sizeof (TIFFCodec) + strlen(name)+1));
if (cd != NULL) {
- cd->info = (TIFFCodec*) ((uint8*) cd + sizeof (codec_t));
+ cd->info = (TIFFCodec*) ((uint8_t*) cd + sizeof (codec_t));
cd->info->name = (char*)
- ((uint8*) cd->info + sizeof (TIFFCodec));
+ ((uint8_t*) cd->info + sizeof (TIFFCodec));
strcpy(cd->info->name, name);
cd->info->scheme = scheme;
cd->info->init = init;
diff --git a/libtiff/tif_config.h.cmake.in b/libtiff/tif_config.h.cmake.in
index faced9c5..dedc1675 100644
--- a/libtiff/tif_config.h.cmake.in
+++ b/libtiff/tif_config.h.cmake.in
@@ -122,57 +122,12 @@
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
-/* The size of `signed int', as computed by sizeof. */
-#define SIZEOF_SIGNED_INT @SIZEOF_SIGNED_INT@
-
-/* The size of `signed long', as computed by sizeof. */
-#define SIZEOF_SIGNED_LONG @SIZEOF_SIGNED_LONG@
-
-/* The size of `signed long long', as computed by sizeof. */
-#define SIZEOF_SIGNED_LONG_LONG @SIZEOF_SIGNED_LONG_LONG@
-
-/* The size of `unsigned char *', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_CHAR_P @SIZEOF_UNSIGNED_CHAR_P@
-
-/* The size of `unsigned int', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_INT @SIZEOF_UNSIGNED_INT@
-
-/* The size of `unsigned long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG @SIZEOF_UNSIGNED_LONG@
-
-/* The size of `unsigned long long', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@
-
-/* The size of `unsigned short', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_SHORT @SIZEOF_UNSIGNED_SHORT@
-
/* Default size of the strip in bytes (when strip chopping enabled) */
#define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
-/* Signed 32-bit type formatter */
-#define TIFF_INT32_FORMAT @TIFF_INT32_FORMAT@
-
-/* Signed 64-bit type formatter */
-#define TIFF_INT64_FORMAT @TIFF_INT64_FORMAT@
-
-/* Pointer difference type formatter */
-#define TIFF_PTRDIFF_FORMAT @TIFF_PTRDIFF_FORMAT@
-
-/* Unsigned size type formatter */
-#define TIFF_SIZE_FORMAT @TIFF_SIZE_FORMAT@
-
/* Signed size type formatter */
#define TIFF_SSIZE_FORMAT @TIFF_SSIZE_FORMAT@
-/* Unsigned 32-bit type formatter */
-#define TIFF_UINT32_FORMAT @TIFF_UINT32_FORMAT@
-
-/* Unsigned 64-bit type formatter */
-#define TIFF_UINT64_FORMAT @TIFF_UINT64_FORMAT@
-
-/* Unsigned 8-bit type */
-#define TIFF_UINT8_T @TIFF_UINT8_T@
-
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
diff --git a/libtiff/tif_config.vc.h b/libtiff/tif_config.vc.h
index b9311cf6..84b650da 100644
--- a/libtiff/tif_config.vc.h
+++ b/libtiff/tif_config.vc.h
@@ -26,72 +26,33 @@
/* Define to 1 if you have the declaration of `optarg', and to 0 if you don't. */
#define HAVE_DECL_OPTARG 0
-/* The size of a `int', as computed by sizeof. */
-#define SIZEOF_INT 4
-
-/* The size of a `long', as computed by sizeof. */
-#define SIZEOF_LONG 4
-
-/* Signed 64-bit type formatter */
-#define TIFF_INT64_FORMAT "%I64d"
-
-/* Signed 64-bit type */
-#define TIFF_INT64_T signed __int64
-
-/* Unsigned 64-bit type formatter */
-#define TIFF_UINT64_FORMAT "%I64u"
-
-/* Unsigned 64-bit type */
-#define TIFF_UINT64_T unsigned __int64
-
#if _WIN64
/*
Windows 64-bit build
*/
-/* Pointer difference type */
-# define TIFF_PTRDIFF_T TIFF_INT64_T
-
/* The size of `size_t', as computed by sizeof. */
# define SIZEOF_SIZE_T 8
-/* Size type formatter */
-# define TIFF_SIZE_FORMAT TIFF_INT64_FORMAT
-
-/* Unsigned size type */
-# define TIFF_SIZE_T TIFF_UINT64_T
-
/* Signed size type formatter */
-# define TIFF_SSIZE_FORMAT TIFF_INT64_FORMAT
+# define TIFF_SSIZE_FORMAT PRId64
/* Signed size type */
-# define TIFF_SSIZE_T TIFF_INT64_T
+# define TIFF_SSIZE_T int64_t
#else
/*
Windows 32-bit build
*/
-/* Pointer difference type */
-# define TIFF_PTRDIFF_T signed int
-
/* The size of `size_t', as computed by sizeof. */
# define SIZEOF_SIZE_T 4
-/* Size type formatter */
-# define TIFF_SIZE_FORMAT "%u"
-
-/* Size type formatter */
-# define TIFF_SIZE_FORMAT "%u"
-
-/* Unsigned size type */
-# define TIFF_SIZE_T unsigned int
-
/* Signed size type formatter */
-# define TIFF_SSIZE_FORMAT "%d"
+# define TIFF_SSIZE_FORMAT PRId32
/* Signed size type */
-# define TIFF_SSIZE_T signed int
+# define TIFF_SSIZE_T int32_t
#endif
diff --git a/libtiff/tif_dir.c b/libtiff/tif_dir.c
index b578c8cf..7ce39d04 100644
--- a/libtiff/tif_dir.c
+++ b/libtiff/tif_dir.c
@@ -54,21 +54,21 @@ setByteArray(void** vpp, void* vp, size_t nmemb, size_t elem_size)
_TIFFmemcpy(*vpp, vp, bytes);
}
}
-void _TIFFsetByteArray(void** vpp, void* vp, uint32 n)
+void _TIFFsetByteArray(void** vpp, void* vp, uint32_t n)
{ setByteArray(vpp, vp, n, 1); }
void _TIFFsetString(char** cpp, char* cp)
{ setByteArray((void**) cpp, (void*) cp, strlen(cp)+1, 1); }
-static void _TIFFsetNString(char** cpp, char* cp, uint32 n)
+static void _TIFFsetNString(char** cpp, char* cp, uint32_t n)
{ setByteArray((void**) cpp, (void*) cp, n, 1); }
-void _TIFFsetShortArray(uint16** wpp, uint16* wp, uint32 n)
- { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16)); }
-void _TIFFsetLongArray(uint32** lpp, uint32* lp, uint32 n)
- { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32)); }
-static void _TIFFsetLong8Array(uint64** lpp, uint64* lp, uint32 n)
- { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint64)); }
-void _TIFFsetFloatArray(float** fpp, float* fp, uint32 n)
+void _TIFFsetShortArray(uint16_t** wpp, uint16_t* wp, uint32_t n)
+ { setByteArray((void**) wpp, (void*) wp, n, sizeof (uint16_t)); }
+void _TIFFsetLongArray(uint32_t** lpp, uint32_t* lp, uint32_t n)
+ { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint32_t)); }
+static void _TIFFsetLong8Array(uint64_t** lpp, uint64_t* lp, uint32_t n)
+ { setByteArray((void**) lpp, (void*) lp, n, sizeof (uint64_t)); }
+void _TIFFsetFloatArray(float** fpp, float* fp, uint32_t n)
{ setByteArray((void**) fpp, (void*) fp, n, sizeof (float)); }
-void _TIFFsetDoubleArray(double** dpp, double* dp, uint32 n)
+void _TIFFsetDoubleArray(double** dpp, double* dp, uint32_t n)
{ setByteArray((void**) dpp, (void*) dp, n, sizeof (double)); }
static void
@@ -88,20 +88,20 @@ setDoubleArrayOneValue(double** vpp, double value, size_t nmemb)
* Install extra samples information.
*/
static int
-setExtraSamples(TIFF* tif, va_list ap, uint32* v)
+setExtraSamples(TIFF* tif, va_list ap, uint32_t* v)
{
/* XXX: Unassociated alpha data == 999 is a known Corel Draw bug, see below */
#define EXTRASAMPLE_COREL_UNASSALPHA 999
- uint16* va;
- uint32 i;
+ uint16_t* va;
+ uint32_t i;
TIFFDirectory* td = &tif->tif_dir;
static const char module[] = "setExtraSamples";
- *v = (uint16) va_arg(ap, uint16_vap);
- if ((uint16) *v > td->td_samplesperpixel)
+ *v = (uint16_t) va_arg(ap, uint16_vap);
+ if ((uint16_t) *v > td->td_samplesperpixel)
return 0;
- va = va_arg(ap, uint16*);
+ va = va_arg(ap, uint16_t*);
if (*v > 0 && va == NULL) /* typically missing param */
return 0;
for (i = 0; i < *v; i++) {
@@ -130,7 +130,7 @@ setExtraSamples(TIFF* tif, va_list ap, uint32* v)
td->td_transferfunction[0] = NULL;
}
- td->td_extrasamples = (uint16) *v;
+ td->td_extrasamples = (uint16_t) *v;
_TIFFsetShortArray(&td->td_sampleinfo, va, td->td_extrasamples);
return 1;
@@ -141,11 +141,11 @@ setExtraSamples(TIFF* tif, va_list ap, uint32* v)
* Confirm we have "samplesperpixel" ink names separated by \0. Returns
* zero if the ink names are not as expected.
*/
-static uint32
-checkInkNamesString(TIFF* tif, uint32 slen, const char* s)
+static uint32_t
+checkInkNamesString(TIFF* tif, uint32_t slen, const char* s)
{
TIFFDirectory* td = &tif->tif_dir;
- uint16 i = td->td_samplesperpixel;
+ uint16_t i = td->td_samplesperpixel;
if (slen > 0) {
const char* ep = s+slen;
@@ -156,7 +156,7 @@ checkInkNamesString(TIFF* tif, uint32 slen, const char* s)
goto bad;
cp++; /* skip \0 */
}
- return ((uint32)(cp-s));
+ return ((uint32_t)(cp - s));
}
bad:
TIFFErrorExt(tif->tif_clientdata, "TIFFSetField",
@@ -168,17 +168,17 @@ bad:
}
static int
-_TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
+_TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "_TIFFVSetField";
TIFFDirectory* td = &tif->tif_dir;
int status = 1;
- uint32 v32, i, v;
+ uint32_t v32, i, v;
double dblval;
char* s;
const TIFFField *fip = TIFFFindField(tif, tag, TIFF_ANY);
- uint32 standard_tag = tag;
+ uint32_t standard_tag = tag;
if( fip == NULL ) /* cannot happen since OkToChangeTag() already checks it */
return 0;
/*
@@ -193,16 +193,16 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
switch (standard_tag) {
case TIFFTAG_SUBFILETYPE:
- td->td_subfiletype = (uint32) va_arg(ap, uint32);
+ td->td_subfiletype = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_IMAGEWIDTH:
- td->td_imagewidth = (uint32) va_arg(ap, uint32);
+ td->td_imagewidth = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_IMAGELENGTH:
- td->td_imagelength = (uint32) va_arg(ap, uint32);
+ td->td_imagelength = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_BITSPERSAMPLE:
- td->td_bitspersample = (uint16) va_arg(ap, uint16_vap);
+ td->td_bitspersample = (uint16_t) va_arg(ap, uint16_vap);
/*
* If the data require post-decoding processing to byte-swap
* samples, set it up here. Note that since tags are required
@@ -226,14 +226,14 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
}
break;
case TIFFTAG_COMPRESSION:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
/*
* If we're changing the compression scheme, the notify the
* previous module so that it can cleanup any state it's
* setup.
*/
if (TIFFFieldSet(tif, FIELD_COMPRESSION)) {
- if ((uint32)td->td_compression == v)
+ if ((uint32_t)td->td_compression == v)
break;
(*tif->tif_cleanup)(tif);
tif->tif_flags &= ~TIFF_CODERSETUP;
@@ -242,31 +242,31 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
* Setup new compression routine state.
*/
if( (status = TIFFSetCompressionScheme(tif, v)) != 0 )
- td->td_compression = (uint16) v;
+ td->td_compression = (uint16_t) v;
else
status = 0;
break;
case TIFFTAG_PHOTOMETRIC:
- td->td_photometric = (uint16) va_arg(ap, uint16_vap);
+ td->td_photometric = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_THRESHHOLDING:
- td->td_threshholding = (uint16) va_arg(ap, uint16_vap);
+ td->td_threshholding = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_FILLORDER:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v != FILLORDER_LSB2MSB && v != FILLORDER_MSB2LSB)
goto badvalue;
- td->td_fillorder = (uint16) v;
+ td->td_fillorder = (uint16_t) v;
break;
case TIFFTAG_ORIENTATION:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v < ORIENTATION_TOPLEFT || ORIENTATION_LEFTBOT < v)
goto badvalue;
else
- td->td_orientation = (uint16) v;
+ td->td_orientation = (uint16_t) v;
break;
case TIFFTAG_SAMPLESPERPIXEL:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v == 0)
goto badvalue;
if( v != td->td_samplesperpixel )
@@ -303,10 +303,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
td->td_transferfunction[0] = NULL;
}
}
- td->td_samplesperpixel = (uint16) v;
+ td->td_samplesperpixel = (uint16_t) v;
break;
case TIFFTAG_ROWSPERSTRIP:
- v32 = (uint32) va_arg(ap, uint32);
+ v32 = (uint32_t) va_arg(ap, uint32_t);
if (v32 == 0)
goto badvalue32;
td->td_rowsperstrip = v32;
@@ -316,10 +316,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
}
break;
case TIFFTAG_MINSAMPLEVALUE:
- td->td_minsamplevalue = (uint16) va_arg(ap, uint16_vap);
+ td->td_minsamplevalue = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_MAXSAMPLEVALUE:
- td->td_maxsamplevalue = (uint16) va_arg(ap, uint16_vap);
+ td->td_maxsamplevalue = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_SMINSAMPLEVALUE:
if (tif->tif_flags & TIFF_PERSAMPLE)
@@ -346,10 +346,10 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
td->td_yresolution = _TIFFClampDoubleToFloat( dblval );
break;
case TIFFTAG_PLANARCONFIG:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v != PLANARCONFIG_CONTIG && v != PLANARCONFIG_SEPARATE)
goto badvalue;
- td->td_planarconfig = (uint16) v;
+ td->td_planarconfig = (uint16_t) v;
break;
case TIFFTAG_XPOSITION:
td->td_xposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
@@ -358,38 +358,38 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
td->td_yposition = _TIFFClampDoubleToFloat( va_arg(ap, double) );
break;
case TIFFTAG_RESOLUTIONUNIT:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v < RESUNIT_NONE || RESUNIT_CENTIMETER < v)
goto badvalue;
- td->td_resolutionunit = (uint16) v;
+ td->td_resolutionunit = (uint16_t) v;
break;
case TIFFTAG_PAGENUMBER:
- td->td_pagenumber[0] = (uint16) va_arg(ap, uint16_vap);
- td->td_pagenumber[1] = (uint16) va_arg(ap, uint16_vap);
+ td->td_pagenumber[0] = (uint16_t) va_arg(ap, uint16_vap);
+ td->td_pagenumber[1] = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_HALFTONEHINTS:
- td->td_halftonehints[0] = (uint16) va_arg(ap, uint16_vap);
- td->td_halftonehints[1] = (uint16) va_arg(ap, uint16_vap);
+ td->td_halftonehints[0] = (uint16_t) va_arg(ap, uint16_vap);
+ td->td_halftonehints[1] = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_COLORMAP:
- v32 = (uint32)(1L<<td->td_bitspersample);
- _TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16*), v32);
- _TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16*), v32);
- _TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16*), v32);
+ v32 = (uint32_t)(1L << td->td_bitspersample);
+ _TIFFsetShortArray(&td->td_colormap[0], va_arg(ap, uint16_t*), v32);
+ _TIFFsetShortArray(&td->td_colormap[1], va_arg(ap, uint16_t*), v32);
+ _TIFFsetShortArray(&td->td_colormap[2], va_arg(ap, uint16_t*), v32);
break;
case TIFFTAG_EXTRASAMPLES:
if (!setExtraSamples(tif, ap, &v))
goto badvalue;
break;
case TIFFTAG_MATTEING:
- td->td_extrasamples = (((uint16) va_arg(ap, uint16_vap)) != 0);
+ td->td_extrasamples = (((uint16_t) va_arg(ap, uint16_vap)) != 0);
if (td->td_extrasamples) {
- uint16 sv = EXTRASAMPLE_ASSOCALPHA;
+ uint16_t sv = EXTRASAMPLE_ASSOCALPHA;
_TIFFsetShortArray(&td->td_sampleinfo, &sv, 1);
}
break;
case TIFFTAG_TILEWIDTH:
- v32 = (uint32) va_arg(ap, uint32);
+ v32 = (uint32_t) va_arg(ap, uint32_t);
if (v32 % 16) {
if (tif->tif_mode != O_RDONLY)
goto badvalue32;
@@ -400,7 +400,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
tif->tif_flags |= TIFF_ISTILED;
break;
case TIFFTAG_TILELENGTH:
- v32 = (uint32) va_arg(ap, uint32);
+ v32 = (uint32_t) va_arg(ap, uint32_t);
if (v32 % 16) {
if (tif->tif_mode != O_RDONLY)
goto badvalue32;
@@ -411,13 +411,13 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
tif->tif_flags |= TIFF_ISTILED;
break;
case TIFFTAG_TILEDEPTH:
- v32 = (uint32) va_arg(ap, uint32);
+ v32 = (uint32_t) va_arg(ap, uint32_t);
if (v32 == 0)
goto badvalue32;
td->td_tiledepth = v32;
break;
case TIFFTAG_DATATYPE:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
switch (v) {
case DATATYPE_VOID: v = SAMPLEFORMAT_VOID; break;
case DATATYPE_INT: v = SAMPLEFORMAT_INT; break;
@@ -425,13 +425,13 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
case DATATYPE_IEEEFP: v = SAMPLEFORMAT_IEEEFP;break;
default: goto badvalue;
}
- td->td_sampleformat = (uint16) v;
+ td->td_sampleformat = (uint16_t) v;
break;
case TIFFTAG_SAMPLEFORMAT:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if (v < SAMPLEFORMAT_UINT || SAMPLEFORMAT_COMPLEXIEEEFP < v)
goto badvalue;
- td->td_sampleformat = (uint16) v;
+ td->td_sampleformat = (uint16_t) v;
/* Try to fix up the SWAB function for complex data. */
if( td->td_sampleformat == SAMPLEFORMAT_COMPLEXINT
@@ -445,13 +445,13 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
tif->tif_postdecode = _TIFFSwab32BitData;
break;
case TIFFTAG_IMAGEDEPTH:
- td->td_imagedepth = (uint32) va_arg(ap, uint32);
+ td->td_imagedepth = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_SUBIFD:
if ((tif->tif_flags & TIFF_INSUBIFD) == 0) {
- td->td_nsubifd = (uint16) va_arg(ap, uint16_vap);
- _TIFFsetLong8Array(&td->td_subifd, (uint64*) va_arg(ap, uint64*),
- (uint32) td->td_nsubifd);
+ td->td_nsubifd = (uint16_t) va_arg(ap, uint16_vap);
+ _TIFFsetLong8Array(&td->td_subifd, (uint64_t*) va_arg(ap, uint64_t*),
+ (uint32_t) td->td_nsubifd);
} else {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Sorry, cannot nest SubIFDs",
@@ -460,24 +460,24 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
}
break;
case TIFFTAG_YCBCRPOSITIONING:
- td->td_ycbcrpositioning = (uint16) va_arg(ap, uint16_vap);
+ td->td_ycbcrpositioning = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_YCBCRSUBSAMPLING:
- td->td_ycbcrsubsampling[0] = (uint16) va_arg(ap, uint16_vap);
- td->td_ycbcrsubsampling[1] = (uint16) va_arg(ap, uint16_vap);
+ td->td_ycbcrsubsampling[0] = (uint16_t) va_arg(ap, uint16_vap);
+ td->td_ycbcrsubsampling[1] = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_TRANSFERFUNCTION:
v = (td->td_samplesperpixel - td->td_extrasamples) > 1 ? 3 : 1;
for (i = 0; i < v; i++)
_TIFFsetShortArray(&td->td_transferfunction[i],
- va_arg(ap, uint16*), 1U<<td->td_bitspersample);
+ va_arg(ap, uint16_t*), 1U << td->td_bitspersample);
break;
case TIFFTAG_REFERENCEBLACKWHITE:
/* XXX should check for null range */
_TIFFsetFloatArray(&td->td_refblackwhite, va_arg(ap, float*), 6);
break;
case TIFFTAG_INKNAMES:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
s = va_arg(ap, char*);
v = checkInkNamesString(tif, v, s);
status = v > 0;
@@ -487,7 +487,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
}
break;
case TIFFTAG_PERSAMPLE:
- v = (uint16) va_arg(ap, uint16_vap);
+ v = (uint16_t) va_arg(ap, uint16_vap);
if( v == PERSAMPLE_MULTI )
tif->tif_flags |= TIFF_PERSAMPLE;
else
@@ -575,18 +575,18 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
if (fip->field_type == TIFF_ASCII)
{
- uint32 ma;
+ uint32_t ma;
char* mb;
if (fip->field_passcount)
{
assert(fip->field_writecount==TIFF_VARIABLE2);
- ma=(uint32)va_arg(ap,uint32);
+ ma=(uint32_t)va_arg(ap, uint32_t);
mb=(char*)va_arg(ap,char*);
}
else
{
mb=(char*)va_arg(ap,char*);
- ma=(uint32)(strlen(mb)+1);
+ ma=(uint32_t)(strlen(mb) + 1);
}
tv->count=ma;
setByteArray(&tv->value,mb,ma,1);
@@ -595,7 +595,7 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
{
if (fip->field_passcount) {
if (fip->field_writecount == TIFF_VARIABLE2)
- tv->count = (uint32) va_arg(ap, uint32);
+ tv->count = (uint32_t) va_arg(ap, uint32_t);
else
tv->count = (int) va_arg(ap, int);
} else if (fip->field_writecount == TIFF_VARIABLE
@@ -632,9 +632,9 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
handled this way ... likely best if we move it into
the directory structure with an explicit field in
libtiff 4.1 and assign it a FIELD_ value */
- uint16 v2[2];
- v2[0] = (uint16)va_arg(ap, int);
- v2[1] = (uint16)va_arg(ap, int);
+ uint16_t v2[2];
+ v2[0] = (uint16_t)va_arg(ap, int);
+ v2[1] = (uint16_t)va_arg(ap, int);
_TIFFmemcpy(tv->value, &v2, 4);
}
@@ -654,51 +654,51 @@ _TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
case TIFF_BYTE:
case TIFF_UNDEFINED:
{
- uint8 v2 = (uint8)va_arg(ap, int);
+ uint8_t v2 = (uint8_t)va_arg(ap, int);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SBYTE:
{
- int8 v2 = (int8)va_arg(ap, int);
+ int8_t v2 = (int8_t)va_arg(ap, int);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SHORT:
{
- uint16 v2 = (uint16)va_arg(ap, int);
+ uint16_t v2 = (uint16_t)va_arg(ap, int);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SSHORT:
{
- int16 v2 = (int16)va_arg(ap, int);
+ int16_t v2 = (int16_t)va_arg(ap, int);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_LONG:
case TIFF_IFD:
{
- uint32 v2 = va_arg(ap, uint32);
+ uint32_t v2 = va_arg(ap, uint32_t);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SLONG:
{
- int32 v2 = va_arg(ap, int32);
+ int32_t v2 = va_arg(ap, int32_t);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_LONG8:
case TIFF_IFD8:
{
- uint64 v2 = va_arg(ap, uint64);
+ uint64_t v2 = va_arg(ap, uint64_t);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
case TIFF_SLONG8:
{
- int64 v2 = va_arg(ap, int64);
+ int64_t v2 = va_arg(ap, int64_t);
_TIFFmemcpy(val, &v2, tv_size);
}
break;
@@ -793,7 +793,7 @@ badvaluedouble:
* on the format of the data that is written.
*/
static int
-OkToChangeTag(TIFF* tif, uint32 tag)
+OkToChangeTag(TIFF* tif, uint32_t tag)
{
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
if (!fip) { /* unknown tag */
@@ -825,7 +825,7 @@ OkToChangeTag(TIFF* tif, uint32 tag)
* updated.
*/
int
-TIFFSetField(TIFF* tif, uint32 tag, ...)
+TIFFSetField(TIFF* tif, uint32_t tag, ...)
{
va_list ap;
int status;
@@ -840,7 +840,7 @@ TIFFSetField(TIFF* tif, uint32 tag, ...)
* Clear the contents of the field in the internal structure.
*/
int
-TIFFUnsetField(TIFF* tif, uint32 tag)
+TIFFUnsetField(TIFF* tif, uint32_t tag)
{
const TIFFField *fip = TIFFFieldWithTag(tif, tag);
TIFFDirectory* td = &tif->tif_dir;
@@ -884,18 +884,18 @@ TIFFUnsetField(TIFF* tif, uint32 tag)
* top of the library.
*/
int
-TIFFVSetField(TIFF* tif, uint32 tag, va_list ap)
+TIFFVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
return OkToChangeTag(tif, tag) ?
(*tif->tif_tagmethods.vsetfield)(tif, tag, ap) : 0;
}
static int
-_TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
+_TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
TIFFDirectory* td = &tif->tif_dir;
int ret_val = 1;
- uint32 standard_tag = tag;
+ uint32_t standard_tag = tag;
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
return 0;
@@ -914,13 +914,13 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
{
int i;
for (i = 0; i < td->td_customValueCount; i++) {
- uint16 val;
+ uint16_t val;
TIFFTagValue *tv = td->td_customValues + i;
if (tv->info->field_tag != standard_tag)
continue;
if( tv->value == NULL )
return 0;
- val = *(uint16 *)tv->value;
+ val = *(uint16_t *)tv->value;
/* Truncate to SamplesPerPixel, since the */
/* setting code for INKNAMES assume that there are SamplesPerPixel */
/* inknames. */
@@ -932,7 +932,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
val, td->td_samplesperpixel);
val = td->td_samplesperpixel;
}
- *va_arg(ap, uint16*) = val;
+ *va_arg(ap, uint16_t*) = val;
return 1;
}
return 0;
@@ -940,43 +940,43 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
switch (standard_tag) {
case TIFFTAG_SUBFILETYPE:
- *va_arg(ap, uint32*) = td->td_subfiletype;
+ *va_arg(ap, uint32_t*) = td->td_subfiletype;
break;
case TIFFTAG_IMAGEWIDTH:
- *va_arg(ap, uint32*) = td->td_imagewidth;
+ *va_arg(ap, uint32_t*) = td->td_imagewidth;
break;
case TIFFTAG_IMAGELENGTH:
- *va_arg(ap, uint32*) = td->td_imagelength;
+ *va_arg(ap, uint32_t*) = td->td_imagelength;
break;
case TIFFTAG_BITSPERSAMPLE:
- *va_arg(ap, uint16*) = td->td_bitspersample;
+ *va_arg(ap, uint16_t*) = td->td_bitspersample;
break;
case TIFFTAG_COMPRESSION:
- *va_arg(ap, uint16*) = td->td_compression;
+ *va_arg(ap, uint16_t*) = td->td_compression;
break;
case TIFFTAG_PHOTOMETRIC:
- *va_arg(ap, uint16*) = td->td_photometric;
+ *va_arg(ap, uint16_t*) = td->td_photometric;
break;
case TIFFTAG_THRESHHOLDING:
- *va_arg(ap, uint16*) = td->td_threshholding;
+ *va_arg(ap, uint16_t*) = td->td_threshholding;
break;
case TIFFTAG_FILLORDER:
- *va_arg(ap, uint16*) = td->td_fillorder;
+ *va_arg(ap, uint16_t*) = td->td_fillorder;
break;
case TIFFTAG_ORIENTATION:
- *va_arg(ap, uint16*) = td->td_orientation;
+ *va_arg(ap, uint16_t*) = td->td_orientation;
break;
case TIFFTAG_SAMPLESPERPIXEL:
- *va_arg(ap, uint16*) = td->td_samplesperpixel;
+ *va_arg(ap, uint16_t*) = td->td_samplesperpixel;
break;
case TIFFTAG_ROWSPERSTRIP:
- *va_arg(ap, uint32*) = td->td_rowsperstrip;
+ *va_arg(ap, uint32_t*) = td->td_rowsperstrip;
break;
case TIFFTAG_MINSAMPLEVALUE:
- *va_arg(ap, uint16*) = td->td_minsamplevalue;
+ *va_arg(ap, uint16_t*) = td->td_minsamplevalue;
break;
case TIFFTAG_MAXSAMPLEVALUE:
- *va_arg(ap, uint16*) = td->td_maxsamplevalue;
+ *va_arg(ap, uint16_t*) = td->td_maxsamplevalue;
break;
case TIFFTAG_SMINSAMPLEVALUE:
if (tif->tif_flags & TIFF_PERSAMPLE)
@@ -984,7 +984,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
else
{
/* libtiff historically treats this as a single value. */
- uint16 i;
+ uint16_t i;
double v = td->td_sminsamplevalue[0];
for (i=1; i < td->td_samplesperpixel; ++i)
if( td->td_sminsamplevalue[i] < v )
@@ -998,7 +998,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
else
{
/* libtiff historically treats this as a single value. */
- uint16 i;
+ uint16_t i;
double v = td->td_smaxsamplevalue[0];
for (i=1; i < td->td_samplesperpixel; ++i)
if( td->td_smaxsamplevalue[i] > v )
@@ -1013,7 +1013,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
*va_arg(ap, float*) = td->td_yresolution;
break;
case TIFFTAG_PLANARCONFIG:
- *va_arg(ap, uint16*) = td->td_planarconfig;
+ *va_arg(ap, uint16_t*) = td->td_planarconfig;
break;
case TIFFTAG_XPOSITION:
*va_arg(ap, float*) = td->td_xposition;
@@ -1022,90 +1022,90 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
*va_arg(ap, float*) = td->td_yposition;
break;
case TIFFTAG_RESOLUTIONUNIT:
- *va_arg(ap, uint16*) = td->td_resolutionunit;
+ *va_arg(ap, uint16_t*) = td->td_resolutionunit;
break;
case TIFFTAG_PAGENUMBER:
- *va_arg(ap, uint16*) = td->td_pagenumber[0];
- *va_arg(ap, uint16*) = td->td_pagenumber[1];
+ *va_arg(ap, uint16_t*) = td->td_pagenumber[0];
+ *va_arg(ap, uint16_t*) = td->td_pagenumber[1];
break;
case TIFFTAG_HALFTONEHINTS:
- *va_arg(ap, uint16*) = td->td_halftonehints[0];
- *va_arg(ap, uint16*) = td->td_halftonehints[1];
+ *va_arg(ap, uint16_t*) = td->td_halftonehints[0];
+ *va_arg(ap, uint16_t*) = td->td_halftonehints[1];
break;
case TIFFTAG_COLORMAP:
- *va_arg(ap, const uint16**) = td->td_colormap[0];
- *va_arg(ap, const uint16**) = td->td_colormap[1];
- *va_arg(ap, const uint16**) = td->td_colormap[2];
+ *va_arg(ap, const uint16_t**) = td->td_colormap[0];
+ *va_arg(ap, const uint16_t**) = td->td_colormap[1];
+ *va_arg(ap, const uint16_t**) = td->td_colormap[2];
break;
case TIFFTAG_STRIPOFFSETS:
case TIFFTAG_TILEOFFSETS:
_TIFFFillStriles( tif );
- *va_arg(ap, const uint64**) = td->td_stripoffset_p;
+ *va_arg(ap, const uint64_t**) = td->td_stripoffset_p;
break;
case TIFFTAG_STRIPBYTECOUNTS:
case TIFFTAG_TILEBYTECOUNTS:
_TIFFFillStriles( tif );
- *va_arg(ap, const uint64**) = td->td_stripbytecount_p;
+ *va_arg(ap, const uint64_t**) = td->td_stripbytecount_p;
break;
case TIFFTAG_MATTEING:
- *va_arg(ap, uint16*) =
+ *va_arg(ap, uint16_t*) =
(td->td_extrasamples == 1 &&
td->td_sampleinfo[0] == EXTRASAMPLE_ASSOCALPHA);
break;
case TIFFTAG_EXTRASAMPLES:
- *va_arg(ap, uint16*) = td->td_extrasamples;
- *va_arg(ap, const uint16**) = td->td_sampleinfo;
+ *va_arg(ap, uint16_t*) = td->td_extrasamples;
+ *va_arg(ap, const uint16_t**) = td->td_sampleinfo;
break;
case TIFFTAG_TILEWIDTH:
- *va_arg(ap, uint32*) = td->td_tilewidth;
+ *va_arg(ap, uint32_t*) = td->td_tilewidth;
break;
case TIFFTAG_TILELENGTH:
- *va_arg(ap, uint32*) = td->td_tilelength;
+ *va_arg(ap, uint32_t*) = td->td_tilelength;
break;
case TIFFTAG_TILEDEPTH:
- *va_arg(ap, uint32*) = td->td_tiledepth;
+ *va_arg(ap, uint32_t*) = td->td_tiledepth;
break;
case TIFFTAG_DATATYPE:
switch (td->td_sampleformat) {
case SAMPLEFORMAT_UINT:
- *va_arg(ap, uint16*) = DATATYPE_UINT;
+ *va_arg(ap, uint16_t*) = DATATYPE_UINT;
break;
case SAMPLEFORMAT_INT:
- *va_arg(ap, uint16*) = DATATYPE_INT;
+ *va_arg(ap, uint16_t*) = DATATYPE_INT;
break;
case SAMPLEFORMAT_IEEEFP:
- *va_arg(ap, uint16*) = DATATYPE_IEEEFP;
+ *va_arg(ap, uint16_t*) = DATATYPE_IEEEFP;
break;
case SAMPLEFORMAT_VOID:
- *va_arg(ap, uint16*) = DATATYPE_VOID;
+ *va_arg(ap, uint16_t*) = DATATYPE_VOID;
break;
}
break;
case TIFFTAG_SAMPLEFORMAT:
- *va_arg(ap, uint16*) = td->td_sampleformat;
+ *va_arg(ap, uint16_t*) = td->td_sampleformat;
break;
case TIFFTAG_IMAGEDEPTH:
- *va_arg(ap, uint32*) = td->td_imagedepth;
+ *va_arg(ap, uint32_t*) = td->td_imagedepth;
break;
case TIFFTAG_SUBIFD:
- *va_arg(ap, uint16*) = td->td_nsubifd;
- *va_arg(ap, const uint64**) = td->td_subifd;
+ *va_arg(ap, uint16_t*) = td->td_nsubifd;
+ *va_arg(ap, const uint64_t**) = td->td_subifd;
break;
case TIFFTAG_YCBCRPOSITIONING:
- *va_arg(ap, uint16*) = td->td_ycbcrpositioning;
+ *va_arg(ap, uint16_t*) = td->td_ycbcrpositioning;
break;
case TIFFTAG_YCBCRSUBSAMPLING:
- *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[0];
- *va_arg(ap, uint16*) = td->td_ycbcrsubsampling[1];
+ *va_arg(ap, uint16_t*) = td->td_ycbcrsubsampling[0];
+ *va_arg(ap, uint16_t*) = td->td_ycbcrsubsampling[1];
break;
case TIFFTAG_TRANSFERFUNCTION:
- *va_arg(ap, const uint16**) = td->td_transferfunction[0];
+ *va_arg(ap, const uint16_t**) = td->td_transferfunction[0];
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
- *va_arg(ap, const uint16**) = td->td_transferfunction[1];
- *va_arg(ap, const uint16**) = td->td_transferfunction[2];
+ *va_arg(ap, const uint16_t**) = td->td_transferfunction[1];
+ *va_arg(ap, const uint16_t**) = td->td_transferfunction[2];
} else {
- *va_arg(ap, const uint16**) = NULL;
- *va_arg(ap, const uint16**) = NULL;
+ *va_arg(ap, const uint16_t**) = NULL;
+ *va_arg(ap, const uint16_t**) = NULL;
}
break;
case TIFFTAG_REFERENCEBLACKWHITE:
@@ -1151,9 +1151,9 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
if (fip->field_passcount) {
if (fip->field_readcount == TIFF_VARIABLE2)
- *va_arg(ap, uint32*) = (uint32)tv->count;
+ *va_arg(ap, uint32_t*) = (uint32_t)tv->count;
else /* Assume TIFF_VARIABLE */
- *va_arg(ap, uint16*) = (uint16)tv->count;
+ *va_arg(ap, uint16_t*) = (uint16_t)tv->count;
*va_arg(ap, const void **) = tv->value;
ret_val = 1;
} else if (fip->field_tag == TIFFTAG_DOTRANGE
@@ -1162,8 +1162,8 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
handled this way ... likely best if we move it into
the directory structure with an explicit field in
libtiff 4.1 and assign it a FIELD_ value */
- *va_arg(ap, uint16*) = ((uint16 *)tv->value)[0];
- *va_arg(ap, uint16*) = ((uint16 *)tv->value)[1];
+ *va_arg(ap, uint16_t*) = ((uint16_t *)tv->value)[0];
+ *va_arg(ap, uint16_t*) = ((uint16_t *)tv->value)[1];
ret_val = 1;
} else {
if (fip->field_type == TIFF_ASCII
@@ -1179,45 +1179,45 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
switch (fip->field_type) {
case TIFF_BYTE:
case TIFF_UNDEFINED:
- *va_arg(ap, uint8*) =
- *(uint8 *)val;
+ *va_arg(ap, uint8_t*) =
+ *(uint8_t *)val;
ret_val = 1;
break;
case TIFF_SBYTE:
- *va_arg(ap, int8*) =
- *(int8 *)val;
+ *va_arg(ap, int8_t*) =
+ *(int8_t *)val;
ret_val = 1;
break;
case TIFF_SHORT:
- *va_arg(ap, uint16*) =
- *(uint16 *)val;
+ *va_arg(ap, uint16_t*) =
+ *(uint16_t *)val;
ret_val = 1;
break;
case TIFF_SSHORT:
- *va_arg(ap, int16*) =
- *(int16 *)val;
+ *va_arg(ap, int16_t*) =
+ *(int16_t *)val;
ret_val = 1;
break;
case TIFF_LONG:
case TIFF_IFD:
- *va_arg(ap, uint32*) =
- *(uint32 *)val;
+ *va_arg(ap, uint32_t*) =
+ *(uint32_t *)val;
ret_val = 1;
break;
case TIFF_SLONG:
- *va_arg(ap, int32*) =
- *(int32 *)val;
+ *va_arg(ap, int32_t*) =
+ *(int32_t *)val;
ret_val = 1;
break;
case TIFF_LONG8:
case TIFF_IFD8:
- *va_arg(ap, uint64*) =
- *(uint64 *)val;
+ *va_arg(ap, uint64_t*) =
+ *(uint64_t *)val;
ret_val = 1;
break;
case TIFF_SLONG8:
- *va_arg(ap, int64*) =
- *(int64 *)val;
+ *va_arg(ap, int64_t*) =
+ *(int64_t *)val;
ret_val = 1;
break;
case TIFF_RATIONAL:
@@ -1267,7 +1267,7 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
* internal directory structure.
*/
int
-TIFFGetField(TIFF* tif, uint32 tag, ...)
+TIFFGetField(TIFF* tif, uint32_t tag, ...)
{
int status;
va_list ap;
@@ -1285,7 +1285,7 @@ TIFFGetField(TIFF* tif, uint32 tag, ...)
* top of the library.
*/
int
-TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
+TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
return (fip && (isPseudoTag(tag) || TIFFFieldSet(tif, fip->field_bit)) ?
@@ -1368,8 +1368,8 @@ TIFFCreateDirectory(TIFF* tif)
tif->tif_diroff = 0;
tif->tif_nextdiroff = 0;
tif->tif_curoff = 0;
- tif->tif_row = (uint32) -1;
- tif->tif_curstrip = (uint32) -1;
+ tif->tif_row = (uint32_t) -1;
+ tif->tif_curstrip = (uint32_t) -1;
return 0;
}
@@ -1389,8 +1389,8 @@ TIFFCreateCustomDirectory(TIFF* tif, const TIFFFieldArray* infoarray)
tif->tif_diroff = 0;
tif->tif_nextdiroff = 0;
tif->tif_curoff = 0;
- tif->tif_row = (uint32) -1;
- tif->tif_curstrip = (uint32) -1;
+ tif->tif_row = (uint32_t) -1;
+ tif->tif_curstrip = (uint32_t) -1;
return 0;
}
@@ -1432,7 +1432,7 @@ TIFFDefaultDirectory(TIFF* tif)
td->td_threshholding = THRESHHOLD_BILEVEL;
td->td_orientation = ORIENTATION_TOPLEFT;
td->td_samplesperpixel = 1;
- td->td_rowsperstrip = (uint32) -1;
+ td->td_rowsperstrip = (uint32_t) -1;
td->td_tilewidth = 0;
td->td_tilelength = 0;
td->td_tiledepth = 1;
@@ -1456,7 +1456,7 @@ TIFFDefaultDirectory(TIFF* tif)
* but do some prior cleanup first. (http://trac.osgeo.org/gdal/ticket/5054)
*/
if (tif->tif_nfieldscompat > 0) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < tif->tif_nfieldscompat; i++) {
if (tif->tif_fieldscompat[i].allocated_size)
@@ -1490,38 +1490,38 @@ TIFFDefaultDirectory(TIFF* tif)
}
static int
-TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
+TIFFAdvanceDirectory(TIFF* tif, uint64_t* nextdir, uint64_t* off)
{
static const char module[] = "TIFFAdvanceDirectory";
if (isMapped(tif))
{
- uint64 poff=*nextdir;
+ uint64_t poff=*nextdir;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
tmsize_t poffa,poffb,poffc,poffd;
- uint16 dircount;
- uint32 nextdir32;
+ uint16_t dircount;
+ uint32_t nextdir32;
poffa=(tmsize_t)poff;
- poffb=poffa+sizeof(uint16);
- if (((uint64)poffa!=poff)||(poffb<poffa)||(poffb<(tmsize_t)sizeof(uint16))||(poffb>tif->tif_size))
+ poffb=poffa+sizeof(uint16_t);
+ if (((uint64_t)poffa != poff) || (poffb < poffa) || (poffb < (tmsize_t)sizeof(uint16_t)) || (poffb > tif->tif_size))
{
TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory count");
*nextdir=0;
return(0);
}
- _TIFFmemcpy(&dircount,tif->tif_base+poffa,sizeof(uint16));
+ _TIFFmemcpy(&dircount,tif->tif_base+poffa,sizeof(uint16_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(&dircount);
poffc=poffb+dircount*12;
- poffd=poffc+sizeof(uint32);
- if ((poffc<poffb)||(poffc<dircount*12)||(poffd<poffc)||(poffd<(tmsize_t)sizeof(uint32))||(poffd>tif->tif_size))
+ poffd=poffc+sizeof(uint32_t);
+ if ((poffc<poffb) || (poffc<dircount*12) || (poffd<poffc) || (poffd<(tmsize_t)sizeof(uint32_t)) || (poffd > tif->tif_size))
{
TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory link");
return(0);
}
if (off!=NULL)
- *off=(uint64)poffc;
- _TIFFmemcpy(&nextdir32,tif->tif_base+poffc,sizeof(uint32));
+ *off=(uint64_t)poffc;
+ _TIFFmemcpy(&nextdir32,tif->tif_base+poffc,sizeof(uint32_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&nextdir32);
*nextdir=nextdir32;
@@ -1529,16 +1529,16 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
else
{
tmsize_t poffa,poffb,poffc,poffd;
- uint64 dircount64;
- uint16 dircount16;
+ uint64_t dircount64;
+ uint16_t dircount16;
poffa=(tmsize_t)poff;
- poffb=poffa+sizeof(uint64);
- if (((uint64)poffa!=poff)||(poffb<poffa)||(poffb<(tmsize_t)sizeof(uint64))||(poffb>tif->tif_size))
+ poffb=poffa+sizeof(uint64_t);
+ if (((uint64_t)poffa != poff) || (poffb < poffa) || (poffb < (tmsize_t)sizeof(uint64_t)) || (poffb > tif->tif_size))
{
TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory count");
return(0);
}
- _TIFFmemcpy(&dircount64,tif->tif_base+poffa,sizeof(uint64));
+ _TIFFmemcpy(&dircount64,tif->tif_base+poffa,sizeof(uint64_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8(&dircount64);
if (dircount64>0xFFFF)
@@ -1546,17 +1546,17 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
TIFFErrorExt(tif->tif_clientdata,module,"Sanity check on directory count failed");
return(0);
}
- dircount16=(uint16)dircount64;
+ dircount16=(uint16_t)dircount64;
poffc=poffb+dircount16*20;
- poffd=poffc+sizeof(uint64);
- if ((poffc<poffb)||(poffc<dircount16*20)||(poffd<poffc)||(poffd<(tmsize_t)sizeof(uint64))||(poffd>tif->tif_size))
+ poffd=poffc+sizeof(uint64_t);
+ if ((poffc<poffb) || (poffc<dircount16*20) || (poffd<poffc) || (poffd<(tmsize_t)sizeof(uint64_t)) || (poffd > tif->tif_size))
{
TIFFErrorExt(tif->tif_clientdata,module,"Error fetching directory link");
return(0);
}
if (off!=NULL)
- *off=(uint64)poffc;
- _TIFFmemcpy(nextdir,tif->tif_base+poffc,sizeof(uint64));
+ *off=(uint64_t)poffc;
+ _TIFFmemcpy(nextdir,tif->tif_base+poffc,sizeof(uint64_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8(nextdir);
}
@@ -1566,10 +1566,10 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint16 dircount;
- uint32 nextdir32;
+ uint16_t dircount;
+ uint32_t nextdir32;
if (!SeekOK(tif, *nextdir) ||
- !ReadOK(tif, &dircount, sizeof (uint16))) {
+ !ReadOK(tif, &dircount, sizeof (uint16_t))) {
TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
tif->tif_name);
return (0);
@@ -1582,7 +1582,7 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
else
(void) TIFFSeekFile(tif,
dircount*12, SEEK_CUR);
- if (!ReadOK(tif, &nextdir32, sizeof (uint32))) {
+ if (!ReadOK(tif, &nextdir32, sizeof (uint32_t))) {
TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory link",
tif->tif_name);
return (0);
@@ -1593,10 +1593,10 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
}
else
{
- uint64 dircount64;
- uint16 dircount16;
+ uint64_t dircount64;
+ uint16_t dircount16;
if (!SeekOK(tif, *nextdir) ||
- !ReadOK(tif, &dircount64, sizeof (uint64))) {
+ !ReadOK(tif, &dircount64, sizeof (uint64_t))) {
TIFFErrorExt(tif->tif_clientdata, module, "%s: Error fetching directory count",
tif->tif_name);
return (0);
@@ -1608,14 +1608,14 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
TIFFErrorExt(tif->tif_clientdata, module, "Error fetching directory count");
return(0);
}
- dircount16 = (uint16)dircount64;
+ dircount16 = (uint16_t)dircount64;
if (off != NULL)
*off = TIFFSeekFile(tif,
dircount16*20, SEEK_CUR);
else
(void) TIFFSeekFile(tif,
dircount16*20, SEEK_CUR);
- if (!ReadOK(tif, nextdir, sizeof (uint64))) {
+ if (!ReadOK(tif, nextdir, sizeof (uint64_t))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Error fetching directory link",
tif->tif_name);
@@ -1631,12 +1631,12 @@ TIFFAdvanceDirectory(TIFF* tif, uint64* nextdir, uint64* off)
/*
* Count the number of directories in a file.
*/
-uint16
+uint16_t
TIFFNumberOfDirectories(TIFF* tif)
{
static const char module[] = "TIFFNumberOfDirectories";
- uint64 nextdir;
- uint16 n;
+ uint64_t nextdir;
+ uint16_t n;
if (!(tif->tif_flags&TIFF_BIGTIFF))
nextdir = tif->tif_header.classic.tiff_diroff;
else
@@ -1663,10 +1663,10 @@ TIFFNumberOfDirectories(TIFF* tif)
* NB: Directories are numbered starting at 0.
*/
int
-TIFFSetDirectory(TIFF* tif, uint16 dirn)
+TIFFSetDirectory(TIFF* tif, uint16_t dirn)
{
- uint64 nextdir;
- uint16 n;
+ uint64_t nextdir;
+ uint16_t n;
if (!(tif->tif_flags&TIFF_BIGTIFF))
nextdir = tif->tif_header.classic.tiff_diroff;
@@ -1697,7 +1697,7 @@ TIFFSetDirectory(TIFF* tif, uint16 dirn)
* the SubIFD tag (e.g. thumbnail images).
*/
int
-TIFFSetSubDirectory(TIFF* tif, uint64 diroff)
+TIFFSetSubDirectory(TIFF* tif, uint64_t diroff)
{
tif->tif_nextdiroff = diroff;
/*
@@ -1711,7 +1711,7 @@ TIFFSetSubDirectory(TIFF* tif, uint64 diroff)
/*
* Return file offset of the current directory.
*/
-uint64
+uint64_t
TIFFCurrentDirOffset(TIFF* tif)
{
return (tif->tif_diroff);
@@ -1731,12 +1731,12 @@ TIFFLastDirectory(TIFF* tif)
* Unlink the specified directory from the directory chain.
*/
int
-TIFFUnlinkDirectory(TIFF* tif, uint16 dirn)
+TIFFUnlinkDirectory(TIFF* tif, uint16_t dirn)
{
static const char module[] = "TIFFUnlinkDirectory";
- uint64 nextdir;
- uint64 off;
- uint16 n;
+ uint64_t nextdir;
+ uint64_t off;
+ uint16_t n;
if (tif->tif_mode == O_RDONLY) {
TIFFErrorExt(tif->tif_clientdata, module,
@@ -1780,12 +1780,12 @@ TIFFUnlinkDirectory(TIFF* tif, uint16 dirn)
(void) TIFFSeekFile(tif, off, SEEK_SET);
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 nextdir32;
- nextdir32=(uint32)nextdir;
- assert((uint64)nextdir32==nextdir);
+ uint32_t nextdir32;
+ nextdir32=(uint32_t)nextdir;
+ assert((uint64_t)nextdir32 == nextdir);
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&nextdir32);
- if (!WriteOK(tif, &nextdir32, sizeof (uint32))) {
+ if (!WriteOK(tif, &nextdir32, sizeof (uint32_t))) {
TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
return (0);
}
@@ -1794,7 +1794,7 @@ TIFFUnlinkDirectory(TIFF* tif, uint16 dirn)
{
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong8(&nextdir);
- if (!WriteOK(tif, &nextdir, sizeof (uint64))) {
+ if (!WriteOK(tif, &nextdir, sizeof (uint64_t))) {
TIFFErrorExt(tif->tif_clientdata, module, "Error writing directory link");
return (0);
}
@@ -1820,8 +1820,8 @@ TIFFUnlinkDirectory(TIFF* tif, uint16 dirn)
tif->tif_diroff = 0; /* force link on next write */
tif->tif_nextdiroff = 0; /* next write must be at end */
tif->tif_curoff = 0;
- tif->tif_row = (uint32) -1;
- tif->tif_curstrip = (uint32) -1;
+ tif->tif_row = (uint32_t) -1;
+ tif->tif_curstrip = (uint32_t) -1;
return (1);
}
diff --git a/libtiff/tif_dir.h b/libtiff/tif_dir.h
index f608dd71..1782b35d 100644
--- a/libtiff/tif_dir.h
+++ b/libtiff/tif_dir.h
@@ -50,15 +50,15 @@ typedef struct {
* it is left-justified in the offset field.
*/
typedef struct {
- uint16 tdir_tag; /* see below */
- uint16 tdir_type; /* data type; see below */
- uint64 tdir_count; /* number of items; length in spec */
+ uint16_t tdir_tag; /* see below */
+ uint16_t tdir_type; /* data type; see below */
+ uint64_t tdir_count; /* number of items; length in spec */
union {
- uint16 toff_short;
- uint32 toff_long;
- uint64 toff_long8;
+ uint16_t toff_short;
+ uint32_t toff_long;
+ uint64_t toff_long8;
} tdir_offset; /* either offset or the data itself if fits */
- uint8 tdir_ignore; /* flag status to ignore tag when parsing tags in tif_dirread.c */
+ uint8_t tdir_ignore; /* flag status to ignore tag when parsing tags in tif_dirread.c */
} TIFFDirEntry;
/*
@@ -69,50 +69,50 @@ typedef struct {
/* bit vector of fields that are set */
unsigned long td_fieldsset[FIELD_SETLONGS];
- uint32 td_imagewidth, td_imagelength, td_imagedepth;
- uint32 td_tilewidth, td_tilelength, td_tiledepth;
- uint32 td_subfiletype;
- uint16 td_bitspersample;
- uint16 td_sampleformat;
- uint16 td_compression;
- uint16 td_photometric;
- uint16 td_threshholding;
- uint16 td_fillorder;
- uint16 td_orientation;
- uint16 td_samplesperpixel;
- uint32 td_rowsperstrip;
- uint16 td_minsamplevalue, td_maxsamplevalue;
+ uint32_t td_imagewidth, td_imagelength, td_imagedepth;
+ uint32_t td_tilewidth, td_tilelength, td_tiledepth;
+ uint32_t td_subfiletype;
+ uint16_t td_bitspersample;
+ uint16_t td_sampleformat;
+ uint16_t td_compression;
+ uint16_t td_photometric;
+ uint16_t td_threshholding;
+ uint16_t td_fillorder;
+ uint16_t td_orientation;
+ uint16_t td_samplesperpixel;
+ uint32_t td_rowsperstrip;
+ uint16_t td_minsamplevalue, td_maxsamplevalue;
double* td_sminsamplevalue;
double* td_smaxsamplevalue;
float td_xresolution, td_yresolution;
- uint16 td_resolutionunit;
- uint16 td_planarconfig;
+ uint16_t td_resolutionunit;
+ uint16_t td_planarconfig;
float td_xposition, td_yposition;
- uint16 td_pagenumber[2];
- uint16* td_colormap[3];
- uint16 td_halftonehints[2];
- uint16 td_extrasamples;
- uint16* td_sampleinfo;
+ uint16_t td_pagenumber[2];
+ uint16_t* td_colormap[3];
+ uint16_t td_halftonehints[2];
+ uint16_t td_extrasamples;
+ uint16_t* td_sampleinfo;
/* even though the name is misleading, td_stripsperimage is the number
* of striles (=strips or tiles) per plane, and td_nstrips the total
* number of striles */
- uint32 td_stripsperimage;
- uint32 td_nstrips; /* size of offset & bytecount arrays */
- uint64* td_stripoffset_p; /* should be accessed with TIFFGetStrileOffset */
- uint64* td_stripbytecount_p; /* should be accessed with TIFFGetStrileByteCount */
- uint32 td_stripoffsetbyteallocsize; /* number of elements currently allocated for td_stripoffset/td_stripbytecount. Only used if TIFF_LAZYSTRILELOAD is set */
+ uint32_t td_stripsperimage;
+ uint32_t td_nstrips; /* size of offset & bytecount arrays */
+ uint64_t* td_stripoffset_p; /* should be accessed with TIFFGetStrileOffset */
+ uint64_t* td_stripbytecount_p; /* should be accessed with TIFFGetStrileByteCount */
+ uint32_t td_stripoffsetbyteallocsize; /* number of elements currently allocated for td_stripoffset/td_stripbytecount. Only used if TIFF_LAZYSTRILELOAD is set */
#ifdef STRIPBYTECOUNTSORTED_UNUSED
int td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
#endif
TIFFDirEntry td_stripoffset_entry; /* for deferred loading */
TIFFDirEntry td_stripbytecount_entry; /* for deferred loading */
- uint16 td_nsubifd;
- uint64* td_subifd;
+ uint16_t td_nsubifd;
+ uint64_t* td_subifd;
/* YCbCr parameters */
- uint16 td_ycbcrsubsampling[2];
- uint16 td_ycbcrpositioning;
+ uint16_t td_ycbcrsubsampling[2];
+ uint16_t td_ycbcrpositioning;
/* Colorimetry parameters */
- uint16* td_transferfunction[3];
+ uint16_t* td_transferfunction[3];
float* td_refblackwhite;
/* CMYK parameters */
int td_inknameslen;
@@ -276,17 +276,17 @@ typedef enum {
struct _TIFFFieldArray {
TIFFFieldArrayType type; /* array type, will be used to determine if IFD is image and such */
- uint32 allocated_size; /* 0 if array is constant, other if modified by future definition extension support */
- uint32 count; /* number of elements in fields array */
+ uint32_t allocated_size; /* 0 if array is constant, other if modified by future definition extension support */
+ uint32_t count; /* number of elements in fields array */
TIFFField* fields; /* actual field info */
};
struct _TIFFField {
- uint32 field_tag; /* field's tag */
+ uint32_t field_tag; /* field's tag */
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
short field_writecount; /* write count/TIFF_VARIABLE */
TIFFDataType field_type; /* type of associated data */
- uint32 reserved; /* reserved for future extension */
+ uint32_t reserved; /* reserved for future extension */
TIFFSetGetFieldType set_field_type; /* type to be passed to TIFFSetField */
TIFFSetGetFieldType get_field_type; /* type to be passed to TIFFGetField */
unsigned short field_bit; /* bit in fieldsset bit vector */
@@ -296,9 +296,9 @@ struct _TIFFField {
TIFFFieldArray* field_subfields; /* if field points to child ifds, child ifd field definition array */
};
-extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32);
-extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32, TIFFDataType);
-extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32, TIFFDataType);
+extern int _TIFFMergeFields(TIFF*, const TIFFField[], uint32_t);
+extern const TIFFField* _TIFFFindOrRegisterField(TIFF *, uint32_t, TIFFDataType);
+extern TIFFField* _TIFFCreateAnonField(TIFF *, uint32_t, TIFFDataType);
extern int _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag);
#if defined(__cplusplus)
diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
index 7cff3ba6..8565dfbc 100644
--- a/libtiff/tif_dirinfo.c
+++ b/libtiff/tif_dirinfo.c
@@ -415,7 +415,7 @@ void
_TIFFSetupFields(TIFF* tif, const TIFFFieldArray* fieldarray)
{
if (tif->tif_fields && tif->tif_nfields > 0) {
- uint32 i;
+ uint32_t i;
for (i = 0; i < tif->tif_nfields; i++) {
TIFFField *fld = tif->tif_fields[i];
@@ -464,12 +464,12 @@ tagNameCompare(const void* a, const void* b)
}
int
-_TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32 n)
+_TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32_t n)
{
static const char module[] = "_TIFFMergeFields";
static const char reason[] = "for fields array";
/* TIFFField** tp; */
- uint32 i;
+ uint32_t i;
tif->tif_foundfield = NULL;
@@ -511,7 +511,7 @@ _TIFFMergeFields(TIFF* tif, const TIFFField info[], uint32 n)
void
_TIFFPrintFieldInfo(TIFF* tif, FILE* fd)
{
- uint32 i;
+ uint32_t i;
fprintf(fd, "%s: \n", tif->tif_name);
for (i = 0; i < tif->tif_nfields; i++) {
@@ -677,7 +677,7 @@ _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype)
const TIFFField*
-TIFFFindField(TIFF* tif, uint32 tag, TIFFDataType dt)
+TIFFFindField(TIFF* tif, uint32_t tag, TIFFDataType dt)
{
TIFFField key = {0, 0, 0, TIFF_NOTYPE, 0, 0, 0, 0, 0, 0, NULL, NULL};
TIFFField* pkey = &key;
@@ -729,7 +729,7 @@ _TIFFFindFieldByName(TIFF* tif, const char *field_name, TIFFDataType dt)
}
const TIFFField*
-TIFFFieldWithTag(TIFF* tif, uint32 tag)
+TIFFFieldWithTag(TIFF* tif, uint32_t tag)
{
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
if (!fip) {
@@ -752,7 +752,7 @@ TIFFFieldWithName(TIFF* tif, const char *field_name)
return (fip);
}
-uint32
+uint32_t
TIFFFieldTag(const TIFFField* fip)
{
return fip->field_tag;
@@ -789,7 +789,7 @@ TIFFFieldWriteCount(const TIFFField* fip)
}
const TIFFField*
-_TIFFFindOrRegisterField(TIFF *tif, uint32 tag, TIFFDataType dt)
+_TIFFFindOrRegisterField(TIFF *tif, uint32_t tag, TIFFDataType dt)
{
const TIFFField *fld;
@@ -805,7 +805,7 @@ _TIFFFindOrRegisterField(TIFF *tif, uint32 tag, TIFFDataType dt)
}
TIFFField*
-_TIFFCreateAnonField(TIFF *tif, uint32 tag, TIFFDataType field_type)
+_TIFFCreateAnonField(TIFF *tif, uint32_t tag, TIFFDataType field_type)
{
TIFFField *fld;
(void) tif;
@@ -1059,13 +1059,13 @@ _TIFFSetGetType(TIFFDataType type, short count, unsigned char passcount)
}
int
-TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32 n)
+TIFFMergeFieldInfo(TIFF* tif, const TIFFFieldInfo info[], uint32_t n)
{
static const char module[] = "TIFFMergeFieldInfo";
static const char reason[] = "for fields array";
TIFFField *tp;
size_t nfields;
- uint32 i;
+ uint32_t i;
if (tif->tif_nfieldscompat > 0) {
tif->tif_fieldscompat = (TIFFFieldArray *)
diff --git a/libtiff/tif_dirread.c b/libtiff/tif_dirread.c
index 3df0ec5c..9f7a404a 100644
--- a/libtiff/tif_dirread.c
+++ b/libtiff/tif_dirread.c
@@ -39,19 +39,14 @@
#include <float.h>
#include <stdlib.h>
-#define FAILED_FII ((uint32) -1)
-
-/*
- * Largest 64-bit signed integer value.
- */
-#define TIFF_INT64_MAX ((int64)(TIFF_UINT64_MAX >> 1))
+#define FAILED_FII ((uint32_t) -1)
#ifdef HAVE_IEEEFP
# define TIFFCvtIEEEFloatToNative(tif, n, fp)
# define TIFFCvtIEEEDoubleToNative(tif, n, dp)
#else
-extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32, float*);
-extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32, double*);
+extern void TIFFCvtIEEEFloatToNative(TIFF*, uint32_t, float*);
+extern void TIFFCvtIEEEDoubleToNative(TIFF*, uint32_t, double*);
#endif
enum TIFFReadDirEntryErr {
@@ -65,126 +60,126 @@ enum TIFFReadDirEntryErr {
TIFFReadDirEntryErrAlloc = 7,
};
-static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* direntry, uint8* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* direntry, uint32* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* direntry, uint64* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* direntry, uint8_t* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* direntry, uint32_t* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryFloat(TIFF* tif, TIFFDirEntry* direntry, float* value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryDouble(TIFF* tif, TIFFDirEntry* direntry, double* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* direntry, uint64* value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntry* direntry, uint8** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEntry* direntry, int8** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEntry* direntry, uint16** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEntry* direntry, int16** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntry* direntry, uint32** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEntry* direntry, int32** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8Array(TIFF* tif, TIFFDirEntry* direntry, uint64** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEntry* direntry, int64** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32_t* count, uint32_t desttypesize, void** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntry* direntry, uint8_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEntry* direntry, int8_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEntry* direntry, uint16_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEntry* direntry, int16_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntry* direntry, uint32_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEntry* direntry, int32_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8Array(TIFF* tif, TIFFDirEntry* direntry, uint64_t** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEntry* direntry, int64_t** value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEntry* direntry, float** value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntry* direntry, uint64** value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntry* direntry, uint64_t** value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value);
#if 0
static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleDouble(TIFF* tif, TIFFDirEntry* direntry, double* value);
#endif
-static void TIFFReadDirEntryCheckedByte(TIFF* tif, TIFFDirEntry* direntry, uint8* value);
-static void TIFFReadDirEntryCheckedSbyte(TIFF* tif, TIFFDirEntry* direntry, int8* value);
-static void TIFFReadDirEntryCheckedShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value);
-static void TIFFReadDirEntryCheckedSshort(TIFF* tif, TIFFDirEntry* direntry, int16* value);
-static void TIFFReadDirEntryCheckedLong(TIFF* tif, TIFFDirEntry* direntry, uint32* value);
-static void TIFFReadDirEntryCheckedSlong(TIFF* tif, TIFFDirEntry* direntry, int32* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedLong8(TIFF* tif, TIFFDirEntry* direntry, uint64* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSlong8(TIFF* tif, TIFFDirEntry* direntry, int64* value);
+static void TIFFReadDirEntryCheckedByte(TIFF* tif, TIFFDirEntry* direntry, uint8_t* value);
+static void TIFFReadDirEntryCheckedSbyte(TIFF* tif, TIFFDirEntry* direntry, int8_t* value);
+static void TIFFReadDirEntryCheckedShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value);
+static void TIFFReadDirEntryCheckedSshort(TIFF* tif, TIFFDirEntry* direntry, int16_t* value);
+static void TIFFReadDirEntryCheckedLong(TIFF* tif, TIFFDirEntry* direntry, uint32_t* value);
+static void TIFFReadDirEntryCheckedSlong(TIFF* tif, TIFFDirEntry* direntry, int32_t* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedLong8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSlong8(TIFF* tif, TIFFDirEntry* direntry, int64_t* value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedRational(TIFF* tif, TIFFDirEntry* direntry, double* value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSrational(TIFF* tif, TIFFDirEntry* direntry, double* value);
static void TIFFReadDirEntryCheckedFloat(TIFF* tif, TIFFDirEntry* direntry, float* value);
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedDouble(TIFF* tif, TIFFDirEntry* direntry, double* value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSbyte(int8 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteShort(uint16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSshort(int16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong(uint32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong(uint32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSbyte(int8 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSshort(int16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong(uint32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortShort(uint16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong(uint32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSbyte(int8 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSshort(int16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongLong(uint32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongLong8(uint64 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongSlong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Sbyte(int8 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Sshort(int16 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Slong(int32 value);
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Slong8(int64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlong8Long8(uint64 value);
-
-static enum TIFFReadDirEntryErr TIFFReadDirEntryData(TIFF* tif, uint64 offset, tmsize_t size, void* dest);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSbyte(int8_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteShort(uint16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSshort(int16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong(uint32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong(uint32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSbyte(int8_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSshort(int16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong(uint32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortShort(uint16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong(uint32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSbyte(int8_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSshort(int16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongLong(uint32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongLong8(uint64_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlongSlong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Sbyte(int8_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Sshort(int16_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Slong(int32_t value);
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLong8Slong8(int64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSlong8Long8(uint64_t value);
+
+static enum TIFFReadDirEntryErr TIFFReadDirEntryData(TIFF* tif, uint64_t offset, tmsize_t size, void* dest);
static void TIFFReadDirEntryOutputErr(TIFF* tif, enum TIFFReadDirEntryErr err, const char* module, const char* tagname, int recover);
-static void TIFFReadDirectoryCheckOrder(TIFF* tif, TIFFDirEntry* dir, uint16 dircount);
-static TIFFDirEntry* TIFFReadDirectoryFindEntry(TIFF* tif, TIFFDirEntry* dir, uint16 dircount, uint16 tagid);
-static void TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii);
+static void TIFFReadDirectoryCheckOrder(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount);
+static TIFFDirEntry* TIFFReadDirectoryFindEntry(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount, uint16_t tagid);
+static void TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16_t tagid, uint32_t* fii);
-static int EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount);
+static int EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount);
static void MissingRequired(TIFF*, const char*);
-static int TIFFCheckDirOffset(TIFF* tif, uint64 diroff);
-static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32);
-static uint16 TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir, uint64* nextdiroff);
+static int TIFFCheckDirOffset(TIFF* tif, uint64_t diroff);
+static int CheckDirCount(TIFF*, TIFFDirEntry*, uint32_t);
+static uint16_t TIFFFetchDirectory(TIFF* tif, uint64_t diroff, TIFFDirEntry** pdir, uint64_t* nextdiroff);
static int TIFFFetchNormalTag(TIFF*, TIFFDirEntry*, int recover);
-static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp);
+static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32_t nstrips, uint64_t** lpp);
static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
static void ChopUpSingleUncompressedStrip(TIFF*);
static void TryChopUpUncompressedBigTiff(TIFF*);
-static uint64 TIFFReadUInt64(const uint8 *value);
-static int _TIFFGetMaxColorChannels(uint16 photometric);
+static uint64_t TIFFReadUInt64(const uint8_t *value);
+static int _TIFFGetMaxColorChannels(uint16_t photometric);
static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount );
typedef union _UInt64Aligned_t
{
double d;
- uint64 l;
- uint32 i[2];
- uint16 s[4];
- uint8 c[8];
+ uint64_t l;
+ uint32_t i[2];
+ uint16_t s[4];
+ uint8_t c[8];
} UInt64Aligned_t;
/*
- Unaligned safe copy of a uint64 value from an octet array.
+ Unaligned safe copy of a uint64_t value from an octet array.
*/
-static uint64 TIFFReadUInt64(const uint8 *value)
+static uint64_t TIFFReadUInt64(const uint8_t *value)
{
UInt64Aligned_t result;
@@ -200,7 +195,7 @@ static uint64 TIFFReadUInt64(const uint8 *value)
return result.l;
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* direntry, uint8* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* direntry, uint8_t* value)
{
enum TIFFReadDirEntryErr err;
if (direntry->tdir_count!=1)
@@ -213,76 +208,76 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* di
return(TIFFReadDirEntryErrOk);
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeByteSbyte(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
{
- uint16 m;
+ uint16_t m;
TIFFReadDirEntryCheckedShort(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeByteShort(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeByteSshort(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeByteLong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeByteSlong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
{
- uint64 m;
+ uint64_t m;
err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeByteLong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeByteSlong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint8)m;
+ *value=(uint8_t)m;
return(TIFFReadDirEntryErrOk);
}
default:
@@ -290,7 +285,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByte(TIFF* tif, TIFFDirEntry* di
}
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value)
{
enum TIFFReadDirEntryErr err;
if (direntry->tdir_count!=1)
@@ -299,19 +294,19 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* d
{
case TIFF_BYTE:
{
- uint8 m;
+ uint8_t m;
TIFFReadDirEntryCheckedByte(tif,direntry,&m);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeShortSbyte(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
@@ -319,56 +314,56 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* d
return(TIFFReadDirEntryErrOk);
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeShortSshort(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeShortLong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeShortSlong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
{
- uint64 m;
+ uint64_t m;
err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeShortLong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeShortSlong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint16)m;
+ *value=(uint16_t)m;
return(TIFFReadDirEntryErrOk);
}
default:
@@ -376,7 +371,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShort(TIFF* tif, TIFFDirEntry* d
}
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* direntry, uint32* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* direntry, uint32_t* value)
{
enum TIFFReadDirEntryErr err;
if (direntry->tdir_count!=1)
@@ -385,36 +380,36 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* di
{
case TIFF_BYTE:
{
- uint8 m;
+ uint8_t m;
TIFFReadDirEntryCheckedByte(tif,direntry,&m);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLongSbyte(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
{
- uint16 m;
+ uint16_t m;
TIFFReadDirEntryCheckedShort(tif,direntry,&m);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLongSshort(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
@@ -422,36 +417,36 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* di
return(TIFFReadDirEntryErrOk);
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLongSlong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
{
- uint64 m;
+ uint64_t m;
err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeLongLong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeLongSlong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint32)m;
+ *value=(uint32_t)m;
return(TIFFReadDirEntryErrOk);
}
default:
@@ -459,7 +454,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong(TIFF* tif, TIFFDirEntry* di
}
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* direntry, uint64* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value)
{
enum TIFFReadDirEntryErr err;
if (direntry->tdir_count!=1)
@@ -468,53 +463,53 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* d
{
case TIFF_BYTE:
{
- uint8 m;
+ uint8_t m;
TIFFReadDirEntryCheckedByte(tif,direntry,&m);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLong8Sbyte(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
{
- uint16 m;
+ uint16_t m;
TIFFReadDirEntryCheckedShort(tif,direntry,&m);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLong8Sshort(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
err=TIFFReadDirEntryCheckRangeLong8Slong(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
@@ -522,14 +517,14 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8(TIFF* tif, TIFFDirEntry* d
return(err);
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
err=TIFFReadDirEntryCheckRangeLong8Slong8(m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
default:
@@ -546,49 +541,49 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloat(TIFF* tif, TIFFDirEntry* d
{
case TIFF_BYTE:
{
- uint8 m;
+ uint8_t m;
TIFFReadDirEntryCheckedByte(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
{
- uint16 m;
+ uint16_t m;
TIFFReadDirEntryCheckedShort(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
*value=(float)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
{
- uint64 m;
+ uint64_t m;
err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
@@ -606,7 +601,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloat(TIFF* tif, TIFFDirEntry* d
}
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
@@ -659,49 +654,49 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDouble(TIFF* tif, TIFFDirEntry*
{
case TIFF_BYTE:
{
- uint8 m;
+ uint8_t m;
TIFFReadDirEntryCheckedByte(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
{
- int8 m;
+ int8_t m;
TIFFReadDirEntryCheckedSbyte(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SHORT:
{
- uint16 m;
+ uint16_t m;
TIFFReadDirEntryCheckedShort(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
{
- int16 m;
+ int16_t m;
TIFFReadDirEntryCheckedSshort(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
{
- int32 m;
+ int32_t m;
TIFFReadDirEntryCheckedSlong(tif,direntry,&m);
*value=(double)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
{
- uint64 m;
+ uint64_t m;
err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
@@ -719,7 +714,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDouble(TIFF* tif, TIFFDirEntry*
}
case TIFF_SLONG8:
{
- int64 m;
+ int64_t m;
err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
return(err);
@@ -747,7 +742,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDouble(TIFF* tif, TIFFDirEntry*
}
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* direntry, uint64* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value)
{
enum TIFFReadDirEntryErr err;
if (direntry->tdir_count!=1)
@@ -757,9 +752,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* di
case TIFF_LONG:
case TIFF_IFD:
{
- uint32 m;
+ uint32_t m;
TIFFReadDirEntryCheckedLong(tif,direntry,&m);
- *value=(uint64)m;
+ *value=(uint64_t)m;
return(TIFFReadDirEntryErrOk);
}
case TIFF_LONG8:
@@ -777,7 +772,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* di
#define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
- TIFF* tif, uint64 offset, tmsize_t size, void** pdest)
+ TIFF* tif, uint64_t offset, tmsize_t size, void** pdest)
{
#if SIZEOF_SIZE_T == 8
tmsize_t threshold = INITIAL_THRESHOLD;
@@ -808,7 +803,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
}
#endif
- new_dest = (uint8*) _TIFFrealloc(
+ new_dest = (uint8_t*) _TIFFrealloc(
*pdest, already_read + to_read);
if( new_dest == NULL )
{
@@ -832,13 +827,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
}
static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
- TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize,
- void** value, uint64 maxcount)
+ TIFF* tif, TIFFDirEntry* direntry, uint32_t* count, uint32_t desttypesize,
+ void** value, uint64_t maxcount)
{
int typesize;
- uint32 datasize;
+ uint32_t datasize;
void* data;
- uint64 target_count64;
+ uint64_t target_count64;
int original_datasize_clamped;
typesize=TIFFDataWidth(direntry->tdir_type);
@@ -863,16 +858,16 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
* in either the current data type or the dest data type. This also
* avoids problems with overflow of tmsize_t on 32bit systems.
*/
- if ((uint64)(2147483647/typesize)<target_count64)
+ if ((uint64_t)(2147483647 / typesize) < target_count64)
return(TIFFReadDirEntryErrSizesan);
- if ((uint64)(2147483647/desttypesize)<target_count64)
+ if ((uint64_t)(2147483647 / desttypesize) < target_count64)
return(TIFFReadDirEntryErrSizesan);
- *count=(uint32)target_count64;
+ *count=(uint32_t)target_count64;
datasize=(*count)*typesize;
assert((tmsize_t)datasize>0);
- if( isMapped(tif) && datasize > (uint64)tif->tif_size )
+ if( isMapped(tif) && datasize > (uint64_t)tif->tif_size )
return TIFFReadDirEntryErrIo;
if( !isMapped(tif) &&
@@ -894,13 +889,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
else
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
if( isMapped(tif) )
- err=TIFFReadDirEntryData(tif,(uint64)offset,(tmsize_t)datasize,data);
+ err=TIFFReadDirEntryData(tif, (uint64_t)offset, (tmsize_t)datasize, data);
else
- err=TIFFReadDirEntryDataAndRealloc(tif,(uint64)offset,(tmsize_t)datasize,&data);
+ err=TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset, (tmsize_t)datasize, &data);
if (err!=TIFFReadDirEntryErrOk)
{
_TIFFfree(data);
@@ -915,13 +910,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
else
{
enum TIFFReadDirEntryErr err;
- uint64 offset = direntry->tdir_offset.toff_long8;
+ uint64_t offset = direntry->tdir_offset.toff_long8;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8(&offset);
if( isMapped(tif) )
- err=TIFFReadDirEntryData(tif,(uint64)offset,(tmsize_t)datasize,data);
+ err=TIFFReadDirEntryData(tif, (uint64_t)offset, (tmsize_t)datasize, data);
else
- err=TIFFReadDirEntryDataAndRealloc(tif,(uint64)offset,(tmsize_t)datasize,&data);
+ err=TIFFReadDirEntryDataAndRealloc(tif, (uint64_t)offset, (tmsize_t)datasize, &data);
if (err!=TIFFReadDirEntryErrOk)
{
_TIFFfree(data);
@@ -933,18 +928,18 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32_t* count, uint32_t desttypesize, void** value)
{
return TIFFReadDirEntryArrayWithLimit(tif, direntry, count,
- desttypesize, value, ~((uint64)0));
+ desttypesize, value, ~((uint64_t)0));
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntry* direntry, uint8** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntry* direntry, uint8_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- uint8* data;
+ uint8_t* data;
switch (direntry->tdir_type)
{
case TIFF_ASCII:
@@ -972,13 +967,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
case TIFF_ASCII:
case TIFF_UNDEFINED:
case TIFF_BYTE:
- *value=(uint8*)origdata;
+ *value=(uint8_t*)origdata;
return(TIFFReadDirEntryErrOk);
case TIFF_SBYTE:
{
- int8* m;
- uint32 n;
- m=(int8*)origdata;
+ int8_t* m;
+ uint32_t n;
+ m=(int8_t*)origdata;
for (n=0; n<count; n++)
{
err=TIFFReadDirEntryCheckRangeByteSbyte(*m);
@@ -989,11 +984,11 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
}
m++;
}
- *value=(uint8*)origdata;
+ *value=(uint8_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
}
- data=(uint8*)_TIFFmalloc(count);
+ data=(uint8_t*)_TIFFmalloc(count);
if (data==0)
{
_TIFFfree(origdata);
@@ -1003,10 +998,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
{
case TIFF_SHORT:
{
- uint16* ma;
- uint8* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1015,34 +1010,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
err=TIFFReadDirEntryCheckRangeByteShort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- uint8* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
err=TIFFReadDirEntryCheckRangeByteSshort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
- uint8* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1051,34 +1046,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
err=TIFFReadDirEntryCheckRangeByteLong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- uint8* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
err=TIFFReadDirEntryCheckRangeByteSlong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- uint8* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1087,25 +1082,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
err=TIFFReadDirEntryCheckRangeByteLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- uint8* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ uint8_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeByteSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint8)(*ma++);
+ *mb++=(uint8_t)(*ma++);
}
}
break;
@@ -1120,12 +1115,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryByteArray(TIFF* tif, TIFFDirEntr
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEntry* direntry, int8** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEntry* direntry, int8_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- int8* data;
+ int8_t* data;
switch (direntry->tdir_type)
{
case TIFF_UNDEFINED:
@@ -1152,9 +1147,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
case TIFF_UNDEFINED:
case TIFF_BYTE:
{
- uint8* m;
- uint32 n;
- m=(uint8*)origdata;
+ uint8_t* m;
+ uint32_t n;
+ m=(uint8_t*)origdata;
for (n=0; n<count; n++)
{
err=TIFFReadDirEntryCheckRangeSbyteByte(*m);
@@ -1165,14 +1160,14 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
}
m++;
}
- *value=(int8*)origdata;
+ *value=(int8_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SBYTE:
- *value=(int8*)origdata;
+ *value=(int8_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
- data=(int8*)_TIFFmalloc(count);
+ data=(int8_t*)_TIFFmalloc(count);
if (data==0)
{
_TIFFfree(origdata);
@@ -1182,10 +1177,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
{
case TIFF_SHORT:
{
- uint16* ma;
- int8* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1194,34 +1189,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeSbyteShort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- int8* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
err=TIFFReadDirEntryCheckRangeSbyteSshort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
- int8* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1230,34 +1225,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeSbyteLong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- int8* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
err=TIFFReadDirEntryCheckRangeSbyteSlong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- int8* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1266,25 +1261,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeSbyteLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- int8* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ int8_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeSbyteSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int8)(*ma++);
+ *mb++=(int8_t)(*ma++);
}
}
break;
@@ -1299,12 +1294,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEnt
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEntry* direntry, uint16** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEntry* direntry, uint16_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- uint16* data;
+ uint16_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -1328,19 +1323,19 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
switch (direntry->tdir_type)
{
case TIFF_SHORT:
- *value=(uint16*)origdata;
+ *value=(uint16_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfShort(*value,count);
return(TIFFReadDirEntryErrOk);
case TIFF_SSHORT:
{
- int16* m;
- uint32 n;
- m=(int16*)origdata;
+ int16_t* m;
+ uint32_t n;
+ m=(int16_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)m);
+ TIFFSwabShort((uint16_t*)m);
err=TIFFReadDirEntryCheckRangeShortSshort(*m);
if (err!=TIFFReadDirEntryErrOk)
{
@@ -1349,11 +1344,11 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
}
m++;
}
- *value=(uint16*)origdata;
+ *value=(uint16_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
}
- data=(uint16*)_TIFFmalloc(count*2);
+ data=(uint16_t*)_TIFFmalloc(count * 2);
if (data==0)
{
_TIFFfree(origdata);
@@ -1363,37 +1358,37 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
{
case TIFF_BYTE:
{
- uint8* ma;
- uint16* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- uint16* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
err=TIFFReadDirEntryCheckRangeShortSbyte(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
- uint16* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1402,34 +1397,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeShortLong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- uint16* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
err=TIFFReadDirEntryCheckRangeShortSlong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- uint16* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1438,25 +1433,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeShortLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- uint16* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ uint16_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeShortSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint16)(*ma++);
+ *mb++=(uint16_t)(*ma++);
}
}
break;
@@ -1471,12 +1466,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryShortArray(TIFF* tif, TIFFDirEnt
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEntry* direntry, int16** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEntry* direntry, int16_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- int16* data;
+ int16_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -1501,9 +1496,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
{
case TIFF_SHORT:
{
- uint16* m;
- uint32 n;
- m=(uint16*)origdata;
+ uint16_t* m;
+ uint32_t n;
+ m=(uint16_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
@@ -1516,16 +1511,16 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
}
m++;
}
- *value=(int16*)origdata;
+ *value=(int16_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SSHORT:
- *value=(int16*)origdata;
+ *value=(int16_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfShort((uint16*)(*value),count);
+ TIFFSwabArrayOfShort((uint16_t*)(*value), count);
return(TIFFReadDirEntryErrOk);
}
- data=(int16*)_TIFFmalloc(count*2);
+ data=(int16_t*)_TIFFmalloc(count * 2);
if (data==0)
{
_TIFFfree(origdata);
@@ -1535,32 +1530,32 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
{
case TIFF_BYTE:
{
- uint8* ma;
- int16* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- int16* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
break;
case TIFF_LONG:
{
- uint32* ma;
- int16* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1569,34 +1564,34 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
err=TIFFReadDirEntryCheckRangeSshortLong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- int16* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
err=TIFFReadDirEntryCheckRangeSshortSlong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- int16* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1605,25 +1600,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
err=TIFFReadDirEntryCheckRangeSshortLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- int16* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ int16_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeSshortSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int16)(*ma++);
+ *mb++=(int16_t)(*ma++);
}
}
break;
@@ -1638,12 +1633,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySshortArray(TIFF* tif, TIFFDirEn
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntry* direntry, uint32** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntry* direntry, uint32_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- uint32* data;
+ uint32_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -1667,19 +1662,19 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntr
switch (direntry->tdir_type)
{
case TIFF_LONG:
- *value=(uint32*)origdata;
+ *value=(uint32_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong(*value,count);
return(TIFFReadDirEntryErrOk);
case TIFF_SLONG:
{
- int32* m;
- uint32 n;
- m=(int32*)origdata;
+ int32_t* m;
+ uint32_t n;
+ m=(int32_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)m);
+ TIFFSwabLong((uint32_t*)m);
err=TIFFReadDirEntryCheckRangeLongSlong(*m);
if (err!=TIFFReadDirEntryErrOk)
{
@@ -1688,11 +1683,11 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntr
}
m++;
}
- *value=(uint32*)origdata;
+ *value=(uint32_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
}
- data=(uint32*)_TIFFmalloc(count*4);
+ data=(uint32_t*)_TIFFmalloc(count * 4);
if (data==0)
{
_TIFFfree(origdata);
@@ -1702,70 +1697,70 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntr
{
case TIFF_BYTE:
{
- uint8* ma;
- uint32* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- uint32* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
err=TIFFReadDirEntryCheckRangeLongSbyte(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
}
break;
case TIFF_SHORT:
{
- uint16* ma;
- uint32* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(ma);
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- uint32* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
err=TIFFReadDirEntryCheckRangeLongSshort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- uint32* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1774,25 +1769,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntr
err=TIFFReadDirEntryCheckRangeLongLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- uint32* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ uint32_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeLongSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint32)(*ma++);
+ *mb++=(uint32_t)(*ma++);
}
}
break;
@@ -1807,12 +1802,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLongArray(TIFF* tif, TIFFDirEntr
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEntry* direntry, int32** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEntry* direntry, int32_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- int32* data;
+ int32_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -1837,13 +1832,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEnt
{
case TIFF_LONG:
{
- uint32* m;
- uint32 n;
- m=(uint32*)origdata;
+ uint32_t* m;
+ uint32_t n;
+ m=(uint32_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)m);
+ TIFFSwabLong((uint32_t*)m);
err=TIFFReadDirEntryCheckRangeSlongLong(*m);
if (err!=TIFFReadDirEntryErrOk)
{
@@ -1852,16 +1847,16 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEnt
}
m++;
}
- *value=(int32*)origdata;
+ *value=(int32_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG:
- *value=(int32*)origdata;
+ *value=(int32_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)(*value),count);
+ TIFFSwabArrayOfLong((uint32_t*)(*value), count);
return(TIFFReadDirEntryErrOk);
}
- data=(int32*)_TIFFmalloc(count*4);
+ data=(int32_t*)_TIFFmalloc(count * 4);
if (data==0)
{
_TIFFfree(origdata);
@@ -1871,62 +1866,62 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEnt
{
case TIFF_BYTE:
{
- uint8* ma;
- int32* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int32)(*ma++);
+ *mb++=(int32_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- int32* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int32)(*ma++);
+ *mb++=(int32_t)(*ma++);
}
break;
case TIFF_SHORT:
{
- uint16* ma;
- int32* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(ma);
- *mb++=(int32)(*ma++);
+ *mb++=(int32_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- int32* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
- *mb++=(int32)(*ma++);
+ TIFFSwabShort((uint16_t*)ma);
+ *mb++=(int32_t)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
- int32* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint64_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -1935,25 +1930,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEnt
err=TIFFReadDirEntryCheckRangeSlongLong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int32)(*ma++);
+ *mb++=(int32_t)(*ma++);
}
}
break;
case TIFF_SLONG8:
{
- int64* ma;
- int32* mb;
- uint32 n;
- ma=(int64*)origdata;
+ int64_t* ma;
+ int32_t* mb;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
err=TIFFReadDirEntryCheckRangeSlongSlong8(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(int32)(*ma++);
+ *mb++=(int32_t)(*ma++);
}
}
break;
@@ -1969,12 +1964,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlongArray(TIFF* tif, TIFFDirEnt
}
static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8ArrayWithLimit(
- TIFF* tif, TIFFDirEntry* direntry, uint64** value, uint64 maxcount)
+ TIFF* tif, TIFFDirEntry* direntry, uint64_t** value, uint64_t maxcount)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- uint64* data;
+ uint64_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -1998,19 +1993,19 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8ArrayWithLimit(
switch (direntry->tdir_type)
{
case TIFF_LONG8:
- *value=(uint64*)origdata;
+ *value=(uint64_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong8(*value,count);
return(TIFFReadDirEntryErrOk);
case TIFF_SLONG8:
{
- int64* m;
- uint32 n;
- m=(int64*)origdata;
+ int64_t* m;
+ uint32_t n;
+ m=(int64_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)m);
+ TIFFSwabLong8((uint64_t*)m);
err=TIFFReadDirEntryCheckRangeLong8Slong8(*m);
if (err!=TIFFReadDirEntryErrOk)
{
@@ -2019,11 +2014,11 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8ArrayWithLimit(
}
m++;
}
- *value=(uint64*)origdata;
+ *value=(uint64_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
}
- data=(uint64*)_TIFFmalloc(count*8);
+ data=(uint64_t*)_TIFFmalloc(count * 8);
if (data==0)
{
_TIFFfree(origdata);
@@ -2033,94 +2028,94 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8ArrayWithLimit(
{
case TIFF_BYTE:
{
- uint8* ma;
- uint64* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- uint64* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
err=TIFFReadDirEntryCheckRangeLong8Sbyte(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
case TIFF_SHORT:
{
- uint16* ma;
- uint64* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(ma);
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- uint64* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
err=TIFFReadDirEntryCheckRangeLong8Sshort(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
- uint64* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- uint64* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
err=TIFFReadDirEntryCheckRangeLong8Slong(*ma);
if (err!=TIFFReadDirEntryErrOk)
break;
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
@@ -2135,17 +2130,17 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8ArrayWithLimit(
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8Array(TIFF* tif, TIFFDirEntry* direntry, uint64** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryLong8Array(TIFF* tif, TIFFDirEntry* direntry, uint64_t** value)
{
- return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value, ~((uint64)0));
+ return TIFFReadDirEntryLong8ArrayWithLimit(tif, direntry, value, ~((uint64_t)0));
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEntry* direntry, int64** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEntry* direntry, int64_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- int64* data;
+ int64_t* data;
switch (direntry->tdir_type)
{
case TIFF_BYTE:
@@ -2170,9 +2165,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEn
{
case TIFF_LONG8:
{
- uint64* m;
- uint32 n;
- m=(uint64*)origdata;
+ uint64_t* m;
+ uint32_t n;
+ m=(uint64_t*)origdata;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
@@ -2185,16 +2180,16 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEn
}
m++;
}
- *value=(int64*)origdata;
+ *value=(int64_t*)origdata;
return(TIFFReadDirEntryErrOk);
}
case TIFF_SLONG8:
- *value=(int64*)origdata;
+ *value=(int64_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8((uint64*)(*value),count);
+ TIFFSwabArrayOfLong8((uint64_t*)(*value), count);
return(TIFFReadDirEntryErrOk);
}
- data=(int64*)_TIFFmalloc(count*8);
+ data=(int64_t*)_TIFFmalloc(count * 8);
if (data==0)
{
_TIFFfree(origdata);
@@ -2204,83 +2199,83 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEn
{
case TIFF_BYTE:
{
- uint8* ma;
- int64* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint8_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int64)(*ma++);
+ *mb++=(int64_t)(*ma++);
}
break;
case TIFF_SBYTE:
{
- int8* ma;
- int64* mb;
- uint32 n;
- ma=(int8*)origdata;
+ int8_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
- *mb++=(int64)(*ma++);
+ *mb++=(int64_t)(*ma++);
}
break;
case TIFF_SHORT:
{
- uint16* ma;
- int64* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint16_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(ma);
- *mb++=(int64)(*ma++);
+ *mb++=(int64_t)(*ma++);
}
}
break;
case TIFF_SSHORT:
{
- int16* ma;
- int64* mb;
- uint32 n;
- ma=(int16*)origdata;
+ int16_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
- *mb++=(int64)(*ma++);
+ TIFFSwabShort((uint16_t*)ma);
+ *mb++=(int64_t)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
- int64* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
- *mb++=(int64)(*ma++);
+ *mb++=(int64_t)(*ma++);
}
}
break;
case TIFF_SLONG:
{
- int32* ma;
- int64* mb;
- uint32 n;
- ma=(int32*)origdata;
+ int32_t* ma;
+ int64_t* mb;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
- *mb++=(int64)(*ma++);
+ TIFFSwabLong((uint32_t*)ma);
+ *mb++=(int64_t)(*ma++);
}
}
break;
@@ -2293,7 +2288,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntrySlong8Array(TIFF* tif, TIFFDirEn
static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEntry* direntry, float** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
float* data;
switch (direntry->tdir_type)
@@ -2324,7 +2319,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
{
case TIFF_FLOAT:
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)origdata,count);
+ TIFFSwabArrayOfLong((uint32_t*)origdata, count);
TIFFCvtIEEEDoubleToNative(tif,count,(float*)origdata);
*value=(float*)origdata;
return(TIFFReadDirEntryErrOk);
@@ -2339,10 +2334,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
{
case TIFF_BYTE:
{
- uint8* ma;
+ uint8_t* ma;
float* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
*mb++=(float)(*ma++);
@@ -2350,10 +2345,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SBYTE:
{
- int8* ma;
+ int8_t* ma;
float* mb;
- uint32 n;
- ma=(int8*)origdata;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
*mb++=(float)(*ma++);
@@ -2361,10 +2356,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SHORT:
{
- uint16* ma;
+ uint16_t* ma;
float* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2376,25 +2371,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SSHORT:
{
- int16* ma;
+ int16_t* ma;
float* mb;
- uint32 n;
- ma=(int16*)origdata;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
*mb++=(float)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
+ uint32_t* ma;
float* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2406,25 +2401,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SLONG:
{
- int32* ma;
+ int32_t* ma;
float* mb;
- uint32 n;
- ma=(int32*)origdata;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
*mb++=(float)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
+ uint64_t* ma;
float* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2445,27 +2440,27 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SLONG8:
{
- int64* ma;
+ int64_t* ma;
float* mb;
- uint32 n;
- ma=(int64*)origdata;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
*mb++=(float)(*ma++);
}
}
break;
case TIFF_RATIONAL:
{
- uint32* ma;
- uint32 maa;
- uint32 mab;
+ uint32_t* ma;
+ uint32_t maa;
+ uint32_t mab;
float* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2484,18 +2479,18 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
break;
case TIFF_SRATIONAL:
{
- uint32* ma;
- int32 maa;
- uint32 mab;
+ uint32_t* ma;
+ int32_t maa;
+ uint32_t mab;
float* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
- maa=*(int32*)ma;
+ maa=*(int32_t*)ma;
ma++;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
@@ -2511,9 +2506,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryFloatArray(TIFF* tif, TIFFDirEnt
{
double* ma;
float* mb;
- uint32 n;
+ uint32_t n;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8((uint64*)origdata,count);
+ TIFFSwabArrayOfLong8((uint64_t*)origdata, count);
TIFFCvtIEEEDoubleToNative(tif,count,(double*)origdata);
ma=(double*)origdata;
mb=data;
@@ -2538,7 +2533,7 @@ static enum TIFFReadDirEntryErr
TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
double* data;
switch (direntry->tdir_type)
@@ -2569,7 +2564,7 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
{
case TIFF_DOUBLE:
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8((uint64*)origdata,count);
+ TIFFSwabArrayOfLong8((uint64_t*)origdata, count);
TIFFCvtIEEEDoubleToNative(tif,count,(double*)origdata);
*value=(double*)origdata;
return(TIFFReadDirEntryErrOk);
@@ -2584,10 +2579,10 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
{
case TIFF_BYTE:
{
- uint8* ma;
+ uint8_t* ma;
double* mb;
- uint32 n;
- ma=(uint8*)origdata;
+ uint32_t n;
+ ma=(uint8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
*mb++=(double)(*ma++);
@@ -2595,10 +2590,10 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SBYTE:
{
- int8* ma;
+ int8_t* ma;
double* mb;
- uint32 n;
- ma=(int8*)origdata;
+ uint32_t n;
+ ma=(int8_t*)origdata;
mb=data;
for (n=0; n<count; n++)
*mb++=(double)(*ma++);
@@ -2606,10 +2601,10 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SHORT:
{
- uint16* ma;
+ uint16_t* ma;
double* mb;
- uint32 n;
- ma=(uint16*)origdata;
+ uint32_t n;
+ ma=(uint16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2621,25 +2616,25 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SSHORT:
{
- int16* ma;
+ int16_t* ma;
double* mb;
- uint32 n;
- ma=(int16*)origdata;
+ uint32_t n;
+ ma=(int16_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
+ TIFFSwabShort((uint16_t*)ma);
*mb++=(double)(*ma++);
}
}
break;
case TIFF_LONG:
{
- uint32* ma;
+ uint32_t* ma;
double* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2651,25 +2646,25 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SLONG:
{
- int32* ma;
+ int32_t* ma;
double* mb;
- uint32 n;
- ma=(int32*)origdata;
+ uint32_t n;
+ ma=(int32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
+ TIFFSwabLong((uint32_t*)ma);
*mb++=(double)(*ma++);
}
}
break;
case TIFF_LONG8:
{
- uint64* ma;
+ uint64_t* ma;
double* mb;
- uint32 n;
- ma=(uint64*)origdata;
+ uint32_t n;
+ ma=(uint64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2690,27 +2685,27 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SLONG8:
{
- int64* ma;
+ int64_t* ma;
double* mb;
- uint32 n;
- ma=(int64*)origdata;
+ uint32_t n;
+ ma=(int64_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
*mb++=(double)(*ma++);
}
}
break;
case TIFF_RATIONAL:
{
- uint32* ma;
- uint32 maa;
- uint32 mab;
+ uint32_t* ma;
+ uint32_t maa;
+ uint32_t mab;
double* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
@@ -2729,18 +2724,18 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
break;
case TIFF_SRATIONAL:
{
- uint32* ma;
- int32 maa;
- uint32 mab;
+ uint32_t* ma;
+ int32_t maa;
+ uint32_t mab;
double* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
- maa=*(int32*)ma;
+ maa=*(int32_t*)ma;
ma++;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
@@ -2756,9 +2751,9 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
{
float* ma;
double* mb;
- uint32 n;
+ uint32_t n;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)origdata,count);
+ TIFFSwabArrayOfLong((uint32_t*)origdata, count);
TIFFCvtIEEEFloatToNative(tif,count,(float*)origdata);
ma=(float*)origdata;
mb=data;
@@ -2772,12 +2767,12 @@ TIFFReadDirEntryDoubleArray(TIFF* tif, TIFFDirEntry* direntry, double** value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntry* direntry, uint64** value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntry* direntry, uint64_t** value)
{
enum TIFFReadDirEntryErr err;
- uint32 count;
+ uint32_t count;
void* origdata;
- uint64* data;
+ uint64_t* data;
switch (direntry->tdir_type)
{
case TIFF_LONG:
@@ -2798,12 +2793,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntr
{
case TIFF_LONG8:
case TIFF_IFD8:
- *value=(uint64*)origdata;
+ *value=(uint64_t*)origdata;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong8(*value,count);
return(TIFFReadDirEntryErrOk);
}
- data=(uint64*)_TIFFmalloc(count*8);
+ data=(uint64_t*)_TIFFmalloc(count * 8);
if (data==0)
{
_TIFFfree(origdata);
@@ -2814,16 +2809,16 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntr
case TIFF_LONG:
case TIFF_IFD:
{
- uint32* ma;
- uint64* mb;
- uint32 n;
- ma=(uint32*)origdata;
+ uint32_t* ma;
+ uint64_t* mb;
+ uint32_t n;
+ ma=(uint32_t*)origdata;
mb=data;
for (n=0; n<count; n++)
{
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(ma);
- *mb++=(uint64)(*ma++);
+ *mb++=(uint64_t)(*ma++);
}
}
break;
@@ -2833,13 +2828,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8Array(TIFF* tif, TIFFDirEntr
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value)
{
enum TIFFReadDirEntryErr err;
- uint16* m;
- uint16* na;
- uint16 nb;
- if (direntry->tdir_count<(uint64)tif->tif_dir.td_samplesperpixel)
+ uint16_t* m;
+ uint16_t* na;
+ uint16_t nb;
+ if (direntry->tdir_count<(uint64_t)tif->tif_dir.td_samplesperpixel)
return(TIFFReadDirEntryErrCount);
err=TIFFReadDirEntryShortArray(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk || m == NULL)
@@ -2867,8 +2862,8 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleDouble(TIFF* tif, TIFFD
enum TIFFReadDirEntryErr err;
double* m;
double* na;
- uint16 nb;
- if (direntry->tdir_count<(uint64)tif->tif_dir.td_samplesperpixel)
+ uint16_t nb;
+ if (direntry->tdir_count<(uint64_t)tif->tif_dir.td_samplesperpixel)
return(TIFFReadDirEntryErrCount);
err=TIFFReadDirEntryDoubleArray(tif,direntry,&m);
if (err!=TIFFReadDirEntryErrOk)
@@ -2891,53 +2886,53 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryPersampleDouble(TIFF* tif, TIFFD
}
#endif
-static void TIFFReadDirEntryCheckedByte(TIFF* tif, TIFFDirEntry* direntry, uint8* value)
+static void TIFFReadDirEntryCheckedByte(TIFF* tif, TIFFDirEntry* direntry, uint8_t* value)
{
(void) tif;
- *value=*(uint8*)(&direntry->tdir_offset);
+ *value=*(uint8_t*)(&direntry->tdir_offset);
}
-static void TIFFReadDirEntryCheckedSbyte(TIFF* tif, TIFFDirEntry* direntry, int8* value)
+static void TIFFReadDirEntryCheckedSbyte(TIFF* tif, TIFFDirEntry* direntry, int8_t* value)
{
(void) tif;
- *value=*(int8*)(&direntry->tdir_offset);
+ *value=*(int8_t*)(&direntry->tdir_offset);
}
-static void TIFFReadDirEntryCheckedShort(TIFF* tif, TIFFDirEntry* direntry, uint16* value)
+static void TIFFReadDirEntryCheckedShort(TIFF* tif, TIFFDirEntry* direntry, uint16_t* value)
{
*value = direntry->tdir_offset.toff_short;
- /* *value=*(uint16*)(&direntry->tdir_offset); */
+ /* *value=*(uint16_t*)(&direntry->tdir_offset); */
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(value);
}
-static void TIFFReadDirEntryCheckedSshort(TIFF* tif, TIFFDirEntry* direntry, int16* value)
+static void TIFFReadDirEntryCheckedSshort(TIFF* tif, TIFFDirEntry* direntry, int16_t* value)
{
- *value=*(int16*)(&direntry->tdir_offset);
+ *value=*(int16_t*)(&direntry->tdir_offset);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)value);
+ TIFFSwabShort((uint16_t*)value);
}
-static void TIFFReadDirEntryCheckedLong(TIFF* tif, TIFFDirEntry* direntry, uint32* value)
+static void TIFFReadDirEntryCheckedLong(TIFF* tif, TIFFDirEntry* direntry, uint32_t* value)
{
- *value=*(uint32*)(&direntry->tdir_offset);
+ *value=*(uint32_t*)(&direntry->tdir_offset);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(value);
}
-static void TIFFReadDirEntryCheckedSlong(TIFF* tif, TIFFDirEntry* direntry, int32* value)
+static void TIFFReadDirEntryCheckedSlong(TIFF* tif, TIFFDirEntry* direntry, int32_t* value)
{
- *value=*(int32*)(&direntry->tdir_offset);
+ *value=*(int32_t*)(&direntry->tdir_offset);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)value);
+ TIFFSwabLong((uint32_t*)value);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedLong8(TIFF* tif, TIFFDirEntry* direntry, uint64* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedLong8(TIFF* tif, TIFFDirEntry* direntry, uint64_t* value)
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,value);
@@ -2951,12 +2946,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedLong8(TIFF* tif, TIFFDirE
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSlong8(TIFF* tif, TIFFDirEntry* direntry, int64* value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSlong8(TIFF* tif, TIFFDirEntry* direntry, int64_t* value)
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,value);
@@ -2964,9 +2959,9 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSlong8(TIFF* tif, TIFFDir
return(err);
}
else
- *value=*(int64*)(&direntry->tdir_offset);
+ *value=*(int64_t*)(&direntry->tdir_offset);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)value);
+ TIFFSwabLong8((uint64_t*)value);
return(TIFFReadDirEntryErrOk);
}
@@ -2975,12 +2970,12 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedRational(TIFF* tif, TIFFD
UInt64Aligned_t m;
assert(sizeof(double)==8);
- assert(sizeof(uint64)==8);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint64_t) == 8);
+ assert(sizeof(uint32_t) == 4);
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,m.i);
@@ -3005,13 +3000,13 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSrational(TIFF* tif, TIFF
{
UInt64Aligned_t m;
assert(sizeof(double)==8);
- assert(sizeof(uint64)==8);
- assert(sizeof(int32)==4);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint64_t) == 8);
+ assert(sizeof(int32_t) == 4);
+ assert(sizeof(uint32_t) == 4);
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,m.i);
@@ -3025,10 +3020,10 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedSrational(TIFF* tif, TIFF
/* Not completely sure what we should do when m.i[1]==0, but some */
/* sanitizers do not like division by 0.0: */
/* http://bugzilla.maptools.org/show_bug.cgi?id=2644 */
- if ((int32)m.i[0]==0 || m.i[1]==0)
+ if ((int32_t)m.i[0] == 0 || m.i[1] == 0)
*value=0.0;
else
- *value=(double)((int32)m.i[0])/(double)m.i[1];
+ *value= (double)((int32_t)m.i[0]) / (double)m.i[1];
return(TIFFReadDirEntryErrOk);
}
@@ -3037,26 +3032,26 @@ static void TIFFReadDirEntryCheckedFloat(TIFF* tif, TIFFDirEntry* direntry, floa
union
{
float f;
- uint32 i;
+ uint32_t i;
} float_union;
assert(sizeof(float)==4);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint32_t) == 4);
assert(sizeof(float_union)==4);
- float_union.i=*(uint32*)(&direntry->tdir_offset);
+ float_union.i=*(uint32_t*)(&direntry->tdir_offset);
*value=float_union.f;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)value);
+ TIFFSwabLong((uint32_t*)value);
}
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedDouble(TIFF* tif, TIFFDirEntry* direntry, double* value)
{
assert(sizeof(double)==8);
- assert(sizeof(uint64)==8);
+ assert(sizeof(uint64_t) == 8);
assert(sizeof(UInt64Aligned_t)==8);
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
enum TIFFReadDirEntryErr err;
- uint32 offset = direntry->tdir_offset.toff_long;
+ uint32_t offset = direntry->tdir_offset.toff_long;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,value);
@@ -3070,11 +3065,11 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckedDouble(TIFF* tif, TIFFDir
*value=uint64_union.d;
}
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)value);
+ TIFFSwabLong8((uint64_t*)value);
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSbyte(int8 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSbyte(int8_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3082,7 +3077,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSbyte(int8 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteShort(uint16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteShort(uint16_t value)
{
if (value>0xFF)
return(TIFFReadDirEntryErrRange);
@@ -3090,7 +3085,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteShort(uint16 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSshort(int16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSshort(int16_t value)
{
if ((value<0)||(value>0xFF))
return(TIFFReadDirEntryErrRange);
@@ -3098,7 +3093,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSshort(int16 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong(uint32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong(uint32_t value)
{
if (value>0xFF)
return(TIFFReadDirEntryErrRange);
@@ -3106,7 +3101,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong(uint32 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong(int32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong(int32_t value)
{
if ((value<0)||(value>0xFF))
return(TIFFReadDirEntryErrRange);
@@ -3114,7 +3109,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong(int32 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong8(uint64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong8(uint64_t value)
{
if (value>0xFF)
return(TIFFReadDirEntryErrRange);
@@ -3122,7 +3117,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteLong8(uint64 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64_t value)
{
if ((value<0)||(value>0xFF))
return(TIFFReadDirEntryErrRange);
@@ -3130,7 +3125,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeByteSlong8(int64 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8_t value)
{
if (value>0x7F)
return(TIFFReadDirEntryErrRange);
@@ -3138,7 +3133,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteByte(uint8 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16_t value)
{
if (value>0x7F)
return(TIFFReadDirEntryErrRange);
@@ -3146,7 +3141,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16_t value)
{
if ((value<-0x80)||(value>0x7F))
return(TIFFReadDirEntryErrRange);
@@ -3154,7 +3149,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSshort(int16 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong(uint32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong(uint32_t value)
{
if (value>0x7F)
return(TIFFReadDirEntryErrRange);
@@ -3162,7 +3157,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong(uint32 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32_t value)
{
if ((value<-0x80)||(value>0x7F))
return(TIFFReadDirEntryErrRange);
@@ -3170,7 +3165,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong(int32 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong8(uint64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong8(uint64_t value)
{
if (value>0x7F)
return(TIFFReadDirEntryErrRange);
@@ -3178,7 +3173,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteLong8(uint64 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong8(int64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong8(int64_t value)
{
if ((value<-0x80)||(value>0x7F))
return(TIFFReadDirEntryErrRange);
@@ -3186,7 +3181,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteSlong8(int64 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSbyte(int8 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSbyte(int8_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3194,7 +3189,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSbyte(int8 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSshort(int16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSshort(int16_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3202,7 +3197,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSshort(int16 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong(uint32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong(uint32_t value)
{
if (value>0xFFFF)
return(TIFFReadDirEntryErrRange);
@@ -3210,7 +3205,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong(uint32 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong(int32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong(int32_t value)
{
if ((value<0)||(value>0xFFFF))
return(TIFFReadDirEntryErrRange);
@@ -3218,7 +3213,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong(int32 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong8(uint64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong8(uint64_t value)
{
if (value>0xFFFF)
return(TIFFReadDirEntryErrRange);
@@ -3226,7 +3221,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortLong8(uint64 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong8(int64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong8(int64_t value)
{
if ((value<0)||(value>0xFFFF))
return(TIFFReadDirEntryErrRange);
@@ -3234,7 +3229,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeShortSlong8(int64 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortShort(uint16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortShort(uint16_t value)
{
if (value>0x7FFF)
return(TIFFReadDirEntryErrRange);
@@ -3242,7 +3237,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortShort(uint16 val
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong(uint32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong(uint32_t value)
{
if (value>0x7FFF)
return(TIFFReadDirEntryErrRange);
@@ -3250,7 +3245,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong(uint32 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong(int32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong(int32_t value)
{
if ((value<-0x8000)||(value>0x7FFF))
return(TIFFReadDirEntryErrRange);
@@ -3258,7 +3253,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong(int32 valu
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong8(uint64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong8(uint64_t value)
{
if (value>0x7FFF)
return(TIFFReadDirEntryErrRange);
@@ -3266,7 +3261,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortLong8(uint64 val
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong8(int64 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong8(int64_t value)
{
if ((value<-0x8000)||(value>0x7FFF))
return(TIFFReadDirEntryErrRange);
@@ -3274,7 +3269,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSshortSlong8(int64 val
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSbyte(int8 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSbyte(int8_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3282,7 +3277,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSbyte(int8 value)
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSshort(int16 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSshort(int16_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3290,7 +3285,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSshort(int16 value
return(TIFFReadDirEntryErrOk);
}
-static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32 value)
+static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32_t value)
{
if (value<0)
return(TIFFReadDirEntryErrRange);
@@ -3299,25 +3294,25 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeLongSlong(int32 value)
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLongLong8(uint64 value)
+TIFFReadDirEntryCheckRangeLongLong8(uint64_t value)
{
- if (value > TIFF_UINT32_MAX)
+ if (value > UINT32_MAX)
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLongSlong8(int64 value)
+TIFFReadDirEntryCheckRangeLongSlong8(int64_t value)
{
- if ((value < 0) || (value > (int64) TIFF_UINT32_MAX))
+ if ((value < 0) || (value > (int64_t) UINT32_MAX))
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeSlongLong(uint32 value)
+TIFFReadDirEntryCheckRangeSlongLong(uint32_t value)
{
if (value > 0x7FFFFFFFUL)
return(TIFFReadDirEntryErrRange);
@@ -3327,7 +3322,7 @@ TIFFReadDirEntryCheckRangeSlongLong(uint32 value)
/* Check that the 8-byte unsigned value can fit in a 4-byte unsigned range */
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeSlongLong8(uint64 value)
+TIFFReadDirEntryCheckRangeSlongLong8(uint64_t value)
{
if (value > 0x7FFFFFFF)
return(TIFFReadDirEntryErrRange);
@@ -3337,16 +3332,16 @@ TIFFReadDirEntryCheckRangeSlongLong8(uint64 value)
/* Check that the 8-byte signed value can fit in a 4-byte signed range */
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeSlongSlong8(int64 value)
+TIFFReadDirEntryCheckRangeSlongSlong8(int64_t value)
{
- if ((value < 0-((int64) 0x7FFFFFFF+1)) || (value > 0x7FFFFFFF))
+ if ((value < 0-((int64_t) 0x7FFFFFFF + 1)) || (value > 0x7FFFFFFF))
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLong8Sbyte(int8 value)
+TIFFReadDirEntryCheckRangeLong8Sbyte(int8_t value)
{
if (value < 0)
return(TIFFReadDirEntryErrRange);
@@ -3355,7 +3350,7 @@ TIFFReadDirEntryCheckRangeLong8Sbyte(int8 value)
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLong8Sshort(int16 value)
+TIFFReadDirEntryCheckRangeLong8Sshort(int16_t value)
{
if (value < 0)
return(TIFFReadDirEntryErrRange);
@@ -3364,7 +3359,7 @@ TIFFReadDirEntryCheckRangeLong8Sshort(int16 value)
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLong8Slong(int32 value)
+TIFFReadDirEntryCheckRangeLong8Slong(int32_t value)
{
if (value < 0)
return(TIFFReadDirEntryErrRange);
@@ -3373,7 +3368,7 @@ TIFFReadDirEntryCheckRangeLong8Slong(int32 value)
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeLong8Slong8(int64 value)
+TIFFReadDirEntryCheckRangeLong8Slong8(int64_t value)
{
if (value < 0)
return(TIFFReadDirEntryErrRange);
@@ -3382,16 +3377,16 @@ TIFFReadDirEntryCheckRangeLong8Slong8(int64 value)
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryCheckRangeSlong8Long8(uint64 value)
+TIFFReadDirEntryCheckRangeSlong8Long8(uint64_t value)
{
- if (value > TIFF_INT64_MAX)
+ if (value > INT64_MAX)
return(TIFFReadDirEntryErrRange);
else
return(TIFFReadDirEntryErrOk);
}
static enum TIFFReadDirEntryErr
-TIFFReadDirEntryData(TIFF* tif, uint64 offset, tmsize_t size, void* dest)
+TIFFReadDirEntryData(TIFF* tif, uint64_t offset, tmsize_t size, void* dest)
{
assert(size>0);
if (!isMapped(tif)) {
@@ -3402,13 +3397,13 @@ TIFFReadDirEntryData(TIFF* tif, uint64 offset, tmsize_t size, void* dest)
} else {
size_t ma,mb;
ma=(size_t)offset;
- if( (uint64)ma!=offset ||
+ if((uint64_t)ma != offset ||
ma > (~(size_t)0) - (size_t)size )
{
return TIFFReadDirEntryErrIo;
}
mb=ma+size;
- if (mb > (uint64)tif->tif_size)
+ if (mb > (uint64_t)tif->tif_size)
return(TIFFReadDirEntryErrIo);
_TIFFmemcpy(dest,tif->tif_base+ma,size);
}
@@ -3507,7 +3502,7 @@ static void TIFFReadDirEntryOutputErr(TIFF* tif, enum TIFFReadDirEntryErr err, c
* type. 0 is returned if photometric type isn't supported or no default value
* is defined by the specification.
*/
-static int _TIFFGetMaxColorChannels( uint16 photometric )
+static int _TIFFGetMaxColorChannels(uint16_t photometric )
{
switch (photometric) {
case PHOTOMETRIC_PALETTE:
@@ -3546,9 +3541,9 @@ static int ByteCountLooksBad(TIFF* tif)
* until the whole image will be written and directory
* dumped out.
*/
- uint64 bytecount = TIFFGetStrileByteCount(tif, 0);
- uint64 offset = TIFFGetStrileOffset(tif, 0);
- uint64 filesize;
+ uint64_t bytecount = TIFFGetStrileByteCount(tif, 0);
+ uint64_t offset = TIFFGetStrileOffset(tif, 0);
+ uint64_t filesize;
if( offset == 0 )
return 0;
@@ -3561,9 +3556,9 @@ static int ByteCountLooksBad(TIFF* tif)
return 1;
if( tif->tif_mode == O_RDONLY )
{
- uint64 scanlinesize = TIFFScanlineSize64(tif);
+ uint64_t scanlinesize = TIFFScanlineSize64(tif);
if( tif->tif_dir.td_imagelength > 0 &&
- scanlinesize > TIFF_UINT64_MAX / tif->tif_dir.td_imagelength )
+ scanlinesize > UINT64_MAX / tif->tif_dir.td_imagelength )
{
return 1;
}
@@ -3583,11 +3578,11 @@ TIFFReadDirectory(TIFF* tif)
{
static const char module[] = "TIFFReadDirectory";
TIFFDirEntry* dir;
- uint16 dircount;
+ uint16_t dircount;
TIFFDirEntry* dp;
- uint16 di;
+ uint16_t di;
const TIFFField* fip;
- uint32 fii=FAILED_FII;
+ uint32_t fii=FAILED_FII;
toff_t nextdiroff;
int bitspersample_read = FALSE;
int color_channels;
@@ -3602,7 +3597,7 @@ TIFFReadDirectory(TIFF* tif)
if (!dircount)
{
TIFFErrorExt(tif->tif_clientdata,module,
- "Failed to read directory at offset %" TIFF_UINT64_FORMAT, nextdiroff);
+ "Failed to read directory at offset %" PRIu64, nextdiroff);
return 0;
}
TIFFReadDirectoryCheckOrder(tif,dir,dircount);
@@ -3613,11 +3608,11 @@ TIFFReadDirectory(TIFF* tif)
*/
{
TIFFDirEntry* ma;
- uint16 mb;
+ uint16_t mb;
for (ma=dir, mb=0; mb<dircount; ma++, mb++)
{
TIFFDirEntry* na;
- uint16 nb;
+ uint16_t nb;
for (na=ma+1, nb=mb+1; nb<dircount; na++, nb++)
{
if (ma->tdir_tag == na->tdir_tag) {
@@ -3674,7 +3669,7 @@ TIFFReadDirectory(TIFF* tif)
* this, we accept the tag if one value is supplied with either
* count.
*/
- uint16 value;
+ uint16_t value;
enum TIFFReadDirEntryErr err;
err=TIFFReadDirEntryShort(tif,dp,&value);
if (err==TIFFReadDirEntryErrCount)
@@ -3864,7 +3859,7 @@ TIFFReadDirectory(TIFF* tif)
* too.
*/
{
- uint16 value;
+ uint16_t value;
enum TIFFReadDirEntryErr err;
err=TIFFReadDirEntryShort(tif,dp,&value);
if (err==TIFFReadDirEntryErrCount)
@@ -3887,9 +3882,9 @@ TIFFReadDirectory(TIFF* tif)
double *data = NULL;
enum TIFFReadDirEntryErr err;
- uint32 saved_flags;
+ uint32_t saved_flags;
int m;
- if (dp->tdir_count != (uint64)tif->tif_dir.td_samplesperpixel)
+ if (dp->tdir_count != (uint64_t)tif->tif_dir.td_samplesperpixel)
err = TIFFReadDirEntryErrCount;
else
err = TIFFReadDirEntryDoubleArray(tif, dp, &data);
@@ -3962,10 +3957,10 @@ TIFFReadDirectory(TIFF* tif)
case TIFFTAG_TRANSFERFUNCTION:
{
enum TIFFReadDirEntryErr err;
- uint32 countpersample;
- uint32 countrequired;
- uint32 incrementpersample;
- uint16* value=NULL;
+ uint32_t countpersample;
+ uint32_t countrequired;
+ uint32_t incrementpersample;
+ uint16_t* value=NULL;
/* It would be dangerous to instantiate those tag values */
/* since if td_bitspersample has not yet been read (due to */
/* unordered tags), it could be read afterwards with a */
@@ -3992,7 +3987,7 @@ TIFFReadDirectory(TIFF* tif)
continue;
}
countpersample=(1U<<tif->tif_dir.td_bitspersample);
- if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64)countpersample))
+ if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64_t)countpersample))
{
countrequired=countpersample;
incrementpersample=0;
@@ -4002,7 +3997,7 @@ TIFFReadDirectory(TIFF* tif)
countrequired=3*countpersample;
incrementpersample=countpersample;
}
- if (dp->tdir_count!=(uint64)countrequired)
+ if (dp->tdir_count!=(uint64_t)countrequired)
err=TIFFReadDirEntryErrCount;
else
err=TIFFReadDirEntryShortArray(tif,dp,&value);
@@ -4021,8 +4016,8 @@ TIFFReadDirectory(TIFF* tif)
/* BEGIN REV 4.0 COMPATIBILITY */
case TIFFTAG_OSUBFILETYPE:
{
- uint16 valueo;
- uint32 value;
+ uint16_t valueo;
+ uint32_t value;
if (TIFFReadDirEntryShort(tif,dp,&valueo)==TIFFReadDirEntryErrOk)
{
switch (valueo)
@@ -4155,18 +4150,18 @@ TIFFReadDirectory(TIFF* tif)
*/
color_channels = _TIFFGetMaxColorChannels(tif->tif_dir.td_photometric);
if (color_channels && tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples > color_channels) {
- uint16 old_extrasamples;
- uint16 *new_sampleinfo;
+ uint16_t old_extrasamples;
+ uint16_t *new_sampleinfo;
TIFFWarningExt(tif->tif_clientdata,module, "Sum of Photometric type-related "
"color channels and ExtraSamples doesn't match SamplesPerPixel. "
"Defining non-color channels as ExtraSamples.");
old_extrasamples = tif->tif_dir.td_extrasamples;
- tif->tif_dir.td_extrasamples = (uint16) (tif->tif_dir.td_samplesperpixel - color_channels);
+ tif->tif_dir.td_extrasamples = (uint16_t) (tif->tif_dir.td_samplesperpixel - color_channels);
// sampleinfo should contain information relative to these new extra samples
- new_sampleinfo = (uint16*) _TIFFcalloc(tif->tif_dir.td_extrasamples, sizeof(uint16));
+ new_sampleinfo = (uint16_t*) _TIFFcalloc(tif->tif_dir.td_extrasamples, sizeof(uint16_t));
if (!new_sampleinfo) {
TIFFErrorExt(tif->tif_clientdata, module, "Failed to allocate memory for "
"temporary new sampleinfo array (%d 16 bit elements)",
@@ -4174,7 +4169,7 @@ TIFFReadDirectory(TIFF* tif)
goto bad;
}
- memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16));
+ memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16_t));
_TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples);
_TIFFfree(new_sampleinfo);
}
@@ -4212,7 +4207,7 @@ TIFFReadDirectory(TIFF* tif)
if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
tif->tif_dir.td_nstrips > 1) ||
(tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
- tif->tif_dir.td_nstrips != (uint32)tif->tif_dir.td_samplesperpixel)) {
+ tif->tif_dir.td_nstrips != (uint32_t)tif->tif_dir.td_samplesperpixel)) {
MissingRequired(tif, "StripByteCounts");
goto bad;
}
@@ -4269,7 +4264,7 @@ TIFFReadDirectory(TIFF* tif)
if (tif->tif_dir.td_bitspersample>=16)
tif->tif_dir.td_maxsamplevalue=0xFFFF;
else
- tif->tif_dir.td_maxsamplevalue = (uint16)((1L<<tif->tif_dir.td_bitspersample)-1);
+ tif->tif_dir.td_maxsamplevalue = (uint16_t)((1L << tif->tif_dir.td_bitspersample) - 1);
}
#ifdef STRIPBYTECOUNTSORTED_UNUSED
@@ -4279,7 +4274,7 @@ TIFFReadDirectory(TIFF* tif)
* function in tif_write.c.
*/
if (!(tif->tif_flags&TIFF_DEFERSTRILELOAD) && tif->tif_dir.td_nstrips > 1) {
- uint32 strip;
+ uint32_t strip;
tif->tif_dir.td_stripbytecountsorted = 1;
for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {
@@ -4334,10 +4329,10 @@ TIFFReadDirectory(TIFF* tif)
/*
* Reinitialize i/o since we are starting on a new directory.
*/
- tif->tif_row = (uint32) -1;
- tif->tif_curstrip = (uint32) -1;
- tif->tif_col = (uint32) -1;
- tif->tif_curtile = (uint32) -1;
+ tif->tif_row = (uint32_t) -1;
+ tif->tif_curstrip = (uint32_t) -1;
+ tif->tif_col = (uint32_t) -1;
+ tif->tif_curtile = (uint32_t) -1;
tif->tif_tilesize = (tmsize_t) -1;
tif->tif_scanlinesize = TIFFScanlineSize(tif);
@@ -4369,11 +4364,11 @@ bad:
}
static void
-TIFFReadDirectoryCheckOrder(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+TIFFReadDirectoryCheckOrder(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount)
{
static const char module[] = "TIFFReadDirectoryCheckOrder";
- uint16 m;
- uint16 n;
+ uint16_t m;
+ uint16_t n;
TIFFDirEntry* o;
m=0;
for (n=0, o=dir; n<dircount; n++, o++)
@@ -4389,10 +4384,10 @@ TIFFReadDirectoryCheckOrder(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
}
static TIFFDirEntry*
-TIFFReadDirectoryFindEntry(TIFF* tif, TIFFDirEntry* dir, uint16 dircount, uint16 tagid)
+TIFFReadDirectoryFindEntry(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount, uint16_t tagid)
{
TIFFDirEntry* m;
- uint16 n;
+ uint16_t n;
(void) tif;
for (m=dir, n=0; n<dircount; m++, n++)
{
@@ -4403,11 +4398,11 @@ TIFFReadDirectoryFindEntry(TIFF* tif, TIFFDirEntry* dir, uint16 dircount, uint16
}
static void
-TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii)
+TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16_t tagid, uint32_t* fii)
{
- int32 ma,mb,mc;
+ int32_t ma,mb,mc;
ma=-1;
- mc=(int32)tif->tif_nfields;
+ mc=(int32_t)tif->tif_nfields;
while (1)
{
if (ma+1==mc)
@@ -4416,9 +4411,9 @@ TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii)
return;
}
mb=(ma+mc)/2;
- if (tif->tif_fields[mb]->field_tag==(uint32)tagid)
+ if (tif->tif_fields[mb]->field_tag==(uint32_t)tagid)
break;
- if (tif->tif_fields[mb]->field_tag<(uint32)tagid)
+ if (tif->tif_fields[mb]->field_tag<(uint32_t)tagid)
ma=mb;
else
mc=mb;
@@ -4427,7 +4422,7 @@ TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii)
{
if (mb==0)
break;
- if (tif->tif_fields[mb-1]->field_tag!=(uint32)tagid)
+ if (tif->tif_fields[mb-1]->field_tag!=(uint32_t)tagid)
break;
mb--;
}
@@ -4444,18 +4439,18 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
{
static const char module[] = "TIFFReadCustomDirectory";
TIFFDirEntry* dir;
- uint16 dircount;
+ uint16_t dircount;
TIFFDirEntry* dp;
- uint16 di;
+ uint16_t di;
const TIFFField* fip;
- uint32 fii;
+ uint32_t fii;
(*tif->tif_cleanup)(tif); /* cleanup any previous compression state */
_TIFFSetupFields(tif, infoarray);
dircount=TIFFFetchDirectory(tif,diroff,&dir,NULL);
if (!dircount)
{
TIFFErrorExt(tif->tif_clientdata,module,
- "Failed to read custom directory at offset %" TIFF_UINT64_FORMAT,diroff);
+ "Failed to read custom directory at offset %" PRIu64,diroff);
return 0;
}
TIFFFreeDirectory(tif);
@@ -4494,7 +4489,7 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
{
fii++;
if ((fii==tif->tif_nfields)||
- (tif->tif_fields[fii]->field_tag!=(uint32)dp->tdir_tag))
+ (tif->tif_fields[fii]->field_tag!=(uint32_t)dp->tdir_tag))
{
fii=0xFFFF;
break;
@@ -4514,11 +4509,11 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
if ((fip->field_readcount!=TIFF_VARIABLE)&&
(fip->field_readcount!=TIFF_VARIABLE2))
{
- uint32 expected;
+ uint32_t expected;
if (fip->field_readcount==TIFF_SPP)
- expected=(uint32)tif->tif_dir.td_samplesperpixel;
+ expected=(uint32_t)tif->tif_dir.td_samplesperpixel;
else
- expected=(uint32)fip->field_readcount;
+ expected=(uint32_t)fip->field_readcount;
if (!CheckDirCount(tif,dp,expected))
dp->tdir_ignore = TRUE;
}
@@ -4566,13 +4561,13 @@ TIFFReadGPSDirectory(TIFF* tif, toff_t diroff)
}
static int
-EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
+EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16_t dircount)
{
static const char module[] = "EstimateStripByteCounts";
TIFFDirEntry *dp;
TIFFDirectory *td = &tif->tif_dir;
- uint32 strip;
+ uint32_t strip;
/* Do not try to load stripbytecount as we will compute it */
if( !_TIFFFillStrilesInternal( tif, 0 ) )
@@ -4580,16 +4575,16 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
if (td->td_stripbytecount_p)
_TIFFfree(td->td_stripbytecount_p);
- td->td_stripbytecount_p = (uint64*)
- _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64),
+ td->td_stripbytecount_p = (uint64_t*)
+ _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64_t),
"for \"StripByteCounts\" array");
if( td->td_stripbytecount_p == NULL )
return -1;
if (td->td_compression != COMPRESSION_NONE) {
- uint64 space;
- uint64 filesize;
- uint16 n;
+ uint64_t space;
+ uint64_t filesize;
+ uint16_t n;
filesize = TIFFGetFileSize(tif);
if (!(tif->tif_flags&TIFF_BIGTIFF))
space=sizeof(TIFFHeaderClassic)+2+dircount*12+4;
@@ -4598,8 +4593,8 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
/* calculate amount of space used by indirect values */
for (dp = dir, n = dircount; n > 0; n--, dp++)
{
- uint32 typewidth;
- uint64 datasize;
+ uint32_t typewidth;
+ uint64_t datasize;
typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type);
if (typewidth == 0) {
TIFFErrorExt(tif->tif_clientdata, module,
@@ -4607,9 +4602,9 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
dp->tdir_type);
return -1;
}
- if( dp->tdir_count > TIFF_UINT64_MAX / typewidth )
+ if( dp->tdir_count > UINT64_MAX / typewidth )
return -1;
- datasize=(uint64)typewidth*dp->tdir_count;
+ datasize= (uint64_t)typewidth * dp->tdir_count;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
if (datasize<=4)
@@ -4620,7 +4615,7 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
if (datasize<=8)
datasize=0;
}
- if( space > TIFF_UINT64_MAX - datasize )
+ if( space > UINT64_MAX - datasize )
return -1;
space+=datasize;
}
@@ -4641,7 +4636,7 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
* of data in the strip and trim this number back accordingly.
*/
strip--;
- if (td->td_stripoffset_p[strip] > TIFF_UINT64_MAX - td->td_stripbytecount_p[strip])
+ if (td->td_stripoffset_p[strip] > UINT64_MAX - td->td_stripbytecount_p[strip])
return -1;
if (td->td_stripoffset_p[strip]+td->td_stripbytecount_p[strip] > filesize) {
if( td->td_stripoffset_p[strip] >= filesize ) {
@@ -4652,16 +4647,16 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
}
}
} else if (isTiled(tif)) {
- uint64 bytespertile = TIFFTileSize64(tif);
+ uint64_t bytespertile = TIFFTileSize64(tif);
for (strip = 0; strip < td->td_nstrips; strip++)
td->td_stripbytecount_p[strip] = bytespertile;
} else {
- uint64 rowbytes = TIFFScanlineSize64(tif);
- uint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage;
+ uint64_t rowbytes = TIFFScanlineSize64(tif);
+ uint32_t rowsperstrip = td->td_imagelength / td->td_stripsperimage;
for (strip = 0; strip < td->td_nstrips; strip++)
{
- if( rowbytes > 0 && rowsperstrip > TIFF_UINT64_MAX / rowbytes )
+ if( rowbytes > 0 && rowsperstrip > UINT64_MAX / rowbytes )
return -1;
td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
}
@@ -4689,9 +4684,9 @@ MissingRequired(TIFF* tif, const char* tagname)
* seen directories and check every IFD offset against that list.
*/
static int
-TIFFCheckDirOffset(TIFF* tif, uint64 diroff)
+TIFFCheckDirOffset(TIFF* tif, uint64_t diroff)
{
- uint16 n;
+ uint16_t n;
if (diroff == 0) /* no more directories */
return 0;
@@ -4709,14 +4704,14 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff)
tif->tif_dirnumber++;
if (tif->tif_dirlist == NULL || tif->tif_dirnumber > tif->tif_dirlistsize) {
- uint64* new_dirlist;
+ uint64_t* new_dirlist;
/*
* XXX: Reduce memory allocation granularity of the dirlist
* array.
*/
- new_dirlist = (uint64*)_TIFFCheckRealloc(tif, tif->tif_dirlist,
- tif->tif_dirnumber, 2 * sizeof(uint64), "for IFD list");
+ new_dirlist = (uint64_t*)_TIFFCheckRealloc(tif, tif->tif_dirlist,
+ tif->tif_dirnumber, 2 * sizeof(uint64_t), "for IFD list");
if (!new_dirlist)
return 0;
if( tif->tif_dirnumber >= 32768 )
@@ -4736,19 +4731,19 @@ TIFFCheckDirOffset(TIFF* tif, uint64 diroff)
* caller is expected to skip/ignore the tag if there is a mismatch.
*/
static int
-CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
+CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32_t count)
{
- if ((uint64)count > dir->tdir_count) {
+ if ((uint64_t)count > dir->tdir_count) {
const TIFFField* fip = TIFFFieldWithTag(tif, dir->tdir_tag);
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
- "incorrect count for field \"%s\" (%" TIFF_UINT64_FORMAT ", expecting %u); tag ignored",
+ "incorrect count for field \"%s\" (%" PRIu64 ", expecting %u); tag ignored",
fip ? fip->field_name : "unknown tagname",
dir->tdir_count, count);
return (0);
- } else if ((uint64)count < dir->tdir_count) {
+ } else if ((uint64_t)count < dir->tdir_count) {
const TIFFField* fip = TIFFFieldWithTag(tif, dir->tdir_tag);
TIFFWarningExt(tif->tif_clientdata, tif->tif_name,
- "incorrect count for field \"%s\" (%" TIFF_UINT64_FORMAT ", expecting %u); tag trimmed",
+ "incorrect count for field \"%s\" (%" PRIu64 ", expecting %u); tag trimmed",
fip ? fip->field_name : "unknown tagname",
dir->tdir_count, count);
dir->tdir_count = count;
@@ -4762,19 +4757,19 @@ CheckDirCount(TIFF* tif, TIFFDirEntry* dir, uint32 count)
* nextdiroff variable has been specified, read it too. Function returns a
* number of fields in the directory or 0 if failed.
*/
-static uint16
-TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
- uint64 *nextdiroff)
+static uint16_t
+TIFFFetchDirectory(TIFF* tif, uint64_t diroff, TIFFDirEntry** pdir,
+ uint64_t *nextdiroff)
{
static const char module[] = "TIFFFetchDirectory";
void* origdir;
- uint16 dircount16;
- uint32 dirsize;
+ uint16_t dircount16;
+ uint32_t dirsize;
TIFFDirEntry* dir;
- uint8* ma;
+ uint8_t* ma;
TIFFDirEntry* mb;
- uint16 n;
+ uint16_t n;
assert(pdir);
@@ -4790,7 +4785,7 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
}
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- if (!ReadOK(tif, &dircount16, sizeof (uint16))) {
+ if (!ReadOK(tif, &dircount16, sizeof (uint16_t))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Can not read TIFF directory count",
tif->tif_name);
@@ -4806,8 +4801,8 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
}
dirsize = 12;
} else {
- uint64 dircount64;
- if (!ReadOK(tif, &dircount64, sizeof (uint64))) {
+ uint64_t dircount64;
+ if (!ReadOK(tif, &dircount64, sizeof (uint64_t))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Can not read TIFF directory count",
tif->tif_name);
@@ -4821,7 +4816,7 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
"Sanity check on directory count failed, this is probably not a valid IFD offset");
return 0;
}
- dircount16 = (uint16)dircount64;
+ dircount16 = (uint16_t)dircount64;
dirsize = 20;
}
origdir = _TIFFCheckMalloc(tif, dircount16,
@@ -4843,14 +4838,14 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 nextdiroff32;
- if (!ReadOK(tif, &nextdiroff32, sizeof(uint32)))
+ uint32_t nextdiroff32;
+ if (!ReadOK(tif, &nextdiroff32, sizeof(uint32_t)))
nextdiroff32 = 0;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&nextdiroff32);
*nextdiroff=nextdiroff32;
} else {
- if (!ReadOK(tif, nextdiroff, sizeof(uint64)))
+ if (!ReadOK(tif, nextdiroff, sizeof(uint64_t)))
*nextdiroff = 0;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8(nextdiroff);
@@ -4859,7 +4854,7 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
} else {
tmsize_t m;
tmsize_t off;
- if (tif->tif_diroff > (uint64)TIFF_INT64_MAX)
+ if (tif->tif_diroff > (uint64_t)INT64_MAX)
{
TIFFErrorExt(tif->tif_clientdata,module,"Can not read TIFF directory count");
return(0);
@@ -4871,22 +4866,22 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
* otherwise a very high offset may cause an OOB read and
* crash the client. Make two comparisons instead of
*
- * off + sizeof(uint16) > tif->tif_size
+ * off + sizeof(uint16_t) > tif->tif_size
*
* to avoid overflow.
*/
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- m=off+sizeof(uint16);
- if ((m<off)||(m<(tmsize_t)sizeof(uint16))||(m>tif->tif_size)) {
+ m=off+sizeof(uint16_t);
+ if ((m<off) || (m<(tmsize_t)sizeof(uint16_t)) || (m > tif->tif_size)) {
TIFFErrorExt(tif->tif_clientdata, module,
"Can not read TIFF directory count");
return 0;
} else {
_TIFFmemcpy(&dircount16, tif->tif_base + off,
- sizeof(uint16));
+ sizeof(uint16_t));
}
- off += sizeof (uint16);
+ off += sizeof (uint16_t);
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabShort(&dircount16);
if (dircount16>4096)
@@ -4899,17 +4894,17 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
}
else
{
- uint64 dircount64;
- m=off+sizeof(uint64);
- if ((m<off)||(m<(tmsize_t)sizeof(uint64))||(m>tif->tif_size)) {
+ uint64_t dircount64;
+ m=off+sizeof(uint64_t);
+ if ((m<off) || (m<(tmsize_t)sizeof(uint64_t)) || (m > tif->tif_size)) {
TIFFErrorExt(tif->tif_clientdata, module,
"Can not read TIFF directory count");
return 0;
} else {
_TIFFmemcpy(&dircount64, tif->tif_base + off,
- sizeof(uint64));
+ sizeof(uint64_t));
}
- off += sizeof (uint64);
+ off += sizeof (uint64_t);
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong8(&dircount64);
if (dircount64>4096)
@@ -4918,7 +4913,7 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
"Sanity check on directory count failed, this is probably not a valid IFD offset");
return 0;
}
- dircount16 = (uint16)dircount64;
+ dircount16 = (uint16_t)dircount64;
dirsize = 20;
}
if (dircount16 == 0 )
@@ -4946,25 +4941,25 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
off += dircount16 * dirsize;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 nextdiroff32;
- m=off+sizeof(uint32);
- if ((m<off)||(m<(tmsize_t)sizeof(uint32))||(m>tif->tif_size))
+ uint32_t nextdiroff32;
+ m=off+sizeof(uint32_t);
+ if ((m<off) || (m<(tmsize_t)sizeof(uint32_t)) || (m > tif->tif_size))
nextdiroff32 = 0;
else
_TIFFmemcpy(&nextdiroff32, tif->tif_base + off,
- sizeof (uint32));
+ sizeof (uint32_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&nextdiroff32);
*nextdiroff = nextdiroff32;
}
else
{
- m=off+sizeof(uint64);
- if ((m<off)||(m<(tmsize_t)sizeof(uint64))||(m>tif->tif_size))
+ m=off+sizeof(uint64_t);
+ if ((m<off) || (m<(tmsize_t)sizeof(uint64_t)) || (m > tif->tif_size))
*nextdiroff = 0;
else
_TIFFmemcpy(nextdiroff, tif->tif_base + off,
- sizeof (uint64));
+ sizeof (uint64_t));
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8(nextdiroff);
}
@@ -4978,37 +4973,37 @@ TIFFFetchDirectory(TIFF* tif, uint64 diroff, TIFFDirEntry** pdir,
_TIFFfree(origdir);
return 0;
}
- ma=(uint8*)origdir;
+ ma=(uint8_t*)origdir;
mb=dir;
for (n=0; n<dircount16; n++)
{
mb->tdir_ignore = FALSE;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
- mb->tdir_tag=*(uint16*)ma;
- ma+=sizeof(uint16);
+ TIFFSwabShort((uint16_t*)ma);
+ mb->tdir_tag=*(uint16_t*)ma;
+ ma+=sizeof(uint16_t);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)ma);
- mb->tdir_type=*(uint16*)ma;
- ma+=sizeof(uint16);
+ TIFFSwabShort((uint16_t*)ma);
+ mb->tdir_type=*(uint16_t*)ma;
+ ma+=sizeof(uint16_t);
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)ma);
- mb->tdir_count=(uint64)(*(uint32*)ma);
- ma+=sizeof(uint32);
+ TIFFSwabLong((uint32_t*)ma);
+ mb->tdir_count=(uint64_t)(*(uint32_t*)ma);
+ ma+=sizeof(uint32_t);
mb->tdir_offset.toff_long8=0;
- *(uint32*)(&mb->tdir_offset)=*(uint32*)ma;
- ma+=sizeof(uint32);
+ *(uint32_t*)(&mb->tdir_offset)=*(uint32_t*)ma;
+ ma+=sizeof(uint32_t);
}
else
{
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)ma);
+ TIFFSwabLong8((uint64_t*)ma);
mb->tdir_count=TIFFReadUInt64(ma);
- ma+=sizeof(uint64);
+ ma+=sizeof(uint64_t);
mb->tdir_offset.toff_long8=TIFFReadUInt64(ma);
- ma+=sizeof(uint64);
+ ma+=sizeof(uint64_t);
}
mb++;
}
@@ -5025,7 +5020,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
{
static const char module[] = "TIFFFetchNormalTag";
enum TIFFReadDirEntryErr err;
- uint32 fii;
+ uint32_t fii;
const TIFFField* fip = NULL;
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
if( fii == FAILED_FII )
@@ -5046,17 +5041,17 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_ASCII:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_passcount==0);
err=TIFFReadDirEntryByteArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
- uint32 mb = 0;
+ uint32_t mb = 0;
int n;
if (data != NULL)
{
- uint8* ma = data;
- while (mb<(uint32)dp->tdir_count)
+ uint8_t* ma = data;
+ while (mb<(uint32_t)dp->tdir_count)
{
if (*ma==0)
break;
@@ -5064,24 +5059,24 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
mb++;
}
}
- if (mb+1<(uint32)dp->tdir_count)
+ if (mb+1<(uint32_t)dp->tdir_count)
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" contains null byte in value; value incorrectly truncated during reading due to implementation limitations",fip->field_name);
- else if (mb+1>(uint32)dp->tdir_count)
+ else if (mb+1>(uint32_t)dp->tdir_count)
{
- uint8* o;
+ uint8_t* o;
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte",fip->field_name);
- if ((uint32)dp->tdir_count+1!=dp->tdir_count+1)
+ if ((uint32_t)dp->tdir_count + 1 != dp->tdir_count + 1)
o=NULL;
else
- o=_TIFFmalloc((uint32)dp->tdir_count+1);
+ o=_TIFFmalloc((uint32_t)dp->tdir_count + 1);
if (o==NULL)
{
if (data!=NULL)
_TIFFfree(data);
return(0);
}
- _TIFFmemcpy(o,data,(uint32)dp->tdir_count);
- o[(uint32)dp->tdir_count]=0;
+ _TIFFmemcpy(o,data,(uint32_t)dp->tdir_count);
+ o[(uint32_t)dp->tdir_count]=0;
if (data!=0)
_TIFFfree(data);
data=o;
@@ -5096,7 +5091,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_UINT8:
{
- uint8 data=0;
+ uint8_t data=0;
assert(fip->field_readcount==1);
assert(fip->field_passcount==0);
err=TIFFReadDirEntryByte(tif,dp,&data);
@@ -5109,7 +5104,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_UINT16:
{
- uint16 data;
+ uint16_t data;
assert(fip->field_readcount==1);
assert(fip->field_passcount==0);
err=TIFFReadDirEntryShort(tif,dp,&data);
@@ -5122,7 +5117,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_UINT32:
{
- uint32 data;
+ uint32_t data;
assert(fip->field_readcount==1);
assert(fip->field_passcount==0);
err=TIFFReadDirEntryLong(tif,dp,&data);
@@ -5135,7 +5130,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_UINT64:
{
- uint64 data;
+ uint64_t data;
assert(fip->field_readcount==1);
assert(fip->field_passcount==0);
err=TIFFReadDirEntryLong8(tif,dp,&data);
@@ -5174,7 +5169,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_IFD8:
{
- uint64 data;
+ uint64_t data;
assert(fip->field_readcount==1);
assert(fip->field_passcount==0);
err=TIFFReadDirEntryIfd8(tif,dp,&data);
@@ -5187,7 +5182,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_UINT16_PAIR:
{
- uint16* data;
+ uint16_t* data;
assert(fip->field_readcount==2);
assert(fip->field_passcount==0);
if (dp->tdir_count!=2) {
@@ -5210,10 +5205,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C0_UINT8:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_readcount>=1);
assert(fip->field_passcount==0);
- if (dp->tdir_count!=(uint64)fip->field_readcount) {
+ if (dp->tdir_count!=(uint64_t)fip->field_readcount) {
TIFFWarningExt(tif->tif_clientdata,module,
"incorrect count for field \"%s\", expected %d, got %d",
fip->field_name,(int) fip->field_readcount, (int)dp->tdir_count);
@@ -5236,10 +5231,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C0_UINT16:
{
- uint16* data;
+ uint16_t* data;
assert(fip->field_readcount>=1);
assert(fip->field_passcount==0);
- if (dp->tdir_count!=(uint64)fip->field_readcount)
+ if (dp->tdir_count!=(uint64_t)fip->field_readcount)
/* corrupt file */;
else
{
@@ -5258,10 +5253,10 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C0_UINT32:
{
- uint32* data;
+ uint32_t* data;
assert(fip->field_readcount>=1);
assert(fip->field_passcount==0);
- if (dp->tdir_count!=(uint64)fip->field_readcount)
+ if (dp->tdir_count!=(uint64_t)fip->field_readcount)
/* corrupt file */;
else
{
@@ -5283,7 +5278,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
float* data;
assert(fip->field_readcount>=1);
assert(fip->field_passcount==0);
- if (dp->tdir_count!=(uint64)fip->field_readcount)
+ if (dp->tdir_count!=(uint64_t)fip->field_readcount)
/* corrupt file */;
else
{
@@ -5306,7 +5301,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
double* data;
assert(fip->field_readcount>=1);
assert(fip->field_passcount==0);
- if (dp->tdir_count!=(uint64)fip->field_readcount)
+ if (dp->tdir_count!=(uint64_t)fip->field_readcount)
/* corrupt file */;
else
{
@@ -5325,7 +5320,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_ASCII:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5341,7 +5336,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
data[dp->tdir_count-1] = '\0';
}
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5352,7 +5347,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_UINT8:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5363,7 +5358,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5374,7 +5369,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_UINT16:
{
- uint16* data;
+ uint16_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5385,7 +5380,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5396,7 +5391,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_UINT32:
{
- uint32* data;
+ uint32_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5407,7 +5402,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5418,7 +5413,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_UINT64:
{
- uint64* data;
+ uint64_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5429,7 +5424,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5451,7 +5446,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5473,7 +5468,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5484,7 +5479,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C16_IFD8:
{
- uint64* data;
+ uint64_t* data;
assert(fip->field_readcount==TIFF_VARIABLE);
assert(fip->field_passcount==1);
if (dp->tdir_count>0xFFFF)
@@ -5495,7 +5490,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint16_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5506,7 +5501,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_ASCII:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryByteArray(tif,dp,&data);
@@ -5518,7 +5513,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
TIFFWarningExt(tif->tif_clientdata,module,"ASCII value for tag \"%s\" does not end in null byte. Forcing it to be null",fip->field_name);
data[dp->tdir_count-1] = '\0';
}
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5528,14 +5523,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_UINT8:
{
- uint8* data;
+ uint8_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryByteArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5545,14 +5540,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_SINT8:
{
- int8* data = NULL;
+ int8_t* data = NULL;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntrySbyteArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5562,14 +5557,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_UINT16:
{
- uint16* data;
+ uint16_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryShortArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5579,14 +5574,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_SINT16:
{
- int16* data = NULL;
+ int16_t* data = NULL;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntrySshortArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5596,14 +5591,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_UINT32:
{
- uint32* data;
+ uint32_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryLongArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5613,14 +5608,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_SINT32:
{
- int32* data = NULL;
+ int32_t* data = NULL;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntrySlongArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5630,14 +5625,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_UINT64:
{
- uint64* data;
+ uint64_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryLong8Array(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5647,14 +5642,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_SINT64:
{
- int64* data = NULL;
+ int64_t* data = NULL;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntrySlong8Array(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5671,7 +5666,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5688,7 +5683,7 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5698,14 +5693,14 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
break;
case TIFF_SETGET_C32_IFD8:
{
- uint64* data;
+ uint64_t* data;
assert(fip->field_readcount==TIFF_VARIABLE2);
assert(fip->field_passcount==1);
err=TIFFReadDirEntryIfd8Array(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
int m;
- m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data);
+ m=TIFFSetField(tif, dp->tdir_tag, (uint32_t)(dp->tdir_count), data);
if (data!=0)
_TIFFfree(data);
if (!m)
@@ -5730,11 +5725,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
* While this routine says "strips", in fact it's also used for tiles.
*/
static int
-TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp)
+TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32_t nstrips, uint64_t** lpp)
{
static const char module[] = "TIFFFetchStripThing";
enum TIFFReadDirEntryErr err;
- uint64* data;
+ uint64_t* data;
err=TIFFReadDirEntryLong8ArrayWithLimit(tif,dir,&data,nstrips);
if (err!=TIFFReadDirEntryErrOk)
{
@@ -5742,14 +5737,14 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp)
TIFFReadDirEntryOutputErr(tif,err,module,fip ? fip->field_name : "unknown tagname",0);
return(0);
}
- if (dir->tdir_count<(uint64)nstrips)
+ if (dir->tdir_count<(uint64_t)nstrips)
{
- uint64* resizeddata;
+ uint64_t* resizeddata;
const TIFFField* fip = TIFFFieldWithTag(tif,dir->tdir_tag);
const char* pszMax = getenv("LIBTIFF_STRILE_ARRAY_MAX_RESIZE_COUNT");
- uint32 max_nstrips = 1000000;
+ uint32_t max_nstrips = 1000000;
if( pszMax )
- max_nstrips = (uint32) atoi(pszMax);
+ max_nstrips = (uint32_t) atoi(pszMax);
TIFFReadDirEntryOutputErr(tif,TIFFReadDirEntryErrCount,
module,
fip ? fip->field_name : "unknown tagname",
@@ -5761,13 +5756,13 @@ TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uint64** lpp)
return(0);
}
- resizeddata=(uint64*)_TIFFCheckMalloc(tif,nstrips,sizeof(uint64),"for strip array");
+ resizeddata=(uint64_t*)_TIFFCheckMalloc(tif, nstrips, sizeof(uint64_t), "for strip array");
if (resizeddata==0) {
_TIFFfree(data);
return(0);
}
- _TIFFmemcpy(resizeddata,data,(uint32)dir->tdir_count*sizeof(uint64));
- _TIFFmemset(resizeddata+(uint32)dir->tdir_count,0,(nstrips-(uint32)dir->tdir_count)*sizeof(uint64));
+ _TIFFmemcpy(resizeddata,data, (uint32_t)dir->tdir_count * sizeof(uint64_t));
+ _TIFFmemset(resizeddata+(uint32_t)dir->tdir_count, 0, (nstrips - (uint32_t)dir->tdir_count) * sizeof(uint64_t));
_TIFFfree(data);
data=resizeddata;
}
@@ -5786,8 +5781,8 @@ TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir)
UInt64Aligned_t m;
m.l=0;
assert(sizeof(double)==8);
- assert(sizeof(uint64)==8);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint64_t) == 8);
+ assert(sizeof(uint32_t) == 4);
if (dir->tdir_count!=1)
err=TIFFReadDirEntryErrCount;
else if (dir->tdir_type!=TIFF_RATIONAL)
@@ -5796,8 +5791,8 @@ TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir)
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 offset;
- offset=*(uint32*)(&dir->tdir_offset);
+ uint32_t offset;
+ offset=*(uint32_t*)(&dir->tdir_offset);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&offset);
err=TIFFReadDirEntryData(tif,offset,8,m.i);
@@ -5833,32 +5828,32 @@ TIFFFetchSubjectDistance(TIFF* tif, TIFFDirEntry* dir)
}
}
-static void allocChoppedUpStripArrays(TIFF* tif, uint32 nstrips,
- uint64 stripbytes, uint32 rowsperstrip)
+static void allocChoppedUpStripArrays(TIFF* tif, uint32_t nstrips,
+ uint64_t stripbytes, uint32_t rowsperstrip)
{
TIFFDirectory *td = &tif->tif_dir;
- uint64 bytecount;
- uint64 offset;
- uint64 last_offset;
- uint64 last_bytecount;
- uint32 i;
- uint64 *newcounts;
- uint64 *newoffsets;
+ uint64_t bytecount;
+ uint64_t offset;
+ uint64_t last_offset;
+ uint64_t last_bytecount;
+ uint32_t i;
+ uint64_t *newcounts;
+ uint64_t *newoffsets;
offset = TIFFGetStrileOffset(tif, 0);
last_offset = TIFFGetStrileOffset(tif, td->td_nstrips-1);
last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips-1);
- if( last_offset > TIFF_UINT64_MAX - last_bytecount ||
+ if( last_offset > UINT64_MAX - last_bytecount ||
last_offset + last_bytecount < offset )
{
return;
}
bytecount = last_offset + last_bytecount - offset;
- newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
- "for chopped \"StripByteCounts\" array");
- newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64),
- "for chopped \"StripOffsets\" array");
+ newcounts = (uint64_t*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64_t),
+ "for chopped \"StripByteCounts\" array");
+ newoffsets = (uint64_t*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64_t),
+ "for chopped \"StripOffsets\" array");
if (newcounts == NULL || newoffsets == NULL) {
/*
* Unable to allocate new strip information, give up and use
@@ -5912,13 +5907,13 @@ static void
ChopUpSingleUncompressedStrip(TIFF* tif)
{
register TIFFDirectory *td = &tif->tif_dir;
- uint64 bytecount;
- uint64 offset;
- uint32 rowblock;
- uint64 rowblockbytes;
- uint64 stripbytes;
- uint32 nstrips;
- uint32 rowsperstrip;
+ uint64_t bytecount;
+ uint64_t offset;
+ uint32_t rowblock;
+ uint64_t rowblockbytes;
+ uint64_t stripbytes;
+ uint32_t nstrips;
+ uint32_t rowsperstrip;
bytecount = TIFFGetStrileByteCount(tif, 0);
/* On a newly created file, just re-opened to be filled, we */
@@ -5942,8 +5937,8 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
stripbytes = rowblockbytes;
rowsperstrip = rowblock;
} else if (rowblockbytes > 0 ) {
- uint32 rowblocksperstrip;
- rowblocksperstrip = (uint32) (STRIP_SIZE_DEFAULT / rowblockbytes);
+ uint32_t rowblocksperstrip;
+ rowblocksperstrip = (uint32_t) (STRIP_SIZE_DEFAULT / rowblockbytes);
rowsperstrip = rowblocksperstrip * rowblock;
stripbytes = rowblocksperstrip * rowblockbytes;
}
@@ -5982,14 +5977,14 @@ ChopUpSingleUncompressedStrip(TIFF* tif)
static void TryChopUpUncompressedBigTiff( TIFF* tif )
{
TIFFDirectory *td = &tif->tif_dir;
- uint32 rowblock;
- uint64 rowblockbytes;
- uint32 i;
- uint64 stripsize;
- uint32 rowblocksperstrip;
- uint32 rowsperstrip;
- uint64 stripbytes;
- uint32 nstrips;
+ uint32_t rowblock;
+ uint64_t rowblockbytes;
+ uint32_t i;
+ uint64_t stripsize;
+ uint32_t rowblocksperstrip;
+ uint32_t rowsperstrip;
+ uint64_t stripbytes;
+ uint32_t nstrips;
stripsize = TIFFStripSize64(tif);
@@ -6042,7 +6037,7 @@ static void TryChopUpUncompressedBigTiff( TIFF* tif )
}
/* Aim for 512 MB strips (that will still be manageable by 32 bit builds */
- rowblocksperstrip = (uint32) (512 * 1024 * 1024 / rowblockbytes);
+ rowblocksperstrip = (uint32_t) (512 * 1024 * 1024 / rowblockbytes);
if( rowblocksperstrip == 0 )
rowblocksperstrip = 1;
rowsperstrip = rowblocksperstrip * rowblock;
@@ -6058,9 +6053,9 @@ static void TryChopUpUncompressedBigTiff( TIFF* tif )
if( tif->tif_mode == O_RDONLY &&
nstrips > 1000000 )
{
- uint64 last_offset = TIFFGetStrileOffset(tif, td->td_nstrips-1);
- uint64 filesize = TIFFGetFileSize(tif);
- uint64 last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips-1);
+ uint64_t last_offset = TIFFGetStrileOffset(tif, td->td_nstrips - 1);
+ uint64_t filesize = TIFFGetFileSize(tif);
+ uint64_t last_bytecount = TIFFGetStrileByteCount(tif, td->td_nstrips - 1);
if( last_offset > filesize ||
last_bytecount > filesize - last_offset )
{
@@ -6073,7 +6068,7 @@ static void TryChopUpUncompressedBigTiff( TIFF* tif )
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
-static uint64 _TIFFUnsanitizedAddUInt64AndInt(uint64 a, int b)
+static uint64_t _TIFFUnsanitizedAddUInt64AndInt(uint64_t a, int b)
{
return a + b;
}
@@ -6083,8 +6078,8 @@ static uint64 _TIFFUnsanitizedAddUInt64AndInt(uint64 a, int b)
* 4096 byte page size.
*/
static
-int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
- int strile, uint64* panVals )
+int _TIFFPartialReadStripArray(TIFF* tif, TIFFDirEntry* dirent,
+ int strile, uint64_t* panVals )
{
static const char module[] = "_TIFFPartialReadStripArray";
#define IO_CACHE_PAGE_SIZE 4096
@@ -6092,37 +6087,37 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
size_t sizeofval;
const int bSwab = (tif->tif_flags & TIFF_SWAB) != 0;
int sizeofvalint;
- uint64 nBaseOffset;
- uint64 nOffset;
- uint64 nOffsetStartPage;
- uint64 nOffsetEndPage;
+ uint64_t nBaseOffset;
+ uint64_t nOffset;
+ uint64_t nOffsetStartPage;
+ uint64_t nOffsetEndPage;
tmsize_t nToRead;
tmsize_t nRead;
- uint64 nLastStripOffset;
+ uint64_t nLastStripOffset;
int iStartBefore;
int i;
- const uint32 arraySize = tif->tif_dir.td_stripoffsetbyteallocsize;
+ const uint32_t arraySize = tif->tif_dir.td_stripoffsetbyteallocsize;
unsigned char buffer[2 * IO_CACHE_PAGE_SIZE];
assert( dirent->tdir_count > 4 );
if( dirent->tdir_type == TIFF_SHORT )
{
- sizeofval = sizeof(uint16);
+ sizeofval = sizeof(uint16_t);
}
else if( dirent->tdir_type == TIFF_LONG )
{
- sizeofval = sizeof(uint32);
+ sizeofval = sizeof(uint32_t);
}
else if( dirent->tdir_type == TIFF_LONG8 )
{
- sizeofval = sizeof(uint64);
+ sizeofval = sizeof(uint64_t);
}
else if( dirent->tdir_type == TIFF_SLONG8 )
{
/* Non conformant but used by some images as in */
/* https://github.com/OSGeo/gdal/issues/2165 */
- sizeofval = sizeof(int64);
+ sizeofval = sizeof(int64_t);
}
else
{
@@ -6135,20 +6130,20 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
if( tif->tif_flags&TIFF_BIGTIFF )
{
- uint64 offset = dirent->tdir_offset.toff_long8;
+ uint64_t offset = dirent->tdir_offset.toff_long8;
if( bSwab )
TIFFSwabLong8(&offset);
nBaseOffset = offset;
}
else
{
- uint32 offset = dirent->tdir_offset.toff_long;
+ uint32_t offset = dirent->tdir_offset.toff_long;
if( bSwab )
TIFFSwabLong(&offset);
nBaseOffset = offset;
}
/* To avoid later unsigned integer overflows */
- if( nBaseOffset > (uint64)TIFF_INT64_MAX )
+ if( nBaseOffset > (uint64_t)INT64_MAX )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Cannot read offset/size for strile %d", strile);
@@ -6192,13 +6187,13 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
if( strile + iStartBefore < 0 )
iStartBefore = -strile;
for( i = iStartBefore;
- (uint32)(strile + i) < arraySize &&
+ (uint32_t)(strile + i) < arraySize &&
_TIFFUnsanitizedAddUInt64AndInt(nOffset, (i + 1) * sizeofvalint) <= nOffsetEndPage;
++i )
{
if( dirent->tdir_type == TIFF_SHORT )
{
- uint16 val;
+ uint16_t val;
memcpy(&val,
buffer + (nOffset - nOffsetStartPage) + i * sizeofvalint,
sizeof(val));
@@ -6208,7 +6203,7 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
}
else if( dirent->tdir_type == TIFF_LONG )
{
- uint32 val;
+ uint32_t val;
memcpy(&val,
buffer + (nOffset - nOffsetStartPage) + i * sizeofvalint,
sizeof(val));
@@ -6218,7 +6213,7 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
}
else if( dirent->tdir_type == TIFF_LONG8 )
{
- uint64 val;
+ uint64_t val;
memcpy(&val,
buffer + (nOffset - nOffsetStartPage) + i * sizeofvalint,
sizeof(val));
@@ -6229,22 +6224,22 @@ int _TIFFPartialReadStripArray( TIFF* tif, TIFFDirEntry* dirent,
else /* if( dirent->tdir_type == TIFF_SLONG8 ) */
{
/* Non conformant data type */
- int64 val;
+ int64_t val;
memcpy(&val,
buffer + (nOffset - nOffsetStartPage) + i * sizeofvalint,
sizeof(val));
if( bSwab )
- TIFFSwabLong8((uint64*) &val);
- panVals[strile + i] = (uint64) val;
+ TIFFSwabLong8((uint64_t*) &val);
+ panVals[strile + i] = (uint64_t) val;
}
}
return 1;
}
static int _TIFFFetchStrileValue(TIFF* tif,
- uint32 strile,
+ uint32_t strile,
TIFFDirEntry* dirent,
- uint64** parray)
+ uint64_t** parray)
{
static const char module[] = "_TIFFFetchStrileValue";
TIFFDirectory *td = &tif->tif_dir;
@@ -6254,20 +6249,20 @@ static int _TIFFFetchStrileValue(TIFF* tif,
}
if( strile >= td->td_stripoffsetbyteallocsize )
{
- uint32 nStripArrayAllocBefore = td->td_stripoffsetbyteallocsize;
- uint32 nStripArrayAllocNew;
- uint64 nArraySize64;
+ uint32_t nStripArrayAllocBefore = td->td_stripoffsetbyteallocsize;
+ uint32_t nStripArrayAllocNew;
+ uint64_t nArraySize64;
size_t nArraySize;
- uint64* offsetArray;
- uint64* bytecountArray;
+ uint64_t* offsetArray;
+ uint64_t* bytecountArray;
if( strile > 1000000 )
{
- uint64 filesize = TIFFGetFileSize(tif);
+ uint64_t filesize = TIFFGetFileSize(tif);
/* Avoid excessive memory allocation attempt */
/* For such a big blockid we need at least a TIFF_LONG per strile */
/* for the offset array. */
- if( strile > filesize / sizeof(uint32) )
+ if( strile > filesize / sizeof(uint32_t) )
{
TIFFErrorExt(tif->tif_clientdata, module, "File too short");
return 0;
@@ -6289,7 +6284,7 @@ static int _TIFFFetchStrileValue(TIFF* tif,
nStripArrayAllocNew = TIFF_MIN(nStripArrayAllocNew, td->td_nstrips);
}
assert( strile < nStripArrayAllocNew );
- nArraySize64 = (uint64)sizeof(uint64) * nStripArrayAllocNew;
+ nArraySize64 = (uint64_t)sizeof(uint64_t) * nStripArrayAllocNew;
nArraySize = (size_t)(nArraySize64);
#if SIZEOF_SIZE_T == 4
if( nArraySize != nArraySize64 )
@@ -6299,9 +6294,9 @@ static int _TIFFFetchStrileValue(TIFF* tif,
return 0;
}
#endif
- offsetArray = (uint64*)(
+ offsetArray = (uint64_t*)(
_TIFFrealloc( td->td_stripoffset_p, nArraySize ) );
- bytecountArray = (uint64*)(
+ bytecountArray = (uint64_t*)(
_TIFFrealloc( td->td_stripbytecount_p, nArraySize ) );
if( offsetArray )
td->td_stripoffset_p = offsetArray;
@@ -6313,10 +6308,10 @@ static int _TIFFFetchStrileValue(TIFF* tif,
/* Initialize new entries to ~0 / -1 */
memset(td->td_stripoffset_p + nStripArrayAllocBefore,
0xFF,
- (td->td_stripoffsetbyteallocsize - nStripArrayAllocBefore) * sizeof(uint64) );
+ (td->td_stripoffsetbyteallocsize - nStripArrayAllocBefore) * sizeof(uint64_t) );
memset(td->td_stripbytecount_p + nStripArrayAllocBefore,
0xFF,
- (td->td_stripoffsetbyteallocsize - nStripArrayAllocBefore) * sizeof(uint64) );
+ (td->td_stripoffsetbyteallocsize - nStripArrayAllocBefore) * sizeof(uint64_t) );
}
else
{
@@ -6344,10 +6339,10 @@ static int _TIFFFetchStrileValue(TIFF* tif,
return 1;
}
-static uint64 _TIFFGetStrileOffsetOrByteCountValue(TIFF *tif, uint32 strile,
- TIFFDirEntry* dirent,
- uint64** parray,
- int *pbErr)
+static uint64_t _TIFFGetStrileOffsetOrByteCountValue(TIFF *tif, uint32_t strile,
+ TIFFDirEntry* dirent,
+ uint64_t** parray,
+ int *pbErr)
{
TIFFDirectory *td = &tif->tif_dir;
if( pbErr )
@@ -6388,13 +6383,13 @@ static uint64 _TIFFGetStrileOffsetOrByteCountValue(TIFF *tif, uint32 strile,
}
/* Return the value of the TileOffsets/StripOffsets array for the specified tile/strile */
-uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile)
+uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile)
{
return TIFFGetStrileOffsetWithErr(tif, strile, NULL);
}
/* Return the value of the TileOffsets/StripOffsets array for the specified tile/strile */
-uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr)
+uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, int *pbErr)
{
TIFFDirectory *td = &tif->tif_dir;
return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
@@ -6403,13 +6398,13 @@ uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr)
}
/* Return the value of the TileByteCounts/StripByteCounts array for the specified tile/strile */
-uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile)
+uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile)
{
return TIFFGetStrileByteCountWithErr(tif, strile, NULL);
}
/* Return the value of the TileByteCounts/StripByteCounts array for the specified tile/strile */
-uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr)
+uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile, int *pbErr)
{
TIFFDirectory *td = &tif->tif_dir;
return _TIFFGetStrileOffsetOrByteCountValue(tif, strile,
@@ -6469,7 +6464,7 @@ static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount )
#ifdef STRIPBYTECOUNTSORTED_UNUSED
if (tif->tif_dir.td_nstrips > 1 && return_value == 1 ) {
- uint32 strip;
+ uint32_t strip;
tif->tif_dir.td_stripbytecountsorted = 1;
for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {
diff --git a/libtiff/tif_dirwrite.c b/libtiff/tif_dirwrite.c
index f481250e..2f469cfd 100644
--- a/libtiff/tif_dirwrite.c
+++ b/libtiff/tif_dirwrite.c
@@ -35,152 +35,152 @@
#define TIFFCvtNativeToIEEEFloat(tif, n, fp)
#define TIFFCvtNativeToIEEEDouble(tif, n, dp)
#else
-extern void TIFFCvtNativeToIEEEFloat(TIFF* tif, uint32 n, float* fp);
-extern void TIFFCvtNativeToIEEEDouble(TIFF* tif, uint32 n, double* dp);
+extern void TIFFCvtNativeToIEEEFloat(TIFF* tif, uint32_t n, float* fp);
+extern void TIFFCvtNativeToIEEEDouble(TIFF* tif, uint32_t n, double* dp);
#endif
-static int TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff);
+static int TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64_t* pdiroff);
-static int TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
+static int TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
#if 0
-static int TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
+static int TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
#endif
-static int TIFFWriteDirectoryTagAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value);
-static int TIFFWriteDirectoryTagUndefinedArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value);
+static int TIFFWriteDirectoryTagAscii(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, char* value);
+static int TIFFWriteDirectoryTagUndefinedArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagByte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value);
+static int TIFFWriteDirectoryTagByte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value);
#endif
-static int TIFFWriteDirectoryTagByteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value);
+static int TIFFWriteDirectoryTagByteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value);
#if 0
-static int TIFFWriteDirectoryTagBytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value);
+static int TIFFWriteDirectoryTagBytePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value);
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagSbyte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value);
+static int TIFFWriteDirectoryTagSbyte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value);
#endif
-static int TIFFWriteDirectoryTagSbyteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int8* value);
+static int TIFFWriteDirectoryTagSbyteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int8_t* value);
#if 0
-static int TIFFWriteDirectoryTagSbytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value);
+static int TIFFWriteDirectoryTagSbytePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value);
#endif
-static int TIFFWriteDirectoryTagShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value);
-static int TIFFWriteDirectoryTagShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value);
-static int TIFFWriteDirectoryTagShortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value);
+static int TIFFWriteDirectoryTagShort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value);
+static int TIFFWriteDirectoryTagShortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint16_t* value);
+static int TIFFWriteDirectoryTagShortPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value);
#ifdef notdef
-static int TIFFWriteDirectoryTagSshort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value);
+static int TIFFWriteDirectoryTagSshort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value);
#endif
-static int TIFFWriteDirectoryTagSshortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int16* value);
+static int TIFFWriteDirectoryTagSshortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int16_t* value);
#if 0
-static int TIFFWriteDirectoryTagSshortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value);
+static int TIFFWriteDirectoryTagSshortPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value);
#endif
-static int TIFFWriteDirectoryTagLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value);
-static int TIFFWriteDirectoryTagLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value);
+static int TIFFWriteDirectoryTagLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value);
+static int TIFFWriteDirectoryTagLongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value);
#if 0
-static int TIFFWriteDirectoryTagLongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value);
+static int TIFFWriteDirectoryTagLongPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value);
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagSlong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value);
+static int TIFFWriteDirectoryTagSlong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value);
#endif
-static int TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value);
+static int TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int32_t* value);
#if 0
-static int TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value);
+static int TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value);
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint64 value);
+static int TIFFWriteDirectoryTagLong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint64_t value);
#endif
-static int TIFFWriteDirectoryTagLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int64 value);
+static int TIFFWriteDirectoryTagSlong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int64_t value);
#endif
-static int TIFFWriteDirectoryTagSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int64* value);
-static int TIFFWriteDirectoryTagRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
-static int TIFFWriteDirectoryTagRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
-static int TIFFWriteDirectoryTagSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
+static int TIFFWriteDirectoryTagSlong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int64_t* value);
+static int TIFFWriteDirectoryTagRational(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
+static int TIFFWriteDirectoryTagRationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
+static int TIFFWriteDirectoryTagSrationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value);
+static int TIFFWriteDirectoryTagFloat(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value);
#endif
-static int TIFFWriteDirectoryTagFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
+static int TIFFWriteDirectoryTagFloatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
#if 0
-static int TIFFWriteDirectoryTagFloatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value);
+static int TIFFWriteDirectoryTagFloatPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value);
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
+static int TIFFWriteDirectoryTagDouble(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
#endif
-static int TIFFWriteDirectoryTagDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
+static int TIFFWriteDirectoryTagDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
#if 0
-static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
+static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
#endif
-static int TIFFWriteDirectoryTagIfdArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value);
+static int TIFFWriteDirectoryTagIfdArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
#endif
-static int TIFFWriteDirectoryTagShortLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value);
-static int TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
-static int TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagShortLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value);
+static int TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
+static int TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
#endif
-static int TIFFWriteDirectoryTagColormap(TIFF* tif, uint32* ndir, TIFFDirEntry* dir);
-static int TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32* ndir, TIFFDirEntry* dir);
-static int TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir);
+static int TIFFWriteDirectoryTagColormap(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir);
+static int TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir);
+static int TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir);
-static int TIFFWriteDirectoryTagCheckedAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value);
-static int TIFFWriteDirectoryTagCheckedUndefinedArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value);
+static int TIFFWriteDirectoryTagCheckedAscii(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, char* value);
+static int TIFFWriteDirectoryTagCheckedUndefinedArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedByte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value);
+static int TIFFWriteDirectoryTagCheckedByte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedByteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value);
+static int TIFFWriteDirectoryTagCheckedByteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedSbyte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value);
+static int TIFFWriteDirectoryTagCheckedSbyte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedSbyteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int8* value);
-static int TIFFWriteDirectoryTagCheckedShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value);
-static int TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value);
+static int TIFFWriteDirectoryTagCheckedSbyteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int8_t* value);
+static int TIFFWriteDirectoryTagCheckedShort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value);
+static int TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint16_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedSshort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value);
+static int TIFFWriteDirectoryTagCheckedSshort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedSshortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int16* value);
-static int TIFFWriteDirectoryTagCheckedLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value);
-static int TIFFWriteDirectoryTagCheckedLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value);
+static int TIFFWriteDirectoryTagCheckedSshortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int16_t* value);
+static int TIFFWriteDirectoryTagCheckedLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value);
+static int TIFFWriteDirectoryTagCheckedLongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedSlong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value);
+static int TIFFWriteDirectoryTagCheckedSlong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value);
+static int TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int32_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint64 value);
+static int TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint64_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int64 value);
+static int TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int64_t value);
#endif
-static int TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int64* value);
-static int TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
-static int TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
-static int TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
+static int TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int64_t* value);
+static int TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
+static int TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
+static int TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
/*--: Rational2Double: New functions to support true double-precision for custom rational tag types. */
-static int TIFFWriteDirectoryTagRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
-static int TIFFWriteDirectoryTagSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
-static int TIFFWriteDirectoryTagCheckedRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
-static int TIFFWriteDirectoryTagCheckedSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
-static void DoubleToRational(double value, uint32 *num, uint32 *denom);
-static void DoubleToSrational(double value, int32 *num, int32 *denom);
+static int TIFFWriteDirectoryTagRationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
+static int TIFFWriteDirectoryTagSrationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
+static int TIFFWriteDirectoryTagCheckedRationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
+static int TIFFWriteDirectoryTagCheckedSrationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
+static void DoubleToRational(double value, uint32_t *num, uint32_t *denom);
+static void DoubleToSrational(double value, int32_t *num, int32_t *denom);
#if 0
static void DoubleToRational_direct(double value, unsigned long *num, unsigned long *denom);
static void DoubleToSrational_direct(double value, long *num, long *denom);
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value);
+static int TIFFWriteDirectoryTagCheckedFloat(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value);
#endif
-static int TIFFWriteDirectoryTagCheckedFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value);
+static int TIFFWriteDirectoryTagCheckedFloatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value);
#ifdef notdef
-static int TIFFWriteDirectoryTagCheckedDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value);
+static int TIFFWriteDirectoryTagCheckedDouble(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value);
#endif
-static int TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value);
-static int TIFFWriteDirectoryTagCheckedIfdArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value);
-static int TIFFWriteDirectoryTagCheckedIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value);
+static int TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value);
+static int TIFFWriteDirectoryTagCheckedIfdArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value);
+static int TIFFWriteDirectoryTagCheckedIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value);
-static int TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data);
+static int TIFFWriteDirectoryTagData(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t datatype, uint32_t count, uint32_t datalength, void* data);
static int TIFFLinkDirectory(TIFF*);
@@ -260,7 +260,7 @@ TIFFCheckpointDirectory(TIFF* tif)
}
int
-TIFFWriteCustomDirectory(TIFF* tif, uint64* pdiroff)
+TIFFWriteCustomDirectory(TIFF* tif, uint64_t* pdiroff)
{
return TIFFWriteDirectorySec(tif,FALSE,FALSE,pdiroff);
}
@@ -302,11 +302,11 @@ TIFFRewriteDirectory( TIFF *tif )
}
else
{
- uint32 nextdir;
+ uint32_t nextdir;
nextdir = tif->tif_header.classic.tiff_diroff;
while(1) {
- uint16 dircount;
- uint32 nextnextdir;
+ uint16_t dircount;
+ uint32_t nextnextdir;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount, 2)) {
@@ -327,7 +327,7 @@ TIFFRewriteDirectory( TIFF *tif )
TIFFSwabLong(&nextnextdir);
if (nextnextdir==tif->tif_diroff)
{
- uint32 m;
+ uint32_t m;
m=0;
(void) TIFFSeekFile(tif,
nextdir+2+dircount*12, SEEK_SET);
@@ -360,12 +360,12 @@ TIFFRewriteDirectory( TIFF *tif )
}
else
{
- uint64 nextdir;
+ uint64_t nextdir;
nextdir = tif->tif_header.big.tiff_diroff;
while(1) {
- uint64 dircount64;
- uint16 dircount;
- uint64 nextnextdir;
+ uint64_t dircount64;
+ uint16_t dircount;
+ uint64_t nextnextdir;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount64, 8)) {
@@ -381,7 +381,7 @@ TIFFRewriteDirectory( TIFF *tif )
"Sanity check on tag count failed, likely corrupt TIFF");
return (0);
}
- dircount=(uint16)dircount64;
+ dircount=(uint16_t)dircount64;
(void) TIFFSeekFile(tif,
nextdir+8+dircount*20, SEEK_SET);
if (!ReadOK(tif, &nextnextdir, 8)) {
@@ -393,7 +393,7 @@ TIFFRewriteDirectory( TIFF *tif )
TIFFSwabLong8(&nextnextdir);
if (nextnextdir==tif->tif_diroff)
{
- uint64 m;
+ uint64_t m;
m=0;
(void) TIFFSeekFile(tif,
nextdir+8+dircount*20, SEEK_SET);
@@ -418,14 +418,14 @@ TIFFRewriteDirectory( TIFF *tif )
}
static int
-TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
+TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64_t* pdiroff)
{
static const char module[] = "TIFFWriteDirectorySec";
- uint32 ndir;
+ uint32_t ndir;
TIFFDirEntry* dir;
- uint32 dirsize;
+ uint32_t dirsize;
void* dirmem;
- uint32 m;
+ uint32_t m;
if (tif->tif_mode == O_RDONLY)
return (1);
@@ -630,8 +630,8 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
{
if (tif->tif_dir.td_extrasamples)
{
- uint16 na;
- uint16* nb;
+ uint16_t na;
+ uint16_t* nb;
TIFFGetFieldDefaulted(tif,TIFFTAG_EXTRASAMPLES,&na,&nb);
if (!TIFFWriteDirectoryTagShortArray(tif,&ndir,dir,TIFFTAG_EXTRASAMPLES,na,nb))
goto bad;
@@ -698,7 +698,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
goto bad;
}
{
- uint32 n;
+ uint32_t n;
for (n=0; n<tif->tif_nfields; n++) {
const TIFFField* o;
o = tif->tif_fields[n];
@@ -708,48 +708,48 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
{
case TIFF_SETGET_ASCII:
{
- uint32 pa;
+ uint32_t pa;
char* pb;
assert(o->field_type==TIFF_ASCII);
assert(o->field_readcount==TIFF_VARIABLE);
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&pb);
- pa=(uint32)(strlen(pb));
- if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,(uint16)o->field_tag,pa,pb))
+ pa=(uint32_t)(strlen(pb));
+ if (!TIFFWriteDirectoryTagAscii(tif, &ndir, dir, (uint16_t)o->field_tag, pa, pb))
goto bad;
}
break;
case TIFF_SETGET_UINT16:
{
- uint16 p;
+ uint16_t p;
assert(o->field_type==TIFF_SHORT);
assert(o->field_readcount==1);
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&p);
- if (!TIFFWriteDirectoryTagShort(tif,&ndir,dir,(uint16)o->field_tag,p))
+ if (!TIFFWriteDirectoryTagShort(tif, &ndir, dir, (uint16_t)o->field_tag, p))
goto bad;
}
break;
case TIFF_SETGET_UINT32:
{
- uint32 p;
+ uint32_t p;
assert(o->field_type==TIFF_LONG);
assert(o->field_readcount==1);
assert(o->field_passcount==0);
TIFFGetField(tif,o->field_tag,&p);
- if (!TIFFWriteDirectoryTagLong(tif,&ndir,dir,(uint16)o->field_tag,p))
+ if (!TIFFWriteDirectoryTagLong(tif, &ndir, dir, (uint16_t)o->field_tag, p))
goto bad;
}
break;
case TIFF_SETGET_C32_UINT8:
{
- uint32 pa;
+ uint32_t pa;
void* pb;
assert(o->field_type==TIFF_UNDEFINED);
assert(o->field_readcount==TIFF_VARIABLE2);
assert(o->field_passcount==1);
TIFFGetField(tif,o->field_tag,&pa,&pb);
- if (!TIFFWriteDirectoryTagUndefinedArray(tif,&ndir,dir,(uint16)o->field_tag,pa,pb))
+ if (!TIFFWriteDirectoryTagUndefinedArray(tif, &ndir, dir, (uint16_t)o->field_tag, pa, pb))
goto bad;
}
break;
@@ -764,10 +764,10 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
}
}
}
- for (m=0; m<(uint32)(tif->tif_dir.td_customValueCount); m++)
+ for (m=0; m<(uint32_t)(tif->tif_dir.td_customValueCount); m++)
{
- uint16 tag = (uint16)tif->tif_dir.td_customValues[m].info->field_tag;
- uint32 count = tif->tif_dir.td_customValues[m].count;
+ uint16_t tag = (uint16_t)tif->tif_dir.td_customValues[m].info->field_tag;
+ uint32_t count = tif->tif_dir.td_customValues[m].count;
switch (tif->tif_dir.td_customValues[m].info->field_type)
{
case TIFF_ASCII:
@@ -892,8 +892,8 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
dirsize=8+ndir*20+8;
tif->tif_dataoff=tif->tif_diroff+dirsize;
if (!(tif->tif_flags&TIFF_BIGTIFF))
- tif->tif_dataoff=(uint32)tif->tif_dataoff;
- if ((tif->tif_dataoff<tif->tif_diroff)||(tif->tif_dataoff<(uint64)dirsize))
+ tif->tif_dataoff=(uint32_t)tif->tif_dataoff;
+ if ((tif->tif_dataoff<tif->tif_diroff)||(tif->tif_dataoff<(uint64_t)dirsize))
{
TIFFErrorExt(tif->tif_clientdata,module,"Maximum TIFF file size exceeded");
goto bad;
@@ -907,7 +907,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
{
if (TIFFFieldSet(tif,FIELD_SUBIFD)&&(tif->tif_subifdoff==0))
{
- uint32 na;
+ uint32_t na;
TIFFDirEntry* nb;
for (na=0, nb=dir; ; na++, nb++)
{
@@ -934,29 +934,29 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
}
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint8* n;
- uint32 nTmp;
+ uint8_t* n;
+ uint32_t nTmp;
TIFFDirEntry* o;
n=dirmem;
- *(uint16*)n=(uint16)ndir;
+ *(uint16_t*)n=(uint16_t)ndir;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)n);
+ TIFFSwabShort((uint16_t*)n);
n+=2;
o=dir;
for (m=0; m<ndir; m++)
{
- *(uint16*)n=o->tdir_tag;
+ *(uint16_t*)n=o->tdir_tag;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)n);
+ TIFFSwabShort((uint16_t*)n);
n+=2;
- *(uint16*)n=o->tdir_type;
+ *(uint16_t*)n=o->tdir_type;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)n);
+ TIFFSwabShort((uint16_t*)n);
n+=2;
- nTmp = (uint32)o->tdir_count;
+ nTmp = (uint32_t)o->tdir_count;
_TIFFmemcpy(n,&nTmp,4);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)n);
+ TIFFSwabLong((uint32_t*)n);
n+=4;
/* This is correct. The data has been */
/* swabbed previously in TIFFWriteDirectoryTagData */
@@ -964,34 +964,34 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
n+=4;
o++;
}
- nTmp = (uint32)tif->tif_nextdiroff;
+ nTmp = (uint32_t)tif->tif_nextdiroff;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&nTmp);
_TIFFmemcpy(n,&nTmp,4);
}
else
{
- uint8* n;
+ uint8_t* n;
TIFFDirEntry* o;
n=dirmem;
- *(uint64*)n=ndir;
+ *(uint64_t*)n=ndir;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)n);
+ TIFFSwabLong8((uint64_t*)n);
n+=8;
o=dir;
for (m=0; m<ndir; m++)
{
- *(uint16*)n=o->tdir_tag;
+ *(uint16_t*)n=o->tdir_tag;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)n);
+ TIFFSwabShort((uint16_t*)n);
n+=2;
- *(uint16*)n=o->tdir_type;
+ *(uint16_t*)n=o->tdir_type;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)n);
+ TIFFSwabShort((uint16_t*)n);
n+=2;
_TIFFmemcpy(n,&o->tdir_count,8);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)n);
+ TIFFSwabLong8((uint64_t*)n);
n+=8;
_TIFFmemcpy(n,&o->tdir_offset,8);
n+=8;
@@ -999,7 +999,7 @@ TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff)
}
_TIFFmemcpy(n,&tif->tif_nextdiroff,8);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)n);
+ TIFFSwabLong8((uint64_t*)n);
}
_TIFFfree(dir);
dir=NULL;
@@ -1035,66 +1035,66 @@ bad:
return(0);
}
-static int8 TIFFClampDoubleToInt8( double val )
+static int8_t TIFFClampDoubleToInt8(double val )
{
if( val > 127 )
return 127;
if( val < -128 || val != val )
return -128;
- return (int8)val;
+ return (int8_t)val;
}
-static int16 TIFFClampDoubleToInt16( double val )
+static int16_t TIFFClampDoubleToInt16(double val )
{
if( val > 32767 )
return 32767;
if( val < -32768 || val != val )
return -32768;
- return (int16)val;
+ return (int16_t)val;
}
-static int32 TIFFClampDoubleToInt32( double val )
+static int32_t TIFFClampDoubleToInt32(double val )
{
if( val > 0x7FFFFFFF )
return 0x7FFFFFFF;
if( val < -0x7FFFFFFF-1 || val != val )
return -0x7FFFFFFF-1;
- return (int32)val;
+ return (int32_t)val;
}
-static uint8 TIFFClampDoubleToUInt8( double val )
+static uint8_t TIFFClampDoubleToUInt8(double val )
{
if( val < 0 )
return 0;
if( val > 255 || val != val )
return 255;
- return (uint8)val;
+ return (uint8_t)val;
}
-static uint16 TIFFClampDoubleToUInt16( double val )
+static uint16_t TIFFClampDoubleToUInt16(double val )
{
if( val < 0 )
return 0;
if( val > 65535 || val != val )
return 65535;
- return (uint16)val;
+ return (uint16_t)val;
}
-static uint32 TIFFClampDoubleToUInt32( double val )
+static uint32_t TIFFClampDoubleToUInt32(double val )
{
if( val < 0 )
return 0;
if( val > 0xFFFFFFFFU || val != val )
return 0xFFFFFFFFU;
- return (uint32)val;
+ return (uint32_t)val;
}
static int
-TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
static const char module[] = "TIFFWriteDirectoryTagSampleformatArray";
void* conv;
- uint32 i;
+ uint32_t i;
int ok;
conv = _TIFFmalloc(count*sizeof(double));
if (conv == NULL)
@@ -1121,40 +1121,40 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di
if (tif->tif_dir.td_bitspersample<=8)
{
for (i = 0; i < count; ++i)
- ((int8*)conv)[i] = TIFFClampDoubleToInt8(value[i]);
- ok = TIFFWriteDirectoryTagSbyteArray(tif,ndir,dir,tag,count,(int8*)conv);
+ ((int8_t*)conv)[i] = TIFFClampDoubleToInt8(value[i]);
+ ok = TIFFWriteDirectoryTagSbyteArray(tif,ndir,dir,tag,count,(int8_t*)conv);
}
else if (tif->tif_dir.td_bitspersample<=16)
{
for (i = 0; i < count; ++i)
- ((int16*)conv)[i] = TIFFClampDoubleToInt16(value[i]);
- ok = TIFFWriteDirectoryTagSshortArray(tif,ndir,dir,tag,count,(int16*)conv);
+ ((int16_t*)conv)[i] = TIFFClampDoubleToInt16(value[i]);
+ ok = TIFFWriteDirectoryTagSshortArray(tif,ndir,dir,tag,count,(int16_t*)conv);
}
else
{
for (i = 0; i < count; ++i)
- ((int32*)conv)[i] = TIFFClampDoubleToInt32(value[i]);
- ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32*)conv);
+ ((int32_t*)conv)[i] = TIFFClampDoubleToInt32(value[i]);
+ ok = TIFFWriteDirectoryTagSlongArray(tif,ndir,dir,tag,count,(int32_t*)conv);
}
break;
case SAMPLEFORMAT_UINT:
if (tif->tif_dir.td_bitspersample<=8)
{
for (i = 0; i < count; ++i)
- ((uint8*)conv)[i] = TIFFClampDoubleToUInt8(value[i]);
- ok = TIFFWriteDirectoryTagByteArray(tif,ndir,dir,tag,count,(uint8*)conv);
+ ((uint8_t*)conv)[i] = TIFFClampDoubleToUInt8(value[i]);
+ ok = TIFFWriteDirectoryTagByteArray(tif,ndir,dir,tag,count,(uint8_t*)conv);
}
else if (tif->tif_dir.td_bitspersample<=16)
{
for (i = 0; i < count; ++i)
- ((uint16*)conv)[i] = TIFFClampDoubleToUInt16(value[i]);
- ok = TIFFWriteDirectoryTagShortArray(tif,ndir,dir,tag,count,(uint16*)conv);
+ ((uint16_t*)conv)[i] = TIFFClampDoubleToUInt16(value[i]);
+ ok = TIFFWriteDirectoryTagShortArray(tif,ndir,dir,tag,count,(uint16_t*)conv);
}
else
{
for (i = 0; i < count; ++i)
- ((uint32*)conv)[i] = TIFFClampDoubleToUInt32(value[i]);
- ok = TIFFWriteDirectoryTagLongArray(tif,ndir,dir,tag,count,(uint32*)conv);
+ ((uint32_t*)conv)[i] = TIFFClampDoubleToUInt32(value[i]);
+ ok = TIFFWriteDirectoryTagLongArray(tif,ndir,dir,tag,count,(uint32_t*)conv);
}
break;
default:
@@ -1167,7 +1167,7 @@ TIFFWriteDirectoryTagSampleformatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di
#if 0
static int
-TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
switch (tif->tif_dir.td_sampleformat)
{
@@ -1178,18 +1178,18 @@ TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry
return(TIFFWriteDirectoryTagDoublePerSample(tif,ndir,dir,tag,value));
case SAMPLEFORMAT_INT:
if (tif->tif_dir.td_bitspersample<=8)
- return(TIFFWriteDirectoryTagSbytePerSample(tif,ndir,dir,tag,(int8)value));
+ return(TIFFWriteDirectoryTagSbytePerSample(tif,ndir,dir,tag,(int8_t)value));
else if (tif->tif_dir.td_bitspersample<=16)
- return(TIFFWriteDirectoryTagSshortPerSample(tif,ndir,dir,tag,(int16)value));
+ return(TIFFWriteDirectoryTagSshortPerSample(tif,ndir,dir,tag,(int16_t)value));
else
- return(TIFFWriteDirectoryTagSlongPerSample(tif,ndir,dir,tag,(int32)value));
+ return(TIFFWriteDirectoryTagSlongPerSample(tif,ndir,dir,tag,(int32_t)value));
case SAMPLEFORMAT_UINT:
if (tif->tif_dir.td_bitspersample<=8)
- return(TIFFWriteDirectoryTagBytePerSample(tif,ndir,dir,tag,(uint8)value));
+ return(TIFFWriteDirectoryTagBytePerSample(tif,ndir,dir,tag,(uint8_t)value));
else if (tif->tif_dir.td_bitspersample<=16)
- return(TIFFWriteDirectoryTagShortPerSample(tif,ndir,dir,tag,(uint16)value));
+ return(TIFFWriteDirectoryTagShortPerSample(tif,ndir,dir,tag,(uint16_t)value));
else
- return(TIFFWriteDirectoryTagLongPerSample(tif,ndir,dir,tag,(uint32)value));
+ return(TIFFWriteDirectoryTagLongPerSample(tif,ndir,dir,tag,(uint32_t)value));
default:
return(1);
}
@@ -1197,7 +1197,7 @@ TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry
#endif
static int
-TIFFWriteDirectoryTagAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value)
+TIFFWriteDirectoryTagAscii(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, char* value)
{
if (dir==NULL)
{
@@ -1208,7 +1208,7 @@ TIFFWriteDirectoryTagAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 ta
}
static int
-TIFFWriteDirectoryTagUndefinedArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value)
+TIFFWriteDirectoryTagUndefinedArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value)
{
if (dir==NULL)
{
@@ -1220,7 +1220,7 @@ TIFFWriteDirectoryTagUndefinedArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
#ifdef notdef
static int
-TIFFWriteDirectoryTagByte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value)
+TIFFWriteDirectoryTagByte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value)
{
if (dir==NULL)
{
@@ -1232,7 +1232,7 @@ TIFFWriteDirectoryTagByte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag
#endif
static int
-TIFFWriteDirectoryTagByteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value)
+TIFFWriteDirectoryTagByteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value)
{
if (dir==NULL)
{
@@ -1244,19 +1244,19 @@ TIFFWriteDirectoryTagByteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint1
#if 0
static int
-TIFFWriteDirectoryTagBytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value)
+TIFFWriteDirectoryTagBytePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value)
{
static const char module[] = "TIFFWriteDirectoryTagBytePerSample";
- uint8* m;
- uint8* na;
- uint16 nb;
+ uint8_t* m;
+ uint8_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint8));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint8_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1272,7 +1272,7 @@ TIFFWriteDirectoryTagBytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
#ifdef notdef
static int
-TIFFWriteDirectoryTagSbyte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value)
+TIFFWriteDirectoryTagSbyte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value)
{
if (dir==NULL)
{
@@ -1284,7 +1284,7 @@ TIFFWriteDirectoryTagSbyte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 ta
#endif
static int
-TIFFWriteDirectoryTagSbyteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int8* value)
+TIFFWriteDirectoryTagSbyteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int8_t* value)
{
if (dir==NULL)
{
@@ -1296,19 +1296,19 @@ TIFFWriteDirectoryTagSbyteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint
#if 0
static int
-TIFFWriteDirectoryTagSbytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value)
+TIFFWriteDirectoryTagSbytePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value)
{
static const char module[] = "TIFFWriteDirectoryTagSbytePerSample";
- int8* m;
- int8* na;
- uint16 nb;
+ int8_t* m;
+ int8_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int8));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int8_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1323,7 +1323,7 @@ TIFFWriteDirectoryTagSbytePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
#endif
static int
-TIFFWriteDirectoryTagShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value)
+TIFFWriteDirectoryTagShort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value)
{
if (dir==NULL)
{
@@ -1334,7 +1334,7 @@ TIFFWriteDirectoryTagShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 ta
}
static int
-TIFFWriteDirectoryTagShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value)
+TIFFWriteDirectoryTagShortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint16_t* value)
{
if (dir==NULL)
{
@@ -1345,19 +1345,19 @@ TIFFWriteDirectoryTagShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint
}
static int
-TIFFWriteDirectoryTagShortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value)
+TIFFWriteDirectoryTagShortPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value)
{
static const char module[] = "TIFFWriteDirectoryTagShortPerSample";
- uint16* m;
- uint16* na;
- uint16 nb;
+ uint16_t* m;
+ uint16_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint16));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint16_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1372,7 +1372,7 @@ TIFFWriteDirectoryTagShortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
#ifdef notdef
static int
-TIFFWriteDirectoryTagSshort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value)
+TIFFWriteDirectoryTagSshort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value)
{
if (dir==NULL)
{
@@ -1384,7 +1384,7 @@ TIFFWriteDirectoryTagSshort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 t
#endif
static int
-TIFFWriteDirectoryTagSshortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int16* value)
+TIFFWriteDirectoryTagSshortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int16_t* value)
{
if (dir==NULL)
{
@@ -1396,19 +1396,19 @@ TIFFWriteDirectoryTagSshortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uin
#if 0
static int
-TIFFWriteDirectoryTagSshortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value)
+TIFFWriteDirectoryTagSshortPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value)
{
static const char module[] = "TIFFWriteDirectoryTagSshortPerSample";
- int16* m;
- int16* na;
- uint16 nb;
+ int16_t* m;
+ int16_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int16));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int16_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1423,7 +1423,7 @@ TIFFWriteDirectoryTagSshortPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
#endif
static int
-TIFFWriteDirectoryTagLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value)
+TIFFWriteDirectoryTagLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value)
{
if (dir==NULL)
{
@@ -1434,7 +1434,7 @@ TIFFWriteDirectoryTagLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag
}
static int
-TIFFWriteDirectoryTagLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value)
+TIFFWriteDirectoryTagLongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value)
{
if (dir==NULL)
{
@@ -1446,19 +1446,19 @@ TIFFWriteDirectoryTagLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint1
#if 0
static int
-TIFFWriteDirectoryTagLongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value)
+TIFFWriteDirectoryTagLongPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value)
{
static const char module[] = "TIFFWriteDirectoryTagLongPerSample";
- uint32* m;
- uint32* na;
- uint16 nb;
+ uint32_t* m;
+ uint32_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint32));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(uint32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1474,7 +1474,7 @@ TIFFWriteDirectoryTagLongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
#ifdef notdef
static int
-TIFFWriteDirectoryTagSlong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value)
+TIFFWriteDirectoryTagSlong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value)
{
if (dir==NULL)
{
@@ -1486,7 +1486,7 @@ TIFFWriteDirectoryTagSlong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 ta
#endif
static int
-TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value)
+TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int32_t* value)
{
if (dir==NULL)
{
@@ -1498,19 +1498,19 @@ TIFFWriteDirectoryTagSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint
#if 0
static int
-TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value)
+TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value)
{
static const char module[] = "TIFFWriteDirectoryTagSlongPerSample";
- int32* m;
- int32* na;
- uint16 nb;
+ int32_t* m;
+ int32_t* na;
+ uint16_t nb;
int o;
if (dir==NULL)
{
(*ndir)++;
return(1);
}
- m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int32));
+ m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(int32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1526,7 +1526,7 @@ TIFFWriteDirectoryTagSlongPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
#ifdef notdef
static int
-TIFFWriteDirectoryTagLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint64 value)
+TIFFWriteDirectoryTagLong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint64_t value)
{
if (dir==NULL)
{
@@ -1538,7 +1538,7 @@ TIFFWriteDirectoryTagLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 ta
#endif
static int
-TIFFWriteDirectoryTagLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
if (dir==NULL)
{
@@ -1550,7 +1550,7 @@ TIFFWriteDirectoryTagLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint
#ifdef notdef
static int
-TIFFWriteDirectoryTagSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int64 value)
+TIFFWriteDirectoryTagSlong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int64_t value)
{
if (dir==NULL)
{
@@ -1562,7 +1562,7 @@ TIFFWriteDirectoryTagSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 t
#endif
static int
-TIFFWriteDirectoryTagSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int64* value)
+TIFFWriteDirectoryTagSlong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int64_t* value)
{
if (dir==NULL)
{
@@ -1573,7 +1573,7 @@ TIFFWriteDirectoryTagSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uin
}
static int
-TIFFWriteDirectoryTagRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+TIFFWriteDirectoryTagRational(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
if (dir==NULL)
{
@@ -1584,7 +1584,7 @@ TIFFWriteDirectoryTagRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16
}
static int
-TIFFWriteDirectoryTagRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+TIFFWriteDirectoryTagRationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
if (dir==NULL)
{
@@ -1595,7 +1595,7 @@ TIFFWriteDirectoryTagRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
}
static int
-TIFFWriteDirectoryTagSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+TIFFWriteDirectoryTagSrationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
if (dir==NULL)
{
@@ -1607,7 +1607,7 @@ TIFFWriteDirectoryTagSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
/*-- Rational2Double: additional write functions */
static int
-TIFFWriteDirectoryTagRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagRationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
if (dir==NULL)
{
@@ -1618,7 +1618,7 @@ TIFFWriteDirectoryTagRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
static int
-TIFFWriteDirectoryTagSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagSrationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
if (dir==NULL)
{
@@ -1629,7 +1629,7 @@ TIFFWriteDirectoryTagSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
#ifdef notdef
-static int TIFFWriteDirectoryTagFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value)
+static int TIFFWriteDirectoryTagFloat(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value)
{
if (dir==NULL)
{
@@ -1640,7 +1640,7 @@ static int TIFFWriteDirectoryTagFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir
}
#endif
-static int TIFFWriteDirectoryTagFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+static int TIFFWriteDirectoryTagFloatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
if (dir==NULL)
{
@@ -1651,12 +1651,12 @@ static int TIFFWriteDirectoryTagFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry
}
#if 0
-static int TIFFWriteDirectoryTagFloatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value)
+static int TIFFWriteDirectoryTagFloatPerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value)
{
static const char module[] = "TIFFWriteDirectoryTagFloatPerSample";
float* m;
float* na;
- uint16 nb;
+ uint16_t nb;
int o;
if (dir==NULL)
{
@@ -1678,7 +1678,7 @@ static int TIFFWriteDirectoryTagFloatPerSample(TIFF* tif, uint32* ndir, TIFFDirE
#endif
#ifdef notdef
-static int TIFFWriteDirectoryTagDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+static int TIFFWriteDirectoryTagDouble(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
if (dir==NULL)
{
@@ -1689,7 +1689,7 @@ static int TIFFWriteDirectoryTagDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* di
}
#endif
-static int TIFFWriteDirectoryTagDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+static int TIFFWriteDirectoryTagDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
if (dir==NULL)
{
@@ -1700,12 +1700,12 @@ static int TIFFWriteDirectoryTagDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntr
}
#if 0
-static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
static const char module[] = "TIFFWriteDirectoryTagDoublePerSample";
double* m;
double* na;
- uint16 nb;
+ uint16_t nb;
int o;
if (dir==NULL)
{
@@ -1727,7 +1727,7 @@ static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32* ndir, TIFFDir
#endif
static int
-TIFFWriteDirectoryTagIfdArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value)
+TIFFWriteDirectoryTagIfdArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value)
{
if (dir==NULL)
{
@@ -1739,7 +1739,7 @@ TIFFWriteDirectoryTagIfdArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16
#ifdef notdef
static int
-TIFFWriteDirectoryTagIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
if (dir==NULL)
{
@@ -1751,7 +1751,7 @@ TIFFWriteDirectoryTagIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint1
#endif
static int
-TIFFWriteDirectoryTagShortLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value)
+TIFFWriteDirectoryTagShortLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value)
{
if (dir==NULL)
{
@@ -1759,14 +1759,14 @@ TIFFWriteDirectoryTagShortLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint1
return(1);
}
if (value<=0xFFFF)
- return(TIFFWriteDirectoryTagCheckedShort(tif,ndir,dir,tag,(uint16)value));
+ return(TIFFWriteDirectoryTagCheckedShort(tif,ndir,dir,tag,(uint16_t)value));
else
return(TIFFWriteDirectoryTagCheckedLong(tif,ndir,dir,tag,value));
}
-static int _WriteAsType(TIFF* tif, uint64 strile_size, uint64 uncompressed_threshold)
+static int _WriteAsType(TIFF* tif, uint64_t strile_size, uint64_t uncompressed_threshold)
{
- const uint16 compression = tif->tif_dir.td_compression;
+ const uint16_t compression = tif->tif_dir.td_compression;
if ( compression == COMPRESSION_NONE )
{
return strile_size > uncompressed_threshold;
@@ -1787,12 +1787,12 @@ static int _WriteAsType(TIFF* tif, uint64 strile_size, uint64 uncompressed_thres
return 1;
}
-static int WriteAsLong8(TIFF* tif, uint64 strile_size)
+static int WriteAsLong8(TIFF* tif, uint64_t strile_size)
{
return _WriteAsType(tif, strile_size, 0xFFFFFFFFU);
}
-static int WriteAsLong4(TIFF* tif, uint64 strile_size)
+static int WriteAsLong4(TIFF* tif, uint64_t strile_size)
{
return _WriteAsType(tif, strile_size, 0xFFFFU);
}
@@ -1805,7 +1805,7 @@ static int WriteAsLong4(TIFF* tif, uint64 strile_size)
/************************************************************************/
static int
-TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
static const char module[] = "TIFFWriteDirectoryTagLongLong8Array";
int o;
@@ -1862,10 +1862,10 @@ TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
** and convert to long format.
*/
- uint32* p = _TIFFmalloc(count*sizeof(uint32));
- uint32* q;
- uint64* ma;
- uint32 mb;
+ uint32_t* p = _TIFFmalloc(count * sizeof(uint32_t));
+ uint32_t* q;
+ uint64_t* ma;
+ uint32_t mb;
if (p==NULL)
{
@@ -1882,7 +1882,7 @@ TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
_TIFFfree(p);
return(0);
}
- *q= (uint32)(*ma);
+ *q= (uint32_t)(*ma);
}
o=TIFFWriteDirectoryTagCheckedLongArray(tif,ndir,dir,tag,count,p);
@@ -1890,10 +1890,10 @@ TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
}
else
{
- uint16* p = _TIFFmalloc(count*sizeof(uint16));
- uint16* q;
- uint64* ma;
- uint32 mb;
+ uint16_t* p = _TIFFmalloc(count * sizeof(uint16_t));
+ uint16_t* q;
+ uint64_t* ma;
+ uint32_t mb;
if (p==NULL)
{
@@ -1911,7 +1911,7 @@ TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
_TIFFfree(p);
return(0);
}
- *q= (uint16)(*ma);
+ *q= (uint16_t)(*ma);
}
o=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,tag,count,p);
@@ -1928,13 +1928,13 @@ TIFFWriteDirectoryTagLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
/************************************************************************/
static int
-TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
static const char module[] = "TIFFWriteDirectoryTagIfdIfd8Array";
- uint64* ma;
- uint32 mb;
- uint32* p;
- uint32* q;
+ uint64_t* ma;
+ uint32_t mb;
+ uint32_t* p;
+ uint32_t* q;
int o;
/* is this just a counting pass? */
@@ -1954,7 +1954,7 @@ TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
** and convert to long format.
*/
- p = _TIFFmalloc(count*sizeof(uint32));
+ p = _TIFFmalloc(count*sizeof(uint32_t));
if (p==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -1970,7 +1970,7 @@ TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
_TIFFfree(p);
return(0);
}
- *q= (uint32)(*ma);
+ *q= (uint32_t)(*ma);
}
o=TIFFWriteDirectoryTagCheckedIfdArray(tif,ndir,dir,tag,count,p);
@@ -1981,12 +1981,12 @@ TIFFWriteDirectoryTagIfdIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
#ifdef notdef
static int
-TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
static const char module[] = "TIFFWriteDirectoryTagShortLongLong8Array";
- uint64* ma;
- uint32 mb;
- uint8 n;
+ uint64_t* ma;
+ uint32_t mb;
+ uint8_t n;
int o;
if (dir==NULL)
{
@@ -2006,31 +2006,31 @@ TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
if (n==0)
{
- uint16* p;
- uint16* q;
- p=_TIFFmalloc(count*sizeof(uint16));
+ uint16_t* p;
+ uint16_t* q;
+ p=_TIFFmalloc(count*sizeof(uint16_t));
if (p==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
for (ma=value, mb=0, q=p; mb<count; ma++, mb++, q++)
- *q=(uint16)(*ma);
+ *q=(uint16_t)(*ma);
o=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,tag,count,p);
_TIFFfree(p);
}
else if (n==1)
{
- uint32* p;
- uint32* q;
- p=_TIFFmalloc(count*sizeof(uint32));
+ uint32_t* p;
+ uint32_t* q;
+ p=_TIFFmalloc(count*sizeof(uint32_t));
if (p==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
for (ma=value, mb=0, q=p; mb<count; ma++, mb++, q++)
- *q=(uint32)(*ma);
+ *q=(uint32_t)(*ma);
o=TIFFWriteDirectoryTagCheckedLongArray(tif,ndir,dir,tag,count,p);
_TIFFfree(p);
}
@@ -2043,11 +2043,11 @@ TIFFWriteDirectoryTagShortLongLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
#endif
static int
-TIFFWriteDirectoryTagColormap(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
+TIFFWriteDirectoryTagColormap(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir)
{
static const char module[] = "TIFFWriteDirectoryTagColormap";
- uint32 m;
- uint16* n;
+ uint32_t m;
+ uint16_t* n;
int o;
if (dir==NULL)
{
@@ -2055,27 +2055,27 @@ TIFFWriteDirectoryTagColormap(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
return(1);
}
m=(1<<tif->tif_dir.td_bitspersample);
- n=_TIFFmalloc(3*m*sizeof(uint16));
+ n=_TIFFmalloc(3*m*sizeof(uint16_t));
if (n==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- _TIFFmemcpy(&n[0],tif->tif_dir.td_colormap[0],m*sizeof(uint16));
- _TIFFmemcpy(&n[m],tif->tif_dir.td_colormap[1],m*sizeof(uint16));
- _TIFFmemcpy(&n[2*m],tif->tif_dir.td_colormap[2],m*sizeof(uint16));
+ _TIFFmemcpy(&n[0],tif->tif_dir.td_colormap[0],m*sizeof(uint16_t));
+ _TIFFmemcpy(&n[m],tif->tif_dir.td_colormap[1],m*sizeof(uint16_t));
+ _TIFFmemcpy(&n[2*m],tif->tif_dir.td_colormap[2],m*sizeof(uint16_t));
o=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,TIFFTAG_COLORMAP,3*m,n);
_TIFFfree(n);
return(o);
}
static int
-TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
+TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir)
{
static const char module[] = "TIFFWriteDirectoryTagTransferfunction";
- uint32 m;
- uint16 n;
- uint16* o;
+ uint32_t m;
+ uint16_t n;
+ uint16_t* o;
int p;
if (dir==NULL)
{
@@ -2095,38 +2095,38 @@ TIFFWriteDirectoryTagTransferfunction(TIFF* tif, uint32* ndir, TIFFDirEntry* dir
if (n==3)
{
if (tif->tif_dir.td_transferfunction[2] == NULL ||
- !_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16)))
+ !_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16_t)))
n=2;
}
if (n==2)
{
if (tif->tif_dir.td_transferfunction[1] == NULL ||
- !_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16)))
+ !_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16_t)))
n=1;
}
if (n==0)
n=1;
- o=_TIFFmalloc(n*m*sizeof(uint16));
+ o=_TIFFmalloc(n*m*sizeof(uint16_t));
if (o==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- _TIFFmemcpy(&o[0],tif->tif_dir.td_transferfunction[0],m*sizeof(uint16));
+ _TIFFmemcpy(&o[0],tif->tif_dir.td_transferfunction[0],m*sizeof(uint16_t));
if (n>1)
- _TIFFmemcpy(&o[m],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16));
+ _TIFFmemcpy(&o[m],tif->tif_dir.td_transferfunction[1],m*sizeof(uint16_t));
if (n>2)
- _TIFFmemcpy(&o[2*m],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16));
+ _TIFFmemcpy(&o[2*m],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16_t));
p=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,TIFFTAG_TRANSFERFUNCTION,n*m,o);
_TIFFfree(o);
return(p);
}
static int
-TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
+TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir)
{
static const char module[] = "TIFFWriteDirectoryTagSubifd";
- uint64 m;
+ uint64_t m;
int n;
if (tif->tif_dir.td_nsubifd==0)
return(1);
@@ -2138,11 +2138,11 @@ TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
m=tif->tif_dataoff;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32* o;
- uint64* pa;
- uint32* pb;
- uint16 p;
- o=_TIFFmalloc(tif->tif_dir.td_nsubifd*sizeof(uint32));
+ uint32_t* o;
+ uint64_t* pa;
+ uint32_t* pb;
+ uint16_t p;
+ o=_TIFFmalloc(tif->tif_dir.td_nsubifd*sizeof(uint32_t));
if (o==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -2161,7 +2161,7 @@ TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
_TIFFfree(o);
return(0);
}
- *pb++=(uint32)(*pa++);
+ *pb++=(uint32_t)(*pa++);
}
n=TIFFWriteDirectoryTagCheckedIfdArray(tif,ndir,dir,TIFFTAG_SUBIFD,tif->tif_dir.td_nsubifd,o);
_TIFFfree(o);
@@ -2188,56 +2188,56 @@ TIFFWriteDirectoryTagSubifd(TIFF* tif, uint32* ndir, TIFFDirEntry* dir)
}
static int
-TIFFWriteDirectoryTagCheckedAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value)
+TIFFWriteDirectoryTagCheckedAscii(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, char* value)
{
assert(sizeof(char)==1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_ASCII,count,count,value));
}
static int
-TIFFWriteDirectoryTagCheckedUndefinedArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value)
+TIFFWriteDirectoryTagCheckedUndefinedArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value)
{
- assert(sizeof(uint8)==1);
+ assert(sizeof(uint8_t) == 1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_UNDEFINED,count,count,value));
}
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedByte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint8 value)
+TIFFWriteDirectoryTagCheckedByte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint8_t value)
{
- assert(sizeof(uint8)==1);
+ assert(sizeof(uint8_t)==1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_BYTE,1,1,&value));
}
#endif
static int
-TIFFWriteDirectoryTagCheckedByteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint8* value)
+TIFFWriteDirectoryTagCheckedByteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint8_t* value)
{
- assert(sizeof(uint8)==1);
+ assert(sizeof(uint8_t) == 1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_BYTE,count,count,value));
}
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedSbyte(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int8 value)
+TIFFWriteDirectoryTagCheckedSbyte(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int8_t value)
{
- assert(sizeof(int8)==1);
+ assert(sizeof(int8_t)==1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SBYTE,1,1,&value));
}
#endif
static int
-TIFFWriteDirectoryTagCheckedSbyteArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int8* value)
+TIFFWriteDirectoryTagCheckedSbyteArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int8_t* value)
{
- assert(sizeof(int8)==1);
+ assert(sizeof(int8_t) == 1);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SBYTE,count,count,value));
}
static int
-TIFFWriteDirectoryTagCheckedShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 value)
+TIFFWriteDirectoryTagCheckedShort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t value)
{
- uint16 m;
- assert(sizeof(uint16)==2);
+ uint16_t m;
+ assert(sizeof(uint16_t) == 2);
m=value;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort(&m);
@@ -2245,10 +2245,10 @@ TIFFWriteDirectoryTagCheckedShort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
}
static int
-TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value)
+TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint16_t* value)
{
assert(count<0x80000000);
- assert(sizeof(uint16)==2);
+ assert(sizeof(uint16_t) == 2);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfShort(value,count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SHORT,count,count*2,value));
@@ -2256,32 +2256,32 @@ TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedSshort(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int16 value)
+TIFFWriteDirectoryTagCheckedSshort(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int16_t value)
{
- int16 m;
- assert(sizeof(int16)==2);
+ int16_t m;
+ assert(sizeof(int16_t)==2);
m=value;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort((uint16*)(&m));
+ TIFFSwabShort((uint16_t*)(&m));
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SSHORT,1,2,&m));
}
#endif
static int
-TIFFWriteDirectoryTagCheckedSshortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int16* value)
+TIFFWriteDirectoryTagCheckedSshortArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int16_t* value)
{
assert(count<0x80000000);
- assert(sizeof(int16)==2);
+ assert(sizeof(int16_t) == 2);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfShort((uint16*)value,count);
+ TIFFSwabArrayOfShort((uint16_t*)value, count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SSHORT,count,count*2,value));
}
static int
-TIFFWriteDirectoryTagCheckedLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 value)
+TIFFWriteDirectoryTagCheckedLong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t value)
{
- uint32 m;
- assert(sizeof(uint32)==4);
+ uint32_t m;
+ assert(sizeof(uint32_t) == 4);
m=value;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&m);
@@ -2289,10 +2289,10 @@ TIFFWriteDirectoryTagCheckedLong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uin
}
static int
-TIFFWriteDirectoryTagCheckedLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value)
+TIFFWriteDirectoryTagCheckedLongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value)
{
assert(count<0x40000000);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint32_t) == 4);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong(value,count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_LONG,count,count*4,value));
@@ -2300,33 +2300,33 @@ TIFFWriteDirectoryTagCheckedLongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedSlong(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int32 value)
+TIFFWriteDirectoryTagCheckedSlong(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int32_t value)
{
- int32 m;
- assert(sizeof(int32)==4);
+ int32_t m;
+ assert(sizeof(int32_t)==4);
m=value;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong((uint32*)(&m));
+ TIFFSwabLong((uint32_t*)(&m));
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG,1,4,&m));
}
#endif
static int
-TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int32* value)
+TIFFWriteDirectoryTagCheckedSlongArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int32_t* value)
{
assert(count<0x40000000);
- assert(sizeof(int32)==4);
+ assert(sizeof(int32_t) == 4);
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)value,count);
+ TIFFSwabArrayOfLong((uint32_t*)value, count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG,count,count*4,value));
}
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint64 value)
+TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint64_t value)
{
- uint64 m;
- assert(sizeof(uint64)==8);
+ uint64_t m;
+ assert(sizeof(uint64_t)==8);
if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8","LONG8 not allowed for ClassicTIFF");
return(0);
@@ -2339,10 +2339,10 @@ TIFFWriteDirectoryTagCheckedLong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
#endif
static int
-TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
assert(count<0x20000000);
- assert(sizeof(uint64)==8);
+ assert(sizeof(uint64_t) == 8);
if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedLong8Array","LONG8 not allowed for ClassicTIFF");
return(0);
@@ -2354,41 +2354,41 @@ TIFFWriteDirectoryTagCheckedLong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* di
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, int64 value)
+TIFFWriteDirectoryTagCheckedSlong8(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, int64_t value)
{
- int64 m;
- assert(sizeof(int64)==8);
+ int64_t m;
+ assert(sizeof(int64_t)==8);
if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedSlong8","SLONG8 not allowed for ClassicTIFF");
return(0);
}
m=value;
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8((uint64*)(&m));
+ TIFFSwabLong8((uint64_t*)(&m));
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG8,1,8,&m));
}
#endif
static int
-TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, int64* value)
+TIFFWriteDirectoryTagCheckedSlong8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, int64_t* value)
{
assert(count<0x20000000);
- assert(sizeof(int64)==8);
+ assert(sizeof(int64_t) == 8);
if( !(tif->tif_flags&TIFF_BIGTIFF) ) {
TIFFErrorExt(tif->tif_clientdata,"TIFFWriteDirectoryTagCheckedSlong8Array","SLONG8 not allowed for ClassicTIFF");
return(0);
}
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong8((uint64*)value,count);
+ TIFFSwabArrayOfLong8((uint64_t*)value, count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SLONG8,count,count*8,value));
}
static int
-TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
static const char module[] = "TIFFWriteDirectoryTagCheckedRational";
- uint32 m[2];
- assert(sizeof(uint32)==4);
+ uint32_t m[2];
+ assert(sizeof(uint32_t) == 4);
if (value < 0)
{
TIFFErrorExt(tif->tif_clientdata, module, "Negative value is illegal");
@@ -2405,20 +2405,20 @@ TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
m[0]=0;
m[1]=1;
}
- else if (value <= 0xFFFFFFFFU && value==(double)(uint32)value)
+ else if (value <= 0xFFFFFFFFU && value==(double)(uint32_t)value)
{
- m[0]=(uint32)value;
+ m[0]=(uint32_t)value;
m[1]=1;
}
else if (value<1.0)
{
- m[0]=(uint32)(value*0xFFFFFFFF);
+ m[0]=(uint32_t)(value*0xFFFFFFFF);
m[1]=0xFFFFFFFF;
}
else
{
m[0]=0xFFFFFFFF;
- m[1]=(uint32)(0xFFFFFFFF/value);
+ m[1]=(uint32_t)(0xFFFFFFFF/value);
}
#else
/*--Rational2Double: New function also used for non-custom rational tags.
@@ -2438,16 +2438,16 @@ TIFFWriteDirectoryTagCheckedRational(TIFF* tif, uint32* ndir, TIFFDirEntry* dir,
}
static int
-TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
static const char module[] = "TIFFWriteDirectoryTagCheckedRationalArray";
- uint32* m;
+ uint32_t* m;
float* na;
- uint32* nb;
- uint32 nc;
+ uint32_t* nb;
+ uint32_t nc;
int o;
- assert(sizeof(uint32)==4);
- m=_TIFFmalloc(count*2*sizeof(uint32));
+ assert(sizeof(uint32_t) == 4);
+ m=_TIFFmalloc(count*2*sizeof(uint32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -2462,20 +2462,20 @@ TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry*
nb[1]=1;
}
else if (*na >= 0 && *na <= (float)0xFFFFFFFFU &&
- *na==(float)(uint32)(*na))
+ *na==(float)(uint32_t)(*na))
{
- nb[0]=(uint32)(*na);
+ nb[0]=(uint32_t)(*na);
nb[1]=1;
}
else if (*na<1.0)
{
- nb[0]=(uint32)((double)(*na)*0xFFFFFFFF);
+ nb[0]=(uint32_t)((double)(*na)*0xFFFFFFFF);
nb[1]=0xFFFFFFFF;
}
else
{
nb[0]=0xFFFFFFFF;
- nb[1]=(uint32)((double)0xFFFFFFFF/(*na));
+ nb[1]=(uint32_t)((double)0xFFFFFFFF/(*na));
}
#else
/*-- Rational2Double: Also for float precision accuracy is sometimes enhanced --*/
@@ -2490,16 +2490,16 @@ TIFFWriteDirectoryTagCheckedRationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry*
}
static int
-TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
static const char module[] = "TIFFWriteDirectoryTagCheckedSrationalArray";
- int32* m;
+ int32_t* m;
float* na;
- int32* nb;
- uint32 nc;
+ int32_t* nb;
+ uint32_t nc;
int o;
- assert(sizeof(int32)==4);
- m=_TIFFmalloc(count*2*sizeof(int32));
+ assert(sizeof(int32_t) == 4);
+ m=_TIFFmalloc(count*2*sizeof(int32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -2510,38 +2510,38 @@ TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry
#ifdef not_def
if (*na<0.0)
{
- if (*na==(int32)(*na))
+ if (*na==(int32_t)(*na))
{
- nb[0]=(int32)(*na);
+ nb[0]=(int32_t)(*na);
nb[1]=1;
}
else if (*na>-1.0)
{
- nb[0]=-(int32)((double)(-*na)*0x7FFFFFFF);
+ nb[0]=-(int32_t)((double)(-*na)*0x7FFFFFFF);
nb[1]=0x7FFFFFFF;
}
else
{
nb[0]=-0x7FFFFFFF;
- nb[1]=(int32)((double)0x7FFFFFFF/(-*na));
+ nb[1]=(int32_t)((double)0x7FFFFFFF/(-*na));
}
}
else
{
- if (*na==(int32)(*na))
+ if (*na==(int32_t)(*na))
{
- nb[0]=(int32)(*na);
+ nb[0]=(int32_t)(*na);
nb[1]=1;
}
else if (*na<1.0)
{
- nb[0]=(int32)((double)(*na)*0x7FFFFFFF);
+ nb[0]=(int32_t)((double)(*na)*0x7FFFFFFF);
nb[1]=0x7FFFFFFF;
}
else
{
nb[0]=0x7FFFFFFF;
- nb[1]=(int32)((double)0x7FFFFFFF/(*na));
+ nb[1]=(int32_t)((double)0x7FFFFFFF/(*na));
}
}
#else
@@ -2550,7 +2550,7 @@ TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry
#endif
}
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)m,count*2);
+ TIFFSwabArrayOfLong((uint32_t*)m, count * 2);
o=TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SRATIONAL,count,count*8,&m[0]);
_TIFFfree(m);
return(o);
@@ -2558,16 +2558,16 @@ TIFFWriteDirectoryTagCheckedSrationalArray(TIFF* tif, uint32* ndir, TIFFDirEntry
/*-- Rational2Double: additional write functions for double arrays */
static int
-TIFFWriteDirectoryTagCheckedRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagCheckedRationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
static const char module[] = "TIFFWriteDirectoryTagCheckedRationalDoubleArray";
- uint32* m;
+ uint32_t* m;
double* na;
- uint32* nb;
- uint32 nc;
+ uint32_t* nb;
+ uint32_t nc;
int o;
- assert(sizeof(uint32)==4);
- m=_TIFFmalloc(count*2*sizeof(uint32));
+ assert(sizeof(uint32_t) == 4);
+ m=_TIFFmalloc(count*2*sizeof(uint32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -2585,16 +2585,16 @@ TIFFWriteDirectoryTagCheckedRationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDir
} /*-- TIFFWriteDirectoryTagCheckedRationalDoubleArray() ------- */
static int
-TIFFWriteDirectoryTagCheckedSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagCheckedSrationalDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
static const char module[] = "TIFFWriteDirectoryTagCheckedSrationalDoubleArray";
- int32* m;
+ int32_t* m;
double* na;
- int32* nb;
- uint32 nc;
+ int32_t* nb;
+ uint32_t nc;
int o;
- assert(sizeof(int32)==4);
- m=_TIFFmalloc(count*2*sizeof(int32));
+ assert(sizeof(int32_t) == 4);
+ m=_TIFFmalloc(count*2*sizeof(int32_t));
if (m==NULL)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
@@ -2605,7 +2605,7 @@ TIFFWriteDirectoryTagCheckedSrationalDoubleArray(TIFF* tif, uint32* ndir, TIFFDi
DoubleToSrational(*na, &nb[0], &nb[1]);
}
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabArrayOfLong((uint32*)m,count*2);
+ TIFFSwabArrayOfLong((uint32_t*)m, count * 2);
o=TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SRATIONAL,count,count*8,&m[0]);
_TIFFfree(m);
return(o);
@@ -2626,20 +2626,20 @@ void DoubleToRational_direct(double value, unsigned long *num, unsigned long *de
*num=0;
*denom=1;
}
- else if (value <= 0xFFFFFFFFU && (value==(double)(uint32)(value))) /* check for integer values */
+ else if (value <= 0xFFFFFFFFU && (value==(double)(uint32_t)(value))) /* check for integer values */
{
- *num=(uint32)(value);
+ *num=(uint32_t)(value);
*denom=1;
}
else if (value<1.0)
{
- *num = (uint32)((value) * (double)0xFFFFFFFFU);
+ *num = (uint32_t)((value) * (double)0xFFFFFFFFU);
*denom=0xFFFFFFFFU;
}
else
{
*num=0xFFFFFFFFU;
- *denom=(uint32)((double)0xFFFFFFFFU/(value));
+ *denom=(uint32_t)((double)0xFFFFFFFFU/(value));
}
} /*-- DoubleToRational_direct() -------------- */
#endif
@@ -2656,38 +2656,38 @@ void DoubleToSrational_direct(double value, long *num, long *denom)
*/
if (value<0.0)
{
- if (value==(int32)(value))
+ if (value==(int32_t)(value))
{
- *num=(int32)(value);
+ *num=(int32_t)(value);
*denom=1;
}
else if (value>-1.0)
{
- *num=-(int32)((-value) * (double)0x7FFFFFFF);
+ *num=-(int32_t)((-value) * (double)0x7FFFFFFF);
*denom=0x7FFFFFFF;
}
else
{
*num=-0x7FFFFFFF;
- *denom=(int32)((double)0x7FFFFFFF / (-value));
+ *denom=(int32_t)((double)0x7FFFFFFF / (-value));
}
}
else
{
- if (value==(int32)(value))
+ if (value==(int32_t)(value))
{
- *num=(int32)(value);
+ *num=(int32_t)(value);
*denom=1;
}
else if (value<1.0)
{
- *num=(int32)((value) *(double)0x7FFFFFFF);
+ *num=(int32_t)((value) *(double)0x7FFFFFFF);
*denom=0x7FFFFFFF;
}
else
{
*num=0x7FFFFFFF;
- *denom=(int32)((double)0x7FFFFFFF / (value));
+ *denom=(int32_t)((double)0x7FFFFFFF / (value));
}
}
} /*-- DoubleToSrational_direct() --------------*/
@@ -2750,11 +2750,11 @@ void ToRationalEuclideanGCD(double value, int blnUseSignedRange, int blnUseSmall
}
/*-- First generate a rational fraction (bigNum/bigDenom) which represents the value
- * as a rational number with the highest accuracy. Therefore, unsigned long long (uint64) is needed.
+ * as a rational number with the highest accuracy. Therefore, unsigned long long (uint64_t) is needed.
* This rational fraction is then reduced using the Euclidean algorithm to find the greatest common divisor (GCD).
* bigNum = big numinator of value without fraction (or cut residual fraction)
* bigDenom = big denominator of value
- *-- Break-criteria so that uint64 cast to "bigNum" introduces no error and bigDenom has no overflow,
+ *-- Break-criteria so that uint64_t cast to "bigNum" introduces no error and bigDenom has no overflow,
* and stop with enlargement of fraction when the double-value of it reaches an integer number without fractional part.
*/
bigDenom = 1;
@@ -2819,7 +2819,7 @@ void ToRationalEuclideanGCD(double value, int blnUseSignedRange, int blnUseSmall
* using the Euclidean algorithm to find the greatest common divisor (GCD)
------------------------------------------------------------------------*/
static
-void DoubleToRational(double value, uint32 *num, uint32 *denom)
+void DoubleToRational(double value, uint32_t *num, uint32_t *denom)
{
/*---- UN-SIGNED RATIONAL ---- */
double dblDiff, dblDiff2;
@@ -2840,8 +2840,8 @@ void DoubleToRational(double value, uint32 *num, uint32 *denom)
return;
}
/*-- Check for easy integer numbers -- */
- if (value == (uint32)(value)) {
- *num = (uint32)value;
+ if (value == (uint32_t)(value)) {
+ *num = (uint32_t)value;
*denom = 1;
return;
}
@@ -2872,12 +2872,12 @@ void DoubleToRational(double value, uint32 *num, uint32 *denom)
dblDiff = fabs(value - ((double)ullNum / (double)ullDenom));
dblDiff2 = fabs(value - ((double)ullNum2 / (double)ullDenom2));
if (dblDiff < dblDiff2) {
- *num = (uint32)ullNum;
- *denom = (uint32)ullDenom;
+ *num = (uint32_t)ullNum;
+ *denom = (uint32_t)ullDenom;
}
else {
- *num = (uint32)ullNum2;
- *denom = (uint32)ullDenom2;
+ *num = (uint32_t)ullNum2;
+ *denom = (uint32_t)ullDenom2;
}
} /*-- DoubleToRational() -------------- */
@@ -2887,7 +2887,7 @@ void DoubleToRational(double value, uint32 *num, uint32 *denom)
* using the Euclidean algorithm to find the greatest common divisor (GCD)
------------------------------------------------------------------------*/
static
-void DoubleToSrational(double value, int32 *num, int32 *denom)
+void DoubleToSrational(double value, int32_t *num, int32_t *denom)
{
/*---- SIGNED RATIONAL ----*/
int neg = 1;
@@ -2904,8 +2904,8 @@ void DoubleToSrational(double value, int32 *num, int32 *denom)
return;
}
/*-- Check for easy numbers -- */
- if (value == (int32)(value)) {
- *num = (int32)(neg * value);
+ if (value == (int32_t)(value)) {
+ *num = (int32_t)(neg * value);
*denom = 1;
return;
}
@@ -2937,12 +2937,12 @@ void DoubleToSrational(double value, int32 *num, int32 *denom)
dblDiff = fabs(value - ((double)ullNum / (double)ullDenom));
dblDiff2 = fabs(value - ((double)ullNum2 / (double)ullDenom2));
if (dblDiff < dblDiff2) {
- *num = (int32)(neg * (long)ullNum);
- *denom = (int32)ullDenom;
+ *num = (int32_t)(neg * (long)ullNum);
+ *denom = (int32_t)ullDenom;
}
else {
- *num = (int32)(neg * (long)ullNum2);
- *denom = (int32)ullDenom2;
+ *num = (int32_t)(neg * (long)ullNum2);
+ *denom = (int32_t)ullDenom2;
}
} /*-- DoubleToSrational() --------------*/
@@ -2952,7 +2952,7 @@ void DoubleToSrational(double value, int32 *num, int32 *denom)
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, float value)
+TIFFWriteDirectoryTagCheckedFloat(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, float value)
{
float m;
assert(sizeof(float)==4);
@@ -2965,7 +2965,7 @@ TIFFWriteDirectoryTagCheckedFloat(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, ui
#endif
static int
-TIFFWriteDirectoryTagCheckedFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, float* value)
+TIFFWriteDirectoryTagCheckedFloatArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, float* value)
{
assert(count<0x40000000);
assert(sizeof(float)==4);
@@ -2977,7 +2977,7 @@ TIFFWriteDirectoryTagCheckedFloatArray(TIFF* tif, uint32* ndir, TIFFDirEntry* di
#ifdef notdef
static int
-TIFFWriteDirectoryTagCheckedDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value)
+TIFFWriteDirectoryTagCheckedDouble(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, double value)
{
double m;
assert(sizeof(double)==8);
@@ -2990,7 +2990,7 @@ TIFFWriteDirectoryTagCheckedDouble(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, u
#endif
static int
-TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value)
+TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, double* value)
{
assert(count<0x20000000);
assert(sizeof(double)==8);
@@ -3001,20 +3001,20 @@ TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* d
}
static int
-TIFFWriteDirectoryTagCheckedIfdArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint32* value)
+TIFFWriteDirectoryTagCheckedIfdArray(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint32_t* value)
{
assert(count<0x40000000);
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint32_t) == 4);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong(value,count);
return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_IFD,count,count*4,value));
}
static int
-TIFFWriteDirectoryTagCheckedIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint64* value)
+TIFFWriteDirectoryTagCheckedIfd8Array(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint32_t count, uint64_t* value)
{
assert(count<0x20000000);
- assert(sizeof(uint64)==8);
+ assert(sizeof(uint64_t) == 8);
assert(tif->tif_flags&TIFF_BIGTIFF);
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabArrayOfLong8(value,count);
@@ -3022,10 +3022,10 @@ TIFFWriteDirectoryTagCheckedIfd8Array(TIFF* tif, uint32* ndir, TIFFDirEntry* dir
}
static int
-TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data)
+TIFFWriteDirectoryTagData(TIFF* tif, uint32_t* ndir, TIFFDirEntry* dir, uint16_t tag, uint16_t datatype, uint32_t count, uint32_t datalength, void* data)
{
static const char module[] = "TIFFWriteDirectoryTagData";
- uint32 m;
+ uint32_t m;
m=0;
while (m<(*ndir))
{
@@ -3036,7 +3036,7 @@ TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag
}
if (m<(*ndir))
{
- uint32 n;
+ uint32_t n;
for (n=*ndir; n>m; n--)
dir[n]=dir[n-1];
}
@@ -3053,11 +3053,11 @@ TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag
}
else
{
- uint64 na,nb;
+ uint64_t na,nb;
na=tif->tif_dataoff;
nb=na+datalength;
if (!(tif->tif_flags&TIFF_BIGTIFF))
- nb=(uint32)nb;
+ nb=(uint32_t)nb;
if ((nb<na)||(nb<datalength))
{
TIFFErrorExt(tif->tif_clientdata,module,"Maximum TIFF file size exceeded");
@@ -3079,8 +3079,8 @@ TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag
tif->tif_dataoff++;
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 o;
- o=(uint32)na;
+ uint32_t o;
+ o=(uint32_t)na;
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong(&o);
_TIFFmemcpy(&dir[m].tdir_offset,&o,4);
@@ -3113,8 +3113,8 @@ TIFFLinkDirectory(TIFF* tif)
{
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 m;
- m = (uint32)tif->tif_diroff;
+ uint32_t m;
+ m = (uint32_t)tif->tif_diroff;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&m);
(void) TIFFSeekFile(tif, tif->tif_subifdoff, SEEK_SET);
@@ -3136,7 +3136,7 @@ TIFFLinkDirectory(TIFF* tif)
}
else
{
- uint64 m;
+ uint64_t m;
m = tif->tif_diroff;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong8(&m);
@@ -3161,16 +3161,16 @@ TIFFLinkDirectory(TIFF* tif)
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 m;
- uint32 nextdir;
- m = (uint32)(tif->tif_diroff);
+ uint32_t m;
+ uint32_t nextdir;
+ m = (uint32_t)(tif->tif_diroff);
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong(&m);
if (tif->tif_header.classic.tiff_diroff == 0) {
/*
* First directory, overwrite offset in header.
*/
- tif->tif_header.classic.tiff_diroff = (uint32) tif->tif_diroff;
+ tif->tif_header.classic.tiff_diroff = (uint32_t) tif->tif_diroff;
(void) TIFFSeekFile(tif,4, SEEK_SET);
if (!WriteOK(tif, &m, 4)) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
@@ -3184,8 +3184,8 @@ TIFFLinkDirectory(TIFF* tif)
*/
nextdir = tif->tif_header.classic.tiff_diroff;
while(1) {
- uint16 dircount;
- uint32 nextnextdir;
+ uint16_t dircount;
+ uint32_t nextnextdir;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount, 2)) {
@@ -3220,8 +3220,8 @@ TIFFLinkDirectory(TIFF* tif)
}
else
{
- uint64 m;
- uint64 nextdir;
+ uint64_t m;
+ uint64_t nextdir;
m = tif->tif_diroff;
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong8(&m);
@@ -3243,9 +3243,9 @@ TIFFLinkDirectory(TIFF* tif)
*/
nextdir = tif->tif_header.big.tiff_diroff;
while(1) {
- uint64 dircount64;
- uint16 dircount;
- uint64 nextnextdir;
+ uint64_t dircount64;
+ uint16_t dircount;
+ uint64_t nextnextdir;
if (!SeekOK(tif, nextdir) ||
!ReadOK(tif, &dircount64, 8)) {
@@ -3261,7 +3261,7 @@ TIFFLinkDirectory(TIFF* tif)
"Sanity check on tag count failed, likely corrupt TIFF");
return (0);
}
- dircount=(uint16)dircount64;
+ dircount=(uint16_t)dircount64;
(void) TIFFSeekFile(tif,
nextdir+8+dircount*20, SEEK_SET);
if (!ReadOK(tif, &nextnextdir, 8)) {
@@ -3302,21 +3302,21 @@ TIFFLinkDirectory(TIFF* tif)
/************************************************************************/
int
-_TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
+_TIFFRewriteField(TIFF* tif, uint16_t tag, TIFFDataType in_datatype,
tmsize_t count, void* data)
{
static const char module[] = "TIFFResetField";
/* const TIFFField* fip = NULL; */
- uint16 dircount;
+ uint16_t dircount;
tmsize_t dirsize;
- uint8 direntry_raw[20];
- uint16 entry_tag = 0;
- uint16 entry_type = 0;
- uint64 entry_count = 0;
- uint64 entry_offset = 0;
+ uint8_t direntry_raw[20];
+ uint16_t entry_tag = 0;
+ uint16_t entry_type = 0;
+ uint64_t entry_count = 0;
+ uint64_t entry_offset = 0;
int value_in_entry = 0;
- uint64 read_offset;
- uint8 *buf_to_write = NULL;
+ uint64_t read_offset;
+ uint8_t *buf_to_write = NULL;
TIFFDataType datatype;
/* -------------------------------------------------------------------- */
@@ -3355,7 +3355,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- if (!ReadOK(tif, &dircount, sizeof (uint16))) {
+ if (!ReadOK(tif, &dircount, sizeof (uint16_t))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Can not read TIFF directory count",
tif->tif_name);
@@ -3366,8 +3366,8 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
dirsize = 12;
read_offset += 2;
} else {
- uint64 dircount64;
- if (!ReadOK(tif, &dircount64, sizeof (uint64))) {
+ uint64_t dircount64;
+ if (!ReadOK(tif, &dircount64, sizeof (uint64_t))) {
TIFFErrorExt(tif->tif_clientdata, module,
"%s: Can not read TIFF directory count",
tif->tif_name);
@@ -3375,7 +3375,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
}
if (tif->tif_flags & TIFF_SWAB)
TIFFSwabLong8(&dircount64);
- dircount = (uint16)dircount64;
+ dircount = (uint16_t)dircount64;
dirsize = 20;
read_offset += 8;
}
@@ -3392,7 +3392,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
return 0;
}
- memcpy( &entry_tag, direntry_raw + 0, sizeof(uint16) );
+ memcpy( &entry_tag, direntry_raw + 0, sizeof(uint16_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort( &entry_tag );
@@ -3413,31 +3413,31 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
/* -------------------------------------------------------------------- */
/* Extract the type, count and offset for this entry. */
/* -------------------------------------------------------------------- */
- memcpy( &entry_type, direntry_raw + 2, sizeof(uint16) );
+ memcpy( &entry_type, direntry_raw + 2, sizeof(uint16_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabShort( &entry_type );
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 value;
+ uint32_t value;
- memcpy( &value, direntry_raw + 4, sizeof(uint32) );
+ memcpy( &value, direntry_raw + 4, sizeof(uint32_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong( &value );
entry_count = value;
- memcpy( &value, direntry_raw + 8, sizeof(uint32) );
+ memcpy( &value, direntry_raw + 8, sizeof(uint32_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong( &value );
entry_offset = value;
}
else
{
- memcpy( &entry_count, direntry_raw + 4, sizeof(uint64) );
+ memcpy( &entry_count, direntry_raw + 4, sizeof(uint64_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8( &entry_count );
- memcpy( &entry_offset, direntry_raw + 12, sizeof(uint64) );
+ memcpy( &entry_offset, direntry_raw + 12, sizeof(uint64_t) );
if (tif->tif_flags&TIFF_SWAB)
TIFFSwabLong8( &entry_offset );
}
@@ -3524,8 +3524,8 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
/* swabbing as needed. */
/* -------------------------------------------------------------------- */
buf_to_write =
- (uint8 *)_TIFFCheckMalloc(tif, count, TIFFDataWidth(datatype),
- "for field buffer.");
+ (uint8_t *)_TIFFCheckMalloc(tif, count, TIFFDataWidth(datatype),
+ "for field buffer.");
if (!buf_to_write)
return 0;
@@ -3537,9 +3537,9 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
for( i = 0; i < count; i++ )
{
- ((int32 *) buf_to_write)[i] =
- (int32) ((int64 *) data)[i];
- if( (int64) ((int32 *) buf_to_write)[i] != ((int64 *) data)[i] )
+ ((int32_t *) buf_to_write)[i] =
+ (int32_t) ((int64_t *) data)[i];
+ if((int64_t) ((int32_t *) buf_to_write)[i] != ((int64_t *) data)[i] )
{
_TIFFfree( buf_to_write );
TIFFErrorExt( tif->tif_clientdata, module,
@@ -3555,9 +3555,9 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
for( i = 0; i < count; i++ )
{
- ((uint32 *) buf_to_write)[i] =
- (uint32) ((uint64 *) data)[i];
- if( (uint64) ((uint32 *) buf_to_write)[i] != ((uint64 *) data)[i] )
+ ((uint32_t *) buf_to_write)[i] =
+ (uint32_t) ((uint64_t *) data)[i];
+ if((uint64_t) ((uint32_t *) buf_to_write)[i] != ((uint64_t *) data)[i] )
{
_TIFFfree( buf_to_write );
TIFFErrorExt( tif->tif_clientdata, module,
@@ -3572,9 +3572,9 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
for( i = 0; i < count; i++ )
{
- ((uint16 *) buf_to_write)[i] =
- (uint16) ((uint64 *) data)[i];
- if( (uint64) ((uint16 *) buf_to_write)[i] != ((uint64 *) data)[i] )
+ ((uint16_t *) buf_to_write)[i] =
+ (uint16_t) ((uint64_t *) data)[i];
+ if((uint64_t) ((uint16_t *) buf_to_write)[i] != ((uint64_t *) data)[i] )
{
_TIFFfree( buf_to_write );
TIFFErrorExt( tif->tif_clientdata, module,
@@ -3593,11 +3593,11 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
if( TIFFDataWidth(datatype) > 1 && (tif->tif_flags&TIFF_SWAB) )
{
if( TIFFDataWidth(datatype) == 2 )
- TIFFSwabArrayOfShort( (uint16 *) buf_to_write, count );
+ TIFFSwabArrayOfShort((uint16_t *) buf_to_write, count );
else if( TIFFDataWidth(datatype) == 4 )
- TIFFSwabArrayOfLong( (uint32 *) buf_to_write, count );
+ TIFFSwabArrayOfLong((uint32_t *) buf_to_write, count );
else if( TIFFDataWidth(datatype) == 8 )
- TIFFSwabArrayOfLong8( (uint64 *) buf_to_write, count );
+ TIFFSwabArrayOfLong8((uint64_t *) buf_to_write, count );
}
/* -------------------------------------------------------------------- */
@@ -3642,7 +3642,7 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
/* over the old values without altering the directory entry at */
/* all. */
/* -------------------------------------------------------------------- */
- if( entry_count == (uint64)count && entry_type == (uint16) datatype )
+ if( entry_count == (uint64_t)count && entry_type == (uint16_t) datatype )
{
if (!SeekOK(tif, entry_offset)) {
_TIFFfree( buf_to_write );
@@ -3688,34 +3688,34 @@ _TIFFRewriteField(TIFF* tif, uint16 tag, TIFFDataType in_datatype,
/* Adjust the directory entry. */
/* -------------------------------------------------------------------- */
entry_type = datatype;
- entry_count = (uint64)count;
- memcpy( direntry_raw + 2, &entry_type, sizeof(uint16) );
+ entry_count = (uint64_t)count;
+ memcpy( direntry_raw + 2, &entry_type, sizeof(uint16_t) );
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabShort( (uint16 *) (direntry_raw + 2) );
+ TIFFSwabShort( (uint16_t *) (direntry_raw + 2) );
if (!(tif->tif_flags&TIFF_BIGTIFF))
{
- uint32 value;
+ uint32_t value;
- value = (uint32) entry_count;
- memcpy( direntry_raw + 4, &value, sizeof(uint32) );
+ value = (uint32_t) entry_count;
+ memcpy( direntry_raw + 4, &value, sizeof(uint32_t) );
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong( (uint32 *) (direntry_raw + 4) );
+ TIFFSwabLong( (uint32_t *) (direntry_raw + 4) );
- value = (uint32) entry_offset;
- memcpy( direntry_raw + 8, &value, sizeof(uint32) );
+ value = (uint32_t) entry_offset;
+ memcpy( direntry_raw + 8, &value, sizeof(uint32_t) );
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong( (uint32 *) (direntry_raw + 8) );
+ TIFFSwabLong( (uint32_t *) (direntry_raw + 8) );
}
else
{
- memcpy( direntry_raw + 4, &entry_count, sizeof(uint64) );
+ memcpy( direntry_raw + 4, &entry_count, sizeof(uint64_t) );
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8( (uint64 *) (direntry_raw + 4) );
+ TIFFSwabLong8( (uint64_t *) (direntry_raw + 4) );
- memcpy( direntry_raw + 12, &entry_offset, sizeof(uint64) );
+ memcpy( direntry_raw + 12, &entry_offset, sizeof(uint64_t) );
if (tif->tif_flags&TIFF_SWAB)
- TIFFSwabLong8( (uint64 *) (direntry_raw + 12) );
+ TIFFSwabLong8( (uint64_t *) (direntry_raw + 12) );
}
/* -------------------------------------------------------------------- */
diff --git a/libtiff/tif_dumpmode.c b/libtiff/tif_dumpmode.c
index 4a0b07f5..d739d8d1 100644
--- a/libtiff/tif_dumpmode.c
+++ b/libtiff/tif_dumpmode.c
@@ -40,7 +40,7 @@ DumpFixupTags(TIFF* tif)
* Encode a hunk of pixels.
*/
static int
-DumpModeEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
+DumpModeEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s)
{
(void) s;
while (cc > 0) {
@@ -73,7 +73,7 @@ DumpModeEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s)
* Decode a hunk of pixels.
*/
static int
-DumpModeDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+DumpModeDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
static const char module[] = "DumpModeDecode";
(void) s;
@@ -108,7 +108,7 @@ DumpModeDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
* Seek forwards nrows in the current strip.
*/
static int
-DumpModeSeek(TIFF* tif, uint32 nrows)
+DumpModeSeek(TIFF* tif, uint32_t nrows)
{
tif->tif_rawcp += nrows * tif->tif_scanlinesize;
tif->tif_rawcc -= nrows * tif->tif_scanlinesize;
diff --git a/libtiff/tif_extension.c b/libtiff/tif_extension.c
index 87d3cfcb..9d46d3ea 100644
--- a/libtiff/tif_extension.c
+++ b/libtiff/tif_extension.c
@@ -39,13 +39,13 @@ int TIFFGetTagListCount( TIFF *tif )
return td->td_customValueCount;
}
-uint32 TIFFGetTagListEntry( TIFF *tif, int tag_index )
+uint32_t TIFFGetTagListEntry(TIFF *tif, int tag_index )
{
TIFFDirectory* td = &tif->tif_dir;
if( tag_index < 0 || tag_index >= td->td_customValueCount )
- return (uint32)(-1);
+ return (uint32_t)(-1);
else
return td->td_customValues[tag_index].info->field_tag;
}
diff --git a/libtiff/tif_fax3.c b/libtiff/tif_fax3.c
index 9ab5b26a..cce477cb 100644
--- a/libtiff/tif_fax3.c
+++ b/libtiff/tif_fax3.c
@@ -49,12 +49,12 @@ typedef struct {
int rw_mode; /* O_RDONLY for decode, else encode */
int mode; /* operating mode */
tmsize_t rowbytes; /* bytes in a decoded scanline */
- uint32 rowpixels; /* pixels in a scanline */
+ uint32_t rowpixels; /* pixels in a scanline */
- uint16 cleanfaxdata; /* CleanFaxData tag */
- uint32 badfaxrun; /* BadFaxRun tag */
- uint32 badfaxlines; /* BadFaxLines tag */
- uint32 groupoptions; /* Group 3/4 options tag */
+ uint16_t cleanfaxdata; /* CleanFaxData tag */
+ uint32_t badfaxrun; /* BadFaxRun tag */
+ uint32_t badfaxlines; /* BadFaxLines tag */
+ uint32_t groupoptions; /* Group 3/4 options tag */
TIFFVGetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
@@ -68,14 +68,14 @@ typedef struct {
/* Decoder state info */
const unsigned char* bitmap; /* bit reversal table */
- uint32 data; /* current i/o byte/word */
+ uint32_t data; /* current i/o byte/word */
int bit; /* current i/o bit in byte */
int EOLcnt; /* count of EOL codes recognized */
TIFFFaxFillFunc fill; /* fill routine */
- uint32* runs; /* b&w runs for current/previous row */
- uint32 nruns; /* size of the refruns / curruns arrays */
- uint32* refruns; /* runs for reference line */
- uint32* curruns; /* runs for current line */
+ uint32_t* runs; /* b&w runs for current/previous row */
+ uint32_t nruns; /* size of the refruns / curruns arrays */
+ uint32_t* refruns; /* runs for reference line */
+ uint32_t* curruns; /* runs for current line */
/* Encoder state info */
Ttag tag; /* encoding state */
@@ -104,20 +104,20 @@ typedef struct {
Fax3CodecState* sp = DecoderState(tif); \
int a0; /* reference element */ \
int lastx = sp->b.rowpixels; /* last element in row */ \
- uint32 BitAcc; /* bit accumulator */ \
+ uint32_t BitAcc; /* bit accumulator */ \
int BitsAvail; /* # valid bits in BitAcc */ \
int RunLength; /* length of current run */ \
unsigned char* cp; /* next byte of input data */ \
unsigned char* ep; /* end of input data */ \
- uint32* pa; /* place to stuff next run */ \
- uint32* thisrun; /* current row's run array */ \
+ uint32_t* pa; /* place to stuff next run */ \
+ uint32_t* thisrun; /* current row's run array */ \
int EOLcnt; /* # EOL codes recognized */ \
const unsigned char* bitmap = sp->bitmap; /* input data bit reverser */ \
const TIFFFaxTabEnt* TabEnt
#define DECLARE_STATE_2D(tif, sp, mod) \
DECLARE_STATE(tif, sp, mod); \
int b1; /* next change on prev line */ \
- uint32* pb /* next run in reference line */\
+ uint32_t* pb /* next run in reference line */\
/*
* Load any state that may be changed during decoding.
*/
@@ -135,15 +135,15 @@ typedef struct {
sp->bit = BitsAvail; \
sp->data = BitAcc; \
sp->EOLcnt = EOLcnt; \
- tif->tif_rawcc -= (tmsize_t)((uint8*) cp - tif->tif_rawcp); \
- tif->tif_rawcp = (uint8*) cp; \
+ tif->tif_rawcc -= (tmsize_t)((uint8_t*) cp - tif->tif_rawcp); \
+ tif->tif_rawcp = (uint8_t*) cp; \
} while (0)
/*
* Setup state for decoding a strip.
*/
static int
-Fax3PreDecode(TIFF* tif, uint16 s)
+Fax3PreDecode(TIFF* tif, uint16_t s)
{
Fax3CodecState* sp = DecoderState(tif);
@@ -164,7 +164,7 @@ Fax3PreDecode(TIFF* tif, uint16 s)
sp->curruns = sp->runs;
if (sp->refruns) { /* init reference line to white */
sp->refruns = sp->runs + sp->nruns;
- sp->refruns[0] = (uint32) sp->b.rowpixels;
+ sp->refruns[0] = (uint32_t) sp->b.rowpixels;
sp->refruns[1] = 0;
}
sp->line = 0;
@@ -178,7 +178,7 @@ Fax3PreDecode(TIFF* tif, uint16 s)
*/
static void
-Fax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0)
+Fax3Unexpected(const char* module, TIFF* tif, uint32_t line, uint32_t a0)
{
TIFFErrorExt(tif->tif_clientdata, module, "Bad code word at line %u of %s %u (x %u)",
line, isTiled(tif) ? "tile" : "strip",
@@ -188,7 +188,7 @@ Fax3Unexpected(const char* module, TIFF* tif, uint32 line, uint32 a0)
#define unexpected(table, a0) Fax3Unexpected(module, tif, sp->line, a0)
static void
-Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)
+Fax3Extension(const char* module, TIFF* tif, uint32_t line, uint32_t a0)
{
TIFFErrorExt(tif->tif_clientdata, module,
"Uncompressed data (not supported) at line %u of %s %u (x %u)",
@@ -199,7 +199,7 @@ Fax3Extension(const char* module, TIFF* tif, uint32 line, uint32 a0)
#define extension(a0) Fax3Extension(module, tif, sp->line, a0)
static void
-Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 lastx)
+Fax3BadLength(const char* module, TIFF* tif, uint32_t line, uint32_t a0, uint32_t lastx)
{
TIFFWarningExt(tif->tif_clientdata, module, "%s at line %u of %s %u (got %u, expected %u)",
a0 < lastx ? "Premature EOL" : "Line length mismatch",
@@ -210,7 +210,7 @@ Fax3BadLength(const char* module, TIFF* tif, uint32 line, uint32 a0, uint32 last
#define badlength(a0,lastx) Fax3BadLength(module, tif, sp->line, a0, lastx)
static void
-Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)
+Fax3PrematureEOF(const char* module, TIFF* tif, uint32_t line, uint32_t a0)
{
TIFFWarningExt(tif->tif_clientdata, module, "Premature EOF at line %u of %s %u (x %u)",
line, isTiled(tif) ? "tile" : "strip",
@@ -229,7 +229,7 @@ Fax3PrematureEOF(const char* module, TIFF* tif, uint32 line, uint32 a0)
* @returns 1 for success, -1 in case of error
*/
static int
-Fax3Decode1D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+Fax3Decode1D(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
DECLARE_STATE(tif, sp, "Fax3Decode1D");
(void) s;
@@ -272,7 +272,7 @@ Fax3Decode1D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
* Decode the requested amount of G3 2D-encoded data.
*/
static int
-Fax3Decode2D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+Fax3Decode2D(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax3Decode2D");
int is1D; /* current line is 1d/2d-encoded */
@@ -310,7 +310,7 @@ Fax3Decode2D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
if (pa < thisrun + sp->nruns) {
SETVALUE(0); /* imaginary change for reference */
}
- SWAP(uint32*, sp->curruns, sp->refruns);
+ SWAP(uint32_t*, sp->curruns, sp->refruns);
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
sp->line++;
@@ -328,13 +328,9 @@ Fax3Decode2D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
#undef SWAP
/*
- * The ZERO & FILL macros must handle spans < 2*sizeof(long) bytes.
- * For machines with 64-bit longs this is <16 bytes; otherwise
- * this is <8 bytes. We optimize the code here to reflect the
- * machine characteristics.
+ * The ZERO & FILL macros must handle spans < 2*sizeof(int64_t) bytes.
*/
-#if SIZEOF_UNSIGNED_LONG == 8
-# define FILL(n, cp) \
+# define FILL(n, cp) \
switch (n) { \
case 15:(cp)[14] = 0xff; /*-fallthrough*/ \
case 14:(cp)[13] = 0xff; /*-fallthrough*/ \
@@ -372,44 +368,20 @@ Fax3Decode2D(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
case 1: (cp)[0] = 0; (cp) += (n); /*-fallthrough*/ \
case 0: ; \
}
-#else
-# define FILL(n, cp) \
- switch (n) { \
- case 7: (cp)[6] = 0xff; /*-fallthrough*/ \
- case 6: (cp)[5] = 0xff; /*-fallthrough*/ \
- case 5: (cp)[4] = 0xff; /*-fallthrough*/ \
- case 4: (cp)[3] = 0xff; /*-fallthrough*/ \
- case 3: (cp)[2] = 0xff; /*-fallthrough*/ \
- case 2: (cp)[1] = 0xff; /*-fallthrough*/ \
- case 1: (cp)[0] = 0xff; (cp) += (n); /*-fallthrough*/ \
- case 0: ; \
- }
-# define ZERO(n, cp) \
- switch (n) { \
- case 7: (cp)[6] = 0; /*-fallthrough*/ \
- case 6: (cp)[5] = 0; /*-fallthrough*/ \
- case 5: (cp)[4] = 0; /*-fallthrough*/ \
- case 4: (cp)[3] = 0; /*-fallthrough*/ \
- case 3: (cp)[2] = 0; /*-fallthrough*/ \
- case 2: (cp)[1] = 0; /*-fallthrough*/ \
- case 1: (cp)[0] = 0; (cp) += (n); /*-fallthrough*/ \
- case 0: ; \
- }
-#endif
/*
* Bit-fill a row according to the white/black
* runs generated during G3/G4 decoding.
*/
void
-_TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+_TIFFFax3fillruns(unsigned char* buf, uint32_t* runs, uint32_t* erun, uint32_t lastx)
{
static const unsigned char _fillmasks[] =
{ 0x00, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
unsigned char* cp;
- uint32 x, bx, run;
- int32 n, nw;
- long* lp;
+ uint32_t x, bx, run;
+ int32_t n, nw;
+ int64_t* lp;
if ((erun-runs)&1)
*erun++ = 0;
@@ -417,7 +389,7 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
for (; runs < erun; runs += 2) {
run = runs[0];
if (x+run > lastx || run > lastx )
- run = runs[0] = (uint32) (lastx - x);
+ run = runs[0] = (uint32_t) (lastx - x);
if (run) {
cp = buf + (x>>3);
bx = x&7;
@@ -427,15 +399,15 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
run -= 8-bx;
}
if( (n = run >> 3) != 0 ) { /* multiple bytes to fill */
- if ((n/sizeof (long)) > 1) {
+ if ((n/sizeof (int64_t)) > 1) {
/*
- * Align to longword boundary and fill.
+ * Align to int64_tword boundary and fill.
*/
- for (; n && !isAligned(cp, long); n--)
+ for (; n && !isAligned(cp, int64_t); n--)
*cp++ = 0x00;
- lp = (long*) cp;
- nw = (int32)(n / sizeof (long));
- n -= nw * sizeof (long);
+ lp = (int64_t*) cp;
+ nw = (int32_t)(n / sizeof (int64_t));
+ n -= nw * sizeof (int64_t);
do {
*lp++ = 0L;
} while (--nw);
@@ -462,15 +434,15 @@ _TIFFFax3fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
run -= 8-bx;
}
if( (n = run>>3) != 0 ) { /* multiple bytes to fill */
- if ((n/sizeof (long)) > 1) {
+ if ((n/sizeof (int64_t)) > 1) {
/*
- * Align to longword boundary and fill.
+ * Align to int64_t boundary and fill.
*/
- for (; n && !isAligned(cp, long); n--)
+ for (; n && !isAligned(cp, int64_t); n--)
*cp++ = 0xff;
- lp = (long*) cp;
- nw = (int32)(n / sizeof (long));
- n -= nw * sizeof (long);
+ lp = (int64_t*) cp;
+ nw = (int32_t)(n / sizeof (int64_t));
+ n -= nw * sizeof (int64_t);
do {
*lp++ = -1L;
} while (--nw);
@@ -515,7 +487,7 @@ Fax3SetupState(TIFF* tif)
int needsRefLine;
Fax3CodecState* dsp = (Fax3CodecState*) Fax3State(tif);
tmsize_t rowbytes;
- uint32 rowpixels;
+ uint32_t rowpixels;
if (td->td_bitspersample != 1) {
TIFFErrorExt(tif->tif_clientdata, module,
@@ -532,11 +504,11 @@ Fax3SetupState(TIFF* tif)
rowbytes = TIFFScanlineSize(tif);
rowpixels = td->td_imagewidth;
}
- if ((uint64)rowbytes < ((uint64)rowpixels + 7) / 8)
+ if ((int64_t)rowbytes < ((int64_t)rowpixels + 7) / 8)
{
TIFFErrorExt(tif->tif_clientdata, module,
- "Inconsistent number of bytes per row : rowbytes=%lu rowpixels=%lu",
- (unsigned long)(rowbytes), (unsigned long)(rowpixels));
+ "Inconsistent number of bytes per row : rowbytes=%" PRId64 " rowpixels=%" PRIu32,
+ (int64_t) rowbytes, rowpixels);
return (0);
}
sp->rowbytes = rowbytes;
@@ -554,24 +526,24 @@ Fax3SetupState(TIFF* tif)
TIFFroundup and TIFFSafeMultiply return zero on integer overflow
*/
- dsp->runs=(uint32*) NULL;
+ dsp->runs=(uint32_t*) NULL;
dsp->nruns = TIFFroundup_32(rowpixels,32);
if (needsRefLine) {
- dsp->nruns = TIFFSafeMultiply(uint32,dsp->nruns,2);
+ dsp->nruns = TIFFSafeMultiply(uint32_t, dsp->nruns, 2);
}
- if ((dsp->nruns == 0) || (TIFFSafeMultiply(uint32,dsp->nruns,2) == 0)) {
+ if ((dsp->nruns == 0) || (TIFFSafeMultiply(uint32_t, dsp->nruns, 2) == 0)) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Row pixels integer overflow (rowpixels %u)",
rowpixels);
return (0);
}
- dsp->runs = (uint32*) _TIFFCheckMalloc(tif,
- TIFFSafeMultiply(uint32,dsp->nruns,2),
- sizeof (uint32),
- "for Group 3/4 run arrays");
+ dsp->runs = (uint32_t*) _TIFFCheckMalloc(tif,
+ TIFFSafeMultiply(uint32_t, dsp->nruns, 2),
+ sizeof (uint32_t),
+ "for Group 3/4 run arrays");
if (dsp->runs == NULL)
return (0);
- memset( dsp->runs, 0, TIFFSafeMultiply(uint32,dsp->nruns,2)*sizeof(uint32));
+ memset( dsp->runs, 0, TIFFSafeMultiply(uint32_t,dsp->nruns,2)*sizeof(uint32_t));
dsp->curruns = dsp->runs;
if (needsRefLine)
dsp->refruns = dsp->runs + dsp->nruns;
@@ -614,7 +586,7 @@ Fax3SetupState(TIFF* tif)
if( !TIFFFlushData1(tif) ) \
return 0; \
} \
- *(tif)->tif_rawcp++ = (uint8) (sp)->data; \
+ *(tif)->tif_rawcp++ = (uint8_t) (sp)->data; \
(tif)->tif_rawcc++; \
(sp)->data = 0, (sp)->bit = 8; \
}
@@ -623,7 +595,7 @@ Fax3SetupState(TIFF* tif)
if( !TIFFFlushData1(tif) ) \
return 0; \
} \
- *(tif)->tif_rawcp++ = (uint8) data; \
+ *(tif)->tif_rawcp++ = (uint8_t) data; \
(tif)->tif_rawcc++; \
data = 0, bit = 8; \
}
@@ -684,7 +656,7 @@ Fax3PutBits(TIFF* tif, unsigned int bits, unsigned int length)
* terminating codes is supplied.
*/
static int
-putspan(TIFF* tif, int32 span, const tableentry* tab)
+putspan(TIFF* tif, int32_t span, const tableentry* tab)
{
Fax3CodecState* sp = EncoderState(tif);
unsigned int bit = sp->bit;
@@ -773,7 +745,7 @@ Fax3PutEOL(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-Fax3PreEncode(TIFF* tif, uint16 s)
+Fax3PreEncode(TIFF* tif, uint16_t s)
{
Fax3CodecState* sp = EncoderState(tif);
@@ -853,8 +825,8 @@ static const unsigned char oneruns[256] = {
* the routines that find pixel spans.
*/
#ifdef VAXC
-static int32 find0span(unsigned char*, int32, int32);
-static int32 find1span(unsigned char*, int32, int32);
+static int32_t find0span(unsigned char*, int32_t, int32_t);
+static int32_t find1span(unsigned char*, int32_t, int32_t);
#pragma inline(find0span,find1span)
#endif
@@ -863,11 +835,11 @@ static int32 find1span(unsigned char*, int32, int32);
* table. The ``base'' of the bit string is supplied
* along with the start+end bit indices.
*/
-inline static int32
-find0span(unsigned char* bp, int32 bs, int32 be)
+inline static int32_t
+find0span(unsigned char* bp, int32_t bs, int32_t be)
{
- int32 bits = be - bs;
- int32 n, span;
+ int32_t bits = be - bs;
+ int32_t n, span;
bp += bs>>3;
/*
@@ -885,22 +857,22 @@ find0span(unsigned char* bp, int32 bs, int32 be)
bp++;
} else
span = 0;
- if (bits >= (int32)(2 * 8 * sizeof(long))) {
- long* lp;
+ if (bits >= (int32_t)(2 * 8 * sizeof(int64_t))) {
+ int64_t* lp;
/*
- * Align to longword boundary and check longwords.
+ * Align to int64_t boundary and check int64_t words.
*/
- while (!isAligned(bp, long)) {
+ while (!isAligned(bp, int64_t)) {
if (*bp != 0x00)
return (span + zeroruns[*bp]);
span += 8;
bits -= 8;
bp++;
}
- lp = (long*) bp;
- while ((bits >= (int32)(8 * sizeof(long))) && (0 == *lp)) {
- span += 8*sizeof (long);
- bits -= 8*sizeof (long);
+ lp = (int64_t*) bp;
+ while ((bits >= (int32_t)(8 * sizeof(int64_t))) && (0 == *lp)) {
+ span += 8*sizeof (int64_t);
+ bits -= 8*sizeof (int64_t);
lp++;
}
bp = (unsigned char*) lp;
@@ -925,11 +897,11 @@ find0span(unsigned char* bp, int32 bs, int32 be)
return (span);
}
-inline static int32
-find1span(unsigned char* bp, int32 bs, int32 be)
+inline static int32_t
+find1span(unsigned char* bp, int32_t bs, int32_t be)
{
- int32 bits = be - bs;
- int32 n, span;
+ int32_t bits = be - bs;
+ int32_t n, span;
bp += bs>>3;
/*
@@ -947,22 +919,22 @@ find1span(unsigned char* bp, int32 bs, int32 be)
bp++;
} else
span = 0;
- if (bits >= (int32)(2 * 8 * sizeof(long))) {
- long* lp;
+ if (bits >= (int32_t)(2 * 8 * sizeof(int64_t))) {
+ int64_t* lp;
/*
- * Align to longword boundary and check longwords.
+ * Align to int64_t boundary and check int64_t words.
*/
- while (!isAligned(bp, long)) {
+ while (!isAligned(bp, int64_t)) {
if (*bp != 0xff)
return (span + oneruns[*bp]);
span += 8;
bits -= 8;
bp++;
}
- lp = (long*) bp;
- while ((bits >= (int32)(8 * sizeof(long))) && (~0 == *lp)) {
- span += 8*sizeof (long);
- bits -= 8*sizeof (long);
+ lp = (int64_t*) bp;
+ while ((bits >= (int32_t)(8 * sizeof(int64_t))) && (~0u == *lp)) {
+ span += 8*sizeof (int64_t);
+ bits -= 8*sizeof (int64_t);
lp++;
}
bp = (unsigned char*) lp;
@@ -1008,11 +980,11 @@ find1span(unsigned char* bp, int32 bs, int32 be)
* of pixels encoded with Huffman codes.
*/
static int
-Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits)
+Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32_t bits)
{
Fax3CodecState* sp = EncoderState(tif);
- int32 span;
- uint32 bs = 0;
+ int32_t span;
+ uint32_t bs = 0;
for (;;) {
span = find0span(bp, bs, bits); /* white span */
@@ -1032,7 +1004,7 @@ Fax3Encode1DRow(TIFF* tif, unsigned char* bp, uint32 bits)
if (sp->bit != 8) /* byte-align */
Fax3FlushBits(tif, sp);
if ((sp->b.mode&FAXMODE_WORDALIGN) &&
- !isAligned(tif->tif_rawcp, uint16))
+ !isAligned(tif->tif_rawcp, uint16_t))
Fax3FlushBits(tif, sp);
}
return (1);
@@ -1057,22 +1029,22 @@ static const tableentry vcodes[7] = {
* documentation for the algorithm.
*/
static int
-Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits)
+Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32_t bits)
{
#define PIXEL(buf,ix) ((((buf)[(ix)>>3]) >> (7-((ix)&7))) & 1)
- uint32 a0 = 0;
- uint32 a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0));
- uint32 b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0));
- uint32 a2, b2;
+ uint32_t a0 = 0;
+ uint32_t a1 = (PIXEL(bp, 0) != 0 ? 0 : finddiff(bp, 0, bits, 0));
+ uint32_t b1 = (PIXEL(rp, 0) != 0 ? 0 : finddiff(rp, 0, bits, 0));
+ uint32_t a2, b2;
for (;;) {
b2 = finddiff2(rp, b1, bits, PIXEL(rp,b1));
if (b2 >= a1) {
/* Naive computation triggers -fsanitize=undefined,unsigned-integer-overflow */
/* although it is correct unless the difference between both is < 31 bit */
- /* int32 d = b1 - a1; */
- int32 d = (b1 >= a1 && b1 - a1 <= 3U) ? (int32)(b1 - a1):
- (b1 < a1 && a1 - b1 <= 3U) ? -(int32)(a1 - b1) : 0x7FFFFFFF;
+ /* int32_t d = b1 - a1; */
+ int32_t d = (b1 >= a1 && b1 - a1 <= 3U) ? (int32_t)(b1 - a1) :
+ (b1 < a1 && a1 - b1 <= 3U) ? -(int32_t)(a1 - b1) : 0x7FFFFFFF;
if (!(-3 <= d && d <= 3)) { /* horizontal mode */
a2 = finddiff2(bp, a1, bits, PIXEL(bp,a1));
if( !putcode(tif, &horizcode) )
@@ -1113,7 +1085,7 @@ Fax3Encode2DRow(TIFF* tif, unsigned char* bp, unsigned char* rp, uint32 bits)
* Encode a buffer of pixels.
*/
static int
-Fax3Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+Fax3Encode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "Fax3Encode";
Fax3CodecState* sp = EncoderState(tif);
@@ -1233,7 +1205,7 @@ static const TIFFField fax4Fields[] = {
};
static int
-Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
+Fax3VSetField(TIFF* tif, uint32_t tag, va_list ap)
{
Fax3BaseState* sp = Fax3State(tif);
const TIFFField* fip;
@@ -1251,21 +1223,21 @@ Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
case TIFFTAG_GROUP3OPTIONS:
/* XXX: avoid reading options if compression mismatches. */
if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX3)
- sp->groupoptions = (uint32) va_arg(ap, uint32);
+ sp->groupoptions = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_GROUP4OPTIONS:
/* XXX: avoid reading options if compression mismatches. */
if (tif->tif_dir.td_compression == COMPRESSION_CCITTFAX4)
- sp->groupoptions = (uint32) va_arg(ap, uint32);
+ sp->groupoptions = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_BADFAXLINES:
- sp->badfaxlines = (uint32) va_arg(ap, uint32);
+ sp->badfaxlines = (uint32_t) va_arg(ap, uint32_t);
break;
case TIFFTAG_CLEANFAXDATA:
- sp->cleanfaxdata = (uint16) va_arg(ap, uint16_vap);
+ sp->cleanfaxdata = (uint16_t) va_arg(ap, uint16_vap);
break;
case TIFFTAG_CONSECUTIVEBADFAXLINES:
- sp->badfaxrun = (uint32) va_arg(ap, uint32);
+ sp->badfaxrun = (uint32_t) va_arg(ap, uint32_t);
break;
default:
return (*sp->vsetparent)(tif, tag, ap);
@@ -1281,7 +1253,7 @@ Fax3VSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-Fax3VGetField(TIFF* tif, uint32 tag, va_list ap)
+Fax3VGetField(TIFF* tif, uint32_t tag, va_list ap)
{
Fax3BaseState* sp = Fax3State(tif);
@@ -1296,16 +1268,16 @@ Fax3VGetField(TIFF* tif, uint32 tag, va_list ap)
break;
case TIFFTAG_GROUP3OPTIONS:
case TIFFTAG_GROUP4OPTIONS:
- *va_arg(ap, uint32*) = sp->groupoptions;
+ *va_arg(ap, uint32_t*) = sp->groupoptions;
break;
case TIFFTAG_BADFAXLINES:
- *va_arg(ap, uint32*) = sp->badfaxlines;
+ *va_arg(ap, uint32_t*) = sp->badfaxlines;
break;
case TIFFTAG_CLEANFAXDATA:
- *va_arg(ap, uint16*) = sp->cleanfaxdata;
+ *va_arg(ap, uint16_t*) = sp->cleanfaxdata;
break;
case TIFFTAG_CONSECUTIVEBADFAXLINES:
- *va_arg(ap, uint32*) = sp->badfaxrun;
+ *va_arg(ap, uint32_t*) = sp->badfaxrun;
break;
default:
return (*sp->vgetparent)(tif, tag, ap);
@@ -1341,9 +1313,9 @@ Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
if (sp->groupoptions & GROUP3OPT_UNCOMPRESSED)
fprintf(fd, "%suncompressed data", sep);
}
- fprintf(fd, " (%lu = 0x%lx)\n",
- (unsigned long) sp->groupoptions,
- (unsigned long) sp->groupoptions);
+ fprintf(fd, " (%" PRIu32 " = 0x%" PRIx32 ")\n",
+ sp->groupoptions,
+ sp->groupoptions);
}
if (TIFFFieldSet(tif,FIELD_CLEANFAXDATA)) {
fprintf(fd, " Fax Data:");
@@ -1362,11 +1334,11 @@ Fax3PrintDir(TIFF* tif, FILE* fd, long flags)
sp->cleanfaxdata, sp->cleanfaxdata);
}
if (TIFFFieldSet(tif,FIELD_BADFAXLINES))
- fprintf(fd, " Bad Fax Lines: %lu\n",
- (unsigned long) sp->badfaxlines);
+ fprintf(fd, " Bad Fax Lines: %" PRIu32 "\n",
+ sp->badfaxlines);
if (TIFFFieldSet(tif,FIELD_BADFAXRUN))
- fprintf(fd, " Consecutive Bad Fax Lines: %lu\n",
- (unsigned long) sp->badfaxrun);
+ fprintf(fd, " Consecutive Bad Fax Lines: %" PRIu32 "\n",
+ sp->badfaxrun);
if (sp->printdir)
(*sp->printdir)(tif, fd, flags);
}
@@ -1389,7 +1361,7 @@ InitCCITTFax3(TIFF* tif)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*)
+ tif->tif_data = (uint8_t*)
_TIFFmalloc(sizeof (Fax3CodecState));
if (tif->tif_data == NULL) {
@@ -1473,7 +1445,7 @@ TIFFInitCCITTFax3(TIFF* tif, int scheme)
* Decode the requested amount of G4-encoded data.
*/
static int
-Fax4Decode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+Fax4Decode(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
DECLARE_STATE_2D(tif, sp, "Fax4Decode");
(void) s;
@@ -1506,7 +1478,7 @@ Fax4Decode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
}
(*sp->fill)(buf, thisrun, pa, lastx);
SETVALUE(0); /* imaginary change for reference */
- SWAP(uint32*, sp->curruns, sp->refruns);
+ SWAP(uint32_t*, sp->curruns, sp->refruns);
buf += sp->b.rowbytes;
occ -= sp->b.rowbytes;
sp->line++;
@@ -1539,7 +1511,7 @@ Fax4Decode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
* Encode the requested amount of data.
*/
static int
-Fax4Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+Fax4Encode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "Fax4Encode";
Fax3CodecState *sp = EncoderState(tif);
@@ -1611,7 +1583,7 @@ TIFFInitCCITTFax4(TIFF* tif, int scheme)
* Decode the requested amount of RLE-encoded data.
*/
static int
-Fax3DecodeRLE(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+Fax3DecodeRLE(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
DECLARE_STATE(tif, sp, "Fax3DecodeRLE");
int mode = sp->b.mode;
@@ -1643,7 +1615,7 @@ Fax3DecodeRLE(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
} else if (mode & FAXMODE_WORDALIGN) {
int n = BitsAvail - (BitsAvail &~ 15);
ClrBits(n);
- if (BitsAvail == 0 && !isAligned(cp, uint16))
+ if (BitsAvail == 0 && !isAligned(cp, uint16_t))
cp++;
}
buf += sp->b.rowbytes;
diff --git a/libtiff/tif_fax3.h b/libtiff/tif_fax3.h
index 701716cc..fdafe492 100644
--- a/libtiff/tif_fax3.h
+++ b/libtiff/tif_fax3.h
@@ -41,7 +41,7 @@
* The routine must have the type signature given below;
* for example:
*
- * fillruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+ * fillruns(unsigned char* buf, uint32_t* runs, uint32_t* erun, uint32_t lastx)
*
* where buf is place to set the bits, runs is the array of b&w run
* lengths (white then black), erun is the last run in the array, and
@@ -50,7 +50,7 @@
* data in the run array as needed (e.g. to append zero runs to bring
* the count up to a nice multiple).
*/
-typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
+typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32_t*, uint32_t*, uint32_t);
/*
* The default run filler; made external for other decoders.
@@ -58,7 +58,7 @@ typedef void (*TIFFFaxFillFunc)(unsigned char*, uint32*, uint32*, uint32);
#if defined(__cplusplus)
extern "C" {
#endif
-extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
+extern void _TIFFFax3fillruns(unsigned char*, uint32_t*, uint32_t*, uint32_t);
#if defined(__cplusplus)
}
#endif
@@ -84,7 +84,7 @@ extern void _TIFFFax3fillruns(unsigned char*, uint32*, uint32*, uint32);
typedef struct { /* state table entry */
unsigned char State; /* see above */
unsigned char Width; /* width of code in bits */
- uint32 Param; /* unsigned 32-bit run length in bits (holds on 16 bit actually, but cannot be changed. See above warning) */
+ uint32_t Param; /* unsigned 32-bit run length in bits (holds on 16 bit actually, but cannot be changed. See above warning) */
} TIFFFaxTabEnt;
extern const TIFFFaxTabEnt TIFFFaxMainTable[];
@@ -141,7 +141,7 @@ extern const TIFFFaxTabEnt TIFFFaxBlackTable[];
goto eoflab; \
BitsAvail = (n); /* pad with zeros */ \
} else { \
- BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
+ BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail; \
BitsAvail += 8; \
} \
} \
@@ -155,13 +155,13 @@ extern const TIFFFaxTabEnt TIFFFaxBlackTable[];
goto eoflab; \
BitsAvail = (n); /* pad with zeros */ \
} else { \
- BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
+ BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail; \
if ((BitsAvail += 8) < (n)) { \
if (EndOfData()) { \
/* NB: we know BitsAvail is non-zero here */ \
BitsAvail = (n); /* pad with zeros */ \
} else { \
- BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail; \
+ BitAcc |= ((uint32_t) bitmap[*cp++])<<BitsAvail; \
BitsAvail += 8; \
} \
} \
diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
index 3460af74..04c4cc7b 100644
--- a/libtiff/tif_getimage.c
+++ b/libtiff/tif_getimage.c
@@ -31,10 +31,10 @@
#include <stdio.h>
#include <limits.h>
-static int gtTileContig(TIFFRGBAImage*, uint32*, uint32, uint32);
-static int gtTileSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
-static int gtStripContig(TIFFRGBAImage*, uint32*, uint32, uint32);
-static int gtStripSeparate(TIFFRGBAImage*, uint32*, uint32, uint32);
+static int gtTileContig(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
+static int gtTileSeparate(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
+static int gtStripContig(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
+static int gtStripSeparate(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
static int PickContigCase(TIFFRGBAImage*);
static int PickSeparateCase(TIFFRGBAImage*);
@@ -75,7 +75,7 @@ int
TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
{
TIFFDirectory* td = &tif->tif_dir;
- uint16 photometric;
+ uint16_t photometric;
int colorchannels;
if (!tif->tif_decodestatus) {
@@ -150,7 +150,7 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
break;
case PHOTOMETRIC_SEPARATED:
{
- uint16 inkset;
+ uint16_t inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
sprintf(emsg,
@@ -254,7 +254,7 @@ TIFFRGBAImageEnd(TIFFRGBAImage* img)
static int
isCCITTCompression(TIFF* tif)
{
- uint16 compress;
+ uint16_t compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
return (compress == COMPRESSION_CCITTFAX3 ||
compress == COMPRESSION_CCITTFAX4 ||
@@ -265,12 +265,12 @@ isCCITTCompression(TIFF* tif)
int
TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
{
- uint16* sampleinfo;
- uint16 extrasamples;
- uint16 planarconfig;
- uint16 compress;
+ uint16_t* sampleinfo;
+ uint16_t extrasamples;
+ uint16_t planarconfig;
+ uint16_t compress;
int colorchannels;
- uint16 *red_orig, *green_orig, *blue_orig;
+ uint16_t *red_orig, *green_orig, *blue_orig;
int n_color;
if( !TIFFRGBAImageOK(tif, emsg) )
@@ -366,9 +366,9 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
/* copy the colormaps so we can modify them */
n_color = (1U << img->bitspersample);
- img->redcmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
- img->greencmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
- img->bluecmap = (uint16 *) _TIFFmalloc(sizeof(uint16)*n_color);
+ img->redcmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
+ img->greencmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
+ img->bluecmap = (uint16_t *) _TIFFmalloc(sizeof(uint16_t) * n_color);
if( !img->redcmap || !img->greencmap || !img->bluecmap ) {
sprintf(emsg, "Out of memory for colormap copy");
goto fail_return;
@@ -428,7 +428,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
break;
case PHOTOMETRIC_SEPARATED:
{
- uint16 inkset;
+ uint16_t inkset;
TIFFGetFieldDefaulted(tif, TIFFTAG_INKSET, &inkset);
if (inkset != INKSET_CMYK) {
sprintf(emsg, "Sorry, can not handle separated image with %s=%d",
@@ -498,7 +498,7 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
}
int
-TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+TIFFRGBAImageGet(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
if (img->get == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No \"get\" routine setup");
@@ -518,15 +518,15 @@ TIFFRGBAImageGet(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
*/
int
TIFFReadRGBAImageOriented(TIFF* tif,
- uint32 rwidth, uint32 rheight, uint32* raster,
- int orientation, int stop)
+ uint32_t rwidth, uint32_t rheight, uint32_t* raster,
+ int orientation, int stop)
{
char emsg[1024] = "";
TIFFRGBAImage img;
int ok;
if (TIFFRGBAImageOK(tif, emsg) && TIFFRGBAImageBegin(&img, tif, stop, emsg)) {
- img.req_orientation = (uint16)orientation;
+ img.req_orientation = (uint16_t)orientation;
/* XXX verify rwidth and rheight against width and height */
ok = TIFFRGBAImageGet(&img, raster+(rheight-img.height)*rwidth,
rwidth, img.height);
@@ -544,7 +544,7 @@ TIFFReadRGBAImageOriented(TIFF* tif,
*/
int
TIFFReadRGBAImage(TIFF* tif,
- uint32 rwidth, uint32 rheight, uint32* raster, int stop)
+ uint32_t rwidth, uint32_t rheight, uint32_t* raster, int stop)
{
return TIFFReadRGBAImageOriented(tif, rwidth, rheight, raster,
ORIENTATION_BOTLEFT, stop);
@@ -618,21 +618,21 @@ setorientation(TIFFRGBAImage* img)
* SamplesPerPixel == 1
*/
static int
-gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+gtTileContig(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
tileContigRoutine put = img->put.contig;
- uint32 col, row, y, rowstoread;
+ uint32_t col, row, y, rowstoread;
tmsize_t pos;
- uint32 tw, th;
+ uint32_t tw, th;
unsigned char* buf = NULL;
- int32 fromskew, toskew;
- uint32 nrow;
+ int32_t fromskew, toskew;
+ uint32_t nrow;
int ret = 1, flip;
- uint32 this_tw, tocol;
- int32 this_toskew, leftmost_toskew;
- int32 leftmost_fromskew;
- uint32 leftmost_tw;
+ uint32_t this_tw, tocol;
+ int32_t this_toskew, leftmost_toskew;
+ int32_t leftmost_fromskew;
+ uint32_t leftmost_tw;
tmsize_t bufsize;
bufsize = TIFFTileSize(tif);
@@ -651,7 +651,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = h - 1;
- toskew = -(int32)(tw + w);
+ toskew = -(int32_t)(tw + w);
}
else {
if (tw > (INT_MAX + w)) {
@@ -659,7 +659,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = 0;
- toskew = -(int32)(tw - w);
+ toskew = -(int32_t)(tw - w);
}
/*
@@ -708,19 +708,19 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
this_toskew = toskew;
}
- y += ((flip & FLIP_VERTICALLY) ? -(int32) nrow : (int32) nrow);
+ y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
}
_TIFFfree(buf);
if (flip & FLIP_HORIZONTALLY) {
- uint32 line;
+ uint32_t line;
for (line = 0; line < h; line++) {
- uint32 *left = raster + (line * w);
- uint32 *right = left + w - 1;
+ uint32_t *left = raster + (line * w);
+ uint32_t *right = left + w - 1;
while ( left < right ) {
- uint32 temp = *left;
+ uint32_t temp = *left;
*left = *right;
*right = temp;
left++;
@@ -739,13 +739,13 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
* We assume that all such images are RGB.
*/
static int
-gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+gtTileSeparate(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
tileSeparateRoutine put = img->put.separate;
- uint32 col, row, y, rowstoread;
+ uint32_t col, row, y, rowstoread;
tmsize_t pos;
- uint32 tw, th;
+ uint32_t tw, th;
unsigned char* buf = NULL;
unsigned char* p0 = NULL;
unsigned char* p1 = NULL;
@@ -753,15 +753,15 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
unsigned char* pa = NULL;
tmsize_t tilesize;
tmsize_t bufsize;
- int32 fromskew, toskew;
+ int32_t fromskew, toskew;
int alpha = img->alpha;
- uint32 nrow;
+ uint32_t nrow;
int ret = 1, flip;
- uint16 colorchannels;
- uint32 this_tw, tocol;
- int32 this_toskew, leftmost_toskew;
- int32 leftmost_fromskew;
- uint32 leftmost_tw;
+ uint16_t colorchannels;
+ uint32_t this_tw, tocol;
+ int32_t this_toskew, leftmost_toskew;
+ int32_t leftmost_fromskew;
+ uint32_t leftmost_tw;
tilesize = TIFFTileSize(tif);
bufsize = _TIFFMultiplySSize(tif, alpha?4:3,tilesize, "gtTileSeparate");
@@ -779,7 +779,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = h - 1;
- toskew = -(int32)(tw + w);
+ toskew = -(int32_t)(tw + w);
}
else {
if (tw > (INT_MAX + w)) {
@@ -787,7 +787,7 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = 0;
- toskew = -(int32)(tw - w);
+ toskew = -(int32_t)(tw - w);
}
switch( img->photometric )
@@ -897,18 +897,18 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
this_toskew = toskew;
}
- y += ((flip & FLIP_VERTICALLY) ?-(int32) nrow : (int32) nrow);
+ y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
}
if (flip & FLIP_HORIZONTALLY) {
- uint32 line;
+ uint32_t line;
for (line = 0; line < h; line++) {
- uint32 *left = raster + (line * w);
- uint32 *right = left + w - 1;
+ uint32_t *left = raster + (line * w);
+ uint32_t *right = left + w - 1;
while ( left < right ) {
- uint32 temp = *left;
+ uint32_t temp = *left;
*left = *right;
*right = temp;
left++;
@@ -928,18 +928,18 @@ gtTileSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
* SamplesPerPixel == 1
*/
static int
-gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+gtStripContig(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
tileContigRoutine put = img->put.contig;
- uint32 row, y, nrow, nrowsub, rowstoread;
+ uint32_t row, y, nrow, nrowsub, rowstoread;
tmsize_t pos;
unsigned char* buf = NULL;
- uint32 rowsperstrip;
- uint16 subsamplinghor,subsamplingver;
- uint32 imagewidth = img->width;
+ uint32_t rowsperstrip;
+ uint16_t subsamplinghor,subsamplingver;
+ uint32_t imagewidth = img->width;
tmsize_t scanline;
- int32 fromskew, toskew;
+ int32_t fromskew, toskew;
int ret = 1, flip;
tmsize_t maxstripsize;
@@ -958,10 +958,10 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = h - 1;
- toskew = -(int32)(w + w);
+ toskew = -(int32_t)(w + w);
} else {
y = 0;
- toskew = -(int32)(w - w);
+ toskew = -(int32_t)(w - w);
}
TIFFGetFieldDefaulted(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
@@ -970,7 +970,7 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += nrow)
{
- uint32 temp;
+ uint32_t temp;
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
nrow = (row + rowstoread > h ? h - row : rowstoread);
nrowsub = nrow;
@@ -996,18 +996,18 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
pos = ((row + img->row_offset) % rowsperstrip) * scanline + \
((tmsize_t) img->col_offset * img->samplesperpixel);
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, buf + pos);
- y += ((flip & FLIP_VERTICALLY) ? -(int32) nrow : (int32) nrow);
+ y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
}
if (flip & FLIP_HORIZONTALLY) {
- uint32 line;
+ uint32_t line;
for (line = 0; line < h; line++) {
- uint32 *left = raster + (line * w);
- uint32 *right = left + w - 1;
+ uint32_t *left = raster + (line * w);
+ uint32_t *right = left + w - 1;
while ( left < right ) {
- uint32 temp = *left;
+ uint32_t temp = *left;
*left = *right;
*right = temp;
left++;
@@ -1027,23 +1027,23 @@ gtStripContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
* We assume that all such images are RGB.
*/
static int
-gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
+gtStripSeparate(TIFFRGBAImage* img, uint32_t* raster, uint32_t w, uint32_t h)
{
TIFF* tif = img->tif;
tileSeparateRoutine put = img->put.separate;
unsigned char *buf = NULL;
unsigned char *p0 = NULL, *p1 = NULL, *p2 = NULL, *pa = NULL;
- uint32 row, y, nrow, rowstoread;
+ uint32_t row, y, nrow, rowstoread;
tmsize_t pos;
tmsize_t scanline;
- uint32 rowsperstrip, offset_row;
- uint32 imagewidth = img->width;
+ uint32_t rowsperstrip, offset_row;
+ uint32_t imagewidth = img->width;
tmsize_t stripsize;
tmsize_t bufsize;
- int32 fromskew, toskew;
+ int32_t fromskew, toskew;
int alpha = img->alpha;
int ret = 1, flip;
- uint16 colorchannels;
+ uint16_t colorchannels;
stripsize = TIFFStripSize(tif);
bufsize = _TIFFMultiplySSize(tif,alpha?4:3,stripsize, "gtStripSeparate");
@@ -1058,11 +1058,11 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
return (0);
}
y = h - 1;
- toskew = -(int32)(w + w);
+ toskew = -(int32_t)(w + w);
}
else {
y = 0;
- toskew = -(int32)(w - w);
+ toskew = -(int32_t)(w - w);
}
switch( img->photometric )
@@ -1083,7 +1083,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
fromskew = (w < imagewidth ? imagewidth - w : 0);
for (row = 0; row < h; row += nrow)
{
- uint32 temp;
+ uint32_t temp;
rowstoread = rowsperstrip - (row + img->row_offset) % rowsperstrip;
nrow = (row + rowstoread > h ? h - row : rowstoread);
offset_row = row + img->row_offset;
@@ -1155,18 +1155,18 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
((tmsize_t) img->col_offset * img->samplesperpixel);
(*put)(img, raster+y*w, 0, y, w, nrow, fromskew, toskew, p0 + pos, p1 + pos,
p2 + pos, (alpha?(pa+pos):NULL));
- y += ((flip & FLIP_VERTICALLY) ? -(int32) nrow : (int32) nrow);
+ y += ((flip & FLIP_VERTICALLY) ? -(int32_t) nrow : (int32_t) nrow);
}
if (flip & FLIP_HORIZONTALLY) {
- uint32 line;
+ uint32_t line;
for (line = 0; line < h; line++) {
- uint32 *left = raster + (line * w);
- uint32 *right = left + w - 1;
+ uint32_t *left = raster + (line * w);
+ uint32_t *right = left + w - 1;
while ( left < right ) {
- uint32 temp = *left;
+ uint32_t temp = *left;
*left = *right;
*right = temp;
left++;
@@ -1206,7 +1206,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
#define NOP
#define UNROLL8(w, op1, op2) { \
- uint32 _x; \
+ uint32_t _x; \
for (_x = w; _x >= 8; _x -= 8) { \
op1; \
REPEAT8(op2); \
@@ -1217,7 +1217,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
} \
}
#define UNROLL4(w, op1, op2) { \
- uint32 _x; \
+ uint32_t _x; \
for (_x = w; _x >= 4; _x -= 4) { \
op1; \
REPEAT4(op2); \
@@ -1228,7 +1228,7 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
} \
}
#define UNROLL2(w, op1, op2) { \
- uint32 _x; \
+ uint32_t _x; \
for (_x = w; _x >= 2; _x -= 2) { \
op1; \
REPEAT2(op2); \
@@ -1242,25 +1242,25 @@ gtStripSeparate(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
#define SKEW(r,g,b,skew) { r += skew; g += skew; b += skew; }
#define SKEW4(r,g,b,a,skew) { r += skew; g += skew; b += skew; a+= skew; }
-#define A1 (((uint32)0xffL)<<24)
+#define A1 (((uint32_t)0xffL)<<24)
#define PACK(r,g,b) \
- ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|A1)
+ ((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|A1)
#define PACK4(r,g,b,a) \
- ((uint32)(r)|((uint32)(g)<<8)|((uint32)(b)<<16)|((uint32)(a)<<24))
+ ((uint32_t)(r)|((uint32_t)(g)<<8)|((uint32_t)(b)<<16)|((uint32_t)(a)<<24))
#define W2B(v) (((v)>>8)&0xff)
/* TODO: PACKW should have be made redundant in favor of Bitdepth16To8 LUT */
#define PACKW(r,g,b) \
- ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|A1)
+ ((uint32_t)W2B(r)|((uint32_t)W2B(g)<<8)|((uint32_t)W2B(b)<<16)|A1)
#define PACKW4(r,g,b,a) \
- ((uint32)W2B(r)|((uint32)W2B(g)<<8)|((uint32)W2B(b)<<16)|((uint32)W2B(a)<<24))
+ ((uint32_t)W2B(r)|((uint32_t)W2B(g)<<8)|((uint32_t)W2B(b)<<16)|((uint32_t)W2B(a)<<24))
#define DECLAREContigPutFunc(name) \
static void name(\
TIFFRGBAImage* img, \
- uint32* cp, \
- uint32 x, uint32 y, \
- uint32 w, uint32 h, \
- int32 fromskew, int32 toskew, \
+ uint32_t* cp, \
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h, \
+ int32_t fromskew, int32_t toskew, \
unsigned char* pp \
)
@@ -1269,7 +1269,7 @@ static void name(\
*/
DECLAREContigPutFunc(put8bitcmaptile)
{
- uint32** PALmap = img->PALmap;
+ uint32_t** PALmap = img->PALmap;
int samplesperpixel = img->samplesperpixel;
(void) y;
@@ -1289,12 +1289,12 @@ DECLAREContigPutFunc(put8bitcmaptile)
*/
DECLAREContigPutFunc(put4bitcmaptile)
{
- uint32** PALmap = img->PALmap;
+ uint32_t** PALmap = img->PALmap;
(void) x; (void) y;
fromskew /= 2;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1306,12 +1306,12 @@ DECLAREContigPutFunc(put4bitcmaptile)
*/
DECLAREContigPutFunc(put2bitcmaptile)
{
- uint32** PALmap = img->PALmap;
+ uint32_t** PALmap = img->PALmap;
(void) x; (void) y;
fromskew /= 4;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL4(w, bw = PALmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1323,12 +1323,12 @@ DECLAREContigPutFunc(put2bitcmaptile)
*/
DECLAREContigPutFunc(put1bitcmaptile)
{
- uint32** PALmap = img->PALmap;
+ uint32_t** PALmap = img->PALmap;
(void) x; (void) y;
fromskew /= 8;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1341,7 +1341,7 @@ DECLAREContigPutFunc(put1bitcmaptile)
DECLAREContigPutFunc(putgreytile)
{
int samplesperpixel = img->samplesperpixel;
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) y;
for( ; h > 0; --h) {
@@ -1361,13 +1361,13 @@ DECLAREContigPutFunc(putgreytile)
DECLAREContigPutFunc(putagreytile)
{
int samplesperpixel = img->samplesperpixel;
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) y;
for( ; h > 0; --h) {
for (x = w; x > 0; --x)
{
- *cp++ = BWmap[*pp][0] & ((uint32)*(pp+1) << 24 | ~A1);
+ *cp++ = BWmap[*pp][0] & ((uint32_t)*(pp + 1) << 24 | ~A1);
pp += samplesperpixel;
}
cp += toskew;
@@ -1381,11 +1381,11 @@ DECLAREContigPutFunc(putagreytile)
DECLAREContigPutFunc(put16bitbwtile)
{
int samplesperpixel = img->samplesperpixel;
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) y;
for( ; h > 0; --h) {
- uint16 *wp = (uint16 *) pp;
+ uint16_t *wp = (uint16_t *) pp;
for (x = w; x > 0; --x)
{
@@ -1405,12 +1405,12 @@ DECLAREContigPutFunc(put16bitbwtile)
*/
DECLAREContigPutFunc(put1bitbwtile)
{
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) x; (void) y;
fromskew /= 8;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1422,12 +1422,12 @@ DECLAREContigPutFunc(put1bitbwtile)
*/
DECLAREContigPutFunc(put2bitbwtile)
{
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) x; (void) y;
fromskew /= 4;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1439,12 +1439,12 @@ DECLAREContigPutFunc(put2bitbwtile)
*/
DECLAREContigPutFunc(put4bitbwtile)
{
- uint32** BWmap = img->BWmap;
+ uint32_t** BWmap = img->BWmap;
(void) x; (void) y;
fromskew /= 2;
for( ; h > 0; --h) {
- uint32* bw;
+ uint32_t* bw;
UNROLL2(w, bw = BWmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
@@ -1498,8 +1498,8 @@ DECLAREContigPutFunc(putRGBUAcontig8bittile)
(void) y;
fromskew *= samplesperpixel;
for( ; h > 0; --h) {
- uint32 r, g, b, a;
- uint8* m;
+ uint32_t r, g, b, a;
+ uint8_t* m;
for (x = w; x > 0; --x) {
a = pp[3];
m = img->UaToAa+((size_t) a<<8);
@@ -1520,7 +1520,7 @@ DECLAREContigPutFunc(putRGBUAcontig8bittile)
DECLAREContigPutFunc(putRGBcontig16bittile)
{
int samplesperpixel = img->samplesperpixel;
- uint16 *wp = (uint16 *)pp;
+ uint16_t *wp = (uint16_t *)pp;
(void) y;
fromskew *= samplesperpixel;
for( ; h > 0; --h) {
@@ -1542,7 +1542,7 @@ DECLAREContigPutFunc(putRGBcontig16bittile)
DECLAREContigPutFunc(putRGBAAcontig16bittile)
{
int samplesperpixel = img->samplesperpixel;
- uint16 *wp = (uint16 *)pp;
+ uint16_t *wp = (uint16_t *)pp;
(void) y;
fromskew *= samplesperpixel;
for( ; h > 0; --h) {
@@ -1565,12 +1565,12 @@ DECLAREContigPutFunc(putRGBAAcontig16bittile)
DECLAREContigPutFunc(putRGBUAcontig16bittile)
{
int samplesperpixel = img->samplesperpixel;
- uint16 *wp = (uint16 *)pp;
+ uint16_t *wp = (uint16_t *)pp;
(void) y;
fromskew *= samplesperpixel;
for( ; h > 0; --h) {
- uint32 r,g,b,a;
- uint8* m;
+ uint32_t r,g,b,a;
+ uint8_t* m;
for (x = w; x > 0; --x) {
a = img->Bitdepth16To8[wp[3]];
m = img->UaToAa+((size_t) a<<8);
@@ -1593,7 +1593,7 @@ DECLAREContigPutFunc(putRGBUAcontig16bittile)
DECLAREContigPutFunc(putRGBcontig8bitCMYKtile)
{
int samplesperpixel = img->samplesperpixel;
- uint16 r, g, b, k;
+ uint16_t r, g, b, k;
(void) x; (void) y;
fromskew *= samplesperpixel;
@@ -1619,7 +1619,7 @@ DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
{
int samplesperpixel = img->samplesperpixel;
TIFFRGBValue* Map = img->Map;
- uint16 r, g, b, k;
+ uint16_t r, g, b, k;
(void) y;
fromskew *= samplesperpixel;
@@ -1640,10 +1640,10 @@ DECLAREContigPutFunc(putRGBcontig8bitCMYKMaptile)
#define DECLARESepPutFunc(name) \
static void name(\
TIFFRGBAImage* img,\
- uint32* cp,\
- uint32 x, uint32 y, \
- uint32 w, uint32 h,\
- int32 fromskew, int32 toskew,\
+ uint32_t* cp,\
+ uint32_t x, uint32_t y, \
+ uint32_t w, uint32_t h,\
+ int32_t fromskew, int32_t toskew,\
unsigned char* r, unsigned char* g, unsigned char* b, unsigned char* a\
)
@@ -1680,7 +1680,7 @@ DECLARESepPutFunc(putCMYKseparate8bittile)
{
(void) img; (void) y;
for( ; h > 0; --h) {
- uint32 rv, gv, bv, kv;
+ uint32_t rv, gv, bv, kv;
for (x = w; x > 0; --x) {
kv = 255 - *a++;
rv = (kv*(255-*r++))/255;
@@ -1700,8 +1700,8 @@ DECLARESepPutFunc(putRGBUAseparate8bittile)
{
(void) img; (void) y;
for( ; h > 0; --h) {
- uint32 rv, gv, bv, av;
- uint8* m;
+ uint32_t rv, gv, bv, av;
+ uint8_t* m;
for (x = w; x > 0; --x) {
av = *a++;
m = img->UaToAa+((size_t) av<<8);
@@ -1720,9 +1720,9 @@ DECLARESepPutFunc(putRGBUAseparate8bittile)
*/
DECLARESepPutFunc(putRGBseparate16bittile)
{
- uint16 *wr = (uint16*) r;
- uint16 *wg = (uint16*) g;
- uint16 *wb = (uint16*) b;
+ uint16_t *wr = (uint16_t*) r;
+ uint16_t *wg = (uint16_t*) g;
+ uint16_t *wb = (uint16_t*) b;
(void) img; (void) y; (void) a;
for( ; h > 0; --h) {
for (x = 0; x < w; x++)
@@ -1739,10 +1739,10 @@ DECLARESepPutFunc(putRGBseparate16bittile)
*/
DECLARESepPutFunc(putRGBAAseparate16bittile)
{
- uint16 *wr = (uint16*) r;
- uint16 *wg = (uint16*) g;
- uint16 *wb = (uint16*) b;
- uint16 *wa = (uint16*) a;
+ uint16_t *wr = (uint16_t*) r;
+ uint16_t *wg = (uint16_t*) g;
+ uint16_t *wb = (uint16_t*) b;
+ uint16_t *wa = (uint16_t*) a;
(void) img; (void) y;
for( ; h > 0; --h) {
for (x = 0; x < w; x++)
@@ -1760,14 +1760,14 @@ DECLARESepPutFunc(putRGBAAseparate16bittile)
*/
DECLARESepPutFunc(putRGBUAseparate16bittile)
{
- uint16 *wr = (uint16*) r;
- uint16 *wg = (uint16*) g;
- uint16 *wb = (uint16*) b;
- uint16 *wa = (uint16*) a;
+ uint16_t *wr = (uint16_t*) r;
+ uint16_t *wg = (uint16_t*) g;
+ uint16_t *wb = (uint16_t*) b;
+ uint16_t *wa = (uint16_t*) a;
(void) img; (void) y;
for( ; h > 0; --h) {
- uint32 r2,g2,b2,a2;
- uint8* m;
+ uint32_t r2,g2,b2,a2;
+ uint8_t* m;
for (x = w; x > 0; --x) {
a2 = img->Bitdepth16To8[*wa++];
m = img->UaToAa+((size_t) a2<<8);
@@ -1787,7 +1787,7 @@ DECLARESepPutFunc(putRGBUAseparate16bittile)
DECLAREContigPutFunc(putcontig8bitCIELab)
{
float X, Y, Z;
- uint32 r, g, b;
+ uint32_t r, g, b;
(void) y;
fromskew *= 3;
for( ; h > 0; --h) {
@@ -1811,7 +1811,7 @@ DECLAREContigPutFunc(putcontig8bitCIELab)
*/
#define YCbCrtoRGB(dst, Y) { \
- uint32 r, g, b; \
+ uint32_t r, g, b; \
TIFFYCbCrtoRGB(img->ycbcr, (Y), Cb, Cr, &r, &g, &b); \
dst = PACK(r, g, b); \
}
@@ -1827,20 +1827,20 @@ DECLAREContigPutFunc(putcontig8bitCIELab)
#ifdef notdef
static void putcontig8bitYCbCrGenericTile(
TIFFRGBAImage* img,
- uint32* cp,
- uint32 x, uint32 y,
- uint32 w, uint32 h,
- int32 fromskew, int32 toskew,
+ uint32_t* cp,
+ uint32_t x, uint32_t y,
+ uint32_t w, uint32_t h,
+ int32_t fromskew, int32_t toskew,
unsigned char* pp,
int h_group,
int v_group )
{
- uint32* cp1 = cp+w+toskew;
- uint32* cp2 = cp1+w+toskew;
- uint32* cp3 = cp2+w+toskew;
- int32 incr = 3*w+4*toskew;
- int32 Cb, Cr;
+ uint32_t* cp1 = cp+w+toskew;
+ uint32_t* cp2 = cp1+w+toskew;
+ uint32_t* cp3 = cp2+w+toskew;
+ int32_t incr = 3*w+4*toskew;
+ int32_t Cb, Cr;
int group_size = v_group * h_group + 2;
(void) y;
@@ -1897,10 +1897,10 @@ static void putcontig8bitYCbCrGenericTile(
*/
DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
{
- uint32* cp1 = cp+w+toskew;
- uint32* cp2 = cp1+w+toskew;
- uint32* cp3 = cp2+w+toskew;
- int32 incr = 3*w+4*toskew;
+ uint32_t* cp1 = cp + w + toskew;
+ uint32_t* cp2 = cp1 + w + toskew;
+ uint32_t* cp3 = cp2 + w + toskew;
+ int32_t incr = 3 * w + 4 * toskew;
(void) y;
/* adjust fromskew */
@@ -1909,8 +1909,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
for (; h >= 4; h -= 4) {
x = w>>2;
do {
- int32 Cb = pp[16];
- int32 Cr = pp[17];
+ int32_t Cb = pp[16];
+ int32_t Cr = pp[17];
YCbCrtoRGB(cp [0], pp[ 0]);
YCbCrtoRGB(cp [1], pp[ 1]);
@@ -1944,8 +1944,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
} else {
while (h > 0) {
for (x = w; x > 0;) {
- int32 Cb = pp[16];
- int32 Cr = pp[17];
+ int32_t Cb = pp[16];
+ int32_t Cr = pp[17];
switch (x) {
default:
switch (h) {
@@ -2003,8 +2003,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr44tile)
*/
DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
{
- uint32* cp1 = cp+w+toskew;
- int32 incr = 2*toskew+w;
+ uint32_t* cp1 = cp + w + toskew;
+ int32_t incr = 2 * toskew + w;
(void) y;
fromskew = (fromskew / 4) * (4*2+2);
@@ -2012,8 +2012,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
for (; h >= 2; h -= 2) {
x = w>>2;
do {
- int32 Cb = pp[8];
- int32 Cr = pp[9];
+ int32_t Cb = pp[8];
+ int32_t Cr = pp[9];
YCbCrtoRGB(cp [0], pp[0]);
YCbCrtoRGB(cp [1], pp[1]);
@@ -2035,8 +2035,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr42tile)
} else {
while (h > 0) {
for (x = w; x > 0;) {
- int32 Cb = pp[8];
- int32 Cr = pp[9];
+ int32_t Cb = pp[8];
+ int32_t Cr = pp[9];
switch (x) {
default:
switch (h) {
@@ -2089,8 +2089,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
do {
x = w>>2;
while(x>0) {
- int32 Cb = pp[4];
- int32 Cr = pp[5];
+ int32_t Cb = pp[4];
+ int32_t Cr = pp[5];
YCbCrtoRGB(cp [0], pp[0]);
YCbCrtoRGB(cp [1], pp[1]);
@@ -2104,8 +2104,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
if( (w&3) != 0 )
{
- int32 Cb = pp[4];
- int32 Cr = pp[5];
+ int32_t Cb = pp[4];
+ int32_t Cr = pp[5];
switch( (w&3) ) {
case 3: YCbCrtoRGB(cp [2], pp[2]); /*-fallthrough*/
@@ -2129,16 +2129,16 @@ DECLAREContigPutFunc(putcontig8bitYCbCr41tile)
*/
DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
{
- uint32* cp2;
- int32 incr = 2*toskew+w;
+ uint32_t* cp2;
+ int32_t incr = 2 * toskew + w;
(void) y;
fromskew = (fromskew / 2) * (2*2+2);
cp2 = cp+w+toskew;
while (h>=2) {
x = w;
while (x>=2) {
- uint32 Cb = pp[4];
- uint32 Cr = pp[5];
+ uint32_t Cb = pp[4];
+ uint32_t Cr = pp[5];
YCbCrtoRGB(cp[0], pp[0]);
YCbCrtoRGB(cp[1], pp[1]);
YCbCrtoRGB(cp2[0], pp[2]);
@@ -2149,8 +2149,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
x -= 2;
}
if (x==1) {
- uint32 Cb = pp[4];
- uint32 Cr = pp[5];
+ uint32_t Cb = pp[4];
+ uint32_t Cr = pp[5];
YCbCrtoRGB(cp[0], pp[0]);
YCbCrtoRGB(cp2[0], pp[2]);
cp ++ ;
@@ -2165,8 +2165,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
if (h==1) {
x = w;
while (x>=2) {
- uint32 Cb = pp[4];
- uint32 Cr = pp[5];
+ uint32_t Cb = pp[4];
+ uint32_t Cr = pp[5];
YCbCrtoRGB(cp[0], pp[0]);
YCbCrtoRGB(cp[1], pp[1]);
cp += 2;
@@ -2175,8 +2175,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr22tile)
x -= 2;
}
if (x==1) {
- uint32 Cb = pp[4];
- uint32 Cr = pp[5];
+ uint32_t Cb = pp[4];
+ uint32_t Cr = pp[5];
YCbCrtoRGB(cp[0], pp[0]);
}
}
@@ -2192,8 +2192,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
do {
x = w>>1;
while(x>0) {
- int32 Cb = pp[2];
- int32 Cr = pp[3];
+ int32_t Cb = pp[2];
+ int32_t Cr = pp[3];
YCbCrtoRGB(cp[0], pp[0]);
YCbCrtoRGB(cp[1], pp[1]);
@@ -2205,8 +2205,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
if( (w&1) != 0 )
{
- int32 Cb = pp[2];
- int32 Cr = pp[3];
+ int32_t Cb = pp[2];
+ int32_t Cr = pp[3];
YCbCrtoRGB(cp[0], pp[0]);
@@ -2224,16 +2224,16 @@ DECLAREContigPutFunc(putcontig8bitYCbCr21tile)
*/
DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
{
- uint32* cp2;
- int32 incr = 2*toskew+w;
+ uint32_t* cp2;
+ int32_t incr = 2 * toskew + w;
(void) y;
fromskew = (fromskew / 1) * (1 * 2 + 2);
cp2 = cp+w+toskew;
while (h>=2) {
x = w;
do {
- uint32 Cb = pp[2];
- uint32 Cr = pp[3];
+ uint32_t Cb = pp[2];
+ uint32_t Cr = pp[3];
YCbCrtoRGB(cp[0], pp[0]);
YCbCrtoRGB(cp2[0], pp[1]);
cp ++;
@@ -2248,8 +2248,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr12tile)
if (h==1) {
x = w;
do {
- uint32 Cb = pp[2];
- uint32 Cr = pp[3];
+ uint32_t Cb = pp[2];
+ uint32_t Cr = pp[3];
YCbCrtoRGB(cp[0], pp[0]);
cp ++;
pp += 4;
@@ -2267,8 +2267,8 @@ DECLAREContigPutFunc(putcontig8bitYCbCr11tile)
do {
x = w; /* was x = w>>1; patched 2000/09/25 warmerda@home.com */
do {
- int32 Cb = pp[1];
- int32 Cr = pp[2];
+ int32_t Cb = pp[1];
+ int32_t Cr = pp[2];
YCbCrtoRGB(*cp++, pp[0]);
@@ -2290,7 +2290,7 @@ DECLARESepPutFunc(putseparate8bitYCbCr11tile)
for( ; h > 0; --h) {
x = w;
do {
- uint32 dr, dg, db;
+ uint32_t dr, dg, db;
TIFFYCbCrtoRGB(img->ycbcr,*r++,*g++,*b++,&dr,&dg,&db);
*cp++ = PACK(dr,dg,db);
} while (--x);
@@ -2317,7 +2317,7 @@ initYCbCrConversion(TIFFRGBAImage* img)
TIFFroundup_32(sizeof (TIFFYCbCrToRGB), sizeof (long))
+ 4*256*sizeof (TIFFRGBValue)
+ 2*256*sizeof (int)
- + 3*256*sizeof (int32)
+ + 3*256*sizeof (int32_t)
);
if (img->ycbcr == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, module,
@@ -2412,18 +2412,18 @@ makebwmap(TIFFRGBAImage* img)
int bitspersample = img->bitspersample;
int nsamples = 8 / bitspersample;
int i;
- uint32* p;
+ uint32_t* p;
if( nsamples == 0 )
nsamples = 1;
- img->BWmap = (uint32**) _TIFFmalloc(
- 256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
+ img->BWmap = (uint32_t**) _TIFFmalloc(
+ 256*sizeof (uint32_t *) + (256 * nsamples * sizeof(uint32_t)));
if (img->BWmap == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for B&W mapping table");
return (0);
}
- p = (uint32*)(img->BWmap + 256);
+ p = (uint32_t*)(img->BWmap + 256);
for (i = 0; i < 256; i++) {
TIFFRGBValue c;
img->BWmap[i] = p;
@@ -2467,13 +2467,13 @@ makebwmap(TIFFRGBAImage* img)
static int
setupMap(TIFFRGBAImage* img)
{
- int32 x, range;
+ int32_t x, range;
- range = (int32)((1L<<img->bitspersample)-1);
+ range = (int32_t)((1L << img->bitspersample) - 1);
/* treat 16 bit the same as eight bit */
if( img->bitspersample == 16 )
- range = (int32) 255;
+ range = (int32_t) 255;
img->Map = (TIFFRGBValue*) _TIFFmalloc((range+1) * sizeof (TIFFRGBValue));
if (img->Map == NULL) {
@@ -2507,9 +2507,9 @@ setupMap(TIFFRGBAImage* img)
static int
checkcmap(TIFFRGBAImage* img)
{
- uint16* r = img->redcmap;
- uint16* g = img->greencmap;
- uint16* b = img->bluecmap;
+ uint16_t* r = img->redcmap;
+ uint16_t* g = img->greencmap;
+ uint16_t* b = img->bluecmap;
long n = 1L<<img->bitspersample;
while (n-- > 0)
@@ -2521,13 +2521,13 @@ checkcmap(TIFFRGBAImage* img)
static void
cvtcmap(TIFFRGBAImage* img)
{
- uint16* r = img->redcmap;
- uint16* g = img->greencmap;
- uint16* b = img->bluecmap;
+ uint16_t* r = img->redcmap;
+ uint16_t* g = img->greencmap;
+ uint16_t* b = img->bluecmap;
long i;
for (i = (1L<<img->bitspersample)-1; i >= 0; i--) {
-#define CVT(x) ((uint16)((x)>>8))
+#define CVT(x) ((uint16_t)((x)>>8))
r[i] = CVT(r[i]);
g[i] = CVT(g[i]);
b[i] = CVT(b[i]);
@@ -2547,19 +2547,19 @@ makecmap(TIFFRGBAImage* img)
{
int bitspersample = img->bitspersample;
int nsamples = 8 / bitspersample;
- uint16* r = img->redcmap;
- uint16* g = img->greencmap;
- uint16* b = img->bluecmap;
- uint32 *p;
+ uint16_t* r = img->redcmap;
+ uint16_t* g = img->greencmap;
+ uint16_t* b = img->bluecmap;
+ uint32_t *p;
int i;
- img->PALmap = (uint32**) _TIFFmalloc(
- 256*sizeof (uint32 *)+(256*nsamples*sizeof(uint32)));
+ img->PALmap = (uint32_t**) _TIFFmalloc(
+ 256*sizeof (uint32_t *) + (256 * nsamples * sizeof(uint32_t)));
if (img->PALmap == NULL) {
TIFFErrorExt(img->tif->tif_clientdata, TIFFFileName(img->tif), "No space for Palette mapping table");
return (0);
}
- p = (uint32*)(img->PALmap + 256);
+ p = (uint32_t*)(img->PALmap + 256);
for (i = 0; i < 256; i++) {
TIFFRGBValue c;
img->PALmap[i] = p;
@@ -2746,8 +2746,8 @@ PickContigCase(TIFFRGBAImage* img)
* Joris: added support for the [1,2] case, nonetheless, to accommodate
* some OJPEG files
*/
- uint16 SubsamplingHor;
- uint16 SubsamplingVer;
+ uint16_t SubsamplingHor;
+ uint16_t SubsamplingVer;
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &SubsamplingHor, &SubsamplingVer);
switch ((SubsamplingHor<<4)|SubsamplingVer) {
case 0x44:
@@ -2845,7 +2845,7 @@ PickSeparateCase(TIFFRGBAImage* img)
{
if (initYCbCrConversion(img)!=0)
{
- uint16 hs, vs;
+ uint16_t hs, vs;
TIFFGetFieldDefaulted(img->tif, TIFFTAG_YCBCRSUBSAMPLING, &hs, &vs);
switch ((hs<<4)|vs) {
case 0x11:
@@ -2864,8 +2864,8 @@ static int
BuildMapUaToAa(TIFFRGBAImage* img)
{
static const char module[]="BuildMapUaToAa";
- uint8* m;
- uint16 na,nv;
+ uint8_t* m;
+ uint16_t na,nv;
assert(img->UaToAa==NULL);
img->UaToAa=_TIFFmalloc(65536);
if (img->UaToAa==NULL)
@@ -2877,7 +2877,7 @@ BuildMapUaToAa(TIFFRGBAImage* img)
for (na=0; na<256; na++)
{
for (nv=0; nv<256; nv++)
- *m++=(uint8)((nv*na+127)/255);
+ *m++=(uint8_t)((nv * na + 127) / 255);
}
return(1);
}
@@ -2886,8 +2886,8 @@ static int
BuildMapBitdepth16To8(TIFFRGBAImage* img)
{
static const char module[]="BuildMapBitdepth16To8";
- uint8* m;
- uint32 n;
+ uint8_t* m;
+ uint32_t n;
assert(img->Bitdepth16To8==NULL);
img->Bitdepth16To8=_TIFFmalloc(65536);
if (img->Bitdepth16To8==NULL)
@@ -2897,7 +2897,7 @@ BuildMapBitdepth16To8(TIFFRGBAImage* img)
}
m=img->Bitdepth16To8;
for (n=0; n<65536; n++)
- *m++=(uint8)((n+128)/257);
+ *m++=(uint8_t)((n + 128) / 257);
return(1);
}
@@ -2911,20 +2911,20 @@ BuildMapBitdepth16To8(TIFFRGBAImage* img)
int
-TIFFReadRGBAStrip(TIFF* tif, uint32 row, uint32 * raster )
+TIFFReadRGBAStrip(TIFF* tif, uint32_t row, uint32_t * raster )
{
return TIFFReadRGBAStripExt(tif, row, raster, 0 );
}
int
-TIFFReadRGBAStripExt(TIFF* tif, uint32 row, uint32 * raster, int stop_on_error)
+TIFFReadRGBAStripExt(TIFF* tif, uint32_t row, uint32_t * raster, int stop_on_error)
{
char emsg[1024] = "";
TIFFRGBAImage img;
int ok;
- uint32 rowsperstrip, rows_to_read;
+ uint32_t rowsperstrip, rows_to_read;
if( TIFFIsTiled( tif ) )
{
@@ -2969,7 +2969,7 @@ TIFFReadRGBAStripExt(TIFF* tif, uint32 row, uint32 * raster, int stop_on_error)
*/
int
-TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
+TIFFReadRGBATile(TIFF* tif, uint32_t col, uint32_t row, uint32_t * raster)
{
return TIFFReadRGBATileExt(tif, col, row, raster, 0 );
@@ -2977,14 +2977,14 @@ TIFFReadRGBATile(TIFF* tif, uint32 col, uint32 row, uint32 * raster)
int
-TIFFReadRGBATileExt(TIFF* tif, uint32 col, uint32 row, uint32 * raster, int stop_on_error )
+TIFFReadRGBATileExt(TIFF* tif, uint32_t col, uint32_t row, uint32_t * raster, int stop_on_error )
{
char emsg[1024] = "";
TIFFRGBAImage img;
int ok;
- uint32 tile_xsize, tile_ysize;
- uint32 read_xsize, read_ysize;
- uint32 i_row;
+ uint32_t tile_xsize, tile_ysize;
+ uint32_t read_xsize, read_ysize;
+ uint32_t i_row;
/*
* Verify that our request is legal - on a tile file, and on a
@@ -3060,14 +3060,14 @@ TIFFReadRGBATileExt(TIFF* tif, uint32 col, uint32 row, uint32 * raster, int stop
for( i_row = 0; i_row < read_ysize; i_row++ ) {
memmove( raster + (tile_ysize - i_row - 1) * tile_xsize,
raster + (read_ysize - i_row - 1) * read_xsize,
- read_xsize * sizeof(uint32) );
+ read_xsize * sizeof(uint32_t) );
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize+read_xsize,
- 0, sizeof(uint32) * (tile_xsize - read_xsize) );
+ 0, sizeof(uint32_t) * (tile_xsize - read_xsize) );
}
for( i_row = read_ysize; i_row < tile_ysize; i_row++ ) {
_TIFFmemset( raster + (tile_ysize - i_row - 1) * tile_xsize,
- 0, sizeof(uint32) * tile_xsize );
+ 0, sizeof(uint32_t) * tile_xsize );
}
return (ok);
diff --git a/libtiff/tif_jbig.c b/libtiff/tif_jbig.c
index a3500e0b..58ef8fe6 100644
--- a/libtiff/tif_jbig.c
+++ b/libtiff/tif_jbig.c
@@ -46,7 +46,7 @@ static int JBIGSetupDecode(TIFF* tif)
return 1;
}
-static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
+static int JBIGDecode(TIFF* tif, uint8_t* buffer, tmsize_t size, uint16_t s)
{
struct jbg_dec_state decoder;
int decodeStatus = 0;
@@ -133,7 +133,7 @@ static int JBIGSetupEncode(TIFF* tif)
return 1;
}
-static int JBIGCopyEncodedData(TIFF* tif, unsigned char* pp, size_t cc, uint16 s)
+static int JBIGCopyEncodedData(TIFF* tif, unsigned char* pp, size_t cc, uint16_t s)
{
(void) s;
while (cc > 0)
@@ -173,7 +173,7 @@ static void JBIGOutputBie(unsigned char* buffer, size_t len, void* userData)
JBIGCopyEncodedData(tif, buffer, len, 0);
}
-static int JBIGEncode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
+static int JBIGEncode(TIFF* tif, uint8_t* buffer, tmsize_t size, uint16_t s)
{
TIFFDirectory* dir = &tif->tif_dir;
struct jbg_enc_state encoder;
diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
index 6711137a..ae5716e8 100644
--- a/libtiff/tif_jpeg.c
+++ b/libtiff/tif_jpeg.c
@@ -44,8 +44,8 @@
*/
#include <setjmp.h>
-int TIFFFillStrip(TIFF* tif, uint32 strip);
-int TIFFFillTile(TIFF* tif, uint32 tile);
+int TIFFFillStrip(TIFF* tif, uint32_t strip);
+int TIFFFillTile(TIFF* tif, uint32_t tile);
int TIFFReInitJPEG_12( TIFF *tif, int scheme, int is_encode );
int TIFFJPEGIsFullStripRequired_12(TIFF* tif);
@@ -156,9 +156,9 @@ typedef struct {
jpeg_source_mgr src; /* data source for decompression */
/* private state */
TIFF* tif; /* back link needed by some code */
- uint16 photometric; /* copy of PhotometricInterpretation */
- uint16 h_sampling; /* luminance sampling factors */
- uint16 v_sampling;
+ uint16_t photometric; /* copy of PhotometricInterpretation */
+ uint16_t h_sampling; /* luminance sampling factors */
+ uint16_t v_sampling;
tmsize_t bytesperline; /* decompressed bytes per scanline */
/* pointers to intermediate buffers when processing downsampled data */
JSAMPARRAY ds_buffer[MAX_COMPONENTS];
@@ -172,7 +172,7 @@ typedef struct {
TIFFTileMethod deftparent; /* super-class method */
/* pseudo-tag fields */
void* jpegtables; /* JPEGTables tag value, or NULL */
- uint32 jpegtables_length; /* number of bytes in same */
+ uint32_t jpegtables_length; /* number of bytes in same */
int jpegquality; /* Compression quality level */
int jpegcolormode; /* Auto RGB<=>YCbCr convert? */
int jpegtablesmode; /* What to put in JPEGTables */
@@ -183,12 +183,12 @@ typedef struct {
#define JState(tif) ((JPEGState*)(tif)->tif_data)
-static int JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
-static int JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
-static int JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
-static int JPEGEncodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
+static int JPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
+static int JPEGDecodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
+static int JPEGEncode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
+static int JPEGEncodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
static int JPEGInitializeLibJPEG(TIFF * tif, int decode );
-static int DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
+static int DecodeRowError(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
#define FIELD_JPEGTABLES (FIELD_CODEC+0)
@@ -480,7 +480,7 @@ std_term_destination(j_compress_ptr cinfo)
JPEGState* sp = (JPEGState*) cinfo;
TIFF* tif = sp->tif;
- tif->tif_rawcp = (uint8*) sp->dest.next_output_byte;
+ tif->tif_rawcp = (uint8_t*) sp->dest.next_output_byte;
tif->tif_rawcc =
tif->tif_rawdatasize - (tmsize_t) sp->dest.free_in_buffer;
/* NB: libtiff does the final buffer flush */
@@ -534,7 +534,7 @@ tables_term_destination(j_compress_ptr cinfo)
JPEGState* sp = (JPEGState*) cinfo;
/* set tables length to number of bytes actually emitted */
- sp->jpegtables_length -= (uint32) sp->dest.free_in_buffer;
+ sp->jpegtables_length -= (uint32_t) sp->dest.free_in_buffer;
}
static int
@@ -724,18 +724,18 @@ struct JPEGFixupTagsSubsamplingData
{
TIFF* tif;
void* buffer;
- uint32 buffersize;
- uint8* buffercurrentbyte;
- uint32 bufferbytesleft;
- uint64 fileoffset;
- uint64 filebytesleft;
- uint8 filepositioned;
+ uint32_t buffersize;
+ uint8_t* buffercurrentbyte;
+ uint32_t bufferbytesleft;
+ uint64_t fileoffset;
+ uint64_t filebytesleft;
+ uint8_t filepositioned;
};
static void JPEGFixupTagsSubsampling(TIFF* tif);
static int JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data);
-static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result);
-static int JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result);
-static void JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength);
+static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8_t* result);
+static int JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16_t* result);
+static void JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16_t skiplength);
#endif
@@ -781,7 +781,7 @@ JPEGFixupTagsSubsampling(TIFF* tif)
*/
static const char module[] = "JPEGFixupTagsSubsampling";
struct JPEGFixupTagsSubsamplingData m;
- uint64 fileoffset = TIFFGetStrileOffset(tif, 0);
+ uint64_t fileoffset = TIFFGetStrileOffset(tif, 0);
if( fileoffset == 0 )
{
@@ -815,7 +815,7 @@ static int
JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data)
{
static const char module[] = "JPEGFixupTagsSubsamplingSec";
- uint8 m;
+ uint8_t m;
while (1)
{
while (1)
@@ -860,7 +860,7 @@ JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data)
case JPEG_MARKER_DRI:
/* this type of marker has data, but it has no use to us and should be skipped */
{
- uint16 n;
+ uint16_t n;
if (!JPEGFixupTagsSubsamplingReadWord(data,&n))
return(0);
if (n<2)
@@ -877,10 +877,10 @@ JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data)
case JPEG_MARKER_SOF10: /* Progressive arithmetic: normally not allowed by TechNote, but that doesn't hurt supporting it */
/* this marker contains the subsampling factors we're scanning for */
{
- uint16 n;
- uint16 o;
- uint8 p;
- uint8 ph,pv;
+ uint16_t n;
+ uint16_t o;
+ uint8_t p;
+ uint8_t ph,pv;
if (!JPEGFixupTagsSubsamplingReadWord(data,&n))
return(0);
if (n!=8+data->tif->tif_dir.td_samplesperpixel*3)
@@ -929,11 +929,11 @@ JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data)
}
static int
-JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
+JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8_t* result)
{
if (data->bufferbytesleft==0)
{
- uint32 m;
+ uint32_t m;
if (data->filebytesleft==0)
return(0);
if (!data->filepositioned)
@@ -945,8 +945,8 @@ JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint
data->filepositioned=1;
}
m=data->buffersize;
- if ((uint64)m>data->filebytesleft)
- m=(uint32)data->filebytesleft;
+ if ((uint64_t)m > data->filebytesleft)
+ m=(uint32_t)data->filebytesleft;
assert(m<0x80000000UL);
if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m)
return(0);
@@ -962,10 +962,10 @@ JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint
}
static int
-JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result)
+JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16_t* result)
{
- uint8 ma;
- uint8 mb;
+ uint8_t ma;
+ uint8_t mb;
if (!JPEGFixupTagsSubsamplingReadByte(data,&ma))
return(0);
if (!JPEGFixupTagsSubsamplingReadByte(data,&mb))
@@ -975,17 +975,17 @@ JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint
}
static void
-JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength)
+JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16_t skiplength)
{
- if ((uint32)skiplength<=data->bufferbytesleft)
+ if ((uint32_t)skiplength <= data->bufferbytesleft)
{
data->buffercurrentbyte+=skiplength;
data->bufferbytesleft-=skiplength;
}
else
{
- uint16 m;
- m=(uint16)(skiplength-data->bufferbytesleft);
+ uint16_t m;
+ m=(uint16_t)(skiplength - data->bufferbytesleft);
if (m<=data->filebytesleft)
{
data->bufferbytesleft=0;
@@ -1089,12 +1089,12 @@ int TIFFJPEGIsFullStripRequired(TIFF* tif)
* Set up for decoding a strip or tile.
*/
/*ARGSUSED*/ static int
-JPEGPreDecode(TIFF* tif, uint16 s)
+JPEGPreDecode(TIFF* tif, uint16_t s)
{
JPEGState *sp = JState(tif);
TIFFDirectory *td = &tif->tif_dir;
static const char module[] = "JPEGPreDecode";
- uint32 segment_width, segment_height;
+ uint32_t segment_width, segment_height;
int downsampled_output;
int ci;
@@ -1119,7 +1119,7 @@ JPEGPreDecode(TIFF* tif, uint16 s)
if (TIFFjpeg_read_header(sp, TRUE) != JPEG_HEADER_OK)
return (0);
- tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
+ tif->tif_rawcp = (uint8_t*) sp->src.next_input_byte;
tif->tif_rawcc = sp->src.bytes_in_buffer;
/*
@@ -1323,7 +1323,7 @@ JPEGPreDecode(TIFF* tif, uint16 s)
*/
#if !JPEG_LIB_MK1_OR_12BIT
static int
-JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+JPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
JPEGState *sp = JState(tif);
tmsize_t nrows;
@@ -1368,7 +1368,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
}
/* Update information on consumed data */
- tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
+ tif->tif_rawcp = (uint8_t*) sp->src.next_input_byte;
tif->tif_rawcc = sp->src.bytes_in_buffer;
/* Close down the decompressor if we've finished the strip or tile. */
@@ -1379,7 +1379,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
#if JPEG_LIB_MK1_OR_12BIT
/*ARGSUSED*/ static int
-JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+JPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
JPEGState *sp = JState(tif);
tmsize_t nrows;
@@ -1474,7 +1474,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
}
/* Update information on consumed data */
- tif->tif_rawcp = (uint8*) sp->src.next_input_byte;
+ tif->tif_rawcp = (uint8_t*) sp->src.next_input_byte;
tif->tif_rawcc = sp->src.bytes_in_buffer;
/* Close down the decompressor if we've finished the strip or tile. */
@@ -1484,7 +1484,7 @@ JPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
#endif /* JPEG_LIB_MK1_OR_12BIT */
/*ARGSUSED*/ static int
-DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+DecodeRowError(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
(void) buf;
@@ -1501,7 +1501,7 @@ DecodeRowError(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
* Returned data is downsampled per sampling factors.
*/
/*ARGSUSED*/ static int
-JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+JPEGDecodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
JPEGState *sp = JState(tif);
tmsize_t nrows;
@@ -1512,7 +1512,7 @@ JPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
/* For last strip, limit number of rows to its truncated height */
/* even if the codestream height is larger (which is not compliant, */
/* but that we tolerate) */
- if( (uint32)nrows > td->td_imagelength - tif->tif_row && !isTiled(tif) )
+ if((uint32_t)nrows > td->td_imagelength - tif->tif_row && !isTiled(tif) )
nrows = td->td_imagelength - tif->tif_row;
/* data is expected to be read in multiples of a scanline */
@@ -1897,12 +1897,12 @@ JPEGSetupEncode(TIFF* tif)
* Set encoding state at the start of a strip or tile.
*/
static int
-JPEGPreEncode(TIFF* tif, uint16 s)
+JPEGPreEncode(TIFF* tif, uint16_t s)
{
JPEGState *sp = JState(tif);
TIFFDirectory *td = &tif->tif_dir;
static const char module[] = "JPEGPreEncode";
- uint32 segment_width, segment_height;
+ uint32_t segment_width, segment_height;
int downsampled_input;
assert(sp != NULL);
@@ -2034,7 +2034,7 @@ JPEGPreEncode(TIFF* tif, uint16 s)
* "Standard" case: incoming data is not downsampled.
*/
static int
-JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+JPEGEncode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
JPEGState *sp = JState(tif);
tmsize_t nrows;
@@ -2112,7 +2112,7 @@ JPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
* Incoming data is expected to be downsampled per sampling factors.
*/
static int
-JPEGEncodeRaw(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+JPEGEncodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
JPEGState *sp = JState(tif);
JSAMPLE* inptr;
@@ -2286,17 +2286,17 @@ JPEGResetUpsampled( TIFF* tif )
}
static int
-JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
+JPEGVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
JPEGState* sp = JState(tif);
const TIFFField* fip;
- uint32 v32;
+ uint32_t v32;
assert(sp != NULL);
switch (tag) {
case TIFFTAG_JPEGTABLES:
- v32 = (uint32) va_arg(ap, uint32);
+ v32 = (uint32_t) va_arg(ap, uint32_t);
if (v32 == 0) {
/* XXX */
return (0);
@@ -2341,7 +2341,7 @@ JPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-JPEGVGetField(TIFF* tif, uint32 tag, va_list ap)
+JPEGVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
JPEGState* sp = JState(tif);
@@ -2349,7 +2349,7 @@ JPEGVGetField(TIFF* tif, uint32 tag, va_list ap)
switch (tag) {
case TIFFTAG_JPEGTABLES:
- *va_arg(ap, uint32*) = sp->jpegtables_length;
+ *va_arg(ap, uint32_t*) = sp->jpegtables_length;
*va_arg(ap, const void**) = sp->jpegtables;
break;
case TIFFTAG_JPEGQUALITY:
@@ -2384,8 +2384,8 @@ JPEGPrintDir(TIFF* tif, FILE* fd, long flags)
}
}
-static uint32
-JPEGDefaultStripSize(TIFF* tif, uint32 s)
+static uint32_t
+JPEGDefaultStripSize(TIFF* tif, uint32_t s)
{
JPEGState* sp = JState(tif);
TIFFDirectory *td = &tif->tif_dir;
@@ -2397,7 +2397,7 @@ JPEGDefaultStripSize(TIFF* tif, uint32 s)
}
static void
-JPEGDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+JPEGDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th)
{
JPEGState* sp = JState(tif);
TIFFDirectory *td = &tif->tif_dir;
@@ -2501,7 +2501,7 @@ TIFFInitJPEG(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof (JPEGState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (JPEGState));
if (tif->tif_data == NULL) {
TIFFErrorExt(tif->tif_clientdata,
diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
index 3bd02e88..d1b9257e 100644
--- a/libtiff/tif_luv.c
+++ b/libtiff/tif_luv.c
@@ -161,9 +161,9 @@ struct logLuvState {
int encode_meth; /* encoding method */
int pixel_size; /* bytes per pixel */
- uint8* tbuf; /* translation buffer */
+ uint8_t* tbuf; /* translation buffer */
tmsize_t tbuflen; /* buffer length */
- void (*tfunc)(LogLuvState*, uint8*, tmsize_t);
+ void (*tfunc)(LogLuvState*, uint8_t*, tmsize_t);
TIFFVSetMethod vgetparent; /* super-class method */
TIFFVSetMethod vsetparent; /* super-class method */
@@ -180,7 +180,7 @@ struct logLuvState {
* Decode a string of 16-bit gray pixels.
*/
static int
-LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+LogL16Decode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "LogL16Decode";
LogLuvState* sp = DecoderState(tif);
@@ -188,8 +188,8 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t i;
tmsize_t npixels;
unsigned char* bp;
- int16* tp;
- int16 b;
+ int16_t* tp;
+ int16_t b;
tmsize_t cc;
int rc;
@@ -200,14 +200,14 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
npixels = occ / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
- tp = (int16*) op;
+ tp = (int16_t*) op;
else {
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
return (0);
}
- tp = (int16*) sp->tbuf;
+ tp = (int16_t*) sp->tbuf;
}
_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
@@ -220,14 +220,14 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
if( cc < 2 )
break;
rc = *bp++ + (2-128);
- b = (int16)(*bp++ << shft);
+ b = (int16_t)(*bp++ << shft);
cc -= 2;
while (rc-- && i < npixels)
tp[i++] |= b;
} else { /* non-run */
rc = *bp++; /* nul is noop */
while (--cc && rc-- && i < npixels)
- tp[i++] |= (int16)*bp++ << shft;
+ tp[i++] |= (int16_t)*bp++ << shft;
}
}
if (i != npixels) {
@@ -242,13 +242,13 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
(unsigned long) tif->tif_row,
(unsigned long long) (npixels - i));
#endif
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
return (0);
}
}
(*sp->tfunc)(sp, op, npixels);
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
return (1);
}
@@ -257,7 +257,7 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
* Decode a string of 24-bit pixels.
*/
static int
-LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+LogLuvDecode24(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "LogLuvDecode24";
LogLuvState* sp = DecoderState(tif);
@@ -265,7 +265,7 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t i;
tmsize_t npixels;
unsigned char* bp;
- uint32* tp;
+ uint32_t* tp;
(void)s;
assert(s == 0);
@@ -274,16 +274,16 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
npixels = occ / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32 *)op;
+ tp = (uint32_t *)op;
else {
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
return (0);
}
- tp = (uint32 *) sp->tbuf;
+ tp = (uint32_t *) sp->tbuf;
}
- /* copy to array of uint32 */
+ /* copy to array of uint32_t */
bp = (unsigned char*) tif->tif_rawcp;
cc = tif->tif_rawcc;
for (i = 0; i < npixels && cc >= 3; i++) {
@@ -291,7 +291,7 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp += 3;
cc -= 3;
}
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
if (i != npixels) {
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
@@ -315,7 +315,7 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
* Decode a string of 32-bit pixels.
*/
static int
-LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+LogLuvDecode32(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "LogLuvDecode32";
LogLuvState* sp;
@@ -323,8 +323,8 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t i;
tmsize_t npixels;
unsigned char* bp;
- uint32* tp;
- uint32 b;
+ uint32_t* tp;
+ uint32_t b;
tmsize_t cc;
int rc;
@@ -336,14 +336,14 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
npixels = occ / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32*) op;
+ tp = (uint32_t*) op;
else {
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
return (0);
}
- tp = (uint32*) sp->tbuf;
+ tp = (uint32_t*) sp->tbuf;
}
_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
@@ -356,14 +356,14 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
if( cc < 2 )
break;
rc = *bp++ + (2-128);
- b = (uint32)*bp++ << shft;
+ b = (uint32_t)*bp++ << shft;
cc -= 2;
while (rc-- && i < npixels)
tp[i++] |= b;
} else { /* non-run */
rc = *bp++; /* nul is noop */
while (--cc && rc-- && i < npixels)
- tp[i++] |= (uint32)*bp++ << shft;
+ tp[i++] |= (uint32_t)*bp++ << shft;
}
}
if (i != npixels) {
@@ -378,13 +378,13 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
(unsigned long) tif->tif_row,
(unsigned long long) (npixels - i));
#endif
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
return (0);
}
}
(*sp->tfunc)(sp, op, npixels);
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
return (1);
}
@@ -395,7 +395,7 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
* is row by row.
*/
static int
-LogLuvDecodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvDecodeStrip(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
tmsize_t rowlen = TIFFScanlineSize(tif);
@@ -416,7 +416,7 @@ LogLuvDecodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* is row by row.
*/
static int
-LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvDecodeTile(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
tmsize_t rowlen = TIFFTileRowSize(tif);
@@ -435,7 +435,7 @@ LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* Encode a row of 16-bit pixels.
*/
static int
-LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogL16Encode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "LogL16Encode";
LogLuvState* sp = EncoderState(tif);
@@ -443,9 +443,9 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
tmsize_t i;
tmsize_t j;
tmsize_t npixels;
- uint8* op;
- int16* tp;
- int16 b;
+ uint8_t* op;
+ int16_t* tp;
+ int16_t b;
tmsize_t occ;
int rc=0, mask;
tmsize_t beg;
@@ -456,9 +456,9 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
npixels = cc / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
- tp = (int16*) bp;
+ tp = (int16_t*) bp;
else {
- tp = (int16*) sp->tbuf;
+ tp = (int16_t*) sp->tbuf;
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
@@ -481,7 +481,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
mask = 0xff << shft; /* find next run */
for (beg = i; beg < npixels; beg += rc) {
- b = (int16) (tp[beg] & mask);
+ b = (int16_t) (tp[beg] & mask);
rc = 1;
while (rc < 127+2 && beg+rc < npixels &&
(tp[beg+rc] & mask) == b)
@@ -490,12 +490,12 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
break; /* long enough */
}
if (beg-i > 1 && beg-i < MINRUN) {
- b = (int16) (tp[i] & mask);/*check short run */
+ b = (int16_t) (tp[i] & mask);/*check short run */
j = i+1;
while ((tp[j++] & mask) == b)
if (j == beg) {
- *op++ = (uint8)(128-2+j-i);
- *op++ = (uint8)(b >> shft);
+ *op++ = (uint8_t)(128 - 2 + j - i);
+ *op++ = (uint8_t)(b >> shft);
occ -= 2;
i = beg;
break;
@@ -511,15 +511,15 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
op = tif->tif_rawcp;
occ = tif->tif_rawdatasize - tif->tif_rawcc;
}
- *op++ = (uint8) j; occ--;
+ *op++ = (uint8_t) j; occ--;
while (j--) {
- *op++ = (uint8) (tp[i++] >> shft & 0xff);
+ *op++ = (uint8_t) (tp[i++] >> shft & 0xff);
occ--;
}
}
if (rc >= MINRUN) { /* write out run */
- *op++ = (uint8) (128-2+rc);
- *op++ = (uint8) (tp[beg] >> shft & 0xff);
+ *op++ = (uint8_t) (128 - 2 + rc);
+ *op++ = (uint8_t) (tp[beg] >> shft & 0xff);
occ -= 2;
} else
rc = 0;
@@ -535,15 +535,15 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* Encode a row of 24-bit pixels.
*/
static int
-LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvEncode24(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "LogLuvEncode24";
LogLuvState* sp = EncoderState(tif);
tmsize_t i;
tmsize_t npixels;
tmsize_t occ;
- uint8* op;
- uint32* tp;
+ uint8_t* op;
+ uint32_t* tp;
(void)s;
assert(s == 0);
@@ -551,9 +551,9 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
npixels = cc / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32*) bp;
+ tp = (uint32_t*) bp;
else {
- tp = (uint32*) sp->tbuf;
+ tp = (uint32_t*) sp->tbuf;
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
@@ -573,9 +573,9 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
op = tif->tif_rawcp;
occ = tif->tif_rawdatasize - tif->tif_rawcc;
}
- *op++ = (uint8)(*tp >> 16);
- *op++ = (uint8)(*tp >> 8 & 0xff);
- *op++ = (uint8)(*tp++ & 0xff);
+ *op++ = (uint8_t)(*tp >> 16);
+ *op++ = (uint8_t)(*tp >> 8 & 0xff);
+ *op++ = (uint8_t)(*tp++ & 0xff);
occ -= 3;
}
tif->tif_rawcp = op;
@@ -588,7 +588,7 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* Encode a row of 32-bit pixels.
*/
static int
-LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvEncode32(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "LogLuvEncode32";
LogLuvState* sp = EncoderState(tif);
@@ -596,9 +596,9 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
tmsize_t i;
tmsize_t j;
tmsize_t npixels;
- uint8* op;
- uint32* tp;
- uint32 b;
+ uint8_t* op;
+ uint32_t* tp;
+ uint32_t b;
tmsize_t occ;
int rc=0, mask;
tmsize_t beg;
@@ -610,9 +610,9 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
npixels = cc / sp->pixel_size;
if (sp->user_datafmt == SGILOGDATAFMT_RAW)
- tp = (uint32*) bp;
+ tp = (uint32_t*) bp;
else {
- tp = (uint32*) sp->tbuf;
+ tp = (uint32_t*) sp->tbuf;
if(sp->tbuflen < npixels) {
TIFFErrorExt(tif->tif_clientdata, module,
"Translation buffer too short");
@@ -648,8 +648,8 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
j = i+1;
while ((tp[j++] & mask) == b)
if (j == beg) {
- *op++ = (uint8)(128-2+j-i);
- *op++ = (uint8)(b >> shft);
+ *op++ = (uint8_t)(128 - 2 + j - i);
+ *op++ = (uint8_t)(b >> shft);
occ -= 2;
i = beg;
break;
@@ -665,15 +665,15 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
op = tif->tif_rawcp;
occ = tif->tif_rawdatasize - tif->tif_rawcc;
}
- *op++ = (uint8) j; occ--;
+ *op++ = (uint8_t) j; occ--;
while (j--) {
- *op++ = (uint8)(tp[i++] >> shft & 0xff);
+ *op++ = (uint8_t)(tp[i++] >> shft & 0xff);
occ--;
}
}
if (rc >= MINRUN) { /* write out run */
- *op++ = (uint8) (128-2+rc);
- *op++ = (uint8)(tp[beg] >> shft & 0xff);
+ *op++ = (uint8_t) (128 - 2 + rc);
+ *op++ = (uint8_t)(tp[beg] >> shft & 0xff);
occ -= 2;
} else
rc = 0;
@@ -690,7 +690,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* avoid encoding runs across row boundaries.
*/
static int
-LogLuvEncodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvEncodeStrip(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
tmsize_t rowlen = TIFFScanlineSize(tif);
@@ -710,7 +710,7 @@ LogLuvEncodeStrip(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
* avoid encoding runs across row boundaries.
*/
static int
-LogLuvEncodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LogLuvEncodeTile(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
tmsize_t rowlen = TIFFTileRowSize(tif);
@@ -790,9 +790,9 @@ LogL16fromY(double Y, int em) /* get 16-bit LogL from Y */
}
static void
-L16toY(LogLuvState* sp, uint8* op, tmsize_t n)
+L16toY(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- int16* l16 = (int16*) sp->tbuf;
+ int16_t* l16 = (int16_t*) sp->tbuf;
float* yp = (float*) op;
while (n-- > 0)
@@ -800,32 +800,32 @@ L16toY(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-L16toGry(LogLuvState* sp, uint8* op, tmsize_t n)
+L16toGry(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- int16* l16 = (int16*) sp->tbuf;
- uint8* gp = (uint8*) op;
+ int16_t* l16 = (int16_t*) sp->tbuf;
+ uint8_t* gp = (uint8_t*) op;
while (n-- > 0) {
double Y = LogL16toY(*l16++);
- *gp++ = (uint8) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256.*sqrt(Y)));
+ *gp++ = (uint8_t) ((Y <= 0.) ? 0 : (Y >= 1.) ? 255 : (int)(256. * sqrt(Y)));
}
}
static void
-L16fromY(LogLuvState* sp, uint8* op, tmsize_t n)
+L16fromY(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- int16* l16 = (int16*) sp->tbuf;
+ int16_t* l16 = (int16_t*) sp->tbuf;
float* yp = (float*) op;
while (n-- > 0)
- *l16++ = (int16) (LogL16fromY(*yp++, sp->encode_meth));
+ *l16++ = (int16_t) (LogL16fromY(*yp++, sp->encode_meth));
}
#if !LOGLUV_PUBLIC
static
#endif
void
-XYZtoRGB24(float xyz[3], uint8 rgb[3])
+XYZtoRGB24(float xyz[3], uint8_t rgb[3])
{
double r, g, b;
/* assume CCIR-709 primaries */
@@ -834,9 +834,9 @@ XYZtoRGB24(float xyz[3], uint8 rgb[3])
b = 0.061*xyz[0] + -0.224*xyz[1] + 1.163*xyz[2];
/* assume 2.0 gamma for speed */
/* could use integer sqrt approx., but this is probably faster */
- rgb[0] = (uint8)((r<=0.) ? 0 : (r >= 1.) ? 255 : (int)(256.*sqrt(r)));
- rgb[1] = (uint8)((g<=0.) ? 0 : (g >= 1.) ? 255 : (int)(256.*sqrt(g)));
- rgb[2] = (uint8)((b<=0.) ? 0 : (b >= 1.) ? 255 : (int)(256.*sqrt(b)));
+ rgb[0] = (uint8_t)((r <= 0.) ? 0 : (r >= 1.) ? 255 : (int)(256. * sqrt(r)));
+ rgb[1] = (uint8_t)((g <= 0.) ? 0 : (g >= 1.) ? 255 : (int)(256. * sqrt(g)));
+ rgb[2] = (uint8_t)((b <= 0.) ? 0 : (b >= 1.) ? 255 : (int)(256. * sqrt(b)));
}
#if !LOGLUV_PUBLIC
@@ -979,7 +979,7 @@ uv_decode(double *up, double *vp, int c) /* decode (u',v') index */
static
#endif
void
-LogLuv24toXYZ(uint32 p, float XYZ[3])
+LogLuv24toXYZ(uint32_t p, float XYZ[3])
{
int Ce;
double L, u, v, s, x, y;
@@ -1006,7 +1006,7 @@ LogLuv24toXYZ(uint32 p, float XYZ[3])
#if !LOGLUV_PUBLIC
static
#endif
-uint32
+uint32_t
LogLuv24fromXYZ(float XYZ[3], int em)
{
int Le, Ce;
@@ -1030,9 +1030,9 @@ LogLuv24fromXYZ(float XYZ[3], int em)
}
static void
-Luv24toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv24toXYZ(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
float* xyz = (float*) op;
while (n-- > 0) {
@@ -1043,30 +1043,30 @@ Luv24toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv24toLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv24toLuv48(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- int16* luv3 = (int16*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ int16_t* luv3 = (int16_t*) op;
while (n-- > 0) {
double u, v;
- *luv3++ = (int16)((*luv >> 12 & 0xffd) + 13314);
+ *luv3++ = (int16_t)((*luv >> 12 & 0xffd) + 13314);
if (uv_decode(&u, &v, *luv&0x3fff) < 0) {
u = U_NEU;
v = V_NEU;
}
- *luv3++ = (int16)(u * (1L<<15));
- *luv3++ = (int16)(v * (1L<<15));
+ *luv3++ = (int16_t)(u * (1L << 15));
+ *luv3++ = (int16_t)(v * (1L << 15));
luv++;
}
}
static void
-Luv24toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv24toRGB(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- uint8* rgb = (uint8*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ uint8_t* rgb = (uint8_t*) op;
while (n-- > 0) {
float xyz[3];
@@ -1078,9 +1078,9 @@ Luv24toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv24fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv24fromXYZ(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
float* xyz = (float*) op;
while (n-- > 0) {
@@ -1090,10 +1090,10 @@ Luv24fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv24fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv24fromLuv48(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- int16* luv3 = (int16*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ int16_t* luv3 = (int16_t*) op;
while (n-- > 0) {
int Le, Ce;
@@ -1111,7 +1111,7 @@ Luv24fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
sp->encode_meth);
if (Ce < 0) /* never happens */
Ce = uv_encode(U_NEU, V_NEU, SGILOGENCODE_NODITHER);
- *luv++ = (uint32)Le << 14 | Ce;
+ *luv++ = (uint32_t)Le << 14 | Ce;
luv3 += 3;
}
}
@@ -1120,7 +1120,7 @@ Luv24fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
static
#endif
void
-LogLuv32toXYZ(uint32 p, float XYZ[3])
+LogLuv32toXYZ(uint32_t p, float XYZ[3])
{
double L, u, v, s, x, y;
/* decode luminance */
@@ -1144,7 +1144,7 @@ LogLuv32toXYZ(uint32 p, float XYZ[3])
#if !LOGLUV_PUBLIC
static
#endif
-uint32
+uint32_t
LogLuv32fromXYZ(float XYZ[3], int em)
{
unsigned int Le, ue, ve;
@@ -1171,9 +1171,9 @@ LogLuv32fromXYZ(float XYZ[3], int em)
}
static void
-Luv32toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv32toXYZ(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
float* xyz = (float*) op;
while (n-- > 0) {
@@ -1183,28 +1183,28 @@ Luv32toXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv32toLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv32toLuv48(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- int16* luv3 = (int16*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ int16_t* luv3 = (int16_t*) op;
while (n-- > 0) {
double u, v;
- *luv3++ = (int16)(*luv >> 16);
+ *luv3++ = (int16_t)(*luv >> 16);
u = 1./UVSCALE * ((*luv>>8 & 0xff) + .5);
v = 1./UVSCALE * ((*luv & 0xff) + .5);
- *luv3++ = (int16)(u * (1L<<15));
- *luv3++ = (int16)(v * (1L<<15));
+ *luv3++ = (int16_t)(u * (1L << 15));
+ *luv3++ = (int16_t)(v * (1L << 15));
luv++;
}
}
static void
-Luv32toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv32toRGB(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- uint8* rgb = (uint8*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ uint8_t* rgb = (uint8_t*) op;
while (n-- > 0) {
float xyz[3];
@@ -1216,9 +1216,9 @@ Luv32toRGB(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv32fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv32fromXYZ(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
float* xyz = (float*) op;
while (n-- > 0) {
@@ -1228,30 +1228,30 @@ Luv32fromXYZ(LogLuvState* sp, uint8* op, tmsize_t n)
}
static void
-Luv32fromLuv48(LogLuvState* sp, uint8* op, tmsize_t n)
+Luv32fromLuv48(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
- uint32* luv = (uint32*) sp->tbuf;
- int16* luv3 = (int16*) op;
+ uint32_t* luv = (uint32_t*) sp->tbuf;
+ int16_t* luv3 = (int16_t*) op;
if (sp->encode_meth == SGILOGENCODE_NODITHER) {
while (n-- > 0) {
- *luv++ = (uint32)luv3[0] << 16 |
- (luv3[1]*(uint32)(UVSCALE+.5) >> 7 & 0xff00) |
- (luv3[2]*(uint32)(UVSCALE+.5) >> 15 & 0xff);
+ *luv++ = (uint32_t)luv3[0] << 16 |
+ (luv3[1]*(uint32_t)(UVSCALE + .5) >> 7 & 0xff00) |
+ (luv3[2]*(uint32_t)(UVSCALE + .5) >> 15 & 0xff);
luv3 += 3;
}
return;
}
while (n-- > 0) {
- *luv++ = (uint32)luv3[0] << 16 |
- (tiff_itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
- (tiff_itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
+ *luv++ = (uint32_t)luv3[0] << 16 |
+ (tiff_itrunc(luv3[1]*(UVSCALE/(1<<15)), sp->encode_meth) << 8 & 0xff00) |
+ (tiff_itrunc(luv3[2]*(UVSCALE/(1<<15)), sp->encode_meth) & 0xff);
luv3 += 3;
}
}
static void
-_logLuvNop(LogLuvState* sp, uint8* op, tmsize_t n)
+_logLuvNop(LogLuvState* sp, uint8_t* op, tmsize_t n)
{
(void) sp; (void) op; (void) n;
}
@@ -1307,10 +1307,10 @@ LogL16InitState(TIFF* tif)
sp->pixel_size = sizeof (float);
break;
case SGILOGDATAFMT_16BIT:
- sp->pixel_size = sizeof (int16);
+ sp->pixel_size = sizeof (int16_t);
break;
case SGILOGDATAFMT_8BIT:
- sp->pixel_size = sizeof (uint8);
+ sp->pixel_size = sizeof (uint8_t);
break;
default:
TIFFErrorExt(tif->tif_clientdata, module,
@@ -1323,8 +1323,8 @@ LogL16InitState(TIFF* tif)
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
else
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
- if (multiply_ms(sp->tbuflen, sizeof (int16)) == 0 ||
- (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (int16))) == NULL) {
+ if (multiply_ms(sp->tbuflen, sizeof (int16_t)) == 0 ||
+ (sp->tbuf = (uint8_t*) _TIFFmalloc(sp->tbuflen * sizeof (int16_t))) == NULL) {
TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer");
return (0);
}
@@ -1406,13 +1406,13 @@ LogLuvInitState(TIFF* tif)
sp->pixel_size = 3*sizeof (float);
break;
case SGILOGDATAFMT_16BIT:
- sp->pixel_size = 3*sizeof (int16);
+ sp->pixel_size = 3*sizeof (int16_t);
break;
case SGILOGDATAFMT_RAW:
- sp->pixel_size = sizeof (uint32);
+ sp->pixel_size = sizeof (uint32_t);
break;
case SGILOGDATAFMT_8BIT:
- sp->pixel_size = 3*sizeof (uint8);
+ sp->pixel_size = 3*sizeof (uint8_t);
break;
default:
TIFFErrorExt(tif->tif_clientdata, module,
@@ -1425,8 +1425,8 @@ LogLuvInitState(TIFF* tif)
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_rowsperstrip);
else
sp->tbuflen = multiply_ms(td->td_imagewidth, td->td_imagelength);
- if (multiply_ms(sp->tbuflen, sizeof (uint32)) == 0 ||
- (sp->tbuf = (uint8*) _TIFFmalloc(sp->tbuflen * sizeof (uint32))) == NULL) {
+ if (multiply_ms(sp->tbuflen, sizeof (uint32_t)) == 0 ||
+ (sp->tbuf = (uint8_t*) _TIFFmalloc(sp->tbuflen * sizeof (uint32_t))) == NULL) {
TIFFErrorExt(tif->tif_clientdata, module, "No space for SGILog translation buffer");
return (0);
}
@@ -1617,7 +1617,7 @@ LogLuvCleanup(TIFF* tif)
}
static int
-LogLuvVSetField(TIFF* tif, uint32 tag, va_list ap)
+LogLuvVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "LogLuvVSetField";
LogLuvState* sp = DecoderState(tif);
@@ -1680,7 +1680,7 @@ LogLuvVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-LogLuvVGetField(TIFF* tif, uint32 tag, va_list ap)
+LogLuvVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
LogLuvState *sp = (LogLuvState *)tif->tif_data;
@@ -1719,7 +1719,7 @@ TIFFInitSGILog(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof (LogLuvState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (LogLuvState));
if (tif->tif_data == NULL)
goto bad;
sp = (LogLuvState*) tif->tif_data;
diff --git a/libtiff/tif_lzma.c b/libtiff/tif_lzma.c
index e150bd63..5bc6846f 100644
--- a/libtiff/tif_lzma.c
+++ b/libtiff/tif_lzma.c
@@ -61,8 +61,8 @@ typedef struct {
#define DecoderState(tif) LState(tif)
#define EncoderState(tif) LState(tif)
-static int LZMAEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int LZMADecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
+static int LZMAEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int LZMADecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s);
static const char *
LZMAStrerror(lzma_ret ret)
@@ -125,7 +125,7 @@ LZMASetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-LZMAPreDecode(TIFF* tif, uint16 s)
+LZMAPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "LZMAPreDecode";
LZMAState* sp = DecoderState(tif);
@@ -160,7 +160,7 @@ LZMAPreDecode(TIFF* tif, uint16 s)
}
static int
-LZMADecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+LZMADecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "LZMADecode";
LZMAState* sp = DecoderState(tif);
@@ -218,7 +218,7 @@ LZMADecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
return 0;
}
- tif->tif_rawcp = (uint8 *)sp->stream.next_in; /* cast away const */
+ tif->tif_rawcp = (uint8_t *)sp->stream.next_in; /* cast away const */
tif->tif_rawcc = sp->stream.avail_in;
return 1;
@@ -243,7 +243,7 @@ LZMASetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-LZMAPreEncode(TIFF* tif, uint16 s)
+LZMAPreEncode(TIFF* tif, uint16_t s)
{
static const char module[] = "LZMAPreEncode";
LZMAState *sp = EncoderState(tif);
@@ -274,7 +274,7 @@ LZMAPreEncode(TIFF* tif, uint16 s)
* Encode a chunk of pixels.
*/
static int
-LZMAEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LZMAEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "LZMAEncode";
LZMAState *sp = EncoderState(tif);
@@ -367,7 +367,7 @@ LZMACleanup(TIFF* tif)
}
static int
-LZMAVSetField(TIFF* tif, uint32 tag, va_list ap)
+LZMAVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "LZMAVSetField";
LZMAState* sp = LState(tif);
@@ -394,7 +394,7 @@ LZMAVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-LZMAVGetField(TIFF* tif, uint32 tag, va_list ap)
+LZMAVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
LZMAState* sp = LState(tif);
@@ -435,7 +435,7 @@ TIFFInitLZMA(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZMAState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(LZMAState));
if (tif->tif_data == NULL)
goto bad;
sp = LState(tif);
diff --git a/libtiff/tif_lzw.c b/libtiff/tif_lzw.c
index d92d0fd3..2f248400 100644
--- a/libtiff/tif_lzw.c
+++ b/libtiff/tif_lzw.c
@@ -107,7 +107,7 @@ typedef struct {
/*
* Encoding-specific state.
*/
-typedef uint16 hcode_t; /* codes fit in 16 bits */
+typedef uint16_t hcode_t; /* codes fit in 16 bits */
typedef struct {
long hash;
hcode_t code;
@@ -123,7 +123,7 @@ typedef struct code_ent {
unsigned char firstchar; /* first token of string */
} code_t;
-typedef int (*decodeFunc)(TIFF*, uint8*, tmsize_t, uint16);
+typedef int (*decodeFunc)(TIFF*, uint8_t*, tmsize_t, uint16_t);
typedef struct {
LZWBaseState base;
@@ -132,7 +132,7 @@ typedef struct {
long dec_nbitsmask; /* lzw_nbits 1 bits, right adjusted */
long dec_restart; /* restart count */
#ifdef LZW_CHECKEOS
- uint64 dec_bitsleft; /* available bits in raw data */
+ uint64_t dec_bitsleft; /* available bits in raw data */
tmsize_t old_tif_rawcc; /* value of tif_rawcc at the end of the previous TIFLZWDecode() call */
#endif
decodeFunc dec_decode; /* regular or backwards compatible */
@@ -149,7 +149,7 @@ typedef struct {
long enc_ratio; /* current compression ratio */
long enc_incount; /* (input) data bytes encoded */
long enc_outcount; /* encoded (output) bytes */
- uint8* enc_rawlimit; /* bound on tif_rawdata buffer */
+ uint8_t* enc_rawlimit; /* bound on tif_rawdata buffer */
hash_t* enc_hashtab; /* kept separate for small machines */
} LZWCodecState;
@@ -157,9 +157,9 @@ typedef struct {
#define DecoderState(tif) ((LZWCodecState*) LZWState(tif))
#define EncoderState(tif) ((LZWCodecState*) LZWState(tif))
-static int LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
+static int LZWDecode(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s);
#ifdef LZW_COMPAT
-static int LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
+static int LZWDecodeCompat(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s);
#endif
static void cl_hash(LZWCodecState*);
@@ -173,7 +173,7 @@ static void cl_hash(LZWCodecState*);
* strip is suppose to be terminated with CODE_EOI.
*/
#define NextCode(_tif, _sp, _bp, _code, _get) { \
- if ((_sp)->dec_bitsleft < (uint64)nbits) { \
+ if ((_sp)->dec_bitsleft < (uint64_t)nbits) { \
TIFFWarningExt(_tif->tif_clientdata, module, \
"LZWDecode: Strip %d not terminated with EOI code", \
_tif->tif_curstrip); \
@@ -207,7 +207,7 @@ LZWSetupDecode(TIFF* tif)
* Allocate state block so tag methods have storage to record
* values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof(LZWCodecState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(LZWCodecState));
if (tif->tif_data == NULL)
{
TIFFErrorExt(tif->tif_clientdata, module, "No space for LZW state block");
@@ -256,7 +256,7 @@ LZWSetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-LZWPreDecode(TIFF* tif, uint16 s)
+LZWPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "LZWPreDecode";
LZWCodecState *sp = DecoderState(tif);
@@ -357,7 +357,7 @@ codeLoop(TIFF* tif, const char* module)
}
static int
-LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
+LZWDecode(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s)
{
static const char module[] = "LZWDecode";
LZWCodecState *sp = DecoderState(tif);
@@ -426,7 +426,7 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
bp = (unsigned char *)tif->tif_rawcp;
#ifdef LZW_CHECKEOS
- sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
+ sp->dec_bitsleft += (((uint64_t)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata;
@@ -552,8 +552,8 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
}
}
- tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp );
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcc -= (tmsize_t)((uint8_t*) bp - tif->tif_rawcp );
+ tif->tif_rawcp = (uint8_t*) bp;
#ifdef LZW_CHECKEOS
sp->old_tif_rawcc = tif->tif_rawcc;
#endif
@@ -597,7 +597,7 @@ LZWDecode(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
}
static int
-LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
+LZWDecodeCompat(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s)
{
static const char module[] = "LZWDecodeCompat";
LZWCodecState *sp = DecoderState(tif);
@@ -660,7 +660,7 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
bp = (unsigned char *)tif->tif_rawcp;
#ifdef LZW_CHECKEOS
- sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
+ sp->dec_bitsleft += (((uint64_t)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata;
@@ -776,8 +776,8 @@ LZWDecodeCompat(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
}
}
- tif->tif_rawcc -= (tmsize_t)( (uint8*) bp - tif->tif_rawcp );
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcc -= (tmsize_t)((uint8_t*) bp - tif->tif_rawcp );
+ tif->tif_rawcp = (uint8_t*) bp;
#ifdef LZW_CHECKEOS
sp->old_tif_rawcc = tif->tif_rawcc;
#endif
@@ -829,7 +829,7 @@ LZWSetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-LZWPreEncode(TIFF* tif, uint16 s)
+LZWPreEncode(TIFF* tif, uint16_t s)
{
LZWCodecState *sp = EncoderState(tif);
@@ -896,7 +896,7 @@ LZWPreEncode(TIFF* tif, uint16 s)
* for the decoder.
*/
static int
-LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+LZWEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
register LZWCodecState *sp = EncoderState(tif);
register long fcode;
@@ -908,8 +908,8 @@ LZWEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
unsigned long nextdata;
long nextbits;
int free_ent, maxcode, nbits;
- uint8* op;
- uint8* limit;
+ uint8_t* op;
+ uint8_t* limit;
(void) s;
if (sp == NULL)
@@ -1067,7 +1067,7 @@ static int
LZWPostEncode(TIFF* tif)
{
register LZWCodecState *sp = EncoderState(tif);
- uint8* op = tif->tif_rawcp;
+ uint8_t* op = tif->tif_rawcp;
long nextbits = sp->lzw_nextbits;
unsigned long nextdata = sp->lzw_nextdata;
long outcount = sp->enc_outcount;
@@ -1163,7 +1163,7 @@ TIFFInitLZW(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof (LZWCodecState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (LZWCodecState));
if (tif->tif_data == NULL)
goto bad;
DecoderState(tif)->dec_codetab = NULL;
diff --git a/libtiff/tif_next.c b/libtiff/tif_next.c
index 0ba61aed..ef0dc2f9 100644
--- a/libtiff/tif_next.c
+++ b/libtiff/tif_next.c
@@ -44,12 +44,12 @@
#define WHITE ((1<<2)-1)
static int
-NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+NeXTDecode(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
static const char module[] = "NeXTDecode";
unsigned char *bp, *op;
tmsize_t cc;
- uint8* row;
+ uint8_t* row;
tmsize_t scanline, n;
(void) s;
@@ -101,9 +101,9 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
break;
}
default: {
- uint32 npixels = 0, grey;
+ uint32_t npixels = 0, grey;
tmsize_t op_offset = 0;
- uint32 imagewidth = tif->tif_dir.td_imagewidth;
+ uint32_t imagewidth = tif->tif_dir.td_imagewidth;
if( isTiled(tif) )
imagewidth = tif->tif_dir.td_tilewidth;
@@ -115,7 +115,7 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
*/
op = row;
for (;;) {
- grey = (uint32)((n>>6) & 0x3);
+ grey = (uint32_t)((n >> 6) & 0x3);
n &= 0x3f;
/*
* Ensure the run does not exceed the scanline
@@ -140,7 +140,7 @@ NeXTDecode(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
}
}
}
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
return (1);
bad:
@@ -150,7 +150,7 @@ bad:
}
static int
-NeXTPreDecode(TIFF* tif, uint16 s)
+NeXTPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "NeXTPreDecode";
TIFFDirectory *td = &tif->tif_dir;
diff --git a/libtiff/tif_ojpeg.c b/libtiff/tif_ojpeg.c
index 54adc7fd..63834e44 100644
--- a/libtiff/tif_ojpeg.c
+++ b/libtiff/tif_ojpeg.c
@@ -141,7 +141,7 @@
* enough so as to not result in significant call overhead. It should be at least a few
* bytes to accommodate some structures (this is verified in asserts), but it would not be
* sensible to make it this small anyway, and it should be at most 64K since it is indexed
- * with uint16. We recommend 2K.
+ * with uint16_t. We recommend 2K.
* EGYPTIANWALK: You could also define EGYPTIANWALK here, but it is not used anywhere and has
* absolutely no effect. That is why most people insist the EGYPTIANWALK is a bit silly.
*/
@@ -250,114 +250,114 @@ typedef struct {
TIFFVGetMethod vgetparent;
TIFFVSetMethod vsetparent;
TIFFPrintMethod printdir;
- uint64 file_size;
- uint32 image_width;
- uint32 image_length;
- uint32 strile_width;
- uint32 strile_length;
- uint32 strile_length_total;
- uint8 samples_per_pixel;
- uint8 plane_sample_offset;
- uint8 samples_per_pixel_per_plane;
- uint64 jpeg_interchange_format;
- uint64 jpeg_interchange_format_length;
- uint8 jpeg_proc;
- uint8 subsamplingcorrect;
- uint8 subsamplingcorrect_done;
- uint8 subsampling_tag;
- uint8 subsampling_hor;
- uint8 subsampling_ver;
- uint8 subsampling_force_desubsampling_inside_decompression;
- uint8 qtable_offset_count;
- uint8 dctable_offset_count;
- uint8 actable_offset_count;
- uint64 qtable_offset[3];
- uint64 dctable_offset[3];
- uint64 actable_offset[3];
- uint8* qtable[4];
- uint8* dctable[4];
- uint8* actable[4];
- uint16 restart_interval;
- uint8 restart_index;
- uint8 sof_log;
- uint8 sof_marker_id;
- uint32 sof_x;
- uint32 sof_y;
- uint8 sof_c[3];
- uint8 sof_hv[3];
- uint8 sof_tq[3];
- uint8 sos_cs[3];
- uint8 sos_tda[3];
+ uint64_t file_size;
+ uint32_t image_width;
+ uint32_t image_length;
+ uint32_t strile_width;
+ uint32_t strile_length;
+ uint32_t strile_length_total;
+ uint8_t samples_per_pixel;
+ uint8_t plane_sample_offset;
+ uint8_t samples_per_pixel_per_plane;
+ uint64_t jpeg_interchange_format;
+ uint64_t jpeg_interchange_format_length;
+ uint8_t jpeg_proc;
+ uint8_t subsamplingcorrect;
+ uint8_t subsamplingcorrect_done;
+ uint8_t subsampling_tag;
+ uint8_t subsampling_hor;
+ uint8_t subsampling_ver;
+ uint8_t subsampling_force_desubsampling_inside_decompression;
+ uint8_t qtable_offset_count;
+ uint8_t dctable_offset_count;
+ uint8_t actable_offset_count;
+ uint64_t qtable_offset[3];
+ uint64_t dctable_offset[3];
+ uint64_t actable_offset[3];
+ uint8_t* qtable[4];
+ uint8_t* dctable[4];
+ uint8_t* actable[4];
+ uint16_t restart_interval;
+ uint8_t restart_index;
+ uint8_t sof_log;
+ uint8_t sof_marker_id;
+ uint32_t sof_x;
+ uint32_t sof_y;
+ uint8_t sof_c[3];
+ uint8_t sof_hv[3];
+ uint8_t sof_tq[3];
+ uint8_t sos_cs[3];
+ uint8_t sos_tda[3];
struct {
- uint8 log;
+ uint8_t log;
OJPEGStateInBufferSource in_buffer_source;
- uint32 in_buffer_next_strile;
- uint64 in_buffer_file_pos;
- uint64 in_buffer_file_togo;
+ uint32_t in_buffer_next_strile;
+ uint64_t in_buffer_file_pos;
+ uint64_t in_buffer_file_togo;
} sos_end[3];
- uint8 readheader_done;
- uint8 writeheader_done;
- uint16 write_cursample;
- uint32 write_curstrile;
- uint8 libjpeg_session_active;
- uint8 libjpeg_jpeg_query_style;
+ uint8_t readheader_done;
+ uint8_t writeheader_done;
+ uint16_t write_cursample;
+ uint32_t write_curstrile;
+ uint8_t libjpeg_session_active;
+ uint8_t libjpeg_jpeg_query_style;
jpeg_error_mgr libjpeg_jpeg_error_mgr;
jpeg_decompress_struct libjpeg_jpeg_decompress_struct;
jpeg_source_mgr libjpeg_jpeg_source_mgr;
- uint8 subsampling_convert_log;
- uint32 subsampling_convert_ylinelen;
- uint32 subsampling_convert_ylines;
- uint32 subsampling_convert_clinelen;
- uint32 subsampling_convert_clines;
- uint32 subsampling_convert_ybuflen;
- uint32 subsampling_convert_cbuflen;
- uint32 subsampling_convert_ycbcrbuflen;
- uint8* subsampling_convert_ycbcrbuf;
- uint8* subsampling_convert_ybuf;
- uint8* subsampling_convert_cbbuf;
- uint8* subsampling_convert_crbuf;
- uint32 subsampling_convert_ycbcrimagelen;
- uint8** subsampling_convert_ycbcrimage;
- uint32 subsampling_convert_clinelenout;
- uint32 subsampling_convert_state;
- uint32 bytes_per_line; /* if the codec outputs subsampled data, a 'line' in bytes_per_line */
- uint32 lines_per_strile; /* and lines_per_strile means subsampling_ver desubsampled rows */
+ uint8_t subsampling_convert_log;
+ uint32_t subsampling_convert_ylinelen;
+ uint32_t subsampling_convert_ylines;
+ uint32_t subsampling_convert_clinelen;
+ uint32_t subsampling_convert_clines;
+ uint32_t subsampling_convert_ybuflen;
+ uint32_t subsampling_convert_cbuflen;
+ uint32_t subsampling_convert_ycbcrbuflen;
+ uint8_t* subsampling_convert_ycbcrbuf;
+ uint8_t* subsampling_convert_ybuf;
+ uint8_t* subsampling_convert_cbbuf;
+ uint8_t* subsampling_convert_crbuf;
+ uint32_t subsampling_convert_ycbcrimagelen;
+ uint8_t** subsampling_convert_ycbcrimage;
+ uint32_t subsampling_convert_clinelenout;
+ uint32_t subsampling_convert_state;
+ uint32_t bytes_per_line; /* if the codec outputs subsampled data, a 'line' in bytes_per_line */
+ uint32_t lines_per_strile; /* and lines_per_strile means subsampling_ver desubsampled rows */
OJPEGStateInBufferSource in_buffer_source;
- uint32 in_buffer_next_strile;
- uint32 in_buffer_strile_count;
- uint64 in_buffer_file_pos;
- uint8 in_buffer_file_pos_log;
- uint64 in_buffer_file_togo;
- uint16 in_buffer_togo;
- uint8* in_buffer_cur;
- uint8 in_buffer[OJPEG_BUFFER];
+ uint32_t in_buffer_next_strile;
+ uint32_t in_buffer_strile_count;
+ uint64_t in_buffer_file_pos;
+ uint8_t in_buffer_file_pos_log;
+ uint64_t in_buffer_file_togo;
+ uint16_t in_buffer_togo;
+ uint8_t* in_buffer_cur;
+ uint8_t in_buffer[OJPEG_BUFFER];
OJPEGStateOutState out_state;
- uint8 out_buffer[OJPEG_BUFFER];
- uint8* skip_buffer;
+ uint8_t out_buffer[OJPEG_BUFFER];
+ uint8_t* skip_buffer;
} OJPEGState;
-static int OJPEGVGetField(TIFF* tif, uint32 tag, va_list ap);
-static int OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap);
+static int OJPEGVGetField(TIFF* tif, uint32_t tag, va_list ap);
+static int OJPEGVSetField(TIFF* tif, uint32_t tag, va_list ap);
static void OJPEGPrintDir(TIFF* tif, FILE* fd, long flags);
static int OJPEGFixupTags(TIFF* tif);
static int OJPEGSetupDecode(TIFF* tif);
-static int OJPEGPreDecode(TIFF* tif, uint16 s);
+static int OJPEGPreDecode(TIFF* tif, uint16_t s);
static int OJPEGPreDecodeSkipRaw(TIFF* tif);
static int OJPEGPreDecodeSkipScanlines(TIFF* tif);
-static int OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
-static int OJPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc);
-static int OJPEGDecodeScanlines(TIFF* tif, uint8* buf, tmsize_t cc);
-static void OJPEGPostDecode(TIFF* tif, uint8* buf, tmsize_t cc);
+static int OJPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
+static int OJPEGDecodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc);
+static int OJPEGDecodeScanlines(TIFF* tif, uint8_t* buf, tmsize_t cc);
+static void OJPEGPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc);
static int OJPEGSetupEncode(TIFF* tif);
-static int OJPEGPreEncode(TIFF* tif, uint16 s);
-static int OJPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s);
+static int OJPEGPreEncode(TIFF* tif, uint16_t s);
+static int OJPEGEncode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s);
static int OJPEGPostEncode(TIFF* tif);
static void OJPEGCleanup(TIFF* tif);
static void OJPEGSubsamplingCorrect(TIFF* tif);
static int OJPEGReadHeaderInfo(TIFF* tif);
-static int OJPEGReadSecondarySos(TIFF* tif, uint16 s);
+static int OJPEGReadSecondarySos(TIFF* tif, uint16_t s);
static int OJPEGWriteHeaderInfo(TIFF* tif);
static void OJPEGLibjpegSessionAbort(TIFF* tif);
@@ -365,45 +365,45 @@ static int OJPEGReadHeaderInfoSec(TIFF* tif);
static int OJPEGReadHeaderInfoSecStreamDri(TIFF* tif);
static int OJPEGReadHeaderInfoSecStreamDqt(TIFF* tif);
static int OJPEGReadHeaderInfoSecStreamDht(TIFF* tif);
-static int OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id);
+static int OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8_t marker_id);
static int OJPEGReadHeaderInfoSecStreamSos(TIFF* tif);
static int OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif);
static int OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif);
static int OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif);
static int OJPEGReadBufferFill(OJPEGState* sp);
-static int OJPEGReadByte(OJPEGState* sp, uint8* byte);
-static int OJPEGReadBytePeek(OJPEGState* sp, uint8* byte);
+static int OJPEGReadByte(OJPEGState* sp, uint8_t* byte);
+static int OJPEGReadBytePeek(OJPEGState* sp, uint8_t* byte);
static void OJPEGReadByteAdvance(OJPEGState* sp);
-static int OJPEGReadWord(OJPEGState* sp, uint16* word);
-static int OJPEGReadBlock(OJPEGState* sp, uint16 len, void* mem);
-static void OJPEGReadSkip(OJPEGState* sp, uint16 len);
-
-static int OJPEGWriteStream(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamQTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);
-static void OJPEGWriteStreamDcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);
-static void OJPEGWriteStreamAcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len);
-static void OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32* len);
-static int OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32* len);
-static void OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len);
+static int OJPEGReadWord(OJPEGState* sp, uint16_t* word);
+static int OJPEGReadBlock(OJPEGState* sp, uint16_t len, void* mem);
+static void OJPEGReadSkip(OJPEGState* sp, uint16_t len);
+
+static int OJPEGWriteStream(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamQTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len);
+static void OJPEGWriteStreamDcTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len);
+static void OJPEGWriteStreamAcTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len);
+static void OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32_t* len);
+static int OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32_t* len);
+static void OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32_t* len);
#ifdef LIBJPEG_ENCAP_EXTERNAL
extern int jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);
-extern int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image);
+extern int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8_t require_image);
extern int jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);
-extern int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines);
-extern int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines);
+extern int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32_t max_lines);
+extern int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32_t max_lines);
extern void jpeg_encap_unwind(TIFF* tif);
#else
static int jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* j);
-static int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image);
+static int jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8_t require_image);
static int jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo);
-static int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines);
-static int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines);
+static int jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32_t max_lines);
+static int jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32_t max_lines);
static void jpeg_encap_unwind(TIFF* tif);
#endif
@@ -461,7 +461,7 @@ TIFFInitOJPEG(TIFF* tif, int scheme)
tif->tif_encodestrip=OJPEGEncode;
tif->tif_encodetile=OJPEGEncode;
tif->tif_cleanup=OJPEGCleanup;
- tif->tif_data=(uint8*)sp;
+ tif->tif_data=(uint8_t*)sp;
/* tif tag methods */
sp->vgetparent=tif->tif_tagmethods.vgetfield;
tif->tif_tagmethods.vgetfield=OJPEGVGetField;
@@ -480,40 +480,40 @@ TIFFInitOJPEG(TIFF* tif, int scheme)
}
static int
-OJPEGVGetField(TIFF* tif, uint32 tag, va_list ap)
+OJPEGVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
switch(tag)
{
case TIFFTAG_JPEGIFOFFSET:
- *va_arg(ap,uint64*)=(uint64)sp->jpeg_interchange_format;
+ *va_arg(ap, uint64_t*)=(uint64_t)sp->jpeg_interchange_format;
break;
case TIFFTAG_JPEGIFBYTECOUNT:
- *va_arg(ap,uint64*)=(uint64)sp->jpeg_interchange_format_length;
+ *va_arg(ap, uint64_t*)=(uint64_t)sp->jpeg_interchange_format_length;
break;
case TIFFTAG_YCBCRSUBSAMPLING:
if (sp->subsamplingcorrect_done==0)
OJPEGSubsamplingCorrect(tif);
- *va_arg(ap,uint16*)=(uint16)sp->subsampling_hor;
- *va_arg(ap,uint16*)=(uint16)sp->subsampling_ver;
+ *va_arg(ap, uint16_t*)=(uint16_t)sp->subsampling_hor;
+ *va_arg(ap, uint16_t*)=(uint16_t)sp->subsampling_ver;
break;
case TIFFTAG_JPEGQTABLES:
- *va_arg(ap,uint32*)=(uint32)sp->qtable_offset_count;
+ *va_arg(ap, uint32_t*)=(uint32_t)sp->qtable_offset_count;
*va_arg(ap,const void**)=(const void*)sp->qtable_offset;
break;
case TIFFTAG_JPEGDCTABLES:
- *va_arg(ap,uint32*)=(uint32)sp->dctable_offset_count;
+ *va_arg(ap, uint32_t*)=(uint32_t)sp->dctable_offset_count;
*va_arg(ap,const void**)=(const void*)sp->dctable_offset;
break;
case TIFFTAG_JPEGACTABLES:
- *va_arg(ap,uint32*)=(uint32)sp->actable_offset_count;
+ *va_arg(ap, uint32_t*)=(uint32_t)sp->actable_offset_count;
*va_arg(ap,const void**)=(const void*)sp->actable_offset;
break;
case TIFFTAG_JPEGPROC:
- *va_arg(ap,uint16*)=(uint16)sp->jpeg_proc;
+ *va_arg(ap, uint16_t*)=(uint16_t)sp->jpeg_proc;
break;
case TIFFTAG_JPEGRESTARTINTERVAL:
- *va_arg(ap,uint16*)=sp->restart_interval;
+ *va_arg(ap, uint16_t*)=sp->restart_interval;
break;
default:
return (*sp->vgetparent)(tif,tag,ap);
@@ -522,32 +522,32 @@ OJPEGVGetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
+OJPEGVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[]="OJPEGVSetField";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint32 ma;
- uint64* mb;
- uint32 n;
+ uint32_t ma;
+ uint64_t* mb;
+ uint32_t n;
const TIFFField* fip;
switch(tag)
{
case TIFFTAG_JPEGIFOFFSET:
- sp->jpeg_interchange_format=(uint64)va_arg(ap,uint64);
+ sp->jpeg_interchange_format=(uint64_t)va_arg(ap, uint64_t);
break;
case TIFFTAG_JPEGIFBYTECOUNT:
- sp->jpeg_interchange_format_length=(uint64)va_arg(ap,uint64);
+ sp->jpeg_interchange_format_length=(uint64_t)va_arg(ap, uint64_t);
break;
case TIFFTAG_YCBCRSUBSAMPLING:
sp->subsampling_tag=1;
- sp->subsampling_hor=(uint8)va_arg(ap,uint16_vap);
- sp->subsampling_ver=(uint8)va_arg(ap,uint16_vap);
+ sp->subsampling_hor=(uint8_t)va_arg(ap, uint16_vap);
+ sp->subsampling_ver=(uint8_t)va_arg(ap, uint16_vap);
tif->tif_dir.td_ycbcrsubsampling[0]=sp->subsampling_hor;
tif->tif_dir.td_ycbcrsubsampling[1]=sp->subsampling_ver;
break;
case TIFFTAG_JPEGQTABLES:
- ma=(uint32)va_arg(ap,uint32);
+ ma=(uint32_t)va_arg(ap, uint32_t);
if (ma!=0)
{
if (ma>3)
@@ -555,14 +555,14 @@ OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
TIFFErrorExt(tif->tif_clientdata,module,"JpegQTables tag has incorrect count");
return(0);
}
- sp->qtable_offset_count=(uint8)ma;
- mb=(uint64*)va_arg(ap,uint64*);
+ sp->qtable_offset_count=(uint8_t)ma;
+ mb=(uint64_t*)va_arg(ap, uint64_t*);
for (n=0; n<ma; n++)
sp->qtable_offset[n]=mb[n];
}
break;
case TIFFTAG_JPEGDCTABLES:
- ma=(uint32)va_arg(ap,uint32);
+ ma=(uint32_t)va_arg(ap, uint32_t);
if (ma!=0)
{
if (ma>3)
@@ -570,14 +570,14 @@ OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
TIFFErrorExt(tif->tif_clientdata,module,"JpegDcTables tag has incorrect count");
return(0);
}
- sp->dctable_offset_count=(uint8)ma;
- mb=(uint64*)va_arg(ap,uint64*);
+ sp->dctable_offset_count=(uint8_t)ma;
+ mb=(uint64_t*)va_arg(ap, uint64_t*);
for (n=0; n<ma; n++)
sp->dctable_offset[n]=mb[n];
}
break;
case TIFFTAG_JPEGACTABLES:
- ma=(uint32)va_arg(ap,uint32);
+ ma=(uint32_t)va_arg(ap, uint32_t);
if (ma!=0)
{
if (ma>3)
@@ -585,17 +585,17 @@ OJPEGVSetField(TIFF* tif, uint32 tag, va_list ap)
TIFFErrorExt(tif->tif_clientdata,module,"JpegAcTables tag has incorrect count");
return(0);
}
- sp->actable_offset_count=(uint8)ma;
- mb=(uint64*)va_arg(ap,uint64*);
+ sp->actable_offset_count=(uint8_t)ma;
+ mb=(uint64_t*)va_arg(ap, uint64_t*);
for (n=0; n<ma; n++)
sp->actable_offset[n]=mb[n];
}
break;
case TIFFTAG_JPEGPROC:
- sp->jpeg_proc=(uint8)va_arg(ap,uint16_vap);
+ sp->jpeg_proc=(uint8_t)va_arg(ap, uint16_vap);
break;
case TIFFTAG_JPEGRESTARTINTERVAL:
- sp->restart_interval=(uint16)va_arg(ap,uint16_vap);
+ sp->restart_interval=(uint16_t)va_arg(ap, uint16_vap);
break;
default:
return (*sp->vsetparent)(tif,tag,ap);
@@ -612,32 +612,32 @@ static void
OJPEGPrintDir(TIFF* tif, FILE* fd, long flags)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
+ uint8_t m;
(void)flags;
assert(sp!=NULL);
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGINTERCHANGEFORMAT))
- fprintf(fd," JpegInterchangeFormat: %" TIFF_UINT64_FORMAT "\n",(TIFF_UINT64_T)sp->jpeg_interchange_format);
+ fprintf(fd," JpegInterchangeFormat: %" PRIu64 "\n",(uint64_t)sp->jpeg_interchange_format);
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGINTERCHANGEFORMATLENGTH))
- fprintf(fd," JpegInterchangeFormatLength: %" TIFF_UINT64_FORMAT "\n",(TIFF_UINT64_T)sp->jpeg_interchange_format_length);
+ fprintf(fd," JpegInterchangeFormatLength: %" PRIu64 "\n",(uint64_t)sp->jpeg_interchange_format_length);
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGQTABLES))
{
fprintf(fd," JpegQTables:");
for (m=0; m<sp->qtable_offset_count; m++)
- fprintf(fd," %" TIFF_UINT64_FORMAT,(TIFF_UINT64_T)sp->qtable_offset[m]);
+ fprintf(fd," %" PRIu64,(uint64_t)sp->qtable_offset[m]);
fprintf(fd,"\n");
}
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGDCTABLES))
{
fprintf(fd," JpegDcTables:");
for (m=0; m<sp->dctable_offset_count; m++)
- fprintf(fd," %" TIFF_UINT64_FORMAT,(TIFF_UINT64_T)sp->dctable_offset[m]);
+ fprintf(fd," %" PRIu64,(uint64_t)sp->dctable_offset[m]);
fprintf(fd,"\n");
}
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGACTABLES))
{
fprintf(fd," JpegAcTables:");
for (m=0; m<sp->actable_offset_count; m++)
- fprintf(fd," %" TIFF_UINT64_FORMAT,(TIFF_UINT64_T)sp->actable_offset[m]);
+ fprintf(fd," %" PRIu64,(uint64_t)sp->actable_offset[m]);
fprintf(fd,"\n");
}
if (TIFFFieldSet(tif,FIELD_OJPEG_JPEGPROC))
@@ -664,10 +664,10 @@ OJPEGSetupDecode(TIFF* tif)
}
static int
-OJPEGPreDecode(TIFF* tif, uint16 s)
+OJPEGPreDecode(TIFF* tif, uint16_t s)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint32 m;
+ uint32_t m;
if (sp->subsamplingcorrect_done==0)
OJPEGSubsamplingCorrect(tif);
if (sp->readheader_done==0)
@@ -692,7 +692,7 @@ OJPEGPreDecode(TIFF* tif, uint16 s)
}
if (sp->writeheader_done==0)
{
- sp->plane_sample_offset=(uint8)s;
+ sp->plane_sample_offset=(uint8_t)s;
sp->write_cursample=s;
sp->write_curstrile=s*tif->tif_dir.td_stripsperimage;
if ((sp->in_buffer_file_pos_log==0) ||
@@ -731,7 +731,7 @@ static int
OJPEGPreDecodeSkipRaw(TIFF* tif)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint32 m;
+ uint32_t m;
m=sp->lines_per_strile;
if (sp->subsampling_convert_state!=0)
{
@@ -766,7 +766,7 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
{
static const char module[]="OJPEGPreDecodeSkipScanlines";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint32 m;
+ uint32_t m;
if (sp->skip_buffer==NULL)
{
sp->skip_buffer=_TIFFmalloc(sp->bytes_per_line);
@@ -785,7 +785,7 @@ OJPEGPreDecodeSkipScanlines(TIFF* tif)
}
static int
-OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+OJPEGDecode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
static const char module[]="OJPEGDecode";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
@@ -813,19 +813,19 @@ OJPEGDecode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
}
static int
-OJPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc)
+OJPEGDecodeRaw(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
static const char module[]="OJPEGDecodeRaw";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8* m;
+ uint8_t* m;
tmsize_t n;
- uint8* oy;
- uint8* ocb;
- uint8* ocr;
- uint8* p;
- uint32 q;
- uint8* r;
- uint8 sx,sy;
+ uint8_t* oy;
+ uint8_t* ocb;
+ uint8_t* ocr;
+ uint8_t* p;
+ uint32_t q;
+ uint8_t* r;
+ uint8_t sx,sy;
if (cc%sp->bytes_per_line!=0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Fractional scanline not read");
@@ -871,11 +871,11 @@ OJPEGDecodeRaw(TIFF* tif, uint8* buf, tmsize_t cc)
}
static int
-OJPEGDecodeScanlines(TIFF* tif, uint8* buf, tmsize_t cc)
+OJPEGDecodeScanlines(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
static const char module[]="OJPEGDecodeScanlines";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8* m;
+ uint8_t* m;
tmsize_t n;
if (cc%sp->bytes_per_line!=0)
{
@@ -896,7 +896,7 @@ OJPEGDecodeScanlines(TIFF* tif, uint8* buf, tmsize_t cc)
}
static void
-OJPEGPostDecode(TIFF* tif, uint8* buf, tmsize_t cc)
+OJPEGPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
(void)buf;
@@ -919,7 +919,7 @@ OJPEGSetupEncode(TIFF* tif)
}
static int
-OJPEGPreEncode(TIFF* tif, uint16 s)
+OJPEGPreEncode(TIFF* tif, uint16_t s)
{
static const char module[]="OJPEGPreEncode";
(void)s;
@@ -928,7 +928,7 @@ OJPEGPreEncode(TIFF* tif, uint16 s)
}
static int
-OJPEGEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+OJPEGEncode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
static const char module[]="OJPEGEncode";
(void)buf;
@@ -998,8 +998,8 @@ OJPEGSubsamplingCorrect(TIFF* tif)
{
static const char module[]="OJPEGSubsamplingCorrect";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 mh;
- uint8 mv;
+ uint8_t mh;
+ uint8_t mv;
assert(sp->subsamplingcorrect_done==0);
if ((tif->tif_dir.td_samplesperpixel!=3) || ((tif->tif_dir.td_photometric!=PHOTOMETRIC_YCBCR) &&
@@ -1065,7 +1065,7 @@ OJPEGReadHeaderInfo(TIFF* tif)
{
sp->strile_width=sp->image_width;
sp->strile_length=tif->tif_dir.td_rowsperstrip;
- if( sp->strile_length == (uint32)-1 )
+ if( sp->strile_length == (uint32_t)-1 )
sp->strile_length = sp->image_length;
sp->strile_length_total=sp->image_length;
}
@@ -1104,7 +1104,7 @@ OJPEGReadHeaderInfo(TIFF* tif)
TIFFErrorExt(tif->tif_clientdata,module,"Incompatible vertical subsampling and image strip/tile length");
return(0);
}
- sp->restart_interval=(uint16)(((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8))*(sp->strile_length/(sp->subsampling_ver*8)));
+ sp->restart_interval=(uint16_t)(((sp->strile_width + sp->subsampling_hor * 8 - 1) / (sp->subsampling_hor * 8)) * (sp->strile_length / (sp->subsampling_ver * 8)));
}
if (OJPEGReadHeaderInfoSec(tif)==0)
return(0);
@@ -1118,15 +1118,15 @@ OJPEGReadHeaderInfo(TIFF* tif)
}
static int
-OJPEGReadSecondarySos(TIFF* tif, uint16 s)
+OJPEGReadSecondarySos(TIFF* tif, uint16_t s)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
+ uint8_t m;
assert(s>0);
assert(s<3);
assert(sp->sos_end[0].log!=0);
assert(sp->sos_end[s].log==0);
- sp->plane_sample_offset=(uint8)(s-1);
+ sp->plane_sample_offset=(uint8_t)(s - 1);
while(sp->sos_end[sp->plane_sample_offset].log==0)
sp->plane_sample_offset--;
sp->in_buffer_source=sp->sos_end[sp->plane_sample_offset].in_buffer_source;
@@ -1172,8 +1172,8 @@ OJPEGWriteHeaderInfo(TIFF* tif)
{
static const char module[]="OJPEGWriteHeaderInfo";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8** m;
- uint32 n;
+ uint8_t** m;
+ uint32_t n;
/* if a previous attempt failed, don't try again */
if (sp->libjpeg_session_active != 0)
return 0;
@@ -1230,16 +1230,16 @@ OJPEGWriteHeaderInfo(TIFF* tif)
sp->subsampling_convert_cbbuf=sp->subsampling_convert_ybuf+sp->subsampling_convert_ybuflen;
sp->subsampling_convert_crbuf=sp->subsampling_convert_cbbuf+sp->subsampling_convert_cbuflen;
sp->subsampling_convert_ycbcrimagelen=3+sp->subsampling_convert_ylines+2*sp->subsampling_convert_clines;
- sp->subsampling_convert_ycbcrimage=_TIFFmalloc(sp->subsampling_convert_ycbcrimagelen*sizeof(uint8*));
+ sp->subsampling_convert_ycbcrimage=_TIFFmalloc(sp->subsampling_convert_ycbcrimagelen*sizeof(uint8_t*));
if (sp->subsampling_convert_ycbcrimage==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
m=sp->subsampling_convert_ycbcrimage;
- *m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3);
- *m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3+sp->subsampling_convert_ylines);
- *m++=(uint8*)(sp->subsampling_convert_ycbcrimage+3+sp->subsampling_convert_ylines+sp->subsampling_convert_clines);
+ *m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3);
+ *m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3 + sp->subsampling_convert_ylines);
+ *m++=(uint8_t*)(sp->subsampling_convert_ycbcrimage + 3 + sp->subsampling_convert_ylines + sp->subsampling_convert_clines);
for (n=0; n<sp->subsampling_convert_ylines; n++)
*m++=sp->subsampling_convert_ybuf+n*sp->subsampling_convert_ylinelen;
for (n=0; n<sp->subsampling_convert_clines; n++)
@@ -1302,9 +1302,9 @@ OJPEGReadHeaderInfoSec(TIFF* tif)
{
static const char module[]="OJPEGReadHeaderInfoSec";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
- uint16 n;
- uint8 o;
+ uint8_t m;
+ uint16_t n;
+ uint8_t o;
if (sp->file_size==0)
sp->file_size=TIFFGetFileSize(tif);
if (sp->jpeg_interchange_format!=0)
@@ -1317,7 +1317,7 @@ OJPEGReadHeaderInfoSec(TIFF* tif)
else
{
if ((sp->jpeg_interchange_format_length==0) ||
- (sp->jpeg_interchange_format > TIFF_UINT64_MAX - sp->jpeg_interchange_format_length) ||
+ (sp->jpeg_interchange_format > UINT64_MAX - sp->jpeg_interchange_format_length) ||
(sp->jpeg_interchange_format+sp->jpeg_interchange_format_length>sp->file_size))
sp->jpeg_interchange_format_length=sp->file_size-sp->jpeg_interchange_format;
}
@@ -1437,7 +1437,7 @@ OJPEGReadHeaderInfoSecStreamDri(TIFF* tif)
occurred so far */
static const char module[]="OJPEGReadHeaderInfoSecStreamDri";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint16 m;
+ uint16_t m;
if (OJPEGReadWord(sp,&m)==0)
return(0);
if (m!=4)
@@ -1457,10 +1457,10 @@ OJPEGReadHeaderInfoSecStreamDqt(TIFF* tif)
/* this is a table marker, and it is to be saved as a whole for exact pushing on the jpeg stream later on */
static const char module[]="OJPEGReadHeaderInfoSecStreamDqt";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint16 m;
- uint32 na;
- uint8* nb;
- uint8 o;
+ uint16_t m;
+ uint32_t na;
+ uint8_t* nb;
+ uint8_t o;
if (OJPEGReadWord(sp,&m)==0)
return(0);
if (m<=2)
@@ -1481,23 +1481,23 @@ OJPEGReadHeaderInfoSecStreamDqt(TIFF* tif)
TIFFErrorExt(tif->tif_clientdata,module,"Corrupt DQT marker in JPEG data");
return(0);
}
- na=sizeof(uint32)+69;
+ na= sizeof(uint32_t) + 69;
nb=_TIFFmalloc(na);
if (nb==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- *(uint32*)nb=na;
- nb[sizeof(uint32)]=255;
- nb[sizeof(uint32)+1]=JPEG_MARKER_DQT;
- nb[sizeof(uint32)+2]=0;
- nb[sizeof(uint32)+3]=67;
- if (OJPEGReadBlock(sp,65,&nb[sizeof(uint32)+4])==0) {
+ *(uint32_t*)nb=na;
+ nb[sizeof(uint32_t)]=255;
+ nb[sizeof(uint32_t) + 1]=JPEG_MARKER_DQT;
+ nb[sizeof(uint32_t) + 2]=0;
+ nb[sizeof(uint32_t) + 3]=67;
+ if (OJPEGReadBlock(sp,65,&nb[sizeof(uint32_t) + 4]) == 0) {
_TIFFfree(nb);
return(0);
}
- o=nb[sizeof(uint32)+4]&15;
+ o= nb[sizeof(uint32_t) + 4] & 15;
if (3<o)
{
TIFFErrorExt(tif->tif_clientdata,module,"Corrupt DQT marker in JPEG data");
@@ -1520,10 +1520,10 @@ OJPEGReadHeaderInfoSecStreamDht(TIFF* tif)
/* TODO: the following assumes there is only one table in this marker... but i'm not quite sure that assumption is guaranteed correct */
static const char module[]="OJPEGReadHeaderInfoSecStreamDht";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint16 m;
- uint32 na;
- uint8* nb;
- uint8 o;
+ uint16_t m;
+ uint32_t na;
+ uint8_t* nb;
+ uint8_t o;
if (OJPEGReadWord(sp,&m)==0)
return(0);
if (m<=2)
@@ -1538,23 +1538,23 @@ OJPEGReadHeaderInfoSecStreamDht(TIFF* tif)
}
else
{
- na=sizeof(uint32)+2+m;
+ na= sizeof(uint32_t) + 2 + m;
nb=_TIFFmalloc(na);
if (nb==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- *(uint32*)nb=na;
- nb[sizeof(uint32)]=255;
- nb[sizeof(uint32)+1]=JPEG_MARKER_DHT;
- nb[sizeof(uint32)+2]=(m>>8);
- nb[sizeof(uint32)+3]=(m&255);
- if (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32)+4])==0) {
+ *(uint32_t*)nb=na;
+ nb[sizeof(uint32_t)]=255;
+ nb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
+ nb[sizeof(uint32_t) + 2]=(m >> 8);
+ nb[sizeof(uint32_t) + 3]=(m & 255);
+ if (OJPEGReadBlock(sp,m-2,&nb[sizeof(uint32_t) + 4]) == 0) {
_TIFFfree(nb);
return(0);
}
- o=nb[sizeof(uint32)+4];
+ o=nb[sizeof(uint32_t) + 4];
if ((o&240)==0)
{
if (3<o)
@@ -1591,16 +1591,16 @@ OJPEGReadHeaderInfoSecStreamDht(TIFF* tif)
}
static int
-OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)
+OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8_t marker_id)
{
/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */
static const char module[]="OJPEGReadHeaderInfoSecStreamSof";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint16 m;
- uint16 n;
- uint8 o;
- uint16 p;
- uint16 q;
+ uint16_t m;
+ uint16_t n;
+ uint8_t o;
+ uint16_t p;
+ uint16_t q;
if (sp->sof_log!=0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Corrupt JPEG data");
@@ -1650,7 +1650,7 @@ OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)
/* Y: Number of lines */
if (OJPEGReadWord(sp,&p)==0)
return(0);
- if (((uint32)p<sp->image_length) && ((uint32)p<sp->strile_length_total))
+ if (((uint32_t)p < sp->image_length) && ((uint32_t)p < sp->strile_length_total))
{
TIFFErrorExt(tif->tif_clientdata,module,"JPEG compressed data indicates unexpected height");
return(0);
@@ -1659,12 +1659,12 @@ OJPEGReadHeaderInfoSecStreamSof(TIFF* tif, uint8 marker_id)
/* X: Number of samples per line */
if (OJPEGReadWord(sp,&p)==0)
return(0);
- if (((uint32)p<sp->image_width) && ((uint32)p<sp->strile_width))
+ if (((uint32_t)p < sp->image_width) && ((uint32_t)p < sp->strile_width))
{
TIFFErrorExt(tif->tif_clientdata,module,"JPEG compressed data indicates unexpected width");
return(0);
}
- if ((uint32)p>sp->strile_width)
+ if ((uint32_t)p > sp->strile_width)
{
TIFFErrorExt(tif->tif_clientdata,module,"JPEG compressed data image width exceeds expected image width");
return(0);
@@ -1748,9 +1748,9 @@ OJPEGReadHeaderInfoSecStreamSos(TIFF* tif)
/* this marker needs to be checked, and part of its data needs to be saved for regeneration later on */
static const char module[]="OJPEGReadHeaderInfoSecStreamSos";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint16 m;
- uint8 n;
- uint8 o;
+ uint16_t m;
+ uint8_t n;
+ uint8_t o;
assert(sp->subsamplingcorrect==0);
if (sp->sof_log==0)
{
@@ -1795,11 +1795,11 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
{
static const char module[]="OJPEGReadHeaderInfoSecTablesQTable";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
- uint8 n;
- uint32 oa;
- uint8* ob;
- uint32 p;
+ uint8_t m;
+ uint8_t n;
+ uint32_t oa;
+ uint8_t* ob;
+ uint32_t p;
if (sp->qtable_offset[0]==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");
@@ -1818,21 +1818,21 @@ OJPEGReadHeaderInfoSecTablesQTable(TIFF* tif)
return(0);
}
}
- oa=sizeof(uint32)+69;
+ oa= sizeof(uint32_t) + 69;
ob=_TIFFmalloc(oa);
if (ob==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- *(uint32*)ob=oa;
- ob[sizeof(uint32)]=255;
- ob[sizeof(uint32)+1]=JPEG_MARKER_DQT;
- ob[sizeof(uint32)+2]=0;
- ob[sizeof(uint32)+3]=67;
- ob[sizeof(uint32)+4]=m;
+ *(uint32_t*)ob=oa;
+ ob[sizeof(uint32_t)]=255;
+ ob[sizeof(uint32_t) + 1]=JPEG_MARKER_DQT;
+ ob[sizeof(uint32_t) + 2]=0;
+ ob[sizeof(uint32_t) + 3]=67;
+ ob[sizeof(uint32_t) + 4]=m;
TIFFSeekFile(tif,sp->qtable_offset[m],SEEK_SET);
- p=(uint32)TIFFReadFile(tif,&ob[sizeof(uint32)+5],64);
+ p=(uint32_t)TIFFReadFile(tif, &ob[sizeof(uint32_t) + 5], 64);
if (p!=64)
{
_TIFFfree(ob);
@@ -1854,13 +1854,13 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
{
static const char module[]="OJPEGReadHeaderInfoSecTablesDcTable";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
- uint8 n;
- uint8 o[16];
- uint32 p;
- uint32 q;
- uint32 ra;
- uint8* rb;
+ uint8_t m;
+ uint8_t n;
+ uint8_t o[16];
+ uint32_t p;
+ uint32_t q;
+ uint32_t ra;
+ uint8_t* rb;
if (sp->dctable_offset[0]==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");
@@ -1880,28 +1880,28 @@ OJPEGReadHeaderInfoSecTablesDcTable(TIFF* tif)
}
}
TIFFSeekFile(tif,sp->dctable_offset[m],SEEK_SET);
- p=(uint32)TIFFReadFile(tif,o,16);
+ p=(uint32_t)TIFFReadFile(tif, o, 16);
if (p!=16)
return(0);
q=0;
for (n=0; n<16; n++)
q+=o[n];
- ra=sizeof(uint32)+21+q;
+ ra= sizeof(uint32_t) + 21 + q;
rb=_TIFFmalloc(ra);
if (rb==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- *(uint32*)rb=ra;
- rb[sizeof(uint32)]=255;
- rb[sizeof(uint32)+1]=JPEG_MARKER_DHT;
- rb[sizeof(uint32)+2]=(uint8)((19+q)>>8);
- rb[sizeof(uint32)+3]=((19+q)&255);
- rb[sizeof(uint32)+4]=m;
+ *(uint32_t*)rb=ra;
+ rb[sizeof(uint32_t)]=255;
+ rb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
+ rb[sizeof(uint32_t) + 2]=(uint8_t)((19 + q) >> 8);
+ rb[sizeof(uint32_t) + 3]=((19 + q) & 255);
+ rb[sizeof(uint32_t) + 4]=m;
for (n=0; n<16; n++)
- rb[sizeof(uint32)+5+n]=o[n];
- p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ rb[sizeof(uint32_t) + 5 + n]=o[n];
+ p=(uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
if (p!=q)
{
_TIFFfree(rb);
@@ -1923,13 +1923,13 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
{
static const char module[]="OJPEGReadHeaderInfoSecTablesAcTable";
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
- uint8 n;
- uint8 o[16];
- uint32 p;
- uint32 q;
- uint32 ra;
- uint8* rb;
+ uint8_t m;
+ uint8_t n;
+ uint8_t o[16];
+ uint32_t p;
+ uint32_t q;
+ uint32_t ra;
+ uint8_t* rb;
if (sp->actable_offset[0]==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Missing JPEG tables");
@@ -1949,28 +1949,28 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
}
}
TIFFSeekFile(tif,sp->actable_offset[m],SEEK_SET);
- p=(uint32)TIFFReadFile(tif,o,16);
+ p=(uint32_t)TIFFReadFile(tif, o, 16);
if (p!=16)
return(0);
q=0;
for (n=0; n<16; n++)
q+=o[n];
- ra=sizeof(uint32)+21+q;
+ ra= sizeof(uint32_t) + 21 + q;
rb=_TIFFmalloc(ra);
if (rb==0)
{
TIFFErrorExt(tif->tif_clientdata,module,"Out of memory");
return(0);
}
- *(uint32*)rb=ra;
- rb[sizeof(uint32)]=255;
- rb[sizeof(uint32)+1]=JPEG_MARKER_DHT;
- rb[sizeof(uint32)+2]=(uint8)((19+q)>>8);
- rb[sizeof(uint32)+3]=((19+q)&255);
- rb[sizeof(uint32)+4]=(16|m);
+ *(uint32_t*)rb=ra;
+ rb[sizeof(uint32_t)]=255;
+ rb[sizeof(uint32_t) + 1]=JPEG_MARKER_DHT;
+ rb[sizeof(uint32_t) + 2]=(uint8_t)((19 + q) >> 8);
+ rb[sizeof(uint32_t) + 3]=((19 + q) & 255);
+ rb[sizeof(uint32_t) + 4]=(16 | m);
for (n=0; n<16; n++)
- rb[sizeof(uint32)+5+n]=o[n];
- p=(uint32)TIFFReadFile(tif,&(rb[sizeof(uint32)+21]),q);
+ rb[sizeof(uint32_t) + 5 + n]=o[n];
+ p=(uint32_t)TIFFReadFile(tif, &(rb[sizeof(uint32_t) + 21]), q);
if (p!=q)
{
_TIFFfree(rb);
@@ -1990,7 +1990,7 @@ OJPEGReadHeaderInfoSecTablesAcTable(TIFF* tif)
static int
OJPEGReadBufferFill(OJPEGState* sp)
{
- uint16 m;
+ uint16_t m;
tmsize_t n;
/* TODO: double-check: when subsamplingcorrect is set, no call to TIFFErrorExt or TIFFWarningExt should be made
* in any other case, seek or read errors should be passed through */
@@ -2004,16 +2004,16 @@ OJPEGReadBufferFill(OJPEGState* sp)
sp->in_buffer_file_pos_log=1;
}
m=OJPEG_BUFFER;
- if ((uint64)m>sp->in_buffer_file_togo)
- m=(uint16)sp->in_buffer_file_togo;
+ if ((uint64_t)m > sp->in_buffer_file_togo)
+ m=(uint16_t)sp->in_buffer_file_togo;
n=TIFFReadFile(sp->tif,sp->in_buffer,(tmsize_t)m);
if (n==0)
return(0);
assert(n>0);
assert(n<=OJPEG_BUFFER);
assert(n<65536);
- assert((uint64)n<=sp->in_buffer_file_togo);
- m=(uint16)n;
+ assert((uint64_t)n <= sp->in_buffer_file_togo);
+ m=(uint16_t)n;
sp->in_buffer_togo=m;
sp->in_buffer_cur=sp->in_buffer;
sp->in_buffer_file_togo-=m;
@@ -2045,7 +2045,7 @@ OJPEGReadBufferFill(OJPEGState* sp)
return 0;
if (sp->in_buffer_file_pos!=0)
{
- uint64 bytecount = TIFFGetStrileByteCountWithErr(sp->tif, sp->in_buffer_next_strile, &err);
+ uint64_t bytecount = TIFFGetStrileByteCountWithErr(sp->tif, sp->in_buffer_next_strile, &err);
if( err )
return 0;
if (sp->in_buffer_file_pos>=sp->file_size)
@@ -2057,7 +2057,7 @@ OJPEGReadBufferFill(OJPEGState* sp)
sp->in_buffer_file_togo=bytecount;
if (sp->in_buffer_file_togo==0)
sp->in_buffer_file_pos=0;
- else if (sp->in_buffer_file_pos > TIFF_UINT64_MAX - sp->in_buffer_file_togo ||
+ else if (sp->in_buffer_file_pos > UINT64_MAX - sp->in_buffer_file_togo ||
sp->in_buffer_file_pos+sp->in_buffer_file_togo>sp->file_size)
sp->in_buffer_file_togo=sp->file_size-sp->in_buffer_file_pos;
}
@@ -2073,7 +2073,7 @@ OJPEGReadBufferFill(OJPEGState* sp)
}
static int
-OJPEGReadByte(OJPEGState* sp, uint8* byte)
+OJPEGReadByte(OJPEGState* sp, uint8_t* byte)
{
if (sp->in_buffer_togo==0)
{
@@ -2088,7 +2088,7 @@ OJPEGReadByte(OJPEGState* sp, uint8* byte)
}
static int
-OJPEGReadBytePeek(OJPEGState* sp, uint8* byte)
+OJPEGReadBytePeek(OJPEGState* sp, uint8_t* byte)
{
if (sp->in_buffer_togo==0)
{
@@ -2109,9 +2109,9 @@ OJPEGReadByteAdvance(OJPEGState* sp)
}
static int
-OJPEGReadWord(OJPEGState* sp, uint16* word)
+OJPEGReadWord(OJPEGState* sp, uint16_t* word)
{
- uint8 m;
+ uint8_t m;
if (OJPEGReadByte(sp,&m)==0)
return(0);
*word=(m<<8);
@@ -2122,11 +2122,11 @@ OJPEGReadWord(OJPEGState* sp, uint16* word)
}
static int
-OJPEGReadBlock(OJPEGState* sp, uint16 len, void* mem)
+OJPEGReadBlock(OJPEGState* sp, uint16_t len, void* mem)
{
- uint16 mlen;
- uint8* mmem;
- uint16 n;
+ uint16_t mlen;
+ uint8_t* mmem;
+ uint16_t n;
assert(len>0);
mlen=len;
mmem=mem;
@@ -2151,10 +2151,10 @@ OJPEGReadBlock(OJPEGState* sp, uint16 len, void* mem)
}
static void
-OJPEGReadSkip(OJPEGState* sp, uint16 len)
+OJPEGReadSkip(OJPEGState* sp, uint16_t len)
{
- uint16 m;
- uint16 n;
+ uint16_t m;
+ uint16_t n;
m=len;
n=m;
if (n>sp->in_buffer_togo)
@@ -2166,8 +2166,8 @@ OJPEGReadSkip(OJPEGState* sp, uint16 len)
{
assert(sp->in_buffer_togo==0);
n=m;
- if ((uint64)n>sp->in_buffer_file_togo)
- n=(uint16)sp->in_buffer_file_togo;
+ if ((uint64_t)n > sp->in_buffer_file_togo)
+ n=(uint16_t)sp->in_buffer_file_togo;
sp->in_buffer_file_pos+=n;
sp->in_buffer_file_togo-=n;
sp->in_buffer_file_pos_log=0;
@@ -2181,7 +2181,7 @@ OJPEGReadSkip(OJPEGState* sp, uint16 len)
}
static int
-OJPEGWriteStream(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStream(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
*len=0;
@@ -2254,7 +2254,7 @@ OJPEGWriteStream(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
assert(OJPEG_BUFFER>=2);
@@ -2266,43 +2266,43 @@ OJPEGWriteStreamSoi(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamQTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)
+OJPEGWriteStreamQTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
if (sp->qtable[table_index]!=0)
{
- *mem=(void*)(sp->qtable[table_index]+sizeof(uint32));
- *len=*((uint32*)sp->qtable[table_index])-sizeof(uint32);
+ *mem=(void*)(sp->qtable[table_index]+sizeof(uint32_t));
+ *len= *((uint32_t*)sp->qtable[table_index]) - sizeof(uint32_t);
}
sp->out_state++;
}
static void
-OJPEGWriteStreamDcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)
+OJPEGWriteStreamDcTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
if (sp->dctable[table_index]!=0)
{
- *mem=(void*)(sp->dctable[table_index]+sizeof(uint32));
- *len=*((uint32*)sp->dctable[table_index])-sizeof(uint32);
+ *mem=(void*)(sp->dctable[table_index]+sizeof(uint32_t));
+ *len= *((uint32_t*)sp->dctable[table_index]) - sizeof(uint32_t);
}
sp->out_state++;
}
static void
-OJPEGWriteStreamAcTable(TIFF* tif, uint8 table_index, void** mem, uint32* len)
+OJPEGWriteStreamAcTable(TIFF* tif, uint8_t table_index, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
if (sp->actable[table_index]!=0)
{
- *mem=(void*)(sp->actable[table_index]+sizeof(uint32));
- *len=*((uint32*)sp->actable[table_index])-sizeof(uint32);
+ *mem=(void*)(sp->actable[table_index]+sizeof(uint32_t));
+ *len= *((uint32_t*)sp->actable[table_index]) - sizeof(uint32_t);
}
sp->out_state++;
}
static void
-OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
assert(OJPEG_BUFFER>=6);
@@ -2321,10 +2321,10 @@ OJPEGWriteStreamDri(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
+ uint8_t m;
assert(OJPEG_BUFFER>=2+8+sp->samples_per_pixel_per_plane*3);
assert(255>=8+sp->samples_per_pixel_per_plane*3);
sp->out_buffer[0]=255;
@@ -2335,10 +2335,10 @@ OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len)
/* P */
sp->out_buffer[4]=8;
/* Y */
- sp->out_buffer[5]=(uint8)(sp->sof_y>>8);
+ sp->out_buffer[5]=(uint8_t)(sp->sof_y >> 8);
sp->out_buffer[6]=(sp->sof_y&255);
/* X */
- sp->out_buffer[7]=(uint8)(sp->sof_x>>8);
+ sp->out_buffer[7]=(uint8_t)(sp->sof_x >> 8);
sp->out_buffer[8]=(sp->sof_x&255);
/* Nf */
sp->out_buffer[9]=sp->samples_per_pixel_per_plane;
@@ -2357,10 +2357,10 @@ OJPEGWriteStreamSof(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
- uint8 m;
+ uint8_t m;
assert(OJPEG_BUFFER>=2+6+sp->samples_per_pixel_per_plane*2);
assert(255>=6+sp->samples_per_pixel_per_plane*2);
sp->out_buffer[0]=255;
@@ -2389,7 +2389,7 @@ OJPEGWriteStreamSos(TIFF* tif, void** mem, uint32* len)
}
static int
-OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
if (sp->in_buffer_togo==0)
@@ -2422,7 +2422,7 @@ OJPEGWriteStreamCompressed(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
assert(OJPEG_BUFFER>=2);
@@ -2437,7 +2437,7 @@ OJPEGWriteStreamRst(TIFF* tif, void** mem, uint32* len)
}
static void
-OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len)
+OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32_t* len)
{
OJPEGState* sp=(OJPEGState*)tif->tif_data;
assert(OJPEG_BUFFER>=2);
@@ -2462,7 +2462,7 @@ jpeg_create_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
#ifndef LIBJPEG_ENCAP_EXTERNAL
static int
-jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8 require_image)
+jpeg_read_header_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, uint8_t require_image)
{
if( SETJMP(sp->exit_jmpbuf) )
return 0;
@@ -2488,7 +2488,7 @@ jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo)
#ifndef LIBJPEG_ENCAP_EXTERNAL
static int
-jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32 max_lines)
+jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* scanlines, uint32_t max_lines)
{
if( SETJMP(sp->exit_jmpbuf) )
return 0;
@@ -2501,7 +2501,7 @@ jpeg_read_scanlines_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* s
#ifndef LIBJPEG_ENCAP_EXTERNAL
static int
-jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32 max_lines)
+jpeg_read_raw_data_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo, void* data, uint32_t max_lines)
{
if( SETJMP(sp->exit_jmpbuf) )
return 0;
@@ -2550,7 +2550,7 @@ OJPEGLibjpegJpegSourceMgrFillInputBuffer(jpeg_decompress_struct* cinfo)
TIFF* tif=(TIFF*)cinfo->client_data;
OJPEGState* sp=(OJPEGState*)tif->tif_data;
void* mem=0;
- uint32 len=0U;
+ uint32_t len=0U;
if (OJPEGWriteStream(tif,&mem,&len)==0)
{
TIFFErrorExt(tif->tif_clientdata,"LibJpeg","Premature end of JPEG data");
diff --git a/libtiff/tif_open.c b/libtiff/tif_open.c
index a0e31583..7b61d4d3 100644
--- a/libtiff/tif_open.c
+++ b/libtiff/tif_open.c
@@ -88,19 +88,19 @@ TIFFClientOpen(
/* The following are configuration checks. They should be redundant, but should not
* compile to any actual code in an optimised release build anyway. If any of them
* fail, (makefile-based or other) configuration is not correct */
- assert(sizeof(uint8)==1);
- assert(sizeof(int8)==1);
- assert(sizeof(uint16)==2);
- assert(sizeof(int16)==2);
- assert(sizeof(uint32)==4);
- assert(sizeof(int32)==4);
- assert(sizeof(uint64)==8);
- assert(sizeof(int64)==8);
+ assert(sizeof(uint8_t) == 1);
+ assert(sizeof(int8_t) == 1);
+ assert(sizeof(uint16_t) == 2);
+ assert(sizeof(int16_t) == 2);
+ assert(sizeof(uint32_t) == 4);
+ assert(sizeof(int32_t) == 4);
+ assert(sizeof(uint64_t) == 8);
+ assert(sizeof(int64_t) == 8);
assert(sizeof(tmsize_t)==sizeof(void*));
{
union{
- uint8 a8[2];
- uint16 a16;
+ uint8_t a8[2];
+ uint16_t a16;
} n;
n.a8[0]=1;
n.a8[1]=0;
@@ -124,10 +124,10 @@ TIFFClientOpen(
tif->tif_name = (char *)tif + sizeof (TIFF);
strcpy(tif->tif_name, name);
tif->tif_mode = m &~ (O_CREAT|O_TRUNC);
- tif->tif_curdir = (uint16) -1; /* non-existent directory */
+ tif->tif_curdir = (uint16_t) -1; /* non-existent directory */
tif->tif_curoff = 0;
- tif->tif_curstrip = (uint32) -1; /* invalid strip */
- tif->tif_row = (uint32) -1; /* read/write pre-increment */
+ tif->tif_curstrip = (uint32_t) -1; /* invalid strip */
+ tif->tif_row = (uint32_t) -1; /* read/write pre-increment */
tif->tif_clientdata = clientdata;
if (!readproc || !writeproc || !seekproc || !closeproc || !sizeproc) {
TIFFErrorExt(clientdata, module,
@@ -410,7 +410,7 @@ TIFFClientOpen(
}
else
{
- if (!ReadOK(tif, ((uint8*)(&tif->tif_header) + sizeof(TIFFHeaderClassic)), (sizeof(TIFFHeaderBig)-sizeof(TIFFHeaderClassic))))
+ if (!ReadOK(tif, ((uint8_t*)(&tif->tif_header) + sizeof(TIFFHeaderClassic)), (sizeof(TIFFHeaderBig) - sizeof(TIFFHeaderClassic))))
{
TIFFErrorExt(tif->tif_clientdata, name,
"Cannot read TIFF header");
@@ -600,7 +600,7 @@ TIFFIsTiled(TIFF* tif)
/*
* Return current row being read/written.
*/
-uint32
+uint32_t
TIFFCurrentRow(TIFF* tif)
{
return (tif->tif_row);
@@ -609,7 +609,7 @@ TIFFCurrentRow(TIFF* tif)
/*
* Return index of the current directory.
*/
-uint16
+uint16_t
TIFFCurrentDirectory(TIFF* tif)
{
return (tif->tif_curdir);
@@ -618,7 +618,7 @@ TIFFCurrentDirectory(TIFF* tif)
/*
* Return current strip.
*/
-uint32
+uint32_t
TIFFCurrentStrip(TIFF* tif)
{
return (tif->tif_curstrip);
@@ -627,7 +627,7 @@ TIFFCurrentStrip(TIFF* tif)
/*
* Return current tile.
*/
-uint32
+uint32_t
TIFFCurrentTile(TIFF* tif)
{
return (tif->tif_curtile);
diff --git a/libtiff/tif_packbits.c b/libtiff/tif_packbits.c
index a8f29e87..01b6a23c 100644
--- a/libtiff/tif_packbits.c
+++ b/libtiff/tif_packbits.c
@@ -32,11 +32,11 @@
#include <stdio.h>
static int
-PackBitsPreEncode(TIFF* tif, uint16 s)
+PackBitsPreEncode(TIFF* tif, uint16_t s)
{
(void) s;
- tif->tif_data = (uint8*)_TIFFmalloc(sizeof(tmsize_t));
+ tif->tif_data = (uint8_t*)_TIFFmalloc(sizeof(tmsize_t));
if (tif->tif_data == NULL)
return (0);
/*
@@ -61,12 +61,12 @@ PackBitsPostEncode(TIFF* tif)
* Encode a run of pixels.
*/
static int
-PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
+PackBitsEncode(TIFF* tif, uint8_t* buf, tmsize_t cc, uint16_t s)
{
unsigned char* bp = (unsigned char*) buf;
- uint8* op;
- uint8* ep;
- uint8* lastliteral;
+ uint8_t* op;
+ uint8_t* ep;
+ uint8_t* lastliteral;
long n, slop;
int b;
enum { BASE, LITERAL, RUN, LITERAL_RUN } state;
@@ -114,17 +114,17 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if (n > 1) {
state = RUN;
if (n > 128) {
- *op++ = (uint8) -127;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) -127;
+ *op++ = (uint8_t) b;
n -= 128;
goto again;
}
- *op++ = (uint8)(-(n-1));
- *op++ = (uint8) b;
+ *op++ = (uint8_t)(-(n - 1));
+ *op++ = (uint8_t) b;
} else {
lastliteral = op;
*op++ = 0;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) b;
state = LITERAL;
}
break;
@@ -132,33 +132,33 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
if (n > 1) {
state = LITERAL_RUN;
if (n > 128) {
- *op++ = (uint8) -127;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) -127;
+ *op++ = (uint8_t) b;
n -= 128;
goto again;
}
- *op++ = (uint8)(-(n-1)); /* encode run */
- *op++ = (uint8) b;
+ *op++ = (uint8_t)(-(n - 1)); /* encode run */
+ *op++ = (uint8_t) b;
} else { /* extend literal */
if (++(*lastliteral) == 127)
state = BASE;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) b;
}
break;
case RUN: /* last object was run */
if (n > 1) {
if (n > 128) {
- *op++ = (uint8) -127;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) -127;
+ *op++ = (uint8_t) b;
n -= 128;
goto again;
}
- *op++ = (uint8)(-(n-1));
- *op++ = (uint8) b;
+ *op++ = (uint8_t)(-(n - 1));
+ *op++ = (uint8_t) b;
} else {
lastliteral = op;
*op++ = 0;
- *op++ = (uint8) b;
+ *op++ = (uint8_t) b;
state = LITERAL;
}
break;
@@ -169,7 +169,7 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
* case we convert literal-run-literal
* to a single literal.
*/
- if (n == 1 && op[-2] == (uint8) -1 &&
+ if (n == 1 && op[-2] == (uint8_t) -1 &&
*lastliteral < 126) {
state = (((*lastliteral) += 2) == 127 ?
BASE : LITERAL);
@@ -192,7 +192,7 @@ PackBitsEncode(TIFF* tif, uint8* buf, tmsize_t cc, uint16 s)
* when it was encoded by strips.
*/
static int
-PackBitsEncodeChunk(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+PackBitsEncodeChunk(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
tmsize_t rowsize = *(tmsize_t*)tif->tif_data;
@@ -211,7 +211,7 @@ PackBitsEncodeChunk(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
static int
-PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+PackBitsDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "PackBitsDecode";
char *bp;
@@ -252,7 +252,7 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
b = *bp++;
cc--;
while (n-- > 0)
- *op++ = (uint8) b;
+ *op++ = (uint8_t) b;
} else { /* copy next n+1 bytes literally */
if (occ < (tmsize_t)(n + 1))
{
@@ -272,7 +272,7 @@ PackBitsDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp += n; cc -= n;
}
}
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
if (occ > 0) {
TIFFErrorExt(tif->tif_clientdata, module,
diff --git a/libtiff/tif_pixarlog.c b/libtiff/tif_pixarlog.c
index 3141f213..a3846aab 100644
--- a/libtiff/tif_pixarlog.c
+++ b/libtiff/tif_pixarlog.c
@@ -109,8 +109,8 @@ static float LogK1, LogK2;
#define REPEAT(n, op) { int i; i=n; do { i--; op; } while (i>0); }
static void
-horizontalAccumulateF(uint16 *wp, int n, int stride, float *op,
- float *ToLinearF)
+horizontalAccumulateF(uint16_t *wp, int n, int stride, float *op,
+ float *ToLinearF)
{
register unsigned int cr, cg, cb, ca, mask;
register float t0, t1, t2, t3;
@@ -172,14 +172,14 @@ horizontalAccumulateF(uint16 *wp, int n, int stride, float *op,
}
static void
-horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op,
- float *ToLinearF)
+horizontalAccumulate12(uint16_t *wp, int n, int stride, int16_t *op,
+ float *ToLinearF)
{
register unsigned int cr, cg, cb, ca, mask;
register float t0, t1, t2, t3;
#define SCALE12 2048.0F
-#define CLAMP12(t) (((t) < 3071) ? (uint16) (t) : 3071)
+#define CLAMP12(t) (((t) < 3071) ? (uint16_t) (t) : 3071)
if (n >= stride) {
mask = CODE_MASK;
@@ -240,8 +240,8 @@ horizontalAccumulate12(uint16 *wp, int n, int stride, int16 *op,
}
static void
-horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
- uint16 *ToLinear16)
+horizontalAccumulate16(uint16_t *wp, int n, int stride, uint16_t *op,
+ uint16_t *ToLinear16)
{
register unsigned int cr, cg, cb, ca, mask;
@@ -292,7 +292,7 @@ horizontalAccumulate16(uint16 *wp, int n, int stride, uint16 *op,
* differencing undone.
*/
static void
-horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
+horizontalAccumulate11(uint16_t *wp, int n, int stride, uint16_t *op)
{
register unsigned int cr, cg, cb, ca, mask;
@@ -306,9 +306,9 @@ horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
wp += 3;
op += 3;
n -= 3;
- op[0] = (uint16)((cr += wp[0]) & mask);
- op[1] = (uint16)((cg += wp[1]) & mask);
- op[2] = (uint16)((cb += wp[2]) & mask);
+ op[0] = (uint16_t)((cr += wp[0]) & mask);
+ op[1] = (uint16_t)((cg += wp[1]) & mask);
+ op[2] = (uint16_t)((cb += wp[2]) & mask);
}
} else if (stride == 4) {
op[0] = wp[0]; op[1] = wp[1];
@@ -319,10 +319,10 @@ horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
wp += 4;
op += 4;
n -= 4;
- op[0] = (uint16)((cr += wp[0]) & mask);
- op[1] = (uint16)((cg += wp[1]) & mask);
- op[2] = (uint16)((cb += wp[2]) & mask);
- op[3] = (uint16)((ca += wp[3]) & mask);
+ op[0] = (uint16_t)((cr += wp[0]) & mask);
+ op[1] = (uint16_t)((cg += wp[1]) & mask);
+ op[2] = (uint16_t)((cb += wp[2]) & mask);
+ op[3] = (uint16_t)((ca += wp[3]) & mask);
}
} else {
REPEAT(stride, *op = *wp&mask; wp++; op++)
@@ -337,8 +337,8 @@ horizontalAccumulate11(uint16 *wp, int n, int stride, uint16 *op)
}
static void
-horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op,
- unsigned char *ToLinear8)
+horizontalAccumulate8(uint16_t *wp, int n, int stride, unsigned char *op,
+ unsigned char *ToLinear8)
{
register unsigned int cr, cg, cb, ca, mask;
@@ -386,8 +386,8 @@ horizontalAccumulate8(uint16 *wp, int n, int stride, unsigned char *op,
static void
-horizontalAccumulate8abgr(uint16 *wp, int n, int stride, unsigned char *op,
- unsigned char *ToLinear8)
+horizontalAccumulate8abgr(uint16_t *wp, int n, int stride, unsigned char *op,
+ unsigned char *ToLinear8)
{
register unsigned int cr, cg, cb, ca, mask;
register unsigned char t0, t1, t2, t3;
@@ -458,8 +458,8 @@ typedef struct {
TIFFPredictorState predict;
z_stream stream;
tmsize_t tbuf_size; /* only set/used on reading for now */
- uint16 *tbuf;
- uint16 stride;
+ uint16_t *tbuf;
+ uint16_t stride;
int state;
int user_datafmt;
int quality;
@@ -469,11 +469,11 @@ typedef struct {
TIFFVSetMethod vsetparent; /* super-class method */
float *ToLinearF;
- uint16 *ToLinear16;
+ uint16_t *ToLinear16;
unsigned char *ToLinear8;
- uint16 *FromLT2;
- uint16 *From14; /* Really for 16-bit data, but we shift down 2 */
- uint16 *From8;
+ uint16_t *FromLT2;
+ uint16_t *From14; /* Really for 16-bit data, but we shift down 2 */
+ uint16_t *From8;
} PixarLogState;
@@ -496,11 +496,11 @@ PixarLogMakeTables(PixarLogState *sp)
int i, j;
double b, c, linstep, v;
float *ToLinearF;
- uint16 *ToLinear16;
+ uint16_t *ToLinear16;
unsigned char *ToLinear8;
- uint16 *FromLT2;
- uint16 *From14; /* Really for 16-bit data, but we shift down 2 */
- uint16 *From8;
+ uint16_t *FromLT2;
+ uint16_t *From14; /* Really for 16-bit data, but we shift down 2 */
+ uint16_t *From8;
c = log(RATIO);
nlin = (int)(1./c); /* nlin must be an integer */
@@ -511,11 +511,11 @@ PixarLogMakeTables(PixarLogState *sp)
LogK1 = (float)(1./c); /* if (v >= 2) token = k1*log(v*k2) */
LogK2 = (float)(1./b);
lt2size = (int)(2./linstep) + 1;
- FromLT2 = (uint16 *)_TIFFmalloc(lt2size*sizeof(uint16));
- From14 = (uint16 *)_TIFFmalloc(16384*sizeof(uint16));
- From8 = (uint16 *)_TIFFmalloc(256*sizeof(uint16));
+ FromLT2 = (uint16_t *)_TIFFmalloc(lt2size * sizeof(uint16_t));
+ From14 = (uint16_t *)_TIFFmalloc(16384 * sizeof(uint16_t));
+ From8 = (uint16_t *)_TIFFmalloc(256 * sizeof(uint16_t));
ToLinearF = (float *)_TIFFmalloc(TSIZEP1 * sizeof(float));
- ToLinear16 = (uint16 *)_TIFFmalloc(TSIZEP1 * sizeof(uint16));
+ ToLinear16 = (uint16_t *)_TIFFmalloc(TSIZEP1 * sizeof(uint16_t));
ToLinear8 = (unsigned char *)_TIFFmalloc(TSIZEP1 * sizeof(unsigned char));
if (FromLT2 == NULL || From14 == NULL || From8 == NULL ||
ToLinearF == NULL || ToLinear16 == NULL || ToLinear8 == NULL) {
@@ -548,7 +548,7 @@ PixarLogMakeTables(PixarLogState *sp)
for (i = 0; i < TSIZEP1; i++) {
v = ToLinearF[i]*65535.0 + 0.5;
- ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16)v;
+ ToLinear16[i] = (v > 65535.0) ? 65535 : (uint16_t)v;
v = ToLinearF[i]*255.0 + 0.5;
ToLinear8[i] = (v > 255.0) ? 255 : (unsigned char)v;
}
@@ -557,7 +557,7 @@ PixarLogMakeTables(PixarLogState *sp)
for (i = 0; i < lt2size; i++) {
if ((i*linstep)*(i*linstep) > ToLinearF[j]*ToLinearF[j+1])
j++;
- FromLT2[i] = (uint16)j;
+ FromLT2[i] = (uint16_t)j;
}
/*
@@ -569,14 +569,14 @@ PixarLogMakeTables(PixarLogState *sp)
for (i = 0; i < 16384; i++) {
while ((i/16383.)*(i/16383.) > ToLinearF[j]*ToLinearF[j+1])
j++;
- From14[i] = (uint16)j;
+ From14[i] = (uint16_t)j;
}
j = 0;
for (i = 0; i < 256; i++) {
while ((i/255.)*(i/255.) > ToLinearF[j]*ToLinearF[j+1])
j++;
- From8[i] = (uint16)j;
+ From8[i] = (uint16_t)j;
}
Fltsize = (float)(lt2size/2);
@@ -594,8 +594,8 @@ PixarLogMakeTables(PixarLogState *sp)
#define DecoderState(tif) ((PixarLogState*) (tif)->tif_data)
#define EncoderState(tif) ((PixarLogState*) (tif)->tif_data)
-static int PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
+static int PixarLogEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int PixarLogDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s);
#define PIXARLOGDATAFMT_UNKNOWN -1
@@ -667,7 +667,7 @@ PixarLogSetupDecode(TIFF* tif)
TIFFDirectory *td = &tif->tif_dir;
PixarLogState* sp = DecoderState(tif);
tmsize_t tbuf_size;
- uint32 strip_height;
+ uint32_t strip_height;
assert(sp != NULL);
@@ -690,12 +690,12 @@ PixarLogSetupDecode(TIFF* tif)
sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
td->td_samplesperpixel : 1);
tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth),
- strip_height), sizeof(uint16));
+ strip_height), sizeof(uint16_t));
/* add one more stride in case input ends mid-stride */
- tbuf_size = add_ms(tbuf_size, sizeof(uint16) * sp->stride);
+ tbuf_size = add_ms(tbuf_size, sizeof(uint16_t) * sp->stride);
if (tbuf_size == 0)
return (0); /* TODO: this is an error return without error report through TIFFErrorExt */
- sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
+ sp->tbuf = (uint16_t *) _TIFFmalloc(tbuf_size);
if (sp->tbuf == NULL)
return (0);
sp->tbuf_size = tbuf_size;
@@ -727,7 +727,7 @@ PixarLogSetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-PixarLogPreDecode(TIFF* tif, uint16 s)
+PixarLogPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "PixarLogPreDecode";
PixarLogState* sp = DecoderState(tif);
@@ -749,7 +749,7 @@ PixarLogPreDecode(TIFF* tif, uint16 s)
}
static int
-PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+PixarLogDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "PixarLogDecode";
TIFFDirectory *td = &tif->tif_dir;
@@ -757,7 +757,7 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
tmsize_t i;
tmsize_t nsamples;
int llen;
- uint16 *up;
+ uint16_t *up;
switch (sp->user_datafmt) {
case PIXARLOGDATAFMT_FLOAT:
@@ -766,7 +766,7 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
case PIXARLOGDATAFMT_16BIT:
case PIXARLOGDATAFMT_12BITPICIO:
case PIXARLOGDATAFMT_11BITLOG:
- nsamples = occ / sizeof(uint16); /* XXX uint16 == 16 bits */
+ nsamples = occ / sizeof(uint16_t); /* XXX uint16_t == 16 bits */
break;
case PIXARLOGDATAFMT_8BIT:
case PIXARLOGDATAFMT_8BITABGR:
@@ -792,8 +792,8 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
appropriately even before we simplify it */
- sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16));
- if (sp->stream.avail_out != nsamples * sizeof(uint16))
+ sp->stream.avail_out = (uInt) (nsamples * sizeof(uint16_t));
+ if (sp->stream.avail_out != nsamples * sizeof(uint16_t))
{
TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size");
return (0);
@@ -825,8 +825,8 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
/* hopefully, we got all the bytes we needed */
if (sp->stream.avail_out != 0) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at scanline %lu (short %" TIFF_UINT64_FORMAT " bytes)",
- (unsigned long) tif->tif_row, (TIFF_UINT64_T) sp->stream.avail_out);
+ "Not enough data at scanline %lu (short %" PRIu64 " bytes)",
+ (unsigned long) tif->tif_row, (uint64_t) sp->stream.avail_out);
return (0);
}
@@ -859,18 +859,18 @@ PixarLogDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
break;
case PIXARLOGDATAFMT_16BIT:
horizontalAccumulate16(up, llen, sp->stride,
- (uint16 *)op, sp->ToLinear16);
- op += llen * sizeof(uint16);
+ (uint16_t *)op, sp->ToLinear16);
+ op += llen * sizeof(uint16_t);
break;
case PIXARLOGDATAFMT_12BITPICIO:
horizontalAccumulate12(up, llen, sp->stride,
- (int16 *)op, sp->ToLinearF);
- op += llen * sizeof(int16);
+ (int16_t *)op, sp->ToLinearF);
+ op += llen * sizeof(int16_t);
break;
case PIXARLOGDATAFMT_11BITLOG:
horizontalAccumulate11(up, llen, sp->stride,
- (uint16 *)op);
- op += llen * sizeof(uint16);
+ (uint16_t *)op);
+ op += llen * sizeof(uint16_t);
break;
case PIXARLOGDATAFMT_8BIT:
horizontalAccumulate8(up, llen, sp->stride,
@@ -908,10 +908,10 @@ PixarLogSetupEncode(TIFF* tif)
sp->stride = (td->td_planarconfig == PLANARCONFIG_CONTIG ?
td->td_samplesperpixel : 1);
tbuf_size = multiply_ms(multiply_ms(multiply_ms(sp->stride, td->td_imagewidth),
- td->td_rowsperstrip), sizeof(uint16));
+ td->td_rowsperstrip), sizeof(uint16_t));
if (tbuf_size == 0)
return (0); /* TODO: this is an error return without error report through TIFFErrorExt */
- sp->tbuf = (uint16 *) _TIFFmalloc(tbuf_size);
+ sp->tbuf = (uint16_t *) _TIFFmalloc(tbuf_size);
if (sp->tbuf == NULL)
return (0);
if (sp->user_datafmt == PIXARLOGDATAFMT_UNKNOWN)
@@ -934,7 +934,7 @@ PixarLogSetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-PixarLogPreEncode(TIFF* tif, uint16 s)
+PixarLogPreEncode(TIFF* tif, uint16_t s)
{
static const char module[] = "PixarLogPreEncode";
PixarLogState *sp = EncoderState(tif);
@@ -956,9 +956,9 @@ PixarLogPreEncode(TIFF* tif, uint16 s)
}
static void
-horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
+horizontalDifferenceF(float *ip, int n, int stride, uint16_t *wp, uint16_t *FromLT2)
{
- int32 r1, g1, b1, a1, r2, g2, b2, a2, mask;
+ int32_t r1, g1, b1, a1, r2, g2, b2, a2, mask;
float fltsize = Fltsize;
#define CLAMP(v) ( (v<(float)0.) ? 0 \
@@ -969,39 +969,39 @@ horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
mask = CODE_MASK;
if (n >= stride) {
if (stride == 3) {
- r2 = wp[0] = (uint16) CLAMP(ip[0]);
- g2 = wp[1] = (uint16) CLAMP(ip[1]);
- b2 = wp[2] = (uint16) CLAMP(ip[2]);
+ r2 = wp[0] = (uint16_t) CLAMP(ip[0]);
+ g2 = wp[1] = (uint16_t) CLAMP(ip[1]);
+ b2 = wp[2] = (uint16_t) CLAMP(ip[2]);
n -= 3;
while (n > 0) {
n -= 3;
wp += 3;
ip += 3;
- r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
+ r1 = (int32_t) CLAMP(ip[0]); wp[0] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = (int32_t) CLAMP(ip[1]); wp[1] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = (int32_t) CLAMP(ip[2]); wp[2] = (uint16_t)((b1 - b2) & mask); b2 = b1;
}
} else if (stride == 4) {
- r2 = wp[0] = (uint16) CLAMP(ip[0]);
- g2 = wp[1] = (uint16) CLAMP(ip[1]);
- b2 = wp[2] = (uint16) CLAMP(ip[2]);
- a2 = wp[3] = (uint16) CLAMP(ip[3]);
+ r2 = wp[0] = (uint16_t) CLAMP(ip[0]);
+ g2 = wp[1] = (uint16_t) CLAMP(ip[1]);
+ b2 = wp[2] = (uint16_t) CLAMP(ip[2]);
+ a2 = wp[3] = (uint16_t) CLAMP(ip[3]);
n -= 4;
while (n > 0) {
n -= 4;
wp += 4;
ip += 4;
- r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
- a1 = (int32) CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
+ r1 = (int32_t) CLAMP(ip[0]); wp[0] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = (int32_t) CLAMP(ip[1]); wp[1] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = (int32_t) CLAMP(ip[2]); wp[2] = (uint16_t)((b1 - b2) & mask); b2 = b1;
+ a1 = (int32_t) CLAMP(ip[3]); wp[3] = (uint16_t)((a1 - a2) & mask); a2 = a1;
}
} else {
- REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp++; ip++)
+ REPEAT(stride, wp[0] = (uint16_t) CLAMP(ip[0]); wp++; ip++)
n -= stride;
while (n > 0) {
REPEAT(stride,
- wp[0] = (uint16)(((int32)CLAMP(ip[0])-(int32)CLAMP(ip[-stride])) & mask);
+ wp[0] = (uint16_t)(((int32_t)CLAMP(ip[0]) - (int32_t)CLAMP(ip[-stride])) & mask);
wp++; ip++)
n -= stride;
}
@@ -1010,8 +1010,8 @@ horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2)
}
static void
-horizontalDifference16(unsigned short *ip, int n, int stride,
- unsigned short *wp, uint16 *From14)
+horizontalDifference16(unsigned short *ip, int n, int stride,
+ unsigned short *wp, uint16_t *From14)
{
register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
@@ -1029,9 +1029,9 @@ horizontalDifference16(unsigned short *ip, int n, int stride,
n -= 3;
wp += 3;
ip += 3;
- r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
+ r1 = CLAMP(ip[0]); wp[0] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[1]); wp[1] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[2]); wp[2] = (uint16_t)((b1 - b2) & mask); b2 = b1;
}
} else if (stride == 4) {
r2 = wp[0] = CLAMP(ip[0]); g2 = wp[1] = CLAMP(ip[1]);
@@ -1041,17 +1041,17 @@ horizontalDifference16(unsigned short *ip, int n, int stride,
n -= 4;
wp += 4;
ip += 4;
- r1 = CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1;
- a1 = CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1;
+ r1 = CLAMP(ip[0]); wp[0] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[1]); wp[1] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[2]); wp[2] = (uint16_t)((b1 - b2) & mask); b2 = b1;
+ a1 = CLAMP(ip[3]); wp[3] = (uint16_t)((a1 - a2) & mask); a2 = a1;
}
} else {
REPEAT(stride, wp[0] = CLAMP(ip[0]); wp++; ip++)
n -= stride;
while (n > 0) {
REPEAT(stride,
- wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
+ wp[0] = (uint16_t)((CLAMP(ip[0]) - CLAMP(ip[-stride])) & mask);
wp++; ip++)
n -= stride;
}
@@ -1061,8 +1061,8 @@ horizontalDifference16(unsigned short *ip, int n, int stride,
static void
-horizontalDifference8(unsigned char *ip, int n, int stride,
- unsigned short *wp, uint16 *From8)
+horizontalDifference8(unsigned char *ip, int n, int stride,
+ unsigned short *wp, uint16_t *From8)
{
register int r1, g1, b1, a1, r2, g2, b2, a2, mask;
@@ -1077,9 +1077,9 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
n -= 3;
while (n > 0) {
n -= 3;
- r1 = CLAMP(ip[3]); wp[3] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = CLAMP(ip[4]); wp[4] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = CLAMP(ip[5]); wp[5] = (uint16)((b1-b2) & mask); b2 = b1;
+ r1 = CLAMP(ip[3]); wp[3] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[4]); wp[4] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[5]); wp[5] = (uint16_t)((b1 - b2) & mask); b2 = b1;
wp += 3;
ip += 3;
}
@@ -1089,10 +1089,10 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
n -= 4;
while (n > 0) {
n -= 4;
- r1 = CLAMP(ip[4]); wp[4] = (uint16)((r1-r2) & mask); r2 = r1;
- g1 = CLAMP(ip[5]); wp[5] = (uint16)((g1-g2) & mask); g2 = g1;
- b1 = CLAMP(ip[6]); wp[6] = (uint16)((b1-b2) & mask); b2 = b1;
- a1 = CLAMP(ip[7]); wp[7] = (uint16)((a1-a2) & mask); a2 = a1;
+ r1 = CLAMP(ip[4]); wp[4] = (uint16_t)((r1 - r2) & mask); r2 = r1;
+ g1 = CLAMP(ip[5]); wp[5] = (uint16_t)((g1 - g2) & mask); g2 = g1;
+ b1 = CLAMP(ip[6]); wp[6] = (uint16_t)((b1 - b2) & mask); b2 = b1;
+ a1 = CLAMP(ip[7]); wp[7] = (uint16_t)((a1 - a2) & mask); a2 = a1;
wp += 4;
ip += 4;
}
@@ -1101,7 +1101,7 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
n -= stride;
while (n > 0) {
REPEAT(stride,
- wp[0] = (uint16)((CLAMP(ip[0])-CLAMP(ip[-stride])) & mask);
+ wp[0] = (uint16_t)((CLAMP(ip[0]) - CLAMP(ip[-stride])) & mask);
wp++; ip++)
n -= stride;
}
@@ -1113,7 +1113,7 @@ horizontalDifference8(unsigned char *ip, int n, int stride,
* Encode a chunk of pixels.
*/
static int
-PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+PixarLogEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "PixarLogEncode";
TIFFDirectory *td = &tif->tif_dir;
@@ -1132,7 +1132,7 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
case PIXARLOGDATAFMT_16BIT:
case PIXARLOGDATAFMT_12BITPICIO:
case PIXARLOGDATAFMT_11BITLOG:
- n = cc / sizeof(uint16); /* XXX uint16 == 16 bits */
+ n = cc / sizeof(uint16_t); /* XXX uint16_t == 16 bits */
break;
case PIXARLOGDATAFMT_8BIT:
case PIXARLOGDATAFMT_8BITABGR:
@@ -1146,7 +1146,7 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
llen = sp->stride * td->td_imagewidth;
- /* Check against the number of elements (of size uint16) of sp->tbuf */
+ /* Check against the number of elements (of size uint16_t) of sp->tbuf */
if( n > ((tmsize_t)td->td_rowsperstrip * llen) )
{
TIFFErrorExt(tif->tif_clientdata, module,
@@ -1162,9 +1162,9 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
bp += llen * sizeof(float);
break;
case PIXARLOGDATAFMT_16BIT:
- horizontalDifference16((uint16 *)bp, llen,
- sp->stride, up, sp->From14);
- bp += llen * sizeof(uint16);
+ horizontalDifference16((uint16_t *)bp, llen,
+ sp->stride, up, sp->From14);
+ bp += llen * sizeof(uint16_t);
break;
case PIXARLOGDATAFMT_8BIT:
horizontalDifference8((unsigned char *)bp, llen,
@@ -1184,8 +1184,8 @@ PixarLogEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
appropriately even before we simplify it */
- sp->stream.avail_in = (uInt) (n * sizeof(uint16));
- if ((sp->stream.avail_in / sizeof(uint16)) != (uInt) n)
+ sp->stream.avail_in = (uInt) (n * sizeof(uint16_t));
+ if ((sp->stream.avail_in / sizeof(uint16_t)) != (uInt) n)
{
TIFFErrorExt(tif->tif_clientdata, module,
"ZLib cannot deal with buffers this size");
@@ -1309,7 +1309,7 @@ PixarLogCleanup(TIFF* tif)
}
static int
-PixarLogVSetField(TIFF* tif, uint32 tag, va_list ap)
+PixarLogVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "PixarLogVSetField";
PixarLogState *sp = (PixarLogState *)tif->tif_data;
@@ -1371,7 +1371,7 @@ PixarLogVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-PixarLogVGetField(TIFF* tif, uint32 tag, va_list ap)
+PixarLogVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
PixarLogState *sp = (PixarLogState *)tif->tif_data;
@@ -1416,7 +1416,7 @@ TIFFInitPixarLog(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof (PixarLogState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof (PixarLogState));
if (tif->tif_data == NULL)
goto bad;
sp = (PixarLogState*) tif->tif_data;
diff --git a/libtiff/tif_predict.c b/libtiff/tif_predict.c
index 49ee1070..30c674c5 100644
--- a/libtiff/tif_predict.c
+++ b/libtiff/tif_predict.c
@@ -32,22 +32,22 @@
#define PredictorState(tif) ((TIFFPredictorState*) (tif)->tif_data)
-static int horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc);
-static int PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
-static int PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s);
-static int PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s);
+static int horAcc8(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int horAcc16(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int horAcc32(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int swabHorAcc16(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int swabHorAcc32(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int horDiff8(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int horDiff16(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int horDiff32(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int swabHorDiff16(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int swabHorDiff32(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int fpAcc(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int fpDiff(TIFF* tif, uint8_t* cp0, tmsize_t cc);
+static int PredictorDecodeRow(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s);
+static int PredictorDecodeTile(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s);
+static int PredictorEncodeRow(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int PredictorEncodeTile(TIFF* tif, uint8_t* bp0, tmsize_t cc0, uint16_t s);
static int
PredictorSetup(TIFF* tif)
@@ -277,7 +277,7 @@ PredictorSetupEncode(TIFF* tif)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc)
+horAcc8(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
@@ -334,9 +334,9 @@ horAcc8(TIFF* tif, uint8* cp0, tmsize_t cc)
}
static int
-swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
+swabHorAcc16(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
- uint16* wp = (uint16*) cp0;
+ uint16_t* wp = (uint16_t*) cp0;
tmsize_t wc = cc / 2;
TIFFSwabArrayOfShort(wp, wc);
@@ -345,10 +345,10 @@ swabHorAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
+horAcc16(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
- uint16* wp = (uint16*) cp0;
+ uint16_t* wp = (uint16_t*) cp0;
tmsize_t wc = cc / 2;
if((cc%(2*stride))!=0)
@@ -361,7 +361,7 @@ horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
if (wc > stride) {
wc -= stride;
do {
- REPEAT4(stride, wp[stride] = (uint16)(((unsigned int)wp[stride] + (unsigned int)wp[0]) & 0xffff); wp++)
+ REPEAT4(stride, wp[stride] = (uint16_t)(((unsigned int)wp[stride] + (unsigned int)wp[0]) & 0xffff); wp++)
wc -= stride;
} while (wc > 0);
}
@@ -369,9 +369,9 @@ horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc)
}
static int
-swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
+swabHorAcc32(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
- uint32* wp = (uint32*) cp0;
+ uint32_t* wp = (uint32_t*) cp0;
tmsize_t wc = cc / 4;
TIFFSwabArrayOfLong(wp, wc);
@@ -380,10 +380,10 @@ swabHorAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
+horAcc32(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
- uint32* wp = (uint32*) cp0;
+ uint32_t* wp = (uint32_t*) cp0;
tmsize_t wc = cc / 4;
if((cc%(4*stride))!=0)
@@ -407,14 +407,14 @@ horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc)
* Floating point predictor accumulation routine.
*/
static int
-fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
+fpAcc(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
- uint32 bps = tif->tif_dir.td_bitspersample / 8;
+ uint32_t bps = tif->tif_dir.td_bitspersample / 8;
tmsize_t wc = cc / bps;
tmsize_t count = cc;
- uint8 *cp = (uint8 *) cp0;
- uint8 *tmp;
+ uint8_t *cp = (uint8_t *) cp0;
+ uint8_t *tmp;
if(cc%(bps*stride)!=0)
{
@@ -423,7 +423,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
return 0;
}
- tmp = (uint8 *)_TIFFmalloc(cc);
+ tmp = (uint8_t *)_TIFFmalloc(cc);
if (!tmp)
return 0;
@@ -434,9 +434,9 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
}
_TIFFmemcpy(tmp, cp0, cc);
- cp = (uint8 *) cp0;
+ cp = (uint8_t *) cp0;
for (count = 0; count < wc; count++) {
- uint32 byte;
+ uint32_t byte;
for (byte = 0; byte < bps; byte++) {
#if WORDS_BIGENDIAN
cp[bps * count + byte] = tmp[byte * wc + count];
@@ -454,7 +454,7 @@ fpAcc(TIFF* tif, uint8* cp0, tmsize_t cc)
* Decode a scanline and apply the predictor routine.
*/
static int
-PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
+PredictorDecodeRow(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s)
{
TIFFPredictorState *sp = PredictorState(tif);
@@ -476,7 +476,7 @@ PredictorDecodeRow(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
* strip/tile dimensions.
*/
static int
-PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
+PredictorDecodeTile(TIFF* tif, uint8_t* op0, tmsize_t occ0, uint16_t s)
{
TIFFPredictorState *sp = PredictorState(tif);
@@ -506,7 +506,7 @@ PredictorDecodeTile(TIFF* tif, uint8* op0, tmsize_t occ0, uint16 s)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)
+horDiff8(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
tmsize_t stride = sp->stride;
@@ -560,11 +560,11 @@ horDiff8(TIFF* tif, uint8* cp0, tmsize_t cc)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
+horDiff16(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
tmsize_t stride = sp->stride;
- uint16 *wp = (uint16*) cp0;
+ uint16_t *wp = (uint16_t*) cp0;
tmsize_t wc = cc/2;
if((cc%(2*stride))!=0)
@@ -578,7 +578,7 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
wc -= stride;
wp += wc - 1;
do {
- REPEAT4(stride, wp[stride] = (uint16)(((unsigned int)wp[stride] - (unsigned int)wp[0]) & 0xffff); wp--)
+ REPEAT4(stride, wp[stride] = (uint16_t)(((unsigned int)wp[stride] - (unsigned int)wp[0]) & 0xffff); wp--)
wc -= stride;
} while (wc > 0);
}
@@ -586,9 +586,9 @@ horDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
}
static int
-swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
+swabHorDiff16(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
- uint16* wp = (uint16*) cp0;
+ uint16_t* wp = (uint16_t*) cp0;
tmsize_t wc = cc / 2;
if( !horDiff16(tif, cp0, cc) )
@@ -600,11 +600,11 @@ swabHorDiff16(TIFF* tif, uint8* cp0, tmsize_t cc)
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
+horDiff32(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
TIFFPredictorState* sp = PredictorState(tif);
tmsize_t stride = sp->stride;
- uint32 *wp = (uint32*) cp0;
+ uint32_t *wp = (uint32_t*) cp0;
tmsize_t wc = cc/4;
if((cc%(4*stride))!=0)
@@ -626,9 +626,9 @@ horDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
}
static int
-swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
+swabHorDiff32(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
- uint32* wp = (uint32*) cp0;
+ uint32_t* wp = (uint32_t*) cp0;
tmsize_t wc = cc / 4;
if( !horDiff32(tif, cp0, cc) )
@@ -643,14 +643,14 @@ swabHorDiff32(TIFF* tif, uint8* cp0, tmsize_t cc)
*/
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
static int
-fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
+fpDiff(TIFF* tif, uint8_t* cp0, tmsize_t cc)
{
tmsize_t stride = PredictorState(tif)->stride;
- uint32 bps = tif->tif_dir.td_bitspersample / 8;
+ uint32_t bps = tif->tif_dir.td_bitspersample / 8;
tmsize_t wc = cc / bps;
tmsize_t count;
- uint8 *cp = (uint8 *) cp0;
- uint8 *tmp;
+ uint8_t *cp = (uint8_t *) cp0;
+ uint8_t *tmp;
if((cc%(bps*stride))!=0)
{
@@ -659,13 +659,13 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
return 0;
}
- tmp = (uint8 *)_TIFFmalloc(cc);
+ tmp = (uint8_t *)_TIFFmalloc(cc);
if (!tmp)
return 0;
_TIFFmemcpy(tmp, cp0, cc);
for (count = 0; count < wc; count++) {
- uint32 byte;
+ uint32_t byte;
for (byte = 0; byte < bps; byte++) {
#if WORDS_BIGENDIAN
cp[byte * wc + count] = tmp[bps * count + byte];
@@ -677,7 +677,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
}
_TIFFfree(tmp);
- cp = (uint8 *) cp0;
+ cp = (uint8_t *) cp0;
cp += cc - stride - 1;
for (count = cc; count > stride; count -= stride)
REPEAT4(stride, cp[stride] = (unsigned char)((cp[stride] - cp[0])&0xff); cp--)
@@ -685,7 +685,7 @@ fpDiff(TIFF* tif, uint8* cp0, tmsize_t cc)
}
static int
-PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+PredictorEncodeRow(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
TIFFPredictorState *sp = PredictorState(tif);
@@ -700,11 +700,11 @@ PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
static int
-PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s)
+PredictorEncodeTile(TIFF* tif, uint8_t* bp0, tmsize_t cc0, uint16_t s)
{
static const char module[] = "PredictorEncodeTile";
TIFFPredictorState *sp = PredictorState(tif);
- uint8 *working_copy;
+ uint8_t *working_copy;
tmsize_t cc = cc0, rowsize;
unsigned char* bp;
int result_code;
@@ -717,12 +717,12 @@ PredictorEncodeTile(TIFF* tif, uint8* bp0, tmsize_t cc0, uint16 s)
* Do predictor manipulation in a working buffer to avoid altering
* the callers buffer. http://trac.osgeo.org/gdal/ticket/1965
*/
- working_copy = (uint8*) _TIFFmalloc(cc0);
+ working_copy = (uint8_t*) _TIFFmalloc(cc0);
if( working_copy == NULL )
{
TIFFErrorExt(tif->tif_clientdata, module,
- "Out of memory allocating %" TIFF_SSIZE_FORMAT " byte temp buffer.",
- cc0 );
+ "Out of memory allocating %" PRId64 " byte temp buffer.",
+ (int64_t) cc0 );
return 0;
}
memcpy( working_copy, bp0, cc0 );
@@ -756,7 +756,7 @@ static const TIFFField predictFields[] = {
};
static int
-PredictorVSetField(TIFF* tif, uint32 tag, va_list ap)
+PredictorVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
TIFFPredictorState *sp = PredictorState(tif);
@@ -765,7 +765,7 @@ PredictorVSetField(TIFF* tif, uint32 tag, va_list ap)
switch (tag) {
case TIFFTAG_PREDICTOR:
- sp->predictor = (uint16) va_arg(ap, uint16_vap);
+ sp->predictor = (uint16_t) va_arg(ap, uint16_vap);
TIFFSetFieldBit(tif, FIELD_PREDICTOR);
break;
default:
@@ -776,7 +776,7 @@ PredictorVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-PredictorVGetField(TIFF* tif, uint32 tag, va_list ap)
+PredictorVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
TIFFPredictorState *sp = PredictorState(tif);
@@ -785,7 +785,7 @@ PredictorVGetField(TIFF* tif, uint32 tag, va_list ap)
switch (tag) {
case TIFFTAG_PREDICTOR:
- *va_arg(ap, uint16*) = (uint16)sp->predictor;
+ *va_arg(ap, uint16_t*) = (uint16_t)sp->predictor;
break;
default:
return (*sp->vgetparent)(tif, tag, ap);
diff --git a/libtiff/tif_predict.h b/libtiff/tif_predict.h
index a326b9b8..597faa16 100644
--- a/libtiff/tif_predict.h
+++ b/libtiff/tif_predict.h
@@ -32,7 +32,7 @@
* ``Library-private'' Support for the Predictor Tag
*/
-typedef int (*TIFFEncodeDecodeMethod)(TIFF* tif, uint8* buf, tmsize_t size);
+typedef int (*TIFFEncodeDecodeMethod)(TIFF* tif, uint8_t* buf, tmsize_t size);
/*
* Codecs that want to support the Predictor tag must place
diff --git a/libtiff/tif_print.c b/libtiff/tif_print.c
index a0737941..53c87492 100644
--- a/libtiff/tif_print.c
+++ b/libtiff/tif_print.c
@@ -65,32 +65,32 @@ static const char * const orientNames[] = {
static void
_TIFFPrintField(FILE* fd, const TIFFField *fip,
- uint32 value_count, void *raw_data)
+ uint32_t value_count, void *raw_data)
{
- uint32 j;
+ uint32_t j;
fprintf(fd, " %s: ", fip->field_name);
for(j = 0; j < value_count; j++) {
if(fip->field_type == TIFF_BYTE)
- fprintf(fd, "%u", ((uint8 *) raw_data)[j]);
+ fprintf(fd, "%u", ((uint8_t *) raw_data)[j]);
else if(fip->field_type == TIFF_UNDEFINED)
fprintf(fd, "0x%x",
(unsigned int) ((unsigned char *) raw_data)[j]);
else if(fip->field_type == TIFF_SBYTE)
- fprintf(fd, "%d", ((int8 *) raw_data)[j]);
+ fprintf(fd, "%d", ((int8_t *) raw_data)[j]);
else if(fip->field_type == TIFF_SHORT)
- fprintf(fd, "%u", ((uint16 *) raw_data)[j]);
+ fprintf(fd, "%u", ((uint16_t *) raw_data)[j]);
else if(fip->field_type == TIFF_SSHORT)
- fprintf(fd, "%d", ((int16 *) raw_data)[j]);
+ fprintf(fd, "%d", ((int16_t *) raw_data)[j]);
else if(fip->field_type == TIFF_LONG)
fprintf(fd, "%lu",
- (unsigned long)((uint32 *) raw_data)[j]);
+ (unsigned long)((uint32_t *) raw_data)[j]);
else if(fip->field_type == TIFF_SLONG)
- fprintf(fd, "%ld", (long)((int32 *) raw_data)[j]);
+ fprintf(fd, "%ld", (long)((int32_t *) raw_data)[j]);
else if(fip->field_type == TIFF_IFD)
fprintf(fd, "0x%lx",
- (unsigned long)((uint32 *) raw_data)[j]);
+ (unsigned long)((uint32_t *) raw_data)[j]);
else if(fip->field_type == TIFF_RATIONAL
|| fip->field_type == TIFF_SRATIONAL
|| fip->field_type == TIFF_FLOAT)
@@ -98,24 +98,24 @@ _TIFFPrintField(FILE* fd, const TIFFField *fip,
else if(fip->field_type == TIFF_LONG8)
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
fprintf(fd, "%I64u",
- (unsigned __int64)((uint64 *) raw_data)[j]);
+ (unsigned __int64)((uint64_t *) raw_data)[j]);
#else
fprintf(fd, "%llu",
- (unsigned long long)((uint64 *) raw_data)[j]);
+ (unsigned long long)((uint64_t *) raw_data)[j]);
#endif
else if(fip->field_type == TIFF_SLONG8)
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
- fprintf(fd, "%I64d", (__int64)((int64 *) raw_data)[j]);
+ fprintf(fd, "%I64d", (__int64)((int64_t *) raw_data)[j]);
#else
- fprintf(fd, "%lld", (long long)((int64 *) raw_data)[j]);
+ fprintf(fd, "%lld", (long long)((int64_t *) raw_data)[j]);
#endif
else if(fip->field_type == TIFF_IFD8)
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
fprintf(fd, "0x%I64x",
- (unsigned __int64)((uint64 *) raw_data)[j]);
+ (unsigned __int64)((uint64_t *) raw_data)[j]);
#else
fprintf(fd, "0x%llx",
- (unsigned long long)((uint64 *) raw_data)[j]);
+ (unsigned long long)((uint64_t *) raw_data)[j]);
#endif
else if(fip->field_type == TIFF_FLOAT)
fprintf(fd, "%f", ((float *)raw_data)[j]);
@@ -138,8 +138,8 @@ _TIFFPrintField(FILE* fd, const TIFFField *fip,
}
static int
-_TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32 tag,
- uint32 value_count, void *raw_data)
+_TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32_t tag,
+ uint32_t value_count, void *raw_data)
{
(void) tif;
@@ -153,14 +153,14 @@ _TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32 tag,
case TIFFTAG_INKSET:
if (value_count == 2 && fip->field_type == TIFF_SHORT) {
fprintf(fd, " Ink Set: ");
- switch (*((uint16*)raw_data)) {
+ switch (*((uint16_t*)raw_data)) {
case INKSET_CMYK:
fprintf(fd, "CMYK\n");
break;
default:
fprintf(fd, "%u (0x%x)\n",
- *((uint16*)raw_data),
- *((uint16*)raw_data));
+ *((uint16_t*)raw_data),
+ *((uint16_t*)raw_data));
break;
}
return 1;
@@ -170,7 +170,7 @@ _TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32 tag,
case TIFFTAG_DOTRANGE:
if (value_count == 2 && fip->field_type == TIFF_SHORT) {
fprintf(fd, " Dot Range: %u-%u\n",
- ((uint16*)raw_data)[0], ((uint16*)raw_data)[1]);
+ ((uint16_t*)raw_data)[0], ((uint16_t*)raw_data)[1]);
return 1;
}
return 0;
@@ -185,7 +185,7 @@ _TIFFPrettyPrintField(TIFF* tif, const TIFFField *fip, FILE* fd, uint32 tag,
case TIFFTAG_XMLPACKET:
{
- uint32 i;
+ uint32_t i;
fprintf(fd, " XMLPacket (XMP Metadata):\n" );
for(i = 0; i < value_count; i++)
@@ -362,7 +362,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
}
}
if (TIFFFieldSet(tif,FIELD_EXTRASAMPLES) && td->td_extrasamples) {
- uint16 i;
+ uint16_t i;
fprintf(fd, " Extra Samples: %u<", td->td_extrasamples);
sep = "";
for (i = 0; i < td->td_extrasamples; i++) {
@@ -387,7 +387,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
}
if (TIFFFieldSet(tif,FIELD_INKNAMES)) {
char* cp;
- uint16 i;
+ uint16_t i;
fprintf(fd, " Ink Names: ");
i = td->td_samplesperpixel;
sep = "";
@@ -470,7 +470,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, " Samples/Pixel: %u\n", td->td_samplesperpixel);
if (TIFFFieldSet(tif,FIELD_ROWSPERSTRIP)) {
fprintf(fd, " Rows/Strip: ");
- if (td->td_rowsperstrip == (uint32) -1)
+ if (td->td_rowsperstrip == (uint32_t) -1)
fprintf(fd, "(infinite)\n");
else
fprintf(fd, "%lu\n", (unsigned long) td->td_rowsperstrip);
@@ -541,7 +541,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "\n");
n = 1L<<td->td_bitspersample;
for (l = 0; l < n; l++) {
- uint16 i;
+ uint16_t i;
fprintf(fd, " %2ld: %5u",
l, td->td_transferfunction[0][l]);
for (i = 1; i < td->td_samplesperpixel - td->td_extrasamples && i < 3; i++)
@@ -553,7 +553,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
fprintf(fd, "(present)\n");
}
if (TIFFFieldSet(tif, FIELD_SUBIFD) && (td->td_subifd)) {
- uint16 i;
+ uint16_t i;
fprintf(fd, " SubIFD Offsets:");
for (i = 0; i < td->td_nsubifd; i++)
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
@@ -575,9 +575,9 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
count = (short) TIFFGetTagListCount(tif);
for(i = 0; i < count; i++) {
- uint32 tag = TIFFGetTagListEntry(tif, i);
+ uint32_t tag = TIFFGetTagListEntry(tif, i);
const TIFFField *fip;
- uint32 value_count;
+ uint32_t value_count;
int mem_alloc = 0;
void *raw_data;
@@ -590,7 +590,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
if(TIFFGetField(tif, tag, &value_count, &raw_data) != 1)
continue;
} else if (fip->field_readcount == TIFF_VARIABLE ) {
- uint16 small_value_count;
+ uint16_t small_value_count;
if(TIFFGetField(tif, tag, &small_value_count, &raw_data) != 1)
continue;
value_count = small_value_count;
@@ -613,7 +613,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
handled this way ... likely best if we move it into
the directory structure with an explicit field in
libtiff 4.1 and assign it a FIELD_ value */
- static uint16 dotrange[2];
+ static uint16_t dotrange[2];
raw_data = dotrange;
TIFFGetField(tif, tag, dotrange+0, dotrange+1);
} else if (fip->field_type == TIFF_ASCII
@@ -654,7 +654,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
if ((flags & TIFFPRINT_STRIPS) &&
TIFFFieldSet(tif,FIELD_STRIPOFFSETS)) {
- uint32 s;
+ uint32_t s;
fprintf(fd, " %lu %s:\n",
(unsigned long) td->td_nstrips,
diff --git a/libtiff/tif_read.c b/libtiff/tif_read.c
index c4c868b1..748fb2d5 100644
--- a/libtiff/tif_read.c
+++ b/libtiff/tif_read.c
@@ -29,31 +29,31 @@
#include "tiffiop.h"
#include <stdio.h>
-int TIFFFillStrip(TIFF* tif, uint32 strip);
-int TIFFFillTile(TIFF* tif, uint32 tile);
-static int TIFFStartStrip(TIFF* tif, uint32 strip);
-static int TIFFStartTile(TIFF* tif, uint32 tile);
+int TIFFFillStrip(TIFF* tif, uint32_t strip);
+int TIFFFillTile(TIFF* tif, uint32_t tile);
+static int TIFFStartStrip(TIFF* tif, uint32_t strip);
+static int TIFFStartTile(TIFF* tif, uint32_t tile);
static int TIFFCheckRead(TIFF*, int);
static tmsize_t
-TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,const char* module);
+TIFFReadRawStrip1(TIFF* tif, uint32_t strip, void* buf, tmsize_t size, const char* module);
static tmsize_t
-TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* module);
+TIFFReadRawTile1(TIFF* tif, uint32_t tile, void* buf, tmsize_t size, const char* module);
-#define NOSTRIP ((uint32)(-1)) /* undefined state */
-#define NOTILE ((uint32)(-1)) /* undefined state */
+#define NOSTRIP ((uint32_t)(-1)) /* undefined state */
+#define NOTILE ((uint32_t)(-1)) /* undefined state */
#define INITIAL_THRESHOLD (1024 * 1024)
#define THRESHOLD_MULTIPLIER 10
#define MAX_THRESHOLD (THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * THRESHOLD_MULTIPLIER * INITIAL_THRESHOLD)
-#define TIFF_INT64_MAX ((((int64)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
+#define TIFF_INT64_MAX ((((int64_t)0x7FFFFFFF) << 32) | 0xFFFFFFFF)
/* Read 'size' bytes in tif_rawdata buffer starting at offset 'rawdata_offset'
* Returns 1 in case of success, 0 otherwise. */
-static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
- tmsize_t rawdata_offset,
- int is_strip, uint32 strip_or_tile,
- const char* module )
+static int TIFFReadAndRealloc(TIFF* tif, tmsize_t size,
+ tmsize_t rawdata_offset,
+ int is_strip, uint32_t strip_or_tile,
+ const char* module )
{
#if SIZEOF_SIZE_T == 8
tmsize_t threshold = INITIAL_THRESHOLD;
@@ -66,8 +66,8 @@ static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
/* file size */
if( size > 1000 * 1000 * 1000 )
{
- uint64 filesize = TIFFGetFileSize(tif);
- if( (uint64)size >= filesize )
+ uint64_t filesize = TIFFGetFileSize(tif);
+ if((uint64_t)size >= filesize )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Chunk size requested is larger than file size.");
@@ -95,16 +95,16 @@ static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
}
#endif
if (already_read + to_read + rawdata_offset > tif->tif_rawdatasize) {
- uint8* new_rawdata;
+ uint8_t* new_rawdata;
assert((tif->tif_flags & TIFF_MYBUFFER) != 0);
tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64(
- (uint64)already_read + to_read + rawdata_offset, 1024);
+ (uint64_t)already_read + to_read + rawdata_offset, 1024);
if (tif->tif_rawdatasize==0) {
TIFFErrorExt(tif->tif_clientdata, module,
"Invalid buffer size");
return 0;
}
- new_rawdata = (uint8*) _TIFFrealloc(
+ new_rawdata = (uint8_t*) _TIFFrealloc(
tif->tif_rawdata, tif->tif_rawdatasize);
if( new_rawdata == 0 )
{
@@ -186,7 +186,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart )
static const char module[] = "TIFFFillStripPartial";
register TIFFDirectory *td = &tif->tif_dir;
tmsize_t unused_data;
- uint64 read_offset;
+ uint64_t read_offset;
tmsize_t to_read;
tmsize_t read_ahead_mod;
/* tmsize_t bytecountm; */
@@ -258,8 +258,8 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart )
to_read = read_ahead_mod - unused_data;
else
to_read = tif->tif_rawdatasize - unused_data;
- if( (uint64) to_read > TIFFGetStrileByteCount(tif, strip)
- - tif->tif_rawdataoff - tif->tif_rawdataloaded )
+ if((uint64_t) to_read > TIFFGetStrileByteCount(tif, strip)
+ - tif->tif_rawdataoff - tif->tif_rawdataloaded )
{
to_read = (tmsize_t) TIFFGetStrileByteCount(tif, strip)
- tif->tif_rawdataoff - tif->tif_rawdataloaded;
@@ -300,7 +300,7 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart )
/* For JPEG, if there are multiple scans (can generally be known */
/* with the read_ahead used), we need to read the whole strip */
if( tif->tif_dir.td_compression==COMPRESSION_JPEG &&
- (uint64)tif->tif_rawcc < TIFFGetStrileByteCount(tif, strip) )
+ (uint64_t)tif->tif_rawcc < TIFFGetStrileByteCount(tif, strip) )
{
if( TIFFJPEGIsFullStripRequired(tif) )
{
@@ -326,10 +326,10 @@ TIFFFillStripPartial( TIFF *tif, int strip, tmsize_t read_ahead, int restart )
* strips.
*/
static int
-TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
+TIFFSeek(TIFF* tif, uint32_t row, uint16_t sample )
{
register TIFFDirectory *td = &tif->tif_dir;
- uint32 strip;
+ uint32_t strip;
int whole_strip;
tmsize_t read_ahead = 0;
@@ -350,7 +350,7 @@ TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
(unsigned long) sample, (unsigned long) td->td_samplesperpixel);
return (0);
}
- strip = (uint32)sample*td->td_stripsperimage + row/td->td_rowsperstrip;
+ strip = (uint32_t)sample * td->td_stripsperimage + row / td->td_rowsperstrip;
} else
strip = row / td->td_rowsperstrip;
@@ -412,7 +412,7 @@ TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
else if( !whole_strip )
{
if( ((tif->tif_rawdata + tif->tif_rawdataloaded) - tif->tif_rawcp) < read_ahead
- && (uint64) tif->tif_rawdataoff+tif->tif_rawdataloaded < TIFFGetStrileByteCount(tif, strip) )
+ && (uint64_t) tif->tif_rawdataoff + tif->tif_rawdataloaded < TIFFGetStrileByteCount(tif, strip) )
{
if( !TIFFFillStripPartial(tif,strip,read_ahead,0) )
return 0;
@@ -457,7 +457,7 @@ TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
}
int
-TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
+TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample)
{
int e;
@@ -468,13 +468,13 @@ TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
* Decompress desired row into user buffer.
*/
e = (*tif->tif_decoderow)
- (tif, (uint8*) buf, tif->tif_scanlinesize, sample);
+ (tif, (uint8_t*) buf, tif->tif_scanlinesize, sample);
/* we are now poised at the beginning of the next row */
tif->tif_row = row + 1;
if (e)
- (*tif->tif_postdecode)(tif, (uint8*) buf,
+ (*tif->tif_postdecode)(tif, (uint8_t*) buf,
tif->tif_scanlinesize);
}
return (e > 0 ? 1 : -1);
@@ -485,14 +485,14 @@ TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
* rows in the strip (check for truncated last strip on any
* of the separations).
*/
-static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF* tif, uint32 strip, uint16* pplane)
+static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF* tif, uint32_t strip, uint16_t* pplane)
{
static const char module[] = "TIFFReadEncodedStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint32 rowsperstrip;
- uint32 stripsperplane;
- uint32 stripinplane;
- uint32 rows;
+ uint32_t rowsperstrip;
+ uint32_t stripsperplane;
+ uint32_t stripinplane;
+ uint32_t rows;
tmsize_t stripsize;
if (!TIFFCheckRead(tif,0))
return((tmsize_t)(-1));
@@ -509,7 +509,7 @@ static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF* tif, uint32 strip, uint16
rowsperstrip=td->td_imagelength;
stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
stripinplane=(strip%stripsperplane);
- if( pplane ) *pplane=(uint16)(strip/stripsperplane);
+ if( pplane ) *pplane=(uint16_t)(strip / stripsperplane);
rows=td->td_imagelength-stripinplane*rowsperstrip;
if (rows>rowsperstrip)
rows=rowsperstrip;
@@ -524,12 +524,12 @@ static tmsize_t TIFFReadEncodedStripGetStripSize(TIFF* tif, uint32 strip, uint16
* amount into the user-supplied buffer.
*/
tmsize_t
-TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
+TIFFReadEncodedStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size)
{
static const char module[] = "TIFFReadEncodedStrip";
TIFFDirectory *td = &tif->tif_dir;
tmsize_t stripsize;
- uint16 plane;
+ uint16_t plane;
stripsize=TIFFReadEncodedStripGetStripSize(tif, strip, &plane);
if (stripsize==((tmsize_t)(-1)))
@@ -569,12 +569,12 @@ TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
* * calls regular TIFFReadEncodedStrip() if *buf != NULL
*/
tmsize_t
-_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
+_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip,
void **buf, tmsize_t bufsizetoalloc,
tmsize_t size_to_read)
{
tmsize_t this_stripsize;
- uint16 plane;
+ uint16_t plane;
if( *buf != NULL )
{
@@ -606,8 +606,8 @@ _TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
}
static tmsize_t
-TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
- const char* module)
+TIFFReadRawStrip1(TIFF* tif, uint32_t strip, void* buf, tmsize_t size,
+ const char* module)
{
assert((tif->tif_flags&TIFF_NOREADRAW)==0);
if (!isMapped(tif)) {
@@ -639,8 +639,8 @@ TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
} else {
tmsize_t ma = 0;
tmsize_t n;
- if ((TIFFGetStrileOffset(tif, strip) > (uint64)TIFF_TMSIZE_T_MAX)||
- ((ma=(tmsize_t)TIFFGetStrileOffset(tif, strip))>tif->tif_size))
+ if ((TIFFGetStrileOffset(tif, strip) > (uint64_t)TIFF_TMSIZE_T_MAX) ||
+ ((ma=(tmsize_t)TIFFGetStrileOffset(tif, strip))>tif->tif_size))
{
n=0;
}
@@ -681,7 +681,7 @@ TIFFReadRawStrip1(TIFF* tif, uint32 strip, void* buf, tmsize_t size,
}
static tmsize_t
-TIFFReadRawStripOrTile2(TIFF* tif, uint32 strip_or_tile, int is_strip,
+TIFFReadRawStripOrTile2(TIFF* tif, uint32_t strip_or_tile, int is_strip,
tmsize_t size, const char* module)
{
assert( !isMapped(tif) );
@@ -719,11 +719,11 @@ TIFFReadRawStripOrTile2(TIFF* tif, uint32 strip_or_tile, int is_strip,
* Read a strip of data from the file.
*/
tmsize_t
-TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
+TIFFReadRawStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size)
{
static const char module[] = "TIFFReadRawStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint64 bytecount64;
+ uint64_t bytecount64;
tmsize_t bytecountm;
if (!TIFFCheckRead(tif, 0))
@@ -742,7 +742,7 @@ TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
return ((tmsize_t)(-1));
}
bytecount64 = TIFFGetStrileByteCount(tif, strip);
- if (size != (tmsize_t)(-1) && (uint64)size <= bytecount64)
+ if (size != (tmsize_t)(-1) && (uint64_t)size <= bytecount64)
bytecountm = size;
else
bytecountm = _TIFFCastUInt64ToSSize(tif, bytecount64, module);
@@ -753,7 +753,7 @@ TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
}
TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
-static uint64 NoSanitizeSubUInt64(uint64 a, uint64 b)
+static uint64_t NoSanitizeSubUInt64(uint64_t a, uint64_t b)
{
return a - b;
}
@@ -763,15 +763,15 @@ static uint64 NoSanitizeSubUInt64(uint64 a, uint64 b)
* expanded, as necessary, to hold the strip's data.
*/
int
-TIFFFillStrip(TIFF* tif, uint32 strip)
+TIFFFillStrip(TIFF* tif, uint32_t strip)
{
static const char module[] = "TIFFFillStrip";
TIFFDirectory *td = &tif->tif_dir;
if ((tif->tif_flags&TIFF_NOREADRAW)==0)
{
- uint64 bytecount = TIFFGetStrileByteCount(tif, strip);
- if( bytecount == 0 || bytecount > (uint64)TIFF_INT64_MAX ) {
+ uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
+ if( bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX ) {
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFErrorExt(tif->tif_clientdata, module,
"Invalid strip byte count %I64u, strip %lu",
@@ -795,10 +795,10 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
/* Hopefully they are safe enough for all codecs */
tmsize_t stripsize = TIFFStripSize(tif);
if( stripsize != 0 &&
- (bytecount - 4096) / 10 > (uint64)stripsize )
+ (bytecount - 4096) / 10 > (uint64_t)stripsize )
{
- uint64 newbytecount = (uint64)stripsize * 10 + 4096;
- if( newbytecount == 0 || newbytecount > (uint64)TIFF_INT64_MAX )
+ uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
+ if( newbytecount == 0 || newbytecount > (uint64_t)TIFF_INT64_MAX )
{
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFWarningExt(tif->tif_clientdata, module,
@@ -828,8 +828,8 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
* comparison (which can overflow) we do the following
* two comparisons:
*/
- if (bytecount > (uint64)tif->tif_size ||
- TIFFGetStrileOffset(tif, strip) > (uint64)tif->tif_size - bytecount) {
+ if (bytecount > (uint64_t)tif->tif_size ||
+ TIFFGetStrileOffset(tif, strip) > (uint64_t)tif->tif_size - bytecount) {
/*
* This error message might seem strange, but
* it's what would happen if a read were done
@@ -897,7 +897,7 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
*/
tmsize_t bytecountm;
bytecountm=(tmsize_t)bytecount;
- if ((uint64)bytecountm!=bytecount)
+ if ((uint64_t)bytecountm != bytecount)
{
TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
return(0);
@@ -962,7 +962,7 @@ TIFFFillStrip(TIFF* tif, uint32 strip)
* tile is selected by the (x,y,z,s) coordinates.
*/
tmsize_t
-TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s)
+TIFFReadTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
{
if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
return ((tmsize_t)(-1));
@@ -975,7 +975,7 @@ TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s)
* amount into the user-supplied buffer.
*/
tmsize_t
-TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
+TIFFReadEncodedTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size)
{
static const char module[] = "TIFFReadEncodedTile";
TIFFDirectory *td = &tif->tif_dir;
@@ -1012,8 +1012,8 @@ TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
else if (size > tilesize)
size = tilesize;
if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif,
- (uint8*) buf, size, (uint16)(tile/td->td_stripsperimage))) {
- (*tif->tif_postdecode)(tif, (uint8*) buf, size);
+ (uint8_t*) buf, size, (uint16_t)(tile / td->td_stripsperimage))) {
+ (*tif->tif_postdecode)(tif, (uint8_t*) buf, size);
return (size);
} else
return ((tmsize_t)(-1));
@@ -1028,7 +1028,7 @@ TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
tmsize_t
_TIFFReadTileAndAllocBuffer(TIFF* tif,
void **buf, tmsize_t bufsizetoalloc,
- uint32 x, uint32 y, uint32 z, uint16 s)
+ uint32_t x, uint32_t y, uint32_t z, uint16_t s)
{
if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s))
return ((tmsize_t)(-1));
@@ -1045,9 +1045,9 @@ _TIFFReadTileAndAllocBuffer(TIFF* tif,
* * calls regular TIFFReadEncodedTile() if *buf != NULL
*/
tmsize_t
-_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32 tile,
- void **buf, tmsize_t bufsizetoalloc,
- tmsize_t size_to_read)
+_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32_t tile,
+ void **buf, tmsize_t bufsizetoalloc,
+ tmsize_t size_to_read)
{
static const char module[] = "_TIFFReadEncodedTileAndAllocBuffer";
TIFFDirectory *td = &tif->tif_dir;
@@ -1083,15 +1083,15 @@ _TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32 tile,
else if (size_to_read > tilesize)
size_to_read = tilesize;
if( (*tif->tif_decodetile)(tif,
- (uint8*) *buf, size_to_read, (uint16)(tile/td->td_stripsperimage))) {
- (*tif->tif_postdecode)(tif, (uint8*) *buf, size_to_read);
+ (uint8_t*) *buf, size_to_read, (uint16_t)(tile / td->td_stripsperimage))) {
+ (*tif->tif_postdecode)(tif, (uint8_t*) *buf, size_to_read);
return (size_to_read);
} else
return ((tmsize_t)(-1));
}
static tmsize_t
-TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* module)
+TIFFReadRawTile1(TIFF* tif, uint32_t tile, void* buf, tmsize_t size, const char* module)
{
assert((tif->tif_flags&TIFF_NOREADRAW)==0);
if (!isMapped(tif)) {
@@ -1129,7 +1129,7 @@ TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* m
tmsize_t n;
ma=(tmsize_t)TIFFGetStrileOffset(tif, tile);
mb=ma+size;
- if ((TIFFGetStrileOffset(tif, tile) > (uint64)TIFF_TMSIZE_T_MAX)||(ma>tif->tif_size))
+ if ((TIFFGetStrileOffset(tif, tile) > (uint64_t)TIFF_TMSIZE_T_MAX) || (ma > tif->tif_size))
n=0;
else if ((mb<ma)||(mb<size)||(mb>tif->tif_size))
n=tif->tif_size-ma;
@@ -1164,11 +1164,11 @@ TIFFReadRawTile1(TIFF* tif, uint32 tile, void* buf, tmsize_t size, const char* m
* Read a tile of data from the file.
*/
tmsize_t
-TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
+TIFFReadRawTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size)
{
static const char module[] = "TIFFReadRawTile";
TIFFDirectory *td = &tif->tif_dir;
- uint64 bytecount64;
+ uint64_t bytecount64;
tmsize_t bytecountm;
if (!TIFFCheckRead(tif, 1))
@@ -1186,7 +1186,7 @@ TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
return ((tmsize_t)(-1));
}
bytecount64 = TIFFGetStrileByteCount(tif, tile);
- if (size != (tmsize_t)(-1) && (uint64)size <= bytecount64)
+ if (size != (tmsize_t)(-1) && (uint64_t)size <= bytecount64)
bytecountm = size;
else
bytecountm = _TIFFCastUInt64ToSSize(tif, bytecount64, module);
@@ -1201,15 +1201,15 @@ TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size)
* expanded, as necessary, to hold the tile's data.
*/
int
-TIFFFillTile(TIFF* tif, uint32 tile)
+TIFFFillTile(TIFF* tif, uint32_t tile)
{
static const char module[] = "TIFFFillTile";
TIFFDirectory *td = &tif->tif_dir;
if ((tif->tif_flags&TIFF_NOREADRAW)==0)
{
- uint64 bytecount = TIFFGetStrileByteCount(tif, tile);
- if( bytecount == 0 || bytecount > (uint64)TIFF_INT64_MAX ) {
+ uint64_t bytecount = TIFFGetStrileByteCount(tif, tile);
+ if( bytecount == 0 || bytecount > (uint64_t)TIFF_INT64_MAX ) {
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFErrorExt(tif->tif_clientdata, module,
"%I64u: Invalid tile byte count, tile %lu",
@@ -1233,10 +1233,10 @@ TIFFFillTile(TIFF* tif, uint32 tile)
/* Hopefully they are safe enough for all codecs */
tmsize_t stripsize = TIFFTileSize(tif);
if( stripsize != 0 &&
- (bytecount - 4096) / 10 > (uint64)stripsize )
+ (bytecount - 4096) / 10 > (uint64_t)stripsize )
{
- uint64 newbytecount = (uint64)stripsize * 10 + 4096;
- if( newbytecount == 0 || newbytecount > (uint64)TIFF_INT64_MAX )
+ uint64_t newbytecount = (uint64_t)stripsize * 10 + 4096;
+ if( newbytecount == 0 || newbytecount > (uint64_t)TIFF_INT64_MAX )
{
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
TIFFWarningExt(tif->tif_clientdata, module,
@@ -1266,8 +1266,8 @@ TIFFFillTile(TIFF* tif, uint32 tile)
* comparison (which can overflow) we do the following
* two comparisons:
*/
- if (bytecount > (uint64)tif->tif_size ||
- TIFFGetStrileOffset(tif, tile) > (uint64)tif->tif_size - bytecount) {
+ if (bytecount > (uint64_t)tif->tif_size ||
+ TIFFGetStrileOffset(tif, tile) > (uint64_t)tif->tif_size - bytecount) {
tif->tif_curtile = NOTILE;
return (0);
}
@@ -1308,7 +1308,7 @@ TIFFFillTile(TIFF* tif, uint32 tile)
*/
tmsize_t bytecountm;
bytecountm=(tmsize_t)bytecount;
- if ((uint64)bytecountm!=bytecount)
+ if ((uint64_t)bytecountm != bytecount)
{
TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
return(0);
@@ -1390,10 +1390,10 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size)
}
if (bp) {
tif->tif_rawdatasize = size;
- tif->tif_rawdata = (uint8*) bp;
+ tif->tif_rawdata = (uint8_t*) bp;
tif->tif_flags &= ~TIFF_MYBUFFER;
} else {
- tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64((uint64)size, 1024);
+ tif->tif_rawdatasize = (tmsize_t)TIFFroundup_64((uint64_t)size, 1024);
if (tif->tif_rawdatasize==0) {
TIFFErrorExt(tif->tif_clientdata, module,
"Invalid buffer size");
@@ -1401,7 +1401,7 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size)
}
/* Initialize to zero to avoid uninitialized buffers in case of */
/* short reads (http://bugzilla.maptools.org/show_bug.cgi?id=2651) */
- tif->tif_rawdata = (uint8*) _TIFFcalloc(1, tif->tif_rawdatasize);
+ tif->tif_rawdata = (uint8_t*) _TIFFcalloc(1, tif->tif_rawdatasize);
tif->tif_flags |= TIFF_MYBUFFER;
}
if (tif->tif_rawdata == NULL) {
@@ -1419,7 +1419,7 @@ TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size)
* strip has just been read in.
*/
static int
-TIFFStartStrip(TIFF* tif, uint32 strip)
+TIFFStartStrip(TIFF* tif, uint32_t strip)
{
TIFFDirectory *td = &tif->tif_dir;
@@ -1446,7 +1446,7 @@ TIFFStartStrip(TIFF* tif, uint32 strip)
tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, strip);
}
if ((*tif->tif_predecode)(tif,
- (uint16)(strip / td->td_stripsperimage)) == 0 ) {
+ (uint16_t)(strip / td->td_stripsperimage)) == 0 ) {
/* Needed for example for scanline access, if tif_predecode */
/* fails, and we try to read the same strip again. Without invalidating */
/* tif_curstrip, we'd call tif_decoderow() on a possibly invalid */
@@ -1462,11 +1462,11 @@ TIFFStartStrip(TIFF* tif, uint32 strip)
* tile has just been read in.
*/
static int
-TIFFStartTile(TIFF* tif, uint32 tile)
+TIFFStartTile(TIFF* tif, uint32_t tile)
{
static const char module[] = "TIFFStartTile";
TIFFDirectory *td = &tif->tif_dir;
- uint32 howmany32;
+ uint32_t howmany32;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
if (!(*tif->tif_setupdecode)(tif))
@@ -1501,7 +1501,7 @@ TIFFStartTile(TIFF* tif, uint32 tile)
tif->tif_rawcc = (tmsize_t)TIFFGetStrileByteCount(tif, tile);
}
return ((*tif->tif_predecode)(tif,
- (uint16)(tile/td->td_stripsperimage)));
+ (uint16_t)(tile / td->td_stripsperimage)));
}
static int
@@ -1529,14 +1529,14 @@ TIFFCheckRead(TIFF* tif, int tiles)
* inbuf content must be writable (if bit reversal is needed)
* Returns 1 in case of success, 0 otherwise.
*/
-int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
+int TIFFReadFromUserBuffer(TIFF* tif, uint32_t strile,
void* inbuf, tmsize_t insize,
void* outbuf, tmsize_t outsize)
{
static const char module[] = "TIFFReadFromUserBuffer";
TIFFDirectory *td = &tif->tif_dir;
int ret = 1;
- uint32 old_tif_flags = tif->tif_flags;
+ uint32_t old_tif_flags = tif->tif_flags;
tmsize_t old_rawdatasize = tif->tif_rawdatasize;
void* old_rawdata = tif->tif_rawdata;
@@ -1567,29 +1567,29 @@ int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
if( TIFFIsTiled(tif) )
{
if( !TIFFStartTile(tif, strile) ||
- !(*tif->tif_decodetile)(tif, (uint8*) outbuf, outsize,
- (uint16)(strile/td->td_stripsperimage)) )
+ !(*tif->tif_decodetile)(tif, (uint8_t*) outbuf, outsize,
+ (uint16_t)(strile / td->td_stripsperimage)) )
{
ret = 0;
}
}
else
{
- uint32 rowsperstrip=td->td_rowsperstrip;
- uint32 stripsperplane;
+ uint32_t rowsperstrip=td->td_rowsperstrip;
+ uint32_t stripsperplane;
if (rowsperstrip>td->td_imagelength)
rowsperstrip=td->td_imagelength;
stripsperplane= TIFFhowmany_32_maxuint_compat(td->td_imagelength, rowsperstrip);
if( !TIFFStartStrip(tif, strile) ||
- !(*tif->tif_decodestrip)(tif, (uint8*) outbuf, outsize,
- (uint16)(strile/stripsperplane)) )
+ !(*tif->tif_decodestrip)(tif, (uint8_t*) outbuf, outsize,
+ (uint16_t)(strile / stripsperplane)) )
{
ret = 0;
}
}
if( ret )
{
- (*tif->tif_postdecode)(tif, (uint8*) outbuf, outsize);
+ (*tif->tif_postdecode)(tif, (uint8_t*) outbuf, outsize);
}
if (!isFillOrder(tif, td->td_fillorder) &&
@@ -1608,37 +1608,37 @@ int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
}
void
-_TIFFNoPostDecode(TIFF* tif, uint8* buf, tmsize_t cc)
+_TIFFNoPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
(void) tif; (void) buf; (void) cc;
}
void
-_TIFFSwab16BitData(TIFF* tif, uint8* buf, tmsize_t cc)
+_TIFFSwab16BitData(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
(void) tif;
assert((cc & 1) == 0);
- TIFFSwabArrayOfShort((uint16*) buf, cc/2);
+ TIFFSwabArrayOfShort((uint16_t*) buf, cc / 2);
}
void
-_TIFFSwab24BitData(TIFF* tif, uint8* buf, tmsize_t cc)
+_TIFFSwab24BitData(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
(void) tif;
assert((cc % 3) == 0);
- TIFFSwabArrayOfTriples((uint8*) buf, cc/3);
+ TIFFSwabArrayOfTriples((uint8_t*) buf, cc / 3);
}
void
-_TIFFSwab32BitData(TIFF* tif, uint8* buf, tmsize_t cc)
+_TIFFSwab32BitData(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
(void) tif;
assert((cc & 3) == 0);
- TIFFSwabArrayOfLong((uint32*) buf, cc/4);
+ TIFFSwabArrayOfLong((uint32_t*) buf, cc / 4);
}
void
-_TIFFSwab64BitData(TIFF* tif, uint8* buf, tmsize_t cc)
+_TIFFSwab64BitData(TIFF* tif, uint8_t* buf, tmsize_t cc)
{
(void) tif;
assert((cc & 7) == 0);
diff --git a/libtiff/tif_stream.cxx b/libtiff/tif_stream.cxx
index 4d0b5c95..ea224169 100644
--- a/libtiff/tif_stream.cxx
+++ b/libtiff/tif_stream.cxx
@@ -80,10 +80,10 @@ extern "C" {
static tmsize_t _tiffisReadProc(thandle_t fd, void* buf, tmsize_t size);
static tmsize_t _tiffosWriteProc(thandle_t fd, void* buf, tmsize_t size);
static tmsize_t _tiffisWriteProc(thandle_t, void*, tmsize_t);
- static uint64 _tiffosSeekProc(thandle_t fd, uint64 off, int whence);
- static uint64 _tiffisSeekProc(thandle_t fd, uint64 off, int whence);
- static uint64 _tiffosSizeProc(thandle_t fd);
- static uint64 _tiffisSizeProc(thandle_t fd);
+ static uint64_t _tiffosSeekProc(thandle_t fd, uint64_t off, int whence);
+ static uint64_t _tiffisSeekProc(thandle_t fd, uint64_t off, int whence);
+ static uint64_t _tiffosSizeProc(thandle_t fd);
+ static uint64_t _tiffisSizeProc(thandle_t fd);
static int _tiffosCloseProc(thandle_t fd);
static int _tiffisCloseProc(thandle_t fd);
static int _tiffDummyMapProc(thandle_t , void** base, toff_t* size );
@@ -146,26 +146,26 @@ _tiffisWriteProc(thandle_t, void*, tmsize_t)
return 0;
}
-static uint64
-_tiffosSeekProc(thandle_t fd, uint64 off, int whence)
+static uint64_t
+_tiffosSeekProc(thandle_t fd, uint64_t off, int whence)
{
tiffos_data *data = reinterpret_cast<tiffos_data *>(fd);
ostream *os = data->stream;
// if the stream has already failed, don't do anything
if( os->fail() )
- return static_cast<uint64>(-1);
+ return static_cast<uint64_t>(-1);
switch(whence) {
case SEEK_SET:
{
// Compute 64-bit offset
- uint64 new_offset = static_cast<uint64>(data->start_pos) + off;
+ uint64_t new_offset = static_cast<uint64_t>(data->start_pos) + off;
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(new_offset);
- if (static_cast<uint64>(offset) != new_offset)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != new_offset)
+ return static_cast<uint64_t>(-1);
os->seekp(offset, ios::beg);
break;
@@ -174,8 +174,8 @@ _tiffosSeekProc(thandle_t fd, uint64 off, int whence)
{
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(off);
- if (static_cast<uint64>(offset) != off)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != off)
+ return static_cast<uint64_t>(-1);
os->seekp(offset, ios::cur);
break;
@@ -184,8 +184,8 @@ _tiffosSeekProc(thandle_t fd, uint64 off, int whence)
{
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(off);
- if (static_cast<uint64>(offset) != off)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != off)
+ return static_cast<uint64_t>(-1);
os->seekp(offset, ios::end);
break;
@@ -220,28 +220,28 @@ _tiffosSeekProc(thandle_t fd, uint64 off, int whence)
os->clear(old_state);
// only do something if desired seek position is valid
- if( (static_cast<uint64>(origin) + off) > static_cast<uint64>(data->start_pos) ) {
- uint64 num_fill;
+ if((static_cast<uint64_t>(origin) + off) > static_cast<uint64_t>(data->start_pos) ) {
+ uint64_t num_fill;
// clear the fail bit
os->clear(os->rdstate() & ~ios::failbit);
// extend the stream to the expected size
os->seekp(0, ios::end);
- num_fill = (static_cast<uint64>(origin)) + off - os->tellp();
- for( uint64 i = 0; i < num_fill; i++ )
+ num_fill = (static_cast<uint64_t>(origin)) + off - os->tellp();
+ for(uint64_t i = 0; i < num_fill; i++ )
os->put('\0');
// retry the seek
- os->seekp(static_cast<ios::off_type>(static_cast<uint64>(origin) + off), ios::beg);
+ os->seekp(static_cast<ios::off_type>(static_cast<uint64_t>(origin) + off), ios::beg);
}
}
- return static_cast<uint64>(os->tellp());
+ return static_cast<uint64_t>(os->tellp());
}
-static uint64
-_tiffisSeekProc(thandle_t fd, uint64 off, int whence)
+static uint64_t
+_tiffisSeekProc(thandle_t fd, uint64_t off, int whence)
{
tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
@@ -249,12 +249,12 @@ _tiffisSeekProc(thandle_t fd, uint64 off, int whence)
case SEEK_SET:
{
// Compute 64-bit offset
- uint64 new_offset = static_cast<uint64>(data->start_pos) + off;
+ uint64_t new_offset = static_cast<uint64_t>(data->start_pos) + off;
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(new_offset);
- if (static_cast<uint64>(offset) != new_offset)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != new_offset)
+ return static_cast<uint64_t>(-1);
data->stream->seekg(offset, ios::beg);
break;
@@ -263,8 +263,8 @@ _tiffisSeekProc(thandle_t fd, uint64 off, int whence)
{
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(off);
- if (static_cast<uint64>(offset) != off)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != off)
+ return static_cast<uint64_t>(-1);
data->stream->seekg(offset, ios::cur);
break;
@@ -273,18 +273,18 @@ _tiffisSeekProc(thandle_t fd, uint64 off, int whence)
{
// Verify that value does not overflow
ios::off_type offset = static_cast<ios::off_type>(off);
- if (static_cast<uint64>(offset) != off)
- return static_cast<uint64>(-1);
+ if (static_cast<uint64_t>(offset) != off)
+ return static_cast<uint64_t>(-1);
data->stream->seekg(offset, ios::end);
break;
}
}
- return (uint64) (data->stream->tellg() - data->start_pos);
+ return (uint64_t) (data->stream->tellg() - data->start_pos);
}
-static uint64
+static uint64_t
_tiffosSizeProc(thandle_t fd)
{
tiffos_data *data = reinterpret_cast<tiffos_data *>(fd);
@@ -296,10 +296,10 @@ _tiffosSizeProc(thandle_t fd)
len = os->tellp();
os->seekp(pos);
- return (uint64) len;
+ return (uint64_t) len;
}
-static uint64
+static uint64_t
_tiffisSizeProc(thandle_t fd)
{
tiffis_data *data = reinterpret_cast<tiffis_data *>(fd);
@@ -310,7 +310,7 @@ _tiffisSizeProc(thandle_t fd)
len = data->stream->tellg();
data->stream->seekg(pos);
- return (uint64) len;
+ return (uint64_t) len;
}
static int
diff --git a/libtiff/tif_strip.c b/libtiff/tif_strip.c
index c08c60a7..f56cc12f 100644
--- a/libtiff/tif_strip.c
+++ b/libtiff/tif_strip.c
@@ -32,12 +32,12 @@
/*
* Compute which strip a (row,sample) value is in.
*/
-uint32
-TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
+uint32_t
+TIFFComputeStrip(TIFF* tif, uint32_t row, uint16_t sample)
{
static const char module[] = "TIFFComputeStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint32 strip;
+ uint32_t strip;
strip = row / td->td_rowsperstrip;
if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
@@ -47,7 +47,7 @@ TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
(unsigned long) sample, (unsigned long) td->td_samplesperpixel);
return (0);
}
- strip += (uint32)sample*td->td_stripsperimage;
+ strip += (uint32_t)sample * td->td_stripsperimage;
}
return (strip);
}
@@ -55,16 +55,16 @@ TIFFComputeStrip(TIFF* tif, uint32 row, uint16 sample)
/*
* Compute how many strips are in an image.
*/
-uint32
+uint32_t
TIFFNumberOfStrips(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
- uint32 nstrips;
+ uint32_t nstrips;
- nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
- TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
+ nstrips = (td->td_rowsperstrip == (uint32_t) -1 ? 1 :
+ TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
- nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel,
+ nstrips = _TIFFMultiply32(tif, nstrips, (uint32_t)td->td_samplesperpixel,
"TIFFNumberOfStrips");
return (nstrips);
}
@@ -72,12 +72,12 @@ TIFFNumberOfStrips(TIFF* tif)
/*
* Compute the # bytes in a variable height, row-aligned strip.
*/
-uint64
-TIFFVStripSize64(TIFF* tif, uint32 nrows)
+uint64_t
+TIFFVStripSize64(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVStripSize64";
TIFFDirectory *td = &tif->tif_dir;
- if (nrows==(uint32)(-1))
+ if (nrows==(uint32_t)(-1))
nrows=td->td_imagelength;
if ((td->td_planarconfig==PLANARCONFIG_CONTIG)&&
(td->td_photometric == PHOTOMETRIC_YCBCR)&&
@@ -91,12 +91,12 @@ TIFFVStripSize64(TIFF* tif, uint32 nrows)
* horizontal/vertical subsampling area include
* YCbCr data for the extended image.
*/
- uint16 ycbcrsubsampling[2];
- uint16 samplingblock_samples;
- uint32 samplingblocks_hor;
- uint32 samplingblocks_ver;
- uint64 samplingrow_samples;
- uint64 samplingrow_size;
+ uint16_t ycbcrsubsampling[2];
+ uint16_t samplingblock_samples;
+ uint32_t samplingblocks_hor;
+ uint32_t samplingblocks_ver;
+ uint64_t samplingrow_samples;
+ uint64_t samplingrow_size;
if(td->td_samplesperpixel!=3)
{
TIFFErrorExt(tif->tif_clientdata,module,
@@ -125,10 +125,10 @@ TIFFVStripSize64(TIFF* tif, uint32 nrows)
return(_TIFFMultiply64(tif,nrows,TIFFScanlineSize64(tif),module));
}
tmsize_t
-TIFFVStripSize(TIFF* tif, uint32 nrows)
+TIFFVStripSize(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVStripSize";
- uint64 m;
+ uint64_t m;
m=TIFFVStripSize64(tif,nrows);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -136,11 +136,11 @@ TIFFVStripSize(TIFF* tif, uint32 nrows)
/*
* Compute the # bytes in a raw strip.
*/
-uint64
-TIFFRawStripSize64(TIFF* tif, uint32 strip)
+uint64_t
+TIFFRawStripSize64(TIFF* tif, uint32_t strip)
{
static const char module[] = "TIFFRawStripSize64";
- uint64 bytecount = TIFFGetStrileByteCount(tif, strip);
+ uint64_t bytecount = TIFFGetStrileByteCount(tif, strip);
if (bytecount == 0)
{
@@ -155,24 +155,24 @@ TIFFRawStripSize64(TIFF* tif, uint32 strip)
(unsigned long long) bytecount,
(unsigned long) strip);
#endif
- bytecount = (uint64) -1;
+ bytecount = (uint64_t) -1;
}
return bytecount;
}
tmsize_t
-TIFFRawStripSize(TIFF* tif, uint32 strip)
+TIFFRawStripSize(TIFF* tif, uint32_t strip)
{
static const char module[] = "TIFFRawStripSize";
- uint64 m;
+ uint64_t m;
tmsize_t n;
m=TIFFRawStripSize64(tif,strip);
- if (m==(uint64)(-1))
+ if (m==(uint64_t)(-1))
n=(tmsize_t)(-1);
else
{
n=(tmsize_t)m;
- if ((uint64)n!=m)
+ if ((uint64_t)n != m)
{
TIFFErrorExt(tif->tif_clientdata,module,"Integer overflow");
n=0;
@@ -189,11 +189,11 @@ TIFFRawStripSize(TIFF* tif, uint32 strip)
* truncated to reflect the actual space required
* to hold the strip.
*/
-uint64
+uint64_t
TIFFStripSize64(TIFF* tif)
{
TIFFDirectory* td = &tif->tif_dir;
- uint32 rps = td->td_rowsperstrip;
+ uint32_t rps = td->td_rowsperstrip;
if (rps > td->td_imagelength)
rps = td->td_imagelength;
return (TIFFVStripSize64(tif, rps));
@@ -202,7 +202,7 @@ tmsize_t
TIFFStripSize(TIFF* tif)
{
static const char module[] = "TIFFStripSize";
- uint64 m;
+ uint64_t m;
m=TIFFStripSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -213,32 +213,32 @@ TIFFStripSize(TIFF* tif)
* request is <1 then we choose a strip size according
* to certain heuristics.
*/
-uint32
-TIFFDefaultStripSize(TIFF* tif, uint32 request)
+uint32_t
+TIFFDefaultStripSize(TIFF* tif, uint32_t request)
{
return (*tif->tif_defstripsize)(tif, request);
}
-uint32
-_TIFFDefaultStripSize(TIFF* tif, uint32 s)
+uint32_t
+_TIFFDefaultStripSize(TIFF* tif, uint32_t s)
{
- if ((int32) s < 1) {
+ if ((int32_t) s < 1) {
/*
* If RowsPerStrip is unspecified, try to break the
* image up into strips that are approximately
* STRIP_SIZE_DEFAULT bytes long.
*/
- uint64 scanlinesize;
- uint64 rows;
+ uint64_t scanlinesize;
+ uint64_t rows;
scanlinesize=TIFFScanlineSize64(tif);
if (scanlinesize==0)
scanlinesize=1;
- rows=(uint64)STRIP_SIZE_DEFAULT/scanlinesize;
+ rows= (uint64_t)STRIP_SIZE_DEFAULT / scanlinesize;
if (rows==0)
rows=1;
else if (rows>0xFFFFFFFF)
rows=0xFFFFFFFF;
- s=(uint32)rows;
+ s=(uint32_t)rows;
}
return (s);
}
@@ -253,23 +253,23 @@ _TIFFDefaultStripSize(TIFF* tif, uint32 s)
* subsampling lines divided by vertical subsampling. It should thus make
* sense when multiplied by a multiple of vertical subsampling.
*/
-uint64
+uint64_t
TIFFScanlineSize64(TIFF* tif)
{
static const char module[] = "TIFFScanlineSize64";
TIFFDirectory *td = &tif->tif_dir;
- uint64 scanline_size;
+ uint64_t scanline_size;
if (td->td_planarconfig==PLANARCONFIG_CONTIG)
{
if ((td->td_photometric==PHOTOMETRIC_YCBCR)&&
(td->td_samplesperpixel==3)&&
(!isUpSampled(tif)))
{
- uint16 ycbcrsubsampling[2];
- uint16 samplingblock_samples;
- uint32 samplingblocks_hor;
- uint64 samplingrow_samples;
- uint64 samplingrow_size;
+ uint16_t ycbcrsubsampling[2];
+ uint16_t samplingblock_samples;
+ uint32_t samplingblocks_hor;
+ uint64_t samplingrow_samples;
+ uint64_t samplingrow_size;
if(td->td_samplesperpixel!=3)
{
TIFFErrorExt(tif->tif_clientdata,module,
@@ -294,7 +294,7 @@ TIFFScanlineSize64(TIFF* tif)
}
else
{
- uint64 scanline_samples;
+ uint64_t scanline_samples;
scanline_samples=_TIFFMultiply64(tif,td->td_imagewidth,td->td_samplesperpixel,module);
scanline_size=TIFFhowmany_64(_TIFFMultiply64(tif,scanline_samples,td->td_bitspersample,module),8);
}
@@ -314,7 +314,7 @@ tmsize_t
TIFFScanlineSize(TIFF* tif)
{
static const char module[] = "TIFFScanlineSize";
- uint64 m;
+ uint64_t m;
m=TIFFScanlineSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -325,12 +325,12 @@ TIFFScanlineSize(TIFF* tif)
* I/O size returned by TIFFScanlineSize which may be less
* if data is store as separate planes).
*/
-uint64
+uint64_t
TIFFRasterScanlineSize64(TIFF* tif)
{
static const char module[] = "TIFFRasterScanlineSize64";
TIFFDirectory *td = &tif->tif_dir;
- uint64 scanline;
+ uint64_t scanline;
scanline = _TIFFMultiply64(tif, td->td_bitspersample, td->td_imagewidth, module);
if (td->td_planarconfig == PLANARCONFIG_CONTIG) {
@@ -344,7 +344,7 @@ tmsize_t
TIFFRasterScanlineSize(TIFF* tif)
{
static const char module[] = "TIFFRasterScanlineSize";
- uint64 m;
+ uint64_t m;
m=TIFFRasterScanlineSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
diff --git a/libtiff/tif_swab.c b/libtiff/tif_swab.c
index b174ba69..3d4bb6ca 100644
--- a/libtiff/tif_swab.c
+++ b/libtiff/tif_swab.c
@@ -31,22 +31,22 @@
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabShort)
void
-TIFFSwabShort(uint16* wp)
+TIFFSwabShort(uint16_t* wp)
{
register unsigned char* cp = (unsigned char*) wp;
unsigned char t;
- assert(sizeof(uint16)==2);
+ assert(sizeof(uint16_t) == 2);
t = cp[1]; cp[1] = cp[0]; cp[0] = t;
}
#endif
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabLong)
void
-TIFFSwabLong(uint32* lp)
+TIFFSwabLong(uint32_t* lp)
{
register unsigned char* cp = (unsigned char*) lp;
unsigned char t;
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint32_t) == 4);
t = cp[3]; cp[3] = cp[0]; cp[0] = t;
t = cp[2]; cp[2] = cp[1]; cp[1] = t;
}
@@ -54,11 +54,11 @@ TIFFSwabLong(uint32* lp)
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabLong8)
void
-TIFFSwabLong8(uint64* lp)
+TIFFSwabLong8(uint64_t* lp)
{
register unsigned char* cp = (unsigned char*) lp;
unsigned char t;
- assert(sizeof(uint64)==8);
+ assert(sizeof(uint64_t) == 8);
t = cp[7]; cp[7] = cp[0]; cp[0] = t;
t = cp[6]; cp[6] = cp[1]; cp[1] = t;
t = cp[5]; cp[5] = cp[2]; cp[2] = t;
@@ -68,11 +68,11 @@ TIFFSwabLong8(uint64* lp)
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfShort)
void
-TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n)
+TIFFSwabArrayOfShort(register uint16_t* wp, tmsize_t n)
{
register unsigned char* cp;
register unsigned char t;
- assert(sizeof(uint16)==2);
+ assert(sizeof(uint16_t) == 2);
/* XXX unroll loop some */
while (n-- > 0) {
cp = (unsigned char*) wp;
@@ -84,7 +84,7 @@ TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n)
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfTriples)
void
-TIFFSwabArrayOfTriples(register uint8* tp, tmsize_t n)
+TIFFSwabArrayOfTriples(register uint8_t* tp, tmsize_t n)
{
unsigned char* cp;
unsigned char t;
@@ -100,11 +100,11 @@ TIFFSwabArrayOfTriples(register uint8* tp, tmsize_t n)
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfLong)
void
-TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
+TIFFSwabArrayOfLong(register uint32_t* lp, tmsize_t n)
{
register unsigned char *cp;
register unsigned char t;
- assert(sizeof(uint32)==4);
+ assert(sizeof(uint32_t) == 4);
/* XXX unroll loop some */
while (n-- > 0) {
cp = (unsigned char *)lp;
@@ -117,11 +117,11 @@ TIFFSwabArrayOfLong(register uint32* lp, tmsize_t n)
#if defined(DISABLE_CHECK_TIFFSWABMACROS) || !defined(TIFFSwabArrayOfLong8)
void
-TIFFSwabArrayOfLong8(register uint64* lp, tmsize_t n)
+TIFFSwabArrayOfLong8(register uint64_t* lp, tmsize_t n)
{
register unsigned char *cp;
register unsigned char t;
- assert(sizeof(uint64)==8);
+ assert(sizeof(uint64_t) == 8);
/* XXX unroll loop some */
while (n-- > 0) {
cp = (unsigned char *)lp;
@@ -281,7 +281,7 @@ TIFFGetBitRevTable(int reversed)
}
void
-TIFFReverseBits(uint8* cp, tmsize_t n)
+TIFFReverseBits(uint8_t* cp, tmsize_t n)
{
for (; n > 8; n -= 8) {
cp[0] = TIFFBitRevTable[cp[0]];
diff --git a/libtiff/tif_thunder.c b/libtiff/tif_thunder.c
index db6383a8..c5b40e2d 100644
--- a/libtiff/tif_thunder.c
+++ b/libtiff/tif_thunder.c
@@ -61,7 +61,7 @@ static const int threebitdeltas[8] = { 0, 1, 2, 3, 0, -3, -2, -1 };
if (npixels++ & 1) \
*op++ |= lastpixel; \
else \
- op[0] = (uint8) (lastpixel << 4); \
+ op[0] = (uint8_t) (lastpixel << 4); \
} \
}
@@ -83,7 +83,7 @@ ThunderSetupDecode(TIFF* tif)
}
static int
-ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
+ThunderDecode(TIFF* tif, uint8_t* op, tmsize_t maxpixels)
{
static const char module[] = "ThunderDecode";
register unsigned char *bp;
@@ -114,7 +114,7 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
npixels += n;
if (npixels < maxpixels) {
for (; n > 0; n -= 2)
- *op++ = (uint8) lastpixel;
+ *op++ = (uint8_t) lastpixel;
}
if (n == -1)
*--op &= 0xf0;
@@ -139,7 +139,7 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
break;
}
}
- tif->tif_rawcp = (uint8*) bp;
+ tif->tif_rawcp = (uint8_t*) bp;
tif->tif_rawcc = cc;
if (npixels != maxpixels) {
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
@@ -164,10 +164,10 @@ ThunderDecode(TIFF* tif, uint8* op, tmsize_t maxpixels)
}
static int
-ThunderDecodeRow(TIFF* tif, uint8* buf, tmsize_t occ, uint16 s)
+ThunderDecodeRow(TIFF* tif, uint8_t* buf, tmsize_t occ, uint16_t s)
{
static const char module[] = "ThunderDecodeRow";
- uint8* row = buf;
+ uint8_t* row = buf;
(void) s;
if (occ % tif->tif_scanlinesize)
diff --git a/libtiff/tif_tile.c b/libtiff/tif_tile.c
index 661cc771..058be9f7 100644
--- a/libtiff/tif_tile.c
+++ b/libtiff/tif_tile.c
@@ -32,27 +32,27 @@
/*
* Compute which tile an (x,y,z,s) value is in.
*/
-uint32
-TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
+uint32_t
+TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
{
TIFFDirectory *td = &tif->tif_dir;
- uint32 dx = td->td_tilewidth;
- uint32 dy = td->td_tilelength;
- uint32 dz = td->td_tiledepth;
- uint32 tile = 1;
+ uint32_t dx = td->td_tilewidth;
+ uint32_t dy = td->td_tilelength;
+ uint32_t dz = td->td_tiledepth;
+ uint32_t tile = 1;
if (td->td_imagedepth == 1)
z = 0;
- if (dx == (uint32) -1)
+ if (dx == (uint32_t) -1)
dx = td->td_imagewidth;
- if (dy == (uint32) -1)
+ if (dy == (uint32_t) -1)
dy = td->td_imagelength;
- if (dz == (uint32) -1)
+ if (dz == (uint32_t) -1)
dz = td->td_imagedepth;
if (dx != 0 && dy != 0 && dz != 0) {
- uint32 xpt = TIFFhowmany_32(td->td_imagewidth, dx);
- uint32 ypt = TIFFhowmany_32(td->td_imagelength, dy);
- uint32 zpt = TIFFhowmany_32(td->td_imagedepth, dz);
+ uint32_t xpt = TIFFhowmany_32(td->td_imagewidth, dx);
+ uint32_t ypt = TIFFhowmany_32(td->td_imagelength, dy);
+ uint32_t zpt = TIFFhowmany_32(td->td_imagedepth, dz);
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
tile = (xpt*ypt*zpt)*s +
@@ -70,7 +70,7 @@ TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
* against the image bounds.
*/
int
-TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
+TIFFCheckTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
{
TIFFDirectory *td = &tif->tif_dir;
@@ -109,20 +109,20 @@ TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s)
/*
* Compute how many tiles are in an image.
*/
-uint32
+uint32_t
TIFFNumberOfTiles(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
- uint32 dx = td->td_tilewidth;
- uint32 dy = td->td_tilelength;
- uint32 dz = td->td_tiledepth;
- uint32 ntiles;
+ uint32_t dx = td->td_tilewidth;
+ uint32_t dy = td->td_tilelength;
+ uint32_t dz = td->td_tiledepth;
+ uint32_t ntiles;
- if (dx == (uint32) -1)
+ if (dx == (uint32_t) -1)
dx = td->td_imagewidth;
- if (dy == (uint32) -1)
+ if (dy == (uint32_t) -1)
dy = td->td_imagelength;
- if (dz == (uint32) -1)
+ if (dz == (uint32_t) -1)
dz = td->td_imagedepth;
ntiles = (dx == 0 || dy == 0 || dz == 0) ? 0 :
_TIFFMultiply32(tif, _TIFFMultiply32(tif, TIFFhowmany_32(td->td_imagewidth, dx),
@@ -138,13 +138,13 @@ TIFFNumberOfTiles(TIFF* tif)
/*
* Compute the # bytes in each row of a tile.
*/
-uint64
+uint64_t
TIFFTileRowSize64(TIFF* tif)
{
static const char module[] = "TIFFTileRowSize64";
TIFFDirectory *td = &tif->tif_dir;
- uint64 rowsize;
- uint64 tilerowsize;
+ uint64_t rowsize;
+ uint64_t tilerowsize;
if (td->td_tilelength == 0)
{
@@ -180,7 +180,7 @@ tmsize_t
TIFFTileRowSize(TIFF* tif)
{
static const char module[] = "TIFFTileRowSize";
- uint64 m;
+ uint64_t m;
m=TIFFTileRowSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -188,8 +188,8 @@ TIFFTileRowSize(TIFF* tif)
/*
* Compute the # bytes in a variable length, row-aligned tile.
*/
-uint64
-TIFFVTileSize64(TIFF* tif, uint32 nrows)
+uint64_t
+TIFFVTileSize64(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVTileSize64";
TIFFDirectory *td = &tif->tif_dir;
@@ -209,12 +209,12 @@ TIFFVTileSize64(TIFF* tif, uint32 nrows)
* horizontal/vertical subsampling area include
* YCbCr data for the extended image.
*/
- uint16 ycbcrsubsampling[2];
- uint16 samplingblock_samples;
- uint32 samplingblocks_hor;
- uint32 samplingblocks_ver;
- uint64 samplingrow_samples;
- uint64 samplingrow_size;
+ uint16_t ycbcrsubsampling[2];
+ uint16_t samplingblock_samples;
+ uint32_t samplingblocks_hor;
+ uint32_t samplingblocks_ver;
+ uint64_t samplingrow_samples;
+ uint64_t samplingrow_size;
TIFFGetFieldDefaulted(tif,TIFFTAG_YCBCRSUBSAMPLING,ycbcrsubsampling+0,
ycbcrsubsampling+1);
if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 && ycbcrsubsampling[0] != 4)
@@ -237,10 +237,10 @@ TIFFVTileSize64(TIFF* tif, uint32 nrows)
return(_TIFFMultiply64(tif,nrows,TIFFTileRowSize64(tif),module));
}
tmsize_t
-TIFFVTileSize(TIFF* tif, uint32 nrows)
+TIFFVTileSize(TIFF* tif, uint32_t nrows)
{
static const char module[] = "TIFFVTileSize";
- uint64 m;
+ uint64_t m;
m=TIFFVTileSize64(tif,nrows);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -248,7 +248,7 @@ TIFFVTileSize(TIFF* tif, uint32 nrows)
/*
* Compute the # bytes in a row-aligned tile.
*/
-uint64
+uint64_t
TIFFTileSize64(TIFF* tif)
{
return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength));
@@ -257,7 +257,7 @@ tmsize_t
TIFFTileSize(TIFF* tif)
{
static const char module[] = "TIFFTileSize";
- uint64 m;
+ uint64_t m;
m=TIFFTileSize64(tif);
return _TIFFCastUInt64ToSSize(tif, m, module);
}
@@ -269,18 +269,18 @@ TIFFTileSize(TIFF* tif)
* to certain heuristics.
*/
void
-TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th)
{
(*tif->tif_deftilesize)(tif, tw, th);
}
void
-_TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th)
+_TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th)
{
(void) tif;
- if (*(int32*) tw < 1)
+ if (*(int32_t*) tw < 1)
*tw = 256;
- if (*(int32*) th < 1)
+ if (*(int32_t*) th < 1)
*th = 256;
/* roundup to a multiple of 16 per the spec */
if (*tw & 0xf)
diff --git a/libtiff/tif_unix.c b/libtiff/tif_unix.c
index bea1ef78..cb543542 100644
--- a/libtiff/tif_unix.c
+++ b/libtiff/tif_unix.c
@@ -120,18 +120,18 @@ _tiffWriteProc(thandle_t fd, void* buf, tmsize_t size)
/* return ((tmsize_t) write(fdh.fd, buf, bytes_total)); */
}
-static uint64
-_tiffSeekProc(thandle_t fd, uint64 off, int whence)
+static uint64_t
+_tiffSeekProc(thandle_t fd, uint64_t off, int whence)
{
fd_as_handle_union_t fdh;
_TIFF_off_t off_io = (_TIFF_off_t) off;
- if ((uint64) off_io != off)
+ if ((uint64_t) off_io != off)
{
errno=EINVAL;
- return (uint64) -1; /* this is really gross */
+ return (uint64_t) -1; /* this is really gross */
}
fdh.h = fd;
- return((uint64)_TIFF_lseek_f(fdh.fd,off_io,whence));
+ return((uint64_t)_TIFF_lseek_f(fdh.fd, off_io, whence));
}
static int
@@ -142,7 +142,7 @@ _tiffCloseProc(thandle_t fd)
return(close(fdh.fd));
}
-static uint64
+static uint64_t
_tiffSizeProc(thandle_t fd)
{
_TIFF_stat_s sb;
@@ -151,7 +151,7 @@ _tiffSizeProc(thandle_t fd)
if (_TIFF_fstat_f(fdh.fd,&sb)<0)
return(0);
else
- return((uint64)sb.st_size);
+ return((uint64_t)sb.st_size);
}
#ifdef HAVE_MMAP
@@ -160,9 +160,9 @@ _tiffSizeProc(thandle_t fd)
static int
_tiffMapProc(thandle_t fd, void** pbase, toff_t* psize)
{
- uint64 size64 = _tiffSizeProc(fd);
+ uint64_t size64 = _tiffSizeProc(fd);
tmsize_t sizem = (tmsize_t)size64;
- if (size64 && (uint64)sizem==size64) {
+ if (size64 && (uint64_t)sizem == size64) {
fd_as_handle_union_t fdh;
fdh.h = fd;
*pbase = (void*)
diff --git a/libtiff/tif_webp.c b/libtiff/tif_webp.c
index 0682382b..31412c84 100644
--- a/libtiff/tif_webp.c
+++ b/libtiff/tif_webp.c
@@ -43,13 +43,13 @@
* file using WEBP compression/decompression.
*/
typedef struct {
- uint16 nSamples; /* number of samples per pixel */
+ uint16_t nSamples; /* number of samples per pixel */
int lossless; /* lossy/lossless compression */
int quality_level; /* compression level */
WebPPicture sPicture; /* WebP Picture */
WebPConfig sEncoderConfig; /* WebP encoder config */
- uint8* pBuffer; /* buffer to hold raw data on encoding */
+ uint8_t* pBuffer; /* buffer to hold raw data on encoding */
unsigned int buffer_offset; /* current offset into the buffer */
unsigned int buffer_size;
@@ -67,8 +67,8 @@ typedef struct {
#define DecoderState(tif) LState(tif)
#define EncoderState(tif) LState(tif)
-static int TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int TWebPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
+static int TWebPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s);
static
int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
@@ -79,7 +79,7 @@ int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
if ( (tif->tif_rawcc + (tmsize_t)data_size) > tif->tif_rawdatasize ) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Buffer too small by %" TIFF_SIZE_FORMAT " bytes.",
+ "Buffer too small by %zu bytes.",
(size_t) (tif->tif_rawcc + data_size - tif->tif_rawdatasize));
return 0;
} else {
@@ -94,7 +94,7 @@ int TWebPDatasetWriter(const uint8_t* data, size_t data_size,
* Encode a chunk of pixels.
*/
static int
-TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+TWebPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "TWebPEncode";
WebPState *sp = EncoderState(tif);
@@ -103,8 +103,8 @@ TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
assert(sp != NULL);
assert(sp->state == LSTATE_INIT_ENCODE);
- if( (uint64)sp->buffer_offset +
- (uint64)cc > sp->buffer_size )
+ if((uint64_t)sp->buffer_offset +
+ (uint64_t)cc > sp->buffer_size )
{
TIFFErrorExt(tif->tif_clientdata, module,
"Too many bytes to be written");
@@ -120,7 +120,7 @@ TWebPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
}
static int
-TWebPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+TWebPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "WebPDecode";
VP8StatusCode status = VP8_STATUS_OK;
@@ -196,8 +196,8 @@ static int
TWebPSetupDecode(TIFF* tif)
{
static const char module[] = "WebPSetupDecode";
- uint16 nBitsPerSample = tif->tif_dir.td_bitspersample;
- uint16 sampleFormat = tif->tif_dir.td_sampleformat;
+ uint16_t nBitsPerSample = tif->tif_dir.td_bitspersample;
+ uint16_t sampleFormat = tif->tif_dir.td_sampleformat;
WebPState* sp = DecoderState(tif);
assert(sp != NULL);
@@ -248,10 +248,10 @@ TWebPSetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-TWebPPreDecode(TIFF* tif, uint16 s)
+TWebPPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "TWebPPreDecode";
- uint32 segment_width, segment_height;
+ uint32_t segment_width, segment_height;
WebPState* sp = DecoderState(tif);
TIFFDirectory* td = &tif->tif_dir;
(void) s;
@@ -313,8 +313,8 @@ static int
TWebPSetupEncode(TIFF* tif)
{
static const char module[] = "WebPSetupEncode";
- uint16 nBitsPerSample = tif->tif_dir.td_bitspersample;
- uint16 sampleFormat = tif->tif_dir.td_sampleformat;
+ uint16_t nBitsPerSample = tif->tif_dir.td_bitspersample;
+ uint16_t sampleFormat = tif->tif_dir.td_sampleformat;
WebPState* sp = EncoderState(tif);
assert(sp != NULL);
@@ -390,10 +390,10 @@ TWebPSetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-TWebPPreEncode(TIFF* tif, uint16 s)
+TWebPPreEncode(TIFF* tif, uint16_t s)
{
static const char module[] = "TWebPPreEncode";
- uint32 segment_width, segment_height;
+ uint32_t segment_width, segment_height;
WebPState *sp = EncoderState(tif);
TIFFDirectory* td = &tif->tif_dir;
@@ -567,7 +567,7 @@ TWebPCleanup(TIFF* tif)
}
static int
-TWebPVSetField(TIFF* tif, uint32 tag, va_list ap)
+TWebPVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "WebPVSetField";
WebPState* sp = LState(tif);
@@ -601,7 +601,7 @@ TWebPVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-TWebPVGetField(TIFF* tif, uint32 tag, va_list ap)
+TWebPVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
WebPState* sp = LState(tif);
@@ -649,7 +649,7 @@ TIFFInitWebP(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof(WebPState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(WebPState));
if (tif->tif_data == NULL)
goto bad;
sp = LState(tif);
diff --git a/libtiff/tif_win32.c b/libtiff/tif_win32.c
index 89645693..073f0ade 100644
--- a/libtiff/tif_win32.c
+++ b/libtiff/tif_win32.c
@@ -65,18 +65,18 @@ _tiffReadProc(thandle_t fd, void* buf, tmsize_t size)
/* tmsize_t is 64bit on 64bit systems, but the WinAPI ReadFile takes
* 32bit sizes, so we loop through the data in suitable 32bit sized
* chunks */
- uint8* ma;
- uint64 mb;
+ uint8_t* ma;
+ uint64_t mb;
DWORD n;
DWORD o;
tmsize_t p;
- ma=(uint8*)buf;
+ ma=(uint8_t*)buf;
mb=size;
p=0;
while (mb>0)
{
n=0x80000000UL;
- if ((uint64)n>mb)
+ if ((uint64_t)n>mb)
n=(DWORD)mb;
if (!ReadFile(fd,(LPVOID)ma,n,&o,NULL))
return(0);
@@ -95,18 +95,18 @@ _tiffWriteProc(thandle_t fd, void* buf, tmsize_t size)
/* tmsize_t is 64bit on 64bit systems, but the WinAPI WriteFile takes
* 32bit sizes, so we loop through the data in suitable 32bit sized
* chunks */
- uint8* ma;
- uint64 mb;
+ uint8_t* ma;
+ uint64_t mb;
DWORD n;
DWORD o;
tmsize_t p;
- ma=(uint8*)buf;
+ ma=(uint8_t*)buf;
mb=size;
p=0;
while (mb>0)
{
n=0x80000000UL;
- if ((uint64)n>mb)
+ if ((uint64_t)n>mb)
n=(DWORD)mb;
if (!WriteFile(fd,(LPVOID)ma,n,&o,NULL))
return(0);
@@ -119,8 +119,8 @@ _tiffWriteProc(thandle_t fd, void* buf, tmsize_t size)
return(p);
}
-static uint64
-_tiffSeekProc(thandle_t fd, uint64 off, int whence)
+static uint64_t
+_tiffSeekProc(thandle_t fd, uint64_t off, int whence)
{
LARGE_INTEGER offli;
DWORD dwMoveMethod;
@@ -152,7 +152,7 @@ _tiffCloseProc(thandle_t fd)
return (CloseHandle(fd) ? 0 : -1);
}
-static uint64
+static uint64_t
_tiffSizeProc(thandle_t fd)
{
LARGE_INTEGER m;
@@ -185,13 +185,13 @@ _tiffDummyMapProc(thandle_t fd, void** pbase, toff_t* psize)
static int
_tiffMapProc(thandle_t fd, void** pbase, toff_t* psize)
{
- uint64 size;
+ uint64_t size;
tmsize_t sizem;
HANDLE hMapFile;
size = _tiffSizeProc(fd);
sizem = (tmsize_t)size;
- if (!size || (uint64)sizem!=size)
+ if (!size || (uint64_t)sizem!=size)
return (0);
/* By passing in 0 for the maximum file size, it specifies that we
diff --git a/libtiff/tif_write.c b/libtiff/tif_write.c
index 3af69ab4..b5ef21d0 100644
--- a/libtiff/tif_write.c
+++ b/libtiff/tif_write.c
@@ -40,16 +40,16 @@
((((tif)->tif_flags & TIFF_BUFFERSETUP) && tif->tif_rawdata) || \
TIFFWriteBufferSetup((tif), NULL, (tmsize_t) -1))
-static int TIFFGrowStrips(TIFF* tif, uint32 delta, const char* module);
-static int TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc);
+static int TIFFGrowStrips(TIFF* tif, uint32_t delta, const char* module);
+static int TIFFAppendToStrip(TIFF* tif, uint32_t strip, uint8_t* data, tmsize_t cc);
int
-TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
+TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample)
{
static const char module[] = "TIFFWriteScanline";
register TIFFDirectory *td;
int status, imagegrew = 0;
- uint32 strip;
+ uint32_t strip;
if (!WRITECHECKSTRIPS(tif, module))
return (-1);
@@ -166,9 +166,9 @@ TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
}
/* swab if needed - note that source buffer will be altered */
- tif->tif_postdecode( tif, (uint8*) buf, tif->tif_scanlinesize );
+ tif->tif_postdecode(tif, (uint8_t*) buf, tif->tif_scanlinesize );
- status = (*tif->tif_encoderow)(tif, (uint8*) buf,
+ status = (*tif->tif_encoderow)(tif, (uint8_t*) buf,
tif->tif_scanlinesize, sample);
/* we are now poised at the beginning of the next row */
@@ -180,14 +180,14 @@ TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample)
/* more bytes available in the output buffer than the previous byte count, */
/* so that TIFFAppendToStrip() will detect the overflow when it is called the first */
/* time if the new compressed tile is bigger than the older one. (GDAL #4771) */
-static int _TIFFReserveLargeEnoughWriteBuffer(TIFF* tif, uint32 strip_or_tile)
+static int _TIFFReserveLargeEnoughWriteBuffer(TIFF* tif, uint32_t strip_or_tile)
{
TIFFDirectory *td = &tif->tif_dir;
if( td->td_stripbytecount_p[strip_or_tile] > 0 )
{
/* The +1 is to ensure at least one extra bytes */
/* The +4 is because the LZW encoder flushes 4 bytes before the limit */
- uint64 safe_buffer_size = (uint64)(td->td_stripbytecount_p[strip_or_tile] + 1 + 4);
+ uint64_t safe_buffer_size = (uint64_t)(td->td_stripbytecount_p[strip_or_tile] + 1 + 4);
if( tif->tif_rawdatasize <= (tmsize_t)safe_buffer_size )
{
if( !(TIFFWriteBufferSetup(tif, NULL,
@@ -209,11 +209,11 @@ static int _TIFFReserveLargeEnoughWriteBuffer(TIFF* tif, uint32 strip_or_tile)
* NB: Image length must be setup before writing.
*/
tmsize_t
-TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
+TIFFWriteEncodedStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc)
{
static const char module[] = "TIFFWriteEncodedStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint16 sample;
+ uint16_t sample;
if (!WRITECHECKSTRIPS(tif, module))
return ((tmsize_t) -1);
@@ -273,26 +273,26 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
if( td->td_compression == COMPRESSION_NONE )
{
/* swab if needed - note that source buffer will be altered */
- tif->tif_postdecode( tif, (uint8*) data, cc );
+ tif->tif_postdecode(tif, (uint8_t*) data, cc );
if (!isFillOrder(tif, td->td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
- TIFFReverseBits((uint8*) data, cc);
+ TIFFReverseBits((uint8_t*) data, cc);
if (cc > 0 &&
- !TIFFAppendToStrip(tif, strip, (uint8*) data, cc))
+ !TIFFAppendToStrip(tif, strip, (uint8_t*) data, cc))
return ((tmsize_t) -1);
return (cc);
}
- sample = (uint16)(strip / td->td_stripsperimage);
+ sample = (uint16_t)(strip / td->td_stripsperimage);
if (!(*tif->tif_preencode)(tif, sample))
return ((tmsize_t) -1);
/* swab if needed - note that source buffer will be altered */
- tif->tif_postdecode( tif, (uint8*) data, cc );
+ tif->tif_postdecode(tif, (uint8_t*) data, cc );
- if (!(*tif->tif_encodestrip)(tif, (uint8*) data, cc, sample))
+ if (!(*tif->tif_encodestrip)(tif, (uint8_t*) data, cc, sample))
return ((tmsize_t) -1);
if (!(*tif->tif_postencode)(tif))
return ((tmsize_t) -1);
@@ -313,7 +313,7 @@ TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
* NB: Image length must be setup before writing.
*/
tmsize_t
-TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
+TIFFWriteRawStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc)
{
static const char module[] = "TIFFWriteRawStrip";
TIFFDirectory *td = &tif->tif_dir;
@@ -352,7 +352,7 @@ TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
return ((tmsize_t) -1);
}
tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
- return (TIFFAppendToStrip(tif, strip, (uint8*) data, cc) ?
+ return (TIFFAppendToStrip(tif, strip, (uint8_t*) data, cc) ?
cc : (tmsize_t) -1);
}
@@ -361,7 +361,7 @@ TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
* tile is selected by the (x,y,z,s) coordinates.
*/
tmsize_t
-TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s)
+TIFFWriteTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s)
{
if (!TIFFCheckTile(tif, x, y, z, s))
return ((tmsize_t)(-1));
@@ -388,12 +388,12 @@ TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s)
* the image on each write (as TIFFWriteScanline does).
*/
tmsize_t
-TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
+TIFFWriteEncodedTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc)
{
static const char module[] = "TIFFWriteEncodedTile";
TIFFDirectory *td;
- uint16 sample;
- uint32 howmany32;
+ uint16_t sample;
+ uint32_t howmany32;
if (!WRITECHECKTILES(tif, module))
return ((tmsize_t)(-1));
@@ -457,31 +457,31 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
if( td->td_compression == COMPRESSION_NONE )
{
/* swab if needed - note that source buffer will be altered */
- tif->tif_postdecode( tif, (uint8*) data, cc );
+ tif->tif_postdecode(tif, (uint8_t*) data, cc );
if (!isFillOrder(tif, td->td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
- TIFFReverseBits((uint8*) data, cc);
+ TIFFReverseBits((uint8_t*) data, cc);
if (cc > 0 &&
- !TIFFAppendToStrip(tif, tile, (uint8*) data, cc))
+ !TIFFAppendToStrip(tif, tile, (uint8_t*) data, cc))
return ((tmsize_t) -1);
return (cc);
}
- sample = (uint16)(tile/td->td_stripsperimage);
+ sample = (uint16_t)(tile / td->td_stripsperimage);
if (!(*tif->tif_preencode)(tif, sample))
return ((tmsize_t)(-1));
/* swab if needed - note that source buffer will be altered */
- tif->tif_postdecode( tif, (uint8*) data, cc );
+ tif->tif_postdecode(tif, (uint8_t*) data, cc );
- if (!(*tif->tif_encodetile)(tif, (uint8*) data, cc, sample))
+ if (!(*tif->tif_encodetile)(tif, (uint8_t*) data, cc, sample))
return ((tmsize_t) -1);
if (!(*tif->tif_postencode)(tif))
return ((tmsize_t)(-1));
if (!isFillOrder(tif, td->td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
- TIFFReverseBits((uint8*)tif->tif_rawdata, tif->tif_rawcc);
+ TIFFReverseBits((uint8_t*)tif->tif_rawdata, tif->tif_rawcc);
if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile,
tif->tif_rawdata, tif->tif_rawcc))
return ((tmsize_t)(-1));
@@ -500,7 +500,7 @@ TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
* the image on each write (as TIFFWriteScanline does).
*/
tmsize_t
-TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
+TIFFWriteRawTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc)
{
static const char module[] = "TIFFWriteRawTile";
@@ -512,7 +512,7 @@ TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc)
(unsigned long) tif->tif_dir.td_nstrips);
return ((tmsize_t)(-1));
}
- return (TIFFAppendToStrip(tif, tile, (uint8*) data, cc) ?
+ return (TIFFAppendToStrip(tif, tile, (uint8_t*) data, cc) ?
cc : (tmsize_t)(-1));
}
@@ -542,11 +542,11 @@ TIFFSetupStrips(TIFF* tif)
}
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
td->td_stripsperimage /= td->td_samplesperpixel;
- td->td_stripoffset_p = (uint64 *)
- _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64),
+ td->td_stripoffset_p = (uint64_t *)
+ _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64_t),
"for \"StripOffsets\" array");
- td->td_stripbytecount_p = (uint64 *)
- _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64),
+ td->td_stripbytecount_p = (uint64_t *)
+ _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64_t),
"for \"StripByteCounts\" array");
if (td->td_stripoffset_p == NULL || td->td_stripbytecount_p == NULL)
return (0);
@@ -554,8 +554,8 @@ TIFFSetupStrips(TIFF* tif)
* Place data at the end-of-file
* (by setting offsets to zero).
*/
- _TIFFmemset(td->td_stripoffset_p, 0, td->td_nstrips*sizeof (uint64));
- _TIFFmemset(td->td_stripbytecount_p, 0, td->td_nstrips*sizeof (uint64));
+ _TIFFmemset(td->td_stripoffset_p, 0, td->td_nstrips*sizeof (uint64_t));
+ _TIFFmemset(td->td_stripbytecount_p, 0, td->td_nstrips*sizeof (uint64_t));
TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
return (1);
@@ -688,7 +688,7 @@ TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size)
tif->tif_flags |= TIFF_MYBUFFER;
} else
tif->tif_flags &= ~TIFF_MYBUFFER;
- tif->tif_rawdata = (uint8*) bp;
+ tif->tif_rawdata = (uint8_t*) bp;
tif->tif_rawdatasize = size;
tif->tif_rawcc = 0;
tif->tif_rawcp = tif->tif_rawdata;
@@ -700,17 +700,17 @@ TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size)
* Grow the strip data structures by delta strips.
*/
static int
-TIFFGrowStrips(TIFF* tif, uint32 delta, const char* module)
+TIFFGrowStrips(TIFF* tif, uint32_t delta, const char* module)
{
TIFFDirectory *td = &tif->tif_dir;
- uint64* new_stripoffset;
- uint64* new_stripbytecount;
+ uint64_t* new_stripoffset;
+ uint64_t* new_stripbytecount;
assert(td->td_planarconfig == PLANARCONFIG_CONTIG);
- new_stripoffset = (uint64*)_TIFFrealloc(td->td_stripoffset_p,
- (td->td_nstrips + delta) * sizeof (uint64));
- new_stripbytecount = (uint64*)_TIFFrealloc(td->td_stripbytecount_p,
- (td->td_nstrips + delta) * sizeof (uint64));
+ new_stripoffset = (uint64_t*)_TIFFrealloc(td->td_stripoffset_p,
+ (td->td_nstrips + delta) * sizeof (uint64_t));
+ new_stripbytecount = (uint64_t*)_TIFFrealloc(td->td_stripbytecount_p,
+ (td->td_nstrips + delta) * sizeof (uint64_t));
if (new_stripoffset == NULL || new_stripbytecount == NULL) {
if (new_stripoffset)
_TIFFfree(new_stripoffset);
@@ -723,9 +723,9 @@ TIFFGrowStrips(TIFF* tif, uint32 delta, const char* module)
td->td_stripoffset_p = new_stripoffset;
td->td_stripbytecount_p = new_stripbytecount;
_TIFFmemset(td->td_stripoffset_p + td->td_nstrips,
- 0, delta*sizeof (uint64));
+ 0, delta*sizeof (uint64_t));
_TIFFmemset(td->td_stripbytecount_p + td->td_nstrips,
- 0, delta*sizeof (uint64));
+ 0, delta*sizeof (uint64_t));
td->td_nstrips += delta;
tif->tif_flags |= TIFF_DIRTYDIRECT;
@@ -736,19 +736,19 @@ TIFFGrowStrips(TIFF* tif, uint32 delta, const char* module)
* Append the data to the specified strip.
*/
static int
-TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc)
+TIFFAppendToStrip(TIFF* tif, uint32_t strip, uint8_t* data, tmsize_t cc)
{
static const char module[] = "TIFFAppendToStrip";
TIFFDirectory *td = &tif->tif_dir;
- uint64 m;
- int64 old_byte_count = -1;
+ uint64_t m;
+ int64_t old_byte_count = -1;
if (td->td_stripoffset_p[strip] == 0 || tif->tif_curoff == 0) {
assert(td->td_nstrips > 0);
if( td->td_stripbytecount_p[strip] != 0
&& td->td_stripoffset_p[strip] != 0
- && td->td_stripbytecount_p[strip] >= (uint64) cc )
+ && td->td_stripbytecount_p[strip] >= (uint64_t) cc )
{
/*
* There is already tile data on disk, and the new tile
@@ -785,8 +785,8 @@ TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc)
m = tif->tif_curoff+cc;
if (!(tif->tif_flags&TIFF_BIGTIFF))
- m = (uint32)m;
- if ((m<tif->tif_curoff)||(m<(uint64)cc))
+ m = (uint32_t)m;
+ if ((m<tif->tif_curoff)||(m<(uint64_t)cc))
{
TIFFErrorExt(tif->tif_clientdata, module, "Maximum TIFF file size exceeded");
return (0);
@@ -799,7 +799,7 @@ TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc)
tif->tif_curoff = m;
td->td_stripbytecount_p[strip] += cc;
- if( (int64) td->td_stripbytecount_p[strip] != old_byte_count )
+ if((int64_t) td->td_stripbytecount_p[strip] != old_byte_count )
tif->tif_flags |= TIFF_DIRTYSTRIP;
return (1);
@@ -816,7 +816,7 @@ TIFFFlushData1(TIFF* tif)
if (tif->tif_rawcc > 0 && tif->tif_flags & TIFF_BUF4WRITE ) {
if (!isFillOrder(tif, tif->tif_dir.td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
- TIFFReverseBits((uint8*)tif->tif_rawdata,
+ TIFFReverseBits((uint8_t*)tif->tif_rawdata,
tif->tif_rawcc);
if (!TIFFAppendToStrip(tif,
isTiled(tif) ? tif->tif_curtile : tif->tif_curstrip,
diff --git a/libtiff/tif_zip.c b/libtiff/tif_zip.c
index 1b097f88..be35e49b 100644
--- a/libtiff/tif_zip.c
+++ b/libtiff/tif_zip.c
@@ -85,8 +85,8 @@ typedef struct {
#define DecoderState(tif) ZState(tif)
#define EncoderState(tif) ZState(tif)
-static int ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
+static int ZIPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int ZIPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s);
static int
ZIPFixupTags(TIFF* tif)
@@ -126,7 +126,7 @@ ZIPSetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-ZIPPreDecode(TIFF* tif, uint16 s)
+ZIPPreDecode(TIFF* tif, uint16_t s)
{
ZIPState* sp = DecoderState(tif);
@@ -144,12 +144,12 @@ ZIPPreDecode(TIFF* tif, uint16 s)
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
appropriately even before we simplify it */
- sp->stream.avail_in = (uint64)tif->tif_rawcc < 0xFFFFFFFFU ? (uInt) tif->tif_rawcc : 0xFFFFFFFFU;
+ sp->stream.avail_in = (uint64_t)tif->tif_rawcc < 0xFFFFFFFFU ? (uInt) tif->tif_rawcc : 0xFFFFFFFFU;
return (inflateReset(&sp->stream) == Z_OK);
}
static int
-ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ZIPDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "ZIPDecode";
ZIPState* sp = DecoderState(tif);
@@ -174,20 +174,20 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
/* Check if we are in the situation where we can use libdeflate */
if (isTiled(tif)) {
- if( TIFFTileSize64(tif) != (uint64)occ )
+ if( TIFFTileSize64(tif) != (uint64_t)occ )
break;
} else {
- uint32 strip_height = td->td_imagelength - tif->tif_row;
+ uint32_t strip_height = td->td_imagelength - tif->tif_row;
if (strip_height > td->td_rowsperstrip)
strip_height = td->td_rowsperstrip;
- if( TIFFVStripSize64(tif, strip_height) != (uint64)occ )
+ if( TIFFVStripSize64(tif, strip_height) != (uint64_t)occ )
break;
}
/* Check for overflow */
- if( (size_t)tif->tif_rawcc != (uint64)tif->tif_rawcc )
+ if( (size_t)tif->tif_rawcc != (uint64_t)tif->tif_rawcc )
break;
- if( (size_t)occ != (uint64)occ )
+ if( (size_t)occ != (uint64_t)occ )
break;
/* Go for decompression using libdeflate */
@@ -238,8 +238,8 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
appropriately even before we simplify it */
do {
int state;
- uInt avail_in_before = (uint64)tif->tif_rawcc <= 0xFFFFFFFFU ? (uInt)tif->tif_rawcc : 0xFFFFFFFFU;
- uInt avail_out_before = (uint64)occ < 0xFFFFFFFFU ? (uInt) occ : 0xFFFFFFFFU;
+ uInt avail_in_before = (uint64_t)tif->tif_rawcc <= 0xFFFFFFFFU ? (uInt)tif->tif_rawcc : 0xFFFFFFFFU;
+ uInt avail_out_before = (uint64_t)occ < 0xFFFFFFFFU ? (uInt) occ : 0xFFFFFFFFU;
sp->stream.avail_in = avail_in_before;
sp->stream.avail_out = avail_out_before;
state = inflate(&sp->stream, Z_PARTIAL_FLUSH);
@@ -261,8 +261,8 @@ ZIPDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
} while (occ > 0);
if (occ != 0) {
TIFFErrorExt(tif->tif_clientdata, module,
- "Not enough data at scanline %lu (short %" TIFF_UINT64_FORMAT " bytes)",
- (unsigned long) tif->tif_row, (TIFF_UINT64_T) occ);
+ "Not enough data at scanline %lu (short %" PRIu64 " bytes)",
+ (unsigned long) tif->tif_row, (uint64_t) occ);
return (0);
}
@@ -301,7 +301,7 @@ ZIPSetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-ZIPPreEncode(TIFF* tif, uint16 s)
+ZIPPreEncode(TIFF* tif, uint16_t s)
{
ZIPState *sp = EncoderState(tif);
@@ -318,7 +318,7 @@ ZIPPreEncode(TIFF* tif, uint16 s)
we need to simplify this code to reflect a ZLib that is likely updated
to deal with 8byte memory sizes, though this code will respond
appropriately even before we simplify it */
- sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
+ sp->stream.avail_out = (uint64_t)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
return (deflateReset(&sp->stream) == Z_OK);
}
@@ -326,7 +326,7 @@ ZIPPreEncode(TIFF* tif, uint16 s)
* Encode a chunk of pixels.
*/
static int
-ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ZIPEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "ZIPEncode";
ZIPState *sp = EncoderState(tif);
@@ -356,20 +356,20 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
/* Check if we are in the situation where we can use libdeflate */
if (isTiled(tif)) {
- if( TIFFTileSize64(tif) != (uint64)cc )
+ if( TIFFTileSize64(tif) != (uint64_t)cc )
break;
} else {
- uint32 strip_height = td->td_imagelength - tif->tif_row;
+ uint32_t strip_height = td->td_imagelength - tif->tif_row;
if (strip_height > td->td_rowsperstrip)
strip_height = td->td_rowsperstrip;
- if( TIFFVStripSize64(tif, strip_height) != (uint64)cc )
+ if( TIFFVStripSize64(tif, strip_height) != (uint64_t)cc )
break;
}
/* Check for overflow */
- if( (size_t)tif->tif_rawdatasize != (uint64)tif->tif_rawdatasize )
+ if( (size_t)tif->tif_rawdatasize != (uint64_t)tif->tif_rawdatasize )
break;
- if( (size_t)cc != (uint64)cc )
+ if( (size_t)cc != (uint64_t)cc )
break;
/* Go for compression using libdeflate */
@@ -430,7 +430,7 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
to deal with 8byte memory sizes, though this code will respond
appropriately even before we simplify it */
do {
- uInt avail_in_before = (uint64)cc <= 0xFFFFFFFFU ? (uInt)cc : 0xFFFFFFFFU;
+ uInt avail_in_before = (uint64_t)cc <= 0xFFFFFFFFU ? (uInt)cc : 0xFFFFFFFFU;
sp->stream.avail_in = avail_in_before;
if (deflate(&sp->stream, Z_NO_FLUSH) != Z_OK) {
TIFFErrorExt(tif->tif_clientdata, module,
@@ -443,7 +443,7 @@ ZIPEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
if (!TIFFFlushData1(tif))
return 0;
sp->stream.next_out = tif->tif_rawdata;
- sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
+ sp->stream.avail_out = (uint64_t)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
}
cc -= (avail_in_before - sp->stream.avail_in);
} while (cc > 0);
@@ -478,7 +478,7 @@ ZIPPostEncode(TIFF* tif)
if (!TIFFFlushData1(tif))
return 0;
sp->stream.next_out = tif->tif_rawdata;
- sp->stream.avail_out = (uint64)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
+ sp->stream.avail_out = (uint64_t)tif->tif_rawdatasize <= 0xFFFFFFFFU ? (uInt)tif->tif_rawdatasize : 0xFFFFFFFFU;
}
break;
default:
@@ -524,7 +524,7 @@ ZIPCleanup(TIFF* tif)
}
static int
-ZIPVSetField(TIFF* tif, uint32 tag, va_list ap)
+ZIPVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "ZIPVSetField";
ZIPState* sp = ZState(tif);
@@ -588,7 +588,7 @@ ZIPVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-ZIPVGetField(TIFF* tif, uint32 tag, va_list ap)
+ZIPVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
ZIPState* sp = ZState(tif);
@@ -636,7 +636,7 @@ TIFFInitZIP(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFcalloc(sizeof (ZIPState), 1);
+ tif->tif_data = (uint8_t*) _TIFFcalloc(sizeof (ZIPState), 1);
if (tif->tif_data == NULL)
goto bad;
sp = ZState(tif);
diff --git a/libtiff/tif_zstd.c b/libtiff/tif_zstd.c
index 66135e03..3411d3a4 100644
--- a/libtiff/tif_zstd.c
+++ b/libtiff/tif_zstd.c
@@ -57,8 +57,8 @@ typedef struct {
#define DecoderState(tif) LState(tif)
#define EncoderState(tif) LState(tif)
-static int ZSTDEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s);
-static int ZSTDDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s);
+static int ZSTDEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s);
+static int ZSTDDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s);
static int
ZSTDFixupTags(TIFF* tif)
@@ -89,7 +89,7 @@ ZSTDSetupDecode(TIFF* tif)
* Setup state for decoding a strip.
*/
static int
-ZSTDPreDecode(TIFF* tif, uint16 s)
+ZSTDPreDecode(TIFF* tif, uint16_t s)
{
static const char module[] = "ZSTDPreDecode";
ZSTDState* sp = DecoderState(tif);
@@ -125,7 +125,7 @@ ZSTDPreDecode(TIFF* tif, uint16 s)
}
static int
-ZSTDDecode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ZSTDDecode(TIFF* tif, uint8_t* op, tmsize_t occ, uint16_t s)
{
static const char module[] = "ZSTDDecode";
ZSTDState* sp = DecoderState(tif);
@@ -192,7 +192,7 @@ ZSTDSetupEncode(TIFF* tif)
* Reset encoding state at the start of a strip.
*/
static int
-ZSTDPreEncode(TIFF* tif, uint16 s)
+ZSTDPreEncode(TIFF* tif, uint16_t s)
{
static const char module[] = "ZSTDPreEncode";
ZSTDState *sp = EncoderState(tif);
@@ -233,7 +233,7 @@ ZSTDPreEncode(TIFF* tif, uint16 s)
* Encode a chunk of pixels.
*/
static int
-ZSTDEncode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ZSTDEncode(TIFF* tif, uint8_t* bp, tmsize_t cc, uint16_t s)
{
static const char module[] = "ZSTDEncode";
ZSTDState *sp = EncoderState(tif);
@@ -326,7 +326,7 @@ ZSTDCleanup(TIFF* tif)
}
static int
-ZSTDVSetField(TIFF* tif, uint32 tag, va_list ap)
+ZSTDVSetField(TIFF* tif, uint32_t tag, va_list ap)
{
static const char module[] = "ZSTDVSetField";
ZSTDState* sp = LState(tif);
@@ -349,7 +349,7 @@ ZSTDVSetField(TIFF* tif, uint32 tag, va_list ap)
}
static int
-ZSTDVGetField(TIFF* tif, uint32 tag, va_list ap)
+ZSTDVGetField(TIFF* tif, uint32_t tag, va_list ap)
{
ZSTDState* sp = LState(tif);
@@ -389,7 +389,7 @@ TIFFInitZSTD(TIFF* tif, int scheme)
/*
* Allocate state block so tag methods have storage to record values.
*/
- tif->tif_data = (uint8*) _TIFFmalloc(sizeof(ZSTDState));
+ tif->tif_data = (uint8_t*) _TIFFmalloc(sizeof(ZSTDState));
if (tif->tif_data == NULL)
goto bad;
sp = LState(tif);
diff --git a/libtiff/tiff.h b/libtiff/tiff.h
index 2d4a4767..3672bd09 100644
--- a/libtiff/tiff.h
+++ b/libtiff/tiff.h
@@ -56,24 +56,26 @@
/*
* Intrinsic data types required by the file format:
*
- * 8-bit quantities int8/uint8
- * 16-bit quantities int16/uint16
- * 32-bit quantities int32/uint32
- * 64-bit quantities int64/uint64
+ * 8-bit quantities int8_t/uint_8_t
+ * 16-bit quantities int16_t/uint_16_t
+ * 32-bit quantities int32_t/uint_32_t
+ * 64-bit quantities int64_t/uint_64_t
* strings unsigned char*
*/
-typedef TIFF_INT8_T int8;
-typedef TIFF_UINT8_T uint8;
-typedef TIFF_INT16_T int16;
-typedef TIFF_UINT16_T uint16;
+typedef int8_t int8;
+typedef uint8_t uint8;
-typedef TIFF_INT32_T int32;
-typedef TIFF_UINT32_T uint32;
+typedef int16_t int16;
+typedef uint16_t uint16;
+
+typedef int32_t int32;
+typedef uint32_t uint32;
+
+typedef int64_t int64;
+typedef uint64_t uint64;
-typedef TIFF_INT64_T int64;
-typedef TIFF_UINT64_T uint64;
/*
* Some types as promoted in a variable argument list
@@ -89,20 +91,20 @@ typedef int uint16_vap;
* TIFF header.
*/
typedef struct {
- uint16 tiff_magic; /* magic number (defines byte order) */
- uint16 tiff_version; /* TIFF version number */
+ uint16_t tiff_magic; /* magic number (defines byte order) */
+ uint16_t tiff_version; /* TIFF version number */
} TIFFHeaderCommon;
typedef struct {
- uint16 tiff_magic; /* magic number (defines byte order) */
- uint16 tiff_version; /* TIFF version number */
- uint32 tiff_diroff; /* byte offset to first directory */
+ uint16_t tiff_magic; /* magic number (defines byte order) */
+ uint16_t tiff_version; /* TIFF version number */
+ uint32_t tiff_diroff; /* byte offset to first directory */
} TIFFHeaderClassic;
typedef struct {
- uint16 tiff_magic; /* magic number (defines byte order) */
- uint16 tiff_version; /* TIFF version number */
- uint16 tiff_offsetsize; /* size of offsets, should be 8 */
- uint16 tiff_unused; /* unused word, should be 0 */
- uint64 tiff_diroff; /* byte offset to first directory */
+ uint16_t tiff_magic; /* magic number (defines byte order) */
+ uint16_t tiff_version; /* TIFF version number */
+ uint16_t tiff_offsetsize; /* size of offsets, should be 8 */
+ uint16_t tiff_unused; /* unused word, should be 0 */
+ uint64_t tiff_diroff; /* byte offset to first directory */
} TIFFHeaderBig;
diff --git a/libtiff/tiffconf.h.cmake.in b/libtiff/tiffconf.h.cmake.in
index 17d795c7..2d7c0147 100644
--- a/libtiff/tiffconf.h.cmake.in
+++ b/libtiff/tiffconf.h.cmake.in
@@ -7,19 +7,11 @@
#ifndef _TIFFCONF_
#define _TIFFCONF_
-/* Define to 1 if you have the <inttypes.h> header file. */
-#cmakedefine TIFF_HAVE_INTTYPES_H 1
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine TIFF_HAVE_STDINT_H 1
#include <stddef.h>
-#ifdef TIFF_HAVE_STDINT_H
#include <stdint.h>
-#endif
-#ifdef TIFF_HAVE_INTTYPES_H
#include <inttypes.h>
-#endif
+
/* Signed 16-bit type */
#define TIFF_INT16_T @TIFF_INT16_T@
@@ -45,15 +37,9 @@
/* Unsigned 8-bit type */
#define TIFF_UINT8_T @TIFF_UINT8_T@
-/* Unsigned size type */
-#define TIFF_SIZE_T @TIFF_SIZE_T@
-
/* Signed size type */
#define TIFF_SSIZE_T @TIFF_SSIZE_T@
-/* Pointer difference type */
-#define TIFF_PTRDIFF_T @TIFF_PTRDIFF_T@
-
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format supported by the
diff --git a/libtiff/tiffconf.h.in b/libtiff/tiffconf.h.in
index 3d8b7a79..4dc0f46d 100644
--- a/libtiff/tiffconf.h.in
+++ b/libtiff/tiffconf.h.in
@@ -7,19 +7,11 @@
#ifndef _TIFFCONF_
#define _TIFFCONF_
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef TIFF_HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef TIFF_HAVE_STDINT_H
#include <stddef.h>
-#ifdef TIFF_HAVE_STDINT_H
#include <stdint.h>
-#endif
-#ifdef TIFF_HAVE_INTTYPES_H
#include <inttypes.h>
-#endif
+
/* Signed 16-bit type */
#undef TIFF_INT16_T
@@ -48,9 +40,6 @@
/* Signed size type */
#undef TIFF_SSIZE_T
-/* Pointer difference type */
-#undef TIFF_PTRDIFF_T
-
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format supported by the
diff --git a/libtiff/tiffconf.vc.h b/libtiff/tiffconf.vc.h
index 2078cdbd..4bb8c42d 100644
--- a/libtiff/tiffconf.vc.h
+++ b/libtiff/tiffconf.vc.h
@@ -7,44 +7,34 @@
#ifndef _TIFFCONF_
#define _TIFFCONF_
-/* The size of a `int', as computed by sizeof. */
-#define SIZEOF_INT 4
+#include <stddef.h>
+#include <stdint.h>
+#include <inttypes.h>
/* Signed 8-bit type */
-#define TIFF_INT8_T signed char
+#define TIFF_INT8_T int8_t
/* Unsigned 8-bit type */
-#define TIFF_UINT8_T unsigned char
+#define TIFF_UINT8_T uint8_t
/* Signed 16-bit type */
-#define TIFF_INT16_T signed short
+#define TIFF_INT16_T int16_t
/* Unsigned 16-bit type */
-#define TIFF_UINT16_T unsigned short
-
-/* Signed 32-bit type formatter */
-#define TIFF_INT32_FORMAT "%d"
+#define TIFF_UINT16_T uint16_t
/* Signed 32-bit type */
-#define TIFF_INT32_T signed int
-
-/* Unsigned 32-bit type formatter */
-#define TIFF_UINT32_FORMAT "%u"
+#define TIFF_INT32_T int32_t
/* Unsigned 32-bit type */
-#define TIFF_UINT32_T unsigned int
-
-/* Signed 64-bit type formatter */
-#define TIFF_INT64_FORMAT "%I64d"
+#define TIFF_UINT32_T uint32_t
/* Signed 64-bit type */
-#define TIFF_INT64_T signed __int64
-
-/* Unsigned 64-bit type formatter */
-#define TIFF_UINT64_FORMAT "%I64u"
+#define TIFF_INT64_T int64_t
/* Unsigned 64-bit type */
-#define TIFF_UINT64_T unsigned __int64
+#define TIFF_UINT64_T uint64_t
+
#if _WIN64
/*
@@ -52,7 +42,7 @@
*/
/* Signed size type */
-# define TIFF_SSIZE_T TIFF_INT64_T
+# define TIFF_SSIZE_T int64_t
#else
/*
@@ -60,7 +50,7 @@
*/
/* Signed size type */
-# define TIFF_SSIZE_T signed int
+# define TIFF_SSIZE_T int32_t
#endif
diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h
index 6274f098..c6a192c5 100644
--- a/libtiff/tiffio.h
+++ b/libtiff/tiffio.h
@@ -60,16 +60,18 @@ typedef struct tiff TIFF;
*/
/*
* this is the machine addressing size type, only it's signed, so make it
- * int32 on 32bit machines, int64 on 64bit machines
+ * int32_t on 32bit machines, int64_t on 64bit machines
*/
typedef TIFF_SSIZE_T tmsize_t;
-typedef uint64 toff_t; /* file offset */
+#define TIFF_TMSIZE_T_MAX (tmsize_t)(SIZE_MAX >> 1)
+
+typedef uint64_t toff_t; /* file offset */
/* the following are deprecated and should be replaced by their defining
counterparts */
-typedef uint32 ttag_t; /* directory tag */
-typedef uint16 tdir_t; /* directory index */
-typedef uint16 tsample_t; /* sample number */
-typedef uint32 tstrile_t; /* strip or tile number */
+typedef uint32_t ttag_t; /* directory tag */
+typedef uint16_t tdir_t; /* directory index */
+typedef uint16_t tsample_t; /* sample number */
+typedef uint32_t tstrile_t; /* strip or tile number */
typedef tstrile_t tstrip_t; /* strip number */
typedef tstrile_t ttile_t; /* tile number */
typedef tmsize_t tsize_t; /* i/o size in bytes */
@@ -140,9 +142,9 @@ typedef struct {
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
- uint32 d_Vrwr; /* Pixel values for ref. white */
- uint32 d_Vrwg;
- uint32 d_Vrwb;
+ uint32_t d_Vrwr; /* Pixel values for ref. white */
+ uint32_t d_Vrwg;
+ uint32_t d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
@@ -155,9 +157,9 @@ typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
- int32* Cr_g_tab;
- int32* Cb_g_tab;
- int32* Y_tab;
+ int32_t* Cr_g_tab;
+ int32_t* Cb_g_tab;
+ int32_t* Y_tab;
} TIFFYCbCrToRGB;
typedef struct { /* CIE Lab 1976->RGB support */
@@ -186,11 +188,11 @@ typedef struct _TIFFRGBAImage TIFFRGBAImage;
* and draw the unpacked raster on the display.
*/
typedef void (*tileContigRoutine)
- (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
- unsigned char*);
+ (TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
+ unsigned char*);
typedef void (*tileSeparateRoutine)
- (TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
- unsigned char*, unsigned char*, unsigned char*, unsigned char*);
+ (TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t, uint32_t, uint32_t, int32_t, int32_t,
+ unsigned char*, unsigned char*, unsigned char*, unsigned char*);
/*
* RGBA-reader state.
*/
@@ -199,18 +201,18 @@ struct _TIFFRGBAImage {
int stoponerr; /* stop on read error */
int isContig; /* data is packed/separate */
int alpha; /* type of alpha data present */
- uint32 width; /* image width */
- uint32 height; /* image height */
- uint16 bitspersample; /* image bits/sample */
- uint16 samplesperpixel; /* image samples/pixel */
- uint16 orientation; /* image orientation */
- uint16 req_orientation; /* requested orientation */
- uint16 photometric; /* image photometric interp */
- uint16* redcmap; /* colormap palette */
- uint16* greencmap;
- uint16* bluecmap;
+ uint32_t width; /* image width */
+ uint32_t height; /* image height */
+ uint16_t bitspersample; /* image bits/sample */
+ uint16_t samplesperpixel; /* image samples/pixel */
+ uint16_t orientation; /* image orientation */
+ uint16_t req_orientation; /* requested orientation */
+ uint16_t photometric; /* image photometric interp */
+ uint16_t* redcmap; /* colormap palette */
+ uint16_t* greencmap;
+ uint16_t* bluecmap;
/* get image data routine */
- int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
+ int (*get)(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
/* put decoded strip/tile */
union {
void (*any)(TIFFRGBAImage*);
@@ -218,13 +220,13 @@ struct _TIFFRGBAImage {
tileSeparateRoutine separate;
} put;
TIFFRGBValue* Map; /* sample mapping array */
- uint32** BWmap; /* black&white map */
- uint32** PALmap; /* palette image map */
+ uint32_t** BWmap; /* black&white map */
+ uint32_t** PALmap; /* palette image map */
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
- uint8* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
- uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
+ uint8_t* UaToAa; /* Unassociated alpha to associated alpha conversion LUT */
+ uint8_t* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
int row_offset;
int col_offset;
@@ -249,7 +251,7 @@ struct _TIFFRGBAImage {
typedef int (*TIFFInitMethod)(TIFF*, int);
typedef struct {
char* name;
- uint16 scheme;
+ uint16_t scheme;
TIFFInitMethod init;
} TIFFCodec;
@@ -282,10 +284,10 @@ typedef void (*TIFFExtendProc)(TIFF*);
extern const char* TIFFGetVersion(void);
-extern const TIFFCodec* TIFFFindCODEC(uint16);
-extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
+extern const TIFFCodec* TIFFFindCODEC(uint16_t);
+extern TIFFCodec* TIFFRegisterCODEC(uint16_t, const char*, TIFFInitMethod);
extern void TIFFUnRegisterCODEC(TIFFCodec*);
-extern int TIFFIsCODECConfigured(uint16);
+extern int TIFFIsCODECConfigured(uint16_t);
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
/*
@@ -304,31 +306,31 @@ extern void _TIFFfree(void* p);
** Stuff, related to tag handling and creating custom tags.
*/
extern int TIFFGetTagListCount( TIFF * );
-extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index );
+extern uint32_t TIFFGetTagListEntry(TIFF *, int tag_index );
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
#define TIFF_VARIABLE -1 /* marker for variable length tags */
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
-#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
+#define TIFF_VARIABLE2 -3 /* marker for uint32_t var-length tags */
#define FIELD_CUSTOM 65
typedef struct _TIFFField TIFFField;
typedef struct _TIFFFieldArray TIFFFieldArray;
-extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType);
-extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32);
+extern const TIFFField* TIFFFindField(TIFF *, uint32_t, TIFFDataType);
+extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32_t);
extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
-extern uint32 TIFFFieldTag(const TIFFField*);
+extern uint32_t TIFFFieldTag(const TIFFField*);
extern const char* TIFFFieldName(const TIFFField*);
extern TIFFDataType TIFFFieldDataType(const TIFFField*);
extern int TIFFFieldPassCount(const TIFFField*);
extern int TIFFFieldReadCount(const TIFFField*);
extern int TIFFFieldWriteCount(const TIFFField*);
-typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list);
-typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list);
+typedef int (*TIFFVSetMethod)(TIFF*, uint32_t, va_list);
+typedef int (*TIFFVGetMethod)(TIFF*, uint32_t, va_list);
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
typedef struct {
@@ -345,32 +347,32 @@ extern void TIFFCleanup(TIFF* tif);
extern void TIFFClose(TIFF* tif);
extern int TIFFFlush(TIFF* tif);
extern int TIFFFlushData(TIFF* tif);
-extern int TIFFGetField(TIFF* tif, uint32 tag, ...);
-extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap);
-extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...);
-extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
+extern int TIFFGetField(TIFF* tif, uint32_t tag, ...);
+extern int TIFFVGetField(TIFF* tif, uint32_t tag, va_list ap);
+extern int TIFFGetFieldDefaulted(TIFF* tif, uint32_t tag, ...);
+extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32_t tag, va_list ap);
extern int TIFFReadDirectory(TIFF* tif);
extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
extern int TIFFReadGPSDirectory(TIFF* tif, toff_t diroff);
-extern uint64 TIFFScanlineSize64(TIFF* tif);
+extern uint64_t TIFFScanlineSize64(TIFF* tif);
extern tmsize_t TIFFScanlineSize(TIFF* tif);
-extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
+extern uint64_t TIFFRasterScanlineSize64(TIFF* tif);
extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
-extern uint64 TIFFStripSize64(TIFF* tif);
+extern uint64_t TIFFStripSize64(TIFF* tif);
extern tmsize_t TIFFStripSize(TIFF* tif);
-extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip);
-extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip);
-extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows);
-extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows);
-extern uint64 TIFFTileRowSize64(TIFF* tif);
+extern uint64_t TIFFRawStripSize64(TIFF* tif, uint32_t strip);
+extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32_t strip);
+extern uint64_t TIFFVStripSize64(TIFF* tif, uint32_t nrows);
+extern tmsize_t TIFFVStripSize(TIFF* tif, uint32_t nrows);
+extern uint64_t TIFFTileRowSize64(TIFF* tif);
extern tmsize_t TIFFTileRowSize(TIFF* tif);
-extern uint64 TIFFTileSize64(TIFF* tif);
+extern uint64_t TIFFTileSize64(TIFF* tif);
extern tmsize_t TIFFTileSize(TIFF* tif);
-extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows);
-extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows);
-extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request);
-extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+extern uint64_t TIFFVTileSize64(TIFF* tif, uint32_t nrows);
+extern tmsize_t TIFFVTileSize(TIFF* tif, uint32_t nrows);
+extern uint32_t TIFFDefaultStripSize(TIFF* tif, uint32_t request);
+extern void TIFFDefaultTileSize(TIFF*, uint32_t*, uint32_t*);
extern int TIFFFileno(TIFF*);
extern int TIFFSetFileno(TIFF*, int);
extern thandle_t TIFFClientdata(TIFF*);
@@ -389,12 +391,12 @@ extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
-extern uint32 TIFFCurrentRow(TIFF*);
-extern uint16 TIFFCurrentDirectory(TIFF*);
-extern uint16 TIFFNumberOfDirectories(TIFF*);
-extern uint64 TIFFCurrentDirOffset(TIFF*);
-extern uint32 TIFFCurrentStrip(TIFF*);
-extern uint32 TIFFCurrentTile(TIFF* tif);
+extern uint32_t TIFFCurrentRow(TIFF*);
+extern uint16_t TIFFCurrentDirectory(TIFF*);
+extern uint16_t TIFFNumberOfDirectories(TIFF*);
+extern uint64_t TIFFCurrentDirOffset(TIFF*);
+extern uint32_t TIFFCurrentStrip(TIFF*);
+extern uint32_t TIFFCurrentTile(TIFF* tif);
extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
extern int TIFFSetupStrips(TIFF *);
@@ -405,14 +407,14 @@ extern int TIFFCreateCustomDirectory(TIFF*,const TIFFFieldArray*);
extern int TIFFCreateEXIFDirectory(TIFF*);
extern int TIFFCreateGPSDirectory(TIFF*);
extern int TIFFLastDirectory(TIFF*);
-extern int TIFFSetDirectory(TIFF*, uint16);
-extern int TIFFSetSubDirectory(TIFF*, uint64);
-extern int TIFFUnlinkDirectory(TIFF*, uint16);
-extern int TIFFSetField(TIFF*, uint32, ...);
-extern int TIFFVSetField(TIFF*, uint32, va_list);
-extern int TIFFUnsetField(TIFF*, uint32);
+extern int TIFFSetDirectory(TIFF*, uint16_t);
+extern int TIFFSetSubDirectory(TIFF*, uint64_t);
+extern int TIFFUnlinkDirectory(TIFF*, uint16_t);
+extern int TIFFSetField(TIFF*, uint32_t, ...);
+extern int TIFFVSetField(TIFF*, uint32_t, va_list);
+extern int TIFFUnsetField(TIFF*, uint32_t);
extern int TIFFWriteDirectory(TIFF *);
-extern int TIFFWriteCustomDirectory(TIFF *, uint64 *);
+extern int TIFFWriteCustomDirectory(TIFF *, uint64_t *);
extern int TIFFCheckpointDirectory(TIFF *);
extern int TIFFRewriteDirectory(TIFF *);
extern int TIFFDeferStrileArrayWriting(TIFF *);
@@ -420,26 +422,26 @@ extern int TIFFForceStrileArrayWriting(TIFF* );
#if defined(c_plusplus) || defined(__cplusplus)
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
-extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
-extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
-extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
-extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
+extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
+extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample = 0);
+extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int = 0);
+extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*,
int = ORIENTATION_BOTLEFT, int = 0);
#else
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
-extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
-extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
-extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
-extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
+extern int TIFFReadScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
+extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32_t row, uint16_t sample);
+extern int TIFFReadRGBAImage(TIFF*, uint32_t, uint32_t, uint32_t*, int);
+extern int TIFFReadRGBAImageOriented(TIFF*, uint32_t, uint32_t, uint32_t*, int, int);
#endif
-extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * );
-extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
-extern int TIFFReadRGBAStripExt(TIFF*, uint32, uint32 *, int stop_on_error );
-extern int TIFFReadRGBATileExt(TIFF*, uint32, uint32, uint32 *, int stop_on_error );
+extern int TIFFReadRGBAStrip(TIFF*, uint32_t, uint32_t * );
+extern int TIFFReadRGBATile(TIFF*, uint32_t, uint32_t, uint32_t * );
+extern int TIFFReadRGBAStripExt(TIFF*, uint32_t, uint32_t *, int stop_on_error );
+extern int TIFFReadRGBATileExt(TIFF*, uint32_t, uint32_t, uint32_t *, int stop_on_error );
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
-extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
+extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32_t*, uint32_t, uint32_t);
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
extern TIFF* TIFFOpen(const char*, const char*);
# ifdef __WIN32__
@@ -463,44 +465,44 @@ extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
-extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
-extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
-extern uint32 TIFFNumberOfTiles(TIFF*);
-extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
-extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
-extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16);
-extern uint32 TIFFNumberOfStrips(TIFF*);
-extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
-extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
-extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
-extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
-extern int TIFFReadFromUserBuffer(TIFF* tif, uint32 strile,
+extern uint32_t TIFFComputeTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
+extern int TIFFCheckTile(TIFF* tif, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
+extern uint32_t TIFFNumberOfTiles(TIFF*);
+extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
+extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32_t x, uint32_t y, uint32_t z, uint16_t s);
+extern uint32_t TIFFComputeStrip(TIFF*, uint32_t, uint16_t);
+extern uint32_t TIFFNumberOfStrips(TIFF*);
+extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
+extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32_t strip, void* buf, tmsize_t size);
+extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
+extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32_t tile, void* buf, tmsize_t size);
+extern int TIFFReadFromUserBuffer(TIFF* tif, uint32_t strile,
void* inbuf, tmsize_t insize,
void* outbuf, tmsize_t outsize);
-extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
-extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
-extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
-extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
+extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
+extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32_t strip, void* data, tmsize_t cc);
+extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
+extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32_t tile, void* data, tmsize_t cc);
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
-extern void TIFFSwabShort(uint16*);
-extern void TIFFSwabLong(uint32*);
-extern void TIFFSwabLong8(uint64*);
+extern void TIFFSwabShort(uint16_t*);
+extern void TIFFSwabLong(uint32_t*);
+extern void TIFFSwabLong8(uint64_t*);
extern void TIFFSwabFloat(float*);
extern void TIFFSwabDouble(double*);
-extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n);
-extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n);
-extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n);
-extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n);
+extern void TIFFSwabArrayOfShort(uint16_t* wp, tmsize_t n);
+extern void TIFFSwabArrayOfTriples(uint8_t* tp, tmsize_t n);
+extern void TIFFSwabArrayOfLong(uint32_t* lp, tmsize_t n);
+extern void TIFFSwabArrayOfLong8(uint64_t* lp, tmsize_t n);
extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
-extern void TIFFReverseBits(uint8* cp, tmsize_t n);
+extern void TIFFReverseBits(uint8_t* cp, tmsize_t n);
extern const unsigned char* TIFFGetBitRevTable(int);
-extern uint64 TIFFGetStrileOffset(TIFF *tif, uint32 strile);
-extern uint64 TIFFGetStrileByteCount(TIFF *tif, uint32 strile);
-extern uint64 TIFFGetStrileOffsetWithErr(TIFF *tif, uint32 strile, int *pbErr);
-extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr);
+extern uint64_t TIFFGetStrileOffset(TIFF *tif, uint32_t strile);
+extern uint64_t TIFFGetStrileByteCount(TIFF *tif, uint32_t strile);
+extern uint64_t TIFFGetStrileOffsetWithErr(TIFF *tif, uint32_t strile, int *pbErr);
+extern uint64_t TIFFGetStrileByteCountWithErr(TIFF *tif, uint32_t strile, int *pbErr);
#ifdef LOGLUV_PUBLIC
#define U_NEU 0.210526316
@@ -508,34 +510,34 @@ extern uint64 TIFFGetStrileByteCountWithErr(TIFF *tif, uint32 strile, int *pbErr
#define UVSCALE 410.
extern double LogL16toY(int);
extern double LogL10toY(int);
-extern void XYZtoRGB24(float*, uint8*);
+extern void XYZtoRGB24(float*, uint8_t*);
extern int uv_decode(double*, double*, int);
-extern void LogLuv24toXYZ(uint32, float*);
-extern void LogLuv32toXYZ(uint32, float*);
+extern void LogLuv24toXYZ(uint32_t, float*);
+extern void LogLuv32toXYZ(uint32_t, float*);
#if defined(c_plusplus) || defined(__cplusplus)
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
-extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
-extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+extern uint32_t LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
+extern uint32_t LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
#else
extern int LogL16fromY(double, int);
extern int LogL10fromY(double, int);
extern int uv_encode(double, double, int);
-extern uint32 LogLuv24fromXYZ(float*, int);
-extern uint32 LogLuv32fromXYZ(float*, int);
+extern uint32_t LogLuv24fromXYZ(float*, int);
+extern uint32_t LogLuv32fromXYZ(float*, int);
#endif
#endif /* LOGLUV_PUBLIC */
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
-extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
- float *, float *, float *);
+extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32_t, int32_t, int32_t,
+ float *, float *, float *);
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
- uint32 *, uint32 *, uint32 *);
+ uint32_t *, uint32_t *, uint32_t *);
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
-extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
- uint32 *, uint32 *, uint32 *);
+extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32_t, int32_t, int32_t,
+ uint32_t *, uint32_t *, uint32_t *);
/****************************************************************************
* O B S O L E T E D I N T E R F A C E S
@@ -554,7 +556,7 @@ typedef struct {
char *field_name; /* ASCII name */
} TIFFFieldInfo;
-extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32);
+extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32_t);
#if defined(c_plusplus) || defined(__cplusplus)
}
diff --git a/libtiff/tiffiop.h b/libtiff/tiffiop.h
index 15efd0d5..167bd14c 100644
--- a/libtiff/tiffiop.h
+++ b/libtiff/tiffiop.h
@@ -68,19 +68,6 @@ extern int snprintf(char* str, size_t size, const char* format, ...);
#define FALSE 0
#endif
-#define TIFF_SIZE_T_MAX ((size_t) ~ ((size_t)0))
-#define TIFF_TMSIZE_T_MAX (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
-
-/*
- * Largest 32-bit unsigned integer value.
- */
-#define TIFF_UINT32_MAX 0xFFFFFFFFU
-
-/*
- * Largest 64-bit unsigned integer value.
- */
-#define TIFF_UINT64_MAX (((uint64)(TIFF_UINT32_MAX)) << 32 | TIFF_UINT32_MAX)
-
typedef struct client_info {
struct client_info *next;
void *data;
@@ -96,18 +83,18 @@ typedef tidataval_t* tidata_t; /* reference to internal image data */
typedef void (*TIFFVoidMethod)(TIFF*);
typedef int (*TIFFBoolMethod)(TIFF*);
-typedef int (*TIFFPreMethod)(TIFF*, uint16);
-typedef int (*TIFFCodeMethod)(TIFF* tif, uint8* buf, tmsize_t size, uint16 sample);
-typedef int (*TIFFSeekMethod)(TIFF*, uint32);
-typedef void (*TIFFPostMethod)(TIFF* tif, uint8* buf, tmsize_t size);
-typedef uint32 (*TIFFStripMethod)(TIFF*, uint32);
-typedef void (*TIFFTileMethod)(TIFF*, uint32*, uint32*);
+typedef int (*TIFFPreMethod)(TIFF*, uint16_t);
+typedef int (*TIFFCodeMethod)(TIFF* tif, uint8_t* buf, tmsize_t size, uint16_t sample);
+typedef int (*TIFFSeekMethod)(TIFF*, uint32_t);
+typedef void (*TIFFPostMethod)(TIFF* tif, uint8_t* buf, tmsize_t size);
+typedef uint32_t (*TIFFStripMethod)(TIFF*, uint32_t);
+typedef void (*TIFFTileMethod)(TIFF*, uint32_t*, uint32_t*);
struct tiff {
char* tif_name; /* name of open file */
int tif_fd; /* open file descriptor */
int tif_mode; /* open mode (O_*) */
- uint32 tif_flags;
+ uint32_t tif_flags;
#define TIFF_FILLORDER 0x00003U /* natural bit fill order for machine */
#define TIFF_DIRTYHEADER 0x00004U /* header must be written on close */
#define TIFF_DIRTYDIRECT 0x00008U /* current directory must be written */
@@ -134,11 +121,11 @@ struct tiff {
#define TIFF_DEFERSTRILELOAD 0x1000000U /* defer strip/tile offset/bytecount array loading. */
#define TIFF_LAZYSTRILELOAD 0x2000000U /* lazy/ondemand loading of strip/tile offset/bytecount values. Only used if TIFF_DEFERSTRILELOAD is set and in read-only mode */
#define TIFF_CHOPPEDUPARRAYS 0x4000000U /* set when allocChoppedUpStripArrays() has modified strip array */
- uint64 tif_diroff; /* file offset of current directory */
- uint64 tif_nextdiroff; /* file offset of following directory */
- uint64* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
- uint16 tif_dirlistsize; /* number of entries in offset list */
- uint16 tif_dirnumber; /* number of already seen directories */
+ uint64_t tif_diroff; /* file offset of current directory */
+ uint64_t tif_nextdiroff; /* file offset of following directory */
+ uint64_t* tif_dirlist; /* list of offsets to already seen directories to prevent IFD looping */
+ uint16_t tif_dirlistsize; /* number of entries in offset list */
+ uint16_t tif_dirnumber; /* number of already seen directories */
TIFFDirectory tif_dir; /* internal rep of current directory */
TIFFDirectory tif_customdir; /* custom IFDs are separated from the main ones */
union {
@@ -146,18 +133,18 @@ struct tiff {
TIFFHeaderClassic classic;
TIFFHeaderBig big;
} tif_header;
- uint16 tif_header_size; /* file's header block and its length */
- uint32 tif_row; /* current scanline */
- uint16 tif_curdir; /* current directory (index) */
- uint32 tif_curstrip; /* current strip for read/write */
- uint64 tif_curoff; /* current offset for read/write */
- uint64 tif_dataoff; /* current offset for writing dir */
+ uint16_t tif_header_size; /* file's header block and its length */
+ uint32_t tif_row; /* current scanline */
+ uint16_t tif_curdir; /* current directory (index) */
+ uint32_t tif_curstrip; /* current strip for read/write */
+ uint64_t tif_curoff; /* current offset for read/write */
+ uint64_t tif_dataoff; /* current offset for writing dir */
/* SubIFD support */
- uint16 tif_nsubifd; /* remaining subifds to write */
- uint64 tif_subifdoff; /* offset for patching SubIFD link */
+ uint16_t tif_nsubifd; /* remaining subifds to write */
+ uint64_t tif_subifdoff; /* offset for patching SubIFD link */
/* tiling support */
- uint32 tif_col; /* current column (offset by row too) */
- uint32 tif_curtile; /* current tile for read/write */
+ uint32_t tif_col; /* current column (offset by row too) */
+ uint32_t tif_curtile; /* current tile for read/write */
tmsize_t tif_tilesize; /* # of bytes in a tile */
/* compression scheme hooks */
int tif_decodestatus;
@@ -179,18 +166,18 @@ struct tiff {
TIFFVoidMethod tif_cleanup; /* cleanup state routine */
TIFFStripMethod tif_defstripsize; /* calculate/constrain strip size */
TIFFTileMethod tif_deftilesize; /* calculate/constrain tile size */
- uint8* tif_data; /* compression scheme private data */
+ uint8_t* tif_data; /* compression scheme private data */
/* input/output buffering */
tmsize_t tif_scanlinesize; /* # of bytes in a scanline */
tmsize_t tif_scanlineskew; /* scanline skew for reading strips */
- uint8* tif_rawdata; /* raw data buffer */
+ uint8_t* tif_rawdata; /* raw data buffer */
tmsize_t tif_rawdatasize; /* # of bytes in raw data buffer */
tmsize_t tif_rawdataoff; /* rawdata offset within strip */
tmsize_t tif_rawdataloaded;/* amount of data in rawdata */
- uint8* tif_rawcp; /* current spot in raw buffer */
+ uint8_t* tif_rawcp; /* current spot in raw buffer */
tmsize_t tif_rawcc; /* bytes unread from raw buffer */
/* memory-mapped file support */
- uint8* tif_base; /* base of mapped file */
+ uint8_t* tif_base; /* base of mapped file */
tmsize_t tif_size; /* size of mapped file region (bytes, thus tmsize_t) */
TIFFMapFileProc tif_mapproc; /* map file method */
TIFFUnmapFileProc tif_unmapproc; /* unmap file method */
@@ -251,18 +238,18 @@ struct tiff {
(TIFFWriteFile((tif),(buf),(size))==(size))
#endif
-/* NB: the uint32 casts are to silence certain ANSI-C compilers */
-#define TIFFhowmany_32(x, y) (((uint32)x < (0xffffffff - (uint32)(y-1))) ? \
- ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y))) : \
+/* NB: the uint32_t casts are to silence certain ANSI-C compilers */
+#define TIFFhowmany_32(x, y) (((uint32_t)x < (0xffffffff - (uint32_t)(y-1))) ? \
+ ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y))) : \
0U)
/* Variant of TIFFhowmany_32() that doesn't return 0 if x close to MAXUINT. */
/* Caution: TIFFhowmany_32_maxuint_compat(x,y)*y might overflow */
#define TIFFhowmany_32_maxuint_compat(x, y) \
- (((uint32)(x) / (uint32)(y)) + ((((uint32)(x) % (uint32)(y)) != 0) ? 1 : 0))
-#define TIFFhowmany8_32(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+ (((uint32_t)(x) / (uint32_t)(y)) + ((((uint32_t)(x) % (uint32_t)(y)) != 0) ? 1 : 0))
+#define TIFFhowmany8_32(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
#define TIFFroundup_32(x, y) (TIFFhowmany_32(x,y)*(y))
-#define TIFFhowmany_64(x, y) ((((uint64)(x))+(((uint64)(y))-1))/((uint64)(y)))
-#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64)(x)>>3)+1:(uint64)(x)>>3)
+#define TIFFhowmany_64(x, y) ((((uint64_t)(x))+(((uint64_t)(y))-1))/((uint64_t)(y)))
+#define TIFFhowmany8_64(x) (((x)&0x07)?((uint64_t)(x)>>3)+1:(uint64_t)(x)>>3)
#define TIFFroundup_64(x, y) (TIFFhowmany_64(x,y)*(y))
/* Safe multiply which returns zero if there is an *unsigned* integer overflow. This macro is not safe for *signed* integer types */
@@ -335,38 +322,38 @@ typedef size_t TIFFIOSize_t;
extern "C" {
#endif
extern int _TIFFgetMode(const char* mode, const char* module);
-extern int _TIFFNoRowEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s);
-extern int _TIFFNoStripEncode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s);
-extern int _TIFFNoTileEncode(TIFF*, uint8* pp, tmsize_t cc, uint16 s);
-extern int _TIFFNoRowDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s);
-extern int _TIFFNoStripDecode(TIFF* tif, uint8* pp, tmsize_t cc, uint16 s);
-extern int _TIFFNoTileDecode(TIFF*, uint8* pp, tmsize_t cc, uint16 s);
-extern void _TIFFNoPostDecode(TIFF* tif, uint8* buf, tmsize_t cc);
-extern int _TIFFNoPreCode(TIFF* tif, uint16 s);
-extern int _TIFFNoSeek(TIFF* tif, uint32 off);
-extern void _TIFFSwab16BitData(TIFF* tif, uint8* buf, tmsize_t cc);
-extern void _TIFFSwab24BitData(TIFF* tif, uint8* buf, tmsize_t cc);
-extern void _TIFFSwab32BitData(TIFF* tif, uint8* buf, tmsize_t cc);
-extern void _TIFFSwab64BitData(TIFF* tif, uint8* buf, tmsize_t cc);
+extern int _TIFFNoRowEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern int _TIFFNoStripEncode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern int _TIFFNoTileEncode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern int _TIFFNoRowDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern int _TIFFNoStripDecode(TIFF* tif, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern int _TIFFNoTileDecode(TIFF*, uint8_t* pp, tmsize_t cc, uint16_t s);
+extern void _TIFFNoPostDecode(TIFF* tif, uint8_t* buf, tmsize_t cc);
+extern int _TIFFNoPreCode(TIFF* tif, uint16_t s);
+extern int _TIFFNoSeek(TIFF* tif, uint32_t off);
+extern void _TIFFSwab16BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
+extern void _TIFFSwab24BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
+extern void _TIFFSwab32BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
+extern void _TIFFSwab64BitData(TIFF* tif, uint8_t* buf, tmsize_t cc);
extern int TIFFFlushData1(TIFF* tif);
extern int TIFFDefaultDirectory(TIFF* tif);
extern void _TIFFSetDefaultCompressionState(TIFF* tif);
-extern int _TIFFRewriteField(TIFF *, uint16, TIFFDataType, tmsize_t, void *);
+extern int _TIFFRewriteField(TIFF *, uint16_t, TIFFDataType, tmsize_t, void *);
extern int TIFFSetCompressionScheme(TIFF* tif, int scheme);
extern int TIFFSetDefaultCompressionState(TIFF* tif);
-extern uint32 _TIFFDefaultStripSize(TIFF* tif, uint32 s);
-extern void _TIFFDefaultTileSize(TIFF* tif, uint32* tw, uint32* th);
+extern uint32_t _TIFFDefaultStripSize(TIFF* tif, uint32_t s);
+extern void _TIFFDefaultTileSize(TIFF* tif, uint32_t* tw, uint32_t* th);
extern int _TIFFDataSize(TIFFDataType type);
/*--: Rational2Double: Return size of TIFFSetGetFieldType in bytes. */
extern int _TIFFSetGetFieldSize(TIFFSetGetFieldType setgettype);
-extern void _TIFFsetByteArray(void**, void*, uint32);
+extern void _TIFFsetByteArray(void**, void*, uint32_t);
extern void _TIFFsetString(char**, char*);
-extern void _TIFFsetShortArray(uint16**, uint16*, uint32);
-extern void _TIFFsetLongArray(uint32**, uint32*, uint32);
-extern void _TIFFsetFloatArray(float**, float*, uint32);
-extern void _TIFFsetDoubleArray(double**, double*, uint32);
+extern void _TIFFsetShortArray(uint16_t**, uint16_t*, uint32_t);
+extern void _TIFFsetLongArray(uint32_t**, uint32_t*, uint32_t);
+extern void _TIFFsetFloatArray(float**, float*, uint32_t);
+extern void _TIFFsetDoubleArray(double**, double*, uint32_t);
extern void _TIFFprintAscii(FILE*, const char*);
extern void _TIFFprintAsciiTag(FILE*, const char*, const char*);
@@ -376,30 +363,30 @@ extern TIFFErrorHandler _TIFFerrorHandler;
extern TIFFErrorHandlerExt _TIFFwarningHandlerExt;
extern TIFFErrorHandlerExt _TIFFerrorHandlerExt;
-extern uint32 _TIFFMultiply32(TIFF*, uint32, uint32, const char*);
-extern uint64 _TIFFMultiply64(TIFF*, uint64, uint64, const char*);
+extern uint32_t _TIFFMultiply32(TIFF*, uint32_t, uint32_t, const char*);
+extern uint64_t _TIFFMultiply64(TIFF*, uint64_t, uint64_t, const char*);
extern tmsize_t _TIFFMultiplySSize(TIFF*, tmsize_t, tmsize_t, const char*);
-extern tmsize_t _TIFFCastUInt64ToSSize(TIFF*, uint64, const char*);
+extern tmsize_t _TIFFCastUInt64ToSSize(TIFF*, uint64_t, const char*);
extern void* _TIFFCheckMalloc(TIFF*, tmsize_t, tmsize_t, const char*);
extern void* _TIFFCheckRealloc(TIFF*, void*, tmsize_t, tmsize_t, const char*);
-extern double _TIFFUInt64ToDouble(uint64);
-extern float _TIFFUInt64ToFloat(uint64);
+extern double _TIFFUInt64ToDouble(uint64_t);
+extern float _TIFFUInt64ToFloat(uint64_t);
extern float _TIFFClampDoubleToFloat(double);
extern tmsize_t
-_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32 strip,
+_TIFFReadEncodedStripAndAllocBuffer(TIFF* tif, uint32_t strip,
void **buf, tmsize_t bufsizetoalloc,
tmsize_t size_to_read);
extern tmsize_t
-_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32 tile,
- void **buf, tmsize_t bufsizetoalloc,
- tmsize_t size_to_read);
+_TIFFReadEncodedTileAndAllocBuffer(TIFF* tif, uint32_t tile,
+ void **buf, tmsize_t bufsizetoalloc,
+ tmsize_t size_to_read);
extern tmsize_t
_TIFFReadTileAndAllocBuffer(TIFF* tif,
void **buf, tmsize_t bufsizetoalloc,
- uint32 x, uint32 y, uint32 z, uint16 s);
+ uint32_t x, uint32_t y, uint32_t z, uint16_t s);
extern int _TIFFSeekOK(TIFF* tif, toff_t off);
extern int TIFFInitDumpMode(TIFF*, int);
diff --git a/man/TIFFFieldPassCount.3tiff b/man/TIFFFieldPassCount.3tiff
index ff14c520..45018573 100644
--- a/man/TIFFFieldPassCount.3tiff
+++ b/man/TIFFFieldPassCount.3tiff
@@ -48,13 +48,13 @@ or
When a
.I count
is required, it will be of type
-.BR uint32
+.BR uint32_t
when
.BR TIFFFieldReadCount
reports
.BR TIFF_VARIABLE2 ,
and of type
-.BR uint16
+.BR uint16_t
otherwise. (This distinction is critical for use of
.BR TIFFGetField ,
but normally not so for use of
diff --git a/man/TIFFFieldReadCount.3tiff b/man/TIFFFieldReadCount.3tiff
index b6a4546c..80bcc6b3 100644
--- a/man/TIFFFieldReadCount.3tiff
+++ b/man/TIFFFieldReadCount.3tiff
@@ -38,7 +38,7 @@ but there are some special values:
.br
.BR TIFF_VARIABLE
indicates that a variable number of values is possible; then, a
-.BR uint16
+.BR uint16_t
.I count
argument and a pointer
.I data
@@ -51,7 +51,7 @@ is the same as
except that the
.I count
argument must have type
-.BR uint32 .
+.BR uint32_t .
.br
.BR TIFF_SPP
indicates that the number of arguments is equal to the image's
diff --git a/man/TIFFFieldTag.3tiff b/man/TIFFFieldTag.3tiff
index 3d1e83d0..2fe41841 100644
--- a/man/TIFFFieldTag.3tiff
+++ b/man/TIFFFieldTag.3tiff
@@ -27,7 +27,7 @@ TIFFFieldTag \- Get TIFF field tag value from field information
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "uint32 TIFFFieldTag(const TIFFField* " fip ")"
+.BI "uint32_t TIFFFieldTag(const TIFFField* " fip ")"
.SH DESCRIPTION
.BR TIFFFieldTag
returns the numeric tag value for a TIFF field.
diff --git a/man/TIFFFieldWriteCount.3tiff b/man/TIFFFieldWriteCount.3tiff
index f80290fe..bfc7222c 100644
--- a/man/TIFFFieldWriteCount.3tiff
+++ b/man/TIFFFieldWriteCount.3tiff
@@ -38,7 +38,7 @@ but there are some special values:
.br
.BR TIFF_VARIABLE
indicates that a variable number of values is possible; then, a
-.BR uint16
+.BR uint16_t
.I count
argument and a pointer
.I data
@@ -51,7 +51,7 @@ is the same as
except that the
.I count
argument must have type
-.BR uint32 .
+.BR uint32_t .
(On most modern machines, this makes no practical difference, and the
.I count
argument can simply be an
diff --git a/man/TIFFGetField.3tiff b/man/TIFFGetField.3tiff
index 431f4ae9..dc158578 100644
--- a/man/TIFFGetField.3tiff
+++ b/man/TIFFGetField.3tiff
@@ -103,78 +103,78 @@ meaning of each tag and their possible values.
\fITag Name\fP \fICount\fP \fITypes\fP \fINotes\fP
.sp 5p
TIFFTAG_ARTIST 1 const char**
-TIFFTAG_BADFAXLINES 1 uint32*
-TIFFTAG_BITSPERSAMPLE 1 uint16*
-TIFFTAG_CLEANFAXDATA 1 uint16*
-TIFFTAG_COLORMAP 3 const uint16** 1<<BitsPerSample arrays
-TIFFTAG_COMPRESSION 1 uint16*
-TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32*
+TIFFTAG_BADFAXLINES 1 uint32_t*
+TIFFTAG_BITSPERSAMPLE 1 uint16_t*
+TIFFTAG_CLEANFAXDATA 1 uint16_t*
+TIFFTAG_COLORMAP 3 const uint16_t** 1<<BitsPerSample arrays
+TIFFTAG_COMPRESSION 1 uint16_t*
+TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32_t*
TIFFTAG_COPYRIGHT 1 const char**
-TIFFTAG_DATATYPE 1 uint16*
+TIFFTAG_DATATYPE 1 uint16_t*
TIFFTAG_DATETIME 1 const char**
TIFFTAG_DOCUMENTNAME 1 const char**
-TIFFTAG_DOTRANGE 2 uint16*
-TIFFTAG_EXTRASAMPLES 2 uint16*,const uint16** count & types array
+TIFFTAG_DOTRANGE 2 uint16_t*
+TIFFTAG_EXTRASAMPLES 2 uint16_t*,const uint16_t** count & types array
TIFFTAG_FAXFILLFUNC 1 TIFFFaxFillFunc* G3/G4 compression pseudo-tag
TIFFTAG_FAXMODE 1 int* G3/G4 compression pseudo-tag
-TIFFTAG_FILLORDER 1 uint16*
-TIFFTAG_GROUP3OPTIONS 1 uint32*
-TIFFTAG_GROUP4OPTIONS 1 uint32*
-TIFFTAG_HALFTONEHINTS 2 uint16*
+TIFFTAG_FILLORDER 1 uint16_t*
+TIFFTAG_GROUP3OPTIONS 1 uint32_t*
+TIFFTAG_GROUP4OPTIONS 1 uint32_t*
+TIFFTAG_HALFTONEHINTS 2 uint16_t*
TIFFTAG_HOSTCOMPUTER 1 const char**
-TIFFTAG_ICCPROFILE 2 const uint32*,const void** count, profile data
-TIFFTAG_IMAGEDEPTH 1 uint32*
+TIFFTAG_ICCPROFILE 2 const uint32_t*,const void** count, profile data
+TIFFTAG_IMAGEDEPTH 1 uint32_t*
TIFFTAG_IMAGEDESCRIPTION 1 const char**
-TIFFTAG_IMAGELENGTH 1 uint32*
-TIFFTAG_IMAGEWIDTH 1 uint32*
+TIFFTAG_IMAGELENGTH 1 uint32_t*
+TIFFTAG_IMAGEWIDTH 1 uint32_t*
TIFFTAG_INKNAMES 1 const char**
-TIFFTAG_INKSET 1 uint16*
+TIFFTAG_INKSET 1 uint16_t*
TIFFTAG_JPEGCOLORMODE 1 int* JPEG pseudo-tag
TIFFTAG_JPEGQUALITY 1 int* JPEG pseudo-tag
-TIFFTAG_JPEGTABLES 2 uint32*,const void** count & tables
+TIFFTAG_JPEGTABLES 2 uint32_t*,const void** count & tables
TIFFTAG_JPEGTABLESMODE 1 int* JPEG pseudo-tag
TIFFTAG_MAKE 1 const char**
-TIFFTAG_MATTEING 1 uint16*
-TIFFTAG_MAXSAMPLEVALUE 1 uint16*
-TIFFTAG_MINSAMPLEVALUE 1 uint16*
+TIFFTAG_MATTEING 1 uint16_t*
+TIFFTAG_MAXSAMPLEVALUE 1 uint16_t*
+TIFFTAG_MINSAMPLEVALUE 1 uint16_t*
TIFFTAG_MODEL 1 const char**
-TIFFTAG_ORIENTATION 1 uint16*
+TIFFTAG_ORIENTATION 1 uint16_t*
TIFFTAG_PAGENAME 1 const char**
-TIFFTAG_PAGENUMBER 2 uint16*
-TIFFTAG_PHOTOMETRIC 1 uint16*
-TIFFTAG_PHOTOSHOP 2 uint32*,const void** count, data
-TIFFTAG_PLANARCONFIG 1 uint16*
-TIFFTAG_PREDICTOR 1 uint16*
+TIFFTAG_PAGENUMBER 2 uint16_t*
+TIFFTAG_PHOTOMETRIC 1 uint16_t*
+TIFFTAG_PHOTOSHOP 2 uint32_t*,const void** count, data
+TIFFTAG_PLANARCONFIG 1 uint16_t*
+TIFFTAG_PREDICTOR 1 uint16_t*
TIFFTAG_PRIMARYCHROMATICITIES 1 const float** 6-entry array
TIFFTAG_REFERENCEBLACKWHITE 1 const float** 6-entry array
-TIFFTAG_RESOLUTIONUNIT 1 uint16*
-TIFFTAG_RICHTIFFIPTC 2 uint32*,const void** count, data
-TIFFTAG_ROWSPERSTRIP 1 uint32*
-TIFFTAG_SAMPLEFORMAT 1 uint16*
-TIFFTAG_SAMPLESPERPIXEL 1 uint16*
+TIFFTAG_RESOLUTIONUNIT 1 uint16_t*
+TIFFTAG_RICHTIFFIPTC 2 uint32_t*,const void** count, data
+TIFFTAG_ROWSPERSTRIP 1 uint32_t*
+TIFFTAG_SAMPLEFORMAT 1 uint16_t*
+TIFFTAG_SAMPLESPERPIXEL 1 uint16_t*
TIFFTAG_SMAXSAMPLEVALUE 1 double*
TIFFTAG_SMINSAMPLEVALUE 1 double*
TIFFTAG_SOFTWARE 1 const char**
TIFFTAG_STONITS 1 const double**
-TIFFTAG_STRIPBYTECOUNTS 1 const uint64**
-TIFFTAG_STRIPOFFSETS 1 const uint64**
-TIFFTAG_SUBFILETYPE 1 uint32*
-TIFFTAG_SUBIFD 2 uint16*,const uint64** count & offsets array
+TIFFTAG_STRIPBYTECOUNTS 1 const uint64_t**
+TIFFTAG_STRIPOFFSETS 1 const uint64_t**
+TIFFTAG_SUBFILETYPE 1 uint32_t*
+TIFFTAG_SUBIFD 2 uint16_t*,const uint64_t** count & offsets array
TIFFTAG_TARGETPRINTER 1 const char**
-TIFFTAG_THRESHHOLDING 1 uint16*
-TIFFTAG_TILEBYTECOUNTS 1 const uint64**
-TIFFTAG_TILEDEPTH 1 uint32*
-TIFFTAG_TILELENGTH 1 uint32*
-TIFFTAG_TILEOFFSETS 1 const uint64**
-TIFFTAG_TILEWIDTH 1 uint32*
-TIFFTAG_TRANSFERFUNCTION 1 or 3\(dg const uint16**1<<BitsPerSample entry arrays
+TIFFTAG_THRESHHOLDING 1 uint16_t*
+TIFFTAG_TILEBYTECOUNTS 1 const uint64_t**
+TIFFTAG_TILEDEPTH 1 uint32_t*
+TIFFTAG_TILELENGTH 1 uint32_t*
+TIFFTAG_TILEOFFSETS 1 const uint64_t**
+TIFFTAG_TILEWIDTH 1 uint32_t*
+TIFFTAG_TRANSFERFUNCTION 1 or 3\(dg const uint16_t**1<<BitsPerSample entry arrays
TIFFTAG_WHITEPOINT 1 const float** 2-entry array
-TIFFTAG_XMLPACKET 2 uint32*,const void** count, data
+TIFFTAG_XMLPACKET 2 uint32_t*,const void** count, data
TIFFTAG_XPOSITION 1 float*
TIFFTAG_XRESOLUTION 1 float*
TIFFTAG_YCBCRCOEFFICIENTS 1 const float** 3-entry array
-TIFFTAG_YCBCRPOSITIONING 1 uint16*
-TIFFTAG_YCBCRSUBSAMPLING 2 uint16*
+TIFFTAG_YCBCRPOSITIONING 1 uint16_t*
+TIFFTAG_YCBCRSUBSAMPLING 2 uint16_t*
TIFFTAG_YPOSITION 1 float*
TIFFTAG_YRESOLUTION 1 float*\(dd
.fi
@@ -196,11 +196,11 @@ and ASCII string from the tag 36867 you can use the following code:
.PP
.RS
.nf
-uint32 count;
+uint32_t count;
void *data;
TIFFGetField(tiff, 33424, &count, &data);
-printf("Tag %d: %d, count %d\n", 33424, *(uint32 *)data, count);
+printf("Tag %d: %d, count %d\n", 33424, *(uint32_t *)data, count);
TIFFGetField(tiff, 36867, &count, &data);
printf("Tag %d: %s, count %d\n", 36867, (char *)data, count);
.fi
diff --git a/man/TIFFRGBAImage.3tiff b/man/TIFFRGBAImage.3tiff
index fe6064fc..2c5f79c4 100644
--- a/man/TIFFRGBAImage.3tiff
+++ b/man/TIFFRGBAImage.3tiff
@@ -36,7 +36,7 @@ TIFFRGBAImageOK, TIFFRGBAImageBegin, TIFFRGBAImageGet, TIFFRGBAImageEnd
.br
.BI "int TIFFRGBAImageBegin(TIFFRGBAImage *" img ", TIFF* " tif ", int " stopOnError ", char " emsg[1024] ")"
.br
-.BI "int TIFFRGBAImageGet(TIFFRGBAImage *" img ", uint32* " raster ", uint32 " width " , uint32 " height ")"
+.BI "int TIFFRGBAImageGet(TIFFRGBAImage *" img ", uint32_t* " raster ", uint32_t " width " , uint32_t " height ")"
.br
.BI "void TIFFRGBAImageEnd(TIFFRGBAImage *" img ")"
.br
@@ -162,9 +162,9 @@ the raster is being filled:
.nf
.ft C
static void
-putContigAndDraw(TIFFRGBAImage* img, uint32* raster,
- uint32 x, uint32 y, uint32 w, uint32 h,
- int32 fromskew, int32 toskew,
+putContigAndDraw(TIFFRGBAImage* img, uint32_t* raster,
+ uint32_t x, uint32_t y, uint32_t w, uint32_t h,
+ int32_t fromskew, int32_t toskew,
unsigned char* cp)
{
(*putContig)(img, raster, x, y, w, h, fromskew, toskew, cp);
diff --git a/man/TIFFReadEncodedStrip.3tiff b/man/TIFFReadEncodedStrip.3tiff
index 05ddefb9..8d1ad6c5 100644
--- a/man/TIFFReadEncodedStrip.3tiff
+++ b/man/TIFFReadEncodedStrip.3tiff
@@ -30,7 +30,7 @@ file
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "tmsize_t TIFFReadEncodedStrip(TIFF *" tif ", uint32 " strip ", void *" buf ", tmsize_t " size ")"
+.BI "tmsize_t TIFFReadEncodedStrip(TIFF *" tif ", uint32_t " strip ", void *" buf ", tmsize_t " size ")"
.SH DESCRIPTION
Read the specified strip of data and place up to
.I size
diff --git a/man/TIFFReadRGBAImage.3tiff b/man/TIFFReadRGBAImage.3tiff
index 6cdf4b8b..a17f71ed 100644
--- a/man/TIFFReadRGBAImage.3tiff
+++ b/man/TIFFReadRGBAImage.3tiff
@@ -37,9 +37,9 @@ into a fixed-format raster
.br
.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
.sp
-.BI "int TIFFReadRGBAImage(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " stopOnError ")"
+.BI "int TIFFReadRGBAImage(TIFF *" tif ", uint32_t " width ", uint32_t " height ", uint32_t *" raster ", int " stopOnError ")"
.br
-.BI "int TIFFReadRGBAImageOriented(TIFF *" tif ", uint32 " width ", uint32 " height ", uint32 *" raster ", int " orientation ", int " stopOnError ")"
+.BI "int TIFFReadRGBAImageOriented(TIFF *" tif ", uint32_t " width ", uint32_t " height ", uint32_t *" raster ", int " orientation ", int " stopOnError ")"
.br
.SH DESCRIPTION
.IR TIFFReadRGBAImage
diff --git a/man/TIFFReadRGBAStrip.3tiff b/man/TIFFReadRGBAStrip.3tiff
index 31604124..803a99af 100644
--- a/man/TIFFReadRGBAStrip.3tiff
+++ b/man/TIFFReadRGBAStrip.3tiff
@@ -36,7 +36,7 @@ TIFFReadRGBAStrip \- read and decode an image strip into a fixed-format raster
.br
.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
.sp
-.BI "int TIFFReadRGBAStrip(TIFF *" tif ", uint32 " row ", uint32 *" raster ")"
+.BI "int TIFFReadRGBAStrip(TIFF *" tif ", uint32_t " row ", uint32_t *" raster ")"
.SH DESCRIPTION
.IR TIFFReadRGBAStrip
reads a single strip of a strip-based image into memory, storing the result in
diff --git a/man/TIFFReadRGBATile.3tiff b/man/TIFFReadRGBATile.3tiff
index 5b9b4bf2..4ee59180 100644
--- a/man/TIFFReadRGBATile.3tiff
+++ b/man/TIFFReadRGBATile.3tiff
@@ -36,7 +36,7 @@ TIFFReadRGBATile \- read and decode an image tile into a fixed-format raster
.br
.B "#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)"
.sp
-.BI "int TIFFReadRGBATile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 *" raster ")"
+.BI "int TIFFReadRGBATile(TIFF *" tif ", uint32_t " x ", uint32_t " y ", uint32_t *" raster ")"
.SH DESCRIPTION
.IR TIFFReadRGBATile
reads a single tile of a tile-based image into memory, storing the result in
diff --git a/man/TIFFReadScanline.3tiff b/man/TIFFReadScanline.3tiff
index ca4b8368..9a61fc85 100644
--- a/man/TIFFReadScanline.3tiff
+++ b/man/TIFFReadScanline.3tiff
@@ -30,7 +30,7 @@ file
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "int TIFFReadScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
+.BI "int TIFFReadScanline(TIFF *" tif ", tdata_t " buf ", uint32_t " row ", tsample_t " sample ")"
.SH DESCRIPTION
Read the data for the specified row into the (user supplied) data buffer
.IR buf .
diff --git a/man/TIFFReadTile.3tiff b/man/TIFFReadTile.3tiff
index cf0f21dc..5bfbbd36 100644
--- a/man/TIFFReadTile.3tiff
+++ b/man/TIFFReadTile.3tiff
@@ -30,7 +30,7 @@ file
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "tsize_t TIFFReadTile(TIFF *" tif ", tdata_t " buf ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.BI "tsize_t TIFFReadTile(TIFF *" tif ", tdata_t " buf ", uint32_t " x ", uint32_t " y ", uint32_t " z ", tsample_t " sample ")"
.SH DESCRIPTION
Return the data for the tile
.I containing
diff --git a/man/TIFFSetDirectory.3tiff b/man/TIFFSetDirectory.3tiff
index 734c0155..d5b49908 100644
--- a/man/TIFFSetDirectory.3tiff
+++ b/man/TIFFSetDirectory.3tiff
@@ -32,7 +32,7 @@ file
.sp
.BI "int TIFFSetDirectory(TIFF *" tif ", tdir_t " dirnum ")"
.br
-.BI "int TIFFSetSubDirectory(TIFF *" tif ", uint64 " diroff ")"
+.BI "int TIFFSetSubDirectory(TIFF *" tif ", uint64_t " diroff ")"
.SH DESCRIPTION
.I TIFFSetDirectory
changes the current directory and reads its contents with
diff --git a/man/TIFFSetField.3tiff b/man/TIFFSetField.3tiff
index df2a5ea2..f614e075 100644
--- a/man/TIFFSetField.3tiff
+++ b/man/TIFFSetField.3tiff
@@ -85,11 +85,11 @@ The data types are:
is null-terminated string and corresponds to the
.SM ASCII
data type;
-.I uint16
+.I uint16_t
is an unsigned 16-bit value;
-.I uint32
+.I uint32_t
is an unsigned 32-bit value;
-.I uint16*
+.I uint16_t*
is an array of unsigned 16-bit values.
.I void*
is an array of data values of unspecified type.
@@ -103,73 +103,73 @@ specification for information on the meaning of each tag.
\fITag Name\fP \fICount\fP \fITypes\fP \fINotes\fP
.sp 5p
TIFFTAG_ARTIST 1 char*
-TIFFTAG_BADFAXLINES 1 uint32
-TIFFTAG_BITSPERSAMPLE 1 uint16 \(dg
-TIFFTAG_CLEANFAXDATA 1 uint16
-TIFFTAG_COLORMAP 3 uint16* 1<<BitsPerSample arrays
-TIFFTAG_COMPRESSION 1 uint16 \(dg
-TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32
+TIFFTAG_BADFAXLINES 1 uint32_t
+TIFFTAG_BITSPERSAMPLE 1 uint16_t \(dg
+TIFFTAG_CLEANFAXDATA 1 uint16_t
+TIFFTAG_COLORMAP 3 uint16_t* 1<<BitsPerSample arrays
+TIFFTAG_COMPRESSION 1 uint16_t \(dg
+TIFFTAG_CONSECUTIVEBADFAXLINES 1 uint32_t
TIFFTAG_COPYRIGHT 1 char*
TIFFTAG_DATETIME 1 char*
TIFFTAG_DOCUMENTNAME 1 char*
-TIFFTAG_DOTRANGE 2 uint16
-TIFFTAG_EXTRASAMPLES 2 uint16,uint16* \(dg count & types array
+TIFFTAG_DOTRANGE 2 uint16_t
+TIFFTAG_EXTRASAMPLES 2 uint16_t,uint16_t* \(dg count & types array
TIFFTAG_FAXFILLFUNC 1 TIFFFaxFillFunc G3/G4 compression pseudo-tag
TIFFTAG_FAXMODE 1 int \(dg G3/G4 compression pseudo-tag
-TIFFTAG_FILLORDER 1 uint16 \(dg
-TIFFTAG_GROUP3OPTIONS 1 uint32 \(dg
-TIFFTAG_GROUP4OPTIONS 1 uint32 \(dg
-TIFFTAG_HALFTONEHINTS 2 uint16
+TIFFTAG_FILLORDER 1 uint16_t \(dg
+TIFFTAG_GROUP3OPTIONS 1 uint32_t \(dg
+TIFFTAG_GROUP4OPTIONS 1 uint32_t \(dg
+TIFFTAG_HALFTONEHINTS 2 uint16_t
TIFFTAG_HOSTCOMPUTER 1 char*
-TIFFTAG_ICCPROFILE 2 uint32,void* count, profile data
-TIFFTAG_IMAGEDEPTH 1 uint32 \(dg
+TIFFTAG_ICCPROFILE 2 uint32_t,void* count, profile data
+TIFFTAG_IMAGEDEPTH 1 uint32_t \(dg
TIFFTAG_IMAGEDESCRIPTION 1 char*
-TIFFTAG_IMAGELENGTH 1 uint32
-TIFFTAG_IMAGEWIDTH 1 uint32 \(dg
-TIFFTAG_INKNAMES 2 uint16, char*
-TIFFTAG_INKSET 1 uint16 \(dg
+TIFFTAG_IMAGELENGTH 1 uint32_t
+TIFFTAG_IMAGEWIDTH 1 uint32_t \(dg
+TIFFTAG_INKNAMES 2 uint16_t, char*
+TIFFTAG_INKSET 1 uint16_t \(dg
TIFFTAG_JPEGCOLORMODE 1 int \(dg JPEG pseudo-tag
TIFFTAG_JPEGQUALITY 1 int JPEG pseudo-tag
-TIFFTAG_JPEGTABLES 2 uint32*,void* \(dg count & tables
+TIFFTAG_JPEGTABLES 2 uint32_t*,void* \(dg count & tables
TIFFTAG_JPEGTABLESMODE 1 int \(dg JPEG pseudo-tag
TIFFTAG_MAKE 1 char*
-TIFFTAG_MATTEING 1 uint16 \(dg
-TIFFTAG_MAXSAMPLEVALUE 1 uint16
-TIFFTAG_MINSAMPLEVALUE 1 uint16
+TIFFTAG_MATTEING 1 uint16_t \(dg
+TIFFTAG_MAXSAMPLEVALUE 1 uint16_t
+TIFFTAG_MINSAMPLEVALUE 1 uint16_t
TIFFTAG_MODEL 1 char*
-TIFFTAG_ORIENTATION 1 uint16
+TIFFTAG_ORIENTATION 1 uint16_t
TIFFTAG_PAGENAME 1 char*
-TIFFTAG_PAGENUMBER 2 uint16
-TIFFTAG_PHOTOMETRIC 1 uint16
-TIFFTAG_PHOTOSHOP ? uint32,void* count, data
-TIFFTAG_PLANARCONFIG 1 uint16 \(dg
-TIFFTAG_PREDICTOR 1 uint16 \(dg
+TIFFTAG_PAGENUMBER 2 uint16_t
+TIFFTAG_PHOTOMETRIC 1 uint16_t
+TIFFTAG_PHOTOSHOP ? uint32_t,void* count, data
+TIFFTAG_PLANARCONFIG 1 uint16_t \(dg
+TIFFTAG_PREDICTOR 1 uint16_t \(dg
TIFFTAG_PRIMARYCHROMATICITIES 1 float* 6-entry array
TIFFTAG_REFERENCEBLACKWHITE 1 float* \(dg 6-entry array
-TIFFTAG_RESOLUTIONUNIT 1 uint16
-TIFFTAG_RICHTIFFIPTC 2 uint32,void* count, data
-TIFFTAG_ROWSPERSTRIP 1 uint32 \(dg must be > 0
-TIFFTAG_SAMPLEFORMAT 1 uint16 \(dg
-TIFFTAG_SAMPLESPERPIXEL 1 uint16 \(dg value must be <= 4
+TIFFTAG_RESOLUTIONUNIT 1 uint16_t
+TIFFTAG_RICHTIFFIPTC 2 uint32_t,void* count, data
+TIFFTAG_ROWSPERSTRIP 1 uint32_t \(dg must be > 0
+TIFFTAG_SAMPLEFORMAT 1 uint16_t \(dg
+TIFFTAG_SAMPLESPERPIXEL 1 uint16_t \(dg value must be <= 4
TIFFTAG_SMAXSAMPLEVALUE 1 double
TIFFTAG_SMINSAMPLEVALUE 1 double
TIFFTAG_SOFTWARE 1 char*
TIFFTAG_STONITS 1 double \(dg
-TIFFTAG_SUBFILETYPE 1 uint32
-TIFFTAG_SUBIFD 2 uint16,uint64* count & offsets array
+TIFFTAG_SUBFILETYPE 1 uint32_t
+TIFFTAG_SUBIFD 2 uint16_t,uint64_t* count & offsets array
TIFFTAG_TARGETPRINTER 1 char*
-TIFFTAG_THRESHHOLDING 1 uint16
-TIFFTAG_TILEDEPTH 1 uint32 \(dg
-TIFFTAG_TILELENGTH 1 uint32 \(dg must be a multiple of 8
-TIFFTAG_TILEWIDTH 1 uint32 \(dg must be a multiple of 8
-TIFFTAG_TRANSFERFUNCTION 1 or 3\(dd uint16* 1<<BitsPerSample entry arrays
+TIFFTAG_THRESHHOLDING 1 uint16_t
+TIFFTAG_TILEDEPTH 1 uint32_t \(dg
+TIFFTAG_TILELENGTH 1 uint32_t \(dg must be a multiple of 8
+TIFFTAG_TILEWIDTH 1 uint32_t \(dg must be a multiple of 8
+TIFFTAG_TRANSFERFUNCTION 1 or 3\(dd uint16_t* 1<<BitsPerSample entry arrays
TIFFTAG_WHITEPOINT 1 float* 2-entry array
-TIFFTAG_XMLPACKET 2 uint32,void* count, data
+TIFFTAG_XMLPACKET 2 uint32_t,void* count, data
TIFFTAG_XPOSITION 1 float
TIFFTAG_XRESOLUTION 1 float
TIFFTAG_YCBCRCOEFFICIENTS 1 float* \(dg 3-entry array
-TIFFTAG_YCBCRPOSITIONING 1 uint16 \(dg
-TIFFTAG_YCBCRSAMPLING 2 uint16 \(dg
+TIFFTAG_YCBCRPOSITIONING 1 uint16_t \(dg
+TIFFTAG_YCBCRSAMPLING 2 uint16_t \(dg
TIFFTAG_YPOSITION 1 float
TIFFTAG_YRESOLUTION 1 float
.fi
diff --git a/man/TIFFWriteScanline.3tiff b/man/TIFFWriteScanline.3tiff
index a51cec52..bf6e6a8d 100644
--- a/man/TIFFWriteScanline.3tiff
+++ b/man/TIFFWriteScanline.3tiff
@@ -30,7 +30,7 @@ file
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32 " row ", tsample_t " sample ")"
+.BI "int TIFFWriteScanline(TIFF *" tif ", tdata_t " buf ", uint32_t " row ", tsample_t " sample ")"
.SH DESCRIPTION
Write data to a file at the specified row. The
.I sample
diff --git a/man/TIFFWriteTile.3tiff b/man/TIFFWriteTile.3tiff
index a6700258..7e86ae00 100644
--- a/man/TIFFWriteTile.3tiff
+++ b/man/TIFFWriteTile.3tiff
@@ -30,7 +30,7 @@ file
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "tsize_t TIFFWriteTile(TIFF *" tif ", tdata_t " buf ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.BI "tsize_t TIFFWriteTile(TIFF *" tif ", tdata_t " buf ", uint32_t " x ", uint32_t " y ", uint32_t " z ", tsample_t " sample ")"
.SH DESCRIPTION
Write the data for the tile
.I containing
diff --git a/man/TIFFcodec.3tiff b/man/TIFFcodec.3tiff
index aa3a8c63..1fb41816 100644
--- a/man/TIFFcodec.3tiff
+++ b/man/TIFFcodec.3tiff
@@ -29,13 +29,13 @@ TIFFFindCODEC, TIFFRegisterCODEC, TIFFUnRegisterCODEC, TIFFIsCODECConfigured
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "const TIFFCodec* TIFFFindCODEC(uint16 " scheme ");"
+.BI "const TIFFCodec* TIFFFindCODEC(uint16_t " scheme ");"
.br
-.BI "TIFFCodec* TIFFRegisterCODEC(uint16 " scheme ", const char *" method ", TIFFInitMethod " init ");"
+.BI "TIFFCodec* TIFFRegisterCODEC(uint16_t " scheme ", const char *" method ", TIFFInitMethod " init ");"
.br
.BI "void TIFFUnRegisterCODEC(TIFFCodec *" codec ");"
.br
-.BI "int TIFFIsCODECConfigured(uint16 " scheme ");"
+.BI "int TIFFIsCODECConfigured(uint16_t " scheme ");"
.SH DESCRIPTION
.I libtiff
supports a variety of compression schemes implemented by software
diff --git a/man/TIFFcolor.3tiff b/man/TIFFcolor.3tiff
index 1d2bb2b8..d1e74a7c 100644
--- a/man/TIFFcolor.3tiff
+++ b/man/TIFFcolor.3tiff
@@ -30,13 +30,13 @@ TIFFXYZToRGB \- color conversion routines.
.sp
.BI "int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB *" ycbcr ", float *" luma ", float *"refBlackWhite" );"
.br
-.BI "void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *" ycbcr ", uint32 " Y ", int32 " Cb ", int32 " Cr ", uint32 *" R ", uint32 *" G ", uint32 *" B " );"
+.BI "void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *" ycbcr ", uint32_t " Y ", int32_t " Cb ", int32_t " Cr ", uint32_t *" R ", uint32_t *" G ", uint32_t *" B " );"
.sp
.BI "int TIFFCIELabToRGBInit(TIFFCIELabToRGB *" cielab ", const TIFFDisplay *" display ", float *" refWhite ");"
.br
-.BI "void TIFFCIELabToXYZ(TIFFCIELabToRGB *" cielab ", uint32 " L ", int32 " a ", int32 " b ", float *" X ", float *" Y ", float *" Z ");"
+.BI "void TIFFCIELabToXYZ(TIFFCIELabToRGB *" cielab ", uint32_t " L ", int32_t " a ", int32_t " b ", float *" X ", float *" Y ", float *" Z ");"
.br
-.BI "void TIFFXYZToRGB(TIFFCIELabToRGB *" cielab ", float " X ", float " Y ", float " Z" , uint32 *" R ", uint32 *" G ", uint32 *" B ");"
+.BI "void TIFFXYZToRGB(TIFFCIELabToRGB *" cielab ", float " X ", float " Y ", float " Z" , uint32_t *" R ", uint32_t *" G ", uint32_t *" B ");"
.SH DESCRIPTION
TIFF supports several color spaces for images stored in that format. There is
usually a problem of application to handle the data properly and convert
@@ -65,9 +65,9 @@ typedef struct { /* YCbCr->RGB support */
TIFFRGBValue* clamptab; /* range clamping table */
int* Cr_r_tab;
int* Cb_b_tab;
- int32* Cr_g_tab;
- int32* Cb_g_tab;
- int32* Y_tab;
+ int32_t* Cr_g_tab;
+ int32_t* Cb_g_tab;
+ int32_t* Y_tab;
} TIFFYCbCrToRGB;
.fi
.RE
@@ -89,14 +89,14 @@ should helps to understand the the technique:
.RS
.nf
float *luma, *refBlackWhite;
-uint16 hs, vs;
+uint16_t hs, vs;
/* Initialize structures */
ycbcr = (TIFFYCbCrToRGB*)
_TIFFmalloc(TIFFroundup(sizeof(TIFFYCbCrToRGB), sizeof(long))
+ 4*256*sizeof(TIFFRGBValue)
+ 2*256*sizeof(int)
- + 3*256*sizeof(int32));
+ + 3*256*sizeof(int32_t));
if (ycbcr == NULL) {
TIFFError("YCbCr->RGB",
"No space for YCbCr->RGB conversion state");
@@ -109,9 +109,9 @@ if (TIFFYCbCrToRGBInit(ycbcr, luma, refBlackWhite) < 0)
exit(0);
/* Start conversion */
-uint32 r, g, b;
-uint32 Y;
-int32 Cb, Cr;
+uint32_t r, g, b;
+uint32_t Y;
+int32_t Cb, Cr;
for each pixel in image
TIFFYCbCrtoRGB(img->ycbcr, Y, Cb, Cr, &r, &g, &b);
@@ -158,9 +158,9 @@ typedef struct {
float d_YCR; /* Light o/p for reference white */
float d_YCG;
float d_YCB;
- uint32 d_Vrwr; /* Pixel values for ref. white */
- uint32 d_Vrwg;
- uint32 d_Vrwb;
+ uint32_t d_Vrwr; /* Pixel values for ref. white */
+ uint32_t d_Vrwg;
+ uint32_t d_Vrwb;
float d_Y0R; /* Residual light for black pixel */
float d_Y0G;
float d_Y0B;
@@ -245,9 +245,9 @@ if (TIFFCIELabToRGBInit(cielab, &display_sRGB, refWhite) < 0) {
}
/* Now we can start to convert */
-uint32 r, g, b;
-uint32 L;
-int32 a, b;
+uint32_t r, g, b;
+uint32_t L;
+int32_t a, b;
float X, Y, Z;
for each pixel in image
diff --git a/man/TIFFquery.3tiff b/man/TIFFquery.3tiff
index 4d95f5f4..1e56a0ec 100644
--- a/man/TIFFquery.3tiff
+++ b/man/TIFFquery.3tiff
@@ -41,7 +41,7 @@ TIFFGetVersion
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "uint32 TIFFCurrentRow(TIFF* " tif ")"
+.BI "uint32_t TIFFCurrentRow(TIFF* " tif ")"
.br
.BI "tstrip_t TIFFCurrentStrip(TIFF* " tif ")"
.br
diff --git a/man/TIFFstrip.3tiff b/man/TIFFstrip.3tiff
index ce3f718c..f8b765ad 100644
--- a/man/TIFFstrip.3tiff
+++ b/man/TIFFstrip.3tiff
@@ -29,15 +29,15 @@ TIFFComputeStrip, TIFFNumberOfStrips \- strip-related utility routines
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "uint32 TIFFDefaultStripSize(TIFF *" tif ", uint32 " estimate ")"
+.BI "uint32_t TIFFDefaultStripSize(TIFF *" tif ", uint32_t " estimate ")"
.br
.BI "tmsize_t TIFFStripSize(TIFF *" tif ")"
.br
-.BI "tmsize_t TIFFVStripSize(TIFF *" tif ", uint32 " nrows ")"
+.BI "tmsize_t TIFFVStripSize(TIFF *" tif ", uint32_t " nrows ")"
.br
-.BI "tmsize_t TIFFRawStripSize(TIFF *" tif ", uint32 " strip ")"
+.BI "tmsize_t TIFFRawStripSize(TIFF *" tif ", uint32_t " strip ")"
.br
-.BI "tstrip_t TIFFComputeStrip(TIFF *" tif ", uint32 " row ", tsample_t " sample ")"
+.BI "tstrip_t TIFFComputeStrip(TIFF *" tif ", uint32_t " row ", tsample_t " sample ")"
.br
.BI "tstrip_t TIFFNumberOfStrips(TIFF *" tif ")"
.SH DESCRIPTION
diff --git a/man/TIFFswab.3tiff b/man/TIFFswab.3tiff
index 3d7a47bc..44325223 100644
--- a/man/TIFFswab.3tiff
+++ b/man/TIFFswab.3tiff
@@ -33,13 +33,13 @@ TIFFSwabArrayOfShort, TIFFSwabArrayOfLong \- byte- and bit-swapping routines
.br
.BI "void TIFFReverseBits(u_char *" data ", unsigned long " nbytes ")"
.br
-.BI "void TIFFSwabShort(uint16 *" data ")"
+.BI "void TIFFSwabShort(uint16_t *" data ")"
.br
-.BI "void TIFFSwabLong(uint32 *" data ")"
+.BI "void TIFFSwabLong(uint32_t *" data ")"
.br
-.BI "void TIFFSwabArrayOfShort(uint16 *" data ", unsigned long " nshorts ")"
+.BI "void TIFFSwabArrayOfShort(uint16_t *" data ", unsigned long " nshorts ")"
.br
-.BI "void TIFFSwabArrayOfLong(uint32 *" data ", unsigned long " nlongs ")"
+.BI "void TIFFSwabArrayOfLong(uint32_t *" data ", unsigned long " nlongs ")"
.SH DESCRIPTION
The following routines are used by the library to swap
16- and 32-bit data and to reverse the order of bits in bytes.
diff --git a/man/TIFFtile.3tiff b/man/TIFFtile.3tiff
index 10310a06..7928e406 100644
--- a/man/TIFFtile.3tiff
+++ b/man/TIFFtile.3tiff
@@ -30,17 +30,17 @@ routines
.SH SYNOPSIS
.B "#include <tiffio.h>"
.sp
-.BI "void TIFFDefaultTileSize(TIFF *" tif ", uint32 *" tw ", uint32 *" th ")"
+.BI "void TIFFDefaultTileSize(TIFF *" tif ", uint32_t *" tw ", uint32_t *" th ")"
.br
.BI "tsize_t TIFFTileSize(TIFF *" tif ")"
.br
.BI "tsize_t TIFFTileRowSize(TIFF *" tif ")"
.br
-.BI "tsize_t TIFFVTileSize(TIFF *" tif ", uint32 " nrows ")"
+.BI "tsize_t TIFFVTileSize(TIFF *" tif ", uint32_t " nrows ")"
.br
-.BI "ttile_t TIFFComputeTile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.BI "ttile_t TIFFComputeTile(TIFF *" tif ", uint32_t " x ", uint32_t " y ", uint32_t " z ", tsample_t " sample ")"
.br
-.BI "int TIFFCheckTile(TIFF *" tif ", uint32 " x ", uint32 " y ", uint32 " z ", tsample_t " sample ")"
+.BI "int TIFFCheckTile(TIFF *" tif ", uint32_t " x ", uint32_t " y ", uint32_t " z ", tsample_t " sample ")"
.br
.BI "ttile_t TIFFNumberOfTiles(TIFF *" tif ")"
.br
diff --git a/man/libtiff.3tiff b/man/libtiff.3tiff
index 8e9ff35b..1f646789 100644
--- a/man/libtiff.3tiff
+++ b/man/libtiff.3tiff
@@ -93,20 +93,20 @@ The following typedefs are exposed to users either through function
definitions or through parameters passed through the varargs interfaces.
.in +.5i
.sp 5p
-.ta +\w'typedef unsigned <\fIthing\fP> uint32; 'u
+.ta +\w'typedef unsigned <\fIthing\fP> uint32_t; 'u
.nf
-typedef unsigned short uint16; 16-bit unsigned integer
-typedef unsigned <\fIthing\fP> uint32; 32-bit unsigned integer
+typedef unsigned short uint16_t; 16-bit unsigned integer
+typedef unsigned <\fIthing\fP> uint32_t; 32-bit unsigned integer
.sp 5p
typedef unsigned int ttag_t; directory tag
-typedef uint16 tdir_t; directory index
-typedef uint16 tsample_t; sample number
-typedef uint32 tstrip_t; strip number
-typedef uint32 ttile_t; tile number
-typedef int32 tsize_t; i/o size in bytes
+typedef uint16_t tdir_t; directory index
+typedef uint16_t tsample_t; sample number
+typedef uint32_t tstrip_t; strip number
+typedef uint32_t ttile_t; tile number
+typedef int32_t tsize_t; i/o size in bytes
typedef void* tdata_t; image data ref
typedef void* thandle_t; client data handle
-typedef int32 toff_t; file offset
+typedef int32_t toff_t; file offset
.fi
.sp 5p
.in -.5i
@@ -134,7 +134,7 @@ a varargs interface and
.SM "ANSI C"
restricts the type of the parameter before an ellipsis to be a promoted type.
.I toff_t
-is defined as int32 because TIFF file offsets are (unsigned) 32-bit
+is defined as int32_t because TIFF file offsets are (unsigned) 32-bit
quantities. A signed value is used because some interfaces return \-1 on
error. Finally, note that user-specified data references are passed as opaque
handles and only cast at the lowest layers where their type is presumed.
diff --git a/test/check_tag.c b/test/check_tag.c
index 5750d683..afbb5ce0 100644
--- a/test/check_tag.c
+++ b/test/check_tag.c
@@ -30,9 +30,9 @@
#include "tiffio.h"
int
-CheckShortField(TIFF *tif, const ttag_t field, const uint16 value)
+CheckShortField(TIFF *tif, const ttag_t field, const uint16_t value)
{
- uint16 tmp = 123;
+ uint16_t tmp = 123;
if (!TIFFGetField(tif, field, &tmp)) {
fprintf (stderr, "Problem fetching tag %lu.\n",
@@ -49,9 +49,9 @@ CheckShortField(TIFF *tif, const ttag_t field, const uint16 value)
}
int
-CheckShortPairedField(TIFF *tif, const ttag_t field, const uint16 *values)
+CheckShortPairedField(TIFF *tif, const ttag_t field, const uint16_t *values)
{
- uint16 tmp[2] = { 123, 456 };
+ uint16_t tmp[2] = {123, 456 };
if (!TIFFGetField(tif, field, tmp, tmp + 1)) {
fprintf (stderr, "Problem fetching tag %lu.\n",
@@ -68,9 +68,9 @@ CheckShortPairedField(TIFF *tif, const ttag_t field, const uint16 *values)
}
int
-CheckLongField(TIFF *tif, const ttag_t field, const uint32 value)
+CheckLongField(TIFF *tif, const ttag_t field, const uint32_t value)
{
- uint32 tmp = 123;
+ uint32_t tmp = 123;
if (!TIFFGetField(tif, field, &tmp)) {
fprintf (stderr, "Problem fetching tag %lu.\n",
diff --git a/test/custom_dir.c b/test/custom_dir.c
index 3b3ad279..42290ae8 100644
--- a/test/custom_dir.c
+++ b/test/custom_dir.c
@@ -42,12 +42,12 @@
static const char filename[] = "custom_dir.tif";
#define SPP 3 /* Samples per pixel */
-const uint16 width = 1;
-const uint16 length = 1;
-const uint16 bps = 8;
-const uint16 photometric = PHOTOMETRIC_RGB;
-const uint16 rows_per_strip = 1;
-const uint16 planarconfig = PLANARCONFIG_CONTIG;
+const uint16_t width = 1;
+const uint16_t length = 1;
+const uint16_t bps = 8;
+const uint16_t photometric = PHOTOMETRIC_RGB;
+const uint16_t rows_per_strip = 1;
+const uint16_t planarconfig = PLANARCONFIG_CONTIG;
static TIFFField
customFields[] = {
@@ -62,11 +62,11 @@ main()
{
TIFF *tif;
unsigned char buf[SPP] = { 0, 127, 255 };
- uint64 dir_offset = 0, dir_offset2 = 0;
- uint64 read_dir_offset = 0, read_dir_offset2 = 0;
- uint64 *dir_offset2_ptr = NULL;
+ uint64_t dir_offset = 0, dir_offset2 = 0;
+ uint64_t read_dir_offset = 0, read_dir_offset2 = 0;
+ uint64_t *dir_offset2_ptr = NULL;
char *ascii_value;
- uint16 count16 = 0;
+ uint16_t count16 = 0;
/* We write the main directory as a simple image. */
diff --git a/test/custom_dir_EXIF_231.c b/test/custom_dir_EXIF_231.c
index 627edf84..94ba6809 100644
--- a/test/custom_dir_EXIF_231.c
+++ b/test/custom_dir_EXIF_231.c
@@ -87,12 +87,12 @@ static const char filename[] = "custom_dir_EXIF_231.tif";
static const char filenameBigTiff[] = "custom_dir_EXIF_231_Big.tif";
#define SPP 3 /* Samples per pixel */
-const uint16 width = 1;
-const uint16 length = 1;
-const uint16 bps = 8;
-const uint16 photometric = PHOTOMETRIC_RGB;
-const uint16 rows_per_strip = 1;
-const uint16 planarconfig = PLANARCONFIG_CONTIG;
+const uint16_t width = 1;
+const uint16_t length = 1;
+const uint16_t bps = 8;
+const uint16_t photometric = PHOTOMETRIC_RGB;
+const uint16_t rows_per_strip = 1;
+const uint16_t planarconfig = PLANARCONFIG_CONTIG;
int
@@ -149,9 +149,9 @@ int
write_test_tiff(TIFF *tif, const char *filenameRead)
{
unsigned char buf[SPP] = { 0, 127, 255 };
- uint64 dir_offset = 0;
- uint64 dir_offset_GPS = 0, dir_offset_EXIF = 0;
- uint64 read_dir_offset = 0;
+ uint64_t dir_offset = 0;
+ uint64_t dir_offset_GPS = 0, dir_offset_EXIF = 0;
+ uint64_t read_dir_offset = 0;
/*-- Additional variables --*/
int retCode, retCode2;
unsigned char exifVersion[4] = {'0','2','3','1'}; /* EXIF 2.31 version is 4 characters of a string! */
@@ -160,7 +160,7 @@ write_test_tiff(TIFF *tif, const char *filenameRead)
float auxFloat = 0.0f;
double auxDouble = 0.0;
char auxChar = 0;
- uint32 auxUint32 = 0;
+ uint32_t auxUint32 = 0;
short auxShort=0;
long auxLong = 0;
void *pVoid;
@@ -199,7 +199,7 @@ write_test_tiff(TIFF *tif, const char *filenameRead)
float auxFloatArrayN2[3] = { -1.0f / 7.0f, -61.23456789012345f, -62.3f };
/* -- Variables for reading -- */
- uint16 count16 = 0;
+ uint16_t count16 = 0;
union {
long Long;
short Short1;
diff --git a/test/long_tag.c b/test/long_tag.c
index 4bfdf805..79f0235c 100644
--- a/test/long_tag.c
+++ b/test/long_tag.c
@@ -37,22 +37,22 @@
#include "tiffio.h"
-extern int CheckLongField(TIFF *, ttag_t, uint32);
+extern int CheckLongField(TIFF *, ttag_t, uint32_t);
const char *filename = "long_test.tiff";
static struct Tags {
ttag_t tag;
short count;
- uint32 value;
+ uint32_t value;
} long_tags[] = {
{ TIFFTAG_SUBFILETYPE, 1, FILETYPE_REDUCEDIMAGE|FILETYPE_PAGE|FILETYPE_MASK }
};
#define NTAGS (sizeof (long_tags) / sizeof (long_tags[0]))
-const uint32 width = 1;
-const uint32 length = 1;
-const uint32 rows_per_strip = 1;
+const uint32_t width = 1;
+const uint32_t length = 1;
+const uint32_t rows_per_strip = 1;
int
main(int argc, char **argv)
diff --git a/test/rational_precision2double.c b/test/rational_precision2double.c
index e33cc97d..4e5c0bbf 100644
--- a/test/rational_precision2double.c
+++ b/test/rational_precision2double.c
@@ -72,12 +72,12 @@
int write_test_tiff(TIFF *tif, const char *filenameRead, int blnAllCustomTags);
#define SPP 3 /* Samples per pixel */
-const uint16 width = 1;
-const uint16 length = 1;
-const uint16 bps = 8;
-const uint16 photometric = PHOTOMETRIC_RGB;
-const uint16 rows_per_strip = 1;
-const uint16 planarconfig = PLANARCONFIG_CONTIG;
+const uint16_t width = 1;
+const uint16_t length = 1;
+const uint16_t bps = 8;
+const uint16_t photometric = PHOTOMETRIC_RGB;
+const uint16_t rows_per_strip = 1;
+const uint16_t planarconfig = PLANARCONFIG_CONTIG;
/*-- Additional custom TIFF tags for testing of Rational2Double precision --*/
#define TIFFTAG_RATIONAL_DOUBLE 60000
@@ -148,11 +148,11 @@ It merges in our new fields and then calls the next extender if there is one in
static void
_XTIFFDefaultDirectory(TIFF *tif)
{
- uint32 n, nadded;
+ uint32_t n, nadded;
/* Install the extended Tag field info */
n = N(tifFieldInfo);
- //_TIFFMergeFields(tif, const TIFFField info[], uint32 n);
+ //_TIFFMergeFields(tif, const TIFFField info[], uint32_t n);
nadded = _TIFFMergeFields(tif, tifFieldInfo, n);
(void)nadded;
@@ -261,8 +261,8 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
int retCode;
float auxFloat = 0.0f;
double auxDouble = 0.0;
- uint16 auxUint16 = 0;
- uint32 auxUint32 = 0;
+ uint16_t auxUint16 = 0;
+ uint32_t auxUint32 = 0;
long auxLong = 0;
void* pVoid;
int blnIsRational2Double;
@@ -292,7 +292,7 @@ write_test_tiff(TIFF* tif, const char* filenameRead, int blnAllCustomTags) {
float auxFloatArrayResolutions[4] = {5.456789f, 6.666666f, 0.0033f, 5.0f / 213.0f};
/* -- Variables for reading -- */
- uint16 count16 = 0;
+ uint16_t count16 = 0;
union {
long Long;
short Short1;
diff --git a/test/raw_decode.c b/test/raw_decode.c
index aeaaf051..b8d12aa6 100644
--- a/test/raw_decode.c
+++ b/test/raw_decode.c
@@ -120,24 +120,24 @@ static int check_rgb_pixel( int pixel,
return 1;
}
-static int check_rgba_pixel( int pixel,
- int min_red, int max_red,
- int min_green, int max_green,
- int min_blue, int max_blue,
- int min_alpha, int max_alpha,
- uint32 *buffer ) {
+static int check_rgba_pixel(int pixel,
+ int min_red, int max_red,
+ int min_green, int max_green,
+ int min_blue, int max_blue,
+ int min_alpha, int max_alpha,
+ uint32_t *buffer ) {
/* RGBA images are upside down - adjust for normal ordering */
int adjusted_pixel = pixel % 128 + (127 - (pixel/128)) * 128;
- uint32 rgba = buffer[adjusted_pixel];
-
- if( TIFFGetR(rgba) >= (uint32) min_red &&
- TIFFGetR(rgba) <= (uint32) max_red &&
- TIFFGetG(rgba) >= (uint32) min_green &&
- TIFFGetG(rgba) <= (uint32) max_green &&
- TIFFGetB(rgba) >= (uint32) min_blue &&
- TIFFGetB(rgba) <= (uint32) max_blue &&
- TIFFGetA(rgba) >= (uint32) min_alpha &&
- TIFFGetA(rgba) <= (uint32) max_alpha ) {
+ uint32_t rgba = buffer[adjusted_pixel];
+
+ if( TIFFGetR(rgba) >= (uint32_t) min_red &&
+ TIFFGetR(rgba) <= (uint32_t) max_red &&
+ TIFFGetG(rgba) >= (uint32_t) min_green &&
+ TIFFGetG(rgba) <= (uint32_t) max_green &&
+ TIFFGetB(rgba) >= (uint32_t) min_blue &&
+ TIFFGetB(rgba) <= (uint32_t) max_blue &&
+ TIFFGetA(rgba) >= (uint32_t) min_alpha &&
+ TIFFGetA(rgba) <= (uint32_t) max_alpha ) {
return 0;
}
@@ -160,7 +160,7 @@ main(int argc, char **argv)
unsigned short h, v;
int status;
unsigned char *buffer;
- uint32 *rgba_buffer;
+ uint32_t *rgba_buffer;
tsize_t sz, szout;
unsigned int pixel_status = 0;
@@ -261,8 +261,8 @@ main(int argc, char **argv)
*/
tif = TIFFOpen(srcfile,"r");
- sz = 128 * 128 * sizeof(uint32);
- rgba_buffer = (uint32 *) malloc(sz);
+ sz = 128 * 128 * sizeof(uint32_t);
+ rgba_buffer = (uint32_t *) malloc(sz);
if (!TIFFReadRGBATile( tif, 1*128, 2*128, rgba_buffer )) {
fprintf( stderr, "TIFFReadRGBATile() returned failure code.\n" );
diff --git a/test/rewrite_tag.c b/test/rewrite_tag.c
index 1708b024..c9f3ac6c 100644
--- a/test/rewrite_tag.c
+++ b/test/rewrite_tag.c
@@ -39,8 +39,8 @@
#include "tiffio.h"
#include "tiffiop.h"
-const uint32 length = 40;
-const uint32 rows_per_strip = 1;
+const uint32_t length = 40;
+const uint32_t rows_per_strip = 1;
int test_packbits()
@@ -49,7 +49,7 @@ int test_packbits()
int i;
unsigned char buf[10] = {0,0,0,0,0,0,0,0,0,0};
- uint32 width = 10;
+ uint32_t width = 10;
int length = 20;
const char *filename = "test_packbits.tif";
@@ -137,16 +137,16 @@ int test_packbits()
/************************************************************************/
/* rewrite_test() */
/************************************************************************/
-int rewrite_test( const char *filename, uint32 width, int length, int bigtiff,
- uint64 base_value )
+int rewrite_test(const char *filename, uint32_t width, int length, int bigtiff,
+ uint64_t base_value )
{
TIFF *tif;
int i;
unsigned char *buf;
- uint64 *rowoffset, *rowbytes;
- uint64 *upd_rowoffset;
- uint64 *upd_bytecount;
+ uint64_t *rowoffset, *rowbytes;
+ uint64_t *upd_rowoffset;
+ uint64_t *upd_bytecount;
buf = calloc(1, width);
assert(buf);
@@ -223,7 +223,7 @@ int rewrite_test( const char *filename, uint32 width, int length, int bigtiff,
goto failure;
}
- upd_rowoffset = (uint64 *) _TIFFmalloc(sizeof(uint64) * length);
+ upd_rowoffset = (uint64_t *) _TIFFmalloc(sizeof(uint64_t) * length);
for( i = 0; i < length; i++ )
upd_rowoffset[i] = base_value + i*width;
@@ -236,7 +236,7 @@ int rewrite_test( const char *filename, uint32 width, int length, int bigtiff,
_TIFFfree( upd_rowoffset );
- upd_bytecount = (uint64 *) _TIFFmalloc(sizeof(uint64) * length);
+ upd_bytecount = (uint64_t *) _TIFFmalloc(sizeof(uint64_t) * length);
for( i = 0; i < length; i++ )
upd_bytecount[i] = 100 + i*width;
@@ -268,7 +268,7 @@ int rewrite_test( const char *filename, uint32 width, int length, int bigtiff,
for( i = 0; i < length; i++ )
{
- uint64 expect = base_value + i*width;
+ uint64_t expect = base_value + i * width;
if( rowoffset[i] != expect )
{
@@ -291,7 +291,7 @@ int rewrite_test( const char *filename, uint32 width, int length, int bigtiff,
for( i = 0; i < length; i++ )
{
- uint64 expect = 100 + i*width;
+ uint64_t expect = 100 + i * width;
if( rowbytes[i] != expect )
{
diff --git a/test/short_tag.c b/test/short_tag.c
index 75e7f5d5..feab3b66 100644
--- a/test/short_tag.c
+++ b/test/short_tag.c
@@ -41,16 +41,16 @@
static const char filename[] = "short_test.tiff";
#define SPP 3 /* Samples per pixel */
-const uint16 width = 1;
-const uint16 length = 1;
-const uint16 bps = 8;
-const uint16 photometric = PHOTOMETRIC_RGB;
-const uint16 rows_per_strip = 1;
-const uint16 planarconfig = PLANARCONFIG_CONTIG;
+const uint16_t width = 1;
+const uint16_t length = 1;
+const uint16_t bps = 8;
+const uint16_t photometric = PHOTOMETRIC_RGB;
+const uint16_t rows_per_strip = 1;
+const uint16_t planarconfig = PLANARCONFIG_CONTIG;
static const struct {
const ttag_t tag;
- const uint16 value;
+ const uint16_t value;
} short_single_tags[] = {
{ TIFFTAG_COMPRESSION, COMPRESSION_NONE },
{ TIFFTAG_FILLORDER, FILLORDER_MSB2LSB },
@@ -66,7 +66,7 @@ static const struct {
static const struct {
const ttag_t tag;
- const uint16 values[2];
+ const uint16_t values[2];
} short_paired_tags[] = {
{ TIFFTAG_PAGENUMBER, {1, 1} },
{ TIFFTAG_HALFTONEHINTS, {0, 255} },
diff --git a/test/strip.c b/test/strip.c
index f2cb7735..91c34bc1 100644
--- a/test/strip.c
+++ b/test/strip.c
@@ -115,11 +115,11 @@ read_strips(TIFF *tif, const tdata_t array, const tsize_t size)
}
int
-create_image_striped(const char *name, uint32 width, uint32 length,
- uint32 rowsperstrip, uint16 compression,
- uint16 spp, uint16 bps, uint16 photometric,
- uint16 sampleformat, uint16 planarconfig,
- const tdata_t array, const tsize_t size)
+create_image_striped(const char *name, uint32_t width, uint32_t length,
+ uint32_t rowsperstrip, uint16_t compression,
+ uint16_t spp, uint16_t bps, uint16_t photometric,
+ uint16_t sampleformat, uint16_t planarconfig,
+ const tdata_t array, const tsize_t size)
{
TIFF *tif;
@@ -179,15 +179,15 @@ openfailure:
}
int
-read_image_striped(const char *name, uint32 width, uint32 length,
- uint32 rowsperstrip, uint16 compression,
- uint16 spp, uint16 bps, uint16 photometric,
- uint16 sampleformat, uint16 planarconfig,
- const tdata_t array, const tsize_t size)
+read_image_striped(const char *name, uint32_t width, uint32_t length,
+ uint32_t rowsperstrip, uint16_t compression,
+ uint16_t spp, uint16_t bps, uint16_t photometric,
+ uint16_t sampleformat, uint16_t planarconfig,
+ const tdata_t array, const tsize_t size)
{
TIFF *tif;
- uint16 value_u16;
- uint32 value_u32;
+ uint16_t value_u16;
+ uint32_t value_u32;
/* Test whether we can read written values. */
tif = TIFFOpen(name, "r");
@@ -259,7 +259,7 @@ openfailure:
int
write_scanlines(TIFF *tif, const tdata_t array, const tsize_t size)
{
- uint32 length, row;
+ uint32_t length, row;
tsize_t scanlinesize, offset;
(void) size;
diff --git a/test/strip_rw.c b/test/strip_rw.c
index bcf7d735..866329b1 100644
--- a/test/strip_rw.c
+++ b/test/strip_rw.c
@@ -39,22 +39,22 @@
#include "test_arrays.h"
extern int
-create_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,
- uint16, uint16, uint16, uint16, const tdata_t,
- const tsize_t);
+create_image_striped(const char *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t,
+ uint16_t, uint16_t, uint16_t, uint16_t, const tdata_t,
+ const tsize_t);
extern int
-read_image_striped(const char *, uint32, uint32, uint32, uint16, uint16,
- uint16, uint16, uint16, uint16, const tdata_t,
- const tsize_t);
+read_image_striped(const char *, uint32_t, uint32_t, uint32_t, uint16_t, uint16_t,
+ uint16_t, uint16_t, uint16_t, uint16_t, const tdata_t,
+ const tsize_t);
const char *filename = "strip_test.tiff";
int
main(int argc, char **argv)
{
- uint32 rowsperstrip;
- uint16 compression;
- uint16 spp, bps, photometric, sampleformat, planarconfig;
+ uint32_t rowsperstrip;
+ uint16_t compression;
+ uint16_t spp, bps, photometric, sampleformat, planarconfig;
(void) argc;
(void) argv;
diff --git a/test/testtypes.c b/test/testtypes.c
index a36d21e5..0405b94f 100644
--- a/test/testtypes.c
+++ b/test/testtypes.c
@@ -42,16 +42,15 @@
int
main()
{
- CHECK_TYPE(TIFF_INT8_T, 1)
- CHECK_TYPE(TIFF_INT16_T, 2)
- CHECK_TYPE(TIFF_INT32_T, 4)
- CHECK_TYPE(TIFF_INT64_T, 8)
- CHECK_TYPE(TIFF_UINT8_T, 1)
- CHECK_TYPE(TIFF_UINT16_T, 2)
- CHECK_TYPE(TIFF_UINT32_T, 4)
- CHECK_TYPE(TIFF_UINT64_T, 8)
- CHECK_TYPE(TIFF_SIZE_T, sizeof(size_t))
- CHECK_TYPE(TIFF_SSIZE_T, sizeof(size_t))
+ CHECK_TYPE(int8_t, 1)
+ CHECK_TYPE(int16_t, 2)
+ CHECK_TYPE(int32_t, 4)
+ CHECK_TYPE(int64_t, 8)
+ CHECK_TYPE(uint8_t, 1)
+ CHECK_TYPE(uint16_t, 2)
+ CHECK_TYPE(uint32_t, 4)
+ CHECK_TYPE(uint64_t, 8)
+ CHECK_TYPE(tmsize_t , sizeof(size_t))
return 0;
}
diff --git a/test/tifftest.h b/test/tifftest.h
index 391b0f64..694f66cc 100644
--- a/test/tifftest.h
+++ b/test/tifftest.h
@@ -32,9 +32,9 @@
#include "tiffio.h"
-int CheckShortField(TIFF *, const ttag_t, const uint16);
-int CheckShortPairedField(TIFF *, const ttag_t, const uint16*);
-int CheckLongField(TIFF *, const ttag_t, const uint32);
+int CheckShortField(TIFF *, const ttag_t, const uint16_t);
+int CheckShortPairedField(TIFF *, const ttag_t, const uint16_t*);
+int CheckLongField(TIFF *, const ttag_t, const uint32_t);
#endif /* _TIFFTEST_ */
diff --git a/tools/fax2ps.c b/tools/fax2ps.c
index 18f70a22..f1fa0c79 100644
--- a/tools/fax2ps.c
+++ b/tools/fax2ps.c
@@ -72,7 +72,7 @@ int maxline = 512; /* max output line of PostScript */
* March 13-15, 1995.
*/
static void
-printruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
+printruns(unsigned char* buf, uint32_t* runs, uint32_t* erun, uint32_t lastx)
{
static struct {
char white, black;
@@ -86,9 +86,9 @@ printruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
static char* svalue =
" !\"#$&'*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abc";
int colormode = 1; /* 0 for white, 1 for black */
- uint32 runlength = 0;
+ uint32_t runlength = 0;
int n = maxline;
- uint32 x = 0;
+ uint32_t x = 0;
int l;
(void) buf;
@@ -126,7 +126,7 @@ printruns(unsigned char* buf, uint32* runs, uint32* erun, uint32 lastx)
l++;
}
while (runlength > 0 && runlength <= 6) {
- uint32 bitsleft = 6;
+ uint32_t bitsleft = 6;
int t = 0;
while (bitsleft) {
if (runlength <= bitsleft) {
@@ -198,10 +198,10 @@ emitFont(FILE* fd)
}
void
-printTIF(TIFF* tif, uint16 pageNumber)
+printTIF(TIFF* tif, uint16_t pageNumber)
{
- uint32 w, h;
- uint16 unit, compression;
+ uint32_t w, h;
+ uint16_t unit, compression;
float xres, yres, scale = 1.0;
tstrip_t s, ns;
time_t creation_time;
@@ -275,10 +275,10 @@ printTIF(TIFF* tif, uint16 pageNumber)
TIFFGetField(tif, TIFFTAG_PAGENUMBER, &pn, &ptotal)
int
-findPage(TIFF* tif, uint16 pageNumber)
+findPage(TIFF* tif, uint16_t pageNumber)
{
- uint16 pn = (uint16) -1;
- uint16 ptotal = (uint16) -1;
+ uint16_t pn = (uint16_t) -1;
+ uint16_t ptotal = (uint16_t) -1;
if (GetPageNumber(tif)) {
while (pn != (pageNumber-1) && TIFFReadDirectory(tif) && GetPageNumber(tif))
;
@@ -288,10 +288,10 @@ findPage(TIFF* tif, uint16 pageNumber)
}
void
-fax2ps(TIFF* tif, uint16 npages, uint16* pages, char* filename)
+fax2ps(TIFF* tif, uint16_t npages, uint16_t* pages, char* filename)
{
if (npages > 0) {
- uint16 pn, ptotal;
+ uint16_t pn, ptotal;
int i;
if (!GetPageNumber(tif))
@@ -304,7 +304,7 @@ fax2ps(TIFF* tif, uint16 npages, uint16* pages, char* filename)
fprintf(stderr, "%s: No page number %d\n", filename, pages[i]);
}
} else {
- uint16 pageNumber = 0;
+ uint16_t pageNumber = 0;
do
printTIF(tif, pageNumber++);
while (TIFFReadDirectory(tif));
@@ -330,7 +330,7 @@ main(int argc, char** argv)
extern int optind;
extern char* optarg;
#endif
- uint16 *pages = NULL, npages = 0, pageNumber;
+ uint16_t *pages = NULL, npages = 0, pageNumber;
int c, dowarnings = 0; /* if 1, enable library warnings */
TIFF* tif;
@@ -346,11 +346,11 @@ main(int argc, char** argv)
pageWidth = (float)atof(optarg);
break;
case 'p': /* print specific page */
- pageNumber = (uint16)atoi(optarg);
+ pageNumber = (uint16_t)atoi(optarg);
if (pages)
- pages = (uint16*) realloc(pages, (npages+1)*sizeof(uint16));
+ pages = (uint16_t*) realloc(pages, (npages + 1) * sizeof(uint16_t));
else
- pages = (uint16*) malloc(sizeof(uint16));
+ pages = (uint16_t*) malloc(sizeof(uint16_t));
if( pages == NULL )
{
fprintf(stderr, "Out of memory\n");
@@ -377,7 +377,7 @@ main(int argc, char** argv)
usage(EXIT_FAILURE);
}
if (npages > 0)
- qsort(pages, npages, sizeof(uint16), pcompar);
+ qsort(pages, npages, sizeof(uint16_t), pcompar);
if (!dowarnings)
TIFFSetWarningHandler(0);
if (optind < argc) {
diff --git a/tools/fax2tiff.c b/tools/fax2tiff.c
index 67acc593..c0a4fec0 100644
--- a/tools/fax2tiff.c
+++ b/tools/fax2tiff.c
@@ -52,17 +52,17 @@
# define EXIT_FAILURE 1
#endif
-#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+#define TIFFhowmany8(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
TIFF *faxTIFF;
char *rowbuf;
char *refbuf;
-uint32 xsize = 1728;
+uint32_t xsize = 1728;
int verbose;
int stretch;
-uint16 badfaxrun;
-uint32 badfaxlines;
+uint16_t badfaxrun;
+uint32_t badfaxlines;
int copyFaxFile(TIFF* tifin, TIFF* tifout);
static void usage(int code);
@@ -88,12 +88,12 @@ main(int argc, char* argv[])
int compression_out = COMPRESSION_CCITTFAX3;
int fillorder_in = FILLORDER_LSB2MSB;
int fillorder_out = FILLORDER_LSB2MSB;
- uint32 group3options_in = 0; /* 1d-encoded */
- uint32 group3options_out = 0; /* 1d-encoded */
- uint32 group4options_in = 0; /* compressed */
- uint32 group4options_out = 0; /* compressed */
- uint32 defrowsperstrip = (uint32) 0;
- uint32 rowsperstrip;
+ uint32_t group3options_in = 0; /* 1d-encoded */
+ uint32_t group3options_out = 0; /* 1d-encoded */
+ uint32_t group4options_in = 0; /* compressed */
+ uint32_t group4options_out = 0; /* compressed */
+ uint32_t defrowsperstrip = (uint32_t) 0;
+ uint32_t rowsperstrip;
int photometric_in = PHOTOMETRIC_MINISWHITE;
int photometric_out = PHOTOMETRIC_MINISWHITE;
int mode = FAXMODE_CLASSF;
@@ -148,7 +148,7 @@ main(int argc, char* argv[])
resY = (float) atof(optarg);
break;
case 'X': /* input width */
- xsize = (uint32) atoi(optarg);
+ xsize = (uint32_t) atoi(optarg);
break;
/* output-related options */
@@ -295,7 +295,7 @@ main(int argc, char* argv[])
group3options_out);
TIFFSetField(out, TIFFTAG_FAXMODE, mode);
rowsperstrip =
- (defrowsperstrip)?defrowsperstrip:(uint32)-1L;
+ (defrowsperstrip)?defrowsperstrip:(uint32_t)-1L;
break;
/* g4 */
@@ -304,7 +304,7 @@ main(int argc, char* argv[])
group4options_out);
TIFFSetField(out, TIFFTAG_FAXMODE, mode);
rowsperstrip =
- (defrowsperstrip)?defrowsperstrip:(uint32)-1L;
+ (defrowsperstrip)?defrowsperstrip:(uint32_t)-1L;
break;
default:
@@ -358,9 +358,9 @@ main(int argc, char* argv[])
int
copyFaxFile(TIFF* tifin, TIFF* tifout)
{
- uint32 row;
- uint32 linesize = TIFFhowmany8(xsize);
- uint16 badrun;
+ uint32_t row;
+ uint32_t linesize = TIFFhowmany8(xsize);
+ uint16_t badrun;
int ok;
tifin->tif_rawdatasize = (tmsize_t)TIFFGetFileSize(tifin);
diff --git a/tools/pal2rgb.c b/tools/pal2rgb.c
index 9a551d9f..a69193b5 100644
--- a/tools/pal2rgb.c
+++ b/tools/pal2rgb.c
@@ -50,7 +50,7 @@ static void usage(int code);
static void cpTags(TIFF* in, TIFF* out);
static int
-checkcmap(int n, uint16* r, uint16* g, uint16* b)
+checkcmap(int n, uint16_t* r, uint16_t* g, uint16_t* b)
{
while (n-- > 0)
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
@@ -64,8 +64,8 @@ checkcmap(int n, uint16* r, uint16* g, uint16* b)
#define CopyField3(tag, v1, v2, v3) \
if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
-static uint16 compression = (uint16) -1;
-static uint16 predictor = 0;
+static uint16_t compression = (uint16_t) -1;
+static uint16_t predictor = 0;
static int quality = 75; /* JPEG quality */
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int processCompressOptions(char*);
@@ -73,13 +73,13 @@ static int processCompressOptions(char*);
int
main(int argc, char* argv[])
{
- uint16 bitspersample, shortv;
- uint32 imagewidth, imagelength;
- uint16 config = PLANARCONFIG_CONTIG;
- uint32 rowsperstrip = (uint32) -1;
- uint16 photometric = PHOTOMETRIC_RGB;
- uint16 *rmap, *gmap, *bmap;
- uint32 row;
+ uint16_t bitspersample, shortv;
+ uint32_t imagewidth, imagelength;
+ uint16_t config = PLANARCONFIG_CONTIG;
+ uint32_t rowsperstrip = (uint32_t) -1;
+ uint16_t photometric = PHOTOMETRIC_RGB;
+ uint16_t *rmap, *gmap, *bmap;
+ uint32_t row;
int cmap = -1;
TIFF *in, *out;
int c;
@@ -151,7 +151,7 @@ main(int argc, char* argv[])
cpTags(in, out);
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &imagewidth);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &imagelength);
- if (compression != (uint16)-1)
+ if (compression != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
else
TIFFGetField(in, TIFFTAG_COMPRESSION, &compression);
@@ -193,7 +193,7 @@ main(int argc, char* argv[])
}
{ unsigned char *ibuf, *obuf;
register unsigned char* pp;
- register uint32 x;
+ register uint32_t x;
tmsize_t tss_in = TIFFScanlineSize(in);
tmsize_t tss_out = TIFFScanlineSize(out);
if (tss_out / tss_in < 3) {
@@ -299,27 +299,27 @@ processCompressOptions(char* opt)
if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
static void
-cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+cpTag(TIFF* in, TIFF* out, uint16_t tag, uint16_t count, TIFFDataType type)
{
switch (type) {
case TIFF_SHORT:
if (count == 1) {
- uint16 shortv;
+ uint16_t shortv;
CopyField(tag, shortv);
} else if (count == 2) {
- uint16 shortv1, shortv2;
+ uint16_t shortv1, shortv2;
CopyField2(tag, shortv1, shortv2);
} else if (count == 4) {
- uint16 *tr, *tg, *tb, *ta;
+ uint16_t *tr, *tg, *tb, *ta;
CopyField4(tag, tr, tg, tb, ta);
- } else if (count == (uint16) -1) {
- uint16 shortv1;
- uint16* shortav;
+ } else if (count == (uint16_t) -1) {
+ uint16_t shortv1;
+ uint16_t* shortav;
CopyField2(tag, shortv1, shortav);
}
break;
case TIFF_LONG:
- { uint32 longv;
+ { uint32_t longv;
CopyField(tag, longv);
}
break;
@@ -327,7 +327,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
float floatv;
CopyField(tag, floatv);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
float* floatav;
CopyField(tag, floatav);
}
@@ -341,7 +341,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
double doublev;
CopyField(tag, doublev);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
double* doubleav;
CopyField(tag, doubleav);
}
@@ -359,8 +359,8 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
#undef CopyField
static const struct cpTag {
- uint16 tag;
- uint16 count;
+ uint16_t tag;
+ uint16_t count;
TIFFDataType type;
} tags[] = {
{ TIFFTAG_IMAGEWIDTH, 1, TIFF_LONG },
@@ -382,30 +382,30 @@ static const struct cpTag {
{ TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
{ TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
{ TIFFTAG_PAGENAME, 1, TIFF_ASCII },
- { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG },
- { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
- { TIFFTAG_PAGENUMBER, 2, TIFF_SHORT },
- { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
- { TIFFTAG_DATETIME, 1, TIFF_ASCII },
- { TIFFTAG_ARTIST, 1, TIFF_ASCII },
- { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
- { TIFFTAG_PRIMARYCHROMATICITIES, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
- { TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
- { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT },
- { TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG },
- { TIFFTAG_INKSET, 1, TIFF_SHORT },
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG },
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
+ { TIFFTAG_PAGENUMBER, 2, TIFF_SHORT },
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
+ { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
+ { TIFFTAG_PRIMARYCHROMATICITIES, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
+ { TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
+ { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT },
+ { TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG },
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
/*{ TIFFTAG_INKNAMES, 1, TIFF_ASCII },*/ /* Needs much more complicated logic. See tiffcp */
- { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
- { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
- { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
- { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
- { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
- { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1, TIFF_RATIONAL },
};
#define NTAGS (sizeof (tags) / sizeof (tags[0]))
@@ -417,14 +417,14 @@ cpTags(TIFF* in, TIFF* out)
{
if( p->tag == TIFFTAG_GROUP3OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX3 )
continue;
}
if( p->tag == TIFFTAG_GROUP4OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX4 )
continue;
diff --git a/tools/ppm2tiff.c b/tools/ppm2tiff.c
index b467516f..3ca19e8e 100644
--- a/tools/ppm2tiff.c
+++ b/tools/ppm2tiff.c
@@ -54,17 +54,17 @@
#define streq(a,b) (strcmp(a,b) == 0)
#define strneq(a,b,n) (strncmp(a,b,n) == 0)
-static uint16 compression = COMPRESSION_PACKBITS;
-static uint16 predictor = 0;
+static uint16_t compression = COMPRESSION_PACKBITS;
+static uint16_t predictor = 0;
static int quality = 75; /* JPEG quality */
static int jpegcolormode = JPEGCOLORMODE_RGB;
-static uint32 g3opts;
+static uint32_t g3opts;
static void usage(int code);
static int processCompressOptions(char*);
static void
-pack_none (unsigned char *buf, unsigned int smpls, uint16 bps)
+pack_none (unsigned char *buf, unsigned int smpls, uint16_t bps)
{
(void)buf;
(void)smpls;
@@ -73,7 +73,7 @@ pack_none (unsigned char *buf, unsigned int smpls, uint16 bps)
}
static void
-pack_swab (unsigned char *buf, unsigned int smpls, uint16 bps)
+pack_swab (unsigned char *buf, unsigned int smpls, uint16_t bps)
{
unsigned int s;
unsigned char h;
@@ -92,13 +92,13 @@ pack_swab (unsigned char *buf, unsigned int smpls, uint16 bps)
}
static void
-pack_bytes (unsigned char *buf, unsigned int smpls, uint16 bps)
+pack_bytes (unsigned char *buf, unsigned int smpls, uint16_t bps)
{
unsigned int s;
unsigned int in;
unsigned int out;
int bits;
- uint16 t;
+ uint16_t t;
in = 0;
out = 0;
@@ -108,7 +108,7 @@ pack_bytes (unsigned char *buf, unsigned int smpls, uint16 bps)
for (s = 0; smpls > s; s++) {
t <<= bps;
- t |= (uint16) buf [in++];
+ t |= (uint16_t) buf [in++];
bits += bps;
@@ -122,13 +122,13 @@ pack_bytes (unsigned char *buf, unsigned int smpls, uint16 bps)
}
static void
-pack_words (unsigned char *buf, unsigned int smpls, uint16 bps)
+pack_words (unsigned char *buf, unsigned int smpls, uint16_t bps)
{
unsigned int s;
unsigned int in;
unsigned int out;
int bits;
- uint32 t;
+ uint32_t t;
in = 0;
out = 0;
@@ -138,8 +138,8 @@ pack_words (unsigned char *buf, unsigned int smpls, uint16 bps)
for (s = 0; smpls > s; s++) {
t <<= bps;
- t |= (uint32) buf [in++] << 8;
- t |= (uint32) buf [in++] << 0;
+ t |= (uint32_t) buf [in++] << 8;
+ t |= (uint32_t) buf [in++] << 0;
bits += bps;
@@ -166,9 +166,6 @@ BadPPM(char* file)
}
-#define TIFF_SIZE_T_MAX ((size_t) ~ ((size_t)0))
-#define TIFF_TMSIZE_T_MAX (tmsize_t)(TIFF_SIZE_T_MAX >> 1)
-
static tmsize_t
multiply_ms(tmsize_t m1, tmsize_t m2)
{
@@ -180,15 +177,15 @@ multiply_ms(tmsize_t m1, tmsize_t m2)
int
main(int argc, char* argv[])
{
- uint16 photometric = 0;
- uint32 rowsperstrip = (uint32) -1;
+ uint16_t photometric = 0;
+ uint32_t rowsperstrip = (uint32_t) -1;
double resolution = -1;
unsigned char *buf = NULL;
tmsize_t linebytes = 0;
int pbm;
- uint16 spp = 1;
- uint16 bpp = 8;
- void (*pack_func) (unsigned char *buf, unsigned int smpls, uint16 bps);
+ uint16_t spp = 1;
+ uint16_t bpp = 8;
+ void (*pack_func) (unsigned char *buf, unsigned int smpls, uint16_t bps);
TIFF *out;
FILE *in;
unsigned int w, h, prec, row;
@@ -343,8 +340,8 @@ main(int argc, char* argv[])
out = TIFFOpen(argv[optind], "w");
if (out == NULL)
return (EXIT_FAILURE);
- TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) w);
- TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) h);
+ TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t) w);
+ TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t) h);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, spp);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, bpp);
@@ -373,7 +370,7 @@ main(int argc, char* argv[])
} else {
linebytes = multiply_ms(2 * spp, w);
}
- if (rowsperstrip == (uint32) -1) {
+ if (rowsperstrip == (uint32_t) -1) {
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, h);
} else {
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP,
diff --git a/tools/raw2tiff.c b/tools/raw2tiff.c
index de731b13..a5ef5b96 100644
--- a/tools/raw2tiff.c
+++ b/tools/raw2tiff.c
@@ -72,37 +72,37 @@ typedef enum {
BAND
} InterleavingType;
-static uint16 compression = (uint16) -1;
+static uint16_t compression = (uint16_t) -1;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
-static uint16 predictor = 0;
+static uint16_t predictor = 0;
-static void swapBytesInScanline(void *, uint32, TIFFDataType);
-static int guessSize(int, TIFFDataType, _TIFF_off_t, uint32, int,
- uint32 *, uint32 *);
-static double correlation(void *, void *, uint32, TIFFDataType);
+static void swapBytesInScanline(void *, uint32_t, TIFFDataType);
+static int guessSize(int, TIFFDataType, _TIFF_off_t, uint32_t, int,
+ uint32_t *, uint32_t *);
+static double correlation(void *, void *, uint32_t, TIFFDataType);
static void usage(int);
static int processCompressOptions(char*);
int
main(int argc, char* argv[])
{
- uint32 width = 0, length = 0, linebytes, bufsize;
- uint32 nbands = 1; /* number of bands in input image*/
+ uint32_t width = 0, length = 0, linebytes, bufsize;
+ uint32_t nbands = 1; /* number of bands in input image*/
_TIFF_off_t hdr_size = 0; /* size of the header to skip */
TIFFDataType dtype = TIFF_BYTE;
- int16 depth = 1; /* bytes per pixel in input image */
+ int16_t depth = 1; /* bytes per pixel in input image */
int swab = 0; /* byte swapping flag */
InterleavingType interleaving = 0; /* interleaving type flag */
- uint32 rowsperstrip = (uint32) -1;
- uint16 photometric = PHOTOMETRIC_MINISBLACK;
- uint16 config = PLANARCONFIG_CONTIG;
- uint16 fillorder = FILLORDER_LSB2MSB;
+ uint32_t rowsperstrip = (uint32_t) -1;
+ uint16_t photometric = PHOTOMETRIC_MINISBLACK;
+ uint16_t config = PLANARCONFIG_CONTIG;
+ uint16_t fillorder = FILLORDER_LSB2MSB;
int fd;
char *outfilename = NULL;
TIFF *out;
- uint32 row, col, band;
+ uint32_t row, col, band;
int c;
unsigned char *buf = NULL, *buf1 = NULL;
#if !HAVE_DECL_OPTARG
@@ -247,7 +247,7 @@ main(int argc, char* argv[])
TIFFSetField(out, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_VOID);
break;
}
- if (compression == (uint16) -1)
+ if (compression == (uint16_t) -1)
compression = COMPRESSION_PACKBITS;
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
switch (compression) {
@@ -340,17 +340,17 @@ main(int argc, char* argv[])
}
static void
-swapBytesInScanline(void *buf, uint32 width, TIFFDataType dtype)
+swapBytesInScanline(void *buf, uint32_t width, TIFFDataType dtype)
{
switch (dtype) {
case TIFF_SHORT:
case TIFF_SSHORT:
- TIFFSwabArrayOfShort((uint16*)buf,
+ TIFFSwabArrayOfShort((uint16_t*)buf,
(unsigned long)width);
break;
case TIFF_LONG:
case TIFF_SLONG:
- TIFFSwabArrayOfLong((uint32*)buf,
+ TIFFSwabArrayOfLong((uint32_t*)buf,
(unsigned long)width);
break;
/* case TIFF_FLOAT: */ /* FIXME */
@@ -364,14 +364,14 @@ swapBytesInScanline(void *buf, uint32 width, TIFFDataType dtype)
}
static int
-guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands,
- int swab, uint32 *width, uint32 *length)
+guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32_t nbands,
+ int swab, uint32_t *width, uint32_t *length)
{
const float longt = 40.0; /* maximum possible height/width ratio */
char *buf1, *buf2;
_TIFF_stat_s filestat;
- uint32 w, h, scanlinesize, imagesize;
- uint32 depth = TIFFDataWidth(dtype);
+ uint32_t w, h, scanlinesize, imagesize;
+ uint32_t depth = TIFFDataWidth(dtype);
double cor_coef = 0, tmp;
if (_TIFF_fstat_f(fd, &filestat) == -1) {
@@ -407,7 +407,7 @@ guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands,
} else if (*width == 0 && *length == 0) {
unsigned int fail = 0;
fprintf(stderr, "Image width and height are not specified.\n");
- w = (uint32) sqrt(imagesize / longt);
+ w = (uint32_t) sqrt(imagesize / longt);
if( w == 0 )
{
fprintf(stderr, "Too small image size.\n");
@@ -489,10 +489,10 @@ guessSize(int fd, TIFFDataType dtype, _TIFF_off_t hdr_size, uint32 nbands,
/* Calculate correlation coefficient between two numeric vectors */
static double
-correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
+correlation(void *buf1, void *buf2, uint32_t n_elem, TIFFDataType dtype)
{
double X, Y, M1 = 0.0, M2 = 0.0, D1 = 0.0, D2 = 0.0, K = 0.0;
- uint32 i;
+ uint32_t i;
switch (dtype) {
case TIFF_BYTE:
@@ -516,8 +516,8 @@ correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
break;
case TIFF_SHORT:
for (i = 0; i < n_elem; i++) {
- X = ((uint16 *)buf1)[i];
- Y = ((uint16 *)buf2)[i];
+ X = ((uint16_t *)buf1)[i];
+ Y = ((uint16_t *)buf2)[i];
M1 += X, M2 += Y;
D1 += X * X, D2 += Y * Y;
K += X * Y;
@@ -525,8 +525,8 @@ correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
break;
case TIFF_SSHORT:
for (i = 0; i < n_elem; i++) {
- X = ((int16 *)buf1)[i];
- Y = ((int16 *)buf2)[i];
+ X = ((int16_t *)buf1)[i];
+ Y = ((int16_t *)buf2)[i];
M1 += X, M2 += Y;
D1 += X * X, D2 += Y * Y;
K += X * Y;
@@ -534,8 +534,8 @@ correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
break;
case TIFF_LONG:
for (i = 0; i < n_elem; i++) {
- X = ((uint32 *)buf1)[i];
- Y = ((uint32 *)buf2)[i];
+ X = ((uint32_t *)buf1)[i];
+ Y = ((uint32_t *)buf2)[i];
M1 += X, M2 += Y;
D1 += X * X, D2 += Y * Y;
K += X * Y;
@@ -543,8 +543,8 @@ correlation(void *buf1, void *buf2, uint32 n_elem, TIFFDataType dtype)
break;
case TIFF_SLONG:
for (i = 0; i < n_elem; i++) {
- X = ((int32 *)buf1)[i];
- Y = ((int32 *)buf2)[i];
+ X = ((int32_t *)buf1)[i];
+ Y = ((int32_t *)buf2)[i];
M1 += X, M2 += Y;
D1 += X * X, D2 += Y * Y;
K += X * Y;
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index 98496daa..84e6f57a 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -50,17 +50,17 @@
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
-#define roundup(x, y) (howmany(x,y)*((uint32)(y)))
+#define roundup(x, y) (howmany(x,y)*((uint32_t)(y)))
#define LumaRed ycbcrCoeffs[0]
#define LumaGreen ycbcrCoeffs[1]
#define LumaBlue ycbcrCoeffs[2]
-uint16 compression = COMPRESSION_PACKBITS;
-uint32 rowsperstrip = (uint32) -1;
+uint16_t compression = COMPRESSION_PACKBITS;
+uint32_t rowsperstrip = (uint32_t) -1;
-uint16 horizSubSampling = 2; /* YCbCr horizontal subsampling */
-uint16 vertSubSampling = 2; /* YCbCr vertical subsampling */
+uint16_t horizSubSampling = 2; /* YCbCr horizontal subsampling */
+uint16_t vertSubSampling = 2; /* YCbCr vertical subsampling */
float ycbcrCoeffs[3] = { .299F, .587F, .114F };
/* default coding range is CCIR Rec 601-1 with no headroom/footroom */
float refBlackWhite[6] = { 0.F, 255.F, 128.F, 255.F, 128.F, 255.F };
@@ -179,17 +179,17 @@ setupLumaTables(void)
}
static void
-cvtClump(unsigned char* op, uint32* raster, uint32 ch, uint32 cw, uint32 w)
+cvtClump(unsigned char* op, uint32_t* raster, uint32_t ch, uint32_t cw, uint32_t w)
{
float Y, Cb = 0, Cr = 0;
- uint32 j, k;
+ uint32_t j, k;
/*
* Convert ch-by-cw block of RGB
* to YCbCr and sample accordingly.
*/
for (k = 0; k < ch; k++) {
for (j = 0; j < cw; j++) {
- uint32 RGB = (raster - k*w)[j];
+ uint32_t RGB = (raster - k * w)[j];
Y = lumaRed[TIFFGetR(RGB)] +
lumaGreen[TIFFGetG(RGB)] +
lumaBlue[TIFFGetB(RGB)];
@@ -221,11 +221,11 @@ cvtClump(unsigned char* op, uint32* raster, uint32 ch, uint32 cw, uint32 w)
* sample to generate the output data.
*/
static void
-cvtStrip(unsigned char* op, uint32* raster, uint32 nrows, uint32 width)
+cvtStrip(unsigned char* op, uint32_t* raster, uint32_t nrows, uint32_t width)
{
- uint32 x;
+ uint32_t x;
int clumpSize = vertSubSampling * horizSubSampling + 2;
- uint32 *tp;
+ uint32_t *tp;
for (; nrows >= vertSubSampling; nrows -= vertSubSampling) {
tp = raster;
@@ -254,23 +254,23 @@ cvtStrip(unsigned char* op, uint32* raster, uint32 nrows, uint32 width)
}
static int
-cvtRaster(TIFF* tif, uint32* raster, uint32 width, uint32 height)
+cvtRaster(TIFF* tif, uint32_t* raster, uint32_t width, uint32_t height)
{
- uint32 y;
+ uint32_t y;
tstrip_t strip = 0;
tsize_t cc, acc;
unsigned char* buf;
- uint32 rwidth = roundup(width, horizSubSampling);
- uint32 rheight = roundup(height, vertSubSampling);
- uint32 nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);
- uint32 rnrows = roundup(nrows,vertSubSampling);
+ uint32_t rwidth = roundup(width, horizSubSampling);
+ uint32_t rheight = roundup(height, vertSubSampling);
+ uint32_t nrows = (rowsperstrip > rheight ? rheight : rowsperstrip);
+ uint32_t rnrows = roundup(nrows, vertSubSampling);
cc = rnrows*rwidth +
2*((rnrows*rwidth) / (horizSubSampling*vertSubSampling));
buf = (unsigned char*)_TIFFmalloc(cc);
// FIXME unchecked malloc
- for (y = height; (int32) y > 0; y -= nrows) {
- uint32 nr = (y > nrows ? nrows : y);
+ for (y = height; (int32_t) y > 0; y -= nrows) {
+ uint32_t nr = (y > nrows ? nrows : y);
cvtStrip(buf, raster + (y-1)*width, nr, width);
nr = roundup(nr, vertSubSampling);
acc = nr*rwidth +
@@ -287,12 +287,12 @@ cvtRaster(TIFF* tif, uint32* raster, uint32 width, uint32 height)
static int
tiffcvt(TIFF* in, TIFF* out)
{
- uint32 width, height; /* image width & height */
- uint32* raster; /* retrieve RGBA image */
- uint16 shortv;
+ uint32_t width, height; /* image width & height */
+ uint32_t* raster; /* retrieve RGBA image */
+ uint16_t shortv;
float floatv;
char *stringv;
- uint32 longv;
+ uint32_t longv;
int result;
size_t pixel_count;
@@ -309,13 +309,13 @@ tiffcvt(TIFF* in, TIFF* out)
return 0;
}
- raster = (uint32*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32),
- "raster buffer");
+ raster = (uint32_t*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32_t),
+ "raster buffer");
if (raster == 0) {
TIFFError(TIFFFileName(in),
"Failed to allocate buffer (%lu elements of %lu each)",
(unsigned long)pixel_count,
- (unsigned long)sizeof(uint32));
+ (unsigned long)sizeof(uint32_t));
return (0);
}
diff --git a/tools/thumbnail.c b/tools/thumbnail.c
index 3b97ede6..3babb838 100644
--- a/tools/thumbnail.c
+++ b/tools/thumbnail.c
@@ -46,7 +46,7 @@
#define streq(a,b) (strcmp(a,b) == 0)
#ifndef TIFFhowmany8
-# define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+# define TIFFhowmany8(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
#endif
typedef enum {
@@ -59,10 +59,10 @@ typedef enum {
LINEAR
} Contrast;
-static uint32 tnw = 216; /* thumbnail width */
-static uint32 tnh = 274; /* thumbnail height */
+static uint32_t tnw = 216; /* thumbnail width */
+static uint32_t tnh = 274; /* thumbnail height */
static Contrast contrast = LINEAR; /* current contrast */
-static uint8* thumbnail;
+static uint8_t* thumbnail;
static int cpIFD(TIFF*, TIFF*);
static int generateThumbnail(TIFF*, TIFF*);
@@ -107,7 +107,7 @@ main(int argc, char* argv[])
if( in == NULL )
return 2;
- thumbnail = (uint8*) _TIFFmalloc(tnw * tnh);
+ thumbnail = (uint8_t*) _TIFFmalloc(tnw * tnh);
if (!thumbnail) {
TIFFError(TIFFFileName(in),
"Can't allocate space for thumbnail buffer.");
@@ -141,37 +141,37 @@ bad:
if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
static void
-cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+cpTag(TIFF* in, TIFF* out, uint16_t tag, uint16_t count, TIFFDataType type)
{
switch (type) {
case TIFF_SHORT:
if (count == 1) {
- uint16 shortv;
+ uint16_t shortv;
CopyField(tag, shortv);
} else if (count == 2) {
- uint16 shortv1, shortv2;
+ uint16_t shortv1, shortv2;
CopyField2(tag, shortv1, shortv2);
} else if (count == 4) {
- uint16 *tr, *tg, *tb, *ta;
+ uint16_t *tr, *tg, *tb, *ta;
CopyField4(tag, tr, tg, tb, ta);
- } else if (count == (uint16) -1) {
- uint16 shortv1;
- uint16* shortav;
+ } else if (count == (uint16_t) -1) {
+ uint16_t shortv1;
+ uint16_t* shortav;
CopyField2(tag, shortv1, shortav);
}
break;
case TIFF_LONG:
- { uint32 longv;
+ { uint32_t longv;
CopyField(tag, longv);
}
break;
case TIFF_LONG8:
- { uint64 longv8;
+ { uint64_t longv8;
CopyField(tag, longv8);
}
break;
case TIFF_SLONG8:
- { int64 longv8;
+ { int64_t longv8;
CopyField(tag, longv8);
}
break;
@@ -179,7 +179,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
float floatv;
CopyField(tag, floatv);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
float* floatav;
CopyField(tag, floatav);
}
@@ -193,7 +193,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
double doublev;
CopyField(tag, doublev);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
double* doubleav;
CopyField(tag, doubleav);
}
@@ -215,8 +215,8 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
#undef CopyField
static const struct cpTag {
- uint16 tag;
- uint16 count;
+ uint16_t tag;
+ uint16_t count;
TIFFDataType type;
} tags[] = {
{ TIFFTAG_IMAGEWIDTH, 1, TIFF_LONG },
@@ -241,31 +241,31 @@ static const struct cpTag {
{ TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
{ TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
{ TIFFTAG_PAGENAME, 1, TIFF_ASCII },
- { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG },
- { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
- { TIFFTAG_PAGENUMBER, 2, TIFF_SHORT },
- { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
- { TIFFTAG_DATETIME, 1, TIFF_ASCII },
- { TIFFTAG_ARTIST, 1, TIFF_ASCII },
- { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
- { TIFFTAG_PRIMARYCHROMATICITIES, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
- { TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
- { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT },
- { TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG },
- { TIFFTAG_INKSET, 1, TIFF_SHORT },
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG },
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
+ { TIFFTAG_PAGENUMBER, 2, TIFF_SHORT },
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
+ { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
+ { TIFFTAG_PRIMARYCHROMATICITIES, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
+ { TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
+ { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT },
+ { TIFFTAG_CONSECUTIVEBADFAXLINES, 1, TIFF_LONG },
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
/*{ TIFFTAG_INKNAMES, 1, TIFF_ASCII },*/ /* Needs much more complicated logic. See tiffcp */
- { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
- { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
- { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
- { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
- { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
- { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_EXTRASAMPLES, (uint16_t) -1, TIFF_SHORT },
};
#define NTAGS (sizeof (tags) / sizeof (tags[0]))
@@ -280,14 +280,14 @@ cpTags(TIFF* in, TIFF* out)
/* isn't used */
if( p->tag == TIFFTAG_GROUP3OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX3 )
continue;
}
if( p->tag == TIFFTAG_GROUP4OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX4 )
continue;
@@ -305,11 +305,11 @@ cpStrips(TIFF* in, TIFF* out)
if (buf) {
tstrip_t s, ns = TIFFNumberOfStrips(in);
- uint64 *bytecounts;
+ uint64_t *bytecounts;
TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts);
for (s = 0; s < ns; s++) {
- if (bytecounts[s] > (uint64) bufsize) {
+ if (bytecounts[s] > (uint64_t) bufsize) {
buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[s]);
if (!buf)
goto bad;
@@ -339,11 +339,11 @@ cpTiles(TIFF* in, TIFF* out)
if (buf) {
ttile_t t, nt = TIFFNumberOfTiles(in);
- uint64 *bytecounts;
+ uint64_t *bytecounts;
TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts);
for (t = 0; t < nt; t++) {
- if (bytecounts[t] > (uint64) bufsize) {
+ if (bytecounts[t] > (uint64_t) bufsize) {
buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[t]);
if (!buf)
goto bad;
@@ -379,16 +379,16 @@ cpIFD(TIFF* in, TIFF* out)
return (1);
}
-static uint16 photometric; /* current photometric of raster */
-static uint16 filterWidth; /* filter width in pixels */
-static uint32 stepSrcWidth; /* src image stepping width */
-static uint32 stepDstWidth; /* dest stepping width */
-static uint8* src0; /* horizontal bit stepping (start) */
-static uint8* src1; /* horizontal bit stepping (middle) */
-static uint8* src2; /* horizontal bit stepping (end) */
-static uint32* rowoff; /* row offset for stepping */
-static uint8 cmap[256]; /* colormap indexes */
-static uint8 bits[256]; /* count of bits set */
+static uint16_t photometric; /* current photometric of raster */
+static uint16_t filterWidth; /* filter width in pixels */
+static uint32_t stepSrcWidth; /* src image stepping width */
+static uint32_t stepDstWidth; /* dest stepping width */
+static uint8_t* src0; /* horizontal bit stepping (start) */
+static uint8_t* src1; /* horizontal bit stepping (middle) */
+static uint8_t* src2; /* horizontal bit stepping (end) */
+static uint32_t* rowoff; /* row offset for stepping */
+static uint8_t cmap[256]; /* colormap indexes */
+static uint8_t bits[256]; /* count of bits set */
static void
setupBitsTables()
@@ -416,10 +416,10 @@ static int clamp(float v, int low, int high)
#endif
static void
-expFill(float pct[], uint32 p, uint32 n)
+expFill(float pct[], uint32_t p, uint32_t n)
{
- uint32 i;
- uint32 c = (p * n) / 100;
+ uint32_t i;
+ uint32_t c = (p * n) / 100;
for (i = 1; i < c; i++)
pct[i] = (float) (1-exp(i/((double)(n-1)))/ M_E);
for (; i < n; i++)
@@ -430,7 +430,7 @@ static void
setupCmap()
{
float pct[256]; /* known to be large enough */
- uint32 i;
+ uint32_t i;
pct[0] = 1; /* force white */
switch (contrast) {
case EXP50: expFill(pct, 50, 256); break;
@@ -459,10 +459,10 @@ setupCmap()
static void
initScale()
{
- src0 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
- src1 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
- src2 = (uint8*) _TIFFmalloc(sizeof (uint8) * tnw);
- rowoff = (uint32*) _TIFFmalloc(sizeof (uint32) * tnw);
+ src0 = (uint8_t*) _TIFFmalloc(sizeof (uint8_t) * tnw);
+ src1 = (uint8_t*) _TIFFmalloc(sizeof (uint8_t) * tnw);
+ src2 = (uint8_t*) _TIFFmalloc(sizeof (uint8_t) * tnw);
+ rowoff = (uint32_t*) _TIFFmalloc(sizeof (uint32_t) * tnw);
filterWidth = 0;
stepDstWidth = stepSrcWidth = 0;
setupBitsTables();
@@ -473,18 +473,18 @@ initScale()
* according to the widths of the src and dst images.
*/
static void
-setupStepTables(uint32 sw)
+setupStepTables(uint32_t sw)
{
if (stepSrcWidth != sw || stepDstWidth != tnw) {
int step = sw;
int limit = tnw;
int err = 0;
- uint32 sx = 0;
- uint32 x;
+ uint32_t sx = 0;
+ uint32_t x;
int fw;
- uint8 b;
+ uint8_t b;
for (x = 0; x < tnw; x++) {
- uint32 sx0 = sx;
+ uint32_t sx0 = sx;
err += step;
while (err >= limit) {
err -= limit;
@@ -507,19 +507,19 @@ setupStepTables(uint32 sw)
}
static void
-setrow(uint8* row, uint32 nrows, const uint8* rows[])
+setrow(uint8_t* row, uint32_t nrows, const uint8_t* rows[])
{
- uint32 x;
- uint32 area = nrows * filterWidth;
+ uint32_t x;
+ uint32_t area = nrows * filterWidth;
for (x = 0; x < tnw; x++) {
- uint32 mask0 = src0[x];
- uint32 fw = src1[x];
- uint32 mask1 = src1[x];
- uint32 off = rowoff[x];
- uint32 acc = 0;
- uint32 y, i;
+ uint32_t mask0 = src0[x];
+ uint32_t fw = src1[x];
+ uint32_t mask1 = src1[x];
+ uint32_t off = rowoff[x];
+ uint32_t acc = 0;
+ uint32_t y, i;
for (y = 0; y < nrows; y++) {
- const uint8* src = rows[y] + off;
+ const uint8_t* src = rows[y] + off;
acc += bits[*src++ & mask0];
switch (fw) {
default:
@@ -549,18 +549,18 @@ setrow(uint8* row, uint32 nrows, const uint8* rows[])
* with a user-selectable contrast curve.
*/
static void
-setImage1(const uint8* br, uint32 rw, uint32 rh)
+setImage1(const uint8_t* br, uint32_t rw, uint32_t rh)
{
int step = rh;
int limit = tnh;
int err = 0;
int bpr = TIFFhowmany8(rw);
int sy = 0;
- uint8* row = thumbnail;
- uint32 dy;
+ uint8_t* row = thumbnail;
+ uint32_t dy;
for (dy = 0; dy < tnh; dy++) {
- const uint8* rows[256];
- uint32 nrows = 1;
+ const uint8_t* rows[256];
+ uint32_t nrows = 1;
fprintf(stderr, "bpr=%d, sy=%d, bpr*sy=%d\n", bpr, sy, bpr*sy);
rows[0] = br + bpr*sy;
err += step;
@@ -582,9 +582,9 @@ setImage1(const uint8* br, uint32 rw, uint32 rh)
}
static void
-setImage(const uint8* br, uint32 rw, uint32 rh)
+setImage(const uint8_t* br, uint32_t rw, uint32_t rh)
{
- filterWidth = (uint16) ceil((double) rw / (double) tnw);
+ filterWidth = (uint16_t) ceil((double) rw / (double) tnw);
setupStepTables(rw);
setImage1(br, rw, rh);
}
@@ -594,8 +594,8 @@ generateThumbnail(TIFF* in, TIFF* out)
{
unsigned char* raster;
unsigned char* rp;
- uint32 sw, sh, rps;
- uint16 bps, spp;
+ uint32_t sw, sh, rps;
+ uint16_t bps, spp;
tsize_t rowsize, rastersize;
tstrip_t s, ns = TIFFNumberOfStrips(in);
toff_t diroff[1];
@@ -632,18 +632,18 @@ generateThumbnail(TIFF* in, TIFF* out)
_TIFFfree(raster);
TIFFSetField(out, TIFFTAG_SUBFILETYPE, FILETYPE_REDUCEDIMAGE);
- TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32) tnw);
- TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32) tnh);
- TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (uint16) 8);
- TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (uint16) 1);
+ TIFFSetField(out, TIFFTAG_IMAGEWIDTH, (uint32_t) tnw);
+ TIFFSetField(out, TIFFTAG_IMAGELENGTH, (uint32_t) tnh);
+ TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (uint16_t) 8);
+ TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, (uint16_t) 1);
TIFFSetField(out, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS);
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
- cpTag(in, out, TIFFTAG_SOFTWARE, (uint16) -1, TIFF_ASCII);
- cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION, (uint16) -1, TIFF_ASCII);
- cpTag(in, out, TIFFTAG_DATETIME, (uint16) -1, TIFF_ASCII);
- cpTag(in, out, TIFFTAG_HOSTCOMPUTER, (uint16) -1, TIFF_ASCII);
+ cpTag(in, out, TIFFTAG_SOFTWARE, (uint16_t) -1, TIFF_ASCII);
+ cpTag(in, out, TIFFTAG_IMAGEDESCRIPTION, (uint16_t) -1, TIFF_ASCII);
+ cpTag(in, out, TIFFTAG_DATETIME, (uint16_t) -1, TIFF_ASCII);
+ cpTag(in, out, TIFFTAG_HOSTCOMPUTER, (uint16_t) -1, TIFF_ASCII);
diroff[0] = 0UL;
TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff);
return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 &&
diff --git a/tools/tiff2bw.c b/tools/tiff2bw.c
index ca560ea7..265a932f 100644
--- a/tools/tiff2bw.c
+++ b/tools/tiff2bw.c
@@ -54,7 +54,7 @@ static void usage(int code);
static int processCompressOptions(char*);
static void
-compresscontig(unsigned char* out, unsigned char* rgb, uint32 n)
+compresscontig(unsigned char* out, unsigned char* rgb, uint32_t n)
{
register int v, red = RED, green = GREEN, blue = BLUE;
@@ -68,9 +68,9 @@ compresscontig(unsigned char* out, unsigned char* rgb, uint32 n)
static void
compresssep(unsigned char* out,
- unsigned char* r, unsigned char* g, unsigned char* b, uint32 n)
+ unsigned char* r, unsigned char* g, unsigned char* b, uint32_t n)
{
- register uint32 red = RED, green = GREEN, blue = BLUE;
+ register uint32_t red = RED, green = GREEN, blue = BLUE;
while (n-- > 0)
*out++ = (unsigned char)
@@ -78,7 +78,7 @@ compresssep(unsigned char* out,
}
static int
-checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
+checkcmap(TIFF* tif, int n, uint16_t* r, uint16_t* g, uint16_t* b)
{
while (n-- > 0)
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256)
@@ -88,7 +88,7 @@ checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
}
static void
-compresspalette(unsigned char* out, unsigned char* data, uint32 n, uint16* rmap, uint16* gmap, uint16* bmap)
+compresspalette(unsigned char* out, unsigned char* data, uint32_t n, uint16_t* rmap, uint16_t* gmap, uint16_t* bmap)
{
register int v, red = RED, green = GREEN, blue = BLUE;
@@ -101,8 +101,8 @@ compresspalette(unsigned char* out, unsigned char* data, uint32 n, uint16* rmap,
}
}
-static uint16 compression = (uint16) -1;
-static uint16 predictor = 0;
+static uint16_t compression = (uint16_t) -1;
+static uint16_t predictor = 0;
static int jpegcolormode = JPEGCOLORMODE_RGB;
static int quality = 75; /* JPEG quality */
@@ -111,18 +111,18 @@ static void cpTags(TIFF* in, TIFF* out);
int
main(int argc, char* argv[])
{
- uint32 rowsperstrip = (uint32) -1;
+ uint32_t rowsperstrip = (uint32_t) -1;
TIFF *in, *out;
- uint32 w, h;
- uint16 samplesperpixel;
- uint16 bitspersample;
- uint16 config;
- uint16 photometric;
- uint16* red;
- uint16* green;
- uint16* blue;
+ uint32_t w, h;
+ uint16_t samplesperpixel;
+ uint16_t bitspersample;
+ uint16_t config;
+ uint16_t photometric;
+ uint16_t* red;
+ uint16_t* green;
+ uint16_t* blue;
tsize_t rowsize;
- register uint32 row;
+ register uint32_t row;
register tsample_t s;
unsigned char *inbuf, *outbuf;
char thing[1024];
@@ -206,7 +206,7 @@ main(int argc, char* argv[])
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, 1);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
cpTags(in, out);
- if (compression != (uint16) -1) {
+ if (compression != (uint16_t) -1) {
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
switch (compression) {
case COMPRESSION_JPEG:
@@ -373,27 +373,27 @@ processCompressOptions(char* opt)
if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
static void
-cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+cpTag(TIFF* in, TIFF* out, uint16_t tag, uint16_t count, TIFFDataType type)
{
switch (type) {
case TIFF_SHORT:
if (count == 1) {
- uint16 shortv;
+ uint16_t shortv;
CopyField(tag, shortv);
} else if (count == 2) {
- uint16 shortv1, shortv2;
+ uint16_t shortv1, shortv2;
CopyField2(tag, shortv1, shortv2);
} else if (count == 4) {
- uint16 *tr, *tg, *tb, *ta;
+ uint16_t *tr, *tg, *tb, *ta;
CopyField4(tag, tr, tg, tb, ta);
- } else if (count == (uint16) -1) {
- uint16 shortv1;
- uint16* shortav;
+ } else if (count == (uint16_t) -1) {
+ uint16_t shortv1;
+ uint16_t* shortav;
CopyField2(tag, shortv1, shortav);
}
break;
case TIFF_LONG:
- { uint32 longv;
+ { uint32_t longv;
CopyField(tag, longv);
}
break;
@@ -401,7 +401,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
float floatv;
CopyField(tag, floatv);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
float* floatav;
CopyField(tag, floatav);
}
@@ -415,7 +415,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
double doublev;
CopyField(tag, doublev);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
double* doubleav;
CopyField(tag, doubleav);
}
@@ -433,8 +433,8 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
#undef CopyField
static const struct cpTag {
- uint16 tag;
- uint16 count;
+ uint16_t tag;
+ uint16_t count;
TIFFDataType type;
} tags[] = {
{ TIFFTAG_SUBFILETYPE, 1, TIFF_LONG },
@@ -446,30 +446,30 @@ static const struct cpTag {
{ TIFFTAG_MINSAMPLEVALUE, 1, TIFF_SHORT },
{ TIFFTAG_MAXSAMPLEVALUE, 1, TIFF_SHORT },
{ TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
- { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
- { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
- { TIFFTAG_DATETIME, 1, TIFF_ASCII },
- { TIFFTAG_ARTIST, 1, TIFF_ASCII },
- { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
- { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
- { TIFFTAG_INKSET, 1, TIFF_SHORT },
- { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
- { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
- { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
- { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
- { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
- { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
- { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
+ { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
+ { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
+ { TIFFTAG_WHITEPOINT, 2, TIFF_RATIONAL },
+ { TIFFTAG_PRIMARYCHROMATICITIES,(uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_EXTRASAMPLES, (uint16_t) -1, TIFF_SHORT },
+ { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
};
#define NTAGS (sizeof (tags) / sizeof (tags[0]))
@@ -481,14 +481,14 @@ cpTags(TIFF* in, TIFF* out)
{
if( p->tag == TIFFTAG_GROUP3OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX3 )
continue;
}
if( p->tag == TIFFTAG_GROUP4OPTIONS )
{
- uint16 compression;
+ uint16_t compression;
if( !TIFFGetField(in, TIFFTAG_COMPRESSION, &compression) ||
compression != COMPRESSION_CCITTFAX4 )
continue;
diff --git a/tools/tiff2pdf.c b/tools/tiff2pdf.c
index df614bdf..2a4e40f1 100644
--- a/tools/tiff2pdf.c
+++ b/tools/tiff2pdf.c
@@ -121,9 +121,9 @@ typedef enum{
/* This struct defines a logical page of a TIFF. */
typedef struct {
tdir_t page_directory;
- uint32 page_number;
+ uint32_t page_number;
ttile_t page_tilecount;
- uint32 page_extra;
+ uint32_t page_extra;
} T2P_PAGE;
/* This struct defines a PDF rectangle's coordinates. */
@@ -143,12 +143,12 @@ typedef struct {
/* This struct defines information about the tiles on a PDF page. */
typedef struct {
ttile_t tiles_tilecount;
- uint32 tiles_tilewidth;
- uint32 tiles_tilelength;
- uint32 tiles_tilecountx;
- uint32 tiles_tilecounty;
- uint32 tiles_edgetilewidth;
- uint32 tiles_edgetilelength;
+ uint32_t tiles_tilewidth;
+ uint32_t tiles_tilelength;
+ uint32_t tiles_tilecountx;
+ uint32_t tiles_tilecounty;
+ uint32_t tiles_edgetilewidth;
+ uint32_t tiles_edgetilelength;
T2P_TILE* tiles_tiles;
} T2P_TILES;
@@ -158,24 +158,24 @@ typedef struct {
T2P_PAGE* tiff_pages;
T2P_TILES* tiff_tiles;
tdir_t tiff_pagecount;
- uint16 tiff_compression;
- uint16 tiff_photometric;
- uint16 tiff_fillorder;
- uint16 tiff_bitspersample;
- uint16 tiff_samplesperpixel;
- uint16 tiff_planar;
- uint32 tiff_width;
- uint32 tiff_length;
+ uint16_t tiff_compression;
+ uint16_t tiff_photometric;
+ uint16_t tiff_fillorder;
+ uint16_t tiff_bitspersample;
+ uint16_t tiff_samplesperpixel;
+ uint16_t tiff_planar;
+ uint32_t tiff_width;
+ uint32_t tiff_length;
float tiff_xres;
float tiff_yres;
- uint16 tiff_orientation;
+ uint16_t tiff_orientation;
toff_t tiff_dataoffset;
tsize_t tiff_datasize;
tsize_t tiff_maxdatasize;
- uint16 tiff_resunit;
- uint16 pdf_centimeters;
- uint16 pdf_overrideres;
- uint16 pdf_overridepagesize;
+ uint16_t tiff_resunit;
+ uint16_t pdf_centimeters;
+ uint16_t pdf_overrideres;
+ uint16_t pdf_overridepagesize;
float pdf_defaultxres;
float pdf_defaultyres;
float pdf_xres;
@@ -189,14 +189,14 @@ typedef struct {
int pdf_image_fillpage; /* 0 (default: no scaling, 1:scale imagesize to pagesize */
T2P_BOX pdf_mediabox;
T2P_BOX pdf_imagebox;
- uint16 pdf_majorversion;
- uint16 pdf_minorversion;
- uint32 pdf_catalog;
- uint32 pdf_pages;
- uint32 pdf_info;
- uint32 pdf_palettecs;
- uint16 pdf_fitwindow;
- uint32 pdf_startxref;
+ uint16_t pdf_majorversion;
+ uint16_t pdf_minorversion;
+ uint32_t pdf_catalog;
+ uint32_t pdf_pages;
+ uint32_t pdf_info;
+ uint32_t pdf_palettecs;
+ uint16_t pdf_fitwindow;
+ uint32_t pdf_startxref;
#define TIFF2PDF_FILEID_SIZE 33
char pdf_fileid[TIFF2PDF_FILEID_SIZE];
#define TIFF2PDF_DATETIME_SIZE 17
@@ -217,35 +217,35 @@ typedef struct {
char pdf_keywords[TIFF2PDF_KEYWORDS_SIZE];
int pdf_keywords_set;
t2p_cs_t pdf_colorspace;
- uint16 pdf_colorspace_invert;
- uint16 pdf_switchdecode;
- uint16 pdf_palettesize;
+ uint16_t pdf_colorspace_invert;
+ uint16_t pdf_switchdecode;
+ uint16_t pdf_palettesize;
unsigned char* pdf_palette;
int pdf_labrange[4];
t2p_compress_t pdf_defaultcompression;
- uint16 pdf_defaultcompressionquality;
+ uint16_t pdf_defaultcompressionquality;
t2p_compress_t pdf_compression;
- uint16 pdf_compressionquality; /* for deflate : 100 * zipquality + predictor */
- uint16 pdf_nopassthrough;
+ uint16_t pdf_compressionquality; /* for deflate : 100 * zipquality + predictor */
+ uint16_t pdf_nopassthrough;
t2p_transcode_t pdf_transcode;
t2p_sample_t pdf_sample;
- uint32* pdf_xrefoffsets;
- uint32 pdf_xrefcount;
+ uint32_t* pdf_xrefoffsets;
+ uint32_t pdf_xrefcount;
tdir_t pdf_page;
#ifdef OJPEG_SUPPORT
tdata_t pdf_ojpegdata;
- uint32 pdf_ojpegdatalength;
- uint32 pdf_ojpegiflength;
+ uint32_t pdf_ojpegdatalength;
+ uint32_t pdf_ojpegiflength;
#endif
float tiff_whitechromaticities[2];
float tiff_primarychromaticities[6];
float tiff_referenceblackwhite[2];
- uint16* tiff_transferfunction[3];
+ uint16_t* tiff_transferfunction[3];
int pdf_image_interpolate; /* 0 (default) : do not interpolate,
1 : interpolate */
- uint16 tiff_transferfunctioncount;
- uint32 pdf_icccs;
- uint32 tiff_iccprofilelength;
+ uint16_t tiff_transferfunctioncount;
+ uint32_t pdf_icccs;
+ uint32_t tiff_iccprofilelength;
tdata_t tiff_iccprofile;
/* fields for custom read/write procedures */
@@ -289,25 +289,25 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P*, TIFF*, TIFF*, ttile_t);
int t2p_process_ojpeg_tables(T2P*, TIFF*);
#endif
#ifdef JPEG_SUPPORT
-int t2p_process_jpeg_strip(unsigned char*, tsize_t*, unsigned char*, tsize_t, tsize_t*, tstrip_t, uint32);
+int t2p_process_jpeg_strip(unsigned char*, tsize_t*, unsigned char*, tsize_t, tsize_t*, tstrip_t, uint32_t);
#endif
-void t2p_tile_collapse_left(tdata_t, tsize_t, uint32, uint32, uint32);
+void t2p_tile_collapse_left(tdata_t, tsize_t, uint32_t, uint32_t, uint32_t);
void t2p_write_advance_directory(T2P*, TIFF*);
tsize_t t2p_sample_planar_separate_to_contig(T2P*, unsigned char*, unsigned char*, tsize_t);
tsize_t t2p_sample_realize_palette(T2P*, unsigned char*);
-tsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32);
-tsize_t t2p_sample_rgba_to_rgb(tdata_t, uint32);
-tsize_t t2p_sample_rgbaa_to_rgb(tdata_t, uint32);
-tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t, uint32);
+tsize_t t2p_sample_abgr_to_rgb(tdata_t, uint32_t);
+tsize_t t2p_sample_rgba_to_rgb(tdata_t, uint32_t);
+tsize_t t2p_sample_rgbaa_to_rgb(tdata_t, uint32_t);
+tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t, uint32_t);
tsize_t t2p_write_pdf_header(T2P*, TIFF*);
-tsize_t t2p_write_pdf_obj_start(uint32, TIFF*);
+tsize_t t2p_write_pdf_obj_start(uint32_t, TIFF*);
tsize_t t2p_write_pdf_obj_end(TIFF*);
tsize_t t2p_write_pdf_name(const unsigned char*, TIFF*);
tsize_t t2p_write_pdf_string(const char*, TIFF*);
tsize_t t2p_write_pdf_stream(tdata_t, tsize_t, TIFF*);
tsize_t t2p_write_pdf_stream_start(TIFF*);
tsize_t t2p_write_pdf_stream_end(TIFF*);
-tsize_t t2p_write_pdf_stream_dict(tsize_t, uint32, TIFF*);
+tsize_t t2p_write_pdf_stream_dict(tsize_t, uint32_t, TIFF*);
tsize_t t2p_write_pdf_stream_dict_start(TIFF*);
tsize_t t2p_write_pdf_stream_dict_end(TIFF*);
tsize_t t2p_write_pdf_stream_length(tsize_t, TIFF*);
@@ -316,16 +316,16 @@ tsize_t t2p_write_pdf_info(T2P*, TIFF*, TIFF*);
void t2p_pdf_currenttime(T2P*);
void t2p_pdf_tifftime(T2P*, TIFF*);
tsize_t t2p_write_pdf_pages(T2P*, TIFF*);
-tsize_t t2p_write_pdf_page(uint32, T2P*, TIFF*);
+tsize_t t2p_write_pdf_page(uint32_t, T2P*, TIFF*);
void t2p_compose_pdf_page(T2P*);
-void t2p_compose_pdf_page_orient(T2P_BOX*, uint16);
-void t2p_compose_pdf_page_orient_flip(T2P_BOX*, uint16);
+void t2p_compose_pdf_page_orient(T2P_BOX*, uint16_t);
+void t2p_compose_pdf_page_orient_flip(T2P_BOX*, uint16_t);
tsize_t t2p_write_pdf_page_content(T2P*, TIFF*);
tsize_t t2p_write_pdf_xobject_stream_dict(ttile_t, T2P*, TIFF*);
tsize_t t2p_write_pdf_xobject_cs(T2P*, TIFF*);
tsize_t t2p_write_pdf_transfer(T2P*, TIFF*);
-tsize_t t2p_write_pdf_transfer_dict(T2P*, TIFF*, uint16);
-tsize_t t2p_write_pdf_transfer_stream(T2P*, TIFF*, uint16);
+tsize_t t2p_write_pdf_transfer_dict(T2P*, TIFF*, uint16_t);
+tsize_t t2p_write_pdf_transfer_stream(T2P*, TIFF*, uint16_t);
tsize_t t2p_write_pdf_xobject_calcs(T2P*, TIFF*);
tsize_t t2p_write_pdf_xobject_icccs(T2P*, TIFF*);
tsize_t t2p_write_pdf_xobject_icccs_dict(T2P*, TIFF*);
@@ -383,7 +383,7 @@ t2pWriteFile(TIFF *tif, tdata_t data, tmsize_t size)
return -1;
}
-static uint64
+static uint64_t
t2pSeekFile(TIFF *tif, toff_t offset, int whence)
{
thandle_t client = TIFFClientdata(tif);
@@ -412,8 +412,8 @@ t2p_writeproc(thandle_t handle, tdata_t data, tmsize_t size)
return size;
}
-static uint64
-t2p_seekproc(thandle_t handle, uint64 offset, int whence)
+static uint64_t
+t2p_seekproc(thandle_t handle, uint64_t offset, int whence)
{
T2P *t2p = (T2P*) handle;
if (t2p->outputdisable <= 0 && t2p->outputfile)
@@ -428,7 +428,7 @@ t2p_closeproc(thandle_t handle)
return fclose(t2p->outputfile);
}
-static uint64
+static uint64_t
t2p_sizeproc(thandle_t handle)
{
(void) handle;
@@ -449,10 +449,10 @@ t2p_unmapproc(thandle_t handle, void *data, toff_t offset)
}
#if defined(OJPEG_SUPPORT) || defined(JPEG_SUPPORT)
-static uint64
-checkAdd64(uint64 summand1, uint64 summand2, T2P* t2p)
+static uint64_t
+checkAdd64(uint64_t summand1, uint64_t summand2, T2P* t2p)
{
- uint64 bytes = summand1 + summand2;
+ uint64_t bytes = summand1 + summand2;
if (bytes < summand1) {
TIFFError(TIFF2PDF_MODULE, "Integer overflow");
@@ -464,10 +464,10 @@ checkAdd64(uint64 summand1, uint64 summand2, T2P* t2p)
}
#endif /* defined(OJPEG_SUPPORT) || defined(JPEG_SUPPORT) */
-static uint64
-checkMultiply64(uint64 first, uint64 second, T2P* t2p)
+static uint64_t
+checkMultiply64(uint64_t first, uint64_t second, T2P* t2p)
{
- uint64 bytes = first * second;
+ uint64_t bytes = first * second;
if (second && bytes / second != first) {
TIFFError(TIFF2PDF_MODULE, "Integer overflow");
@@ -1027,7 +1027,7 @@ void t2p_validate(T2P* t2p){
#endif
#ifdef ZIP_SUPPORT
if(t2p->pdf_defaultcompression==T2P_COMPRESS_ZIP){
- uint16 m=t2p->pdf_defaultcompressionquality%100;
+ uint16_t m= t2p->pdf_defaultcompressionquality % 100;
if(t2p->pdf_defaultcompressionquality/100 > 9 ||
(m>1 && m<10) || m>15){
t2p->pdf_defaultcompressionquality=0;
@@ -1061,11 +1061,11 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
tdir_t directorycount=0;
tdir_t i=0;
- uint16 pagen=0;
- uint16 paged=0;
- uint16 xuint16=0;
- uint16 tiff_transferfunctioncount=0;
- uint16* tiff_transferfunction[3];
+ uint16_t pagen=0;
+ uint16_t paged=0;
+ uint16_t xuint16=0;
+ uint16_t tiff_transferfunctioncount=0;
+ uint16_t* tiff_transferfunction[3];
directorycount=TIFFNumberOfDirectories(input);
if(directorycount > TIFF_DIR_MAX) {
@@ -1080,8 +1080,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_pages==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %" TIFF_SIZE_FORMAT " bytes of memory for tiff_pages array, %s",
- (TIFF_SIZE_T) directorycount * sizeof(T2P_PAGE),
+ "Can't allocate %zu bytes of memory for tiff_pages array, %s",
+ (size_t) directorycount * sizeof(T2P_PAGE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -1091,15 +1091,15 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if(t2p->tiff_tiles==NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %" TIFF_SIZE_FORMAT " bytes of memory for tiff_tiles array, %s",
- (TIFF_SIZE_T) directorycount * sizeof(T2P_TILES),
+ "Can't allocate %zu bytes of memory for tiff_tiles array, %s",
+ (size_t) directorycount * sizeof(T2P_TILES),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
}
_TIFFmemset( t2p->tiff_tiles, 0x00, directorycount * sizeof(T2P_TILES));
for(i=0;i<directorycount;i++){
- uint32 subfiletype = 0;
+ uint32_t subfiletype = 0;
if(!TIFFSetDirectory(input, i)){
TIFFError(
@@ -1178,8 +1178,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
&(tiff_transferfunction[1]),
&(tiff_transferfunction[2]))) {
- if((tiff_transferfunction[1] != (uint16*) NULL) &&
- (tiff_transferfunction[2] != (uint16*) NULL)
+ if((tiff_transferfunction[1] != (uint16_t*) NULL) &&
+ (tiff_transferfunction[2] != (uint16_t*) NULL)
) {
tiff_transferfunctioncount=3;
} else {
@@ -1264,8 +1264,8 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
if( t2p->tiff_tiles[i].tiles_tiles == NULL){
TIFFError(
TIFF2PDF_MODULE,
- "Can't allocate %" TIFF_SIZE_FORMAT " bytes of memory for t2p_read_tiff_init, %s",
- (TIFF_SIZE_T) t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE),
+ "Can't allocate %zu bytes of memory for t2p_read_tiff_init, %s",
+ (size_t) t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE),
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -1285,9 +1285,9 @@ void t2p_read_tiff_init(T2P* t2p, TIFF* input){
int t2p_cmp_t2p_page(const void* e1, const void* e2){
int d;
- d = (int32)(((T2P_PAGE*)e1)->page_number) - (int32)(((T2P_PAGE*)e2)->page_number);
+ d = (int32_t)(((T2P_PAGE*)e1)->page_number) - (int32_t)(((T2P_PAGE*)e2)->page_number);
if(d == 0){
- d = (int32)(((T2P_PAGE*)e1)->page_directory) - (int32)(((T2P_PAGE*)e2)->page_directory);
+ d = (int32_t)(((T2P_PAGE*)e1)->page_directory) - (int32_t)(((T2P_PAGE*)e2)->page_directory);
}
return d;
}
@@ -1307,12 +1307,12 @@ int t2p_cmp_t2p_page(const void* e1, const void* e2){
void t2p_read_tiff_data(T2P* t2p, TIFF* input){
int i=0;
- uint16* r = NULL;
- uint16* g = NULL;
- uint16* b = NULL;
- uint16* a = NULL;
- uint16 xuint16;
- uint16* xuint16p;
+ uint16_t* r = NULL;
+ uint16_t* g = NULL;
+ uint16_t* b = NULL;
+ uint16_t* a = NULL;
+ uint16_t xuint16;
+ uint16_t* xuint16p;
float* xfloatp;
t2p->pdf_transcode = T2P_TRANSCODE_ENCODE;
@@ -1819,7 +1819,7 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
if(t2p->tiff_compression== COMPRESSION_ADOBE_DEFLATE
|| t2p->tiff_compression==COMPRESSION_DEFLATE){
if(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){
- uint16 predictor;
+ uint16_t predictor;
t2p->pdf_transcode = T2P_TRANSCODE_RAW;
t2p->pdf_compression=T2P_COMPRESS_ZIP;
TIFFGetField(input, TIFFTAG_PREDICTOR, &predictor);
@@ -1894,8 +1894,8 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
&(t2p->tiff_transferfunction[0]),
&(t2p->tiff_transferfunction[1]),
&(t2p->tiff_transferfunction[2]))) {
- if((t2p->tiff_transferfunction[1] != (uint16*) NULL) &&
- (t2p->tiff_transferfunction[2] != (uint16*) NULL)
+ if((t2p->tiff_transferfunction[1] != (uint16_t*) NULL) &&
+ (t2p->tiff_transferfunction[2] != (uint16_t*) NULL)
) {
t2p->tiff_transferfunctioncount=3;
} else {
@@ -1958,8 +1958,8 @@ void t2p_read_tiff_data(T2P* t2p, TIFF* input){
/**
* checks for overflow
*/
-static void t2p_set_tiff_datasize(T2P* t2p, uint64 k) {
- if (k != (uint64)(tmsize_t)k || (tmsize_t)k < 0) {
+static void t2p_set_tiff_datasize(T2P* t2p, uint64_t k) {
+ if (k != (uint64_t)(tmsize_t)k || (tmsize_t)k < 0) {
TIFFError(TIFF2PDF_MODULE, "Integer overflow");
t2p->t2p_error = T2P_ERR_ERROR;
return;
@@ -1973,13 +1973,13 @@ static void t2p_set_tiff_datasize(T2P* t2p, uint64 k) {
*/
void t2p_read_tiff_size(T2P* t2p, TIFF* input){
- uint64* sbc=NULL;
+ uint64_t* sbc=NULL;
#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)
unsigned char* jpt=NULL;
tstrip_t i=0;
tstrip_t stripcount=0;
#endif
- uint64 k = 0;
+ uint64_t k = 0;
if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){
#if defined(CCITT_SUPPORT) || defined(ZIP_SUPPORT)
@@ -2012,7 +2012,7 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){
if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){
if(t2p->tiff_dataoffset != 0){
if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){
- if((uint64)t2p->tiff_datasize < k) {
+ if((uint64_t)t2p->tiff_datasize < k) {
TIFFWarning(TIFF2PDF_MODULE,
"Input file %s has short JPEG interchange file byte count",
TIFFFileName(input));
@@ -2043,7 +2043,7 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){
#endif
#ifdef JPEG_SUPPORT
if(t2p->tiff_compression == COMPRESSION_JPEG) {
- uint32 count = 0;
+ uint32_t count = 0;
if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){
if(count > 4){
k += count;
@@ -2102,12 +2102,12 @@ void t2p_read_tiff_size(T2P* t2p, TIFF* input){
void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
- uint64* tbc = NULL;
- uint16 edge=0;
+ uint64_t* tbc = NULL;
+ uint16_t edge=0;
#ifdef JPEG_SUPPORT
unsigned char* jpt;
#endif
- uint64 k;
+ uint64_t k;
edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);
@@ -2134,7 +2134,7 @@ void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){
#endif
#ifdef JPEG_SUPPORT
if(t2p->tiff_compression==COMPRESSION_JPEG) {
- uint32 count = 0;
+ uint32_t count = 0;
if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt)!=0){
if(count > 4){
k = checkAdd64(k, count, t2p);
@@ -2237,18 +2237,18 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
tsize_t sepstripsize=0;
#ifdef OJPEG_SUPPORT
toff_t inputoffset=0;
- uint16 h_samp=1;
- uint16 v_samp=1;
- uint16 ri=1;
- uint32 rows=0;
+ uint16_t h_samp=1;
+ uint16_t v_samp=1;
+ uint16_t ri=1;
+ uint32_t rows=0;
#endif /* ifdef OJPEG_SUPPORT */
#ifdef JPEG_SUPPORT
unsigned char* jpt;
float* xfloatp;
- uint64* sbc;
+ uint64_t* sbc;
unsigned char* stripbuffer;
tsize_t striplength=0;
- uint32 max_striplength=0;
+ uint32_t max_striplength=0;
#endif /* ifdef JPEG_SUPPORT */
/* Fail if prior error (in particular, can't trust tiff_datasize) */
@@ -2456,7 +2456,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
#endif /* ifdef OJPEG_SUPPORT */
#ifdef JPEG_SUPPORT
if(t2p->tiff_compression == COMPRESSION_JPEG) {
- uint32 count = 0;
+ uint32_t count = 0;
buffer = (unsigned char*)
_TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
@@ -2698,7 +2698,7 @@ tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){
input,
t2p->tiff_width,
t2p->tiff_length,
- (uint32*)buffer,
+ (uint32_t*)buffer,
ORIENTATION_TOPLEFT,
0)){
TIFFError(TIFF2PDF_MODULE,
@@ -2744,7 +2744,7 @@ dataready:
#ifdef JPEG_SUPPORT
case T2P_COMPRESS_JPEG:
if(t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {
- uint16 hor = 0, ver = 0;
+ uint16_t hor = 0, ver = 0;
if (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver) !=0 ) {
if(hor != 0 && ver != 0){
TIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);
@@ -2846,14 +2846,14 @@ dataready:
tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_t tile){
- uint16 edge=0;
+ uint16_t edge=0;
tsize_t written=0;
unsigned char* buffer=NULL;
tsize_t bufferoffset=0;
unsigned char* samplebuffer=NULL;
tsize_t samplebufferoffset=0;
tsize_t read=0;
- uint16 i=0;
+ uint16_t i=0;
ttile_t tilecount=0;
/* tsize_t tilesize=0; */
ttile_t septilecount=0;
@@ -2861,7 +2861,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
#ifdef JPEG_SUPPORT
unsigned char* jpt;
float* xfloatp;
- uint32 xuint32=0;
+ uint32_t xuint32=0;
#endif
/* Fail if prior error (in particular, can't trust tiff_datasize) */
@@ -2991,13 +2991,13 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
#ifdef JPEG_SUPPORT
if(t2p->tiff_compression == COMPRESSION_JPEG){
unsigned char table_end[2];
- uint32 count = 0;
+ uint32_t count = 0;
buffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);
if(buffer==NULL){
TIFFError(TIFF2PDF_MODULE,
- "Can't allocate %" TIFF_SIZE_FORMAT " bytes of memory "
+ "Can't allocate %zu bytes of memory "
"for t2p_readwrite_pdf_image_tile, %s",
- (TIFF_SIZE_T) t2p->tiff_datasize,
+ (size_t) t2p->tiff_datasize,
TIFFFileName(input));
t2p->t2p_error = T2P_ERR_ERROR;
return(0);
@@ -3186,7 +3186,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
}
if(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) != 0){
- if ((uint64)t2p->tiff_datasize < (uint64)TIFFTileRowSize(input) * (uint64)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength) {
+ if ((uint64_t)t2p->tiff_datasize < (uint64_t)TIFFTileRowSize(input) * (uint64_t)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength) {
/* we don't know how to handle PLANARCONFIG_CONTIG, PHOTOMETRIC_YCBCR with 3 samples per pixel */
TIFFWarning(
TIFF2PDF_MODULE,
@@ -3251,7 +3251,7 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
#ifdef JPEG_SUPPORT
case T2P_COMPRESS_JPEG:
if (t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {
- uint16 hor = 0, ver = 0;
+ uint16_t hor = 0, ver = 0;
if (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver)!=0) {
if (hor != 0 && ver != 0) {
TIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);
@@ -3305,8 +3305,8 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
if (TIFFStripSize(output) > t2p->tiff_datasize) {
TIFFError(TIFF2PDF_MODULE,
- "Size mismatch input %" TIFF_SSIZE_FORMAT ", output %" TIFF_SSIZE_FORMAT,
- t2p->tiff_datasize, TIFFStripSize(output));
+ "Size mismatch input %" PRId64 ", output %" PRId64,
+ (int64_t) t2p->tiff_datasize, (int64_t) TIFFStripSize(output));
_TIFFfree(buffer);
t2p->t2p_error = T2P_ERR_ERROR;
return(0);
@@ -3334,26 +3334,26 @@ tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_
#ifdef OJPEG_SUPPORT
int t2p_process_ojpeg_tables(T2P* t2p, TIFF* input){
- uint16 proc=0;
+ uint16_t proc=0;
void* q;
- uint32 q_length=0;
+ uint32_t q_length=0;
void* dc;
- uint32 dc_length=0;
+ uint32_t dc_length=0;
void* ac;
- uint32 ac_length=0;
- uint16* lp;
- uint16* pt;
- uint16 h_samp=1;
- uint16 v_samp=1;
+ uint32_t ac_length=0;
+ uint16_t* lp;
+ uint16_t* pt;
+ uint16_t h_samp=1;
+ uint16_t v_samp=1;
unsigned char* ojpegdata;
- uint16 table_count;
- uint32 offset_table;
- uint32 offset_ms_l;
- uint32 code_count;
- uint32 i=0;
- uint32 dest=0;
- uint16 ri=0;
- uint32 rows=0;
+ uint16_t table_count;
+ uint32_t offset_table;
+ uint32_t offset_ms_l;
+ uint32_t code_count;
+ uint32_t i=0;
+ uint32_t dest=0;
+ uint16_t ri=0;
+ uint32_t rows=0;
if(!TIFFGetField(input, TIFFTAG_JPEGPROC, &proc)){
TIFFError(TIFF2PDF_MODULE,
@@ -3579,21 +3579,21 @@ int t2p_process_ojpeg_tables(T2P* t2p, TIFF* input){
#ifdef JPEG_SUPPORT
int t2p_process_jpeg_strip(
- unsigned char* strip,
- tsize_t* striplength,
- unsigned char* buffer,
- tsize_t buffersize,
- tsize_t* bufferoffset,
- tstrip_t no,
- uint32 height){
+ unsigned char* strip,
+ tsize_t* striplength,
+ unsigned char* buffer,
+ tsize_t buffersize,
+ tsize_t* bufferoffset,
+ tstrip_t no,
+ uint32_t height){
tsize_t i=0;
while (i < *striplength) {
tsize_t datalen;
- uint16 ri;
- uint16 v_samp;
- uint16 h_samp;
+ uint16_t ri;
+ uint16_t v_samp;
+ uint16_t h_samp;
int j;
int ncomp;
@@ -3641,7 +3641,7 @@ int t2p_process_jpeg_strip(
if( *bufferoffset + 11 + 3*(ncomp-1) >= buffersize )
return(0);
for(j=0;j<ncomp;j++){
- uint16 samp = buffer[*bufferoffset+11+(3*j)];
+ uint16_t samp = buffer[*bufferoffset + 11 + (3 * j)];
if( (samp>>4) > h_samp)
h_samp = (samp>>4);
if( (samp & 0x0f) > v_samp)
@@ -3649,12 +3649,12 @@ int t2p_process_jpeg_strip(
}
v_samp*=8;
h_samp*=8;
- ri=((( ((uint16)(buffer[*bufferoffset+5])<<8) |
- (uint16)(buffer[*bufferoffset+6]) )+v_samp-1)/
- v_samp);
- ri*=((( ((uint16)(buffer[*bufferoffset+7])<<8) |
- (uint16)(buffer[*bufferoffset+8]) )+h_samp-1)/
- h_samp);
+ ri=(((((uint16_t)(buffer[*bufferoffset + 5]) << 8) |
+ (uint16_t)(buffer[*bufferoffset + 6]) ) + v_samp - 1) /
+ v_samp);
+ ri*=(((((uint16_t)(buffer[*bufferoffset + 7]) << 8) |
+ (uint16_t)(buffer[*bufferoffset + 8]) ) + h_samp - 1) /
+ h_samp);
buffer[*bufferoffset+5]=
(unsigned char) ((height>>8) & 0xff);
buffer[*bufferoffset+6]=
@@ -3713,13 +3713,13 @@ int t2p_process_jpeg_strip(
tilelength buffer of samples.
*/
void t2p_tile_collapse_left(
- tdata_t buffer,
- tsize_t scanwidth,
- uint32 tilewidth,
- uint32 edgetilewidth,
- uint32 tilelength){
+ tdata_t buffer,
+ tsize_t scanwidth,
+ uint32_t tilewidth,
+ uint32_t edgetilewidth,
+ uint32_t tilelength){
- uint32 i;
+ uint32_t i;
tsize_t edgescanwidth=0;
edgescanwidth = (scanwidth * edgetilewidth + (tilewidth - 1))/ tilewidth;
@@ -3778,12 +3778,12 @@ tsize_t t2p_sample_planar_separate_to_contig(
tsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){
- uint32 sample_count=0;
- uint16 component_count=0;
- uint32 palette_offset=0;
- uint32 sample_offset=0;
- uint32 i=0;
- uint32 j=0;
+ uint32_t sample_count=0;
+ uint16_t component_count=0;
+ uint32_t palette_offset=0;
+ uint32_t sample_offset=0;
+ uint32_t i=0;
+ uint32_t j=0;
size_t data_size;
sample_count=t2p->tiff_width*t2p->tiff_length;
component_count=t2p->tiff_samplesperpixel;
@@ -3818,13 +3818,13 @@ tsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){
into RGB interleaved data, discarding A.
*/
-tsize_t t2p_sample_abgr_to_rgb(tdata_t data, uint32 samplecount)
+tsize_t t2p_sample_abgr_to_rgb(tdata_t data, uint32_t samplecount)
{
- uint32 i=0;
- uint32 sample=0;
+ uint32_t i=0;
+ uint32_t sample=0;
for(i=0;i<samplecount;i++){
- sample=((uint32*)data)[i];
+ sample=((uint32_t*)data)[i];
((char*)data)[i*3]= (char) (sample & 0xff);
((char*)data)[i*3+1]= (char) ((sample>>8) & 0xff);
((char*)data)[i*3+2]= (char) ((sample>>16) & 0xff);
@@ -3839,18 +3839,18 @@ tsize_t t2p_sample_abgr_to_rgb(tdata_t data, uint32 samplecount)
*/
tsize_t
-t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount)
+t2p_sample_rgbaa_to_rgb(tdata_t data, uint32_t samplecount)
{
- uint32 i;
+ uint32_t i;
/* For the 3 first samples, there is overlap between source and
* destination, so use memmove().
* See http://bugzilla.maptools.org/show_bug.cgi?id=2577
*/
for(i = 0; i < 3 && i < samplecount; i++)
- memmove((uint8*)data + i * 3, (uint8*)data + i * 4, 3);
+ memmove((uint8_t*)data + i * 3, (uint8_t*)data + i * 4, 3);
for(; i < samplecount; i++)
- memcpy((uint8*)data + i * 3, (uint8*)data + i * 4, 3);
+ memcpy((uint8_t*)data + i * 3, (uint8_t*)data + i * 4, 3);
return(i * 3);
}
@@ -3861,18 +3861,18 @@ t2p_sample_rgbaa_to_rgb(tdata_t data, uint32 samplecount)
*/
tsize_t
-t2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount)
+t2p_sample_rgba_to_rgb(tdata_t data, uint32_t samplecount)
{
- uint32 i = 0;
- uint32 sample = 0;
- uint8 alpha = 0;
+ uint32_t i = 0;
+ uint32_t sample = 0;
+ uint8_t alpha = 0;
for (i = 0; i < samplecount; i++) {
- sample=((uint32*)data)[i];
- alpha=(uint8)((255 - ((sample >> 24) & 0xff)));
- ((uint8 *)data)[i * 3] = (uint8) ((sample >> 16) & 0xff) + alpha;
- ((uint8 *)data)[i * 3 + 1] = (uint8) ((sample >> 8) & 0xff) + alpha;
- ((uint8 *)data)[i * 3 + 2] = (uint8) (sample & 0xff) + alpha;
+ sample=((uint32_t*)data)[i];
+ alpha=(uint8_t)((255 - ((sample >> 24) & 0xff)));
+ ((uint8_t *)data)[i * 3] = (uint8_t) ((sample >> 16) & 0xff) + alpha;
+ ((uint8_t *)data)[i * 3 + 1] = (uint8_t) ((sample >> 8) & 0xff) + alpha;
+ ((uint8_t *)data)[i * 3 + 2] = (uint8_t) (sample & 0xff) + alpha;
}
return (i * 3);
@@ -3883,9 +3883,9 @@ t2p_sample_rgba_to_rgb(tdata_t data, uint32 samplecount)
to unsigned.
*/
-tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t buffer, uint32 samplecount){
+tsize_t t2p_sample_lab_signed_to_unsigned(tdata_t buffer, uint32_t samplecount){
- uint32 i=0;
+ uint32_t i=0;
for(i=0;i<samplecount;i++){
if( (((unsigned char*)buffer)[(i*3)+1] & 0x80) !=0){
@@ -3929,7 +3929,7 @@ tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){
This function writes the beginning of a PDF object to output.
*/
-tsize_t t2p_write_pdf_obj_start(uint32 number, TIFF* output){
+tsize_t t2p_write_pdf_obj_start(uint32_t number, TIFF* output){
tsize_t written=0;
char buffer[32];
@@ -3963,9 +3963,9 @@ tsize_t t2p_write_pdf_obj_end(TIFF* output){
tsize_t t2p_write_pdf_name(const unsigned char* name, TIFF* output){
tsize_t written=0;
- uint32 i=0;
+ uint32_t i=0;
char buffer[64];
- uint16 nextchar=0;
+ uint16_t nextchar=0;
size_t namelen=0;
namelen = strlen((char *)name);
@@ -4061,7 +4061,7 @@ tsize_t t2p_write_pdf_name(const unsigned char* name, TIFF* output){
tsize_t t2p_write_pdf_string(const char* pdfstr, TIFF* output)
{
tsize_t written = 0;
- uint32 i = 0;
+ uint32_t i = 0;
char buffer[64];
size_t len = 0;
@@ -4151,7 +4151,7 @@ tsize_t t2p_write_pdf_stream_end(TIFF* output){
This function writes a stream dictionary for a PDF stream to output.
*/
-tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32 number, TIFF* output){
+tsize_t t2p_write_pdf_stream_dict(tsize_t len, uint32_t number, TIFF* output){
tsize_t written=0;
char buffer[32];
@@ -4428,7 +4428,7 @@ tsize_t t2p_write_pdf_pages(T2P* t2p, TIFF* output)
This function writes a PDF Page structure to output.
*/
-tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
+tsize_t t2p_write_pdf_page(uint32_t object, T2P* t2p, TIFF* output){
unsigned int i=0;
tsize_t written=0;
@@ -4531,14 +4531,14 @@ tsize_t t2p_write_pdf_page(uint32 object, T2P* t2p, TIFF* output){
void t2p_compose_pdf_page(T2P* t2p){
- uint32 i=0;
- uint32 i2=0;
+ uint32_t i=0;
+ uint32_t i2=0;
T2P_TILE* tiles=NULL;
T2P_BOX* boxp=NULL;
- uint32 tilecountx=0;
- uint32 tilecounty=0;
- uint32 tilewidth=0;
- uint32 tilelength=0;
+ uint32_t tilecountx=0;
+ uint32_t tilecounty=0;
+ uint32_t tilewidth=0;
+ uint32_t tilelength=0;
int istiled=0;
float f=0;
float width_ratio=0;
@@ -4737,7 +4737,7 @@ void t2p_compose_pdf_page(T2P* t2p){
return;
}
-void t2p_compose_pdf_page_orient(T2P_BOX* boxp, uint16 orientation){
+void t2p_compose_pdf_page_orient(T2P_BOX* boxp, uint16_t orientation){
float m1[9];
float f=0.0;
@@ -4812,7 +4812,7 @@ void t2p_compose_pdf_page_orient(T2P_BOX* boxp, uint16 orientation){
return;
}
-void t2p_compose_pdf_page_orient_flip(T2P_BOX* boxp, uint16 orientation){
+void t2p_compose_pdf_page_orient_flip(T2P_BOX* boxp, uint16_t orientation){
float m1[9];
float f=0.0;
@@ -5120,7 +5120,7 @@ tsize_t t2p_write_pdf_transfer(T2P* t2p, TIFF* output){
return(written);
}
-tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){
+tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16_t i){
tsize_t written=0;
char buffer[32];
@@ -5139,7 +5139,7 @@ tsize_t t2p_write_pdf_transfer_dict(T2P* t2p, TIFF* output, uint16 i){
return(written);
}
-tsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16 i){
+tsize_t t2p_write_pdf_transfer_stream(T2P* t2p, TIFF* output, uint16_t i){
tsize_t written=0;
@@ -5448,7 +5448,7 @@ tsize_t t2p_write_pdf_xreftable(T2P* t2p, TIFF* output){
tsize_t written=0;
char buffer[64];
int buflen=0;
- uint32 i=0;
+ uint32_t i=0;
written += t2pWriteFile(output, (tdata_t) "xref\n0 ", 7);
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)(t2p->pdf_xrefcount + 1));
@@ -5551,16 +5551,16 @@ tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){
tsize_t written=0;
ttile_t i2=0;
tsize_t streamlen=0;
- uint16 i=0;
+ uint16_t i=0;
t2p_read_tiff_init(t2p, input);
if(t2p->t2p_error!=T2P_ERR_OK){return(0);}
- t2p->pdf_xrefoffsets= (uint32*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->pdf_xrefcount,sizeof(uint32)) );
+ t2p->pdf_xrefoffsets= (uint32_t*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t, t2p->pdf_xrefcount, sizeof(uint32_t)) );
if(t2p->pdf_xrefoffsets==NULL){
TIFFError(
TIFF2PDF_MODULE,
"Can't allocate %u bytes of memory for t2p_write_pdf",
- (unsigned int) (t2p->pdf_xrefcount * sizeof(uint32)) );
+ (unsigned int) (t2p->pdf_xrefcount * sizeof(uint32_t)) );
t2p->t2p_error = T2P_ERR_ERROR;
return(written);
}
@@ -5668,8 +5668,8 @@ tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){
t2p_read_tiff_size_tile(t2p, input, i2);
if (t2p->tiff_maxdatasize && (t2p->tiff_datasize > t2p->tiff_maxdatasize)) {
TIFFError(TIFF2PDF_MODULE,
- "Allocation of %" TIFF_UINT64_FORMAT " bytes is forbidden. Limit is %" TIFF_UINT64_FORMAT ". Use -m option to change limit",
- (uint64)t2p->tiff_datasize, (uint64)t2p->tiff_maxdatasize);
+ "Allocation of %" PRIu64 " bytes is forbidden. Limit is %" PRIu64 ". Use -m option to change limit",
+ (uint64_t)t2p->tiff_datasize, (uint64_t)t2p->tiff_maxdatasize);
t2p->t2p_error = T2P_ERR_ERROR;
return (0);
}
@@ -5698,8 +5698,8 @@ tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){
t2p_read_tiff_size(t2p, input);
if (t2p->tiff_maxdatasize && (t2p->tiff_datasize > t2p->tiff_maxdatasize)) {
TIFFError(TIFF2PDF_MODULE,
- "Allocation of %" TIFF_UINT64_FORMAT " bytes is forbidden. Limit is %" TIFF_UINT64_FORMAT ". Use -m option to change limit",
- (uint64)t2p->tiff_datasize, (uint64)t2p->tiff_maxdatasize);
+ "Allocation of %" PRIu64 " bytes is forbidden. Limit is %" PRIu64 ". Use -m option to change limit",
+ (uint64_t)t2p->tiff_datasize, (uint64_t)t2p->tiff_maxdatasize);
t2p->t2p_error = T2P_ERR_ERROR;
return (0);
}
diff --git a/tools/tiff2ps.c b/tools/tiff2ps.c
index f59873fb..4bbd7d90 100644
--- a/tools/tiff2ps.c
+++ b/tools/tiff2ps.c
@@ -171,7 +171,7 @@
#define EXP_ASCII85ENCODER
/*
- * NB: this code assumes uint32 works with printf's %l[ud].
+ * NB: this code assumes uint32_t works with printf's %l[ud].
*/
#ifndef TRUE
#define TRUE 1
@@ -203,7 +203,7 @@ char *title = NULL; /* optional document title string */
char *creator = NULL; /* optional document creator string */
char pageOrientation[12]; /* set optional PageOrientation DSC to Landscape or Portrait */
int useImagemask = FALSE; /* Use imagemask instead of image operator */
-uint16 res_unit = 0; /* Resolution units: 2 - inches, 3 - cm */
+uint16_t res_unit = 0; /* Resolution units: 2 - inches, 3 - cm */
/*
* ASCII85 Encoding Support.
@@ -213,14 +213,14 @@ int ascii85count;
int ascii85breaklen;
int TIFF2PS(FILE*, TIFF*, double, double, double, double, int);
-void PSpage(FILE*, TIFF*, uint32, uint32);
-void PSColorContigPreamble(FILE*, uint32, uint32, int);
-void PSColorSeparatePreamble(FILE*, uint32, uint32, int);
-void PSDataColorContig(FILE*, TIFF*, uint32, uint32, int);
-void PSDataColorSeparate(FILE*, TIFF*, uint32, uint32, int);
-void PSDataPalette(FILE*, TIFF*, uint32, uint32);
-void PSDataBW(FILE*, TIFF*, uint32, uint32);
-void PSRawDataBW(FILE*, TIFF*, uint32, uint32);
+void PSpage(FILE*, TIFF*, uint32_t, uint32_t);
+void PSColorContigPreamble(FILE*, uint32_t, uint32_t, int);
+void PSColorSeparatePreamble(FILE*, uint32_t, uint32_t, int);
+void PSDataColorContig(FILE*, TIFF*, uint32_t, uint32_t, int);
+void PSDataColorSeparate(FILE*, TIFF*, uint32_t, uint32_t, int);
+void PSDataPalette(FILE*, TIFF*, uint32_t, uint32_t);
+void PSDataBW(FILE*, TIFF*, uint32_t, uint32_t);
+void PSRawDataBW(FILE*, TIFF*, uint32_t, uint32_t);
void Ascii85Init(void);
void Ascii85Put(unsigned char code, FILE* fd);
void Ascii85Flush(FILE* fd);
@@ -239,7 +239,7 @@ int exportMaskedImage(FILE *, double, double, double, double, int, int,
double, double, double, int, int);
#if defined( EXP_ASCII85ENCODER)
-tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, tsize_t raw_l );
+tsize_t Ascii85EncodeBlock(uint8_t * ascii85_p, unsigned f_eod, const uint8_t * raw_p, tsize_t raw_l );
#endif
static void usage(int);
@@ -250,8 +250,8 @@ static void usage(int);
static void* limitMalloc(tmsize_t s)
{
if (maxMalloc && (s > maxMalloc)) {
- fprintf(stderr, "MemoryLimitError: allocation of %" TIFF_UINT64_FORMAT " bytes is forbidden. Limit is %" TIFF_UINT64_FORMAT ".\n",
- (uint64)s, (uint64)maxMalloc);
+ fprintf(stderr, "MemoryLimitError: allocation of %" PRIu64 " bytes is forbidden. Limit is %" PRIu64 ".\n",
+ (uint64_t)s, (uint64_t)maxMalloc);
fprintf(stderr, " use -M option to change limit.\n");
return NULL;
}
@@ -267,7 +267,7 @@ main(int argc, char* argv[])
double leftmargin = 0;
double pageWidth = 0;
double pageHeight = 0;
- uint32 diroff = 0;
+ uint32_t diroff = 0;
#if !HAVE_DECL_OPTARG
extern char *optarg;
extern int optind;
@@ -333,7 +333,7 @@ main(int argc, char* argv[])
case '6':
case '7':
case '8':
- case '9': diroff = (uint32) strtoul(optarg, NULL, 0);
+ case '9': diroff = (uint32_t) strtoul(optarg, NULL, 0);
break;
default: TIFFError ("-o", "Offset must be a numeric value.");
exit (EXIT_FAILURE);
@@ -519,12 +519,12 @@ main(int argc, char* argv[])
return (EXIT_SUCCESS);
}
-static uint16 samplesperpixel;
-static uint16 bitspersample;
-static uint16 planarconfiguration;
-static uint16 photometric;
-static uint16 compression;
-static uint16 extrasamples;
+static uint16_t samplesperpixel;
+static uint16_t bitspersample;
+static uint16_t planarconfiguration;
+static uint16_t photometric;
+static uint16_t compression;
+static uint16_t extrasamples;
static int alpha;
static int
@@ -632,7 +632,7 @@ static const char RGBcolorimage[] = "\
* It is claimed to be part of some future revision of the EPS spec.
*/
static void
-PhotoshopBanner(FILE* fd, uint32 w, uint32 h, int bs, int nc, char* startline)
+PhotoshopBanner(FILE* fd, uint32_t w, uint32_t h, int bs, int nc, char* startline)
{
fprintf(fd, "%%ImageData: %ld %ld %d %d 0 %d 2 \"",
(long) w, (long) h, bitspersample, nc, bs);
@@ -648,7 +648,7 @@ PhotoshopBanner(FILE* fd, uint32 w, uint32 h, int bs, int nc, char* startline)
* pprh : image height in PS units (72 dpi)
*/
static void
-setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
+setupPageState(TIFF* tif, uint32_t* pw, uint32_t* ph, double* pprw, double* pprh)
{
float xres = 0.0F, yres = 0.0F;
@@ -699,7 +699,7 @@ setupPageState(TIFF* tif, uint32* pw, uint32* ph, double* pprw, double* pprh)
static int
isCCITTCompression(TIFF* tif)
{
- uint16 compress;
+ uint16_t compress;
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compress);
return (compress == COMPRESSION_CCITTFAX3 ||
compress == COMPRESSION_CCITTFAX4 ||
@@ -709,8 +709,8 @@ isCCITTCompression(TIFF* tif)
static tsize_t tf_bytesperrow;
static tsize_t ps_bytesperrow;
-static uint32 tf_rowsperstrip;
-static uint32 tf_numberstrips;
+static uint32_t tf_rowsperstrip;
+static uint32_t tf_numberstrips;
static char *hex = "0123456789abcdef";
/*
@@ -1512,15 +1512,15 @@ int get_viewport (double pgwidth, double pgheight, double pswidth, double psheig
int TIFF2PS(FILE* fd, TIFF* tif, double pgwidth, double pgheight, double lm, double bm, int center)
{
- uint32 pixwidth = 0, pixheight = 0; /* Image width and height in pixels */
+ uint32_t pixwidth = 0, pixheight = 0; /* Image width and height in pixels */
double ox = 0.0, oy = 0.0; /* Offset from current Postscript origin */
double pswidth, psheight; /* Original raw image width and height in points */
double view_width, view_height; /* Viewport width and height in points */
double scale = 1.0;
double left_offset = lm * PS_UNIT_SIZE;
double bottom_offset = bm * PS_UNIT_SIZE;
- uint32 subfiletype;
- uint16* sampleinfo;
+ uint32_t subfiletype;
+ uint16_t* sampleinfo;
static int npages = 0;
if (!TIFFGetField(tif, TIFFTAG_XPOSITION, &ox))
@@ -1729,7 +1729,7 @@ PSTail(FILE *fd, int npages)
}
static int
-checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
+checkcmap(TIFF* tif, int n, uint16_t* r, uint16_t* g, uint16_t* b)
{
(void) tif;
while (n-- > 0)
@@ -1742,7 +1742,7 @@ checkcmap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
static void
PS_Lvl2colorspace(FILE* fd, TIFF* tif)
{
- uint16 *rmap, *gmap, *bmap;
+ uint16_t *rmap, *gmap, *bmap;
int i, num_colors;
const char * colorspace_p;
@@ -1820,12 +1820,12 @@ PS_Lvl2colorspace(FILE* fd, TIFF* tif)
}
static int
-PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
int use_rawdata;
- uint32 tile_width, tile_height;
- uint16 predictor, minsamplevalue, maxsamplevalue;
- uint32 repeat_count;
+ uint32_t tile_width, tile_height;
+ uint16_t predictor, minsamplevalue, maxsamplevalue;
+ uint32_t repeat_count;
char im_h[64], im_x[64], im_y[64];
char * imageOp = "image";
@@ -1993,7 +1993,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
case COMPRESSION_CCITTFAX4: /* 4: CCITT Group 4 fax encoding */
fputs("\n\t<<\n", fd);
if (compression == COMPRESSION_CCITTFAX3) {
- uint32 g3_options;
+ uint32_t g3_options;
fputs("\t /EndOfLine true\n", fd);
fputs("\t /EndOfBlock false\n", fd);
@@ -2008,7 +2008,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
fputs("\t /EncodedByteAlign true\n", fd);
}
if (compression == COMPRESSION_CCITTFAX4) {
- uint32 g4_options;
+ uint32_t g4_options;
fputs("\t /K -1\n", fd);
TIFFGetFieldDefaulted(tif, TIFFTAG_GROUP4OPTIONS,
@@ -2098,7 +2098,7 @@ PS_Lvl2ImageDict(FILE* fd, TIFF* tif, uint32 w, uint32 h)
}
if (planarconfiguration == PLANARCONFIG_SEPARATE &&
samplesperpixel > 1) {
- uint16 i;
+ uint16_t i;
/*
* NOTE: This code does not work yet...
@@ -2171,18 +2171,18 @@ PS_FlipBytes(unsigned char* buf, tsize_t count)
#define MAXLINE 36
int
-PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PS_Lvl2page(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
- uint16 fillorder;
+ uint16_t fillorder;
int use_rawdata, tiled_image, breaklen = MAXLINE;
- uint32 chunk_no, num_chunks;
- uint64 *bc;
+ uint32_t chunk_no, num_chunks;
+ uint64_t *bc;
unsigned char *buf_data, *cp;
tsize_t chunk_size, byte_count;
#if defined( EXP_ASCII85ENCODER )
tsize_t ascii85_l; /* Length, in bytes, of ascii85_p[] data */
- uint8 * ascii85_p = 0; /* Holds ASCII85 encoded data */
+ uint8_t * ascii85_p = 0; /* Holds ASCII85 encoded data */
#endif
PS_Lvl2colorspace(fd, tif);
@@ -2360,7 +2360,7 @@ PS_Lvl2page(FILE* fd, TIFF* tif, uint32 w, uint32 h)
}
void
-PSpage(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PSpage(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
char * imageOp = "image";
@@ -2423,7 +2423,7 @@ PSpage(FILE* fd, TIFF* tif, uint32 w, uint32 h)
}
void
-PSColorContigPreamble(FILE* fd, uint32 w, uint32 h, int nc)
+PSColorContigPreamble(FILE* fd, uint32_t w, uint32_t h, int nc)
{
ps_bytesperrow = nc * (tf_bytesperrow / samplesperpixel);
PhotoshopBanner(fd, w, h, 1, nc, "false %d colorimage");
@@ -2437,7 +2437,7 @@ PSColorContigPreamble(FILE* fd, uint32 w, uint32 h, int nc)
}
void
-PSColorSeparatePreamble(FILE* fd, uint32 w, uint32 h, int nc)
+PSColorSeparatePreamble(FILE* fd, uint32_t w, uint32_t h, int nc)
{
int i;
@@ -2462,9 +2462,9 @@ PSColorSeparatePreamble(FILE* fd, uint32 w, uint32 h, int nc)
#define PUTHEX(c,fd) putc(hex[((c)>>4)&0xf],fd); putc(hex[(c)&0xf],fd)
void
-PSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
+PSDataColorContig(FILE* fd, TIFF* tif, uint32_t w, uint32_t h, int nc)
{
- uint32 row;
+ uint32_t row;
int breaklen = MAXLINE, es = samplesperpixel - nc;
tsize_t cc;
unsigned char *tf_buf;
@@ -2534,9 +2534,9 @@ PSDataColorContig(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
}
void
-PSDataColorSeparate(FILE* fd, TIFF* tif, uint32 w, uint32 h, int nc)
+PSDataColorSeparate(FILE* fd, TIFF* tif, uint32_t w, uint32_t h, int nc)
{
- uint32 row;
+ uint32_t row;
int breaklen = MAXLINE;
tsize_t cc;
tsample_t s, maxs;
@@ -2569,10 +2569,10 @@ end_loop:
PUTHEX(rmap[c],fd); PUTHEX(gmap[c],fd); PUTHEX(bmap[c],fd)
void
-PSDataPalette(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PSDataPalette(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
- uint16 *rmap, *gmap, *bmap;
- uint32 row;
+ uint16_t *rmap, *gmap, *bmap;
+ uint32_t row;
int breaklen = MAXLINE, nc;
tsize_t cc;
unsigned char *tf_buf;
@@ -2643,7 +2643,7 @@ end_loop:
}
void
-PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PSDataBW(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
int breaklen = MAXLINE;
unsigned char* tf_buf;
@@ -2653,7 +2653,7 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
#if defined( EXP_ASCII85ENCODER )
tsize_t ascii85_l; /* Length, in bytes, of ascii85_p[] data */
- uint8 *ascii85_p = 0; /* Holds ASCII85 encoded data */
+ uint8_t *ascii85_p = 0; /* Holds ASCII85 encoded data */
#endif
(void) w; (void) h;
@@ -2773,20 +2773,20 @@ PSDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
}
void
-PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
+PSRawDataBW(FILE* fd, TIFF* tif, uint32_t w, uint32_t h)
{
- uint64 *bc;
- uint32 bufsize;
+ uint64_t *bc;
+ uint32_t bufsize;
int breaklen = MAXLINE;
tmsize_t cc;
- uint16 fillorder;
+ uint16_t fillorder;
unsigned char *tf_buf;
unsigned char *cp, c;
tstrip_t s;
#if defined( EXP_ASCII85ENCODER )
tsize_t ascii85_l; /* Length, in bytes, of ascii85_p[] data */
- uint8 * ascii85_p = 0; /* Holds ASCII85 encoded data */
+ uint8_t * ascii85_p = 0; /* Holds ASCII85 encoded data */
#endif
(void) w; (void) h;
@@ -2797,11 +2797,11 @@ PSRawDataBW(FILE* fd, TIFF* tif, uint32 w, uint32 h)
* Find largest strip:
*/
- bufsize = (uint32) bc[0];
+ bufsize = (uint32_t) bc[0];
for ( s = 0; ++s < tf_numberstrips; ) {
if ( bc[s] > bufsize )
- bufsize = (uint32) bc[s];
+ bufsize = (uint32_t) bc[s];
}
tf_buf = (unsigned char*) limitMalloc(bufsize);
@@ -2881,12 +2881,12 @@ static char*
Ascii85Encode(unsigned char* raw)
{
static char encoded[6];
- uint32 word;
+ uint32_t word;
word = (((raw[0]<<8)+raw[1])<<16) + (raw[2]<<8) + raw[3];
if (word != 0L) {
- uint32 q;
- uint16 w1;
+ uint32_t q;
+ uint16_t w1;
q = word / (85L*85*85*85); /* actually only a byte */
encoded[0] = (char) (q + '!');
@@ -2897,7 +2897,7 @@ Ascii85Encode(unsigned char* raw)
word -= q * (85L*85*85); q = word / (85*85);
encoded[2] = (char) (q + '!');
- w1 = (uint16) (word - q*(85L*85));
+ w1 = (uint16_t) (word - q * (85L * 85));
encoded[3] = (char) ((w1 / 85) + '!');
encoded[4] = (char) ((w1 % 85) + '!');
encoded[5] = '\0';
@@ -2983,13 +2983,13 @@ Ascii85Flush(FILE* fd)
*
*****************************************************************************/
-tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw_p, tsize_t raw_l )
+tsize_t Ascii85EncodeBlock(uint8_t * ascii85_p, unsigned f_eod, const uint8_t * raw_p, tsize_t raw_l )
{
char ascii85[5]; /* Encoded 5 tuple */
tsize_t ascii85_l; /* Number of bytes written to ascii85_p[] */
int rc; /* Return code */
- uint32 val32; /* Unencoded 4 tuple */
+ uint32_t val32; /* Unencoded 4 tuple */
ascii85_l = 0; /* Nothing written yet */
@@ -2999,10 +2999,10 @@ tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw
for ( ; raw_l > 3; raw_l -= 4 )
{
- val32 = (uint32)*(++raw_p) << 24;
- val32 += (uint32)*(++raw_p) << 16;
- val32 += (uint32)*(++raw_p) << 8;
- val32 += (uint32)*(++raw_p);
+ val32 = (uint32_t)*(++raw_p) << 24;
+ val32 += (uint32_t)*(++raw_p) << 16;
+ val32 += (uint32_t)*(++raw_p) << 8;
+ val32 += (uint32_t)*(++raw_p);
if ( val32 == 0 ) /* Special case */
{
@@ -3047,7 +3047,7 @@ tsize_t Ascii85EncodeBlock( uint8 * ascii85_p, unsigned f_eod, const uint8 * raw
tsize_t len; /* Output this many bytes */
len = raw_l + 1;
- val32 = (uint32)*++raw_p << 24; /* Prime the pump */
+ val32 = (uint32_t)*++raw_p << 24; /* Prime the pump */
if ( --raw_l > 0 ) val32 += *(++raw_p) << 16;
if ( --raw_l > 0 ) val32 += *(++raw_p) << 8;
diff --git a/tools/tiff2rgba.c b/tools/tiff2rgba.c
index a89b7e31..d8ba5990 100644
--- a/tools/tiff2rgba.c
+++ b/tools/tiff2rgba.c
@@ -50,10 +50,10 @@
#ifndef howmany
#define howmany(x, y) (((x)+((y)-1))/(y))
#endif
-#define roundup(x, y) (howmany(x,y)*((uint32)(y)))
+#define roundup(x, y) (howmany(x,y)*((uint32_t)(y)))
-static uint16 compression = COMPRESSION_PACKBITS;
-static uint32 rowsperstrip = (uint32) -1;
+static uint16_t compression = COMPRESSION_PACKBITS;
+static uint32_t rowsperstrip = (uint32_t) -1;
static int process_by_block = 0; /* default is whole image at once */
static int no_alpha = 0;
static int bigtiff_output = 0;
@@ -153,13 +153,13 @@ static int
cvt_by_tile( TIFF *in, TIFF *out )
{
- uint32* raster; /* retrieve RGBA image */
- uint32 width, height; /* image width & height */
- uint32 tile_width, tile_height;
- uint32 row, col;
- uint32 *wrk_line;
+ uint32_t* raster; /* retrieve RGBA image */
+ uint32_t width, height; /* image width & height */
+ uint32_t tile_width, tile_height;
+ uint32_t row, col;
+ uint32_t *wrk_line;
int ok = 1;
- uint32 rastersize, wrk_linesize;
+ uint32_t rastersize, wrk_linesize;
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
@@ -176,13 +176,13 @@ cvt_by_tile( TIFF *in, TIFF *out )
/*
* Allocate tile buffer
*/
- rastersize = tile_width * tile_height * sizeof (uint32);
- if (tile_width != (rastersize / tile_height) / sizeof( uint32))
+ rastersize = tile_width * tile_height * sizeof (uint32_t);
+ if (tile_width != (rastersize / tile_height) / sizeof( uint32_t))
{
TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer");
exit(EXIT_FAILURE);
}
- raster = (uint32*)_TIFFmalloc(rastersize);
+ raster = (uint32_t*)_TIFFmalloc(rastersize);
if (raster == 0) {
TIFFError(TIFFFileName(in), "No space for raster buffer");
return (0);
@@ -192,13 +192,13 @@ cvt_by_tile( TIFF *in, TIFF *out )
* Allocate a scanline buffer for swapping during the vertical
* mirroring pass.
*/
- wrk_linesize = tile_width * sizeof (uint32);
- if (tile_width != wrk_linesize / sizeof (uint32))
+ wrk_linesize = tile_width * sizeof (uint32_t);
+ if (tile_width != wrk_linesize / sizeof (uint32_t))
{
TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer");
exit(EXIT_FAILURE);
}
- wrk_line = (uint32*)_TIFFmalloc(wrk_linesize);
+ wrk_line = (uint32_t*)_TIFFmalloc(wrk_linesize);
if (!wrk_line) {
TIFFError(TIFFFileName(in), "No space for raster scanline buffer");
ok = 0;
@@ -211,7 +211,7 @@ cvt_by_tile( TIFF *in, TIFF *out )
{
for( col = 0; ok && col < width; col += tile_width )
{
- uint32 i_row;
+ uint32_t i_row;
/* Read the tile into an RGBA array */
if (!TIFFReadRGBATile(in, col, row, raster)) {
@@ -234,7 +234,7 @@ cvt_by_tile( TIFF *in, TIFF *out )
*/
for( i_row = 0; i_row < tile_height / 2; i_row++ )
{
- uint32 *top_line, *bottom_line;
+ uint32_t *top_line, *bottom_line;
top_line = raster + tile_width * i_row;
bottom_line = raster + tile_width * (tile_height-i_row-1);
@@ -269,12 +269,12 @@ static int
cvt_by_strip( TIFF *in, TIFF *out )
{
- uint32* raster; /* retrieve RGBA image */
- uint32 width, height; /* image width & height */
- uint32 row;
- uint32 *wrk_line;
+ uint32_t* raster; /* retrieve RGBA image */
+ uint32_t width, height; /* image width & height */
+ uint32_t row;
+ uint32_t *wrk_line;
int ok = 1;
- uint32 rastersize, wrk_linesize;
+ uint32_t rastersize, wrk_linesize;
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
@@ -289,13 +289,13 @@ cvt_by_strip( TIFF *in, TIFF *out )
/*
* Allocate strip buffer
*/
- rastersize = width * rowsperstrip * sizeof (uint32);
- if (width != (rastersize / rowsperstrip) / sizeof( uint32))
+ rastersize = width * rowsperstrip * sizeof (uint32_t);
+ if (width != (rastersize / rowsperstrip) / sizeof( uint32_t))
{
TIFFError(TIFFFileName(in), "Integer overflow when calculating raster buffer");
exit(EXIT_FAILURE);
}
- raster = (uint32*)_TIFFmalloc(rastersize);
+ raster = (uint32_t*)_TIFFmalloc(rastersize);
if (raster == 0) {
TIFFError(TIFFFileName(in), "No space for raster buffer");
return (0);
@@ -305,13 +305,13 @@ cvt_by_strip( TIFF *in, TIFF *out )
* Allocate a scanline buffer for swapping during the vertical
* mirroring pass.
*/
- wrk_linesize = width * sizeof (uint32);
- if (width != wrk_linesize / sizeof (uint32))
+ wrk_linesize = width * sizeof (uint32_t);
+ if (width != wrk_linesize / sizeof (uint32_t))
{
TIFFError(TIFFFileName(in), "Integer overflow when calculating wrk_line buffer");
exit(EXIT_FAILURE);
}
- wrk_line = (uint32*)_TIFFmalloc(wrk_linesize);
+ wrk_line = (uint32_t*)_TIFFmalloc(wrk_linesize);
if (!wrk_line) {
TIFFError(TIFFFileName(in), "No space for raster scanline buffer");
ok = 0;
@@ -353,7 +353,7 @@ cvt_by_strip( TIFF *in, TIFF *out )
for( i_row = 0; i_row < rows_to_write / 2; i_row++ )
{
- uint32 *top_line, *bottom_line;
+ uint32_t *top_line, *bottom_line;
top_line = raster + width * i_row;
bottom_line = raster + width * (rows_to_write-i_row-1);
@@ -393,9 +393,9 @@ static int
cvt_whole_image( TIFF *in, TIFF *out )
{
- uint32* raster; /* retrieve RGBA image */
- uint32 width, height; /* image width & height */
- uint32 row;
+ uint32_t* raster; /* retrieve RGBA image */
+ uint32_t width, height; /* image width & height */
+ uint32_t row;
size_t pixel_count;
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
@@ -409,20 +409,20 @@ cvt_whole_image( TIFF *in, TIFF *out )
(unsigned long)width, (unsigned long)height);
return 0;
}
- if (maxMalloc != 0 && (tmsize_t)pixel_count * (tmsize_t)sizeof(uint32) > maxMalloc) {
+ if (maxMalloc != 0 && (tmsize_t)pixel_count * (tmsize_t)sizeof(uint32_t) > maxMalloc) {
TIFFError(TIFFFileName(in),
- "Raster size %" TIFF_UINT64_FORMAT " over memory limit (%" TIFF_UINT64_FORMAT "), try -b option.",
- (uint64)pixel_count * sizeof(uint32), (uint64)maxMalloc);
+ "Raster size %" PRIu64 " over memory limit (%" PRIu64 "), try -b option.",
+ (uint64_t)pixel_count * sizeof(uint32_t), (uint64_t)maxMalloc);
return 0;
}
rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
- raster = (uint32*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32), "raster buffer");
+ raster = (uint32_t*)_TIFFCheckMalloc(in, pixel_count, sizeof(uint32_t), "raster buffer");
if (raster == 0) {
TIFFError(TIFFFileName(in), "Failed to allocate buffer (%lu elements of %lu each)",
- (unsigned long)pixel_count, (unsigned long)sizeof(uint32));
+ (unsigned long)pixel_count, (unsigned long)sizeof(uint32_t));
return (0);
}
@@ -502,12 +502,12 @@ cvt_whole_image( TIFF *in, TIFF *out )
static int
tiffcvt(TIFF* in, TIFF* out)
{
- uint32 width, height; /* image width & height */
- uint16 shortv;
+ uint32_t width, height; /* image width & height */
+ uint16_t shortv;
float floatv;
char *stringv;
- uint32 longv;
- uint16 v[1];
+ uint32_t longv;
+ uint16_t v[1];
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &height);
@@ -543,8 +543,8 @@ tiffcvt(TIFF* in, TIFF* out)
if (maxMalloc != 0 && TIFFStripSize(in) > maxMalloc)
{
TIFFError(TIFFFileName(in),
- "Strip Size %" TIFF_UINT64_FORMAT " over memory limit (%" TIFF_UINT64_FORMAT ")",
- (uint64)TIFFStripSize(in), (uint64)maxMalloc);
+ "Strip Size %" PRIu64 " over memory limit (%" PRIu64 ")",
+ (uint64_t)TIFFStripSize(in), (uint64_t)maxMalloc);
return 0;
}
if( process_by_block && TIFFIsTiled( in ) )
diff --git a/tools/tiffcmp.c b/tools/tiffcmp.c
index 88273e65..51374a1f 100644
--- a/tools/tiffcmp.c
+++ b/tools/tiffcmp.c
@@ -45,21 +45,21 @@
static int stopondiff = 1;
static int stoponfirsttag = 1;
-static uint16 bitspersample = 1;
-static uint16 samplesperpixel = 1;
-static uint16 sampleformat = SAMPLEFORMAT_UINT;
-static uint32 imagewidth;
-static uint32 imagelength;
+static uint16_t bitspersample = 1;
+static uint16_t samplesperpixel = 1;
+static uint16_t sampleformat = SAMPLEFORMAT_UINT;
+static uint32_t imagewidth;
+static uint32_t imagelength;
static void usage(int code);
static int tiffcmp(TIFF*, TIFF*);
static int cmptags(TIFF*, TIFF*);
-static int ContigCompare(int, uint32, unsigned char*, unsigned char*, tsize_t);
-static int SeparateCompare(int, int, uint32, unsigned char*, unsigned char*);
-static void PrintIntDiff(uint32, int, uint32, uint32, uint32);
-static void PrintFloatDiff(uint32, int, uint32, double, double);
+static int ContigCompare(int, uint32_t, unsigned char*, unsigned char*, tsize_t);
+static int SeparateCompare(int, int, uint32_t, unsigned char*, unsigned char*);
+static void PrintIntDiff(uint32_t, int, uint32_t, uint32_t, uint32_t);
+static void PrintFloatDiff(uint32_t, int, uint32_t, double, double);
-static void leof(const char*, uint32, int);
+static void leof(const char*, uint32_t, int);
/*
* exit with status :
@@ -156,9 +156,9 @@ static int CheckStringTag(TIFF*, TIFF*, int, char*);
static int
tiffcmp(TIFF* tif1, TIFF* tif2)
{
- uint16 config1, config2;
+ uint16_t config1, config2;
tsize_t size1;
- uint32 row;
+ uint32_t row;
tsample_t s;
unsigned char *buf1, *buf2;
@@ -264,7 +264,7 @@ bad1:
static int
cmptags(TIFF* tif1, TIFF* tif2)
{
- uint16 compression1, compression2;
+ uint16_t compression1, compression2;
CmpLongField(TIFFTAG_SUBFILETYPE, "SubFileType");
CmpLongField(TIFFTAG_IMAGEWIDTH, "ImageWidth");
CmpLongField(TIFFTAG_IMAGELENGTH, "ImageLength");
@@ -303,13 +303,13 @@ cmptags(TIFF* tif1, TIFF* tif2)
CmpShortField(TIFFTAG_GRAYRESPONSEUNIT, "GrayResponseUnit");
CmpShortField(TIFFTAG_COLORRESPONSEUNIT, "ColorResponseUnit");
#ifdef notdef
- { uint16 *graycurve;
+ { uint16_t *graycurve;
CmpField(TIFFTAG_GRAYRESPONSECURVE, graycurve);
}
- { uint16 *red, *green, *blue;
+ { uint16_t *red, *green, *blue;
CmpField3(TIFFTAG_COLORRESPONSECURVE, red, green, blue);
}
- { uint16 *red, *green, *blue;
+ { uint16_t *red, *green, *blue;
CmpField3(TIFFTAG_COLORMAP, red, green, blue);
}
#endif
@@ -329,10 +329,10 @@ cmptags(TIFF* tif1, TIFF* tif2)
}
static int
-ContigCompare(int sample, uint32 row,
- unsigned char* p1, unsigned char* p2, tsize_t size)
+ContigCompare(int sample, uint32_t row,
+ unsigned char* p1, unsigned char* p2, tsize_t size)
{
- uint32 pix;
+ uint32_t pix;
int samples_to_test;
if (memcmp(p1, p2, size) == 0)
@@ -367,7 +367,7 @@ ContigCompare(int sample, uint32 row,
}
case 16:
{
- uint16 *pix1 = (uint16 *)p1, *pix2 = (uint16 *)p2;
+ uint16_t *pix1 = (uint16_t *)p1, *pix2 = (uint16_t *)p2;
for (pix = 0; pix < imagewidth; pix++) {
int s;
@@ -385,7 +385,7 @@ ContigCompare(int sample, uint32 row,
case 32:
if (sampleformat == SAMPLEFORMAT_UINT
|| sampleformat == SAMPLEFORMAT_INT) {
- uint32 *pix1 = (uint32 *)p1, *pix2 = (uint32 *)p2;
+ uint32_t *pix1 = (uint32_t *)p1, *pix2 = (uint32_t *)p2;
for (pix = 0; pix < imagewidth; pix++) {
int s;
@@ -431,7 +431,7 @@ ContigCompare(int sample, uint32 row,
}
static void
-PrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2)
+PrintIntDiff(uint32_t row, int sample, uint32_t pix, uint32_t w1, uint32_t w2)
{
if (sample < 0)
sample = 0;
@@ -440,10 +440,10 @@ PrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2)
case 2:
case 4:
{
- int32 mask1, mask2, s;
+ int32_t mask1, mask2, s;
/* mask1 should have the n lowest bits set, where n == bitspersample */
- mask1 = ((int32)1 << bitspersample) - 1;
+ mask1 = ((int32_t)1 << bitspersample) - 1;
s = (8 - bitspersample);
mask2 = mask1 << s;
for (; mask2 && pix < imagewidth;
@@ -489,7 +489,7 @@ PrintIntDiff(uint32 row, int sample, uint32 pix, uint32 w1, uint32 w2)
}
static void
-PrintFloatDiff(uint32 row, int sample, uint32 pix, double w1, double w2)
+PrintFloatDiff(uint32_t row, int sample, uint32_t pix, double w1, double w2)
{
if (sample < 0)
sample = 0;
@@ -506,10 +506,10 @@ PrintFloatDiff(uint32 row, int sample, uint32 pix, double w1, double w2)
}
static int
-SeparateCompare(int reversed, int sample, uint32 row,
- unsigned char* cp1, unsigned char* p2)
+SeparateCompare(int reversed, int sample, uint32_t row,
+ unsigned char* cp1, unsigned char* p2)
{
- uint32 npixels = imagewidth;
+ uint32_t npixels = imagewidth;
int pixel;
cp1 += sample;
@@ -559,14 +559,14 @@ checkTag(TIFF* tif1, TIFF* tif2, int tag, char* name, void* p1, void* p2)
static int
CheckShortTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
{
- uint16 v1, v2;
+ uint16_t v1, v2;
CHECK(v1 == v2, "%s: %u %u\n");
}
static int
CheckShort2Tag(TIFF* tif1, TIFF* tif2, int tag, char* name)
{
- uint16 v11, v12, v21, v22;
+ uint16_t v11, v12, v21, v22;
if (TIFFGetField(tif1, tag, &v11, &v12)) {
if (!TIFFGetField(tif2, tag, &v21, &v22)) {
@@ -587,8 +587,8 @@ CheckShort2Tag(TIFF* tif1, TIFF* tif2, int tag, char* name)
static int
CheckShortArrayTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
{
- uint16 n1, *a1;
- uint16 n2, *a2;
+ uint16_t n1, *a1;
+ uint16_t n2, *a2;
if (TIFFGetField(tif1, tag, &n1, &a1)) {
if (!TIFFGetField(tif2, tag, &n2, &a2)) {
@@ -598,9 +598,9 @@ CheckShortArrayTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
}
if (n1 == n2) {
char* sep;
- uint16 i;
+ uint16_t i;
- if (memcmp(a1, a2, n1 * sizeof(uint16)) == 0)
+ if (memcmp(a1, a2, n1 * sizeof(uint16_t)) == 0)
return (1);
printf("%s: value mismatch, <%u:", name, n1);
sep = "";
@@ -626,7 +626,7 @@ CheckShortArrayTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
static int
CheckLongTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
{
- uint32 v1, v2;
+ uint32_t v1, v2;
CHECK(v1 == v2, "%s: %u %u\n");
}
@@ -645,7 +645,7 @@ CheckStringTag(TIFF* tif1, TIFF* tif2, int tag, char* name)
}
static void
-leof(const char* name, uint32 row, int s)
+leof(const char* name, uint32_t row, int s)
{
printf("%s: EOF at scanline %lu", name, (unsigned long)row);
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index af760068..dd9ee768 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -72,23 +72,23 @@
static tmsize_t maxMalloc = DEFAULT_MAX_MALLOC;
static int outtiled = -1;
-static uint32 tilewidth;
-static uint32 tilelength;
+static uint32_t tilewidth;
+static uint32_t tilelength;
-static uint16 config;
-static uint16 compression;
-static uint16 predictor;
+static uint16_t config;
+static uint16_t compression;
+static uint16_t predictor;
static int preset;
-static uint16 fillorder;
-static uint16 orientation;
-static uint32 rowsperstrip;
-static uint32 g3opts;
+static uint16_t fillorder;
+static uint16_t orientation;
+static uint32_t rowsperstrip;
+static uint32_t g3opts;
static int ignore = FALSE; /* if true, ignore read errors */
-static uint32 defg3opts = (uint32) -1;
+static uint32_t defg3opts = (uint32_t) -1;
static int quality = 75; /* JPEG quality */
static int jpegcolormode = JPEGCOLORMODE_RGB;
-static uint16 defcompression = (uint16) -1;
-static uint16 defpredictor = (uint16) -1;
+static uint16_t defcompression = (uint16_t) -1;
+static uint16_t defpredictor = (uint16_t) -1;
static int defpreset = -1;
static int subcodec = -1;
@@ -107,8 +107,8 @@ static int pageInSeq = 0;
static void* limitMalloc(tmsize_t s)
{
if (maxMalloc && (s > maxMalloc)) {
- fprintf(stderr, "MemoryLimitError: allocation of %" TIFF_UINT64_FORMAT " bytes is forbidden. Limit is %" TIFF_UINT64_FORMAT ".\n",
- (uint64)s, (uint64)maxMalloc);
+ fprintf(stderr, "MemoryLimitError: allocation of %" PRIu64 " bytes is forbidden. Limit is %" PRIu64 ".\n",
+ (uint64_t)s, (uint64_t)maxMalloc);
fprintf(stderr, " use -m option to change limit.\n");
return NULL;
}
@@ -178,12 +178,12 @@ static TIFF* openSrcImage (char **imageSpec)
int
main(int argc, char* argv[])
{
- uint16 defconfig = (uint16) -1;
- uint16 deffillorder = 0;
- uint32 deftilewidth = (uint32) -1;
- uint32 deftilelength = (uint32) -1;
- uint32 defrowsperstrip = (uint32) 0;
- uint64 diroff = 0;
+ uint16_t defconfig = (uint16_t) -1;
+ uint16_t deffillorder = 0;
+ uint32_t deftilewidth = (uint32_t) -1;
+ uint32_t deftilelength = (uint32_t) -1;
+ uint32_t defrowsperstrip = (uint32_t) 0;
+ uint64_t diroff = 0;
TIFF* in;
TIFF* out;
char mode[10];
@@ -211,7 +211,7 @@ main(int argc, char* argv[])
exit (EXIT_FAILURE);
}
{
- uint16 samples = (uint16) -1;
+ uint16_t samples = (uint16_t) -1;
char **biasFn = &optarg;
bias = openSrcImage (biasFn);
if (!bias) exit (EXIT_FAILURE);
@@ -313,7 +313,7 @@ main(int argc, char* argv[])
}
if (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {
TIFFError(TIFFFileName(in),
- "Error, setting subdirectory at %" TIFF_UINT64_FORMAT, diroff);
+ "Error, setting subdirectory at %" PRIu64, diroff);
(void) TIFFClose(in);
(void) TIFFClose(out);
return (EXIT_FAILURE);
@@ -367,7 +367,7 @@ static void
processG3Options(char* cp)
{
if( (cp = strchr(cp, ':')) ) {
- if (defg3opts == (uint32) -1)
+ if (defg3opts == (uint32_t) -1)
defg3opts = 0;
do {
cp++;
@@ -555,27 +555,27 @@ usage(int code)
if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
static void
-cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+cpTag(TIFF* in, TIFF* out, uint16_t tag, uint16_t count, TIFFDataType type)
{
switch (type) {
case TIFF_SHORT:
if (count == 1) {
- uint16 shortv;
+ uint16_t shortv;
CopyField(tag, shortv);
} else if (count == 2) {
- uint16 shortv1, shortv2;
+ uint16_t shortv1, shortv2;
CopyField2(tag, shortv1, shortv2);
} else if (count == 4) {
- uint16 *tr, *tg, *tb, *ta;
+ uint16_t *tr, *tg, *tb, *ta;
CopyField4(tag, tr, tg, tb, ta);
- } else if (count == (uint16) -1) {
- uint16 shortv1;
- uint16* shortav;
+ } else if (count == (uint16_t) -1) {
+ uint16_t shortv1;
+ uint16_t* shortav;
CopyField2(tag, shortv1, shortav);
}
break;
case TIFF_LONG:
- { uint32 longv;
+ { uint32_t longv;
CopyField(tag, longv);
}
break;
@@ -583,7 +583,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
float floatv;
CopyField(tag, floatv);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
float* floatav;
CopyField(tag, floatav);
}
@@ -597,7 +597,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
double doublev;
CopyField(tag, doublev);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
double* doubleav;
CopyField(tag, doubleav);
}
@@ -610,8 +610,8 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
}
static const struct cpTag {
- uint16 tag;
- uint16 count;
+ uint16_t tag;
+ uint16_t count;
TIFFDataType type;
} tags[] = {
{ TIFFTAG_SUBFILETYPE, 1, TIFF_LONG },
@@ -622,56 +622,56 @@ static const struct cpTag {
{ TIFFTAG_MODEL, 1, TIFF_ASCII },
{ TIFFTAG_MINSAMPLEVALUE, 1, TIFF_SHORT },
{ TIFFTAG_MAXSAMPLEVALUE, 1, TIFF_SHORT },
- { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
- { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
- { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
- { TIFFTAG_DATETIME, 1, TIFF_ASCII },
- { TIFFTAG_ARTIST, 1, TIFF_ASCII },
- { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, (uint16) -1, TIFF_RATIONAL },
- { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
- { TIFFTAG_INKSET, 1, TIFF_SHORT },
- { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
- { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
- { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
- { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
- { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
- { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
- { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
+ { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
+ { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
+ { TIFFTAG_WHITEPOINT, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_PRIMARYCHROMATICITIES,(uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_EXTRASAMPLES, (uint16_t) -1, TIFF_SHORT },
+ { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
};
#define NTAGS (sizeof (tags) / sizeof (tags[0]))
#define CopyTag(tag, count, type) cpTag(in, out, tag, count, type)
typedef int (*copyFunc)
- (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);
-static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
+ (TIFF* in, TIFF* out, uint32_t l, uint32_t w, uint16_t samplesperpixel);
+static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16_t, uint16_t);
/* PODD */
static int
tiffcp(TIFF* in, TIFF* out)
{
- uint16 bitspersample = 1, samplesperpixel = 1;
- uint16 input_compression, input_photometric = PHOTOMETRIC_MINISBLACK;
+ uint16_t bitspersample = 1, samplesperpixel = 1;
+ uint16_t input_compression, input_photometric = PHOTOMETRIC_MINISBLACK;
copyFunc cf;
- uint32 width, length;
+ uint32_t width, length;
const struct cpTag* p;
CopyField(TIFFTAG_IMAGEWIDTH, width);
CopyField(TIFFTAG_IMAGELENGTH, length);
CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
- if (compression != (uint16)-1)
+ if (compression != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
else
CopyField(TIFFTAG_COMPRESSION, compression);
@@ -682,7 +682,7 @@ tiffcp(TIFF* in, TIFF* out)
TIFFSetField(in, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);
} else if (input_photometric == PHOTOMETRIC_YCBCR) {
/* Otherwise, can't handle subsampled input */
- uint16 subsamplinghor,subsamplingver;
+ uint16_t subsamplinghor,subsamplingver;
TIFFGetFieldDefaulted(in, TIFFTAG_YCBCRSUBSAMPLING,
&subsamplinghor, &subsamplingver);
@@ -754,9 +754,9 @@ tiffcp(TIFF* in, TIFF* out)
* input image or, if nothing is defined, use the
* library default.
*/
- if (tilewidth == (uint32) -1)
+ if (tilewidth == (uint32_t) -1)
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
- if (tilelength == (uint32) -1)
+ if (tilelength == (uint32_t) -1)
TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
TIFFDefaultTileSize(out, &tilewidth, &tilelength);
TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
@@ -767,20 +767,20 @@ tiffcp(TIFF* in, TIFF* out)
* value from the input image or, if nothing is defined,
* use the library default.
*/
- if (rowsperstrip == (uint32) 0) {
+ if (rowsperstrip == (uint32_t) 0) {
if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP,
&rowsperstrip)) {
rowsperstrip =
TIFFDefaultStripSize(out, rowsperstrip);
}
- if (rowsperstrip > length && rowsperstrip != (uint32)-1)
+ if (rowsperstrip > length && rowsperstrip != (uint32_t)-1)
rowsperstrip = length;
}
- else if (rowsperstrip == (uint32) -1)
+ else if (rowsperstrip == (uint32_t) -1)
rowsperstrip = length;
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
}
- if (config != (uint16) -1)
+ if (config != (uint16_t) -1)
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
else
CopyField(TIFFTAG_PLANARCONFIG, config);
@@ -804,7 +804,7 @@ tiffcp(TIFF* in, TIFF* out)
case COMPRESSION_DEFLATE:
case COMPRESSION_LZMA:
case COMPRESSION_ZSTD:
- if (predictor != (uint16)-1)
+ if (predictor != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
else
CopyField(TIFFTAG_PREDICTOR, predictor);
@@ -841,7 +841,7 @@ tiffcp(TIFF* in, TIFF* out)
case COMPRESSION_CCITTFAX3:
case COMPRESSION_CCITTFAX4:
if (compression == COMPRESSION_CCITTFAX3) {
- if (g3opts != (uint32) -1)
+ if (g3opts != (uint32_t) -1)
TIFFSetField(out, TIFFTAG_GROUP3OPTIONS,
g3opts);
else
@@ -857,13 +857,13 @@ tiffcp(TIFF* in, TIFF* out)
break;
}
{
- uint32 len32;
+ uint32_t len32;
void** data;
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
}
{
- uint16 ninks;
+ uint16_t ninks;
const char* inknames;
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
@@ -912,17 +912,17 @@ tiffcp(TIFF* in, TIFF* out)
*/
#define DECLAREcpFunc(x) \
static int x(TIFF* in, TIFF* out, \
- uint32 imagelength, uint32 imagewidth, tsample_t spp)
+ uint32_t imagelength, uint32_t imagewidth, tsample_t spp)
#define DECLAREreadFunc(x) \
static int x(TIFF* in, \
- uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
-typedef int (*readFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
+ uint8_t* buf, uint32_t imagelength, uint32_t imagewidth, tsample_t spp)
+typedef int (*readFunc)(TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t);
#define DECLAREwriteFunc(x) \
static int x(TIFF* out, \
- uint8* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
-typedef int (*writeFunc)(TIFF*, uint8*, uint32, uint32, tsample_t);
+ uint8_t* buf, uint32_t imagelength, uint32_t imagewidth, tsample_t spp)
+typedef int (*writeFunc)(TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t);
/*
* Contig -> contig by scanline for rows/strip change.
@@ -931,7 +931,7 @@ DECLAREcpFunc(cpContig2ContigByRow)
{
tsize_t scanlinesize = TIFFScanlineSize(in);
tdata_t buf;
- uint32 row;
+ uint32_t row;
buf = limitMalloc(scanlinesize);
if (!buf)
@@ -960,13 +960,13 @@ bad:
}
-typedef void biasFn (void *image, void *bias, uint32 pixels);
+typedef void biasFn (void *image, void *bias, uint32_t pixels);
#define subtract(bits) \
-static void subtract##bits (void *i, void *b, uint32 pixels)\
+static void subtract##bits (void *i, void *b, uint32_t pixels)\
{\
- uint##bits *image = i;\
- uint##bits *bias = b;\
+ uint##bits##_t *image = i;\
+ uint##bits##_t *bias = b;\
while (pixels--) {\
*image = *image > *bias ? *image-*bias : 0;\
image++, bias++; \
@@ -996,17 +996,17 @@ DECLAREcpFunc(cpBiasedContig2Contig)
tsize_t biasSize = TIFFScanlineSize(bias);
tsize_t bufSize = TIFFScanlineSize(in);
tdata_t buf, biasBuf;
- uint32 biasWidth = 0, biasLength = 0;
+ uint32_t biasWidth = 0, biasLength = 0;
TIFFGetField(bias, TIFFTAG_IMAGEWIDTH, &biasWidth);
TIFFGetField(bias, TIFFTAG_IMAGELENGTH, &biasLength);
if (biasSize == bufSize &&
imagelength == biasLength && imagewidth == biasWidth) {
- uint16 sampleBits = 0;
+ uint16_t sampleBits = 0;
biasFn *subtractLine;
TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &sampleBits);
subtractLine = lineSubtractFn (sampleBits);
if (subtractLine) {
- uint32 row;
+ uint32_t row;
buf = limitMalloc(bufSize);
biasBuf = limitMalloc(bufSize);
for (row = 0; row < imagelength; row++) {
@@ -1075,7 +1075,7 @@ DECLAREcpFunc(cpDecodedStrips)
(void) imagewidth; (void) spp;
if (buf) {
tstrip_t s, ns = TIFFNumberOfStrips(in);
- uint32 row = 0;
+ uint32_t row = 0;
_TIFFmemset(buf, 0, stripsize);
for (s = 0; s < ns && row < imagelength; s++) {
tsize_t cc = (row + rowsperstrip > imagelength) ?
@@ -1116,7 +1116,7 @@ DECLAREcpFunc(cpSeparate2SeparateByRow)
{
tsize_t scanlinesize = TIFFScanlineSize(in);
tdata_t buf;
- uint32 row;
+ uint32_t row;
tsample_t s;
(void) imagewidth;
@@ -1156,11 +1156,11 @@ DECLAREcpFunc(cpContig2SeparateByRow)
tsize_t scanlinesizeout = TIFFScanlineSize(out);
tdata_t inbuf;
tdata_t outbuf;
- register uint8 *inp, *outp;
- register uint32 n;
- uint32 row;
+ register uint8_t *inp, *outp;
+ register uint32_t n;
+ uint32_t row;
tsample_t s;
- uint16 bps = 0;
+ uint16_t bps = 0;
(void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
if( bps != 8 )
@@ -1187,8 +1187,8 @@ DECLAREcpFunc(cpContig2SeparateByRow)
(unsigned long) row);
goto bad;
}
- inp = ((uint8*)inbuf) + s;
- outp = (uint8*)outbuf;
+ inp = ((uint8_t*)inbuf) + s;
+ outp = (uint8_t*)outbuf;
for (n = imagewidth; n-- > 0;) {
*outp++ = *inp;
inp += spp;
@@ -1219,11 +1219,11 @@ DECLAREcpFunc(cpSeparate2ContigByRow)
tsize_t scanlinesizeout = TIFFScanlineSize(out);
tdata_t inbuf;
tdata_t outbuf;
- register uint8 *inp, *outp;
- register uint32 n;
- uint32 row;
+ register uint8_t *inp, *outp;
+ register uint32_t n;
+ uint32_t row;
tsample_t s;
- uint16 bps = 0;
+ uint16_t bps = 0;
(void) TIFFGetField(in, TIFFTAG_BITSPERSAMPLE, &bps);
if( bps != 8 )
@@ -1250,8 +1250,8 @@ DECLAREcpFunc(cpSeparate2ContigByRow)
(unsigned long) row);
goto bad;
}
- inp = (uint8*)inbuf;
- outp = ((uint8*)outbuf) + s;
+ inp = (uint8_t*)inbuf;
+ outp = ((uint8_t*)outbuf) + s;
for (n = imagewidth; n-- > 0;) {
*outp = *inp++;
outp += spp;
@@ -1274,11 +1274,11 @@ bad:
}
static void
-cpStripToTile(uint8* out, uint8* in,
- uint32 rows, uint32 cols, int outskew, int64 inskew)
+cpStripToTile(uint8_t* out, uint8_t* in,
+ uint32_t rows, uint32_t cols, int outskew, int64_t inskew)
{
while (rows-- > 0) {
- uint32 j = cols;
+ uint32_t j = cols;
while (j-- > 0)
*out++ = *in++;
out += outskew;
@@ -1287,12 +1287,12 @@ cpStripToTile(uint8* out, uint8* in,
}
static void
-cpContigBufToSeparateBuf(uint8* out, uint8* in,
- uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
- int bytes_per_sample )
+cpContigBufToSeparateBuf(uint8_t* out, uint8_t* in,
+ uint32_t rows, uint32_t cols, int outskew, int inskew, tsample_t spp,
+ int bytes_per_sample )
{
while (rows-- > 0) {
- uint32 j = cols;
+ uint32_t j = cols;
while (j-- > 0)
{
int n = bytes_per_sample;
@@ -1308,12 +1308,12 @@ cpContigBufToSeparateBuf(uint8* out, uint8* in,
}
static void
-cpSeparateBufToContigBuf(uint8* out, uint8* in,
- uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp,
- int bytes_per_sample)
+cpSeparateBufToContigBuf(uint8_t* out, uint8_t* in,
+ uint32_t rows, uint32_t cols, int outskew, int inskew, tsample_t spp,
+ int bytes_per_sample)
{
while (rows-- > 0) {
- uint32 j = cols;
+ uint32_t j = cols;
while (j-- > 0) {
int n = bytes_per_sample;
@@ -1329,7 +1329,7 @@ cpSeparateBufToContigBuf(uint8* out, uint8* in,
static int
cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
- uint32 imagelength, uint32 imagewidth, tsample_t spp)
+ uint32_t imagelength, uint32_t imagewidth, tsample_t spp)
{
int status = 0;
tdata_t buf = NULL;
@@ -1343,9 +1343,9 @@ cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
&& bytes / (tsize_t)imagelength == scanlinesize) {
buf = limitMalloc(bytes);
if (buf) {
- if ((*fin)(in, (uint8*)buf, imagelength,
- imagewidth, spp)) {
- status = (*fout)(out, (uint8*)buf,
+ if ((*fin)(in, (uint8_t*)buf, imagelength,
+ imagewidth, spp)) {
+ status = (*fout)(out, (uint8_t*)buf,
imagelength, imagewidth, spp);
}
_TIFFfree(buf);
@@ -1363,8 +1363,8 @@ cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
DECLAREreadFunc(readContigStripsIntoBuffer)
{
tsize_t scanlinesize = TIFFScanlineSize(in);
- uint8* bufp = buf;
- uint32 row;
+ uint8_t* bufp = buf;
+ uint32_t row;
(void) imagewidth; (void) spp;
for (row = 0; row < imagelength; row++) {
@@ -1395,15 +1395,15 @@ DECLAREreadFunc(readSeparateStripsIntoBuffer)
_TIFFmemset(scanline, 0, scanlinesize);
(void) imagewidth;
if (scanline) {
- uint8* bufp = (uint8*) buf;
- uint32 row;
+ uint8_t* bufp = (uint8_t*) buf;
+ uint32_t row;
tsample_t s;
for (row = 0; row < imagelength; row++) {
/* merge channels */
for (s = 0; s < spp; s++) {
- uint8* bp = bufp + s;
+ uint8_t* bp = bufp + s;
tsize_t n = scanlinesize;
- uint8* sbuf = scanline;
+ uint8_t* sbuf = scanline;
if (TIFFReadScanline(in, scanline, row, s) < 0
&& !ignore) {
@@ -1430,12 +1430,12 @@ DECLAREreadFunc(readContigTilesIntoBuffer)
int status = 1;
tsize_t tilesize = TIFFTileSize(in);
tdata_t tilebuf;
- uint32 imagew = TIFFScanlineSize(in);
- uint32 tilew = TIFFTileRowSize(in);
- int64 iskew = (int64)imagew - (int64)tilew;
- uint8* bufp = (uint8*) buf;
- uint32 tw, tl;
- uint32 row;
+ uint32_t imagew = TIFFScanlineSize(in);
+ uint32_t tilew = TIFFTileRowSize(in);
+ int64_t iskew = (int64_t)imagew - (int64_t)tilew;
+ uint8_t* bufp = (uint8_t*) buf;
+ uint32_t tw, tl;
+ uint32_t row;
(void) spp;
tilebuf = limitMalloc(tilesize);
@@ -1446,9 +1446,9 @@ DECLAREreadFunc(readContigTilesIntoBuffer)
(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
for (row = 0; row < imagelength; row += tl) {
- uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
- uint32 colb = 0;
- uint32 col;
+ uint32_t nrow = (row + tl > imagelength) ? imagelength - row : tl;
+ uint32_t colb = 0;
+ uint32_t col;
for (col = 0; col < imagewidth && colb < imagew; col += tw) {
if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0
@@ -1461,8 +1461,8 @@ DECLAREreadFunc(readContigTilesIntoBuffer)
goto done;
}
if (colb > iskew) {
- uint32 width = imagew - colb;
- uint32 oskew = tilew - width;
+ uint32_t width = imagew - colb;
+ uint32_t oskew = tilew - width;
cpStripToTile(bufp + colb,
tilebuf, nrow, width,
oskew + iskew, oskew );
@@ -1482,15 +1482,15 @@ done:
DECLAREreadFunc(readSeparateTilesIntoBuffer)
{
int status = 1;
- uint32 imagew = TIFFRasterScanlineSize(in);
- uint32 tilew = TIFFTileRowSize(in);
+ uint32_t imagew = TIFFRasterScanlineSize(in);
+ uint32_t tilew = TIFFTileRowSize(in);
int iskew;
tsize_t tilesize = TIFFTileSize(in);
tdata_t tilebuf;
- uint8* bufp = (uint8*) buf;
- uint32 tw, tl;
- uint32 row;
- uint16 bps = 0, bytes_per_sample;
+ uint8_t* bufp = (uint8_t*) buf;
+ uint32_t tw, tl;
+ uint32_t row;
+ uint16_t bps = 0, bytes_per_sample;
if (tilew && spp > (INT_MAX / tilew))
{
@@ -1520,9 +1520,9 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer)
bytes_per_sample = bps/8;
for (row = 0; row < imagelength; row += tl) {
- uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
- uint32 colb = 0;
- uint32 col;
+ uint32_t nrow = (row + tl > imagelength) ? imagelength - row : tl;
+ uint32_t colb = 0;
+ uint32_t col;
for (col = 0; col < imagewidth; col += tw) {
tsample_t s;
@@ -1544,7 +1544,7 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer)
* visible portion and skewing factors.
*/
if (colb + tilew*spp > imagew) {
- uint32 width = imagew - colb;
+ uint32_t width = imagew - colb;
int oskew = tilew*spp - width;
cpSeparateBufToContigBuf(
bufp+colb+s*bytes_per_sample,
@@ -1571,13 +1571,13 @@ done:
DECLAREwriteFunc(writeBufferToContigStrips)
{
- uint32 row, rowsperstrip;
+ uint32_t row, rowsperstrip;
tstrip_t strip = 0;
(void) imagewidth; (void) spp;
(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
for (row = 0; row < imagelength; row += rowsperstrip) {
- uint32 nrows = (row+rowsperstrip > imagelength) ?
+ uint32_t nrows = (row + rowsperstrip > imagelength) ?
imagelength-row : rowsperstrip;
tsize_t stripsize = TIFFVStripSize(out, nrows);
if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) {
@@ -1592,8 +1592,8 @@ DECLAREwriteFunc(writeBufferToContigStrips)
DECLAREwriteFunc(writeBufferToSeparateStrips)
{
- uint32 rowsize = imagewidth * spp;
- uint32 rowsperstrip;
+ uint32_t rowsize = imagewidth * spp;
+ uint32_t rowsperstrip;
tsize_t stripsize = TIFFStripSize(out);
tdata_t obuf;
tstrip_t strip = 0;
@@ -1605,14 +1605,14 @@ DECLAREwriteFunc(writeBufferToSeparateStrips)
_TIFFmemset(obuf, 0, stripsize);
(void) TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
for (s = 0; s < spp; s++) {
- uint32 row;
+ uint32_t row;
for (row = 0; row < imagelength; row += rowsperstrip) {
- uint32 nrows = (row+rowsperstrip > imagelength) ?
+ uint32_t nrows = (row + rowsperstrip > imagelength) ?
imagelength-row : rowsperstrip;
tsize_t stripsize = TIFFVStripSize(out, nrows);
cpContigBufToSeparateBuf(
- obuf, (uint8*) buf + row*rowsize + s,
+ obuf, (uint8_t*) buf + row * rowsize + s,
nrows, imagewidth, 0, 0, spp, 1);
if (TIFFWriteEncodedStrip(out, strip++, obuf, stripsize) < 0) {
TIFFError(TIFFFileName(out),
@@ -1630,14 +1630,14 @@ DECLAREwriteFunc(writeBufferToSeparateStrips)
DECLAREwriteFunc(writeBufferToContigTiles)
{
- uint32 imagew = TIFFScanlineSize(out);
- uint32 tilew = TIFFTileRowSize(out);
+ uint32_t imagew = TIFFScanlineSize(out);
+ uint32_t tilew = TIFFTileRowSize(out);
int iskew = imagew - tilew;
tsize_t tilesize = TIFFTileSize(out);
tdata_t obuf;
- uint8* bufp = (uint8*) buf;
- uint32 tl, tw;
- uint32 row;
+ uint8_t* bufp = (uint8_t*) buf;
+ uint32_t tl, tw;
+ uint32_t row;
(void) spp;
@@ -1648,9 +1648,9 @@ DECLAREwriteFunc(writeBufferToContigTiles)
(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
for (row = 0; row < imagelength; row += tilelength) {
- uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
- uint32 colb = 0;
- uint32 col;
+ uint32_t nrow = (row + tl > imagelength) ? imagelength - row : tl;
+ uint32_t colb = 0;
+ uint32_t col;
for (col = 0; col < imagewidth && colb < imagew; col += tw) {
/*
@@ -1658,7 +1658,7 @@ DECLAREwriteFunc(writeBufferToContigTiles)
* visible portion and skewing factors.
*/
if (colb + tilew > imagew) {
- uint32 width = imagew - colb;
+ uint32_t width = imagew - colb;
int oskew = tilew - width;
cpStripToTile(obuf, bufp + colb, nrow, width,
oskew, oskew + iskew);
@@ -1683,16 +1683,16 @@ DECLAREwriteFunc(writeBufferToContigTiles)
DECLAREwriteFunc(writeBufferToSeparateTiles)
{
- uint32 imagew = TIFFScanlineSize(out);
+ uint32_t imagew = TIFFScanlineSize(out);
tsize_t tilew = TIFFTileRowSize(out);
- uint32 iimagew = TIFFRasterScanlineSize(out);
+ uint32_t iimagew = TIFFRasterScanlineSize(out);
int iskew = iimagew - tilew*spp;
tsize_t tilesize = TIFFTileSize(out);
tdata_t obuf;
- uint8* bufp = (uint8*) buf;
- uint32 tl, tw;
- uint32 row;
- uint16 bps = 0, bytes_per_sample;
+ uint8_t* bufp = (uint8_t*) buf;
+ uint32_t tl, tw;
+ uint32_t row;
+ uint16_t bps = 0, bytes_per_sample;
obuf = limitMalloc(TIFFTileSize(out));
if (obuf == NULL)
@@ -1716,9 +1716,9 @@ DECLAREwriteFunc(writeBufferToSeparateTiles)
bytes_per_sample = bps/8;
for (row = 0; row < imagelength; row += tl) {
- uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
- uint32 colb = 0;
- uint32 col;
+ uint32_t nrow = (row + tl > imagelength) ? imagelength - row : tl;
+ uint32_t colb = 0;
+ uint32_t col;
for (col = 0; col < imagewidth; col += tw) {
tsample_t s;
@@ -1728,7 +1728,7 @@ DECLAREwriteFunc(writeBufferToSeparateTiles)
* visible portion and skewing factors.
*/
if (colb + tilew > imagew) {
- uint32 width = (imagew - colb);
+ uint32_t width = (imagew - colb);
int oskew = tilew - width;
cpContigBufToSeparateBuf(obuf,
@@ -1897,10 +1897,10 @@ DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
* Select the appropriate copy function to use.
*/
static copyFunc
-pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
+pickCopyFunc(TIFF* in, TIFF* out, uint16_t bitspersample, uint16_t samplesperpixel)
{
- uint16 shortv;
- uint32 w, l, tw, tl;
+ uint16_t shortv;
+ uint32_t w, l, tw, tl;
int bychunk;
(void) TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &shortv);
@@ -1913,7 +1913,7 @@ pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
if (!(TIFFIsTiled(out) || TIFFIsTiled(in))) {
- uint32 irps = (uint32) -1L;
+ uint32_t irps = (uint32_t) -1L;
TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
/* if biased, force decoded copying to allow image subtraction */
bychunk = !bias && (rowsperstrip == irps);
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 9610f953..83af4c1a 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -142,14 +142,12 @@ static char tiffcrop_rev_date[] = "12-13-2010";
#define PATH_MAX 1024
#endif
-#define TIFF_UINT32_MAX 0xFFFFFFFFU
-
#define TRUE 1
#define FALSE 0
#ifndef TIFFhowmany
-#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
-#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
+#define TIFFhowmany(x, y) ((((uint32_t)(x))+(((uint32_t)(y))-1))/((uint32_t)(y)))
+#define TIFFhowmany8(x) (((x)&0x07)?((uint32_t)(x)>>3)+1:(uint32_t)(x)>>3)
#endif
/*
@@ -210,16 +208,16 @@ static char tiffcrop_rev_date[] = "12-13-2010";
/* Offsets into buffer for margins and fixed width and length segments */
struct offset {
- uint32 tmargin;
- uint32 lmargin;
- uint32 bmargin;
- uint32 rmargin;
- uint32 crop_width;
- uint32 crop_length;
- uint32 startx;
- uint32 endx;
- uint32 starty;
- uint32 endy;
+ uint32_t tmargin;
+ uint32_t lmargin;
+ uint32_t bmargin;
+ uint32_t rmargin;
+ uint32_t crop_width;
+ uint32_t crop_length;
+ uint32_t startx;
+ uint32_t endx;
+ uint32_t starty;
+ uint32_t endy;
};
/* Description of a zone within the image. Position 1 of 3 zones would be
@@ -229,7 +227,7 @@ struct offset {
*/
struct buffinfo {
- uint32 size; /* size of this buffer */
+ uint32_t size; /* size of this buffer */
unsigned char *buffer; /* address of the allocated buffer */
};
@@ -239,13 +237,13 @@ struct zone {
};
struct pageseg {
- uint32 x1; /* index of left edge */
- uint32 x2; /* index of right edge */
- uint32 y1; /* index of top edge */
- uint32 y2; /* index of bottom edge */
+ uint32_t x1; /* index of left edge */
+ uint32_t x2; /* index of right edge */
+ uint32_t y1; /* index of top edge */
+ uint32_t y2; /* index of bottom edge */
int position; /* ordinal of segment to be extracted */
int total; /* total equal sized divisions of crop area */
- uint32 buffsize; /* size of buffer needed to hold the cropped zone */
+ uint32_t buffsize; /* size of buffer needed to hold the cropped zone */
};
struct coordpairs {
@@ -256,13 +254,13 @@ struct coordpairs {
};
struct region {
- uint32 x1; /* pixel offset of left edge */
- uint32 x2; /* pixel offset of right edge */
- uint32 y1; /* pixel offset of top edge */
- uint32 y2; /* picel offset of bottom edge */
- uint32 width; /* width in pixels */
- uint32 length; /* length in pixels */
- uint32 buffsize; /* size of buffer needed to hold the cropped region */
+ uint32_t x1; /* pixel offset of left edge */
+ uint32_t x2; /* pixel offset of right edge */
+ uint32_t y1; /* pixel offset of top edge */
+ uint32_t y2; /* picel offset of bottom edge */
+ uint32_t width; /* width in pixels */
+ uint32_t length; /* length in pixels */
+ uint32_t buffsize; /* size of buffer needed to hold the cropped region */
unsigned char *buffptr; /* address of start of the region */
};
@@ -276,22 +274,22 @@ struct crop_mask {
double margins[4]; /* Top, left, bottom, right margins */
float xres; /* Horizontal resolution read from image*/
float yres; /* Vertical resolution read from image */
- uint32 combined_width; /* Width of combined cropped zones */
- uint32 combined_length; /* Length of combined cropped zones */
- uint32 bufftotal; /* Size of buffer needed to hold all the cropped region */
- uint16 img_mode; /* Composite or separate images created from zones or regions */
- uint16 exp_mode; /* Export input images or selections to one or more files */
- uint16 crop_mode; /* Crop options to be applied */
- uint16 res_unit; /* Resolution unit for margins and selections */
- uint16 edge_ref; /* Reference edge for sections extraction and combination */
- uint16 rotation; /* Clockwise rotation of the extracted region or image */
- uint16 mirror; /* Mirror extracted region or image horizontally or vertically */
- uint16 invert; /* Invert the color map of image or region */
- uint16 photometric; /* Status of photometric interpretation for inverted image */
- uint16 selections; /* Number of regions or zones selected */
- uint16 regions; /* Number of regions delimited by corner coordinates */
+ uint32_t combined_width; /* Width of combined cropped zones */
+ uint32_t combined_length; /* Length of combined cropped zones */
+ uint32_t bufftotal; /* Size of buffer needed to hold all the cropped region */
+ uint16_t img_mode; /* Composite or separate images created from zones or regions */
+ uint16_t exp_mode; /* Export input images or selections to one or more files */
+ uint16_t crop_mode; /* Crop options to be applied */
+ uint16_t res_unit; /* Resolution unit for margins and selections */
+ uint16_t edge_ref; /* Reference edge for sections extraction and combination */
+ uint16_t rotation; /* Clockwise rotation of the extracted region or image */
+ uint16_t mirror; /* Mirror extracted region or image horizontally or vertically */
+ uint16_t invert; /* Invert the color map of image or region */
+ uint16_t photometric; /* Status of photometric interpretation for inverted image */
+ uint16_t selections; /* Number of regions or zones selected */
+ uint16_t regions; /* Number of regions delimited by corner coordinates */
struct region regionlist[MAX_REGIONS]; /* Regions within page or master crop region */
- uint16 zones; /* Number of zones delimited by Ordinal:Total requested */
+ uint16_t zones; /* Number of zones delimited by Ordinal:Total requested */
struct zone zonelist[MAX_REGIONS]; /* Zones indices to define a region */
struct coordpairs corners[MAX_REGIONS]; /* Coordinates of upper left and lower right corner */
};
@@ -385,16 +383,16 @@ static const struct paperdef PaperTable[/*MAX_PAPERNAMES*/] = {
struct image_data {
float xres;
float yres;
- uint32 width;
- uint32 length;
- uint16 res_unit;
- uint16 bps;
- uint16 spp;
- uint16 planar;
- uint16 photometric;
- uint16 orientation;
- uint16 compression;
- uint16 adjustments;
+ uint32_t width;
+ uint32_t length;
+ uint16_t res_unit;
+ uint16_t bps;
+ uint16_t spp;
+ uint16_t planar;
+ uint16_t photometric;
+ uint16_t orientation;
+ uint16_t compression;
+ uint16_t adjustments;
};
/* Structure to define the output image modifiers */
@@ -406,8 +404,8 @@ struct pagedef {
double vmargin; /* margins to subtract from height of sections */
double hres; /* horizontal resolution for output */
double vres; /* vertical resolution for output */
- uint32 mode; /* bitmask of modifiers to page format */
- uint16 res_unit; /* resolution unit for output image */
+ uint32_t mode; /* bitmask of modifiers to page format */
+ uint16_t res_unit; /* resolution unit for output image */
unsigned int rows; /* number of section rows */
unsigned int cols; /* number of section cols */
unsigned int orient; /* portrait, landscape, seascape, auto */
@@ -426,36 +424,36 @@ struct dump_opts {
/* globals */
static int outtiled = -1;
-static uint32 tilewidth = 0;
-static uint32 tilelength = 0;
-
-static uint16 config = 0;
-static uint16 compression = 0;
-static uint16 predictor = 0;
-static uint16 fillorder = 0;
-static uint32 rowsperstrip = 0;
-static uint32 g3opts = 0;
+static uint32_t tilewidth = 0;
+static uint32_t tilelength = 0;
+
+static uint16_t config = 0;
+static uint16_t compression = 0;
+static uint16_t predictor = 0;
+static uint16_t fillorder = 0;
+static uint32_t rowsperstrip = 0;
+static uint32_t g3opts = 0;
static int ignore = FALSE; /* if true, ignore read errors */
-static uint32 defg3opts = (uint32) -1;
+static uint32_t defg3opts = (uint32_t) -1;
static int quality = 100; /* JPEG quality */
/* static int jpegcolormode = -1; was JPEGCOLORMODE_RGB; */
static int jpegcolormode = JPEGCOLORMODE_RGB;
-static uint16 defcompression = (uint16) -1;
-static uint16 defpredictor = (uint16) -1;
+static uint16_t defcompression = (uint16_t) -1;
+static uint16_t defpredictor = (uint16_t) -1;
static int pageNum = 0;
static int little_endian = 1;
/* Functions adapted from tiffcp with additions or significant modifications */
-static int readContigStripsIntoBuffer (TIFF*, uint8*);
-static int readSeparateStripsIntoBuffer (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);
-static int readContigTilesIntoBuffer (TIFF*, uint8*, uint32, uint32, uint32, uint32, tsample_t, uint16);
-static int readSeparateTilesIntoBuffer (TIFF*, uint8*, uint32, uint32, uint32, uint32, tsample_t, uint16);
-static int writeBufferToContigStrips (TIFF*, uint8*, uint32);
-static int writeBufferToContigTiles (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);
-static int writeBufferToSeparateStrips (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);
-static int writeBufferToSeparateTiles (TIFF*, uint8*, uint32, uint32, tsample_t, struct dump_opts *);
-static int extractContigSamplesToBuffer (uint8 *, uint8 *, uint32, uint32, tsample_t,
- uint16, uint16, struct dump_opts *);
+static int readContigStripsIntoBuffer (TIFF*, uint8_t*);
+static int readSeparateStripsIntoBuffer (TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t, struct dump_opts *);
+static int readContigTilesIntoBuffer (TIFF*, uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t, tsample_t, uint16_t);
+static int readSeparateTilesIntoBuffer (TIFF*, uint8_t*, uint32_t, uint32_t, uint32_t, uint32_t, tsample_t, uint16_t);
+static int writeBufferToContigStrips (TIFF*, uint8_t*, uint32_t);
+static int writeBufferToContigTiles (TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t, struct dump_opts *);
+static int writeBufferToSeparateStrips (TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t, struct dump_opts *);
+static int writeBufferToSeparateTiles (TIFF*, uint8_t*, uint32_t, uint32_t, tsample_t, struct dump_opts *);
+static int extractContigSamplesToBuffer (uint8_t *, uint8_t *, uint32_t, uint32_t, tsample_t,
+ uint16_t, uint16_t, struct dump_opts *);
static int processCompressOptions(char*);
static void usage(int code);
@@ -466,10 +464,10 @@ static void initPageSetup (struct pagedef *, struct pageseg *, struct buffinfo [
static void initDumpOptions(struct dump_opts *);
/* Command line and file naming functions */
-void process_command_opts (int, char *[], char *, char *, uint32 *,
- uint16 *, uint16 *, uint32 *, uint32 *, uint32 *,
- struct crop_mask *, struct pagedef *,
- struct dump_opts *,
+void process_command_opts (int, char *[], char *, char *, uint32_t *,
+ uint16_t *, uint16_t *, uint32_t *, uint32_t *, uint32_t *,
+ struct crop_mask *, struct pagedef *,
+ struct dump_opts *,
unsigned int *, unsigned int *);
static int update_output_file (TIFF **, char *, int, char *, unsigned int *);
@@ -491,12 +489,12 @@ static int writeSelections(TIFF *, TIFF **, struct crop_mask *, struct image_da
char *, char *, unsigned int*, unsigned int);
/* Section functions */
-static int createImageSection(uint32, unsigned char **);
+static int createImageSection(uint32_t, unsigned char **);
static int extractImageSection(struct image_data *, struct pageseg *,
unsigned char *, unsigned char *);
static int writeSingleSection(TIFF *, TIFF *, struct image_data *,
- struct dump_opts *, uint32, uint32,
- double, double, unsigned char *);
+ struct dump_opts *, uint32_t, uint32_t,
+ double, double, unsigned char *);
static int writeImageSections(TIFF *, TIFF *, struct image_data *,
struct pagedef *, struct pageseg *,
struct dump_opts *, unsigned char *,
@@ -506,108 +504,108 @@ static int createCroppedImage(struct image_data *, struct crop_mask *,
unsigned char **, unsigned char **);
static int writeCroppedImage(TIFF *, TIFF *, struct image_data *image,
struct dump_opts * dump,
- uint32, uint32, unsigned char *, int, int);
+ uint32_t, uint32_t, unsigned char *, int, int);
/* Image manipulation functions */
-static int rotateContigSamples8bits(uint16, uint16, uint16, uint32,
- uint32, uint32, uint8 *, uint8 *);
-static int rotateContigSamples16bits(uint16, uint16, uint16, uint32,
- uint32, uint32, uint8 *, uint8 *);
-static int rotateContigSamples24bits(uint16, uint16, uint16, uint32,
- uint32, uint32, uint8 *, uint8 *);
-static int rotateContigSamples32bits(uint16, uint16, uint16, uint32,
- uint32, uint32, uint8 *, uint8 *);
-static int rotateImage(uint16, struct image_data *, uint32 *, uint32 *,
- unsigned char **);
-static int mirrorImage(uint16, uint16, uint16, uint32, uint32,
- unsigned char *);
-static int invertImage(uint16, uint16, uint16, uint32, uint32,
- unsigned char *);
+static int rotateContigSamples8bits(uint16_t, uint16_t, uint16_t, uint32_t,
+ uint32_t, uint32_t, uint8_t *, uint8_t *);
+static int rotateContigSamples16bits(uint16_t, uint16_t, uint16_t, uint32_t,
+ uint32_t, uint32_t, uint8_t *, uint8_t *);
+static int rotateContigSamples24bits(uint16_t, uint16_t, uint16_t, uint32_t,
+ uint32_t, uint32_t, uint8_t *, uint8_t *);
+static int rotateContigSamples32bits(uint16_t, uint16_t, uint16_t, uint32_t,
+ uint32_t, uint32_t, uint8_t *, uint8_t *);
+static int rotateImage(uint16_t, struct image_data *, uint32_t *, uint32_t *,
+ unsigned char **);
+static int mirrorImage(uint16_t, uint16_t, uint16_t, uint32_t, uint32_t,
+ unsigned char *);
+static int invertImage(uint16_t, uint16_t, uint16_t, uint32_t, uint32_t,
+ unsigned char *);
/* Functions to reverse the sequence of samples in a scanline */
-static int reverseSamples8bits (uint16, uint16, uint32, uint8 *, uint8 *);
-static int reverseSamples16bits (uint16, uint16, uint32, uint8 *, uint8 *);
-static int reverseSamples24bits (uint16, uint16, uint32, uint8 *, uint8 *);
-static int reverseSamples32bits (uint16, uint16, uint32, uint8 *, uint8 *);
-static int reverseSamplesBytes (uint16, uint16, uint32, uint8 *, uint8 *);
+static int reverseSamples8bits (uint16_t, uint16_t, uint32_t, uint8_t *, uint8_t *);
+static int reverseSamples16bits (uint16_t, uint16_t, uint32_t, uint8_t *, uint8_t *);
+static int reverseSamples24bits (uint16_t, uint16_t, uint32_t, uint8_t *, uint8_t *);
+static int reverseSamples32bits (uint16_t, uint16_t, uint32_t, uint8_t *, uint8_t *);
+static int reverseSamplesBytes (uint16_t, uint16_t, uint32_t, uint8_t *, uint8_t *);
/* Functions for manipulating individual samples in an image */
static int extractSeparateRegion(struct image_data *, struct crop_mask *,
unsigned char *, unsigned char *, int);
static int extractCompositeRegions(struct image_data *, struct crop_mask *,
unsigned char *, unsigned char *);
-static int extractContigSamples8bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32);
-static int extractContigSamples16bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32);
-static int extractContigSamples24bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32);
-static int extractContigSamples32bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32);
-static int extractContigSamplesBytes (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32);
-static int extractContigSamplesShifted8bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32,
+static int extractContigSamples8bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t);
+static int extractContigSamples16bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t);
+static int extractContigSamples24bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t);
+static int extractContigSamples32bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t);
+static int extractContigSamplesBytes (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t);
+static int extractContigSamplesShifted8bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t,
int);
-static int extractContigSamplesShifted16bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32,
+static int extractContigSamplesShifted16bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t,
int);
-static int extractContigSamplesShifted24bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32,
+static int extractContigSamplesShifted24bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t,
int);
-static int extractContigSamplesShifted32bits (uint8 *, uint8 *, uint32,
- tsample_t, uint16, uint16,
- tsample_t, uint32, uint32,
+static int extractContigSamplesShifted32bits (uint8_t *, uint8_t *, uint32_t,
+ tsample_t, uint16_t, uint16_t,
+ tsample_t, uint32_t, uint32_t,
int);
-static int extractContigSamplesToTileBuffer(uint8 *, uint8 *, uint32, uint32,
- uint32, uint32, tsample_t, uint16,
- uint16, uint16, struct dump_opts *);
+static int extractContigSamplesToTileBuffer(uint8_t *, uint8_t *, uint32_t, uint32_t,
+ uint32_t, uint32_t, tsample_t, uint16_t,
+ uint16_t, uint16_t, struct dump_opts *);
/* Functions to combine separate planes into interleaved planes */
-static int combineSeparateSamples8bits (uint8 *[], uint8 *, uint32, uint32,
- uint16, uint16, FILE *, int, int);
-static int combineSeparateSamples16bits (uint8 *[], uint8 *, uint32, uint32,
- uint16, uint16, FILE *, int, int);
-static int combineSeparateSamples24bits (uint8 *[], uint8 *, uint32, uint32,
- uint16, uint16, FILE *, int, int);
-static int combineSeparateSamples32bits (uint8 *[], uint8 *, uint32, uint32,
- uint16, uint16, FILE *, int, int);
+static int combineSeparateSamples8bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint16_t, uint16_t, FILE *, int, int);
+static int combineSeparateSamples16bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint16_t, uint16_t, FILE *, int, int);
+static int combineSeparateSamples24bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint16_t, uint16_t, FILE *, int, int);
+static int combineSeparateSamples32bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint16_t, uint16_t, FILE *, int, int);
static int combineSeparateSamplesBytes (unsigned char *[], unsigned char *,
- uint32, uint32, tsample_t, uint16,
+ uint32_t, uint32_t, tsample_t, uint16_t,
FILE *, int, int);
-static int combineSeparateTileSamples8bits (uint8 *[], uint8 *, uint32, uint32,
- uint32, uint32, uint16, uint16,
+static int combineSeparateTileSamples8bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint32_t, uint32_t, uint16_t, uint16_t,
FILE *, int, int);
-static int combineSeparateTileSamples16bits (uint8 *[], uint8 *, uint32, uint32,
- uint32, uint32, uint16, uint16,
+static int combineSeparateTileSamples16bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint32_t, uint32_t, uint16_t, uint16_t,
FILE *, int, int);
-static int combineSeparateTileSamples24bits (uint8 *[], uint8 *, uint32, uint32,
- uint32, uint32, uint16, uint16,
+static int combineSeparateTileSamples24bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint32_t, uint32_t, uint16_t, uint16_t,
FILE *, int, int);
-static int combineSeparateTileSamples32bits (uint8 *[], uint8 *, uint32, uint32,
- uint32, uint32, uint16, uint16,
+static int combineSeparateTileSamples32bits (uint8_t *[], uint8_t *, uint32_t, uint32_t,
+ uint32_t, uint32_t, uint16_t, uint16_t,
FILE *, int, int);
static int combineSeparateTileSamplesBytes (unsigned char *[], unsigned char *,
- uint32, uint32, uint32, uint32,
- tsample_t, uint16, FILE *, int, int);
+ uint32_t, uint32_t, uint32_t, uint32_t,
+ tsample_t, uint16_t, FILE *, int, int);
/* Dump functions for debugging */
static void dump_info (FILE *, int, char *, char *, ...);
-static int dump_data (FILE *, int, char *, unsigned char *, uint32);
+static int dump_data (FILE *, int, char *, unsigned char *, uint32_t);
static int dump_byte (FILE *, int, char *, unsigned char);
-static int dump_short (FILE *, int, char *, uint16);
-static int dump_long (FILE *, int, char *, uint32);
-static int dump_wide (FILE *, int, char *, uint64);
-static int dump_buffer (FILE *, int, uint32, uint32, uint32, unsigned char *);
+static int dump_short (FILE *, int, char *, uint16_t);
+static int dump_long (FILE *, int, char *, uint32_t);
+static int dump_wide (FILE *, int, char *, uint64_t);
+static int dump_buffer (FILE *, int, uint32_t, uint32_t, uint32_t, unsigned char *);
/* End function declarations */
/* Functions derived in whole or in part from tiffcp */
@@ -625,8 +623,8 @@ static tmsize_t maxMalloc = DEFAULT_MAX_MALLOC;
static void* limitMalloc(tmsize_t s)
{
if (maxMalloc && (s > maxMalloc)) {
- fprintf(stderr, "MemoryLimitError: allocation of %" TIFF_UINT64_FORMAT " bytes is forbidden. Limit is %" TIFF_UINT64_FORMAT ".\n",
- (uint64)s, (uint64)maxMalloc);
+ fprintf(stderr, "MemoryLimitError: allocation of %" PRIu64 " bytes is forbidden. Limit is %" PRIu64 ".\n",
+ (uint64_t)s, (uint64_t)maxMalloc);
fprintf(stderr, " use -k option to change limit.\n"); return NULL;
}
return _TIFFmalloc(s);
@@ -785,24 +783,24 @@ static const char usage_info[] =
* from input image. These would then be passed to individual
* extractContigSampleXX routines.
*/
-static int readContigTilesIntoBuffer (TIFF* in, uint8* buf,
- uint32 imagelength,
- uint32 imagewidth,
- uint32 tw, uint32 tl,
- tsample_t spp, uint16 bps)
+static int readContigTilesIntoBuffer (TIFF* in, uint8_t* buf,
+ uint32_t imagelength,
+ uint32_t imagewidth,
+ uint32_t tw, uint32_t tl,
+ tsample_t spp, uint16_t bps)
{
int status = 1;
tsample_t sample = 0;
tsample_t count = spp;
- uint32 row, col, trow;
- uint32 nrow, ncol;
- uint32 dst_rowsize, shift_width;
- uint32 bytes_per_sample, bytes_per_pixel;
- uint32 trailing_bits, prev_trailing_bits;
- uint32 tile_rowsize = TIFFTileRowSize(in);
- uint32 src_offset, dst_offset;
- uint32 row_offset, col_offset;
- uint8 *bufp = (uint8*) buf;
+ uint32_t row, col, trow;
+ uint32_t nrow, ncol;
+ uint32_t dst_rowsize, shift_width;
+ uint32_t bytes_per_sample, bytes_per_pixel;
+ uint32_t trailing_bits, prev_trailing_bits;
+ uint32_t tile_rowsize = TIFFTileRowSize(in);
+ uint32_t src_offset, dst_offset;
+ uint32_t row_offset, col_offset;
+ uint8_t *bufp = (uint8_t*) buf;
unsigned char *src = NULL;
unsigned char *dst = NULL;
tsize_t tbytes = 0, tile_buffsize = 0;
@@ -992,20 +990,20 @@ static int readContigTilesIntoBuffer (TIFF* in, uint8* buf,
return status;
}
-static int readSeparateTilesIntoBuffer (TIFF* in, uint8 *obuf,
- uint32 imagelength, uint32 imagewidth,
- uint32 tw, uint32 tl,
- uint16 spp, uint16 bps)
+static int readSeparateTilesIntoBuffer (TIFF* in, uint8_t *obuf,
+ uint32_t imagelength, uint32_t imagewidth,
+ uint32_t tw, uint32_t tl,
+ uint16_t spp, uint16_t bps)
{
int i, status = 1, sample;
int shift_width, bytes_per_pixel;
- uint16 bytes_per_sample;
- uint32 row, col; /* Current row and col of image */
- uint32 nrow, ncol; /* Number of rows and cols in current tile */
- uint32 row_offset, col_offset; /* Output buffer offsets */
+ uint16_t bytes_per_sample;
+ uint32_t row, col; /* Current row and col of image */
+ uint32_t nrow, ncol; /* Number of rows and cols in current tile */
+ uint32_t row_offset, col_offset; /* Output buffer offsets */
tsize_t tbytes = 0, tilesize = TIFFTileSize(in);
tsample_t s;
- uint8* bufp = (uint8*)obuf;
+ uint8_t* bufp = (uint8_t*)obuf;
unsigned char *srcbuffs[MAX_SAMPLES];
unsigned char *tbuff = NULL;
@@ -1139,9 +1137,9 @@ static int readSeparateTilesIntoBuffer (TIFF* in, uint8 *obuf,
return status;
}
-static int writeBufferToContigStrips(TIFF* out, uint8* buf, uint32 imagelength)
+static int writeBufferToContigStrips(TIFF* out, uint8_t* buf, uint32_t imagelength)
{
- uint32 row, nrows, rowsperstrip;
+ uint32_t row, nrows, rowsperstrip;
tstrip_t strip = 0;
tsize_t stripsize;
@@ -1171,14 +1169,14 @@ static int writeBufferToContigStrips(TIFF* out, uint8* buf, uint32 imagelength)
* before any strips or tiles of a different plane are stored.
*/
static int
-writeBufferToSeparateStrips (TIFF* out, uint8* buf,
- uint32 length, uint32 width, uint16 spp,
- struct dump_opts *dump)
+writeBufferToSeparateStrips (TIFF* out, uint8_t* buf,
+ uint32_t length, uint32_t width, uint16_t spp,
+ struct dump_opts *dump)
{
- uint8 *src;
- uint16 bps;
- uint32 row, nrows, rowsize, rowsperstrip;
- uint32 bytes_per_sample;
+ uint8_t *src;
+ uint16_t bps;
+ uint32_t row, nrows, rowsize, rowsperstrip;
+ uint32_t bytes_per_sample;
tsample_t s;
tstrip_t strip = 0;
tsize_t stripsize = TIFFStripSize(out);
@@ -1190,20 +1188,20 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf,
(void) TIFFGetFieldDefaulted(out, TIFFTAG_BITSPERSAMPLE, &bps);
bytes_per_sample = (bps + 7) / 8;
if( width == 0 ||
- (uint32)bps * (uint32)spp > TIFF_UINT32_MAX / width ||
- bps * spp * width > TIFF_UINT32_MAX - 7U )
+ (uint32_t)bps * (uint32_t)spp > UINT32_MAX / width ||
+ bps * spp * width > UINT32_MAX - 7U )
{
TIFFError(TIFFFileName(out),
- "Error, uint32 overflow when computing (bps * spp * width) + 7");
+ "Error, uint32_t overflow when computing (bps * spp * width) + 7");
return 1;
}
rowsize = ((bps * spp * width) + 7U) / 8; /* source has interleaved samples */
if( bytes_per_sample == 0 ||
- rowsperstrip > TIFF_UINT32_MAX / bytes_per_sample ||
- rowsperstrip * bytes_per_sample > TIFF_UINT32_MAX / (width + 1) )
+ rowsperstrip > UINT32_MAX / bytes_per_sample ||
+ rowsperstrip * bytes_per_sample > UINT32_MAX / (width + 1) )
{
TIFFError(TIFFFileName(out),
- "Error, uint32 overflow when computing rowsperstrip * "
+ "Error, uint32_t overflow when computing rowsperstrip * "
"bytes_per_sample * (width + 1)");
return 1;
}
@@ -1252,16 +1250,16 @@ writeBufferToSeparateStrips (TIFF* out, uint8* buf,
/* Extract all planes from contiguous buffer into a single tile buffer
* to be written out as a tile.
*/
-static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,
- uint32 imagewidth, tsample_t spp,
- struct dump_opts* dump)
+static int writeBufferToContigTiles (TIFF* out, uint8_t* buf, uint32_t imagelength,
+ uint32_t imagewidth, tsample_t spp,
+ struct dump_opts* dump)
{
- uint16 bps;
- uint32 tl, tw;
- uint32 row, col, nrow, ncol;
- uint32 src_rowsize, col_offset;
- uint32 tile_rowsize = TIFFTileRowSize(out);
- uint8* bufp = (uint8*) buf;
+ uint16_t bps;
+ uint32_t tl, tw;
+ uint32_t row, col, nrow, ncol;
+ uint32_t src_rowsize, col_offset;
+ uint32_t tile_rowsize = TIFFTileRowSize(out);
+ uint8_t* bufp = (uint8_t*) buf;
tsize_t tile_buffsize = 0;
tsize_t tilesize = TIFFTileSize(out);
unsigned char *tilebuf = NULL;
@@ -1294,11 +1292,11 @@ static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,
}
if( imagewidth == 0 ||
- (uint32)bps * (uint32)spp > TIFF_UINT32_MAX / imagewidth ||
- bps * spp * imagewidth > TIFF_UINT32_MAX - 7U )
+ (uint32_t)bps * (uint32_t)spp > UINT32_MAX / imagewidth ||
+ bps * spp * imagewidth > UINT32_MAX - 7U )
{
TIFFError(TIFFFileName(out),
- "Error, uint32 overflow when computing (imagewidth * bps * spp) + 7");
+ "Error, uint32_t overflow when computing (imagewidth * bps * spp) + 7");
return 1;
}
src_rowsize = ((imagewidth * spp * bps) + 7U) / 8;
@@ -1347,17 +1345,17 @@ static int writeBufferToContigTiles (TIFF* out, uint8* buf, uint32 imagelength,
/* Extract each plane from contiguous buffer into a single tile buffer
* to be written out as a tile.
*/
-static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength,
- uint32 imagewidth, tsample_t spp,
+static int writeBufferToSeparateTiles (TIFF* out, uint8_t* buf, uint32_t imagelength,
+ uint32_t imagewidth, tsample_t spp,
struct dump_opts * dump)
{
tdata_t obuf = limitMalloc(TIFFTileSize(out));
- uint32 tl, tw;
- uint32 row, col, nrow, ncol;
- uint32 src_rowsize, col_offset;
- uint16 bps;
+ uint32_t tl, tw;
+ uint32_t row, col, nrow, ncol;
+ uint32_t src_rowsize, col_offset;
+ uint16_t bps;
tsample_t s;
- uint8* bufp = (uint8*) buf;
+ uint8_t* bufp = (uint8_t*) buf;
if (obuf == NULL)
return 1;
@@ -1368,11 +1366,11 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength
return 1;
if( imagewidth == 0 ||
- (uint32)bps * (uint32)spp > TIFF_UINT32_MAX / imagewidth ||
- bps * spp * imagewidth > TIFF_UINT32_MAX - 7 )
+ (uint32_t)bps * (uint32_t)spp > UINT32_MAX / imagewidth ||
+ bps * spp * imagewidth > UINT32_MAX - 7 )
{
TIFFError(TIFFFileName(out),
- "Error, uint32 overflow when computing (imagewidth * bps * spp) + 7");
+ "Error, uint32_t overflow when computing (imagewidth * bps * spp) + 7");
_TIFFfree(obuf);
return 1;
}
@@ -1425,7 +1423,7 @@ static void
processG3Options(char* cp)
{
if( (cp = strchr(cp, ':')) ) {
- if (defg3opts == (uint32) -1)
+ if (defg3opts == (uint32_t) -1)
defg3opts = 0;
do {
cp++;
@@ -1521,27 +1519,27 @@ usage(int code)
if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
static void
-cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
+cpTag(TIFF* in, TIFF* out, uint16_t tag, uint16_t count, TIFFDataType type)
{
switch (type) {
case TIFF_SHORT:
if (count == 1) {
- uint16 shortv;
+ uint16_t shortv;
CopyField(tag, shortv);
} else if (count == 2) {
- uint16 shortv1, shortv2;
+ uint16_t shortv1, shortv2;
CopyField2(tag, shortv1, shortv2);
} else if (count == 4) {
- uint16 *tr, *tg, *tb, *ta;
+ uint16_t *tr, *tg, *tb, *ta;
CopyField4(tag, tr, tg, tb, ta);
- } else if (count == (uint16) -1) {
- uint16 shortv1;
- uint16* shortav;
+ } else if (count == (uint16_t) -1) {
+ uint16_t shortv1;
+ uint16_t* shortav;
CopyField2(tag, shortv1, shortav);
}
break;
case TIFF_LONG:
- { uint32 longv;
+ { uint32_t longv;
CopyField(tag, longv);
}
break;
@@ -1549,7 +1547,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
float floatv;
CopyField(tag, floatv);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
float* floatav;
CopyField(tag, floatav);
}
@@ -1563,7 +1561,7 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
if (count == 1) {
double doublev;
CopyField(tag, doublev);
- } else if (count == (uint16) -1) {
+ } else if (count == (uint16_t) -1) {
double* doubleav;
CopyField(tag, doubleav);
}
@@ -1576,8 +1574,8 @@ cpTag(TIFF* in, TIFF* out, uint16 tag, uint16 count, TIFFDataType type)
}
static const struct cpTag {
- uint16 tag;
- uint16 count;
+ uint16_t tag;
+ uint16_t count;
TIFFDataType type;
} tags[] = {
{ TIFFTAG_SUBFILETYPE, 1, TIFF_LONG },
@@ -1588,41 +1586,41 @@ static const struct cpTag {
{ TIFFTAG_MODEL, 1, TIFF_ASCII },
{ TIFFTAG_MINSAMPLEVALUE, 1, TIFF_SHORT },
{ TIFFTAG_MAXSAMPLEVALUE, 1, TIFF_SHORT },
- { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
- { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
- { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
- { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
- { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
- { TIFFTAG_DATETIME, 1, TIFF_ASCII },
- { TIFFTAG_ARTIST, 1, TIFF_ASCII },
- { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
- { TIFFTAG_WHITEPOINT, (uint16) -1, TIFF_RATIONAL },
- { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
- { TIFFTAG_INKSET, 1, TIFF_SHORT },
- { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
- { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
- { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
- { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
- { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
- { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
- { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
- { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
- { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
+ { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
+ { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
+ { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
+ { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
+ { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
+ { TIFFTAG_DATETIME, 1, TIFF_ASCII },
+ { TIFFTAG_ARTIST, 1, TIFF_ASCII },
+ { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
+ { TIFFTAG_WHITEPOINT, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_PRIMARYCHROMATICITIES,(uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
+ { TIFFTAG_INKSET, 1, TIFF_SHORT },
+ { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
+ { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
+ { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
+ { TIFFTAG_YCBCRCOEFFICIENTS, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
+ { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
+ { TIFFTAG_REFERENCEBLACKWHITE, (uint16_t) -1, TIFF_RATIONAL },
+ { TIFFTAG_EXTRASAMPLES, (uint16_t) -1, TIFF_SHORT },
+ { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
+ { TIFFTAG_STONITS, 1, TIFF_DOUBLE },
};
#define NTAGS (sizeof (tags) / sizeof (tags[0]))
#define CopyTag(tag, count, type) cpTag(in, out, tag, count, type)
/* Functions written by Richard Nolde, with exceptions noted. */
-void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32 *dirnum,
- uint16 *defconfig, uint16 *deffillorder, uint32 *deftilewidth,
- uint32 *deftilelength, uint32 *defrowsperstrip,
- struct crop_mask *crop_data, struct pagedef *page,
+void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32_t *dirnum,
+ uint16_t *defconfig, uint16_t *deffillorder, uint32_t *deftilewidth,
+ uint32_t *deftilelength, uint32_t *defrowsperstrip,
+ struct crop_mask *crop_data, struct pagedef *page,
struct dump_opts *dump,
unsigned int *imagelist, unsigned int *image_count )
{
@@ -2033,11 +2031,11 @@ void process_command_opts (int argc, char *argv[], char *mp, char *mode, uint32
crop_data->crop_mode |= CROP_ROTATE;
switch (strtoul(optarg, NULL, 0))
{
- case 90: crop_data->rotation = (uint16)90;
+ case 90: crop_data->rotation = (uint16_t)90;
break;
- case 180: crop_data->rotation = (uint16)180;
+ case 180: crop_data->rotation = (uint16_t)180;
break;
- case 270: crop_data->rotation = (uint16)270;
+ case 270: crop_data->rotation = (uint16_t)270;
break;
default: TIFFError ("Rotation must be 90, 180, or 270 degrees clockwise", "%s", optarg);
TIFFError ("For valid options type", "tiffcrop -h");
@@ -2208,12 +2206,12 @@ main(int argc, char* argv[])
#if !HAVE_DECL_OPTARG
extern int optind;
#endif
- uint16 defconfig = (uint16) -1;
- uint16 deffillorder = 0;
- uint32 deftilewidth = (uint32) 0;
- uint32 deftilelength = (uint32) 0;
- uint32 defrowsperstrip = (uint32) 0;
- uint32 dirnum = 0;
+ uint16_t defconfig = (uint16_t) -1;
+ uint16_t deffillorder = 0;
+ uint32_t deftilewidth = (uint32_t) 0;
+ uint32_t deftilelength = (uint32_t) 0;
+ uint32_t defrowsperstrip = (uint32_t) 0;
+ uint32_t dirnum = 0;
TIFF *in = NULL;
TIFF *out = NULL;
@@ -2513,10 +2511,10 @@ main(int argc, char* argv[])
/* Debugging functions */
-static int dump_data (FILE *dumpfile, int format, char *dump_tag, unsigned char *data, uint32 count)
+static int dump_data (FILE *dumpfile, int format, char *dump_tag, unsigned char *data, uint32_t count)
{
int j, k;
- uint32 i;
+ uint32_t i;
char dump_array[10];
unsigned char bitset;
@@ -2588,7 +2586,7 @@ static int dump_byte (FILE *dumpfile, int format, char *dump_tag, unsigned char
return (0);
}
-static int dump_short (FILE *dumpfile, int format, char *dump_tag, uint16 data)
+static int dump_short (FILE *dumpfile, int format, char *dump_tag, uint16_t data)
{
int j, k;
char dump_array[20];
@@ -2625,7 +2623,7 @@ static int dump_short (FILE *dumpfile, int format, char *dump_tag, uint16 data)
return (0);
}
-static int dump_long (FILE *dumpfile, int format, char *dump_tag, uint32 data)
+static int dump_long (FILE *dumpfile, int format, char *dump_tag, uint32_t data)
{
int j, k;
char dump_array[40];
@@ -2642,7 +2640,7 @@ static int dump_long (FILE *dumpfile, int format, char *dump_tag, uint32 data)
fprintf (dumpfile," %s ", dump_tag);
for (j = 0, k = 31; k >= 0; j++, k--)
{
- bitset = data & (((uint32)1 << k)) ? 1 : 0;
+ bitset = data & (((uint32_t)1 << k)) ? 1 : 0;
sprintf(&dump_array[j], (bitset) ? "1" : "0");
if ((k % 8) == 0)
sprintf(&dump_array[++j], " ");
@@ -2661,7 +2659,7 @@ static int dump_long (FILE *dumpfile, int format, char *dump_tag, uint32 data)
return (0);
}
-static int dump_wide (FILE *dumpfile, int format, char *dump_tag, uint64 data)
+static int dump_wide (FILE *dumpfile, int format, char *dump_tag, uint64_t data)
{
int j, k;
char dump_array[80];
@@ -2678,7 +2676,7 @@ static int dump_wide (FILE *dumpfile, int format, char *dump_tag, uint64 data)
fprintf (dumpfile," %s ", dump_tag);
for (j = 0, k = 63; k >= 0; j++, k--)
{
- bitset = data & (((uint64)1 << k)) ? 1 : 0;
+ bitset = data & (((uint64_t)1 << k)) ? 1 : 0;
sprintf(&dump_array[j], (bitset) ? "1" : "0");
if ((k % 8) == 0)
sprintf(&dump_array[++j], " ");
@@ -2711,11 +2709,11 @@ static void dump_info(FILE *dumpfile, int format, char *prefix, char *msg, ...)
}
}
-static int dump_buffer (FILE* dumpfile, int format, uint32 rows, uint32 width,
- uint32 row, unsigned char *buff)
+static int dump_buffer (FILE* dumpfile, int format, uint32_t rows, uint32_t width,
+ uint32_t row, unsigned char *buff)
{
int j, k;
- uint32 i;
+ uint32_t i;
unsigned char * dump_ptr;
if (dumpfile == NULL)
@@ -2747,15 +2745,15 @@ static int dump_buffer (FILE* dumpfile, int format, uint32 rows, uint32 width,
*/
static int
-extractContigSamplesBytes (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end)
+extractContigSamplesBytes (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end)
{
int i, bytes_per_sample, sindex;
- uint32 col, dst_rowsize, bit_offset;
- uint32 src_byte /*, src_bit */;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, dst_rowsize, bit_offset;
+ uint32_t src_byte /*, src_bit */;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((src == NULL) || (dst == NULL))
{
@@ -2813,16 +2811,16 @@ extractContigSamplesBytes (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamplesBytes */
static int
-extractContigSamples8bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end)
+extractContigSamples8bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint8 maskbits = 0, matchbits = 0;
- uint8 buff1 = 0, buff2 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint8_t maskbits = 0, matchbits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((src == NULL) || (dst == NULL))
{
@@ -2844,7 +2842,7 @@ extractContigSamples8bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = 0;
- maskbits = (uint8)-1 >> ( 8 - bps);
+ maskbits = (uint8_t)-1 >> (8 - bps);
buff1 = buff2 = 0;
for (col = start; col < end; col++)
{ /* Compute src byte(s) and bits within byte(s) */
@@ -2890,17 +2888,17 @@ extractContigSamples8bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamples8bits */
static int
-extractContigSamples16bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end)
+extractContigSamples16bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint16 maskbits = 0, matchbits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint16_t maskbits = 0, matchbits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((src == NULL) || (dst == NULL))
{
@@ -2922,7 +2920,7 @@ extractContigSamples16bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = 0;
- maskbits = (uint16)-1 >> (16 - bps);
+ maskbits = (uint16_t)-1 >> (16 - bps);
for (col = start; col < end; col++)
{ /* Compute src byte(s) and bits within byte(s) */
@@ -2979,17 +2977,17 @@ extractContigSamples16bits (uint8 *in, uint8 *out, uint32 cols,
static int
-extractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end)
+extractContigSamples24bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint32 maskbits = 0, matchbits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint32_t maskbits = 0, matchbits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((in == NULL) || (out == NULL))
{
@@ -3011,7 +3009,7 @@ extractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = 0;
- maskbits = (uint32)-1 >> ( 32 - bps);
+ maskbits = (uint32_t)-1 >> (32 - bps);
for (col = start; col < end; col++)
{
/* Compute src byte(s) and bits within byte(s) */
@@ -3088,18 +3086,18 @@ extractContigSamples24bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamples24bits */
static int
-extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end)
+extractContigSamples32bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end)
{
int ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
- uint32 col, src_byte, src_bit, bit_offset;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 maskbits = 0, matchbits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t maskbits = 0, matchbits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((in == NULL) || (out == NULL))
{
@@ -3123,7 +3121,7 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
/* shift_width = ((bps + 7) / 8) + 1; */
ready_bits = 0;
- maskbits = (uint64)-1 >> ( 64 - bps);
+ maskbits = (uint64_t)-1 >> (64 - bps);
for (col = start; col < end; col++)
{
/* Compute src byte(s) and bits within byte(s) */
@@ -3154,7 +3152,7 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
buff1 = (buff3 & matchbits) << (src_bit);
/* If we have a full buffer's worth, write it out */
@@ -3193,17 +3191,17 @@ extractContigSamples32bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamples32bits */
static int
-extractContigSamplesShifted8bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end,
- int shift)
+extractContigSamplesShifted8bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end,
+ int shift)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint8 maskbits = 0, matchbits = 0;
- uint8 buff1 = 0, buff2 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint8_t maskbits = 0, matchbits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((src == NULL) || (dst == NULL))
{
@@ -3225,7 +3223,7 @@ extractContigSamplesShifted8bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = shift;
- maskbits = (uint8)-1 >> ( 8 - bps);
+ maskbits = (uint8_t)-1 >> (8 - bps);
buff1 = buff2 = 0;
for (col = start; col < end; col++)
{ /* Compute src byte(s) and bits within byte(s) */
@@ -3247,7 +3245,7 @@ extractContigSamplesShifted8bits (uint8 *in, uint8 *out, uint32 cols,
matchbits = maskbits << (8 - src_bit - bps);
buff1 = ((*src) & matchbits) << (src_bit);
if ((col == start) && (sindex == sample))
- buff2 = *src & ((uint8)-1) << (shift);
+ buff2 = *src & ((uint8_t)-1) << (shift);
/* If we have a full buffer's worth, write it out */
if (ready_bits >= 8)
@@ -3273,18 +3271,18 @@ extractContigSamplesShifted8bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamplesShifted8bits */
static int
-extractContigSamplesShifted16bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end,
- int shift)
+extractContigSamplesShifted16bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end,
+ int shift)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint16 maskbits = 0, matchbits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint16_t maskbits = 0, matchbits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((src == NULL) || (dst == NULL))
{
@@ -3306,7 +3304,7 @@ extractContigSamplesShifted16bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = shift;
- maskbits = (uint16)-1 >> (16 - bps);
+ maskbits = (uint16_t)-1 >> (16 - bps);
for (col = start; col < end; col++)
{ /* Compute src byte(s) and bits within byte(s) */
bit_offset = col * bps * spp;
@@ -3331,7 +3329,7 @@ extractContigSamplesShifted16bits (uint8 *in, uint8 *out, uint32 cols,
buff1 = (src[1] << 8) | src[0];
if ((col == start) && (sindex == sample))
- buff2 = buff1 & ((uint16)-1) << (8 - shift);
+ buff2 = buff1 & ((uint16_t)-1) << (8 - shift);
buff1 = (buff1 & matchbits) << (src_bit);
@@ -3363,18 +3361,18 @@ extractContigSamplesShifted16bits (uint8 *in, uint8 *out, uint32 cols,
static int
-extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end,
- int shift)
+extractContigSamplesShifted24bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end,
+ int shift)
{
int ready_bits = 0, sindex = 0;
- uint32 col, src_byte, src_bit, bit_offset;
- uint32 maskbits = 0, matchbits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint32_t maskbits = 0, matchbits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((in == NULL) || (out == NULL))
{
@@ -3396,7 +3394,7 @@ extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols,
}
ready_bits = shift;
- maskbits = (uint32)-1 >> ( 32 - bps);
+ maskbits = (uint32_t)-1 >> (32 - bps);
for (col = start; col < end; col++)
{
/* Compute src byte(s) and bits within byte(s) */
@@ -3422,7 +3420,7 @@ extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols,
buff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];
if ((col == start) && (sindex == sample))
- buff2 = buff1 & ((uint32)-1) << (16 - shift);
+ buff2 = buff1 & ((uint32_t)-1) << (16 - shift);
buff1 = (buff1 & matchbits) << (src_bit);
@@ -3461,19 +3459,19 @@ extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamplesShifted24bits */
static int
-extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
- tsample_t count, uint32 start, uint32 end,
- int shift)
+extractContigSamplesShifted32bits (uint8_t *in, uint8_t *out, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
+ tsample_t count, uint32_t start, uint32_t end,
+ int shift)
{
int ready_bits = 0, sindex = 0 /*, shift_width = 0 */;
- uint32 col, src_byte, src_bit, bit_offset;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 maskbits = 0, matchbits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
- uint8 *src = in;
- uint8 *dst = out;
+ uint32_t col, src_byte, src_bit, bit_offset;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t maskbits = 0, matchbits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint8_t *src = in;
+ uint8_t *dst = out;
if ((in == NULL) || (out == NULL))
{
@@ -3497,7 +3495,7 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
/* shift_width = ((bps + 7) / 8) + 1; */
ready_bits = shift;
- maskbits = (uint64)-1 >> ( 64 - bps);
+ maskbits = (uint64_t)-1 >> (64 - bps);
for (col = start; col < end; col++)
{
/* Compute src byte(s) and bits within byte(s) */
@@ -3528,9 +3526,9 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
if ((col == start) && (sindex == sample))
- buff2 = buff3 & ((uint64)-1) << (32 - shift);
+ buff2 = buff3 & ((uint64_t)-1) << (32 - shift);
buff1 = (buff3 & matchbits) << (src_bit);
@@ -3569,15 +3567,15 @@ extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols,
} /* end extractContigSamplesShifted32bits */
static int
-extractContigSamplesToBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols,
- tsample_t sample, uint16 spp, uint16 bps,
+extractContigSamplesToBuffer(uint8_t *out, uint8_t *in, uint32_t rows, uint32_t cols,
+ tsample_t sample, uint16_t spp, uint16_t bps,
struct dump_opts *dump)
{
int shift_width, bytes_per_sample, bytes_per_pixel;
- uint32 src_rowsize, src_offset, row, first_col = 0;
- uint32 dst_rowsize, dst_offset;
+ uint32_t src_rowsize, src_offset, row, first_col = 0;
+ uint32_t dst_rowsize, dst_offset;
tsample_t count = 1;
- uint8 *src, *dst;
+ uint8_t *src, *dst;
bytes_per_sample = (bps + 7) / 8;
bytes_per_pixel = ((bps * spp) + 7) / 8;
@@ -3645,14 +3643,14 @@ extractContigSamplesToBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols,
} /* end extractContigSamplesToBuffer */
static int
-extractContigSamplesToTileBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols,
- uint32 imagewidth, uint32 tilewidth, tsample_t sample,
- uint16 count, uint16 spp, uint16 bps, struct dump_opts *dump)
+extractContigSamplesToTileBuffer(uint8_t *out, uint8_t *in, uint32_t rows, uint32_t cols,
+ uint32_t imagewidth, uint32_t tilewidth, tsample_t sample,
+ uint16_t count, uint16_t spp, uint16_t bps, struct dump_opts *dump)
{
int shift_width, bytes_per_sample, bytes_per_pixel;
- uint32 src_rowsize, src_offset, row;
- uint32 dst_rowsize, dst_offset;
- uint8 *src, *dst;
+ uint32_t src_rowsize, src_offset, row;
+ uint32_t dst_rowsize, dst_offset;
+ uint8_t *src, *dst;
bytes_per_sample = (bps + 7) / 8;
bytes_per_pixel = ((bps * spp) + 7) / 8;
@@ -3721,14 +3719,14 @@ extractContigSamplesToTileBuffer(uint8 *out, uint8 *in, uint32 rows, uint32 cols
return (0);
} /* end extractContigSamplesToTileBuffer */
-static int readContigStripsIntoBuffer (TIFF* in, uint8* buf)
+static int readContigStripsIntoBuffer (TIFF* in, uint8_t* buf)
{
- uint8* bufp = buf;
- int32 bytes_read = 0;
- uint32 strip, nstrips = TIFFNumberOfStrips(in);
- uint32 stripsize = TIFFStripSize(in);
- uint32 rows = 0;
- uint32 rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);
+ uint8_t* bufp = buf;
+ int32_t bytes_read = 0;
+ uint32_t strip, nstrips = TIFFNumberOfStrips(in);
+ uint32_t stripsize = TIFFStripSize(in);
+ uint32_t rows = 0;
+ uint32_t rps = TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rps);
tsize_t scanline_size = TIFFScanlineSize(in);
if (scanline_size == 0) {
@@ -3739,7 +3737,7 @@ static int readContigStripsIntoBuffer (TIFF* in, uint8* buf)
for (strip = 0; strip < nstrips; strip++) {
bytes_read = TIFFReadEncodedStrip (in, strip, bufp, -1);
rows = bytes_read / scanline_size;
- if ((strip < (nstrips - 1)) && (bytes_read != (int32)stripsize))
+ if ((strip < (nstrips - 1)) && (bytes_read != (int32_t)stripsize))
TIFFError("", "Strip %d: read %lu bytes, strip size %lu",
(int)strip + 1, (unsigned long) bytes_read,
(unsigned long)stripsize);
@@ -3757,11 +3755,11 @@ static int readContigStripsIntoBuffer (TIFF* in, uint8* buf)
static int
combineSeparateSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,
- uint32 cols, uint32 rows, uint16 spp, uint16 bps,
+ uint32_t cols, uint32_t rows, uint16_t spp, uint16_t bps,
FILE *dumpfile, int format, int level)
{
int i, bytes_per_sample;
- uint32 row, col, col_offset, src_rowsize, dst_rowsize, row_offset;
+ uint32_t row, col, col_offset, src_rowsize, dst_rowsize, row_offset;
unsigned char *src;
unsigned char *dst;
tsample_t s;
@@ -3814,17 +3812,17 @@ combineSeparateSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,
} /* end combineSeparateSamplesBytes */
static int
-combineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateSamples8bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0;
/* int bytes_per_sample = 0; */
- uint32 src_rowsize, dst_rowsize, src_offset;
- uint32 bit_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint8 maskbits = 0, matchbits = 0;
- uint8 buff1 = 0, buff2 = 0;
+ uint32_t src_rowsize, dst_rowsize, src_offset;
+ uint32_t bit_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint8_t maskbits = 0, matchbits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -3839,7 +3837,7 @@ combineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
- maskbits = (uint8)-1 >> ( 8 - bps);
+ maskbits = (uint8_t)-1 >> (8 - bps);
for (row = 0; row < rows; row++)
{
@@ -3914,17 +3912,17 @@ combineSeparateSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateSamples8bits */
static int
-combineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateSamples16bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0 /*, bytes_per_sample = 0 */;
- uint32 src_rowsize, dst_rowsize;
- uint32 bit_offset, src_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint16 maskbits = 0, matchbits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
+ uint32_t src_rowsize, dst_rowsize;
+ uint32_t bit_offset, src_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint16_t maskbits = 0, matchbits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -3939,7 +3937,7 @@ combineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
- maskbits = (uint16)-1 >> (16 - bps);
+ maskbits = (uint16_t)-1 >> (16 - bps);
for (row = 0; row < rows; row++)
{
@@ -4024,17 +4022,17 @@ combineSeparateSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateSamples16bits */
static int
-combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateSamples24bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0 /*, bytes_per_sample = 0 */;
- uint32 src_rowsize, dst_rowsize;
- uint32 bit_offset, src_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint32 maskbits = 0, matchbits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
+ uint32_t src_rowsize, dst_rowsize;
+ uint32_t bit_offset, src_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint32_t maskbits = 0, matchbits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4049,7 +4047,7 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
- maskbits = (uint32)-1 >> ( 32 - bps);
+ maskbits = (uint32_t)-1 >> (32 - bps);
for (row = 0; row < rows; row++)
{
@@ -4069,9 +4067,9 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
{
src = in[s] + src_offset + src_byte;
if (little_endian)
- buff1 = ((uint32)src[0] << 24) | ((uint32)src[1] << 16) | ((uint32)src[2] << 8) | (uint32)src[3];
+ buff1 = ((uint32_t)src[0] << 24) | ((uint32_t)src[1] << 16) | ((uint32_t)src[2] << 8) | (uint32_t)src[3];
else
- buff1 = ((uint32)src[3] << 24) | ((uint32)src[2] << 16) | ((uint32)src[1] << 8) | (uint32)src[0];
+ buff1 = ((uint32_t)src[3] << 24) | ((uint32_t)src[2] << 16) | ((uint32_t)src[1] << 8) | (uint32_t)src[0];
buff1 = (buff1 & matchbits) << (src_bit);
/* If we have a full buffer's worth, write it out */
@@ -4148,18 +4146,18 @@ combineSeparateSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateSamples24bits */
static int
-combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0 /*, bytes_per_sample = 0, shift_width = 0 */;
- uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;
- uint32 src_byte = 0, src_bit = 0;
- uint32 row, col;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 maskbits = 0, matchbits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint32_t src_rowsize, dst_rowsize, bit_offset, src_offset;
+ uint32_t src_byte = 0, src_bit = 0;
+ uint32_t row, col;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t maskbits = 0, matchbits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4174,7 +4172,7 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
/* bytes_per_sample = (bps + 7) / 8; */
src_rowsize = ((bps * cols) + 7) / 8;
dst_rowsize = ((bps * cols * spp) + 7) / 8;
- maskbits = (uint64)-1 >> ( 64 - bps);
+ maskbits = (uint64_t)-1 >> (64 - bps);
/* shift_width = ((bps + 7) / 8) + 1; */
for (row = 0; row < rows; row++)
@@ -4204,7 +4202,7 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
longbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
buff1 = (buff3 & matchbits) << (src_bit);
/* If we have a full buffer's worth, write it out */
@@ -4280,12 +4278,12 @@ combineSeparateSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
static int
combineSeparateTileSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,
- uint32 cols, uint32 rows, uint32 imagewidth,
- uint32 tw, uint16 spp, uint16 bps,
+ uint32_t cols, uint32_t rows, uint32_t imagewidth,
+ uint32_t tw, uint16_t spp, uint16_t bps,
FILE *dumpfile, int format, int level)
{
int i, bytes_per_sample;
- uint32 row, col, col_offset, src_rowsize, dst_rowsize, src_offset;
+ uint32_t row, col, col_offset, src_rowsize, dst_rowsize, src_offset;
unsigned char *src;
unsigned char *dst;
tsample_t s;
@@ -4340,17 +4338,17 @@ combineSeparateTileSamplesBytes (unsigned char *srcbuffs[], unsigned char *out,
} /* end combineSeparateTileSamplesBytes */
static int
-combineSeparateTileSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint32 imagewidth,
- uint32 tw, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateTileSamples8bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint32_t imagewidth,
+ uint32_t tw, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0;
- uint32 src_rowsize, dst_rowsize, src_offset;
- uint32 bit_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint8 maskbits = 0, matchbits = 0;
- uint8 buff1 = 0, buff2 = 0;
+ uint32_t src_rowsize, dst_rowsize, src_offset;
+ uint32_t bit_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint8_t maskbits = 0, matchbits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4364,7 +4362,7 @@ combineSeparateTileSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
src_rowsize = ((bps * tw) + 7) / 8;
dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;
- maskbits = (uint8)-1 >> ( 8 - bps);
+ maskbits = (uint8_t)-1 >> (8 - bps);
for (row = 0; row < rows; row++)
{
@@ -4439,18 +4437,18 @@ combineSeparateTileSamples8bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateTileSamples8bits */
static int
-combineSeparateTileSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint32 imagewidth,
- uint32 tw, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateTileSamples16bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint32_t imagewidth,
+ uint32_t tw, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0;
- uint32 src_rowsize, dst_rowsize;
- uint32 bit_offset, src_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint16 maskbits = 0, matchbits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
+ uint32_t src_rowsize, dst_rowsize;
+ uint32_t bit_offset, src_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint16_t maskbits = 0, matchbits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4464,7 +4462,7 @@ combineSeparateTileSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
src_rowsize = ((bps * tw) + 7) / 8;
dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;
- maskbits = (uint16)-1 >> (16 - bps);
+ maskbits = (uint16_t)-1 >> (16 - bps);
for (row = 0; row < rows; row++)
{
@@ -4548,18 +4546,18 @@ combineSeparateTileSamples16bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateTileSamples16bits */
static int
-combineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint32 imagewidth,
- uint32 tw, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateTileSamples24bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint32_t imagewidth,
+ uint32_t tw, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0;
- uint32 src_rowsize, dst_rowsize;
- uint32 bit_offset, src_offset;
- uint32 row, col, src_byte = 0, src_bit = 0;
- uint32 maskbits = 0, matchbits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
+ uint32_t src_rowsize, dst_rowsize;
+ uint32_t bit_offset, src_offset;
+ uint32_t row, col, src_byte = 0, src_bit = 0;
+ uint32_t maskbits = 0, matchbits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4573,7 +4571,7 @@ combineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
src_rowsize = ((bps * tw) + 7) / 8;
dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;
- maskbits = (uint32)-1 >> ( 32 - bps);
+ maskbits = (uint32_t)-1 >> (32 - bps);
for (row = 0; row < rows; row++)
{
@@ -4672,19 +4670,19 @@ combineSeparateTileSamples24bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateTileSamples24bits */
static int
-combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
- uint32 rows, uint32 imagewidth,
- uint32 tw, uint16 spp, uint16 bps,
- FILE *dumpfile, int format, int level)
+combineSeparateTileSamples32bits (uint8_t *in[], uint8_t *out, uint32_t cols,
+ uint32_t rows, uint32_t imagewidth,
+ uint32_t tw, uint16_t spp, uint16_t bps,
+ FILE *dumpfile, int format, int level)
{
int ready_bits = 0 /*, shift_width = 0 */;
- uint32 src_rowsize, dst_rowsize, bit_offset, src_offset;
- uint32 src_byte = 0, src_bit = 0;
- uint32 row, col;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 maskbits = 0, matchbits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint32_t src_rowsize, dst_rowsize, bit_offset, src_offset;
+ uint32_t src_byte = 0, src_bit = 0;
+ uint32_t row, col;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t maskbits = 0, matchbits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
tsample_t s;
unsigned char *src = in[0];
unsigned char *dst = out;
@@ -4698,7 +4696,7 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
src_rowsize = ((bps * tw) + 7) / 8;
dst_rowsize = ((imagewidth * bps * spp) + 7) / 8;
- maskbits = (uint64)-1 >> ( 64 - bps);
+ maskbits = (uint64_t)-1 >> (64 - bps);
/* shift_width = ((bps + 7) / 8) + 1; */
for (row = 0; row < rows; row++)
@@ -4729,7 +4727,7 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
buff1 = (buff3 & matchbits) << (src_bit);
/* If we have a full buffer's worth, write it out */
@@ -4804,18 +4802,18 @@ combineSeparateTileSamples32bits (uint8 *in[], uint8 *out, uint32 cols,
} /* end combineSeparateTileSamples32bits */
-static int readSeparateStripsIntoBuffer (TIFF *in, uint8 *obuf, uint32 length,
- uint32 width, uint16 spp,
+static int readSeparateStripsIntoBuffer (TIFF *in, uint8_t *obuf, uint32_t length,
+ uint32_t width, uint16_t spp,
struct dump_opts *dump)
{
int i, bytes_per_sample, bytes_per_pixel, shift_width, result = 1;
- uint32 j;
- int32 bytes_read = 0;
- uint16 bps = 0, planar;
- uint32 nstrips;
- uint32 strips_per_sample;
- uint32 src_rowsize, dst_rowsize, rows_processed, rps;
- uint32 rows_this_strip = 0;
+ uint32_t j;
+ int32_t bytes_read = 0;
+ uint16_t bps = 0, planar;
+ uint32_t nstrips;
+ uint32_t strips_per_sample;
+ uint32_t src_rowsize, dst_rowsize, rows_processed, rps;
+ uint32_t rows_this_strip = 0;
tsample_t s;
tstrip_t strip;
tsize_t scanlinesize = TIFFScanlineSize(in);
@@ -5041,11 +5039,11 @@ initPageSetup (struct pagedef *page, struct pageseg *pagelist,
for (i = 0; i < MAX_SECTIONS; i++)
{
- pagelist[i].x1 = (uint32)0;
- pagelist[i].x2 = (uint32)0;
- pagelist[i].y1 = (uint32)0;
- pagelist[i].y2 = (uint32)0;
- pagelist[i].buffsize = (uint32)0;
+ pagelist[i].x1 = (uint32_t)0;
+ pagelist[i].x2 = (uint32_t)0;
+ pagelist[i].y1 = (uint32_t)0;
+ pagelist[i].y2 = (uint32_t)0;
+ pagelist[i].buffsize = (uint32_t)0;
pagelist[i].position = 0;
pagelist[i].total = 0;
}
@@ -5086,15 +5084,15 @@ initCropMasks (struct crop_mask *cps)
cps->length = 0;
for (i = 0; i < 4; i++)
cps->margins[i] = 0.0;
- cps->bufftotal = (uint32)0;
- cps->combined_width = (uint32)0;
- cps->combined_length = (uint32)0;
- cps->rotation = (uint16)0;
+ cps->bufftotal = (uint32_t)0;
+ cps->combined_width = (uint32_t)0;
+ cps->combined_length = (uint32_t)0;
+ cps->rotation = (uint16_t)0;
cps->photometric = INVERT_DATA_AND_TAG;
- cps->mirror = (uint16)0;
- cps->invert = (uint16)0;
- cps->zones = (uint32)0;
- cps->regions = (uint32)0;
+ cps->mirror = (uint16_t)0;
+ cps->invert = (uint16_t)0;
+ cps->zones = (uint32_t)0;
+ cps->regions = (uint32_t)0;
for (i = 0; i < MAX_REGIONS; i++)
{
cps->corners[i].X1 = 0.0;
@@ -5137,12 +5135,12 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
float xres, yres;
/* Values for these offsets are in pixels from start of image, not bytes,
* and are indexed from zero to width - 1 or length - 1 */
- uint32 tmargin, bmargin, lmargin, rmargin;
- uint32 startx, endx; /* offsets of first and last columns to extract */
- uint32 starty, endy; /* offsets of first and last row to extract */
- uint32 width, length, crop_width, crop_length;
- uint32 i, max_width, max_length, zwidth, zlength, buffsize;
- uint32 x1, x2, y1, y2;
+ uint32_t tmargin, bmargin, lmargin, rmargin;
+ uint32_t startx, endx; /* offsets of first and last columns to extract */
+ uint32_t starty, endy; /* offsets of first and last row to extract */
+ uint32_t width, length, crop_width, crop_length;
+ uint32_t i, max_width, max_length, zwidth, zlength, buffsize;
+ uint32_t x1, x2, y1, y2;
if (image->res_unit != RESUNIT_INCH && image->res_unit != RESUNIT_CENTIMETER)
{
@@ -5187,38 +5185,38 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
{
if ((crop->res_unit == RESUNIT_INCH) || (crop->res_unit == RESUNIT_CENTIMETER))
{
- x1 = (uint32) (crop->corners[i].X1 * scale * xres);
- x2 = (uint32) (crop->corners[i].X2 * scale * xres);
- y1 = (uint32) (crop->corners[i].Y1 * scale * yres);
- y2 = (uint32) (crop->corners[i].Y2 * scale * yres);
+ x1 = (uint32_t) (crop->corners[i].X1 * scale * xres);
+ x2 = (uint32_t) (crop->corners[i].X2 * scale * xres);
+ y1 = (uint32_t) (crop->corners[i].Y1 * scale * yres);
+ y2 = (uint32_t) (crop->corners[i].Y2 * scale * yres);
}
else
{
- x1 = (uint32) (crop->corners[i].X1);
- x2 = (uint32) (crop->corners[i].X2);
- y1 = (uint32) (crop->corners[i].Y1);
- y2 = (uint32) (crop->corners[i].Y2);
+ x1 = (uint32_t) (crop->corners[i].X1);
+ x2 = (uint32_t) (crop->corners[i].X2);
+ y1 = (uint32_t) (crop->corners[i].Y1);
+ y2 = (uint32_t) (crop->corners[i].Y2);
}
if (x1 < 1)
crop->regionlist[i].x1 = 0;
else
- crop->regionlist[i].x1 = (uint32) (x1 - 1);
+ crop->regionlist[i].x1 = (uint32_t) (x1 - 1);
if (x2 > image->width - 1)
crop->regionlist[i].x2 = image->width - 1;
else
- crop->regionlist[i].x2 = (uint32) (x2 - 1);
+ crop->regionlist[i].x2 = (uint32_t) (x2 - 1);
zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
if (y1 < 1)
crop->regionlist[i].y1 = 0;
else
- crop->regionlist[i].y1 = (uint32) (y1 - 1);
+ crop->regionlist[i].y1 = (uint32_t) (y1 - 1);
if (y2 > image->length - 1)
crop->regionlist[i].y2 = image->length - 1;
else
- crop->regionlist[i].y2 = (uint32) (y2 - 1);
+ crop->regionlist[i].y2 = (uint32_t) (y2 - 1);
zlength = crop->regionlist[i].y2 - crop->regionlist[i].y1 + 1;
@@ -5227,7 +5225,7 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
if (zlength > max_length)
max_length = zlength;
- buffsize = (uint32)
+ buffsize = (uint32_t)
(((zwidth * image->bps * image->spp + 7 ) / 8) * (zlength + 1));
crop->regionlist[i].buffsize = buffsize;
@@ -5260,64 +5258,64 @@ computeInputPixelOffsets(struct crop_mask *crop, struct image_data *image,
{
if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER)
{ /* User has specified pixels as reference unit */
- tmargin = (uint32)(crop->margins[0]);
- lmargin = (uint32)(crop->margins[1]);
- bmargin = (uint32)(crop->margins[2]);
- rmargin = (uint32)(crop->margins[3]);
+ tmargin = (uint32_t)(crop->margins[0]);
+ lmargin = (uint32_t)(crop->margins[1]);
+ bmargin = (uint32_t)(crop->margins[2]);
+ rmargin = (uint32_t)(crop->margins[3]);
}
else
{ /* inches or centimeters specified */
- tmargin = (uint32)(crop->margins[0] * scale * yres);
- lmargin = (uint32)(crop->margins[1] * scale * xres);
- bmargin = (uint32)(crop->margins[2] * scale * yres);
- rmargin = (uint32)(crop->margins[3] * scale * xres);
+ tmargin = (uint32_t)(crop->margins[0] * scale * yres);
+ lmargin = (uint32_t)(crop->margins[1] * scale * xres);
+ bmargin = (uint32_t)(crop->margins[2] * scale * yres);
+ rmargin = (uint32_t)(crop->margins[3] * scale * xres);
}
if ((lmargin + rmargin) > image->width)
{
TIFFError("computeInputPixelOffsets", "Combined left and right margins exceed image width");
- lmargin = (uint32) 0;
- rmargin = (uint32) 0;
+ lmargin = (uint32_t) 0;
+ rmargin = (uint32_t) 0;
return (-1);
}
if ((tmargin + bmargin) > image->length)
{
TIFFError("computeInputPixelOffsets", "Combined top and bottom margins exceed image length");
- tmargin = (uint32) 0;
- bmargin = (uint32) 0;
+ tmargin = (uint32_t) 0;
+ bmargin = (uint32_t) 0;
return (-1);
}
}
else
{ /* no margins requested */
- tmargin = (uint32) 0;
- lmargin = (uint32) 0;
- bmargin = (uint32) 0;
- rmargin = (uint32) 0;
+ tmargin = (uint32_t) 0;
+ lmargin = (uint32_t) 0;
+ bmargin = (uint32_t) 0;
+ rmargin = (uint32_t) 0;
}
/* Width, height, and margins are expressed as pixel offsets into image */
if (crop->res_unit != RESUNIT_INCH && crop->res_unit != RESUNIT_CENTIMETER)
{
if (crop->crop_mode & CROP_WIDTH)
- width = (uint32)crop->width;
+ width = (uint32_t)crop->width;
else
width = image->width - lmargin - rmargin;
if (crop->crop_mode & CROP_LENGTH)
- length = (uint32)crop->length;
+ length = (uint32_t)crop->length;
else
length = image->length - tmargin - bmargin;
}
else
{
if (crop->crop_mode & CROP_WIDTH)
- width = (uint32)(crop->width * scale * image->xres);
+ width = (uint32_t)(crop->width * scale * image->xres);
else
width = image->width - lmargin - rmargin;
if (crop->crop_mode & CROP_LENGTH)
- length = (uint32)(crop->length * scale * image->yres);
+ length = (uint32_t)(crop->length * scale * image->yres);
else
length = image->length - tmargin - bmargin;
}
@@ -5421,15 +5419,15 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
{
struct offset offsets;
int i;
- int32 test;
- uint32 seg, total, need_buff = 0;
- uint32 buffsize;
- uint32 zwidth, zlength;
+ int32_t test;
+ uint32_t seg, total, need_buff = 0;
+ uint32_t buffsize;
+ uint32_t zwidth, zlength;
memset(&offsets, '\0', sizeof(struct offset));
crop->bufftotal = 0;
- crop->combined_width = (uint32)0;
- crop->combined_length = (uint32)0;
+ crop->combined_width = (uint32_t)0;
+ crop->combined_length = (uint32_t)0;
crop->selections = 0;
/* Compute pixel offsets if margins or fixed width or length specified */
@@ -5508,14 +5506,14 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
crop->regionlist[i].y2 = offsets.endy;
crop->regionlist[i].x1 = offsets.startx +
- (uint32)(offsets.crop_width * 1.0 * (seg - 1) / total);
- test = (int32)offsets.startx +
- (int32)(offsets.crop_width * 1.0 * seg / total);
+ (uint32_t)(offsets.crop_width * 1.0 * (seg - 1) / total);
+ test = (int32_t)offsets.startx +
+ (int32_t)(offsets.crop_width * 1.0 * seg / total);
if (test < 1 )
crop->regionlist[i].x2 = 0;
else
{
- if (test > (int32)(image->width - 1))
+ if (test > (int32_t)(image->width - 1))
crop->regionlist[i].x2 = image->width - 1;
else
crop->regionlist[i].x2 = test - 1;
@@ -5523,18 +5521,18 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
/* This is passed to extractCropZone or extractCompositeZones */
- crop->combined_length = (uint32)zlength;
+ crop->combined_length = (uint32_t)zlength;
if (crop->exp_mode == COMPOSITE_IMAGES)
- crop->combined_width += (uint32)zwidth;
+ crop->combined_width += (uint32_t)zwidth;
else
- crop->combined_width = (uint32)zwidth;
+ crop->combined_width = (uint32_t)zwidth;
break;
case EDGE_BOTTOM: /* width from left, zones from bottom to top */
zwidth = offsets.crop_width;
crop->regionlist[i].x1 = offsets.startx;
crop->regionlist[i].x2 = offsets.endx;
- test = offsets.endy - (uint32)(offsets.crop_length * 1.0 * seg / total);
+ test = offsets.endy - (uint32_t)(offsets.crop_length * 1.0 * seg / total);
if (test < 1 )
crop->regionlist[i].y1 = 0;
else
@@ -5545,7 +5543,7 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
crop->regionlist[i].y2 = 0;
else
{
- if (test > (int32)(image->length - 1))
+ if (test > (int32_t)(image->length - 1))
crop->regionlist[i].y2 = image->length - 1;
else
crop->regionlist[i].y2 = test;
@@ -5554,10 +5552,10 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
/* This is passed to extractCropZone or extractCompositeZones */
if (crop->exp_mode == COMPOSITE_IMAGES)
- crop->combined_length += (uint32)zlength;
+ crop->combined_length += (uint32_t)zlength;
else
- crop->combined_length = (uint32)zlength;
- crop->combined_width = (uint32)zwidth;
+ crop->combined_length = (uint32_t)zlength;
+ crop->combined_width = (uint32_t)zwidth;
break;
case EDGE_RIGHT: /* zones from right to left, length from top */
zlength = offsets.crop_length;
@@ -5565,14 +5563,14 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
crop->regionlist[i].y2 = offsets.endy;
crop->regionlist[i].x1 = offsets.startx +
- (uint32)(offsets.crop_width * (total - seg) * 1.0 / total);
+ (uint32_t)(offsets.crop_width * (total - seg) * 1.0 / total);
test = offsets.startx +
(offsets.crop_width * (total - seg + 1) * 1.0 / total);
if (test < 1 )
crop->regionlist[i].x2 = 0;
else
{
- if (test > (int32)(image->width - 1))
+ if (test > (int32_t)(image->width - 1))
crop->regionlist[i].x2 = image->width - 1;
else
crop->regionlist[i].x2 = test - 1;
@@ -5580,11 +5578,11 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
zwidth = crop->regionlist[i].x2 - crop->regionlist[i].x1 + 1;
/* This is passed to extractCropZone or extractCompositeZones */
- crop->combined_length = (uint32)zlength;
+ crop->combined_length = (uint32_t)zlength;
if (crop->exp_mode == COMPOSITE_IMAGES)
- crop->combined_width += (uint32)zwidth;
+ crop->combined_width += (uint32_t)zwidth;
else
- crop->combined_width = (uint32)zwidth;
+ crop->combined_width = (uint32_t)zwidth;
break;
case EDGE_TOP: /* width from left, zones from top to bottom */
default:
@@ -5592,13 +5590,13 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
crop->regionlist[i].x1 = offsets.startx;
crop->regionlist[i].x2 = offsets.endx;
- crop->regionlist[i].y1 = offsets.starty + (uint32)(offsets.crop_length * 1.0 * (seg - 1) / total);
- test = offsets.starty + (uint32)(offsets.crop_length * 1.0 * seg / total);
+ crop->regionlist[i].y1 = offsets.starty + (uint32_t)(offsets.crop_length * 1.0 * (seg - 1) / total);
+ test = offsets.starty + (uint32_t)(offsets.crop_length * 1.0 * seg / total);
if (test < 1 )
crop->regionlist[i].y2 = 0;
else
{
- if (test > (int32)(image->length - 1))
+ if (test > (int32_t)(image->length - 1))
crop->regionlist[i].y2 = image->length - 1;
else
crop->regionlist[i].y2 = test - 1;
@@ -5607,26 +5605,26 @@ getCropOffsets(struct image_data *image, struct crop_mask *crop, struct dump_opt
/* This is passed to extractCropZone or extractCompositeZones */
if (crop->exp_mode == COMPOSITE_IMAGES)
- crop->combined_length += (uint32)zlength;
+ crop->combined_length += (uint32_t)zlength;
else
- crop->combined_length = (uint32)zlength;
- crop->combined_width = (uint32)zwidth;
+ crop->combined_length = (uint32_t)zlength;
+ crop->combined_width = (uint32_t)zwidth;
break;
} /* end switch statement */
- buffsize = (uint32)
+ buffsize = (uint32_t)
((((zwidth * image->bps * image->spp) + 7 ) / 8) * (zlength + 1));
- crop->regionlist[i].width = (uint32) zwidth;
- crop->regionlist[i].length = (uint32) zlength;
+ crop->regionlist[i].width = (uint32_t) zwidth;
+ crop->regionlist[i].length = (uint32_t) zlength;
crop->regionlist[i].buffsize = buffsize;
crop->bufftotal += buffsize;
if (dump->outfile != NULL)
- dump_info (dump->outfile, dump->format, "", "Zone %d, width: %4d, length: %4d, x1: %4d x2: %4d y1: %4d y2: %4d",
- i + 1, (uint32)zwidth, (uint32)zlength,
- crop->regionlist[i].x1, crop->regionlist[i].x2,
- crop->regionlist[i].y1, crop->regionlist[i].y2);
+ dump_info (dump->outfile, dump->format, "", "Zone %d, width: %4d, length: %4d, x1: %4d x2: %4d y1: %4d y2: %4d",
+ i + 1, (uint32_t)zwidth, (uint32_t)zlength,
+ crop->regionlist[i].x1, crop->regionlist[i].x2,
+ crop->regionlist[i].y1, crop->regionlist[i].y2);
}
return (0);
@@ -5640,13 +5638,13 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
{
double scale;
double pwidth, plength; /* Output page width and length in user units*/
- uint32 iwidth, ilength; /* Input image width and length in pixels*/
- uint32 owidth, olength; /* Output image width and length in pixels*/
- uint32 orows, ocols; /* rows and cols for output */
- uint32 hmargin, vmargin; /* Horizontal and vertical margins */
- uint32 x1, x2, y1, y2, line_bytes;
+ uint32_t iwidth, ilength; /* Input image width and length in pixels*/
+ uint32_t owidth, olength; /* Output image width and length in pixels*/
+ uint32_t orows, ocols; /* rows and cols for output */
+ uint32_t hmargin, vmargin; /* Horizontal and vertical margins */
+ uint32_t x1, x2, y1, y2, line_bytes;
/* unsigned int orientation; */
- uint32 i, j, k;
+ uint32_t i, j, k;
scale = 1.0;
if (page->res_unit == RESUNIT_NONE)
@@ -5716,27 +5714,27 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
{
if (page->res_unit == RESUNIT_INCH || page->res_unit == RESUNIT_CENTIMETER)
{ /* inches or centimeters specified */
- hmargin = (uint32)(page->hmargin * scale * page->hres * ((image->bps + 7)/ 8));
- vmargin = (uint32)(page->vmargin * scale * page->vres * ((image->bps + 7)/ 8));
+ hmargin = (uint32_t)(page->hmargin * scale * page->hres * ((image->bps + 7) / 8));
+ vmargin = (uint32_t)(page->vmargin * scale * page->vres * ((image->bps + 7) / 8));
}
else
{ /* Otherwise user has specified pixels as reference unit */
- hmargin = (uint32)(page->hmargin * scale * ((image->bps + 7)/ 8));
- vmargin = (uint32)(page->vmargin * scale * ((image->bps + 7)/ 8));
+ hmargin = (uint32_t)(page->hmargin * scale * ((image->bps + 7) / 8));
+ vmargin = (uint32_t)(page->vmargin * scale * ((image->bps + 7) / 8));
}
if ((hmargin * 2.0) > (pwidth * page->hres))
{
TIFFError("computeOutputPixelOffsets",
"Combined left and right margins exceed page width");
- hmargin = (uint32) 0;
+ hmargin = (uint32_t) 0;
return (-1);
}
if ((vmargin * 2.0) > (plength * page->vres))
{
TIFFError("computeOutputPixelOffsets",
"Combined top and bottom margins exceed page length");
- vmargin = (uint32) 0;
+ vmargin = (uint32_t) 0;
return (-1);
}
}
@@ -5760,13 +5758,13 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
{
if (page->mode & PAGE_MODE_PAPERSIZE )
{
- owidth = (uint32)((pwidth * page->hres) - (hmargin * 2));
- olength = (uint32)((plength * page->vres) - (vmargin * 2));
+ owidth = (uint32_t)((pwidth * page->hres) - (hmargin * 2));
+ olength = (uint32_t)((plength * page->vres) - (vmargin * 2));
}
else
{
- owidth = (uint32)(iwidth - (hmargin * 2 * page->hres));
- olength = (uint32)(ilength - (vmargin * 2 * page->vres));
+ owidth = (uint32_t)(iwidth - (hmargin * 2 * page->hres));
+ olength = (uint32_t)(ilength - (vmargin * 2 * page->vres));
}
}
@@ -5841,14 +5839,14 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
/* build the list of offsets for each output section */
for (k = 0, i = 0 && k <= MAX_SECTIONS; i < orows; i++)
{
- y1 = (uint32)(olength * i);
- y2 = (uint32)(olength * (i + 1) - 1);
+ y1 = (uint32_t)(olength * i);
+ y2 = (uint32_t)(olength * (i + 1) - 1);
if (y2 >= ilength)
y2 = ilength - 1;
for (j = 0; j < ocols; j++, k++)
{
- x1 = (uint32)(owidth * j);
- x2 = (uint32)(owidth * (j + 1) - 1);
+ x1 = (uint32_t)(owidth * j);
+ x2 = (uint32_t)(owidth * (j + 1) - 1);
if (x2 >= iwidth)
x2 = iwidth - 1;
sections[k].x1 = x1;
@@ -5866,22 +5864,22 @@ computeOutputPixelOffsets (struct crop_mask *crop, struct image_data *image,
static int
loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned char **read_ptr)
{
- uint32 i;
+ uint32_t i;
float xres = 0.0, yres = 0.0;
- uint32 nstrips = 0, ntiles = 0;
- uint16 planar = 0;
- uint16 bps = 0, spp = 0, res_unit = 0;
- uint16 orientation = 0;
- uint16 input_compression = 0, input_photometric = 0;
- uint16 subsampling_horiz, subsampling_vert;
- uint32 width = 0, length = 0;
- uint32 stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0;
- uint32 tw = 0, tl = 0; /* Tile width and length */
- uint32 tile_rowsize = 0;
+ uint32_t nstrips = 0, ntiles = 0;
+ uint16_t planar = 0;
+ uint16_t bps = 0, spp = 0, res_unit = 0;
+ uint16_t orientation = 0;
+ uint16_t input_compression = 0, input_photometric = 0;
+ uint16_t subsampling_horiz, subsampling_vert;
+ uint32_t width = 0, length = 0;
+ uint32_t stsize = 0, tlsize = 0, buffsize = 0, scanlinesize = 0;
+ uint32_t tw = 0, tl = 0; /* Tile width and length */
+ uint32_t tile_rowsize = 0;
unsigned char *read_buff = NULL;
unsigned char *new_buff = NULL;
int readunit = 0;
- static uint32 prev_readsize = 0;
+ static uint32_t prev_readsize = 0;
TIFFGetFieldDefaulted(in, TIFFTAG_BITSPERSAMPLE, &bps);
TIFFGetFieldDefaulted(in, TIFFTAG_SAMPLESPERPIXEL, &spp);
@@ -6089,7 +6087,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
exit(EXIT_FAILURE);
}
- if (buffsize < (uint32)(ntiles * tl * tile_rowsize))
+ if (buffsize < (uint32_t)(ntiles * tl * tile_rowsize))
{
buffsize = ntiles * tl * tile_rowsize;
if (ntiles != (buffsize / tl / tile_rowsize))
@@ -6112,7 +6110,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
}
else
{
- uint32 buffsize_check;
+ uint32_t buffsize_check;
readunit = STRIP;
TIFFGetFieldDefaulted(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
stsize = TIFFStripSize(in);
@@ -6135,7 +6133,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
TIFFError("loadImage", "Integer overflow detected.");
exit(EXIT_FAILURE);
}
- if (buffsize < (uint32) (((length * width * spp * bps) + 7) / 8))
+ if (buffsize < (uint32_t) (((length * width * spp * bps) + 7) / 8))
{
buffsize = ((length * width * spp * bps) + 7) / 8;
#ifdef DEBUG2
@@ -6280,7 +6278,7 @@ loadImage(TIFF* in, struct image_data *image, struct dump_opts *dump, unsigned c
static int correct_orientation(struct image_data *image, unsigned char **work_buff_ptr)
{
- uint16 mirror, rotation;
+ uint16_t mirror, rotation;
unsigned char *work_buff;
work_buff = *work_buff_ptr;
@@ -6292,7 +6290,7 @@ static int correct_orientation(struct image_data *image, unsigned char **work_b
if ((image->adjustments & MIRROR_HORIZ) || (image->adjustments & MIRROR_VERT))
{
- mirror = (uint16)(image->adjustments & MIRROR_BOTH);
+ mirror = (uint16_t)(image->adjustments & MIRROR_BOTH);
if (mirrorImage(image->spp, image->bps, mirror,
image->width, image->length, work_buff))
{
@@ -6304,13 +6302,13 @@ static int correct_orientation(struct image_data *image, unsigned char **work_b
if (image->adjustments & ROTATE_ANY)
{
if (image->adjustments & ROTATECW_90)
- rotation = (uint16) 90;
+ rotation = (uint16_t) 90;
else
if (image->adjustments & ROTATECW_180)
- rotation = (uint16) 180;
+ rotation = (uint16_t) 180;
else
if (image->adjustments & ROTATECW_270)
- rotation = (uint16) 270;
+ rotation = (uint16_t) 270;
else
{
TIFFError ("correct_orientation", "Invalid rotation value: %d",
@@ -6336,13 +6334,13 @@ extractCompositeRegions(struct image_data *image, struct crop_mask *crop,
unsigned char *read_buff, unsigned char *crop_buff)
{
int shift_width, bytes_per_sample, bytes_per_pixel;
- uint32 i, trailing_bits, prev_trailing_bits;
- uint32 row, first_row, last_row, first_col, last_col;
- uint32 src_rowsize, dst_rowsize, src_offset, dst_offset;
- uint32 crop_width, crop_length, img_width /*, img_length */;
- uint32 prev_length, prev_width, composite_width;
- uint16 bps, spp;
- uint8 *src, *dst;
+ uint32_t i, trailing_bits, prev_trailing_bits;
+ uint32_t row, first_row, last_row, first_col, last_col;
+ uint32_t src_rowsize, dst_rowsize, src_offset, dst_offset;
+ uint32_t crop_width, crop_length, img_width /*, img_length */;
+ uint32_t prev_length, prev_width, composite_width;
+ uint16_t bps, spp;
+ uint8_t *src, *dst;
tsample_t count, sample = 0; /* Update to extract one or more samples */
img_width = image->width;
@@ -6585,13 +6583,13 @@ extractSeparateRegion(struct image_data *image, struct crop_mask *crop,
int region)
{
int shift_width, prev_trailing_bits = 0;
- uint32 bytes_per_sample, bytes_per_pixel;
- uint32 src_rowsize, dst_rowsize;
- uint32 row, first_row, last_row, first_col, last_col;
- uint32 src_offset, dst_offset;
- uint32 crop_width, crop_length, img_width /*, img_length */;
- uint16 bps, spp;
- uint8 *src, *dst;
+ uint32_t bytes_per_sample, bytes_per_pixel;
+ uint32_t src_rowsize, dst_rowsize;
+ uint32_t row, first_row, last_row, first_col, last_col;
+ uint32_t src_offset, dst_offset;
+ uint32_t crop_width, crop_length, img_width /*, img_length */;
+ uint16_t bps, spp;
+ uint8_t *src, *dst;
tsample_t count, sample = 0; /* Update to extract more or more samples */
img_width = image->width;
@@ -6711,19 +6709,19 @@ extractImageSection(struct image_data *image, struct pageseg *section,
/* unsigned char *src, *dst; */
#endif
- uint32 img_width, img_rowsize;
+ uint32_t img_width, img_rowsize;
#ifdef DEVELMODE
- uint32 img_length;
+ uint32_t img_length;
#endif
- uint32 j, shift1, shift2, trailing_bits;
- uint32 row, first_row, last_row, first_col, last_col;
- uint32 src_offset, dst_offset, row_offset, col_offset;
- uint32 offset1, offset2, full_bytes;
- uint32 sect_width;
+ uint32_t j, shift1, shift2, trailing_bits;
+ uint32_t row, first_row, last_row, first_col, last_col;
+ uint32_t src_offset, dst_offset, row_offset, col_offset;
+ uint32_t offset1, offset2, full_bytes;
+ uint32_t sect_width;
#ifdef DEVELMODE
- uint32 sect_length;
+ uint32_t sect_length;
#endif
- uint16 bps, spp;
+ uint16_t bps, spp;
#ifdef DEVELMODE
int k;
@@ -7048,7 +7046,7 @@ writeImageSections(TIFF *in, TIFF *out, struct image_data *image,
unsigned char **sect_buff_ptr)
{
double hres, vres;
- uint32 i, k, width, length, sectsize;
+ uint32_t i, k, width, length, sectsize;
unsigned char *sect_buff = *sect_buff_ptr;
hres = page->hres;
@@ -7066,7 +7064,7 @@ writeImageSections(TIFF *in, TIFF *out, struct image_data *image,
{
width = sections[i].x2 - sections[i].x1 + 1;
length = sections[i].y2 - sections[i].y1 + 1;
- sectsize = (uint32)
+ sectsize = (uint32_t)
ceil((width * image->bps + 7) / (double)8) * image->spp * length;
/* allocate a buffer if we don't have one already */
if (createImageSection(sectsize, sect_buff_ptr))
@@ -7101,13 +7099,13 @@ writeImageSections(TIFF *in, TIFF *out, struct image_data *image,
*/
static int
writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
- struct dump_opts *dump, uint32 width, uint32 length,
+ struct dump_opts *dump, uint32_t width, uint32_t length,
double hres, double vres,
unsigned char *sect_buff)
{
- uint16 bps, spp;
- uint16 input_compression, input_photometric;
- uint16 input_planar;
+ uint16_t bps, spp;
+ uint16_t input_compression, input_photometric;
+ uint16_t input_planar;
const struct cpTag* p;
/* Calling this seems to reset the compression mode on the TIFF *in file.
@@ -7132,8 +7130,8 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
* if the user has specified a command line option for
* a compression option. Should be passed around in one
* of the parameters instead of as a global. If no user
- * option specified it will still be (uint16) -1. */
- if (compression != (uint16)-1)
+ * option specified it will still be (uint16_t) -1. */
+ if (compression != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
else
{ /* OJPEG is no longer supported for writing so upgrade to JPEG */
@@ -7217,9 +7215,9 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
* input image or, if nothing is defined, use the
* library default.
*/
- if (tilewidth == (uint32) 0)
+ if (tilewidth == (uint32_t) 0)
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
- if (tilelength == (uint32) 0)
+ if (tilelength == (uint32_t) 0)
TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
if (tilewidth == 0 || tilelength == 0)
@@ -7233,7 +7231,7 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
* value from the input image or, if nothing is defined,
* use the library default.
*/
- if (rowsperstrip == (uint32) 0)
+ if (rowsperstrip == (uint32_t) 0)
{
if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip))
rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
@@ -7244,13 +7242,13 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
}
}
else
- if (rowsperstrip == (uint32) -1)
+ if (rowsperstrip == (uint32_t) -1)
rowsperstrip = length;
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
}
TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &input_planar);
- if (config != (uint16) -1)
+ if (config != (uint16_t) -1)
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
else
CopyField(TIFFTAG_PLANARCONFIG, config);
@@ -7279,7 +7277,7 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
- if (predictor != (uint16)-1)
+ if (predictor != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
else
CopyField(TIFFTAG_PREDICTOR, predictor);
@@ -7287,7 +7285,7 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
case COMPRESSION_CCITTFAX3:
case COMPRESSION_CCITTFAX4:
if (compression == COMPRESSION_CCITTFAX3) {
- if (g3opts != (uint32) -1)
+ if (g3opts != (uint32_t) -1)
TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);
else
CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
@@ -7302,12 +7300,12 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
CopyTag(TIFFTAG_FAXSUBADDRESS, 1, TIFF_ASCII);
break;
}
- { uint32 len32;
+ { uint32_t len32;
void** data;
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
}
- { uint16 ninks;
+ { uint16_t ninks;
const char* inknames;
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
@@ -7371,11 +7369,11 @@ writeSingleSection(TIFF *in, TIFF *out, struct image_data *image,
/* Create a buffer to write one section at a time */
static int
-createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr)
+createImageSection(uint32_t sectsize, unsigned char **sect_buff_ptr)
{
unsigned char *sect_buff = NULL;
unsigned char *new_buff = NULL;
- static uint32 prev_sectsize = 0;
+ static uint32_t prev_sectsize = 0;
sect_buff = *sect_buff_ptr;
@@ -7420,7 +7418,7 @@ processCropSelections(struct image_data *image, struct crop_mask *crop,
unsigned char **read_buff_ptr, struct buffinfo seg_buffs[])
{
int i;
- uint32 width, length, total_width, total_length;
+ uint32_t width, length, total_width, total_length;
tsize_t cropsize;
unsigned char *crop_buff = NULL;
unsigned char *read_buff = NULL;
@@ -7778,13 +7776,13 @@ createCroppedImage(struct image_data *image, struct crop_mask *crop,
* then passed in as an argument.
*/
static int
-writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
- struct dump_opts *dump, uint32 width, uint32 length,
+writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
+ struct dump_opts *dump, uint32_t width, uint32_t length,
unsigned char *crop_buff, int pagenum, int total_pages)
{
- uint16 bps, spp;
- uint16 input_compression, input_photometric;
- uint16 input_planar;
+ uint16_t bps, spp;
+ uint16_t input_compression, input_photometric;
+ uint16_t input_planar;
const struct cpTag* p;
input_compression = image->compression;
@@ -7803,7 +7801,7 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
((input_compression == COMPRESSION_JPEG) ? "New Jpeg" : "Non Jpeg"));
#endif
- if (compression != (uint16)-1)
+ if (compression != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
else
{
@@ -7892,9 +7890,9 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
* input image or, if nothing is defined, use the
* library default.
*/
- if (tilewidth == (uint32) 0)
+ if (tilewidth == (uint32_t) 0)
TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
- if (tilelength == (uint32) 0)
+ if (tilelength == (uint32_t) 0)
TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
if (tilewidth == 0 || tilelength == 0)
@@ -7907,7 +7905,7 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
* value from the input image or, if nothing is defined,
* use the library default.
*/
- if (rowsperstrip == (uint32) 0)
+ if (rowsperstrip == (uint32_t) 0)
{
if (!TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip))
rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
@@ -7918,13 +7916,13 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
}
}
else
- if (rowsperstrip == (uint32) -1)
+ if (rowsperstrip == (uint32_t) -1)
rowsperstrip = length;
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
}
TIFFGetFieldDefaulted(in, TIFFTAG_PLANARCONFIG, &input_planar);
- if (config != (uint16) -1)
+ if (config != (uint16_t) -1)
TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
else
CopyField(TIFFTAG_PLANARCONFIG, config);
@@ -7950,7 +7948,7 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
case COMPRESSION_LZW:
case COMPRESSION_ADOBE_DEFLATE:
case COMPRESSION_DEFLATE:
- if (predictor != (uint16)-1)
+ if (predictor != (uint16_t)-1)
TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
else
CopyField(TIFFTAG_PREDICTOR, predictor);
@@ -7964,7 +7962,7 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
return (-1);
}
if (compression == COMPRESSION_CCITTFAX3) {
- if (g3opts != (uint32) -1)
+ if (g3opts != (uint32_t) -1)
TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);
else
CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
@@ -7982,12 +7980,12 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
break;
default: break;
}
- { uint32 len32;
+ { uint32_t len32;
void** data;
if (TIFFGetField(in, TIFFTAG_ICCPROFILE, &len32, &data))
TIFFSetField(out, TIFFTAG_ICCPROFILE, len32, data);
}
- { uint16 ninks;
+ { uint16_t ninks;
const char* inknames;
if (TIFFGetField(in, TIFFTAG_NUMBEROFINKS, &ninks)) {
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, ninks);
@@ -8054,15 +8052,15 @@ writeCroppedImage(TIFF *in, TIFF *out, struct image_data *image,
} /* end writeCroppedImage */
static int
-rotateContigSamples8bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
- uint32 length, uint32 col, uint8 *src, uint8 *dst)
+rotateContigSamples8bits(uint16_t rotation, uint16_t spp, uint16_t bps, uint32_t width,
+ uint32_t length, uint32_t col, uint8_t *src, uint8_t *dst)
{
int ready_bits = 0;
- uint32 src_byte = 0, src_bit = 0;
- uint32 row, rowsize = 0, bit_offset = 0;
- uint8 matchbits = 0, maskbits = 0;
- uint8 buff1 = 0, buff2 = 0;
- uint8 *next;
+ uint32_t src_byte = 0, src_bit = 0;
+ uint32_t row, rowsize = 0, bit_offset = 0;
+ uint8_t matchbits = 0, maskbits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
+ uint8_t *next;
tsample_t sample;
if ((src == NULL) || (dst == NULL))
@@ -8073,7 +8071,7 @@ rotateContigSamples8bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
rowsize = ((bps * spp * width) + 7) / 8;
ready_bits = 0;
- maskbits = (uint8)-1 >> ( 8 - bps);
+ maskbits = (uint8_t)-1 >> (8 - bps);
buff1 = buff2 = 0;
for (row = 0; row < length ; row++)
@@ -8130,16 +8128,16 @@ rotateContigSamples8bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
static int
-rotateContigSamples16bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
- uint32 length, uint32 col, uint8 *src, uint8 *dst)
+rotateContigSamples16bits(uint16_t rotation, uint16_t spp, uint16_t bps, uint32_t width,
+ uint32_t length, uint32_t col, uint8_t *src, uint8_t *dst)
{
int ready_bits = 0;
- uint32 row, rowsize, bit_offset;
- uint32 src_byte = 0, src_bit = 0;
- uint16 matchbits = 0, maskbits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
- uint8 *next;
+ uint32_t row, rowsize, bit_offset;
+ uint32_t src_byte = 0, src_bit = 0;
+ uint16_t matchbits = 0, maskbits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
+ uint8_t *next;
tsample_t sample;
if ((src == NULL) || (dst == NULL))
@@ -8150,7 +8148,7 @@ rotateContigSamples16bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
rowsize = ((bps * spp * width) + 7) / 8;
ready_bits = 0;
- maskbits = (uint16)-1 >> (16 - bps);
+ maskbits = (uint16_t)-1 >> (16 - bps);
buff1 = buff2 = 0;
for (row = 0; row < length; row++)
{
@@ -8213,16 +8211,16 @@ rotateContigSamples16bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
} /* end rotateContigSamples16bits */
static int
-rotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
- uint32 length, uint32 col, uint8 *src, uint8 *dst)
+rotateContigSamples24bits(uint16_t rotation, uint16_t spp, uint16_t bps, uint32_t width,
+ uint32_t length, uint32_t col, uint8_t *src, uint8_t *dst)
{
int ready_bits = 0;
- uint32 row, rowsize, bit_offset;
- uint32 src_byte = 0, src_bit = 0;
- uint32 matchbits = 0, maskbits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
- uint8 *next;
+ uint32_t row, rowsize, bit_offset;
+ uint32_t src_byte = 0, src_bit = 0;
+ uint32_t matchbits = 0, maskbits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
+ uint8_t *next;
tsample_t sample;
@@ -8234,7 +8232,7 @@ rotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
rowsize = ((bps * spp * width) + 7) / 8;
ready_bits = 0;
- maskbits = (uint32)-1 >> (32 - bps);
+ maskbits = (uint32_t)-1 >> (32 - bps);
buff1 = buff2 = 0;
for (row = 0; row < length; row++)
{
@@ -8304,18 +8302,18 @@ rotateContigSamples24bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
} /* end rotateContigSamples24bits */
static int
-rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
- uint32 length, uint32 col, uint8 *src, uint8 *dst)
+rotateContigSamples32bits(uint16_t rotation, uint16_t spp, uint16_t bps, uint32_t width,
+ uint32_t length, uint32_t col, uint8_t *src, uint8_t *dst)
{
int ready_bits = 0 /*, shift_width = 0 */;
/* int bytes_per_sample, bytes_per_pixel; */
- uint32 row, rowsize, bit_offset;
- uint32 src_byte, src_bit;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 maskbits = 0, matchbits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
- uint8 *next;
+ uint32_t row, rowsize, bit_offset;
+ uint32_t src_byte, src_bit;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t maskbits = 0, matchbits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint8_t *next;
tsample_t sample;
@@ -8334,7 +8332,7 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
rowsize = ((bps * spp * width) + 7) / 8;
ready_bits = 0;
- maskbits = (uint64)-1 >> (64 - bps);
+ maskbits = (uint64_t)-1 >> (64 - bps);
buff1 = buff2 = 0;
for (row = 0; row < length; row++)
{
@@ -8373,7 +8371,7 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
buff1 = (buff3 & matchbits) << (src_bit);
if (ready_bits < 32)
@@ -8413,18 +8411,18 @@ rotateContigSamples32bits(uint16 rotation, uint16 spp, uint16 bps, uint32 width,
/* Rotate an image by a multiple of 90 degrees clockwise */
static int
-rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
- uint32 *img_length, unsigned char **ibuff_ptr)
+rotateImage(uint16_t rotation, struct image_data *image, uint32_t *img_width,
+ uint32_t *img_length, unsigned char **ibuff_ptr)
{
int shift_width;
- uint32 bytes_per_pixel, bytes_per_sample;
- uint32 row, rowsize, src_offset, dst_offset;
- uint32 i, col, width, length;
- uint32 colsize, buffsize, col_offset, pix_offset;
+ uint32_t bytes_per_pixel, bytes_per_sample;
+ uint32_t row, rowsize, src_offset, dst_offset;
+ uint32_t i, col, width, length;
+ uint32_t colsize, buffsize, col_offset, pix_offset;
unsigned char *ibuff;
unsigned char *src;
unsigned char *dst;
- uint16 spp, bps;
+ uint16_t spp, bps;
float res_temp;
unsigned char *rbuff = NULL;
@@ -8695,15 +8693,15 @@ rotateImage(uint16 rotation, struct image_data *image, uint32 *img_width,
} /* end rotateImage */
static int
-reverseSamples8bits (uint16 spp, uint16 bps, uint32 width,
- uint8 *ibuff, uint8 *obuff)
+reverseSamples8bits (uint16_t spp, uint16_t bps, uint32_t width,
+ uint8_t *ibuff, uint8_t *obuff)
{
int ready_bits = 0;
- uint32 col;
- uint32 src_byte, src_bit;
- uint32 bit_offset = 0;
- uint8 match_bits = 0, mask_bits = 0;
- uint8 buff1 = 0, buff2 = 0;
+ uint32_t col;
+ uint32_t src_byte, src_bit;
+ uint32_t bit_offset = 0;
+ uint8_t match_bits = 0, mask_bits = 0;
+ uint8_t buff1 = 0, buff2 = 0;
unsigned char *src;
unsigned char *dst;
tsample_t sample;
@@ -8715,7 +8713,7 @@ reverseSamples8bits (uint16 spp, uint16 bps, uint32 width,
}
ready_bits = 0;
- mask_bits = (uint8)-1 >> ( 8 - bps);
+ mask_bits = (uint8_t)-1 >> (8 - bps);
dst = obuff;
for (col = width; col > 0; col--)
{
@@ -8760,16 +8758,16 @@ reverseSamples8bits (uint16 spp, uint16 bps, uint32 width,
static int
-reverseSamples16bits (uint16 spp, uint16 bps, uint32 width,
- uint8 *ibuff, uint8 *obuff)
+reverseSamples16bits (uint16_t spp, uint16_t bps, uint32_t width,
+ uint8_t *ibuff, uint8_t *obuff)
{
int ready_bits = 0;
- uint32 col;
- uint32 src_byte = 0, high_bit = 0;
- uint32 bit_offset = 0;
- uint16 match_bits = 0, mask_bits = 0;
- uint16 buff1 = 0, buff2 = 0;
- uint8 bytebuff = 0;
+ uint32_t col;
+ uint32_t src_byte = 0, high_bit = 0;
+ uint32_t bit_offset = 0;
+ uint16_t match_bits = 0, mask_bits = 0;
+ uint16_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff = 0;
unsigned char *src;
unsigned char *dst;
tsample_t sample;
@@ -8781,7 +8779,7 @@ reverseSamples16bits (uint16 spp, uint16 bps, uint32 width,
}
ready_bits = 0;
- mask_bits = (uint16)-1 >> (16 - bps);
+ mask_bits = (uint16_t)-1 >> (16 - bps);
dst = obuff;
for (col = width; col > 0; col--)
{
@@ -8835,16 +8833,16 @@ reverseSamples16bits (uint16 spp, uint16 bps, uint32 width,
} /* end reverseSamples16bits */
static int
-reverseSamples24bits (uint16 spp, uint16 bps, uint32 width,
- uint8 *ibuff, uint8 *obuff)
+reverseSamples24bits (uint16_t spp, uint16_t bps, uint32_t width,
+ uint8_t *ibuff, uint8_t *obuff)
{
int ready_bits = 0;
- uint32 col;
- uint32 src_byte = 0, high_bit = 0;
- uint32 bit_offset = 0;
- uint32 match_bits = 0, mask_bits = 0;
- uint32 buff1 = 0, buff2 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0;
+ uint32_t col;
+ uint32_t src_byte = 0, high_bit = 0;
+ uint32_t bit_offset = 0;
+ uint32_t match_bits = 0, mask_bits = 0;
+ uint32_t buff1 = 0, buff2 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0;
unsigned char *src;
unsigned char *dst;
tsample_t sample;
@@ -8856,7 +8854,7 @@ reverseSamples24bits (uint16 spp, uint16 bps, uint32 width,
}
ready_bits = 0;
- mask_bits = (uint32)-1 >> (32 - bps);
+ mask_bits = (uint32_t)-1 >> (32 - bps);
dst = obuff;
for (col = width; col > 0; col--)
{
@@ -8919,18 +8917,18 @@ reverseSamples24bits (uint16 spp, uint16 bps, uint32 width,
static int
-reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
- uint8 *ibuff, uint8 *obuff)
+reverseSamples32bits (uint16_t spp, uint16_t bps, uint32_t width,
+ uint8_t *ibuff, uint8_t *obuff)
{
int ready_bits = 0 /*, shift_width = 0 */;
/* int bytes_per_sample, bytes_per_pixel; */
- uint32 bit_offset;
- uint32 src_byte = 0, high_bit = 0;
- uint32 col;
- uint32 longbuff1 = 0, longbuff2 = 0;
- uint64 mask_bits = 0, match_bits = 0;
- uint64 buff1 = 0, buff2 = 0, buff3 = 0;
- uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
+ uint32_t bit_offset;
+ uint32_t src_byte = 0, high_bit = 0;
+ uint32_t col;
+ uint32_t longbuff1 = 0, longbuff2 = 0;
+ uint64_t mask_bits = 0, match_bits = 0;
+ uint64_t buff1 = 0, buff2 = 0, buff3 = 0;
+ uint8_t bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0;
unsigned char *src;
unsigned char *dst;
tsample_t sample;
@@ -8942,7 +8940,7 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
}
ready_bits = 0;
- mask_bits = (uint64)-1 >> (64 - bps);
+ mask_bits = (uint64_t)-1 >> (64 - bps);
dst = obuff;
/* bytes_per_sample = (bps + 7) / 8; */
@@ -8981,7 +8979,7 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
longbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0];
longbuff2 = longbuff1;
}
- buff3 = ((uint64)longbuff1 << 32) | longbuff2;
+ buff3 = ((uint64_t)longbuff1 << 32) | longbuff2;
buff1 = (buff3 & match_bits) << (high_bit);
if (ready_bits < 32)
@@ -9019,12 +9017,12 @@ reverseSamples32bits (uint16 spp, uint16 bps, uint32 width,
} /* end reverseSamples32bits */
static int
-reverseSamplesBytes (uint16 spp, uint16 bps, uint32 width,
- uint8 *src, uint8 *dst)
+reverseSamplesBytes (uint16_t spp, uint16_t bps, uint32_t width,
+ uint8_t *src, uint8_t *dst)
{
int i;
- uint32 col, bytes_per_pixel, col_offset;
- uint8 bytebuff1;
+ uint32_t col, bytes_per_pixel, col_offset;
+ uint8_t bytebuff1;
unsigned char swapbuff[32];
if ((src == NULL) || (dst == NULL))
@@ -9073,11 +9071,11 @@ reverseSamplesBytes (uint16 spp, uint16 bps, uint32 width,
/* Mirror an image horizontally or vertically */
static int
-mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length, unsigned char *ibuff)
+mirrorImage(uint16_t spp, uint16_t bps, uint16_t mirror, uint32_t width, uint32_t length, unsigned char *ibuff)
{
int shift_width;
- uint32 bytes_per_pixel, bytes_per_sample;
- uint32 row, rowsize, row_offset;
+ uint32_t bytes_per_pixel, bytes_per_sample;
+ uint32_t row, rowsize, row_offset;
unsigned char *line_buff = NULL;
unsigned char *src;
unsigned char *dst;
@@ -9187,12 +9185,12 @@ mirrorImage(uint16 spp, uint16 bps, uint16 mirror, uint32 width, uint32 length,
/* Invert the light and dark values for a bilevel or grayscale image */
static int
-invertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 length, unsigned char *work_buff)
+invertImage(uint16_t photometric, uint16_t spp, uint16_t bps, uint32_t width, uint32_t length, unsigned char *work_buff)
{
- uint32 row, col;
+ uint32_t row, col;
unsigned char *src;
- uint16 *src_uint16;
- uint32 *src_uint32;
+ uint16_t *src_uint16;
+ uint32_t *src_uint32;
if (spp != 1)
{
@@ -9215,7 +9213,7 @@ invertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 len
switch (bps)
{
- case 32: src_uint32 = (uint32 *)src;
+ case 32: src_uint32 = (uint32_t *)src;
for (row = 0; row < length; row++)
for (col = 0; col < width; col++)
{
@@ -9223,7 +9221,7 @@ invertImage(uint16 photometric, uint16 spp, uint16 bps, uint32 width, uint32 len
src_uint32++;
}
break;
- case 16: src_uint16 = (uint16 *)src;
+ case 16: src_uint16 = (uint16_t *)src;
for (row = 0; row < length; row++)
for (col = 0; col < width; col++)
{
diff --git a/tools/tiffdither.c b/tools/tiffdither.c
index bc488a6a..e240ec35 100644
--- a/tools/tiffdither.c
+++ b/tools/tiffdither.c
@@ -49,8 +49,8 @@
#define CopyField(tag, v) \
if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
-uint32 imagewidth;
-uint32 imagelength;
+uint32_t imagewidth;
+uint32_t imagelength;
int threshold = 128;
static void usage(int code);
@@ -66,8 +66,8 @@ fsdither(TIFF* in, TIFF* out)
short *thisline, *nextline, *tmpptr;
register unsigned char *outptr;
register short *thisptr, *nextptr;
- register uint32 i, j;
- uint32 imax, jmax;
+ register uint32_t i, j;
+ uint32_t imax, jmax;
int lastline, lastpixel;
int bit;
tsize_t outlinesize;
@@ -153,9 +153,9 @@ fsdither(TIFF* in, TIFF* out)
return errcode;
}
-static uint16 compression = COMPRESSION_PACKBITS;
-static uint16 predictor = 0;
-static uint32 group3options = 0;
+static uint16_t compression = COMPRESSION_PACKBITS;
+static uint16_t predictor = 0;
+static uint32_t group3options = 0;
static void
processG3Options(char* cp)
@@ -206,11 +206,11 @@ int
main(int argc, char* argv[])
{
TIFF *in, *out;
- uint16 samplesperpixel, bitspersample = 1, shortv;
+ uint16_t samplesperpixel, bitspersample = 1, shortv;
float floatv;
char thing[1024];
- uint32 rowsperstrip = (uint32) -1;
- uint16 fillorder = 0;
+ uint32_t rowsperstrip = (uint32_t) -1;
+ uint16_t fillorder = 0;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
diff --git a/tools/tiffdump.c b/tools/tiffdump.c
index 81f7b98a..b0f05650 100644
--- a/tools/tiffdump.c
+++ b/tools/tiffdump.c
@@ -71,7 +71,7 @@ static char* curfile;
static int swabflag;
static int bigendian;
static int bigtiff;
-static uint32 maxitems = 24; /* maximum indirect data items to print */
+static uint32_t maxitems = 24; /* maximum indirect data items to print */
static const char bytefmt[] = "%s%#02x"; /* BYTE */
static const char sbytefmt[] = "%s%d"; /* SBYTE */
@@ -100,7 +100,7 @@ static const char doublefmt[] = "%s%g"; /* DOUBLE */
unsigned int hex_mode;
-static void dump(int, uint64);
+static void dump(int, uint64_t);
#if !HAVE_DECL_OPTARG
extern int optind;
@@ -120,7 +120,7 @@ main(int argc, char* argv[])
int one = 1, fd;
int multiplefiles = (argc > 1);
int c;
- uint64 diroff = 0;
+ uint64_t diroff = 0;
hex_mode=0;
bigendian = (*(char *)&one == 0);
@@ -131,7 +131,7 @@ main(int argc, char* argv[])
hex_mode=1;
break;
case 'o':
- diroff = (uint64) strtoul(optarg, NULL, 0);
+ diroff = (uint64_t) strtoul(optarg, NULL, 0);
break;
case 'm':
maxitems = strtoul(optarg, NULL, 0);
@@ -161,16 +161,16 @@ main(int argc, char* argv[])
#define ord(e) ((int)e)
-static uint64 ReadDirectory(int, unsigned, uint64);
+static uint64_t ReadDirectory(int, unsigned, uint64_t);
static void ReadError(char*);
static void Error(const char*, ...);
static void Fatal(const char*, ...);
static void
-dump(int fd, uint64 diroff)
+dump(int fd, uint64_t diroff)
{
unsigned i, j;
- uint64* visited_diroff = NULL;
+ uint64_t* visited_diroff = NULL;
unsigned int count_visited_dir = 0;
_TIFF_lseek_f(fd, (_TIFF_off_t) 0, 0);
@@ -243,7 +243,7 @@ dump(int fd, uint64 diroff)
{
size_t alloc_size;
alloc_size=TIFFSafeMultiply(tmsize_t,(count_visited_dir + 1),
- sizeof(uint64));
+ sizeof(uint64_t));
if (alloc_size == 0)
{
if (visited_diroff)
@@ -252,7 +252,7 @@ dump(int fd, uint64 diroff)
}
else
{
- visited_diroff = (uint64*) realloc(visited_diroff,alloc_size);
+ visited_diroff = (uint64_t*) realloc(visited_diroff, alloc_size);
}
}
if( !visited_diroff )
@@ -290,24 +290,24 @@ static const int datawidth[] = {
8, /* 18 = TIFF_IFD8 */
};
#define NWIDTHS (sizeof (datawidth) / sizeof (datawidth[0]))
-static void PrintTag(FILE*, uint16);
-static void PrintType(FILE*, uint16);
-static void PrintData(FILE*, uint16, uint32, unsigned char*);
+static void PrintTag(FILE*, uint16_t);
+static void PrintType(FILE*, uint16_t);
+static void PrintData(FILE*, uint16_t, uint32_t, unsigned char*);
/*
* Read the next TIFF directory from a file
* and convert it to the internal format.
* We read directories sequentially.
*/
-static uint64
-ReadDirectory(int fd, unsigned int ix, uint64 off)
+static uint64_t
+ReadDirectory(int fd, unsigned int ix, uint64_t off)
{
- uint16 dircount;
- uint32 direntrysize;
+ uint16_t dircount;
+ uint32_t direntrysize;
void* dirmem = NULL;
- uint64 nextdiroff = 0;
- uint32 n;
- uint8* dp;
+ uint64_t nextdiroff = 0;
+ uint32_t n;
+ uint8_t* dp;
if (off == 0) /* no more directories */
goto done;
@@ -316,7 +316,7 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
goto done;
}
if (!bigtiff) {
- if (read(fd, (char*) &dircount, sizeof (uint16)) != sizeof (uint16)) {
+ if (read(fd, (char*) &dircount, sizeof (uint16_t)) != sizeof (uint16_t)) {
ReadError("directory count");
goto done;
}
@@ -324,8 +324,8 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
TIFFSwabShort(&dircount);
direntrysize = 12;
} else {
- uint64 dircount64 = 0;
- if (read(fd, (char*) &dircount64, sizeof (uint64)) != sizeof (uint64)) {
+ uint64_t dircount64 = 0;
+ if (read(fd, (char*) &dircount64, sizeof (uint64_t)) != sizeof (uint64_t)) {
ReadError("directory count");
goto done;
}
@@ -335,7 +335,7 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
Error("Sanity check on directory count failed");
goto done;
}
- dircount = (uint16)dircount64;
+ dircount = (uint16_t)dircount64;
direntrysize = 20;
}
dirmem = _TIFFmalloc(TIFFSafeMultiply(tmsize_t,dircount,direntrysize));
@@ -358,14 +358,14 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
nextdiroff = 0;
} else {
if (!bigtiff) {
- uint32 nextdiroff32;
- if (read(fd, (char*) &nextdiroff32, sizeof (uint32)) != sizeof (uint32))
+ uint32_t nextdiroff32;
+ if (read(fd, (char*) &nextdiroff32, sizeof (uint32_t)) != sizeof (uint32_t))
nextdiroff32 = 0;
if (swabflag)
TIFFSwabLong(&nextdiroff32);
nextdiroff = nextdiroff32;
} else {
- if (read(fd, (char*) &nextdiroff, sizeof (uint64)) != sizeof (uint64))
+ if (read(fd, (char*) &nextdiroff, sizeof (uint64_t)) != sizeof (uint64_t))
nextdiroff = 0;
if (swabflag)
TIFFSwabLong8(&nextdiroff);
@@ -380,24 +380,24 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
(unsigned long long)off, (unsigned long long)off,
(unsigned long long)nextdiroff, (unsigned long long)nextdiroff);
#endif
- for (dp = (uint8*)dirmem, n = dircount; n > 0; n--) {
- uint16 tag;
- uint16 type;
- uint16 typewidth;
- uint64 count;
- uint64 datasize;
+ for (dp = (uint8_t*)dirmem, n = dircount; n > 0; n--) {
+ uint16_t tag;
+ uint16_t type;
+ uint16_t typewidth;
+ uint64_t count;
+ uint64_t datasize;
int datafits;
void* datamem;
- uint64 dataoffset;
+ uint64_t dataoffset;
int datatruncated;
int datasizeoverflow;
- tag = *(uint16*)dp;
+ tag = *(uint16_t*)dp;
if (swabflag)
TIFFSwabShort(&tag);
- dp += sizeof(uint16);
- type = *(uint16*)dp;
- dp += sizeof(uint16);
+ dp += sizeof(uint16_t);
+ type = *(uint16_t*)dp;
+ dp += sizeof(uint16_t);
if (swabflag)
TIFFSwabShort(&type);
PrintTag(stdout, tag);
@@ -406,19 +406,19 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
putchar(' ');
if (!bigtiff)
{
- uint32 count32;
- count32 = *(uint32*)dp;
+ uint32_t count32;
+ count32 = *(uint32_t*)dp;
if (swabflag)
TIFFSwabLong(&count32);
- dp += sizeof(uint32);
+ dp += sizeof(uint32_t);
count = count32;
}
else
{
- memcpy(&count, dp, sizeof(uint64));
+ memcpy(&count, dp, sizeof(uint64_t));
if (swabflag)
TIFFSwabLong8(&count);
- dp += sizeof(uint64);
+ dp += sizeof(uint64_t);
}
#if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
printf("%I64u<", (unsigned __int64)count);
@@ -439,15 +439,15 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
{
if (datasizeoverflow || datasize>4)
{
- uint32 dataoffset32;
+ uint32_t dataoffset32;
datafits = 0;
datamem = NULL;
- dataoffset32 = *(uint32*)dp;
+ dataoffset32 = *(uint32_t*)dp;
if (swabflag)
TIFFSwabLong(&dataoffset32);
dataoffset = dataoffset32;
}
- dp += sizeof(uint32);
+ dp += sizeof(uint32_t);
}
else
{
@@ -455,11 +455,11 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
{
datafits = 0;
datamem = NULL;
- memcpy(&dataoffset, dp, sizeof(uint64));
+ memcpy(&dataoffset, dp, sizeof(uint64_t));
if (swabflag)
TIFFSwabLong8(&dataoffset);
}
- dp += sizeof(uint64);
+ dp += sizeof(uint64_t);
}
if (datasizeoverflow || datasize>0x10000)
{
@@ -485,7 +485,7 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
_TIFFfree(datamem);
datamem = NULL;
}
- else if (read(fd, datamem, (size_t)datasize) != (TIFF_SSIZE_T)datasize)
+ else if (read(fd, datamem, (size_t)datasize) != (tmsize_t)datasize)
{
Error(
"Read error accessing tag %u value", tag);
@@ -508,27 +508,27 @@ ReadDirectory(int fd, unsigned int ix, uint64 off)
break;
case TIFF_SHORT:
case TIFF_SSHORT:
- TIFFSwabArrayOfShort((uint16*)datamem,(tmsize_t)count);
+ TIFFSwabArrayOfShort((uint16_t*)datamem, (tmsize_t)count);
break;
case TIFF_LONG:
case TIFF_SLONG:
case TIFF_FLOAT:
case TIFF_IFD:
- TIFFSwabArrayOfLong((uint32*)datamem,(tmsize_t)count);
+ TIFFSwabArrayOfLong((uint32_t*)datamem, (tmsize_t)count);
break;
case TIFF_RATIONAL:
case TIFF_SRATIONAL:
- TIFFSwabArrayOfLong((uint32*)datamem,(tmsize_t)count*2);
+ TIFFSwabArrayOfLong((uint32_t*)datamem, (tmsize_t)count * 2);
break;
case TIFF_DOUBLE:
case TIFF_LONG8:
case TIFF_SLONG8:
case TIFF_IFD8:
- TIFFSwabArrayOfLong8((uint64*)datamem,(tmsize_t)count);
+ TIFFSwabArrayOfLong8((uint64_t*)datamem, (tmsize_t)count);
break;
}
}
- PrintData(stdout,type,(uint32)count,datamem);
+ PrintData(stdout, type, (uint32_t)count, datamem);
if (datatruncated)
printf(" ...");
if (!datafits)
@@ -546,7 +546,7 @@ done:
}
static const struct tagname {
- uint16 tag;
+ uint16_t tag;
const char* name;
} tagnames[] = {
{ TIFFTAG_SUBFILETYPE, "SubFileType" },
@@ -644,7 +644,7 @@ static const struct tagname {
#define NTAGS (sizeof (tagnames) / sizeof (tagnames[0]))
static void
-PrintTag(FILE* fd, uint16 tag)
+PrintTag(FILE* fd, uint16_t tag)
{
const struct tagname *tp;
@@ -657,7 +657,7 @@ PrintTag(FILE* fd, uint16 tag)
}
static void
-PrintType(FILE* fd, uint16 type)
+PrintType(FILE* fd, uint16_t type)
{
static const char *typenames[] = {
"0",
@@ -692,7 +692,7 @@ PrintType(FILE* fd, uint16 type)
#include <ctype.h>
static void
-PrintASCII(FILE* fd, uint32 cc, const unsigned char* cp)
+PrintASCII(FILE* fd, uint32_t cc, const unsigned char* cp)
{
for (; cc > 0; cc--, cp++) {
const char* tp;
@@ -714,7 +714,7 @@ PrintASCII(FILE* fd, uint32 cc, const unsigned char* cp)
}
static void
-PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
+PrintData(FILE* fd, uint16_t type, uint32_t count, unsigned char* data)
{
char* sep = "";
@@ -735,19 +735,19 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
PrintASCII(fd, count, data);
break;
case TIFF_SHORT: {
- uint16 *wp = (uint16*)data;
+ uint16_t *wp = (uint16_t*)data;
while (count-- > 0)
fprintf(fd, hex_mode ? shortfmth : shortfmtd, sep, *wp++), sep = " ";
break;
}
case TIFF_SSHORT: {
- int16 *wp = (int16*)data;
+ int16_t *wp = (int16_t*)data;
while (count-- > 0)
fprintf(fd, hex_mode ? sshortfmth : sshortfmtd, sep, *wp++), sep = " ";
break;
}
case TIFF_LONG: {
- uint32 *lp = (uint32*)data;
+ uint32_t *lp = (uint32_t*)data;
while (count-- > 0) {
fprintf(fd, hex_mode ? longfmth : longfmtd, sep, (unsigned long) *lp++);
sep = " ";
@@ -755,16 +755,16 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_SLONG: {
- int32 *lp = (int32*)data;
+ int32_t *lp = (int32_t*)data;
while (count-- > 0)
fprintf(fd, hex_mode ? slongfmth : slongfmtd, sep, (long) *lp++), sep = " ";
break;
}
case TIFF_LONG8: {
- uint64 *llp = (uint64*)data;
+ uint64_t *llp = (uint64_t*)data;
while (count-- > 0) {
- uint64 val;
- memcpy(&val, llp, sizeof(uint64));
+ uint64_t val;
+ memcpy(&val, llp, sizeof(uint64_t));
llp ++;
fprintf(fd, long8fmt, sep, (unsigned long long) val);
sep = " ";
@@ -772,10 +772,10 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_SLONG8: {
- int64 *llp = (int64*)data;
+ int64_t *llp = (int64_t*)data;
while (count-- > 0) {
- int64 val;
- memcpy(&val, llp, sizeof(int64));
+ int64_t val;
+ memcpy(&val, llp, sizeof(int64_t));
llp ++;
fprintf(fd, slong8fmt, sep, (long long) val);
sep = " ";
@@ -783,7 +783,7 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_RATIONAL: {
- uint32 *lp = (uint32*)data;
+ uint32_t *lp = (uint32_t*)data;
while (count-- > 0) {
if (lp[1] == 0)
fprintf(fd, "%sNan (%lu/%lu)", sep,
@@ -798,7 +798,7 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_SRATIONAL: {
- int32 *lp = (int32*)data;
+ int32_t *lp = (int32_t*)data;
while (count-- > 0) {
if (lp[1] == 0)
fprintf(fd, "%sNan (%ld/%ld)", sep,
@@ -824,7 +824,7 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_IFD: {
- uint32 *lp = (uint32*)data;
+ uint32_t *lp = (uint32_t*)data;
while (count-- > 0) {
fprintf(fd, ifdfmt, sep, (unsigned long) *lp++);
sep = " ";
@@ -832,7 +832,7 @@ PrintData(FILE* fd, uint16 type, uint32 count, unsigned char* data)
break;
}
case TIFF_IFD8: {
- uint64 *llp = (uint64*)data;
+ uint64_t *llp = (uint64_t*)data;
while (count-- > 0) {
#if defined(__WIN32__) && defined(_MSC_VER)
fprintf(fd, ifd8fmt, sep, (unsigned __int64) *llp++);
diff --git a/tools/tiffgt.c b/tools/tiffgt.c
index 561df5c9..f9e1e087 100644
--- a/tools/tiffgt.c
+++ b/tools/tiffgt.c
@@ -57,16 +57,16 @@
#define EXIT_FAILURE 1
#endif
-static uint32 width = 0, height = 0; /* window width & height */
-static uint32* raster = NULL; /* displayable image */
+static uint32_t width = 0, height = 0; /* window width & height */
+static uint32_t* raster = NULL; /* displayable image */
static TIFFRGBAImage img;
static int order0 = 0, order;
-static uint16 photo0 = (uint16) -1, photo;
+static uint16_t photo0 = (uint16_t) -1, photo;
static int stoponerr = 0; /* stop on read error */
static int verbose = 0;
#define TITLE_LENGTH 1024
static char title[TITLE_LENGTH]; /* window title line */
-static uint32 xmax, ymax;
+static uint32_t xmax, ymax;
static char** filelist = NULL;
static int fileindex;
static int filenum;
@@ -79,7 +79,7 @@ static int prevImage(void);
static int nextImage(void);
static void setWindowSize(void);
static void usage(int);
-static uint16 photoArg(const char*);
+static uint16_t photoArg(const char*);
static void raster_draw(void);
static void raster_reshape(int, int);
static void raster_keys(unsigned char, int, int);
@@ -103,7 +103,7 @@ main(int argc, char* argv[])
{
int c;
int dirnum = -1;
- uint32 diroff = 0;
+ uint32_t diroff = 0;
oerror = TIFFSetErrorHandler(NULL);
owarning = TIFFSetWarningHandler(NULL);
@@ -221,11 +221,11 @@ cleanup_and_exit(int code)
static int
initImage(void)
{
- uint32 w, h;
+ uint32_t w, h;
if (order)
TIFFSetField(tif, TIFFTAG_FILLORDER, order);
- if (photo != (uint16) -1)
+ if (photo != (uint16_t) -1)
TIFFSetField(tif, TIFFTAG_PHOTOMETRIC, photo);
if (!TIFFRGBAImageBegin(&img, tif, stoponerr, title)) {
TIFFError(filelist[fileindex], "%s", title);
@@ -249,12 +249,12 @@ initImage(void)
}
if (w != width || h != height) {
- uint32 rastersize =
+ uint32_t rastersize =
_TIFFMultiply32(tif, img.width, img.height, "allocating raster buffer");
if (raster != NULL)
_TIFFfree(raster), raster = NULL;
- raster = (uint32*) _TIFFCheckMalloc(tif, rastersize, sizeof (uint32),
- "allocating raster buffer");
+ raster = (uint32_t*) _TIFFCheckMalloc(tif, rastersize, sizeof (uint32_t),
+ "allocating raster buffer");
if (raster == NULL) {
width = height = 0;
TIFFError(filelist[fileindex], "No space for raster buffer");
@@ -459,7 +459,7 @@ usage(int code)
exit(code);
}
-static uint16
+static uint16_t
photoArg(const char* arg)
{
if (strcmp(arg, "miniswhite") == 0)
@@ -483,7 +483,7 @@ photoArg(const char* arg)
else if (strcmp(arg, "logluv") == 0)
return (PHOTOMETRIC_LOGLUV);
else
- return ((uint16) -1);
+ return ((uint16_t) -1);
}
/* vim: set ts=8 sts=8 sw=8 noet: */
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);
diff --git a/tools/tiffmedian.c b/tools/tiffmedian.c
index a7f9a923..d3726bc3 100644
--- a/tools/tiffmedian.c
+++ b/tools/tiffmedian.c
@@ -79,7 +79,7 @@ typedef struct colorbox {
int rmin, rmax;
int gmin, gmax;
int bmin, bmax;
- uint32 total;
+ uint32_t total;
} Colorbox;
typedef struct {
@@ -87,20 +87,20 @@ typedef struct {
int entries[MAX_CMAP_SIZE][2];
} C_cell;
-static uint16 rm[MAX_CMAP_SIZE], gm[MAX_CMAP_SIZE], bm[MAX_CMAP_SIZE];
+static uint16_t rm[MAX_CMAP_SIZE], gm[MAX_CMAP_SIZE], bm[MAX_CMAP_SIZE];
static int num_colors;
-static uint32 histogram[B_LEN][B_LEN][B_LEN];
+static uint32_t histogram[B_LEN][B_LEN][B_LEN];
static Colorbox *freeboxes;
static Colorbox *usedboxes;
static C_cell **ColorCells;
static TIFF *in, *out;
-static uint32 rowsperstrip = (uint32) -1;
-static uint16 compression = (uint16) -1;
-static uint16 bitspersample = 1;
-static uint16 samplesperpixel;
-static uint32 imagewidth;
-static uint32 imagelength;
-static uint16 predictor = 0;
+static uint32_t rowsperstrip = (uint32_t) -1;
+static uint16_t compression = (uint16_t) -1;
+static uint16_t bitspersample = 1;
+static uint16_t samplesperpixel;
+static uint32_t imagewidth;
+static uint32_t imagelength;
+static uint16_t predictor = 0;
static void get_histogram(TIFF*, Colorbox*);
static void splitbox(Colorbox*);
@@ -120,10 +120,10 @@ int
main(int argc, char* argv[])
{
int i, dither = 0;
- uint16 shortv, config, photometric;
+ uint16_t shortv, config, photometric;
Colorbox *box_list, *ptr;
float floatv;
- uint32 longv;
+ uint32_t longv;
int c;
#if !HAVE_DECL_OPTARG
extern int optind;
@@ -257,7 +257,7 @@ main(int argc, char* argv[])
CopyField(TIFFTAG_SUBFILETYPE, longv);
CopyField(TIFFTAG_IMAGEWIDTH, longv);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, (short)COLOR_DEPTH);
- if (compression != (uint16)-1) {
+ if (compression != (uint16_t)-1) {
TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
switch (compression) {
case COMPRESSION_LZW:
@@ -364,7 +364,7 @@ get_histogram(TIFF* in, Colorbox* box)
{
register unsigned char *inptr;
register int red, green, blue;
- register uint32 j, i;
+ register uint32_t j, i;
unsigned char *inputline;
inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
@@ -376,7 +376,7 @@ get_histogram(TIFF* in, Colorbox* box)
box->rmax = box->gmax = box->bmax = -1;
box->total = imagewidth * imagelength;
- { register uint32 *ptr = &histogram[0][0][0];
+ { register uint32_t *ptr = &histogram[0][0][0];
for (i = B_LEN*B_LEN*B_LEN; i-- > 0;)
*ptr++ = 0;
}
@@ -416,7 +416,7 @@ static Colorbox *
largest_box(void)
{
register Colorbox *p, *b;
- register uint32 size;
+ register uint32_t size;
b = NULL;
size = 0;
@@ -430,13 +430,13 @@ largest_box(void)
static void
splitbox(Colorbox* ptr)
{
- uint32 hist2[B_LEN];
+ uint32_t hist2[B_LEN];
int first=0, last=0;
register Colorbox *new;
- register uint32 *iptr, *histp;
+ register uint32_t *iptr, *histp;
register int i, j;
register int ir,ig,ib;
- register uint32 sum, sum1, sum2;
+ register uint32_t sum, sum1, sum2;
enum { RED, GREEN, BLUE } axis;
/*
@@ -552,7 +552,7 @@ splitbox(Colorbox* ptr)
static void
shrinkbox(Colorbox* box)
{
- register uint32 *histp;
+ register uint32_t *histp;
register int ir, ig, ib;
if (box->rmax > box->rmin) {
@@ -725,7 +725,7 @@ create_colorcell(int red, int green, int blue)
static void
map_colortable(void)
{
- register uint32 *histp = &histogram[0][0][0];
+ register uint32_t *histp = &histogram[0][0][0];
register C_cell *cell;
register int j, tmp, d2, dist;
int ir, ig, ib, i;
@@ -774,7 +774,7 @@ quant(TIFF* in, TIFF* out)
{
unsigned char *outline, *inputline;
register unsigned char *outptr, *inptr;
- register uint32 i, j;
+ register uint32_t i, j;
register int red, green, blue;
inputline = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
@@ -829,8 +829,8 @@ quant_fsdither(TIFF* in, TIFF* out)
short *thisline, *nextline;
register unsigned char *outptr;
register short *thisptr, *nextptr;
- register uint32 i, j;
- uint32 imax, jmax;
+ register uint32_t i, j;
+ uint32_t imax, jmax;
int lastline, lastpixel;
imax = imagelength - 1;
diff --git a/tools/tiffset.c b/tools/tiffset.c
index c38c50a9..ea31c5e4 100644
--- a/tools/tiffset.c
+++ b/tools/tiffset.c
@@ -218,37 +218,37 @@ main(int argc, char* argv[])
switch (TIFFFieldDataType(fip)) {
case TIFF_BYTE:
for (i = 0; i < wc; i++)
- ((uint8 *)array)[i] = atoi(argv[arg_index+i]);
+ ((uint8_t *)array)[i] = atoi(argv[arg_index + i]);
break;
case TIFF_SHORT:
for (i = 0; i < wc; i++)
- ((uint16 *)array)[i] = atoi(argv[arg_index+i]);
+ ((uint16_t *)array)[i] = atoi(argv[arg_index + i]);
break;
case TIFF_SBYTE:
for (i = 0; i < wc; i++)
- ((int8 *)array)[i] = atoi(argv[arg_index+i]);
+ ((int8_t *)array)[i] = atoi(argv[arg_index + i]);
break;
case TIFF_SSHORT:
for (i = 0; i < wc; i++)
- ((int16 *)array)[i] = atoi(argv[arg_index+i]);
+ ((int16_t *)array)[i] = atoi(argv[arg_index + i]);
break;
case TIFF_LONG:
for (i = 0; i < wc; i++)
- ((uint32 *)array)[i] = atol(argv[arg_index+i]);
+ ((uint32_t *)array)[i] = atol(argv[arg_index + i]);
break;
case TIFF_SLONG:
case TIFF_IFD:
for (i = 0; i < wc; i++)
- ((int32 *)array)[i] = atol(argv[arg_index+i]);
+ ((int32_t *)array)[i] = atol(argv[arg_index + i]);
break;
case TIFF_LONG8:
for (i = 0; i < wc; i++)
- ((uint64 *)array)[i] = strtoll(argv[arg_index+i], (char **)NULL, 10);
+ ((uint64_t *)array)[i] = strtoll(argv[arg_index + i], (char **)NULL, 10);
break;
case TIFF_SLONG8:
case TIFF_IFD8:
for (i = 0; i < wc; i++)
- ((int64 *)array)[i] = strtoll(argv[arg_index+i], (char **)NULL, 10);
+ ((int64_t *)array)[i] = strtoll(argv[arg_index + i], (char **)NULL, 10);
break;
case TIFF_DOUBLE:
for (i = 0; i < wc; i++)
@@ -273,10 +273,10 @@ main(int argc, char* argv[])
|| TIFFFieldTag(fip) == TIFFTAG_DOTRANGE) {
if (TIFFFieldDataType(fip) == TIFF_BYTE) {
ret = TIFFSetField(tiff, TIFFFieldTag(fip),
- ((uint8 *)array)[0], ((uint8 *)array)[1]);
+ ((uint8_t *)array)[0], ((uint8_t *)array)[1]);
} else if (TIFFFieldDataType(fip) == TIFF_SHORT) {
ret = TIFFSetField(tiff, TIFFFieldTag(fip),
- ((uint16 *)array)[0], ((uint16 *)array)[1]);
+ ((uint16_t *)array)[0], ((uint16_t *)array)[1]);
}
} else {
ret = TIFFSetField(tiff, TIFFFieldTag(fip),
@@ -364,7 +364,7 @@ main(int argc, char* argv[])
fclose( fp );
if(TIFFFieldPassCount( fip )) {
- ret = TIFFSetField( tiff, TIFFFieldTag(fip), (uint16)len, text );
+ ret = TIFFSetField(tiff, TIFFFieldTag(fip), (uint16_t)len, text );
} else {
ret = TIFFSetField( tiff, TIFFFieldTag(fip), text );
}
diff --git a/tools/tiffsplit.c b/tools/tiffsplit.c
index 5faf645b..d5578ae3 100644
--- a/tools/tiffsplit.c
+++ b/tools/tiffsplit.c
@@ -164,11 +164,11 @@ newfilename(void)
static int
tiffcp(TIFF* in, TIFF* out)
{
- uint16 bitspersample, samplesperpixel, compression, shortv, *shortav;
- uint32 w, l;
+ uint16_t bitspersample, samplesperpixel, compression, shortv, *shortav;
+ uint32_t w, l;
float floatv;
char *stringv;
- uint32 longv;
+ uint32_t longv;
CopyField(TIFFTAG_SUBFILETYPE, longv);
CopyField(TIFFTAG_TILEWIDTH, w);
@@ -179,7 +179,7 @@ tiffcp(TIFF* in, TIFF* out)
CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
CopyField(TIFFTAG_COMPRESSION, compression);
if (compression == COMPRESSION_JPEG) {
- uint32 count = 0;
+ uint32_t count = 0;
void *table = NULL;
if (TIFFGetField(in, TIFFTAG_JPEGTABLES, &count, &table)
&& count > 0 && table) {
@@ -206,10 +206,10 @@ tiffcp(TIFF* in, TIFF* out)
CopyField(TIFFTAG_TILEDEPTH, longv);
CopyField(TIFFTAG_SAMPLEFORMAT, shortv);
CopyField2(TIFFTAG_EXTRASAMPLES, shortv, shortav);
- { uint16 *red, *green, *blue;
+ { uint16_t *red, *green, *blue;
CopyField3(TIFFTAG_COLORMAP, red, green, blue);
}
- { uint16 shortv2;
+ { uint16_t shortv2;
CopyField2(TIFFTAG_PAGENUMBER, shortv, shortv2);
}
CopyField(TIFFTAG_ARTIST, stringv);
@@ -242,7 +242,7 @@ cpStrips(TIFF* in, TIFF* out)
if (buf) {
tstrip_t s, ns = TIFFNumberOfStrips(in);
- uint64 *bytecounts;
+ uint64_t *bytecounts;
if (!TIFFGetField(in, TIFFTAG_STRIPBYTECOUNTS, &bytecounts)) {
fprintf(stderr, "tiffsplit: strip byte counts are missing\n");
@@ -250,7 +250,7 @@ cpStrips(TIFF* in, TIFF* out)
return (0);
}
for (s = 0; s < ns; s++) {
- if (bytecounts[s] > (uint64)bufsize) {
+ if (bytecounts[s] > (uint64_t)bufsize) {
buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[s]);
if (!buf)
return (0);
@@ -276,7 +276,7 @@ cpTiles(TIFF* in, TIFF* out)
if (buf) {
ttile_t t, nt = TIFFNumberOfTiles(in);
- uint64 *bytecounts;
+ uint64_t *bytecounts;
if (!TIFFGetField(in, TIFFTAG_TILEBYTECOUNTS, &bytecounts)) {
fprintf(stderr, "tiffsplit: tile byte counts are missing\n");
@@ -284,7 +284,7 @@ cpTiles(TIFF* in, TIFF* out)
return (0);
}
for (t = 0; t < nt; t++) {
- if (bytecounts[t] > (uint64) bufsize) {
+ if (bytecounts[t] > (uint64_t) bufsize) {
buf = (unsigned char *)_TIFFrealloc(buf, (tmsize_t)bytecounts[t]);
if (!buf)
return (0);