summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/libtiff/libtiff
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-11 10:19:31 +0100
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-12-11 10:19:31 +0100
commit178b8572d71a34975ffd7ada87227e1b8ed7296e (patch)
tree1ca3314f2a20983cd919c7078ae8f20eadb259de /src/3rdparty/libtiff/libtiff
parent7abea3cc2d4295298e7682c755c4de9f674d55b4 (diff)
parent904aa931871fe2ebe5cc6b14a55f37658e15ee89 (diff)
Merge remote-tracking branch 'origin/5.11' into 5.12
Diffstat (limited to 'src/3rdparty/libtiff/libtiff')
-rw-r--r--src/3rdparty/libtiff/libtiff/SConstruct2
-rw-r--r--src/3rdparty/libtiff/libtiff/mkg3states.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/t4.h2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_aux.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_close.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_codec.c10
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_color.c4
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_compress.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_config.h.in60
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_config.wince.h2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dir.c29
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dir.h6
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dirinfo.c17
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dirread.c107
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dirwrite.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_dumpmode.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_error.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_extension.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_fax3.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_fax3.h2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_flush.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_getimage.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_jbig.c34
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_jpeg.c6
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_luv.c12
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_lzma.c11
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_lzw.c14
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_next.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_ojpeg.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_open.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_packbits.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_pixarlog.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_predict.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_predict.h6
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_print.c4
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_read.c13
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_stream.cxx8
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_strip.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_swab.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_thunder.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_tile.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_unix.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_version.c1
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_warning.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_win32.c41
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_write.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tif_zip.c2
-rw-r--r--src/3rdparty/libtiff/libtiff/tiff.h18
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffconf.h.in9
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffconf.vc.h9
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffconf.wince.h11
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffio.h4
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffio.hxx3
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffiop.h15
-rw-r--r--src/3rdparty/libtiff/libtiff/tiffvers.h4
55 files changed, 239 insertions, 275 deletions
diff --git a/src/3rdparty/libtiff/libtiff/SConstruct b/src/3rdparty/libtiff/libtiff/SConstruct
index cb6a7cc..af3daac 100644
--- a/src/3rdparty/libtiff/libtiff/SConstruct
+++ b/src/3rdparty/libtiff/libtiff/SConstruct
@@ -1,5 +1,3 @@
-# $Id: SConstruct,v 1.4 2007/02/24 15:03:50 dron Exp $
-
# Tag Image File Format (TIFF) Software
#
# Copyright (C) 2005, Andrey Kiselev <dron@ak4719.spb.edu>
diff --git a/src/3rdparty/libtiff/libtiff/mkg3states.c b/src/3rdparty/libtiff/libtiff/mkg3states.c
index 16ad3c2..54fc059 100644
--- a/src/3rdparty/libtiff/libtiff/mkg3states.c
+++ b/src/3rdparty/libtiff/libtiff/mkg3states.c
@@ -1,5 +1,3 @@
-/* "$Id: mkg3states.c,v 1.12 2015-06-21 01:09:09 bfriesen Exp $ */
-
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/t4.h b/src/3rdparty/libtiff/libtiff/t4.h
index b908f54..fb0951a 100644
--- a/src/3rdparty/libtiff/libtiff/t4.h
+++ b/src/3rdparty/libtiff/libtiff/t4.h
@@ -1,5 +1,3 @@
-/* $Id: t4.h,v 1.3 2010-03-10 18:56:48 bfriesen Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_aux.c b/src/3rdparty/libtiff/libtiff/tif_aux.c
index 10b8d00..4ece162 100644
--- a/src/3rdparty/libtiff/libtiff/tif_aux.c
+++ b/src/3rdparty/libtiff/libtiff/tif_aux.c
@@ -1,5 +1,3 @@
-/* $Id: tif_aux.c,v 1.31 2017-11-17 20:21:00 erouault Exp $ */
-
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_close.c b/src/3rdparty/libtiff/libtiff/tif_close.c
index a0cb661..e4228df 100644
--- a/src/3rdparty/libtiff/libtiff/tif_close.c
+++ b/src/3rdparty/libtiff/libtiff/tif_close.c
@@ -1,5 +1,3 @@
-/* $Id: tif_close.c,v 1.21 2016-01-23 21:20:34 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_codec.c b/src/3rdparty/libtiff/libtiff/tif_codec.c
index 7cb46f6..b6c04f0 100644
--- a/src/3rdparty/libtiff/libtiff/tif_codec.c
+++ b/src/3rdparty/libtiff/libtiff/tif_codec.c
@@ -1,5 +1,3 @@
-/* $Id: tif_codec.c,v 1.17 2015-08-19 02:31:04 bfriesen Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -72,6 +70,12 @@ static int NotConfigured(TIFF*, int);
#ifndef LZMA_SUPPORT
#define TIFFInitLZMA NotConfigured
#endif
+#ifndef ZSTD_SUPPORT
+#define TIFFInitZSTD NotConfigured
+#endif
+#ifndef WEBP_SUPPORT
+#define TIFFInitWebP NotConfigured
+#endif
/*
* Compression schemes statically built into the library.
@@ -99,6 +103,8 @@ TIFFCodec _TIFFBuiltinCODECS[] = {
{ "SGILog", COMPRESSION_SGILOG, TIFFInitSGILog },
{ "SGILog24", COMPRESSION_SGILOG24, TIFFInitSGILog },
{ "LZMA", COMPRESSION_LZMA, TIFFInitLZMA },
+ { "ZSTD", COMPRESSION_ZSTD, TIFFInitZSTD },
+ { "WEBP", COMPRESSION_WEBP, TIFFInitWebP },
{ NULL, 0, NULL }
};
diff --git a/src/3rdparty/libtiff/libtiff/tif_color.c b/src/3rdparty/libtiff/libtiff/tif_color.c
index 71cafcd..8fae40e 100644
--- a/src/3rdparty/libtiff/libtiff/tif_color.c
+++ b/src/3rdparty/libtiff/libtiff/tif_color.c
@@ -1,5 +1,3 @@
-/* $Id: tif_color.c,v 1.24 2017-05-29 10:12:54 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -168,7 +166,7 @@ TIFFCIELabToRGBInit(TIFFCIELabToRGB* cielab,
}
/*
- * Convert color value from the YCbCr space to CIE XYZ.
+ * Convert color value from the YCbCr space to RGB.
* The colorspace conversion algorithm comes from the IJG v5a code;
* see below for more information on how it works.
*/
diff --git a/src/3rdparty/libtiff/libtiff/tif_compress.c b/src/3rdparty/libtiff/libtiff/tif_compress.c
index b571d19..8130ef0 100644
--- a/src/3rdparty/libtiff/libtiff/tif_compress.c
+++ b/src/3rdparty/libtiff/libtiff/tif_compress.c
@@ -1,5 +1,3 @@
-/* $Id: tif_compress.c,v 1.25 2016-10-25 20:04:22 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_config.h.in b/src/3rdparty/libtiff/libtiff/tif_config.h.in
index a4b2e60..eae07aa 100644
--- a/src/3rdparty/libtiff/libtiff/tif_config.h.in
+++ b/src/3rdparty/libtiff/libtiff/tif_config.h.in
@@ -37,9 +37,6 @@
/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
-/* Define to 1 if you have the `floor' function. */
-#undef HAVE_FLOOR
-
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
@@ -62,45 +59,21 @@
machine */
#undef HAVE_IEEEFP
-/* Define to 1 if the system has the type `int16'. */
-#undef HAVE_INT16
-
-/* Define to 1 if the system has the type `int32'. */
-#undef HAVE_INT32
-
-/* Define to 1 if the system has the type `int8'. */
-#undef HAVE_INT8
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <io.h> header file. */
#undef HAVE_IO_H
-/* Define to 1 if you have the `isascii' function. */
-#undef HAVE_ISASCII
-
/* Define to 1 if you have the `jbg_newlen' function. */
#undef HAVE_JBG_NEWLEN
/* Define to 1 if you have the `lfind' function. */
#undef HAVE_LFIND
-/* Define to 1 if you have the <limits.h> header file. */
-#undef HAVE_LIMITS_H
-
-/* Define to 1 if you have the <malloc.h> header file. */
-#undef HAVE_MALLOC_H
-
-/* Define to 1 if you have the `memmove' function. */
-#undef HAVE_MEMMOVE
-
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
-/* Define to 1 if you have the `memset' function. */
-#undef HAVE_MEMSET
-
/* Define to 1 if you have the `mmap' function. */
#undef HAVE_MMAP
@@ -110,9 +83,6 @@
/* Define to 1 if you have the <OpenGL/gl.h> header file. */
#undef HAVE_OPENGL_GL_H
-/* Define to 1 if you have the `pow' function. */
-#undef HAVE_POW
-
/* Define if you have POSIX threads libraries and header files. */
#undef HAVE_PTHREAD
@@ -125,9 +95,6 @@
/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF
-/* Define to 1 if you have the `sqrt' function. */
-#undef HAVE_SQRT
-
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -137,24 +104,18 @@
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
-/* Define to 1 if you have the `strchr' function. */
-#undef HAVE_STRCHR
-
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
-/* Define to 1 if you have the `strrchr' function. */
-#undef HAVE_STRRCHR
-
-/* Define to 1 if you have the `strstr' function. */
-#undef HAVE_STRSTR
-
/* Define to 1 if you have the `strtol' function. */
#undef HAVE_STRTOL
+/* Define to 1 if you have the `strtoll' function. */
+#undef HAVE_STRTOLL
+
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
@@ -164,9 +125,6 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
-/* Define to 1 if you have the <sys/time.h> header file. */
-#undef HAVE_SYS_TIME_H
-
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
@@ -259,9 +217,6 @@
/* The size of `signed long long', as computed by sizeof. */
#undef SIZEOF_SIGNED_LONG_LONG
-/* The size of `signed short', as computed by sizeof. */
-#undef SIZEOF_SIGNED_SHORT
-
/* The size of `size_t', as computed by sizeof. */
#undef SIZEOF_SIZE_T
@@ -277,9 +232,6 @@
/* The size of `unsigned long long', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_LONG_LONG
-/* The size of `unsigned short', as computed by sizeof. */
-#undef SIZEOF_UNSIGNED_SHORT
-
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
@@ -362,6 +314,9 @@
/* Version number of package */
#undef VERSION
+/* Support webp compression */
+#undef WEBP_SUPPORT
+
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
@@ -380,6 +335,9 @@
/* Support Deflate compression */
#undef ZIP_SUPPORT
+/* Support zstd compression */
+#undef ZSTD_SUPPORT
+
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
diff --git a/src/3rdparty/libtiff/libtiff/tif_config.wince.h b/src/3rdparty/libtiff/libtiff/tif_config.wince.h
index 94e92bb..e85e2e6 100644
--- a/src/3rdparty/libtiff/libtiff/tif_config.wince.h
+++ b/src/3rdparty/libtiff/libtiff/tif_config.wince.h
@@ -1,5 +1,3 @@
-/* $Id: tif_config.wince.h,v 1.3 2010-03-10 18:56:48 bfriesen Exp $ */
-
/*
* TIFF library configuration header for Windows CE platform.
*/
diff --git a/src/3rdparty/libtiff/libtiff/tif_dir.c b/src/3rdparty/libtiff/libtiff/tif_dir.c
index f00f808..6f0b487 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dir.c
+++ b/src/3rdparty/libtiff/libtiff/tif_dir.c
@@ -1,5 +1,3 @@
-/* $Id: tif_dir.c,v 1.131 2017-07-11 21:38:04 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -863,14 +861,24 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
const TIFFField* fip = TIFFFindField(tif, tag, TIFF_ANY);
if( fip == NULL ) /* cannot happen since TIFFGetField() already checks it */
return 0;
+
+ /*
+ * We want to force the custom code to be used for custom
+ * fields even if the tag happens to match a well known
+ * one - important for reinterpreted handling of standard
+ * tag values in custom directories (i.e. EXIF)
+ */
+ if (fip->field_bit == FIELD_CUSTOM) {
+ standard_tag = 0;
+ }
- if( tag == TIFFTAG_NUMBEROFINKS )
+ if( standard_tag == TIFFTAG_NUMBEROFINKS )
{
int i;
for (i = 0; i < td->td_customValueCount; i++) {
uint16 val;
TIFFTagValue *tv = td->td_customValues + i;
- if (tv->info->field_tag != tag)
+ if (tv->info->field_tag != standard_tag)
continue;
if( tv->value == NULL )
return 0;
@@ -892,16 +900,6 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
return 0;
}
- /*
- * We want to force the custom code to be used for custom
- * fields even if the tag happens to match a well known
- * one - important for reinterpreted handling of standard
- * tag values in custom directories (i.e. EXIF)
- */
- if (fip->field_bit == FIELD_CUSTOM) {
- standard_tag = 0;
- }
-
switch (standard_tag) {
case TIFFTAG_SUBFILETYPE:
*va_arg(ap, uint32*) = td->td_subfiletype;
@@ -1067,6 +1065,9 @@ _TIFFVGetField(TIFF* tif, uint32 tag, va_list ap)
if (td->td_samplesperpixel - td->td_extrasamples > 1) {
*va_arg(ap, uint16**) = td->td_transferfunction[1];
*va_arg(ap, uint16**) = td->td_transferfunction[2];
+ } else {
+ *va_arg(ap, uint16**) = NULL;
+ *va_arg(ap, uint16**) = NULL;
}
break;
case TIFFTAG_REFERENCEBLACKWHITE:
diff --git a/src/3rdparty/libtiff/libtiff/tif_dir.h b/src/3rdparty/libtiff/libtiff/tif_dir.h
index 5a38076..b2f5e69 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dir.h
+++ b/src/3rdparty/libtiff/libtiff/tif_dir.h
@@ -1,5 +1,3 @@
-/* $Id: tif_dir.h,v 1.55 2017-06-01 12:44:04 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -26,6 +24,10 @@
#ifndef _TIFFDIR_
#define _TIFFDIR_
+
+#include "tiff.h"
+#include "tiffio.h"
+
/*
* ``Library-private'' Directory-related Definitions.
*/
diff --git a/src/3rdparty/libtiff/libtiff/tif_dirinfo.c b/src/3rdparty/libtiff/libtiff/tif_dirinfo.c
index 4904f54..e1f6b23 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dirinfo.c
+++ b/src/3rdparty/libtiff/libtiff/tif_dirinfo.c
@@ -1,5 +1,3 @@
-/* $Id: tif_dirinfo.c,v 1.127 2017-06-01 12:44:04 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -979,6 +977,8 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
case TIFFTAG_CONSECUTIVEBADFAXLINES:
case TIFFTAG_GROUP3OPTIONS:
case TIFFTAG_GROUP4OPTIONS:
+ /* LERC */
+ case TIFFTAG_LERC_PARAMETERS:
break;
default:
return 1;
@@ -1054,7 +1054,18 @@ _TIFFCheckFieldIsValidForCodec(TIFF *tif, ttag_t tag)
if (tag == TIFFTAG_PREDICTOR)
return 1;
break;
-
+ case COMPRESSION_ZSTD:
+ if (tag == TIFFTAG_PREDICTOR)
+ return 1;
+ break;
+ case COMPRESSION_LERC:
+ if (tag == TIFFTAG_LERC_PARAMETERS)
+ return 1;
+ break;
+ case COMPRESSION_WEBP:
+ if (tag == TIFFTAG_PREDICTOR)
+ return 1;
+ break;
}
return 0;
}
diff --git a/src/3rdparty/libtiff/libtiff/tif_dirread.c b/src/3rdparty/libtiff/libtiff/tif_dirread.c
index aa258ba..e80a3b1 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dirread.c
+++ b/src/3rdparty/libtiff/libtiff/tif_dirread.c
@@ -1,5 +1,3 @@
-/* $Id: tif_dirread.c,v 1.218 2017-09-09 21:44:42 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -167,6 +165,7 @@ static int TIFFFetchStripThing(TIFF* tif, TIFFDirEntry* dir, uint32 nstrips, uin
static int TIFFFetchSubjectDistance(TIFF*, TIFFDirEntry*);
static void ChopUpSingleUncompressedStrip(TIFF*);
static uint64 TIFFReadUInt64(const uint8 *value);
+static int _TIFFGetMaxColorChannels(uint16 photometric);
static int _TIFFFillStrilesInternal( TIFF *tif, int loadStripByteCount );
@@ -776,7 +775,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryIfd8(TIFF* tif, TIFFDirEntry* di
static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
TIFF* tif, uint64 offset, tmsize_t size, void** pdest)
{
-#if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8
+#if SIZEOF_SIZE_T == 8
tmsize_t threshold = INITIAL_THRESHOLD;
#endif
tmsize_t already_read = 0;
@@ -797,7 +796,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryDataAndRealloc(
void* new_dest;
tmsize_t bytes_read;
tmsize_t to_read = size - already_read;
-#if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8
+#if SIZEOF_SIZE_T == 8
if( to_read >= threshold && threshold < MAX_THRESHOLD )
{
to_read = threshold;
@@ -3507,6 +3506,35 @@ static void TIFFReadDirEntryOutputErr(TIFF* tif, enum TIFFReadDirEntryErr err, c
}
/*
+ * Return the maximum number of color channels specified for a given photometric
+ * type. 0 is returned if photometric type isn't supported or no default value
+ * is defined by the specification.
+ */
+static int _TIFFGetMaxColorChannels( uint16 photometric )
+{
+ switch (photometric) {
+ case PHOTOMETRIC_PALETTE:
+ case PHOTOMETRIC_MINISWHITE:
+ case PHOTOMETRIC_MINISBLACK:
+ return 1;
+ case PHOTOMETRIC_YCBCR:
+ case PHOTOMETRIC_RGB:
+ case PHOTOMETRIC_CIELAB:
+ case PHOTOMETRIC_LOGLUV:
+ case PHOTOMETRIC_ITULAB:
+ case PHOTOMETRIC_ICCLAB:
+ return 3;
+ case PHOTOMETRIC_SEPARATED:
+ case PHOTOMETRIC_MASK:
+ return 4;
+ case PHOTOMETRIC_LOGL:
+ case PHOTOMETRIC_CFA:
+ default:
+ return 0;
+ }
+}
+
+/*
* Read the next TIFF directory from a file and convert it to the internal
* format. We read directories sequentially.
*/
@@ -3522,6 +3550,7 @@ TIFFReadDirectory(TIFF* tif)
uint32 fii=FAILED_FII;
toff_t nextdiroff;
int bitspersample_read = FALSE;
+ int color_channels;
tif->tif_diroff=tif->tif_nextdiroff;
if (!TIFFCheckDirOffset(tif,tif->tif_nextdiroff))
@@ -4026,6 +4055,37 @@ TIFFReadDirectory(TIFF* tif)
}
}
}
+
+ /*
+ * Make sure all non-color channels are extrasamples.
+ * If it's not the case, define them as such.
+ */
+ 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;
+
+ 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);
+
+ // sampleinfo should contain information relative to these new extra samples
+ new_sampleinfo = (uint16*) _TIFFcalloc(tif->tif_dir.td_extrasamples, sizeof(uint16));
+ if (!new_sampleinfo) {
+ TIFFErrorExt(tif->tif_clientdata, module, "Failed to allocate memory for "
+ "temporary new sampleinfo array (%d 16 bit elements)",
+ tif->tif_dir.td_extrasamples);
+ goto bad;
+ }
+
+ memcpy(new_sampleinfo, tif->tif_dir.td_sampleinfo, old_extrasamples * sizeof(uint16));
+ _TIFFsetShortArray(&tif->tif_dir.td_sampleinfo, new_sampleinfo, tif->tif_dir.td_extrasamples);
+ _TIFFfree(new_sampleinfo);
+ }
+
/*
* Verify Palette image has a Colormap.
*/
@@ -4881,17 +4941,18 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
err=TIFFReadDirEntryByteArray(tif,dp,&data);
if (err==TIFFReadDirEntryErrOk)
{
- uint8* ma;
- uint32 mb;
+ uint32 mb = 0;
int n;
- ma=data;
- mb=0;
- while (mb<(uint32)dp->tdir_count)
+ if (data != NULL)
{
- if (*ma==0)
- break;
- ma++;
- mb++;
+ uint8* ma = data;
+ while (mb<(uint32)dp->tdir_count)
+ {
+ if (*ma==0)
+ break;
+ ma++;
+ mb++;
+ }
}
if (mb+1<(uint32)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);
@@ -5141,11 +5202,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
- {
- 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';
- }
+ if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
+ {
+ 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);
if (data!=0)
_TIFFfree(data);
@@ -5318,11 +5379,11 @@ TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover)
if (err==TIFFReadDirEntryErrOk)
{
int m;
- if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
- {
- 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';
- }
+ if( data != 0 && dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' )
+ {
+ 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);
if (data!=0)
_TIFFfree(data);
diff --git a/src/3rdparty/libtiff/libtiff/tif_dirwrite.c b/src/3rdparty/libtiff/libtiff/tif_dirwrite.c
index 5d0a669..c15a28d 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dirwrite.c
+++ b/src/3rdparty/libtiff/libtiff/tif_dirwrite.c
@@ -1,5 +1,3 @@
-/* $Id: tif_dirwrite.c,v 1.89 2017-08-23 13:33:42 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_dumpmode.c b/src/3rdparty/libtiff/libtiff/tif_dumpmode.c
index a6a94c0..4a0b07f 100644
--- a/src/3rdparty/libtiff/libtiff/tif_dumpmode.c
+++ b/src/3rdparty/libtiff/libtiff/tif_dumpmode.c
@@ -1,5 +1,3 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_dumpmode.c,v 1.15 2015-12-12 18:04:26 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_error.c b/src/3rdparty/libtiff/libtiff/tif_error.c
index 47516b4..651168f 100644
--- a/src/3rdparty/libtiff/libtiff/tif_error.c
+++ b/src/3rdparty/libtiff/libtiff/tif_error.c
@@ -1,5 +1,3 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_error.c,v 1.6 2017-07-04 12:54:42 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_extension.c b/src/3rdparty/libtiff/libtiff/tif_extension.c
index 39fab4c..87d3cfc 100644
--- a/src/3rdparty/libtiff/libtiff/tif_extension.c
+++ b/src/3rdparty/libtiff/libtiff/tif_extension.c
@@ -1,5 +1,3 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_extension.c,v 1.8 2015-12-06 11:13:43 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_fax3.c b/src/3rdparty/libtiff/libtiff/tif_fax3.c
index 5fd5141..d11c968 100644
--- a/src/3rdparty/libtiff/libtiff/tif_fax3.c
+++ b/src/3rdparty/libtiff/libtiff/tif_fax3.c
@@ -1,5 +1,3 @@
-/* $Id: tif_fax3.c,v 1.81 2017-06-18 10:31:50 erouault Exp $ */
-
/*
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_fax3.h b/src/3rdparty/libtiff/libtiff/tif_fax3.h
index 8a43505..abadcd9 100644
--- a/src/3rdparty/libtiff/libtiff/tif_fax3.h
+++ b/src/3rdparty/libtiff/libtiff/tif_fax3.h
@@ -1,5 +1,3 @@
-/* $Id: tif_fax3.h,v 1.13 2016-12-14 18:36:27 faxguy Exp $ */
-
/*
* Copyright (c) 1990-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_flush.c b/src/3rdparty/libtiff/libtiff/tif_flush.c
index fd14e4c..881fac5 100644
--- a/src/3rdparty/libtiff/libtiff/tif_flush.c
+++ b/src/3rdparty/libtiff/libtiff/tif_flush.c
@@ -1,5 +1,3 @@
-/* $Id: tif_flush.c,v 1.9 2010-03-31 06:40:10 fwarmerdam Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_getimage.c b/src/3rdparty/libtiff/libtiff/tif_getimage.c
index fc554cc..6a9d5a7 100644
--- a/src/3rdparty/libtiff/libtiff/tif_getimage.c
+++ b/src/3rdparty/libtiff/libtiff/tif_getimage.c
@@ -1,5 +1,3 @@
-/* $Id: tif_getimage.c,v 1.114 2017-11-17 20:21:00 erouault Exp $ */
-
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_jbig.c b/src/3rdparty/libtiff/libtiff/tif_jbig.c
index 7a14dd9..7ffe885 100644
--- a/src/3rdparty/libtiff/libtiff/tif_jbig.c
+++ b/src/3rdparty/libtiff/libtiff/tif_jbig.c
@@ -1,5 +1,3 @@
-/* $Id: tif_jbig.c,v 1.16 2017-06-26 15:20:00 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -53,17 +51,18 @@ static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
struct jbg_dec_state decoder;
int decodeStatus = 0;
unsigned char* pImage = NULL;
- (void) size, (void) s;
+ unsigned long decodedSize;
+ (void) s;
if (isFillOrder(tif, tif->tif_dir.td_fillorder))
{
- TIFFReverseBits(tif->tif_rawdata, tif->tif_rawdatasize);
+ TIFFReverseBits(tif->tif_rawcp, tif->tif_rawcc);
}
jbg_dec_init(&decoder);
#if defined(HAVE_JBG_NEWLEN)
- jbg_newlen(tif->tif_rawdata, (size_t)tif->tif_rawdatasize);
+ jbg_newlen(tif->tif_rawcp, (size_t)tif->tif_rawcc);
/*
* I do not check the return status of jbg_newlen because even if this
* function fails it does not necessarily mean that decoding the image
@@ -76,8 +75,8 @@ static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
*/
#endif /* HAVE_JBG_NEWLEN */
- decodeStatus = jbg_dec_in(&decoder, (unsigned char*)tif->tif_rawdata,
- (size_t)tif->tif_rawdatasize, NULL);
+ decodeStatus = jbg_dec_in(&decoder, (unsigned char*)tif->tif_rawcp,
+ (size_t)tif->tif_rawcc, NULL);
if (JBG_EOK != decodeStatus)
{
/*
@@ -98,9 +97,28 @@ static int JBIGDecode(TIFF* tif, uint8* buffer, tmsize_t size, uint16 s)
return 0;
}
+ decodedSize = jbg_dec_getsize(&decoder);
+ if( (tmsize_t)decodedSize < size )
+ {
+ TIFFWarningExt(tif->tif_clientdata, "JBIG",
+ "Only decoded %lu bytes, whereas %lu requested",
+ decodedSize, (unsigned long)size);
+ }
+ else if( (tmsize_t)decodedSize > size )
+ {
+ TIFFErrorExt(tif->tif_clientdata, "JBIG",
+ "Decoded %lu bytes, whereas %lu were requested",
+ decodedSize, (unsigned long)size);
+ jbg_dec_free(&decoder);
+ return 0;
+ }
pImage = jbg_dec_getimage(&decoder, 0);
- _TIFFmemcpy(buffer, pImage, jbg_dec_getsize(&decoder));
+ _TIFFmemcpy(buffer, pImage, decodedSize);
jbg_dec_free(&decoder);
+
+ tif->tif_rawcp += tif->tif_rawcc;
+ tif->tif_rawcc = 0;
+
return 1;
}
diff --git a/src/3rdparty/libtiff/libtiff/tif_jpeg.c b/src/3rdparty/libtiff/libtiff/tif_jpeg.c
index 0fbdb35..f2ddc33 100644
--- a/src/3rdparty/libtiff/libtiff/tif_jpeg.c
+++ b/src/3rdparty/libtiff/libtiff/tif_jpeg.c
@@ -1,5 +1,3 @@
-/* $Id: tif_jpeg.c,v 1.134 2017-10-17 19:04:47 erouault Exp $ */
-
/*
* Copyright (c) 1994-1997 Sam Leffler
* Copyright (c) 1994-1997 Silicon Graphics, Inc.
@@ -27,9 +25,9 @@
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRALEAN
+#include "tiffiop.h"
#include <stdlib.h>
-#include "tiffiop.h"
#ifdef JPEG_SUPPORT
/*
@@ -76,7 +74,7 @@ int TIFFJPEGIsFullStripRequired_12(TIFF* tif);
"JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
caller expects 464"
- For such users we wil fix the problem here. See install.doc file from
+ For such users we will fix the problem here. See install.doc file from
the JPEG library distribution for details.
*/
diff --git a/src/3rdparty/libtiff/libtiff/tif_luv.c b/src/3rdparty/libtiff/libtiff/tif_luv.c
index 4b25244..aa35ea0 100644
--- a/src/3rdparty/libtiff/libtiff/tif_luv.c
+++ b/src/3rdparty/libtiff/libtiff/tif_luv.c
@@ -1,5 +1,3 @@
-/* $Id: tif_luv.c,v 1.49 2017-07-24 12:47:30 erouault Exp $ */
-
/*
* Copyright (c) 1997 Greg Ward Larson
* Copyright (c) 1997 Silicon Graphics, Inc.
@@ -215,7 +213,7 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp = (unsigned char*) tif->tif_rawcp;
cc = tif->tif_rawcc;
/* get each byte string */
- for (shft = 2*8; (shft -= 8) >= 0; ) {
+ for (shft = 8; shft >= 0; shft -=8) {
for (i = 0; i < npixels && cc > 0; ) {
if (*bp >= 128) { /* run */
if( cc < 2 )
@@ -349,7 +347,7 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
bp = (unsigned char*) tif->tif_rawcp;
cc = tif->tif_rawcc;
/* get each byte string */
- for (shft = 4*8; (shft -= 8) >= 0; ) {
+ for (shft = 24; shft >= 0; shft -=8) {
for (i = 0; i < npixels && cc > 0; ) {
if (*bp >= 128) { /* run */
if( cc < 2 )
@@ -467,7 +465,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
/* compress each byte string */
op = tif->tif_rawcp;
occ = tif->tif_rawdatasize - tif->tif_rawcc;
- for (shft = 2*8; (shft -= 8) >= 0; )
+ for (shft = 8; shft >= 0; shft -=8) {
for (i = 0; i < npixels; i += rc) {
if (occ < 4) {
tif->tif_rawcp = op;
@@ -522,6 +520,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
} else
rc = 0;
}
+ }
tif->tif_rawcp = op;
tif->tif_rawcc = tif->tif_rawdatasize - occ;
@@ -618,7 +617,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
/* compress each byte string */
op = tif->tif_rawcp;
occ = tif->tif_rawdatasize - tif->tif_rawcc;
- for (shft = 4*8; (shft -= 8) >= 0; )
+ for (shft = 24; shft >= 0; shft -=8) {
for (i = 0; i < npixels; i += rc) {
if (occ < 4) {
tif->tif_rawcp = op;
@@ -673,6 +672,7 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
} else
rc = 0;
}
+ }
tif->tif_rawcp = op;
tif->tif_rawcc = tif->tif_rawdatasize - occ;
diff --git a/src/3rdparty/libtiff/libtiff/tif_lzma.c b/src/3rdparty/libtiff/libtiff/tif_lzma.c
index 80fc394..3f6096b 100644
--- a/src/3rdparty/libtiff/libtiff/tif_lzma.c
+++ b/src/3rdparty/libtiff/libtiff/tif_lzma.c
@@ -1,5 +1,3 @@
-/* $Id: tif_lzma.c,v 1.6 2016-09-17 09:18:59 erouault Exp $ */
-
/*
* Copyright (c) 2010, Andrey Kiselev <dron@ak4719.spb.edu>
*
@@ -249,6 +247,7 @@ LZMAPreEncode(TIFF* tif, uint16 s)
{
static const char module[] = "LZMAPreEncode";
LZMAState *sp = EncoderState(tif);
+ lzma_ret ret;
(void) s;
assert(sp != NULL);
@@ -262,7 +261,13 @@ LZMAPreEncode(TIFF* tif, uint16 s)
"Liblzma cannot deal with buffers this size");
return 0;
}
- return (lzma_stream_encoder(&sp->stream, sp->filters, sp->check) == LZMA_OK);
+ ret = lzma_stream_encoder(&sp->stream, sp->filters, sp->check);
+ if (ret != LZMA_OK) {
+ TIFFErrorExt(tif->tif_clientdata, module,
+ "Error in lzma_stream_encoder(): %s", LZMAStrerror(ret));
+ return 0;
+ }
+ return 1;
}
/*
diff --git a/src/3rdparty/libtiff/libtiff/tif_lzw.c b/src/3rdparty/libtiff/libtiff/tif_lzw.c
index 186ea3c..ac685dd 100644
--- a/src/3rdparty/libtiff/libtiff/tif_lzw.c
+++ b/src/3rdparty/libtiff/libtiff/tif_lzw.c
@@ -1,5 +1,3 @@
-/* $Id: tif_lzw.c,v 1.57 2017-07-11 10:54:29 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -135,6 +133,7 @@ typedef struct {
long dec_restart; /* restart count */
#ifdef LZW_CHECKEOS
uint64 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 */
code_t* dec_codep; /* current recognized code */
@@ -320,6 +319,7 @@ LZWPreDecode(TIFF* tif, uint16 s)
sp->dec_nbitsmask = MAXCODE(BITS_MIN);
#ifdef LZW_CHECKEOS
sp->dec_bitsleft = 0;
+ sp->old_tif_rawcc = 0;
#endif
sp->dec_free_entp = sp->dec_codetab + CODE_FIRST;
/*
@@ -427,7 +427,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) << 3);
+ sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata;
@@ -555,6 +555,9 @@ 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;
+#ifdef LZW_CHECKEOS
+ sp->old_tif_rawcc = tif->tif_rawcc;
+#endif
sp->lzw_nbits = (unsigned short) nbits;
sp->lzw_nextdata = nextdata;
sp->lzw_nextbits = nextbits;
@@ -658,7 +661,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) << 3);
+ sp->dec_bitsleft += (((uint64)tif->tif_rawcc - sp->old_tif_rawcc) << 3);
#endif
nbits = sp->lzw_nbits;
nextdata = sp->lzw_nextdata;
@@ -776,6 +779,9 @@ 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;
+#ifdef LZW_CHECKEOS
+ sp->old_tif_rawcc = tif->tif_rawcc;
+#endif
sp->lzw_nbits = (unsigned short)nbits;
sp->lzw_nextdata = nextdata;
sp->lzw_nextbits = nextbits;
diff --git a/src/3rdparty/libtiff/libtiff/tif_next.c b/src/3rdparty/libtiff/libtiff/tif_next.c
index 0821178..0ba61ae 100644
--- a/src/3rdparty/libtiff/libtiff/tif_next.c
+++ b/src/3rdparty/libtiff/libtiff/tif_next.c
@@ -1,5 +1,3 @@
-/* $Id: tif_next.c,v 1.19 2016-09-04 21:32:56 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c
index 92ed1fa..27385d8 100644
--- a/src/3rdparty/libtiff/libtiff/tif_ojpeg.c
+++ b/src/3rdparty/libtiff/libtiff/tif_ojpeg.c
@@ -1,5 +1,3 @@
-/* $Id: tif_ojpeg.c,v 1.69 2017-04-27 17:29:26 erouault Exp $ */
-
/* WARNING: The type of JPEG encapsulation defined by the TIFF Version 6.0
specification is now totally obsolete and deprecated for new applications and
images. This file was was created solely in order to read unconverted images
diff --git a/src/3rdparty/libtiff/libtiff/tif_open.c b/src/3rdparty/libtiff/libtiff/tif_open.c
index a7279e1..c574c45 100644
--- a/src/3rdparty/libtiff/libtiff/tif_open.c
+++ b/src/3rdparty/libtiff/libtiff/tif_open.c
@@ -1,5 +1,3 @@
-/* $Id: tif_open.c,v 1.48 2016-11-20 22:29:47 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_packbits.c b/src/3rdparty/libtiff/libtiff/tif_packbits.c
index 18904b0..a8f29e8 100644
--- a/src/3rdparty/libtiff/libtiff/tif_packbits.c
+++ b/src/3rdparty/libtiff/libtiff/tif_packbits.c
@@ -1,5 +1,3 @@
-/* $Id: tif_packbits.c,v 1.26 2017-05-14 02:26:07 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_pixarlog.c b/src/3rdparty/libtiff/libtiff/tif_pixarlog.c
index 979858d..7438d69 100644
--- a/src/3rdparty/libtiff/libtiff/tif_pixarlog.c
+++ b/src/3rdparty/libtiff/libtiff/tif_pixarlog.c
@@ -1,5 +1,3 @@
-/* $Id: tif_pixarlog.c,v 1.54 2017-07-10 10:40:28 erouault Exp $ */
-
/*
* Copyright (c) 1996-1997 Sam Leffler
* Copyright (c) 1996 Pixar
diff --git a/src/3rdparty/libtiff/libtiff/tif_predict.c b/src/3rdparty/libtiff/libtiff/tif_predict.c
index 9ae1f57..b775663 100644
--- a/src/3rdparty/libtiff/libtiff/tif_predict.c
+++ b/src/3rdparty/libtiff/libtiff/tif_predict.c
@@ -1,5 +1,3 @@
-/* $Id: tif_predict.c,v 1.44 2017-06-18 10:31:50 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_predict.h b/src/3rdparty/libtiff/libtiff/tif_predict.h
index 6c68e21..a326b9b 100644
--- a/src/3rdparty/libtiff/libtiff/tif_predict.h
+++ b/src/3rdparty/libtiff/libtiff/tif_predict.h
@@ -1,5 +1,3 @@
-/* $Id: tif_predict.h,v 1.9 2016-10-31 17:24:26 erouault Exp $ */
-
/*
* Copyright (c) 1995-1997 Sam Leffler
* Copyright (c) 1995-1997 Silicon Graphics, Inc.
@@ -26,6 +24,10 @@
#ifndef _TIFFPREDICT_
#define _TIFFPREDICT_
+
+#include "tiffio.h"
+#include "tiffiop.h"
+
/*
* ``Library-private'' Support for the Predictor Tag
*/
diff --git a/src/3rdparty/libtiff/libtiff/tif_print.c b/src/3rdparty/libtiff/libtiff/tif_print.c
index f494cfb..1d86adb 100644
--- a/src/3rdparty/libtiff/libtiff/tif_print.c
+++ b/src/3rdparty/libtiff/libtiff/tif_print.c
@@ -1,5 +1,3 @@
-/* $Id: tif_print.c,v 1.65 2016-11-20 22:31:22 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -546,7 +544,7 @@ TIFFPrintDirectory(TIFF* tif, FILE* fd, long flags)
uint16 i;
fprintf(fd, " %2ld: %5u",
l, td->td_transferfunction[0][l]);
- for (i = 1; i < td->td_samplesperpixel; i++)
+ for (i = 1; i < td->td_samplesperpixel - td->td_extrasamples && i < 3; i++)
fprintf(fd, " %5u",
td->td_transferfunction[i][l]);
fputc('\n', fd);
diff --git a/src/3rdparty/libtiff/libtiff/tif_read.c b/src/3rdparty/libtiff/libtiff/tif_read.c
index 2ba985a..e63810c 100644
--- a/src/3rdparty/libtiff/libtiff/tif_read.c
+++ b/src/3rdparty/libtiff/libtiff/tif_read.c
@@ -1,5 +1,3 @@
-/* $Id: tif_read.c,v 1.66 2017-11-17 20:21:00 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -58,7 +56,7 @@ static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
int is_strip, uint32 strip_or_tile,
const char* module )
{
-#if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8
+#if SIZEOF_SIZE_T == 8
tmsize_t threshold = INITIAL_THRESHOLD;
#endif
tmsize_t already_read = 0;
@@ -73,7 +71,7 @@ static int TIFFReadAndRealloc( TIFF* tif, tmsize_t size,
{
tmsize_t bytes_read;
tmsize_t to_read = size - already_read;
-#if SIZEOF_VOIDP == 8 || SIZEOF_SIZE_T == 8
+#if SIZEOF_SIZE_T == 8
if( to_read >= threshold && threshold < MAX_THRESHOLD &&
already_read + to_read + rawdata_offset > tif->tif_rawdatasize )
{
@@ -348,6 +346,13 @@ TIFFSeek(TIFF* tif, uint32 row, uint16 sample )
return 0;
whole_strip = tif->tif_dir.td_stripbytecount[strip] < 10
|| isMapped(tif);
+ if( td->td_compression == COMPRESSION_LERC ||
+ td->td_compression == COMPRESSION_JBIG )
+ {
+ /* Ideally plugins should have a way to declare they don't support
+ * chunk strip */
+ whole_strip = 1;
+ }
#else
whole_strip = 1;
#endif
diff --git a/src/3rdparty/libtiff/libtiff/tif_stream.cxx b/src/3rdparty/libtiff/libtiff/tif_stream.cxx
index ecca1fd..7f640a9 100644
--- a/src/3rdparty/libtiff/libtiff/tif_stream.cxx
+++ b/src/3rdparty/libtiff/libtiff/tif_stream.cxx
@@ -1,5 +1,3 @@
-/* $Id: tif_stream.cxx,v 1.13 2015-05-28 01:50:22 bfriesen Exp $ */
-
/*
* Copyright (c) 1988-1996 Sam Leffler
* Copyright (c) 1991-1996 Silicon Graphics, Inc.
@@ -375,6 +373,9 @@ _tiffStreamOpen(const char* name, const char* mode, void *fd)
_tiffosSizeProc,
_tiffDummyMapProc,
_tiffDummyUnmapProc);
+ if (!tif) {
+ delete data;
+ }
} else {
tiffis_data *data = new tiffis_data;
data->stream = reinterpret_cast<istream *>(fd);
@@ -389,6 +390,9 @@ _tiffStreamOpen(const char* name, const char* mode, void *fd)
_tiffisSizeProc,
_tiffDummyMapProc,
_tiffDummyUnmapProc);
+ if (!tif) {
+ delete data;
+ }
}
return (tif);
diff --git a/src/3rdparty/libtiff/libtiff/tif_strip.c b/src/3rdparty/libtiff/libtiff/tif_strip.c
index 6e9f2ef..5b76fba 100644
--- a/src/3rdparty/libtiff/libtiff/tif_strip.c
+++ b/src/3rdparty/libtiff/libtiff/tif_strip.c
@@ -1,5 +1,3 @@
-/* $Id: tif_strip.c,v 1.38 2016-12-03 11:02:15 erouault Exp $ */
-
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_swab.c b/src/3rdparty/libtiff/libtiff/tif_swab.c
index 4b2e5f1..b174ba6 100644
--- a/src/3rdparty/libtiff/libtiff/tif_swab.c
+++ b/src/3rdparty/libtiff/libtiff/tif_swab.c
@@ -1,5 +1,3 @@
-/* $Id: tif_swab.c,v 1.15 2017-06-08 16:39:50 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_thunder.c b/src/3rdparty/libtiff/libtiff/tif_thunder.c
index 183199d..2388dbb 100644
--- a/src/3rdparty/libtiff/libtiff/tif_thunder.c
+++ b/src/3rdparty/libtiff/libtiff/tif_thunder.c
@@ -1,5 +1,3 @@
-/* $Id: tif_thunder.c,v 1.13 2016-09-04 21:32:56 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_tile.c b/src/3rdparty/libtiff/libtiff/tif_tile.c
index 388e168..58fe935 100644
--- a/src/3rdparty/libtiff/libtiff/tif_tile.c
+++ b/src/3rdparty/libtiff/libtiff/tif_tile.c
@@ -1,5 +1,3 @@
-/* $Id: tif_tile.c,v 1.24 2015-06-07 22:35:40 bfriesen Exp $ */
-
/*
* Copyright (c) 1991-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_unix.c b/src/3rdparty/libtiff/libtiff/tif_unix.c
index 80c437c..874f1fe 100644
--- a/src/3rdparty/libtiff/libtiff/tif_unix.c
+++ b/src/3rdparty/libtiff/libtiff/tif_unix.c
@@ -1,5 +1,3 @@
-/* $Id: tif_unix.c,v 1.28 2017-01-11 19:02:49 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_version.c b/src/3rdparty/libtiff/libtiff/tif_version.c
index f92c843..60875bb 100644
--- a/src/3rdparty/libtiff/libtiff/tif_version.c
+++ b/src/3rdparty/libtiff/libtiff/tif_version.c
@@ -1,4 +1,3 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_version.c,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */
/*
* Copyright (c) 1992-1997 Sam Leffler
* Copyright (c) 1992-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_warning.c b/src/3rdparty/libtiff/libtiff/tif_warning.c
index dc79f14..c482785 100644
--- a/src/3rdparty/libtiff/libtiff/tif_warning.c
+++ b/src/3rdparty/libtiff/libtiff/tif_warning.c
@@ -1,5 +1,3 @@
-/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_warning.c,v 1.4 2017-07-04 12:54:42 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_win32.c b/src/3rdparty/libtiff/libtiff/tif_win32.c
index 090baed..088880e 100644
--- a/src/3rdparty/libtiff/libtiff/tif_win32.c
+++ b/src/3rdparty/libtiff/libtiff/tif_win32.c
@@ -1,5 +1,3 @@
-/* $Id: tif_win32.c,v 1.42 2017-01-11 19:02:49 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -407,60 +405,21 @@ _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c)
static void
Win32WarningHandler(const char* module, const char* fmt, va_list ap)
{
-#ifndef TIF_PLATFORM_CONSOLE
- LPTSTR szTitle;
- LPTSTR szTmp;
- LPCTSTR szTitleText = "%s Warning";
- LPCTSTR szDefaultModule = "LIBTIFF";
- LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;
- SIZE_T nBufSize = (strlen(szTmpModule) +
- strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char);
-
- if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL)
- return;
- sprintf(szTitle, szTitleText, szTmpModule);
- szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);
- vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap);
- MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONINFORMATION);
- LocalFree(szTitle);
-
- return;
-#else
if (module != NULL)
fprintf(stderr, "%s: ", module);
fprintf(stderr, "Warning, ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, ".\n");
-#endif
}
TIFFErrorHandler _TIFFwarningHandler = Win32WarningHandler;
static void
Win32ErrorHandler(const char* module, const char* fmt, va_list ap)
{
-#ifndef TIF_PLATFORM_CONSOLE
- LPTSTR szTitle;
- LPTSTR szTmp;
- LPCTSTR szTitleText = "%s Error";
- LPCTSTR szDefaultModule = "LIBTIFF";
- LPCTSTR szTmpModule = (module == NULL) ? szDefaultModule : module;
- SIZE_T nBufSize = (strlen(szTmpModule) +
- strlen(szTitleText) + strlen(fmt) + 256)*sizeof(char);
-
- if ((szTitle = (LPTSTR)LocalAlloc(LMEM_FIXED, nBufSize)) == NULL)
- return;
- sprintf(szTitle, szTitleText, szTmpModule);
- szTmp = szTitle + (strlen(szTitle)+2)*sizeof(char);
- vsnprintf(szTmp, nBufSize-(strlen(szTitle)+2)*sizeof(char), fmt, ap);
- MessageBoxA(GetFocus(), szTmp, szTitle, MB_OK | MB_ICONEXCLAMATION);
- LocalFree(szTitle);
- return;
-#else
if (module != NULL)
fprintf(stderr, "%s: ", module);
vfprintf(stderr, fmt, ap);
fprintf(stderr, ".\n");
-#endif
}
TIFFErrorHandler _TIFFerrorHandler = Win32ErrorHandler;
diff --git a/src/3rdparty/libtiff/libtiff/tif_write.c b/src/3rdparty/libtiff/libtiff/tif_write.c
index 208a2ee..a31ecd1 100644
--- a/src/3rdparty/libtiff/libtiff/tif_write.c
+++ b/src/3rdparty/libtiff/libtiff/tif_write.c
@@ -1,5 +1,3 @@
-/* $Id: tif_write.c,v 1.46 2016-12-03 21:57:44 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tif_zip.c b/src/3rdparty/libtiff/libtiff/tif_zip.c
index 42943fb..9d4bceb 100644
--- a/src/3rdparty/libtiff/libtiff/tif_zip.c
+++ b/src/3rdparty/libtiff/libtiff/tif_zip.c
@@ -1,5 +1,3 @@
-/* $Id: tif_zip.c,v 1.37 2017-05-10 15:21:16 erouault Exp $ */
-
/*
* Copyright (c) 1995-1997 Sam Leffler
* Copyright (c) 1995-1997 Silicon Graphics, Inc.
diff --git a/src/3rdparty/libtiff/libtiff/tiff.h b/src/3rdparty/libtiff/libtiff/tiff.h
index fb39634..5b0a0c9 100644
--- a/src/3rdparty/libtiff/libtiff/tiff.h
+++ b/src/3rdparty/libtiff/libtiff/tiff.h
@@ -1,5 +1,3 @@
-/* $Id: tiff.h,v 1.70 2016-01-23 21:20:34 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -189,7 +187,11 @@ typedef enum {
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
+#define COMPRESSION_LERC 34887 /* ESRI Lerc codec: https://github.com/Esri/lerc */
+/* compression codes 34887-34889 are reserved for ESRI */
#define COMPRESSION_LZMA 34925 /* LZMA2 */
+#define COMPRESSION_ZSTD 50000 /* ZSTD: WARNING not registered in Adobe-maintained registry */
+#define COMPRESSION_WEBP 50001 /* WEBP: WARNING not registered in Adobe-maintained registry */
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
@@ -450,6 +452,8 @@ typedef enum {
/* tag 34929 is a private tag registered to FedEx */
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
+/* tags 50674 to 50677 are reserved for ESRI */
+#define TIFFTAG_LERC_PARAMETERS 50674 /* Stores LERC version and additional compression method */
/* Adobe Digital Negative (DNG) format tags */
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
@@ -603,6 +607,16 @@ typedef enum {
#define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */
#define PERSAMPLE_MERGED 0 /* present as a single value */
#define PERSAMPLE_MULTI 1 /* present as multiple values */
+#define TIFFTAG_ZSTD_LEVEL 65564 /* ZSTD compression level */
+#define TIFFTAG_LERC_VERSION 65565 /* LERC version */
+#define LERC_VERSION_2_4 4
+#define TIFFTAG_LERC_ADD_COMPRESSION 65566 /* LERC additional compression */
+#define LERC_ADD_COMPRESSION_NONE 0
+#define LERC_ADD_COMPRESSION_DEFLATE 1
+#define LERC_ADD_COMPRESSION_ZSTD 2
+#define TIFFTAG_LERC_MAXZERROR 65567 /* LERC maximum error */
+#define TIFFTAG_WEBP_LEVEL 65568 /* WebP compression level: WARNING not registered in Adobe-maintained registry */
+#define TIFFTAG_WEBP_LOSSLESS 65569 /* WebP lossless/lossy : WARNING not registered in Adobe-maintained registry */
/*
* EXIF tags
diff --git a/src/3rdparty/libtiff/libtiff/tiffconf.h.in b/src/3rdparty/libtiff/libtiff/tiffconf.h.in
index 6da9c5a..5de30c9 100644
--- a/src/3rdparty/libtiff/libtiff/tiffconf.h.in
+++ b/src/3rdparty/libtiff/libtiff/tiffconf.h.in
@@ -37,15 +37,6 @@
/* Pointer difference type */
#undef TIFF_PTRDIFF_T
-/* Define to 1 if the system has the type `int16'. */
-#undef HAVE_INT16
-
-/* Define to 1 if the system has the type `int32'. */
-#undef HAVE_INT32
-
-/* Define to 1 if the system has the type `int8'. */
-#undef HAVE_INT8
-
/* Compatibility stuff. */
/* Define as 0 or 1 according to the floating point format suported by the
diff --git a/src/3rdparty/libtiff/libtiff/tiffconf.vc.h b/src/3rdparty/libtiff/libtiff/tiffconf.vc.h
index c8c6c65..fb37a75 100644
--- a/src/3rdparty/libtiff/libtiff/tiffconf.vc.h
+++ b/src/3rdparty/libtiff/libtiff/tiffconf.vc.h
@@ -7,15 +7,6 @@
#ifndef _TIFFCONF_
#define _TIFFCONF_
-/* Define to 1 if the system has the type `int16'. */
-/* #undef HAVE_INT16 */
-
-/* Define to 1 if the system has the type `int32'. */
-/* #undef HAVE_INT32 */
-
-/* Define to 1 if the system has the type `int8'. */
-/* #undef HAVE_INT8 */
-
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
diff --git a/src/3rdparty/libtiff/libtiff/tiffconf.wince.h b/src/3rdparty/libtiff/libtiff/tiffconf.wince.h
index 2ef3958..013b096 100644
--- a/src/3rdparty/libtiff/libtiff/tiffconf.wince.h
+++ b/src/3rdparty/libtiff/libtiff/tiffconf.wince.h
@@ -1,5 +1,3 @@
-/* $Id: tiffconf.wince.h,v 1.3 2010-03-10 18:56:49 bfriesen Exp $ */
-
/*
* Windows CE platform tiffconf.wince.h
* Created by Mateusz Loskot (mateusz@loskot.net)
@@ -27,15 +25,6 @@
#ifndef _TIFFCONF_
#define _TIFFCONF_
-/* Define to 1 if the system has the type `int16'. */
-/* #undef HAVE_INT16 */
-
-/* Define to 1 if the system has the type `int32'. */
-/* #undef HAVE_INT32 */
-
-/* Define to 1 if the system has the type `int8'. */
-/* #undef HAVE_INT8 */
-
/* The size of a `int', as computed by sizeof. */
#define SIZEOF_INT 4
diff --git a/src/3rdparty/libtiff/libtiff/tiffio.h b/src/3rdparty/libtiff/libtiff/tiffio.h
index ef61b5c..31c2e67 100644
--- a/src/3rdparty/libtiff/libtiff/tiffio.h
+++ b/src/3rdparty/libtiff/libtiff/tiffio.h
@@ -1,5 +1,3 @@
-/* $Id: tiffio.h,v 1.94 2017-01-11 19:02:49 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -52,7 +50,7 @@ typedef struct tiff TIFF;
* promoted type (i.e. one of int, unsigned int, pointer,
* or double) and because we defined pseudo-tags that are
* outside the range of legal Aldus-assigned tags.
- * NB: tsize_t is int32 and not uint32 because some functions
+ * NB: tsize_t is signed and not unsigned because some functions
* return -1.
* NB: toff_t is not off_t for many reasons; TIFFs max out at
* 32-bit file offsets, and BigTIFF maxes out at 64-bit
diff --git a/src/3rdparty/libtiff/libtiff/tiffio.hxx b/src/3rdparty/libtiff/libtiff/tiffio.hxx
index ed994f1..df2cbbc 100644
--- a/src/3rdparty/libtiff/libtiff/tiffio.hxx
+++ b/src/3rdparty/libtiff/libtiff/tiffio.hxx
@@ -1,5 +1,3 @@
-/* $Id: tiffio.hxx,v 1.3 2010-06-08 18:55:15 bfriesen Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -33,6 +31,7 @@
#include <iostream>
#include "tiff.h"
+#include "tiffio.h"
extern TIFF* TIFFStreamOpen(const char*, std::ostream *);
extern TIFF* TIFFStreamOpen(const char*, std::istream *);
diff --git a/src/3rdparty/libtiff/libtiff/tiffiop.h b/src/3rdparty/libtiff/libtiff/tiffiop.h
index daa291c..186c291 100644
--- a/src/3rdparty/libtiff/libtiff/tiffiop.h
+++ b/src/3rdparty/libtiff/libtiff/tiffiop.h
@@ -1,5 +1,3 @@
-/* $Id: tiffiop.h,v 1.95 2017-09-07 14:02:52 erouault Exp $ */
-
/*
* Copyright (c) 1988-1997 Sam Leffler
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
@@ -72,6 +70,7 @@ extern int snprintf(char* str, size_t size, const char* format, ...);
#endif
#define streq(a,b) (strcmp(a,b) == 0)
+#define strneq(a,b,n) (strncmp(a,b,n) == 0)
#ifndef TRUE
#define TRUE 1
@@ -314,11 +313,15 @@ typedef size_t TIFFIOSize_t;
#define _TIFF_off_t off_t
#endif
-#if __clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 8)
+#if defined(__has_attribute) && defined(__clang__)
+#if __has_attribute(no_sanitize)
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW __attribute__((no_sanitize("unsigned-integer-overflow")))
#else
#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
#endif
+#else
+#define TIFF_NOSANITIZE_UNSIGNED_INT_OVERFLOW
+#endif
#if defined(__cplusplus)
@@ -424,6 +427,12 @@ extern int TIFFInitSGILog(TIFF*, int);
#ifdef LZMA_SUPPORT
extern int TIFFInitLZMA(TIFF*, int);
#endif
+#ifdef ZSTD_SUPPORT
+extern int TIFFInitZSTD(TIFF*, int);
+#endif
+#ifdef WEBP_SUPPORT
+extern int TIFFInitWebP(TIFF*, int);
+#endif
#ifdef VMS
extern const TIFFCodec _TIFFBuiltinCODECS[];
#else
diff --git a/src/3rdparty/libtiff/libtiff/tiffvers.h b/src/3rdparty/libtiff/libtiff/tiffvers.h
index 7c41574..403d61b 100644
--- a/src/3rdparty/libtiff/libtiff/tiffvers.h
+++ b/src/3rdparty/libtiff/libtiff/tiffvers.h
@@ -1,4 +1,4 @@
-#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.9\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.10\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
/*
* This define can be used in code that requires
* compilation-related definitions specific to a
@@ -6,4 +6,4 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
-#define TIFFLIB_VERSION 20171118
+#define TIFFLIB_VERSION 20181110