From: Vadim Zeitlin Date: Tue, 4 Jan 2011 15:10:09 +0000 (+0000) Subject: Compilation fix for PNG saving code when wxUSE_PALETTE==0. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/967956ddcf45090ff2c965d12b68ea0ef6bf9eae Compilation fix for PNG saving code when wxUSE_PALETTE==0. Don't handle wxPNG_TYPE_PALETTE and don't compile PaletteFind() in at all when wxUSE_PALETTE is off. Closes #12505. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66577 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/imagpng.cpp b/src/common/imagpng.cpp index 700833b776..70e2a0abac 100644 --- a/src/common/imagpng.cpp +++ b/src/common/imagpng.cpp @@ -649,8 +649,9 @@ error: // SaveFile() helpers // ---------------------------------------------------------------------------- -static int PaletteFind(const png_color& clr, - const png_color *pal, int palCount) +#if wxUSE_PALETTE + +static int PaletteFind(const png_color& clr, const png_color *pal, int palCount) { for (int i = 0; i < palCount; ++i) { @@ -665,6 +666,8 @@ static int PaletteFind(const png_color& clr, return wxNOT_FOUND; } +#endif // wxUSE_PALETTE + // ---------------------------------------------------------------------------- // writing PNGs // ---------------------------------------------------------------------------- @@ -1004,10 +1007,12 @@ bool wxPNGHandler::SaveFile( wxImage *image, wxOutputStream& stream, bool verbos *pData++ = 0; break; +#if wxUSE_PALETTE case wxPNG_TYPE_PALETTE: *pData++ = (unsigned char) PaletteFind(clr, palette, numPalette); break; +#endif // wxUSE_PALETTE } if ( bUseAlpha )