From 885ef1df48e2528b4a4222a192046af4177f1b93 Mon Sep 17 00:00:00 2001 From: Franz Zotter Date: Fri, 30 Apr 2010 12:58:50 +0000 Subject: [iem_image] has some problems with fread... fread does not always return the _number_ of successful read items, but sometimes just "1" instead. iem_image then does not recognize gif-files. fixed it. svn path=/trunk/externals/iem/iemgui/; revision=13485 --- src/iem_image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/iem_image.c b/src/iem_image.c index 74a98f4..ac2c652 100644 --- a/src/iem_image.c +++ b/src/iem_image.c @@ -38,6 +38,7 @@ static t_symbol *iem_image_calc_size(t_iem_image *x) char *c; int fd; FILE *fh; + size_t items; if(!x->x_gifsym || !x->x_gifsym->s_name) { @@ -69,8 +70,9 @@ static t_symbol *iem_image_calc_size(t_iem_image *x) } else { - if(fread(buf, 22, sizeof(unsigned char), fh) < 22){ - post("iem_image-ERROR: can not read header in %s ", namebuf); + items=fread(buf, 22, sizeof(unsigned char), fh); + if((items < 1)||(strlen((char*)buf)<7)) { + post("iem_image-ERROR: can not read header in %s, only %d items read: %s.", namebuf, strlen((char*)buf), (char*) buf); x->x_gifsym = (t_symbol *)0; return((t_symbol *)0); }; -- cgit v1.2.1