IMG_xcf.c
changeset 117 e613cf987897
parent 98 9f94c4674cc9
child 118 c5e736a47ad2
     1.1 --- a/IMG_xcf.c	Sat Feb 04 04:53:36 2006 +0000
     1.2 +++ b/IMG_xcf.c	Sat Feb 04 20:37:17 2006 +0000
     1.3 @@ -209,18 +209,21 @@
     1.4  
     1.5  
     1.6  /* See if an image is contained in a data source */
     1.7 -int IMG_isXCF(SDL_RWops *src) {
     1.8 -  int is_XCF;
     1.9 -  char magic[14];
    1.10 +int IMG_isXCF(SDL_RWops *src)
    1.11 +{
    1.12 +	int start;
    1.13 +	int is_XCF;
    1.14 +	char magic[14];
    1.15  
    1.16 -  is_XCF = 0;
    1.17 -  if ( SDL_RWread(src, magic, 14, 1) ) {
    1.18 -    if (strncmp(magic, "gimp xcf ", 9) == 0) {
    1.19 -      is_XCF = 1;
    1.20 -    }
    1.21 -  }
    1.22 -
    1.23 -  return(is_XCF);
    1.24 +	start = SDL_RWtell(src);
    1.25 +	is_XCF = 0;
    1.26 +	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
    1.27 +		if (strncmp(magic, "gimp xcf ", 9) == 0) {
    1.28 +			is_XCF = 1;
    1.29 +		}
    1.30 +	}
    1.31 +	SDL_RWseek(src, start, SEEK_SET);
    1.32 +	return(is_XCF);
    1.33  }
    1.34  
    1.35  static char * read_string (SDL_RWops * src) {