src/file/SDL_rwops.c
changeset 5582 1281a3f1f0a6
parent 5535 96594ac5fd1a
child 6138 4c64952a58fb
equal deleted inserted replaced
5581:f40f9d3ca2bc 5582:1281a3f1f0a6
    28 #include "SDL_rwops.h"
    28 #include "SDL_rwops.h"
    29 
    29 
    30 #ifdef __APPLE__
    30 #ifdef __APPLE__
    31 #include "cocoa/SDL_rwopsbundlesupport.h"
    31 #include "cocoa/SDL_rwopsbundlesupport.h"
    32 #endif /* __APPLE__ */
    32 #endif /* __APPLE__ */
       
    33 
       
    34 #ifdef ANDROID
       
    35 #include "../core/android/SDL_android.h"
       
    36 #endif
    33 
    37 
    34 #ifdef __NDS__
    38 #ifdef __NDS__
    35 /* include libfat headers for fatInitDefault(). */
    39 /* include libfat headers for fatInitDefault(). */
    36 #include <fat.h>
    40 #include <fat.h>
    37 #endif /* __NDS__ */
    41 #endif /* __NDS__ */
   439 #endif
   443 #endif
   440     if (!file || !*file || !mode || !*mode) {
   444     if (!file || !*file || !mode || !*mode) {
   441         SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
   445         SDL_SetError("SDL_RWFromFile(): No file or no mode specified");
   442         return NULL;
   446         return NULL;
   443     }
   447     }
   444 #if defined(__WIN32__)
   448 #if defined(ANDROID)
       
   449     rwops = SDL_AllocRW();
       
   450     if (!rwops)
       
   451         return NULL;            /* SDL_SetError already setup by SDL_AllocRW() */
       
   452     if (Android_JNI_FileOpen(rwops, file, mode) < 0) {
       
   453         SDL_FreeRW(rwops);
       
   454         return NULL;
       
   455     }
       
   456     rwops->seek = Android_JNI_FileSeek;
       
   457     rwops->read = Android_JNI_FileRead;
       
   458     rwops->write = Android_JNI_FileWrite;
       
   459     rwops->close = Android_JNI_FileClose;
       
   460 
       
   461 #elif defined(__WIN32__)
   445     rwops = SDL_AllocRW();
   462     rwops = SDL_AllocRW();
   446     if (!rwops)
   463     if (!rwops)
   447         return NULL;            /* SDL_SetError already setup by SDL_AllocRW() */
   464         return NULL;            /* SDL_SetError already setup by SDL_AllocRW() */
   448     if (windows_file_open(rwops, file, mode) < 0) {
   465     if (windows_file_open(rwops, file, mode) < 0) {
   449         SDL_FreeRW(rwops);
   466         SDL_FreeRW(rwops);