Commit 673cac9e authored by Alexandre Julliard's avatar Alexandre Julliard

tiff: Import upstream release 4.6.0.

parent 736f90d8
/* libtiff/tif_config.h. Generated from tif_config.h.in by configure. */
/* clang-format off */
/* clang-format disabled because CMake scripts are very sensitive to the
* formatting of this file. configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted.
*/
/* libtiff/tif_config.h.in. Not generated, but originated from autoheader. */
#include "tiffconf.h"
......@@ -35,18 +41,6 @@
/* Define to 1 if you have the `getopt' function. */
/* #undef HAVE_GETOPT */
/* Define to 1 if you have the <GLUT/glut.h> header file. */
/* #undef HAVE_GLUT_GLUT_H */
/* Define to 1 if you have the <GL/glut.h> header file. */
/* #undef HAVE_GL_GLUT_H */
/* Define to 1 if you have the <GL/glu.h> header file. */
#define HAVE_GL_GLU_H 1
/* Define to 1 if you have the <GL/gl.h> header file. */
#define HAVE_GL_GL_H 1
/* Define to 1 if you have the <io.h> header file. */
#define HAVE_IO_H 1
......@@ -56,12 +50,6 @@
/* Define to 1 if you have the `mmap' function. */
/* #undef HAVE_MMAP */
/* Define to 1 if you have the <OpenGL/glu.h> header file. */
/* #undef HAVE_OPENGL_GLU_H */
/* Define to 1 if you have the <OpenGL/gl.h> header file. */
/* #undef HAVE_OPENGL_GL_H */
/* Define to 1 if you have the `setmode' function. */
#define HAVE_SETMODE 1
......@@ -93,35 +81,29 @@
#define PACKAGE "tiff"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "tiff@lists.maptools.org"
#define PACKAGE_BUGREPORT "tiff@lists.osgeo.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "LibTIFF Software"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "LibTIFF Software 4.5.1"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "tiff"
/* Define to the home page for this package. */
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "4.5.1"
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T 4
/* Default size of the strip in bytes (when strip chopping enabled) */
#define STRIP_SIZE_DEFAULT 8192
/* Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
#define TIFF_MAX_DIR_COUNT 1048576
/* define to use win32 IO system */
#define USE_WIN32_FILEIO 1
/* Version number of package */
#define VERSION "4.5.1"
/* Support webp compression */
/* #undef WEBP_SUPPORT */
......@@ -156,8 +138,19 @@
#if !defined(__MINGW32__)
# define TIFF_SIZE_FORMAT "zu"
# define TIFF_SSIZE_FORMAT "zd"
#endif
#if SIZEOF_SIZE_T == 8
# define TIFF_SSIZE_FORMAT PRId64
# if defined(__MINGW32__)
# define TIFF_SIZE_FORMAT PRIu64
# endif
#elif SIZEOF_SIZE_T == 4
# define TIFF_SSIZE_FORMAT PRId32
# if defined(__MINGW32__)
# define TIFF_SIZE_FORMAT PRIu32
# endif
#else
# define TIFF_SIZE_FORMAT "Iu"
# define TIFF_SSIZE_FORMAT "Id"
# error "Unsupported size_t size; please submit a bug report"
#endif
/* clang-format on */
......@@ -5038,7 +5038,7 @@ static void TIFFReadDirectoryCheckOrder(TIFF *tif, TIFFDirEntry *dir,
uint16_t dircount)
{
static const char module[] = "TIFFReadDirectoryCheckOrder";
uint16_t m;
uint32_t m;
uint16_t n;
TIFFDirEntry *o;
m = 0;
......
......@@ -2073,34 +2073,41 @@ static int TIFFWriteDirectoryTagTransferfunction(TIFF *tif, uint32_t *ndir,
(*ndir)++;
return (1);
}
/* TIFFTAG_TRANSFERFUNCTION expects (1 or 3) pointer to arrays with
* (1 << BitsPerSample) * uint16_t values.
*/
m = (1 << tif->tif_dir.td_bitspersample);
n = tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples;
/* clang-format off */
n = (tif->tif_dir.td_samplesperpixel - tif->tif_dir.td_extrasamples) > 1 ? 3 : 1;
/* clang-format on */
/* Check for proper number of transferfunctions */
for (int i = 0; i < n; i++)
{
if (tif->tif_dir.td_transferfunction[i] == NULL)
{
TIFFWarningExtR(
tif, module,
"Too few TransferFunctions provided. Tag not written to file");
return (1); /* Not an error; only tag is not written. */
}
}
/*
* Check if the table can be written as a single column,
* or if it must be written as 3 columns. Note that we
* write a 3-column tag if there are 2 samples/pixel and
* a single column of data won't suffice--hmm.
*/
if (n > 3)
n = 3;
if (n == 3)
{
if (tif->tif_dir.td_transferfunction[2] == NULL ||
!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],
if (!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],
tif->tif_dir.td_transferfunction[2],
m * sizeof(uint16_t)))
n = 2;
}
if (n == 2)
{
if (tif->tif_dir.td_transferfunction[1] == NULL ||
m * sizeof(uint16_t)) &&
!_TIFFmemcmp(tif->tif_dir.td_transferfunction[0],
tif->tif_dir.td_transferfunction[1],
m * sizeof(uint16_t)))
n = 1;
}
if (n == 0)
n = 1;
o = _TIFFmallocExt(tif, n * m * sizeof(uint16_t));
if (o == NULL)
{
......
......@@ -761,6 +761,7 @@ typedef enum
#define TIFFTAG_LERC_MAXZERROR 65567 /* LERC maximum error */
#define TIFFTAG_WEBP_LEVEL 65568 /* WebP compression level */
#define TIFFTAG_WEBP_LOSSLESS 65569 /* WebP lossless/lossy */
#define TIFFTAG_WEBP_LOSSLESS_EXACT 65571 /* WebP lossless exact mode. Set-only mode. Default is 1. Can be set to 0 to increase compression rate, but R,G,B in areas where alpha = 0 will not be preserved */
#define TIFFTAG_DEFLATE_SUBCODEC 65570 /* ZIP codec: to get/set the sub-codec to use. Will default to libdeflate when available */
#define DEFLATE_SUBCODEC_ZLIB 0
#define DEFLATE_SUBCODEC_LIBDEFLATE 1
......
......@@ -5,6 +5,12 @@
from this file in your programs.
*/
/* clang-format off */
/* clang-format disabled because CMake scripts are very sensitive to the
* formatting of this file. configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted.
*/
#ifndef _TIFFCONF_
#define _TIFFCONF_
......@@ -12,7 +18,6 @@
#include <stddef.h>
#include <stdint.h>
#include <inttypes.h>
#include <sys/types.h>
/* Signed 16-bit type */
......@@ -40,7 +45,7 @@
/* #undef TIFF_UINT8_T */
/* Signed size type */
#define TIFF_SSIZE_T ssize_t
#define TIFF_SSIZE_T intptr_t
/* Compatibility stuff. */
......@@ -48,6 +53,18 @@
machine */
#define HAVE_IEEEFP 1
/* The concept of HOST_FILLORDER is broken. Since libtiff 4.5.1
* this macro will always be hardcoded to FILLORDER_LSB2MSB on all
* architectures, to reflect past long behavior of doing so on x86 architecture.
* Note however that the default FillOrder used by libtiff is FILLORDER_MSB2LSB,
* as mandated per the TIFF specification.
* The influence of HOST_FILLORDER is only when passing the 'H' mode in
* TIFFOpen().
* You should NOT rely on this macro to decide the CPU endianness!
* This macro will be removed in libtiff 4.6
*/
#define HOST_FILLORDER FILLORDER_LSB2MSB
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
(Intel) */
#define HOST_BIGENDIAN 0
......@@ -124,3 +141,5 @@
#define IPTC_SUPPORT
#endif /* _TIFFCONF_ */
/* clang-format on */
......@@ -277,7 +277,7 @@ typedef struct
#define LOGLUV_PUBLIC 1
#endif
#if defined(__GNUC__) || defined(__attribute__)
#if defined(__GNUC__) || defined(__clang__) || defined(__attribute__)
#define TIFF_ATTRIBUTE(x) __attribute__(x)
#else
#define TIFF_ATTRIBUTE(x) /*nothing*/
......
/* tiffvers.h version information is updated according to version information
* in configure.ac */
/* clang-format off */
/* clang-format disabled because FindTIFF.cmake is very sensitive to the
* formatting of below line being a single line.
* Furthermore, configure_file variables of type "@VAR@" are
* modified by clang-format and won't be substituted by CMake.
*/
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.5.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.6.0\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
......@@ -11,12 +16,13 @@
* version checking should be done based on the
* string returned by TIFFGetVersion.
*/
#define TIFFLIB_VERSION 20230609
#define TIFFLIB_VERSION 20230908
/* The following defines have been added in 4.5.0 */
#define TIFFLIB_MAJOR_VERSION 4
#define TIFFLIB_MINOR_VERSION 5
#define TIFFLIB_MICRO_VERSION 1
#define TIFFLIB_MINOR_VERSION 6
#define TIFFLIB_MICRO_VERSION 0
#define TIFFLIB_VERSION_STR_MAJ_MIN_MIC "4.6.0"
/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is
* greater or equal to major.minor.micro
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment