]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imaggif.cpp
correct bug with using uninitialized end variable (unused variable warnings are not...
[wxWidgets.git] / src / common / imaggif.cpp
index 22a8dc04cca7c1ec2b2172f9a26a0c874510faaf..cd81463b498d8b88d3fbe0c53c23230ecff6d703 100644 (file)
@@ -98,6 +98,20 @@ bool wxGIFHandler::DoCanRead( wxInputStream& stream )
 {
     wxGIFDecoder decod;
     return decod.CanRead(stream);
+         // it's ok to modify the stream position here
+}
+
+int wxGIFHandler::DoGetImageCount( wxInputStream& stream )
+{
+    wxGIFDecoder decod;
+    wxGIFErrorCode error = decod.LoadGIF(stream);
+    if ( (error != wxGIF_OK) && (error != wxGIF_TRUNCATED) )
+        return -1;
+    
+    // NOTE: this function modifies the current stream position but it's ok
+    //       (see wxImageHandler::GetImageCount)
+
+    return decod.GetFrameCount();
 }
 
 #endif  // wxUSE_STREAMS