diff options
author | Sam James <sam@gentoo.org> | 2022-09-21 14:18:08 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-10-02 04:31:25 +0100 |
commit | a529111f77ff46f4836fe7312e70953bc16587cf (patch) | |
tree | 9dc3924cb1a6ef3ef853b7bb45f735365e0b4e6d /tiff/contrib/pds | |
parent | Import Ghostscript 9.56.1 (diff) | |
download | ghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.tar.gz ghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.tar.bz2 ghostscript-gpl-patches-a529111f77ff46f4836fe7312e70953bc16587cf.zip |
Import Ghostscript 10.0ghostscript-10.0ghostscript-10
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'tiff/contrib/pds')
-rw-r--r-- | tiff/contrib/pds/CMakeLists.txt | 30 | ||||
-rw-r--r-- | tiff/contrib/pds/Makefile.am | 1 | ||||
-rw-r--r-- | tiff/contrib/pds/Makefile.in | 12 | ||||
-rw-r--r-- | tiff/contrib/pds/tif_imageiter.c | 76 | ||||
-rw-r--r-- | tiff/contrib/pds/tif_imageiter.h | 36 | ||||
-rw-r--r-- | tiff/contrib/pds/tif_pdsdirread.c | 188 | ||||
-rw-r--r-- | tiff/contrib/pds/tif_pdsdirwrite.c | 138 |
7 files changed, 226 insertions, 255 deletions
diff --git a/tiff/contrib/pds/CMakeLists.txt b/tiff/contrib/pds/CMakeLists.txt deleted file mode 100644 index 53a0e056..00000000 --- a/tiff/contrib/pds/CMakeLists.txt +++ /dev/null @@ -1,30 +0,0 @@ -# CMake build for libtiff -# -# Copyright © 2015 Open Microscopy Environment / University of Dundee -# Written by Roger Leigh <rleigh@codelibre.net> -# -# Permission to use, copy, modify, distribute, and sell this software and -# its documentation for any purpose is hereby granted without fee, provided -# that (i) the above copyright notices and this permission notice appear in -# all copies of the software and related documentation, and (ii) the names of -# Sam Leffler and Silicon Graphics may not be used in any advertising or -# publicity relating to the software without the specific, prior written -# permission of Sam Leffler and Silicon Graphics. -# -# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, -# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. -# -# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR -# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, -# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF -# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. - -extra_dist( - README - tif_imageiter.c - tif_imageiter.h - tif_pdsdirread.c - tif_pdsdirwrite.c) diff --git a/tiff/contrib/pds/Makefile.am b/tiff/contrib/pds/Makefile.am index 435e2b33..c4e6bafe 100644 --- a/tiff/contrib/pds/Makefile.am +++ b/tiff/contrib/pds/Makefile.am @@ -24,7 +24,6 @@ # Process this file with automake to produce Makefile.in. EXTRA_DIST = \ - CMakeLists.txt \ README \ tif_imageiter.c \ tif_imageiter.h \ diff --git a/tiff/contrib/pds/Makefile.in b/tiff/contrib/pds/Makefile.in index 77b02179..f3f79a82 100644 --- a/tiff/contrib/pds/Makefile.in +++ b/tiff/contrib/pds/Makefile.in @@ -1,7 +1,7 @@ -# Makefile.in generated by automake 1.16.2 from Makefile.am. +# Makefile.in generated by automake 1.16.1 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2020 Free Software Foundation, Inc. +# Copyright (C) 1994-2018 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -122,8 +122,10 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/libtiff/tif_config.h \ - $(top_builddir)/libtiff/tiffconf.h +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/libtiff/tif_config.h \ + $(top_builddir)/libtiff/tiffconf.h \ + $(top_builddir)/port/libport_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) @@ -287,6 +289,7 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ +runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ @@ -297,7 +300,6 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ - CMakeLists.txt \ README \ tif_imageiter.c \ tif_imageiter.h \ diff --git a/tiff/contrib/pds/tif_imageiter.c b/tiff/contrib/pds/tif_imageiter.c index 243cfd65..7ecf61a0 100644 --- a/tiff/contrib/pds/tif_imageiter.c +++ b/tiff/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/tiff/contrib/pds/tif_imageiter.h b/tiff/contrib/pds/tif_imageiter.h index 4f4fd279..4f09c1d2 100644 --- a/tiff/contrib/pds/tif_imageiter.h +++ b/tiff/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/tiff/contrib/pds/tif_pdsdirread.c b/tiff/contrib/pds/tif_pdsdirread.c index cc6231da..19fccb38 100644 --- a/tiff/contrib/pds/tif_pdsdirread.c +++ b/tiff/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/tiff/contrib/pds/tif_pdsdirwrite.c b/tiff/contrib/pds/tif_pdsdirwrite.c index a670bda1..9e51bfbd 100644 --- a/tiff/contrib/pds/tif_pdsdirwrite.c +++ b/tiff/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 @@ -124,7 +124,7 @@ static int TIFFWriteRational(TIFF*, the main, standard TIFF directories that does not apply to special private subdirectories, so such a reimplementation for the sake of eliminating redundant or duplicate code is probably not possible, - unless we also pass in a Main flag to indiciate which type of handling + unless we also pass in a Main flag to indicate which type of handling to do, which would be kind of a hack. I've marked those places where I changed or ripped out code which would have to be re-inserted to generalize this function. If it can be done in a clean and graceful way, @@ -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))) { |