Other than this one seek, all other seeks used by the library are of the
SEEK_SET type. Only requiring SEEK_SET will simplify implementations of
lbx_file_ops quite a lot, so let's get rid of this one.
The whole point of this seek is to skip just one byte — a normal read
works just as well.
return -1;
}
- if (!(img->flags & FLAG_RAW)) {
- /* Skip padding byte, if any */
- if (img->currentn % 2) {
- if (img->fops->seek(img->f, 1, SEEK_CUR))
- return -1;
+ if (!(img->flags & FLAG_RAW) && img->currentn % 2) {
+ unsigned char c;
+
+ /* Skip padding byte */
+ if (img->fops->read(&c, 1, img->f) != 1) {
+ if (img->fops->eof(img->f))
+ lbx_error_raise(LBX_EEOF);
+ return -1;
}
}