IMG_xpm.c
changeset 117 e613cf987897
parent 98 9f94c4674cc9
child 118 c5e736a47ad2
     1.1 --- a/IMG_xpm.c	Sat Feb 04 04:53:36 2006 +0000
     1.2 +++ b/IMG_xpm.c	Sat Feb 04 20:37:17 2006 +0000
     1.3 @@ -57,10 +57,19 @@
     1.4  /* See if an image is contained in a data source */
     1.5  int IMG_isXPM(SDL_RWops *src)
     1.6  {
     1.7 +	int start;
     1.8 +	int is_XPM;
     1.9  	char magic[9];
    1.10  
    1.11 -	return (SDL_RWread(src, magic, sizeof(magic), 1)
    1.12 -		&& memcmp(magic, "/* XPM */", 9) == 0);
    1.13 +	start = SDL_RWtell(src);
    1.14 +	is_XPM = 0;
    1.15 +	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
    1.16 +		if ( memcmp(magic, "/* XPM */", sizeof(magic)) == 0 ) {
    1.17 +			is_XPM = 1;
    1.18 +		}
    1.19 +	}
    1.20 +	SDL_RWseek(src, start, SEEK_SET);
    1.21 +	return(is_XPM);
    1.22  }
    1.23  
    1.24  /* Hash table to look up colors from pixel strings */