diff options
author | Franz Zotter <fzotter@users.sourceforge.net> | 2010-04-30 12:58:50 +0000 |
---|---|---|
committer | Franz Zotter <fzotter@users.sourceforge.net> | 2010-04-30 12:58:50 +0000 |
commit | 885ef1df48e2528b4a4222a192046af4177f1b93 (patch) | |
tree | 9c0d592c8ad3645ca9ba6c7ddaac268261e0492c | |
parent | 0d632e6b9582c9e5c7d7815a522d2fc0eb4f8e4f (diff) |
[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
-rw-r--r-- | src/iem_image.c | 6 |
1 files 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); }; |