IMG_xcf.c
changeset 117 e613cf987897
parent 98 9f94c4674cc9
child 118 c5e736a47ad2
equal deleted inserted replaced
116:df32aeaf0b10 117:e613cf987897
   207 
   207 
   208 typedef unsigned char * (* load_tile_type) (SDL_RWops *, Uint32, int, int, int);
   208 typedef unsigned char * (* load_tile_type) (SDL_RWops *, Uint32, int, int, int);
   209 
   209 
   210 
   210 
   211 /* See if an image is contained in a data source */
   211 /* See if an image is contained in a data source */
   212 int IMG_isXCF(SDL_RWops *src) {
   212 int IMG_isXCF(SDL_RWops *src)
   213   int is_XCF;
   213 {
   214   char magic[14];
   214 	int start;
   215 
   215 	int is_XCF;
   216   is_XCF = 0;
   216 	char magic[14];
   217   if ( SDL_RWread(src, magic, 14, 1) ) {
   217 
   218     if (strncmp(magic, "gimp xcf ", 9) == 0) {
   218 	start = SDL_RWtell(src);
   219       is_XCF = 1;
   219 	is_XCF = 0;
   220     }
   220 	if ( SDL_RWread(src, magic, sizeof(magic), 1) ) {
   221   }
   221 		if (strncmp(magic, "gimp xcf ", 9) == 0) {
   222 
   222 			is_XCF = 1;
   223   return(is_XCF);
   223 		}
       
   224 	}
       
   225 	SDL_RWseek(src, start, SEEK_SET);
       
   226 	return(is_XCF);
   224 }
   227 }
   225 
   228 
   226 static char * read_string (SDL_RWops * src) {
   229 static char * read_string (SDL_RWops * src) {
   227   Uint32 tmp;
   230   Uint32 tmp;
   228   char * data;
   231   char * data;