IMG_pnm.c
changeset 98 9f94c4674cc9
parent 97 e1161bd417c4
child 117 e613cf987897
equal deleted inserted replaced
97:e1161bd417c4 98:9f94c4674cc9
   105 	Uint8 magic[2];
   105 	Uint8 magic[2];
   106 	int ascii;
   106 	int ascii;
   107 	enum { PBM, PGM, PPM } kind;
   107 	enum { PBM, PGM, PPM } kind;
   108 
   108 
   109 #define ERROR(s) do { error = (s); goto done; } while(0)
   109 #define ERROR(s) do { error = (s); goto done; } while(0)
       
   110 
       
   111 	if ( !src ) {
       
   112 		/* The error message has been set in SDL_RWFromFile */
       
   113 		return NULL;
       
   114 	}
   110 
   115 
   111 	SDL_RWread(src, magic, 2, 1);
   116 	SDL_RWread(src, magic, 2, 1);
   112 	kind = magic[1] - '1';
   117 	kind = magic[1] - '1';
   113 	ascii = 1;
   118 	ascii = 1;
   114 	if(kind >= 3) {
   119 	if(kind >= 3) {