img_load_webp: remove unnecessary casting
This commit is contained in:
parent
eccd7de532
commit
3b6db44267
12
image.c
12
image.c
|
@ -302,12 +302,11 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
{
|
{
|
||||||
FILE *webp_file;
|
FILE *webp_file;
|
||||||
WebPData data;
|
WebPData data;
|
||||||
|
|
||||||
Imlib_Image im = NULL;
|
Imlib_Image im = NULL;
|
||||||
struct WebPAnimDecoderOptions opts;
|
struct WebPAnimDecoderOptions opts;
|
||||||
WebPAnimDecoder *dec = NULL;
|
WebPAnimDecoder *dec = NULL;
|
||||||
struct WebPAnimInfo info;
|
struct WebPAnimInfo info;
|
||||||
unsigned char *buf = NULL;
|
unsigned char *buf = NULL, *bytes = NULL;
|
||||||
int ts;
|
int ts;
|
||||||
const WebPDemuxer *demux;
|
const WebPDemuxer *demux;
|
||||||
WebPIterator iter;
|
WebPIterator iter;
|
||||||
|
@ -315,8 +314,6 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
unsigned int delay;
|
unsigned int delay;
|
||||||
bool err = false;
|
bool err = false;
|
||||||
|
|
||||||
data.bytes = NULL;
|
|
||||||
|
|
||||||
if ((err = (webp_file = fopen(file->path, "rb")) == NULL)) {
|
if ((err = (webp_file = fopen(file->path, "rb")) == NULL)) {
|
||||||
error(0, 0, "%s: Error opening webp image", file->name);
|
error(0, 0, "%s: Error opening webp image", file->name);
|
||||||
goto fail;
|
goto fail;
|
||||||
|
@ -324,11 +321,12 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
fseek(webp_file, 0L, SEEK_END);
|
fseek(webp_file, 0L, SEEK_END);
|
||||||
data.size = ftell(webp_file);
|
data.size = ftell(webp_file);
|
||||||
rewind(webp_file);
|
rewind(webp_file);
|
||||||
data.bytes = emalloc(data.size);
|
bytes = emalloc(data.size);
|
||||||
if ((err = fread((unsigned char *)data.bytes, 1, data.size, webp_file) != data.size)) {
|
if ((err = fread(bytes, 1, data.size, webp_file) != data.size)) {
|
||||||
error(0, 0, "%s: Error reading webp image", file->name);
|
error(0, 0, "%s: Error reading webp image", file->name);
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
data.bytes = bytes;
|
||||||
|
|
||||||
/* Setup the WebP Animation Decoder */
|
/* Setup the WebP Animation Decoder */
|
||||||
if ((err = !WebPAnimDecoderOptionsInit(&opts))) {
|
if ((err = !WebPAnimDecoderOptionsInit(&opts))) {
|
||||||
|
@ -391,7 +389,7 @@ static bool img_load_webp(img_t *img, const fileinfo_t *file)
|
||||||
fail:
|
fail:
|
||||||
if (dec != NULL)
|
if (dec != NULL)
|
||||||
WebPAnimDecoderDelete(dec);
|
WebPAnimDecoderDelete(dec);
|
||||||
free((unsigned char *)data.bytes);
|
free(bytes);
|
||||||
return !err;
|
return !err;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_LIBWEBP */
|
#endif /* HAVE_LIBWEBP */
|
||||||
|
|
Loading…
Reference in a new issue