summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff/tif_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/libtiff/libtiff/tif_aux.c')
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_aux.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/src/3rdparty/libtiff/libtiff/tif_aux.c b/src/3rdparty/libtiff/libtiff/tif_aux.c
index c9f1905..140f26c 100644
--- a/src/3rdparty/libtiff/libtiff/tif_aux.c
+++ b/src/3rdparty/libtiff/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 )
{
@@ -109,8 +109,8 @@ _TIFFCheckRealloc(TIFF* tif, void* buffer,
if (cp == NULL) {
TIFFErrorExt(tif->tif_clientdata, tif->tif_name,
"Failed to allocate memory for %s "
- "(%ld elements of %ld bytes each)",
- what,(long) nmemb, (long) elem_size);
+ "(%"TIFF_SSIZE_FORMAT" elements of %"TIFF_SSIZE_FORMAT" bytes each)",
+ what, nmemb, elem_size);
}
return cp;
@@ -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: */