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 @@ -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 */