]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed failing to load ANI, BMP, and ICO images from non-seekable streams.
authorDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Thu, 5 May 2011 23:52:07 +0000 (23:52 +0000)
committerDimitri Schoolwerth <dimitri.schoolwerth@gmail.com>
Thu, 5 May 2011 23:52:07 +0000 (23:52 +0000)
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

src/common/anidecod.cpp
src/common/imagbmp.cpp

index 2cb075948d1070c40385019f4c0d7fedfc44c94e..d0d0b6d75bc7c034b17ac9a4e7573ab1714991eb 100644 (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;
     }
index 71dd36d635106cad5d41ba522f54e9787dd016b6..631130805c99d5b3246c31845a847888811f7513 100644 (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;
     }