suppressed compiler warning

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2313 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-04-30 10:35:30 +00:00
parent f46f1bc60a
commit 95ee0ac83b

View File

@@ -76,7 +76,7 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
// VZ: as this function uses setjmp() the only fool proof error handling // VZ: as this function uses setjmp() the only fool proof error handling
// method is to use goto (setjmp is not really C++ dtors friendly...) // method is to use goto (setjmp is not really C++ dtors friendly...)
unsigned char **lines = (unsigned char **) NULL; unsigned char **lines;
unsigned int i; unsigned int i;
png_infop info_ptr = (png_infop) NULL; png_infop info_ptr = (png_infop) NULL;
@@ -87,17 +87,17 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
(png_error_ptr) NULL, (png_error_ptr) NULL,
(png_error_ptr) NULL ); (png_error_ptr) NULL );
if (!png_ptr) if (!png_ptr)
goto error; goto error_nolines;
info_ptr = png_create_info_struct( png_ptr ); info_ptr = png_create_info_struct( png_ptr );
if (!info_ptr) if (!info_ptr)
goto error; goto error_nolines;
if (setjmp(png_ptr->jmpbuf)) if (setjmp(png_ptr->jmpbuf))
goto error; goto error_nolines;
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA) if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
goto error; goto error_nolines;
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader); png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
@@ -119,11 +119,11 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
image->Create( width, height ); image->Create( width, height );
if (!image->Ok()) if (!image->Ok())
goto error; goto error_nolines;
lines = (unsigned char **)malloc( height * sizeof(unsigned char *) ); lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
if (lines == NULL) if (lines == NULL)
goto error; goto error_nolines;
for (i = 0; i < height; i++) for (i = 0; i < height; i++)
{ {
@@ -212,6 +212,8 @@ bool wxPNGHandler::LoadFile( wxImage *image, wxInputStream& stream )
return TRUE; return TRUE;
error_nolines:
lines = NULL; // called from before it was set
error: error:
wxLogError(_("Couldn't load a PNG image - probably file is corrupted.")); wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));