- if (img->flags & FLAG_PALETTE) {
- unsigned char buf[4];
-
- if (fops->read(buf, sizeof buf, f) != sizeof buf) {
- if (fops->eof(f))
- lbx_error_raise(LBX_EEOF);
- free(img);
- return NULL;
- }
-
- img->palstart = unpack_16_le(buf+0);
- img->palcount = unpack_16_le(buf+2);
- img->paloff = fops->tell(f);
-
- if (img->palstart + img->palcount > 256) {
- lbx_error_raise(LBX_EFORMAT);
- free(img);
- return NULL;
- }
- }
-