X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e34f4f195d204ca8eb94c651f8bed85e1820c368..88f23fdd8366d57d15cba42d152539ff9ccbdd39:/src/common/gifdecod.cpp?ds=sidebyside diff --git a/src/common/gifdecod.cpp b/src/common/gifdecod.cpp index 011d8cf3ad..05c4073524 100644 --- a/src/common/gifdecod.cpp +++ b/src/common/gifdecod.cpp @@ -21,6 +21,7 @@ #ifndef WX_PRECOMP # include "wx/defs.h" +# include "wx/palette.h" #endif #if wxUSE_STREAMS && wxUSE_GIF @@ -279,7 +280,7 @@ bool wxGIFDecoder::GoFrame(int which) { m_pimage = m_pfirst; - for (i = 1; i < which; i++) + for (i = 0; i < which; i++) m_pimage = m_pimage->next; return TRUE; @@ -617,10 +618,12 @@ bool wxGIFDecoder::CanRead() { unsigned char buf[3]; - m_f->Read(buf, 3); - m_f->SeekI(-3, wxFromCurrent); + if ( !m_f->Read(buf, WXSIZEOF(buf)) ) + return FALSE; + + m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent); - return (memcmp(buf, "GIF", 3) == 0); + return memcmp(buf, "GIF", WXSIZEOF(buf)) == 0; }