src/file/SDL_rwops.c
changeset 11230 15b10ad902dd
parent 11200 8bcc1cc9ac4c
child 11234 b5cf1e85ffd5
     1.1 --- a/src/file/SDL_rwops.c	Fri Aug 11 20:54:06 2017 -0700
     1.2 +++ b/src/file/SDL_rwops.c	Fri Aug 11 21:16:33 2017 -0700
     1.3 @@ -292,6 +292,23 @@
     1.4  
     1.5  #ifdef HAVE_STDIO_H
     1.6  
     1.7 +#ifdef HAVE_FOPEN64
     1.8 +#define fopen   fopen64
     1.9 +#endif
    1.10 +#ifdef HAVE_FSEEKO64
    1.11 +#define fseek_off_t off64_t
    1.12 +#define fseek   fseeko64
    1.13 +#define ftell   ftello64
    1.14 +#elif defined(HAVE_FSEEKO)
    1.15 +#define fseek_off_t off_t
    1.16 +#define fseek   fseeko
    1.17 +#define ftell   ftello
    1.18 +#elif defined(HAVE__FSEEKI64)
    1.19 +#define fseek_off_t __int64
    1.20 +#define fseek   _fseeki64
    1.21 +#define ftell   _ftelli64
    1.22 +#endif
    1.23 +
    1.24  /* Functions to read/write stdio file pointers */
    1.25  
    1.26  static Sint64 SDLCALL
    1.27 @@ -312,23 +329,9 @@
    1.28  static Sint64 SDLCALL
    1.29  stdio_seek(SDL_RWops * context, Sint64 offset, int whence)
    1.30  {
    1.31 -#ifdef HAVE_FSEEKO64
    1.32 -    if (fseeko64(context->hidden.stdio.fp, (off64_t)offset, whence) == 0) {
    1.33 -        return ftello64(context->hidden.stdio.fp);
    1.34 -    }
    1.35 -#elif defined(HAVE_FSEEKO)
    1.36 -    if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) {
    1.37 -        return ftello(context->hidden.stdio.fp);
    1.38 -    }
    1.39 -#elif defined(HAVE__FSEEKI64)
    1.40 -    if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) {
    1.41 -        return _ftelli64(context->hidden.stdio.fp);
    1.42 -    }
    1.43 -#else
    1.44 -    if (fseek(context->hidden.stdio.fp, offset, whence) == 0) {
    1.45 +    if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) {
    1.46          return ftell(context->hidden.stdio.fp);
    1.47      }
    1.48 -#endif
    1.49      return SDL_Error(SDL_EFSEEK);
    1.50  }
    1.51