www.digitalmars.com         C & C++   DMDScript  

c++.wxwindows - jpegs

reply "chris elliott" <biol75 york.ac.uk> writes:
On wx-dev Mailing list Daniel walter wrote:

In jmorecfg.h boolean has a typedef as int which prevents jpegs from
loading.  If I change this to unsigned char it works.

I am not sure exactly where this change should be made.  It would be nice to
get boolean from the compiler to be compatible with C++ or maybe not use
boolean in C code.

I am using Code Warrior for windows if this needs to be platform specific.
This problem was quite a pain to find thougth as the first symptom was a seg
fault and after digging deeper the next thing I got was struct sizes don't
match, so it would be nice to prevent people porting to other compilers from
finding this one the hard way.

-----------
I see the same bug with the image sample on loading the jpeg image
I tried debugging it but got in a tangle
chris
Sep 21 2003
parent reply Arjan Knepper <arjan ask.me> writes:
The problem is the structsize of jpeg_decompress_struct which differ 
between the jpeg-lib and wxwindows-lib. (464 vs 432)

To solve this change the file:

%WXIR%\src\jpeg\jconfig.h

and add the next define to line 5:
-----------------------<snip>-----------------------------------------
                                                VVVVVVVVVVVVVVVVVVVV
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__DMC__)
#include "jconfig.vc"
#else
-----------------------<snip>-----------------------------------------

recompile the jpeglib and you should be fine.

Arjan Knepper

chris elliott wrote:
 On wx-dev Mailing list Daniel walter wrote:
 
 In jmorecfg.h boolean has a typedef as int which prevents jpegs from
 loading.  If I change this to unsigned char it works.
 
 I am not sure exactly where this change should be made.  It would be nice to
 get boolean from the compiler to be compatible with C++ or maybe not use
 boolean in C code.
 
 I am using Code Warrior for windows if this needs to be platform specific.
 This problem was quite a pain to find thougth as the first symptom was a seg
 fault and after digging deeper the next thing I got was struct sizes don't
 match, so it would be nice to prevent people porting to other compilers from
 finding this one the hard way.
 
 -----------
 I see the same bug with the image sample on loading the jpeg image
 I tried debugging it but got in a tangle
 chris
 
 
Oct 02 2003
parent chris elliott <biol75 york.ac.uk> writes:
Thanks for finding this- I have fixed it in the CVS code
chris

Arjan Knepper wrote:

 The problem is the structsize of jpeg_decompress_struct which differ 
 between the jpeg-lib and wxwindows-lib. (464 vs 432)
 
 To solve this change the file:
 
 %WXIR%\src\jpeg\jconfig.h
 
 and add the next define to line 5:
 -----------------------<snip>-----------------------------------------
                                                VVVVVVVVVVVVVVVVVVVV
 #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__DMC__)
 #include "jconfig.vc"
 #else
 -----------------------<snip>-----------------------------------------
 
 recompile the jpeglib and you should be fine.
 
 Arjan Knepper
 
 chris elliott wrote:
 
 On wx-dev Mailing list Daniel walter wrote:

 In jmorecfg.h boolean has a typedef as int which prevents jpegs from
 loading.  If I change this to unsigned char it works.

 I am not sure exactly where this change should be made.  It would be 
 nice to
 get boolean from the compiler to be compatible with C++ or maybe not use
 boolean in C code.

 I am using Code Warrior for windows if this needs to be platform 
 specific.
 This problem was quite a pain to find thougth as the first symptom was 
 a seg
 fault and after digging deeper the next thing I got was struct sizes 
 don't
 match, so it would be nice to prevent people porting to other 
 compilers from
 finding this one the hard way.

 -----------
 I see the same bug with the image sample on loading the jpeg image
 I tried debugging it but got in a tangle
 chris
Oct 02 2003