1diff a/third_party/libtiff/tiffiop.h b/third_party/libtiff/tiffiop.h 2--- a/third_party/libtiff/tiffiop.h 3+++ b/third_party/libtiff/tiffiop.h 4@@ -30,7 +30,7 @@ 5 * ``Library-private'' definitions. 6 */ 7 8-#include "tif_config.h" 9+#include "tiffconf.h" 10 11 #ifdef HAVE_FCNTL_H 12 # include <fcntl.h> 13@@ -59,8 +59,7 @@ 14 15 #if !defined(HAVE_SNPRINTF) && !defined(HAVE__SNPRINTF) 16 #undef snprintf 17-#define snprintf _TIFF_snprintf_f 18-extern int snprintf(char* str, size_t size, const char* format, ...); 19+#define snprintf FXSYS_snprintf 20 #endif 21 22 #include "tiffio.h" 23diff a/third_party/libtiff/tif_jpeg.c b/third_party/libtiff/tif_jpeg.c 24--- a/third_party/libtiff/tif_jpeg.c 25+++ b/third_party/libtiff/tif_jpeg.c 26@@ -85,8 +85,16 @@ 27 # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 28 #endif 29 30-#include "jpeglib.h" 31-#include "jerror.h" 32+#if defined(USE_SYSTEM_LIBJPEG) 33+#include <jerror.h> 34+#include <jpeglib.h> 35+#elif defined(USE_LIBJPEG_TURBO) 36+#include "third_party/libjpeg_turbo/jerror.h" 37+#include "third_party/libjpeg_turbo/jpeglib.h" 38+#else 39+#include "third_party/libjpeg/jerror.h" 40+#include "third_party/libjpeg/jpeglib.h" 41+#endif 42 43 /* 44 * Do we want to do special processing suitable for when JSAMPLE is a 45diff a/third_party/libtiff/tif_ojpeg.c b/third_party/libtiff/tif_ojpeg.c 46--- a/third_party/libtiff/tif_ojpeg.c 47+++ b/third_party/libtiff/tif_ojpeg.c 48@@ -214,8 +214,17 @@ 49 # define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 50 #endif 51 52-#include "jpeglib.h" 53-#include "jerror.h" 54+#if defined(USE_SYSTEM_LIBJPEG) 55+#include <jerror.h> 56+#include <jpeglib.h> 57+#elif defined(USE_LIBJPEG_TURBO) 58+#include "third_party/libjpeg_turbo/jerror.h" 59+#include "third_party/libjpeg_turbo/jpeglib.h" 60+#else 61+#include "third_party/libjpeg/jerror.h" 62+#include "third_party/libjpeg/jpeglib.h" 63+#endif 64+ 65 66 typedef struct jpeg_error_mgr jpeg_error_mgr; 67 typedef struct jpeg_common_struct jpeg_common_struct; 68diff a/third_party/libtiff/tif_pixarlog.c b/third_party/libtiff/tif_pixarlog.c 69--- a/third_party/libtiff/tif_pixarlog.c 70+++ b/third_party/libtiff/tif_pixarlog.c 71@@ -90,7 +90,7 @@ 72 */ 73 74 #include "tif_predict.h" 75-#include "zlib.h" 76+#include "../zlib_v128/zlib.h" 77 78 #include <stdio.h> 79 #include <stdlib.h> 80diff a/third_party/libtiff/tif_zip.c b/third_party/libtiff/tif_zip.c 81--- a/third_party/libtiff/tif_zip.c 82+++ b/third_party/libtiff/tif_zip.c 83@@ -47,7 +47,7 @@ 84 * last found at ftp://ftp.uu.net/pub/archiving/zip/zlib/zlib-0.99.tar.gz. 85 */ 86 #include "tif_predict.h" 87-#include "zlib.h" 88+#include "../zlib_v128/zlib.h" 89 90 #include <stdio.h> 91 92diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h 93--- /dev/null 94+++ b/third_party/libtiff/tiffconf.h 95@@ -0,0 +1,248 @@ 96+/* libtiff/tiffconf.h. Generated by configure. */ 97+/* 98+ Configuration defines for installed libtiff. 99+ This file maintained for backward compatibility. Do not use definitions 100+ from this file in your programs. 101+*/ 102+#ifndef _TIFFCONF_ 103+#define _TIFFCONF_ 104+ 105+#include "core/include/fxcrt/fx_system.h" 106+ 107+//NOTE: The tiff codec requires an ANSI C compiler environment for building and 108+// presumes an ANSI C environment for use. 109+ 110+/* Define to 1 if you have the <fcntl.h> header file. */ 111+/* Define to 1 if you have the <sys/types.h> header file. */ 112+#if _FX_OS_ == _FX_WIN32_MOBILE_ 113+# define O_RDONLY 0x0000 /* open for reading only */ 114+# define O_WRONLY 0x0001 /* open for writing only */ 115+# define O_RDWR 0x0002 /* open for reading and writing */ 116+# define O_CREAT 0x0100 /* create and open file */ 117+# define O_TRUNC 0x0200 /* open and truncate */ 118+#else 119+# define HAVE_SYS_TYPES_H 1 120+# define HAVE_FCNTL_H 1 121+#endif 122+ 123+/* Compatibility stuff. */ 124+ 125+/* Define to 1 if you have the <assert.h> header file. */ 126+#define HAVE_ASSERT_H 1 127+ 128+/* Define as 0 or 1 according to the floating point format suported by the 129+ machine */ 130+#define HAVE_IEEEFP 1 131+ 132+/* Define to 1 if you have the <string.h> header file. */ 133+//#define HAVE_STRING_H 1 134+//fx_system.h already include the string.h in ANSIC 135+ 136+/* Define to 1 if you have the <search.h> header file. */ 137+/*#define HAVE_SEARCH_H 1 */ 138+ 139+/* The size of a `int', as computed by sizeof. */ 140+/* According typedef int int32_t; in the fx_system.h*/ 141+#define SIZEOF_INT 4 142+ 143+/* Sunliang.Liu 20110325. We should config the correct long size for tif 144+ fax4decode optimize in tif_fax3.c -- Linux64 decode issue. 145+ TESTDOC: Bug #23661 - z1.tif. */ 146+#if _FX_CPU_ == _FX_WIN64_ || _FX_CPU_ == _FX_X64_ || _FX_CPU_ == _FX_IA64_ 147+/* The size of `unsigned long', as computed by sizeof. */ 148+#define SIZEOF_UNSIGNED_LONG 8 149+#else 150+#define SIZEOF_UNSIGNED_LONG 4 151+#endif 152+ 153+/* Signed 8-bit type */ 154+#define TIFF_INT8_T signed char 155+ 156+/* Unsigned 8-bit type */ 157+#define TIFF_UINT8_T unsigned char 158+ 159+/* Signed 16-bit type */ 160+#define TIFF_INT16_T signed short 161+ 162+/* Unsigned 16-bit type */ 163+#define TIFF_UINT16_T unsigned short 164+ 165+/* Signed 32-bit type */ 166+#define TIFF_INT32_T signed int 167+ 168+/* Unsigned 32-bit type */ 169+#define TIFF_UINT32_T unsigned int 170+ 171+/* Signed 32-bit type formatter */ 172+#define TIFF_INT32_FORMAT "%d" 173+ 174+/* Unsigned 32-bit type formatter */ 175+#define TIFF_UINT32_FORMAT "%u" 176+ 177+#ifdef _MSC_VER // windows 178+ 179+/* Signed 64-bit type formatter */ 180+#define TIFF_INT64_FORMAT "%I64d" 181+ 182+/* Unsigned 64-bit type formatter */ 183+#define TIFF_UINT64_FORMAT "%I64u" 184+ 185+/* Signed 64-bit type */ 186+#define TIFF_INT64_T signed __int64 187+ 188+/* Unsigned 64-bit type */ 189+#define TIFF_UINT64_T unsigned __int64 190+ 191+#else // linux/unix 192+ 193+#if 0 //_FX_CPU_ == _FX_X64_ // linux/unix 64 194+ 195+/* Signed 64-bit type formatter */ 196+#define TIFF_INT64_FORMAT "%ld" 197+ 198+/* Unsigned 64-bit type formatter */ 199+#define TIFF_UINT64_FORMAT "%lu" 200+ 201+/* Signed 64-bit type */ 202+#define TIFF_INT64_T signed long 203+ 204+#else // linux/unix 32 205+ 206+/* Signed 64-bit type formatter */ 207+#define TIFF_INT64_FORMAT "%lld" 208+ 209+/* Unsigned 64-bit type formatter */ 210+#define TIFF_UINT64_FORMAT "%llu" 211+ 212+/* Signed 64-bit type */ 213+#define TIFF_INT64_T signed long long 214+ 215+#endif // end _FX_CPU_ 216+ 217+/* Unsigned 64-bit type */ 218+#define TIFF_UINT64_T unsigned long long 219+ 220+#endif 221+ 222+ 223+/* Signed size type */ 224+#ifdef _MSC_VER 225+ 226+#if defined(_WIN64) 227+#define TIFF_SSIZE_T signed __int64 228+#else 229+#define TIFF_SSIZE_T signed int 230+#endif 231+ 232+#else 233+ 234+#define TIFF_SSIZE_T signed long 235+ 236+#endif 237+ 238+/* Signed size type formatter */ 239+#if defined(_WIN64) 240+#define TIFF_SSIZE_FORMAT "%I64d" 241+#else 242+#define TIFF_SSIZE_FORMAT "%ld" 243+#endif 244+ 245+/* Pointer difference type */ 246+#ifdef _MSC_VER 247+#define TIFF_PTRDIFF_T long 248+#else 249+#define TIFF_PTRDIFF_T ptrdiff_t 250+#endif 251+ 252+/* Signed 64-bit type */ 253+/*#define TIFF_INT64_T signed __int64*/ 254+ 255+/* Unsigned 64-bit type */ 256+/*#define TIFF_UINT64_T unsigned __int64*/ 257+ 258+/* Define to `__inline__' or `__inline' if that's what the C compiler 259+ calls it, or to nothing if 'inline' is not supported under any name. */ 260+#ifndef __cplusplus 261+# ifndef inline 262+# define inline __inline 263+# endif 264+#endif 265+ 266+#define lfind _lfind 267+ 268+#define BSDTYPES 269+ 270+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ 271+#define HOST_FILLORDER FILLORDER_LSB2MSB 272+ 273+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian 274+ (Intel) */ 275+#if _FX_ENDIAN_ == _FX_BIG_ENDIAN_ 276+# define HOST_BIGENDIAN 1 277+#else 278+# define HOST_BIGENDIAN 0 279+#endif 280+ 281+/* Support CCITT Group 3 & 4 algorithms */ 282+#define CCITT_SUPPORT 1 283+ 284+/* Support JPEG compression (requires IJG JPEG library) */ 285+#define JPEG_SUPPORT 1 286+ 287+/* Support LogLuv high dynamic range encoding */ 288+#define LOGLUV_SUPPORT 1 289+ 290+/* Support LZW algorithm */ 291+#define LZW_SUPPORT 1 292+ 293+/* Support NeXT 2-bit RLE algorithm */ 294+#define NEXT_SUPPORT 1 295+ 296+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation 297+ fails with unpatched IJG JPEG library) */ 298+#define OJPEG_SUPPORT 1 299+ 300+/* Support Macintosh PackBits algorithm */ 301+#define PACKBITS_SUPPORT 1 302+ 303+/* Support Pixar log-format algorithm (requires Zlib) */ 304+#define PIXARLOG_SUPPORT 1 305+ 306+/* Support ThunderScan 4-bit RLE algorithm */ 307+#define THUNDER_SUPPORT 1 308+ 309+/* Support Deflate compression */ 310+#define ZIP_SUPPORT 1 311+ 312+/* Support strip chopping (whether or not to convert single-strip uncompressed 313+ images to mutiple strips of ~8Kb to reduce memory usage) */ 314+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP 315+ 316+/* Enable SubIFD tag (330) support */ 317+#define SUBIFD_SUPPORT 1 318+ 319+/* Treat extra sample as alpha (default enabled). The RGBA interface will 320+ treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many 321+ packages produce RGBA files but don't mark the alpha properly. */ 322+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 323+ 324+/* Pick up YCbCr subsampling info from the JPEG data stream to support files 325+ lacking the tag (default enabled). */ 326+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 327+ 328+/* Support MS MDI magic number files as TIFF */ 329+#define MDI_SUPPORT 1 330+ 331+/* 332+ * Feature support definitions. 333+ * XXX: These macros are obsoleted. Don't use them in your apps! 334+ * Macros stays here for backward compatibility and should be always defined. 335+ */ 336+#define COLORIMETRY_SUPPORT 337+#define YCBCR_SUPPORT 338+#define CMYK_SUPPORT 339+#define ICC_SUPPORT 340+#define PHOTOSHOP_SUPPORT 341+#define IPTC_SUPPORT 342+ 343+#endif /* _TIFFCONF_ */ 344