Game Development Community

dev|Pro Game Development Curriculum

BitmapPng.cc portability patch

by Vincent Cojot · 06/16/2003 (11:26 am) · 6 comments

Download Code File

Hi,

in file engine/dgl/bitmapPng.cc I think I found a couple issues:

1) NULL is redefined at the TOP of the file when there is no need to (perhaps because of 2) ).

2) calls to png_set_IHDR use "NULL" instead of the correct values (PNG_INTERLACE_NONE, etc...)

3) there is no fallback from png_create_read_struct_2/png_create_write_struct_2 to png_create_read_struct/png_create_write_struct if your PNG library does not support custom memory routines.

The latter might not seem important since it just works -but- on Solaris/Sparc it kept seg faulting on startup until I discarded pngMallocFn and pngFreeFn and used the PNG-provided functions. I have tested this patch on both Linux/Nvidia/RH7.3 and Solaris/Sparc.

Thanks for reading.

Vincent S. Cojot, June 16th 2003

About the author

Recent Blogs


#1
06/16/2003 (2:53 am)
#2
06/16/2003 (11:27 am)
If this patch compiles and works with VC 6 & 7, I'll merge and check it in...
#3
06/16/2003 (11:28 am)
Awesome! Another portability bug knocked down :)
#4
06/16/2003 (4:56 pm)
Great! :)
Good stuff.
#5
06/17/2003 (5:02 am)
Hi Tim and Xavier,

Glad you find that useful.. I think it should compile fine wherever libpng is used (Tested with 1.0.12 from TGE and also 1.0.15). But I'm a complete newbie at this.. :) However, aside from some color problems (they're all wrong in the 3D view), I made some progress on the Solaris/Sparc port (check screenshot below)... :) That's a personal project that I do just for fun so my progress on this is tremendously slow but I do get some X11 windows now... :)

step.polymtl.ca/~coyote/torque/torque_solaris_20030520_03.jpg
Vincent
#6
07/08/2003 (7:21 am)
Hi Tim,
Any opinions/problems with that patch? If you encountered problems, what were they? Thanks for reading.
Regards,

Vincent