Make TIFF_MAX_DIR_COUNT a autoconf/CMake setting

This commit is contained in:
Even Rouault
2022-12-13 13:12:49 +01:00
parent 0530835da4
commit a1be870b1f
6 changed files with 26 additions and 5 deletions

View File

@@ -35,6 +35,8 @@ if(strip-chopping)
endif()
endif()
set(TIFF_MAX_DIR_COUNT 1048576 CACHE STRING "Maximum number of TIFF directories that libtiff can browse through")
# Defer loading of strip/tile offsets
option(defer-strile-load "enable deferred strip/tile offset/size loading (also available at runtime with the 'D' flag of TIFFOpen())" OFF)
set(DEFER_STRILE_LOAD ${defer-strile-load})

View File

@@ -1080,6 +1080,20 @@ if test "$HAVE_STRIPCHOP" = "yes" \
fi
dnl ---------------------------------------------------------------------------
dnl Maximum number of TIFF directories that libtiff can browse through
dnl ---------------------------------------------------------------------------
AC_ARG_WITH(max-dir-count,
AS_HELP_STRING([--with-max-dir-count=SIZE],
[Maximum number of TIFF directories that libtiff can browse through [[default=1048576]]]),,)
if test "x$with_max_dir_count" = "x" -o "x$with_max_dir_count" = "xyes"; then
with_max_dir_count="1048576"
fi
AC_DEFINE_UNQUOTED(TIFF_MAX_DIR_COUNT,$with_max_dir_count,[Maximum number of TIFF directories that libtiff can browse through])
dnl ---------------------------------------------------------------------------
dnl Should we try to defer loading of strip/tile offsets and sizes to
dnl optimize directory scanning?

View File

@@ -112,6 +112,9 @@
/* Default size of the strip in bytes (when strip chopping enabled) */
#define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
/** Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
#define TIFF_MAX_DIR_COUNT @TIFF_MAX_DIR_COUNT@
/* define to use win32 IO system */
#cmakedefine USE_WIN32_FILEIO 1

View File

@@ -115,6 +115,9 @@
/* Default size of the strip in bytes (when strip chopping enabled) */
#undef STRIP_SIZE_DEFAULT
/* Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
#undef TIFF_MAX_DIR_COUNT
/* define to use win32 IO system */
#undef USE_WIN32_FILEIO

View File

@@ -277,11 +277,6 @@ typedef struct
#define TIFF_ATTRIBUTE(x) /*nothing*/
#endif
/** Maximum number of TIFF IFDs that libtiff can iterate through in a file. */
#ifndef TIFF_MAX_DIR_COUNT
#define TIFF_MAX_DIR_COUNT 1048576
#endif
#if defined(c_plusplus) || defined(__cplusplus)
extern "C"
{

View File

@@ -55,6 +55,10 @@
#define STRIP_SIZE_DEFAULT 8192
#endif
#ifndef TIFF_MAX_DIR_COUNT
#define TIFF_MAX_DIR_COUNT 1048576
#endif
#define streq(a, b) (strcmp(a, b) == 0)
#define strneq(a, b, n) (strncmp(a, b, n) == 0)