]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix harmless gcc warning about uninitialized mask in PNG saving code.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 19 Jul 2011 22:36:00 +0000 (22:36 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 19 Jul 2011 22:36:00 +0000 (22:36 +0000)
The mask was actually only used when it was initialized (or, conversely, the
mask was always initialized when it was used) but gcc doesn't seem to notice
this and still warns that mask components "may be used uninitialized in this
function".

Suppress the warnings by always initializing the mask, even if we don't use
it.

Closes #13333.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/imagpng.cpp

index 578d0baf6dd37b01c5f4ddaaa2e4515fe69581a2..284f5d7171c669668720bbad1f3ff2ca4d639dba 100644 (file)
@@ -795,15 +795,13 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos
 #endif
     ;
 
-    png_color_8 mask;
+    png_color_8 mask = { 0, 0, 0, 0, 0 };
 
     if (bHasMask)
     {
         mask.red   = image->GetMaskRed();
         mask.green = image->GetMaskGreen();
         mask.blue  = image->GetMaskBlue();
-        mask.alpha = 0;
-        mask.gray  = 0;
     }
 
     PaletteMap palette;