Now wxGIFDecoder always tries to read to the end of the GIF data.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6131 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guillermo Rodriguez Garcia
2000-02-17 23:39:35 +00:00
parent 80d83cbcc2
commit 8141573c1e
3 changed files with 94 additions and 38 deletions

View File

@@ -45,22 +45,35 @@ bool wxGIFHandler::LoadFile( wxImage *image, wxInputStream& stream, bool verbose
bool ok;
decod = new wxGIFDecoder(&stream, TRUE);
error = decod->ReadGIF();
if ((error = decod->ReadGIF()) != wxGIF_OK)
if ((error != wxGIF_OK) && (error != wxGIF_TRUNCATED))
{
if (verbose)
{
switch (error)
{
case wxGIF_INVFORMAT: wxLogError(_("wxGIFHandler: error in GIF image format")); break;
case wxGIF_MEMERR: wxLogError(_("wxGIFHandler: couldn't allocate enough memory")); break;
default: wxLogError(_("wxGIFHandler: unknown error !!!"));
case wxGIF_INVFORMAT:
wxLogError(_("wxGIFHandler: error in GIF image format."));
break;
case wxGIF_MEMERR:
wxLogError(_("wxGIFHandler: not enough memory."));
break;
default:
wxLogError(_("wxGIFHandler: unknown error!!!"));
break;
}
}
delete decod;
return FALSE;
}
if ((error == wxGIF_TRUNCATED) && verbose)
{
wxLogWarning(_("wxGIFHandler: data stream seems to be truncated."));
/* go on; image data is OK */
}
image->Destroy();
ok = decod->ConvertToImage(image);