]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/imagiff.cpp
no, we shouldn't inconditionally add the separator at the end even if wxPATH_GET_SEPA...
[wxWidgets.git] / src / common / imagiff.cpp
index 68dc35b1afda58931b67f4f67bd7ce95f523f596..25d700bc377dadfc3e7968959fb1741a9815975a 100644 (file)
@@ -1,14 +1,16 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        imagiff.h
 // Purpose:     wxImage handler for Amiga IFF images
-// Author:      Steffen Gutmann
+// Author:      Steffen Gutmann, Thomas Meyer
 // RCS-ID:      $Id$
 // Copyright:   (c) Steffen Gutmann, 2002
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-//        parts of the source are based on xviff by Thomas Meyer
-//        Permission for use in wxWindows has been gratefully given.
+// Parts of this source are based on the iff loading algorithm found
+// in xviff.c.  Permission by the original author, Thomas Meyer, and
+// by the author of xv, John Bradley for using the iff loading part
+// in wxWindows has been gratefully given.
 
 #ifdef __GNUG__
 #pragma implementation "imagiff.h"
@@ -228,12 +230,14 @@ int wxIFFDecoder::GetTransparentColour() const { return m_image->transparent; }
 //
 bool wxIFFDecoder::CanRead()
 {
-    unsigned char buf[12] = "";
+    unsigned char buf[12];
 
-    m_f->Read(buf, 12);
-    m_f->SeekI(-12, wxFromCurrent);
+    if ( !m_f->Read(buf, WXSIZEOF(buf)) )
+        return FALSE;
+
+    m_f->SeekI(-WXSIZEOF(buf), wxFromCurrent);
 
-    return (memcmp(buf, "FORM", 4) == 0 && memcmp(buf+8, "ILBM", 4) == 0);
+    return (memcmp(buf, "FORM", 4) == 0) && (memcmp(buf+8, "ILBM", 4) == 0);
 }