Strangely useless code in io-tga.c, part of gdk-pixbuf



I was looking through gdk-pixbuf and I found something odd. In io-tga.c, there's the following code snippet:

if (ctx->hdr->infolen > 255) {
  g_set_error(err, GDK_PIXBUF_ERROR,
                   GDK_PIXBUF_ERROR_CORRUPT_IMAGE,
                   _("TGA image comment length is too long"));
  return FALSE;
}

I don't get it! infolen is an element of _TGAHeader, and is declared as a guint8. Isn't guint8 *gauranteed* to be an unsigned integer that's one byte long?

If this is the case, this code check really isn't needed... so why is it in there?

Chris




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]