git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2313
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
// VZ: as this function uses setjmp() the only fool proof error handling
// method is to use goto (setjmp is not really C++ dtors friendly...)
// VZ: as this function uses setjmp() the only fool proof error handling
// method is to use goto (setjmp is not really C++ dtors friendly...)
- unsigned char **lines = (unsigned char **) NULL;
unsigned int i;
png_infop info_ptr = (png_infop) NULL;
unsigned int i;
png_infop info_ptr = (png_infop) NULL;
(png_error_ptr) NULL,
(png_error_ptr) NULL );
if (!png_ptr)
(png_error_ptr) NULL,
(png_error_ptr) NULL );
if (!png_ptr)
info_ptr = png_create_info_struct( png_ptr );
if (!info_ptr)
info_ptr = png_create_info_struct( png_ptr );
if (!info_ptr)
if (setjmp(png_ptr->jmpbuf))
if (setjmp(png_ptr->jmpbuf))
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
if (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
png_set_read_fn( png_ptr, &stream, _PNG_stream_reader);
image->Create( width, height );
if (!image->Ok())
image->Create( width, height );
if (!image->Ok())
lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
if (lines == NULL)
lines = (unsigned char **)malloc( height * sizeof(unsigned char *) );
if (lines == NULL)
for (i = 0; i < height; i++)
{
for (i = 0; i < height; i++)
{
+
+ error_nolines:
+ lines = NULL; // called from before it was set
+ error:
wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));
if ( image->Ok() )
wxLogError(_("Couldn't load a PNG image - probably file is corrupted."));
if ( image->Ok() )