From 6a5b7872c838ba9e24ea6e1f9a306bb95a80ae6c Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Thu, 3 Aug 2017 16:13:40 -0400 Subject: LibTIFF: fix defines in tiffconf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL hardcodes the defines used in tiffconf so that the values can be used inside of '#if'. The CL that changed them was: https://pdfium-review.googlesource.com/c/9410 SIZEOF_VOIDP was a new variable in that CL. This CL uses __LP64__ to detect whether this value should be set to 8 or to 4. Bug: chromium:718494 Change-Id: I628d64cb7e2e94c47b8bcc1856abf5949d6578d4 Reviewed-on: https://pdfium-review.googlesource.com/10090 Reviewed-by: Tom Sepez Commit-Queue: Nicolás Peña --- third_party/libtiff/0027-build-config.patch | 40 +++++++++++++++++++++++++++++ third_party/libtiff/README.pdfium | 1 + third_party/libtiff/tiffconf.h | 27 ++++++++++++------- 3 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 third_party/libtiff/0027-build-config.patch diff --git a/third_party/libtiff/0027-build-config.patch b/third_party/libtiff/0027-build-config.patch new file mode 100644 index 0000000000..dcd860cb5d --- /dev/null +++ b/third_party/libtiff/0027-build-config.patch @@ -0,0 +1,40 @@ +diff --git a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h +index 2a88cb75f..4d2d7c9d9 100644 +--- a/third_party/libtiff/tiffconf.h ++++ b/third_party/libtiff/tiffconf.h +@@ -35,17 +35,26 @@ + #define HAVE_SEARCH_H 1 + #endif + +-static const size_t sizeOfInt = sizeof(int); +-/* The size of a `int', as computed by sizeof. */ +-#define SIZEOF_INT sizeOfInt +- +-static const size_t sizeOfULong = sizeof(unsigned long); ++/* The size of a `int'. */ ++/* According typedef int int32_t; in the fx_system.h*/ ++#define SIZEOF_INT 4 ++ ++/* Sunliang.Liu 20110325. We should config the correct long size for tif ++ fax4decode optimize in tif_fax3.c -- Linux64 decode issue. ++ TESTDOC: Bug #23661 - z1.tif. */ ++#if _FX_CPU_ == _FX_WIN64_ || _FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ + /* The size of `unsigned long', as computed by sizeof. */ +-#define SIZEOF_UNSIGNED_LONG sizeOfULong ++#define SIZEOF_UNSIGNED_LONG 8 ++#else ++#define SIZEOF_UNSIGNED_LONG 4 ++#endif + +-static const size_t sizeOfVoidP = sizeof(void*); +-/* The size of void* as computed by sizeof. */ +-#define SIZEOF_VOIDP sizeOfVoidP ++/* The size of void*. */ ++#ifdef __LP64__ ++#define SIZEOF_VOIDP 8 ++#else ++#define SIZEOF_VOIDP 4 ++#endif + + /* Signed 8-bit type */ + #define TIFF_INT8_T signed char diff --git a/third_party/libtiff/README.pdfium b/third_party/libtiff/README.pdfium index 80cc6371f4..39a8b5f025 100644 --- a/third_party/libtiff/README.pdfium +++ b/third_party/libtiff/README.pdfium @@ -16,3 +16,4 @@ Local Modifications: 0017-safe_skews_in_gtTileContig.patch: return error if to/from skews overflow from int32. 0025-upstream-OOM-gtTileContig: allocates the decoded buffer only after a first successful TIFFFillStrip. 0026-upstream-null-dereference: properly evit when stoponerr is set and avoid null dereferences. +0027-build-config.patch: #define variables so their value can be used by #if. diff --git a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h index 2a88cb75f4..4d2d7c9d9a 100644 --- a/third_party/libtiff/tiffconf.h +++ b/third_party/libtiff/tiffconf.h @@ -35,17 +35,26 @@ #define HAVE_SEARCH_H 1 #endif -static const size_t sizeOfInt = sizeof(int); -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT sizeOfInt - -static const size_t sizeOfULong = sizeof(unsigned long); +/* The size of a `int'. */ +/* According typedef int int32_t; in the fx_system.h*/ +#define SIZEOF_INT 4 + +/* Sunliang.Liu 20110325. We should config the correct long size for tif + fax4decode optimize in tif_fax3.c -- Linux64 decode issue. + TESTDOC: Bug #23661 - z1.tif. */ +#if _FX_CPU_ == _FX_WIN64_ || _FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ /* The size of `unsigned long', as computed by sizeof. */ -#define SIZEOF_UNSIGNED_LONG sizeOfULong +#define SIZEOF_UNSIGNED_LONG 8 +#else +#define SIZEOF_UNSIGNED_LONG 4 +#endif -static const size_t sizeOfVoidP = sizeof(void*); -/* The size of void* as computed by sizeof. */ -#define SIZEOF_VOIDP sizeOfVoidP +/* The size of void*. */ +#ifdef __LP64__ +#define SIZEOF_VOIDP 8 +#else +#define SIZEOF_VOIDP 4 +#endif /* Signed 8-bit type */ #define TIFF_INT8_T signed char -- cgit v1.2.3