[gdal-dev] Patch to improve libjpeg compatibility on gdal 1.11

Even Rouault even.rouault at spatialys.com
Tue Feb 17 08:00:03 PST 2015


David,

Hum I can see http://trac.osgeo.org/gdal/changeset/27926#file1 was accidentaly 
committed with an unrelated commit (and should probably be related). When 
digging a bit, it was related to experiments I did with libjpegv9 (not 9a) 
which dates back to 2013 whereas 9a is from 2014, and has a different section 
in jmorecfg.h related to boolean/TRUE/FALSE (and I see I also manually edited 
jmorecfg.h of that older version)

Where I'm confused now is that I don't need any patch in the 1.11 branch to 
compile against 9a...

The releavant extract of the output of g++ -E on libjpeg_io.cpp is
{{{
# 309 "/home/even/install-jpeg-9a/include/jmorecfg.h"
typedef int boolean;
}}}

so it doesn't use at all the "typedef enum { FALSE = 0, TRUE = 1 } boolean;" 
thing.

Even

> Hey,
> 
> the attached patch against the 1.11 branch from svn is basically a backport
> from the 2.0 branch.
> 
> It fixes a namespace problem in
> frmts/pcidsk/sdk/core/libjpeg_io.cpp
> when building gdal against a current libjpeg version (newer than v6b,
> tested with v9a).
> 
> The technical reason is that libjpeg v6b typedefs boolean as int and uses
> macros for TRUE and FALSE, which is namespace agnostic. Newer versions of
> libjpeg typedef boolean as enum with values TRUE and FALSE, which do not
> propagate into other namespaces. Therefor, the use of TRUE inside C++
> methods fails.
> 
> I encountered the problem when trying to build gdal 1.11.1 against libjpeg
> v9a.
> 
> Please review.
> 
> Thanks,
> David

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list