Apparent error in wxGIFHandler_WriteWord()

5 views
Skip to first unread message

Vadim Zeitlin

unread,
May 27, 2011, 5:19:45 AM5/27/11
to wx-dev
Hi Dimitri,

Could you please look at wxGIFHandler_WriteWord() function? gcc warns
about the variable "buf" being set but not used in it and this is indeed
the case so the current code -- and here it is in its entirety:

bool wxGIFHandler_WriteWord(wxOutputStream *stream, wxUint16 word)
{
wxUint8 buf[2];

buf[0] = word & 0xff;
buf[1] = (word >> 8) & 0xff;
return wxGIFHandler_Write(stream, &word, sizeof(word));
}

doesn't make much sense. I suppose we should pass buf to
wxGIFHandler_Write() but I'm not totally sure so I'd appreciate if you
could check this.

TIA,
VZ

Dimitri Schoolwerth

unread,
May 27, 2011, 8:20:23 AM5/27/11
to wx-dev
On Fri, May 27, 2011 at 1:19 PM, Vadim Zeitlin <va...@wxwidgets.org> wrote:

>            buf[0] = word & 0xff;
>            buf[1] = (word >> 8) & 0xff;
>            return wxGIFHandler_Write(stream, &word, sizeof(word));

> doesn't make much sense. I suppose we should pass buf to
> wxGIFHandler_Write() but I'm not totally sure so I'd appreciate if you
> could check this.

You're right, and I didn't notice this during my review of the patch.
Just to be sure I also verified it causes havoc with a saved GIF image
when running on PowerPC. Thank you (& gcc)! Will commit soon.


Regards,
Dimitri

Reply all
Reply to author
Forward
0 new messages