bool wxGIFDecoder::GoFrame(int which)
{
- int i;
-
if (!IsAnimation())
return false;
if ((which >= 1) && (which <= m_nimages))
{
+ m_image = 1;
m_pimage = m_pfirst;
- for (i = 0; i < which; i++)
+ while (m_image < which)
+ {
+ m_image++;
m_pimage = m_pimage->next;
+ }
return true;
}
if ( !m_f->Read(buf, WXSIZEOF(buf)) )
return false;
- m_f->SeekI(-(off_t)WXSIZEOF(buf), wxFromCurrent);
+ m_f->SeekI(-(wxFileOffset)WXSIZEOF(buf), wxFromCurrent);
return memcmp(buf, "GIF", WXSIZEOF(buf)) == 0;
}
transparent = buf[4];
/* read disposal method */
- disposal = (buf[1] & 0x1C) - 1;
+ disposal = ((buf[1] & 0x1C) >> 2) - 1;
}
else
/* other extension, skip */
if ((buf[8] & 0x80) == 0x80)
{
ncolors = 2 << (buf[8] & 0x07);
- off_t pos = m_f->TellI();
- off_t numBytes = 3 * ncolors;
+ wxFileOffset pos = m_f->TellI();
+ wxFileOffset numBytes = 3 * ncolors;
m_f->SeekI(numBytes, wxFromCurrent);
if (m_f->TellI() != (pos + numBytes))
{