aboutsummaryrefslogtreecommitdiffstats
path: root/src/gif.c
diff options
context:
space:
mode:
authorJohn Hawthorn <jhawthor@uvic.ca>2008-06-22 01:34:45 -0700
committerJohn Hawthorn <jhawthor@uvic.ca>2008-06-22 01:34:45 -0700
commit292cf3ee0494b14e6f82df755ae02b2f078afc35 (patch)
tree624dd892b6d44e85131a5a192eb3093ebc1e0428 /src/gif.c
parent12fe3f62f2931f296beb130840c091542647319b (diff)
downloadmirror-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.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gif.c b/src/gif.c
index 78400f2..977e8df 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -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;