src/file/SDL_rwops.c
changeset 1330 450721ad5436
parent 1312 c9b51268668f
child 1336 3692456e7b0f
     1.1 --- a/src/file/SDL_rwops.c	Sat Feb 04 22:01:44 2006 +0000
     1.2 +++ b/src/file/SDL_rwops.c	Mon Feb 06 08:28:51 2006 +0000
     1.3 @@ -24,12 +24,12 @@
     1.4     data sources.  It can easily be extended to files, memory, etc.
     1.5  */
     1.6  
     1.7 -#include <stdlib.h>
     1.8 -#include <stdio.h>
     1.9 -#include <string.h>
    1.10 -
    1.11  #include "SDL_error.h"
    1.12  #include "SDL_rwops.h"
    1.13 +#include "SDL_stdlib.h"
    1.14 +#include "SDL_string.h"
    1.15 +
    1.16 +#ifdef HAVE_STDIO_H
    1.17  
    1.18  /* Functions to read/write stdio file pointers */
    1.19  
    1.20 @@ -74,6 +74,8 @@
    1.21  	return(0);
    1.22  }
    1.23  
    1.24 +#endif /* HAVE_STDIO_H */
    1.25 +
    1.26  /* Functions to read/write memory pointers */
    1.27  
    1.28  static int mem_seek(SDL_RWops *context, int offset, int whence)
    1.29 @@ -81,13 +83,13 @@
    1.30  	Uint8 *newpos;
    1.31  
    1.32  	switch (whence) {
    1.33 -		case SEEK_SET:
    1.34 +		case RW_SEEK_SET:
    1.35  			newpos = context->hidden.mem.base+offset;
    1.36  			break;
    1.37 -		case SEEK_CUR:
    1.38 +		case RW_SEEK_CUR:
    1.39  			newpos = context->hidden.mem.here+offset;
    1.40  			break;
    1.41 -		case SEEK_END:
    1.42 +		case RW_SEEK_END:
    1.43  			newpos = context->hidden.mem.stop+offset;
    1.44  			break;
    1.45  		default:
    1.46 @@ -199,10 +201,9 @@
    1.47  
    1.48  SDL_RWops *SDL_RWFromFile(const char *file, const char *mode)
    1.49  {
    1.50 +	SDL_RWops *rwops = NULL;
    1.51 +#ifdef HAVE_STDIO_H
    1.52  	FILE *fp;
    1.53 -	SDL_RWops *rwops;
    1.54 -
    1.55 -	rwops = NULL;
    1.56  
    1.57  #ifdef macintosh
    1.58  	{
    1.59 @@ -224,12 +225,14 @@
    1.60  		rwops = SDL_RWFromFP(fp, 1);
    1.61  #endif
    1.62  	}
    1.63 +#endif /* HAVE_STDIO_H */
    1.64  	return(rwops);
    1.65  }
    1.66  
    1.67 +#ifdef HAVE_STDIO_H
    1.68  SDL_RWops *SDL_RWFromFP(FILE *fp, int autoclose)
    1.69  {
    1.70 -	SDL_RWops *rwops;
    1.71 +	SDL_RWops *rwops = NULL;
    1.72  
    1.73  #ifdef WIN32
    1.74  	if ( ! in_sdl ) {
    1.75 @@ -249,6 +252,7 @@
    1.76  	}
    1.77  	return(rwops);
    1.78  }
    1.79 +#endif /* HAVE_STDIO_H */
    1.80  
    1.81  SDL_RWops *SDL_RWFromMem(void *mem, int size)
    1.82  {