Merge libtiff build config patches. Easier to just patch once. Fix a typo in third_party/libtiff/README.pdfium along the way. Change-Id: I50a52ac4f7ffd250150397965c8768f3e9055592 Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79831 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
diff --git a/third_party/libtiff/0000-build-config.patch b/third_party/libtiff/0000-build-config.patch index 40a373c..400bc9e 100644 --- a/third_party/libtiff/0000-build-config.patch +++ b/third_party/libtiff/0000-build-config.patch
@@ -68,7 +68,7 @@ diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h --- /dev/null +++ b/third_party/libtiff/tiffconf.h -@@ -0,0 +1,240 @@ +@@ -0,0 +1,253 @@ +/* libtiff/tiffconf.h. Generated by configure. */ +/* + Configuration defines for installed libtiff. @@ -107,17 +107,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 ++/* The size of a `int'. */ ++/* According typedef int int32_t; in the fx_system.h*/ ++#define SIZEOF_INT 4 + -+static const size_t sizeOfULong = sizeof(unsigned long); ++/* 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_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 @@ -194,13 +203,16 @@ + +#if defined(_WIN64) +#define TIFF_SSIZE_T signed __int64 ++#define TIFF_SSIZE_T_MAX INT64_MAX +#else +#define TIFF_SSIZE_T signed int ++#define TIFF_SSIZE_T_MAX INT_MAX +#endif + +#else + +#define TIFF_SSIZE_T signed long ++#define TIFF_SSIZE_T_MAX LONG_MAX + +#endif +
diff --git a/third_party/libtiff/0027-build-config.patch b/third_party/libtiff/0027-build-config.patch deleted file mode 100644 index ec1a205..0000000 --- a/third_party/libtiff/0027-build-config.patch +++ /dev/null
@@ -1,40 +0,0 @@ -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_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 b7d70e7..9e98d61 100644 --- a/third_party/libtiff/README.pdfium +++ b/third_party/libtiff/README.pdfium
@@ -11,8 +11,7 @@ 0000-build-config.patch: Local build configuration changes. 0017-safe_skews_in_gtTileContig.patch: return error if to/from skews overflow from int32. -0027-build-config.patch: #define variables so their value can be used by #if. 0028-nstrips-OOM.patch: return error for excess number of tiles/strips. 0031-safe_size_ingtStripContig.patch: return error if the size to read overflow from int32. 0032-builtin-codecs.patch: make _TIFFBuiltinCODECS const data. -0033-0033-avail-out-overflow.patch: signed comparison in PixarLogDecode(). \ No newline at end of file +0033-avail-out-overflow.patch: signed comparison in PixarLogDecode().