summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbfriesen <bfriesen>2015-08-16 20:08:21 +0000
committerbfriesen <bfriesen>2015-08-16 20:08:21 +0000
commit5d2b2f4d47cdc6e49336a5bb1cba3c7840ef7ed8 (patch)
tree31450e5a82c36d5e7dd9eb5d8a2355f81baf3273
parentdc6180f93bba6569f6ec31202a4e546ee7a766e1 (diff)
downloadlibtiff-5d2b2f4d47cdc6e49336a5bb1cba3c7840ef7ed8.tar.gz
Fix problem with 'boolean' definition from IJG JPEG 9.
-rw-r--r--test/raw_decode.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/test/raw_decode.c b/test/raw_decode.c
index 5e95a6f5..f81aa059 100644
--- a/test/raw_decode.c
+++ b/test/raw_decode.c
@@ -1,4 +1,4 @@
-/* $Id: raw_decode.c,v 1.6 2015-06-20 16:52:25 bfriesen Exp $ */
+/* $Id: raw_decode.c,v 1.7 2015-08-16 20:08:21 bfriesen Exp $ */
/*
* Copyright (c) 2012, Frank Warmerdam <warmerdam@pobox.com>
@@ -41,12 +41,36 @@
#endif
#include "tiffio.h"
+
/*
- Avoid conflicting typedefs for INT32 and boolean when including jpeglib.h.
+ Libjpeg's jmorecfg.h defines INT16 and INT32, but only if XMD_H is
+ not defined. Unfortunately, the MinGW and Borland compilers include
+ a typedef for INT32, which causes a conflict. MSVC does not include
+ a conficting typedef given the headers which are included.
*/
-#if defined(__MINGW32__)
+#if defined(__BORLANDC__) || defined(__MINGW32__)
# define XMD_H 1
-# define HAVE_BOOLEAN /* Needs to match statement in jconfig.h */
+#endif
+
+/*
+ The windows RPCNDR.H file defines boolean, but defines it with the
+ unsigned char size. You should compile JPEG library using appropriate
+ definitions in jconfig.h header, but many users compile library in wrong
+ way. That causes errors of the following type:
+
+ "JPEGLib: JPEG parameter struct mismatch: library thinks size is 432,
+ caller expects 464"
+
+ For such users we wil fix the problem here. See install.doc file from
+ the JPEG library distribution for details.
+*/
+
+/* Define "boolean" as unsigned char, not int, per Windows custom. */
+#if defined(__WIN32__) && !defined(__MINGW32__)
+# ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
+ typedef unsigned char boolean;
+# endif
+# define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#endif
#include "jpeglib.h" /* Needed for JPEG_LIB_VERSION */