diff options
author | John Hawthorn <jhawthor@uvic.ca> | 2008-06-22 01:34:45 -0700 |
---|---|---|
committer | John Hawthorn <jhawthor@uvic.ca> | 2008-06-22 01:34:45 -0700 |
commit | 292cf3ee0494b14e6f82df755ae02b2f078afc35 (patch) | |
tree | 624dd892b6d44e85131a5a192eb3093ebc1e0428 /src/gif.c | |
parent | 12fe3f62f2931f296beb130840c091542647319b (diff) | |
download | mirror-meh-292cf3ee0494b14e6f82df755ae02b2f078afc35.tar.gz mirror-meh-292cf3ee0494b14e6f82df755ae02b2f078afc35.tar.bz2 mirror-meh-292cf3ee0494b14e6f82df755ae02b2f078afc35.zip |
cleanup
Diffstat (limited to 'src/gif.c')
-rw-r--r-- | src/gif.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -17,12 +17,25 @@ struct gif_t{ GifFileType *gif; }; +static int isgif(FILE *f){ + return (getc(f) == 'G' && getc(f) == 'I' && getc(f) == 'F'); +} + static struct image *gif_open(FILE *f){ struct gif_t *g; GifFileType *gif; + rewind(f); + if(!isgif(f)) + return NULL; + + /* HACK HACK HACK */ + rewind(f); lseek(fileno(f), 0L, SEEK_SET); if(!(gif = DGifOpenFileHandle(fileno(f)))){ + /* HACK AND HOPE */ + rewind(f); + lseek(fileno(f), 0L, SEEK_SET); return NULL; } g = malloc(sizeof(struct gif_t)); @@ -36,7 +49,7 @@ static struct image *gif_open(FILE *f){ } static int gif_read(struct image *img){ - int i, j = 0; + unsigned int i, j = 0; struct gif_t *g = (struct gif_t *)img; GifColorType *colormap; SavedImage *s; |