Warnings in pnglib


#1

Hey,

With GCC 4.2 on Mac OS X 10.6, i get those warnings into the release build:

pnglib/pngread.c:1029: warning: 'sig_bit' may be used uninitialized in this function
pnglib/pngset.c:579: warning: 'sig_bit.juce::pnglibNamespace::png_color_8_struct::gray' is used uninitialized in this function

#2

I don't think those show up with newer compilers - it looks like a compiler mistake to me. I can add an initialiser to avoid the one in pndread.c, but not sure what the other one is trying to say.


#3

Hi,

Concerning the second warning, sorry for the bad report, here the complete message:

/Users/nicolas/Work/Grenadine/Projects/Tralala/Builds/MacOSX/../../../../../JUCE/modules/juce_graphics/image_formats/pnglib/pngset.c:579: warning: 'sig_bit.juce::pnglibNamespace::png_color_8_struct::gray' is used uninitialized in this function
/Users/nicolas/Work/Grenadine/Projects/Tralala/Builds/MacOSX/../../../../../JUCE/modules/juce_graphics/image_formats/juce_PNGLoader.cpp:493: note: 'sig_bit.juce::pnglibNamespace::png_color_8_struct::gray' was declared here

It could be solved like below in "juce_PNGLoader.cpp" / line 493.

    png_color_8 sig_bit;
    sig_bit.red = 8;
    sig_bit.green = 8;
    sig_bit.blue = 8;
    sig_bit.gray = 0;   /* ??? */
    sig_bit.alpha = 8;
    png_set_sBIT (pngWriteStruct, pngInfoStruct, &sig_bit);

I have no idea what's the proper value to initialize with, so i set it to zero.


#4

Ok, thanks!


#5

Thanks, compiles cleanly now.