Fixed failing to load ANI, BMP, and ICO images from non-seekable streams.

Guarded recently added SeekI() calls by calling is IsSeekable() first.

Regression since r67671.

Closes #12861 (again).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67708 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Dimitri Schoolwerth
2011-05-05 23:52:07 +00:00
parent 066bd25191
commit 5c98cb9b75
2 changed files with 5 additions and 5 deletions

View File

@@ -127,7 +127,7 @@ bool wxANIDecoder::DoCanRead(wxInputStream& stream) const
wxInt32 anih32;
memcpy( &anih32, "anih", 4 );
if ( stream.SeekI(0) == wxInvalidOffset )
if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset )
{
return false;
}
@@ -225,7 +225,7 @@ bool wxANIDecoder::Load( wxInputStream& stream )
wxInt32 seq32;
memcpy( &seq32, "seq ", 4 );
if ( stream.SeekI(0) == wxInvalidOffset)
if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset )
{
return false;
}

View File

@@ -1335,7 +1335,7 @@ bool wxICOHandler::SaveFile(wxImage *image,
bool wxICOHandler::LoadFile(wxImage *image, wxInputStream& stream,
bool verbose, int index)
{
if (stream.SeekI(0) == wxInvalidOffset)
if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset )
{
return false;
}
@@ -1430,7 +1430,7 @@ int wxICOHandler::DoGetImageCount(wxInputStream& stream)
{
// It's ok to modify the stream position in this function.
if (stream.SeekI(0) == wxInvalidOffset)
if ( stream.IsSeekable() && stream.SeekI(0) == wxInvalidOffset )
{
return 0;
}
@@ -1505,7 +1505,7 @@ static bool CanReadICOOrCUR(wxInputStream *stream, wxUint16 resourceType)
{
// It's ok to modify the stream position in this function.
if ( stream->SeekI(0) == wxInvalidOffset)
if ( stream->IsSeekable() && stream->SeekI(0) == wxInvalidOffset )
{
return false;
}