]> git.saurik.com Git - wxWidgets.git/commitdiff
continue with other handlers if some handler fails in LoadFile() after returning...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Apr 2008 15:31:18 +0000 (15:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Apr 2008 15:31:18 +0000 (15:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/image.cpp

index e4ccc1b8f322c80e49348c4d96c5e528f48eda24..3f253221838056ec9259d797f5597e245f1de5d9 100644 (file)
@@ -2159,13 +2159,19 @@ int wxImage::GetImageCount( wxInputStream &stream, long type )
 
     if ( type == wxBITMAP_TYPE_ANY )
     {
-        wxList &list=GetHandlers();
+        const wxList& list = GetHandlers();
 
-        for (wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext())
+        for ( wxList::compatibility_iterator node = list.GetFirst();
+              node;
+              node = node->GetNext() )
         {
-             handler=(wxImageHandler*)node->GetData();
+             handler = (wxImageHandler*)node->GetData();
              if ( handler->CanRead(stream) )
-                 return handler->GetImageCount(stream);
+             {
+                 const int count = handler->GetImageCount(stream);
+                 if ( count >= 0 )
+                     return count;
+             }
 
         }
 
@@ -2202,17 +2208,22 @@ bool wxImage::LoadFile( wxInputStream& stream, long type, int index )
 
     if ( type == wxBITMAP_TYPE_ANY )
     {
-        wxList &list=GetHandlers();
-
-        for ( wxList::compatibility_iterator node = list.GetFirst(); node; node = node->GetNext() )
+        const wxList& list = GetHandlers();
+        for ( wxList::compatibility_iterator node = list.GetFirst();
+              node;
+              node = node->GetNext() )
         {
-             handler=(wxImageHandler*)node->GetData();
-             if ( handler->CanRead(stream) )
-                 return handler->LoadFile(this, stream, true/*verbose*/, index);
+             handler = (wxImageHandler*)node->GetData();
+             if ( handler->CanRead(stream) &&
+                    handler->LoadFile(this, stream, true/*verbose*/, index) )
+             {
+                 return true;
+             }
 
         }
 
         wxLogWarning( _("No handler found for image type.") );
+
         return false;
     }