native_midi/native_midi_macosx.c
changeset 625 1d489d8ec2e0
parent 617 87116a42526e
child 718 fb0562cc1559
     1.1 --- a/native_midi/native_midi_macosx.c	Sat Jun 01 15:49:18 2013 -0700
     1.2 +++ b/native_midi/native_midi_macosx.c	Sat Jun 01 19:52:15 2013 -0700
     1.3 @@ -154,26 +154,26 @@
     1.4      return 1;  /* always available. */
     1.5  }
     1.6  
     1.7 -NativeMidiSong *native_midi_loadsong_RW(SDL_RWops *rw, int freerw)
     1.8 +NativeMidiSong *native_midi_loadsong_RW(SDL_RWops *src, int freesrc)
     1.9  {
    1.10      NativeMidiSong *retval = NULL;
    1.11      void *buf = NULL;
    1.12 -    int len = 0;
    1.13 +    Sint64 len = 0;
    1.14      CFDataRef data = NULL;
    1.15  
    1.16 -    if (SDL_RWseek(rw, 0, RW_SEEK_END) < 0)
    1.17 +    if (SDL_RWseek(src, 0, RW_SEEK_END) < 0)
    1.18          goto fail;
    1.19 -    len = SDL_RWtell(rw);
    1.20 +    len = SDL_RWtell(src);
    1.21      if (len < 0)
    1.22          goto fail;
    1.23 -    if (SDL_RWseek(rw, 0, RW_SEEK_SET) < 0)
    1.24 +    if (SDL_RWseek(src, 0, RW_SEEK_SET) < 0)
    1.25          goto fail;
    1.26  
    1.27      buf = malloc(len);
    1.28      if (buf == NULL)
    1.29          goto fail;
    1.30  
    1.31 -    if (SDL_RWread(rw, buf, len, 1) != 1)
    1.32 +    if (SDL_RWread(src, buf, len, 1) != 1)
    1.33          goto fail;
    1.34  
    1.35      retval = malloc(sizeof(NativeMidiSong));
    1.36 @@ -221,8 +221,8 @@
    1.37      if (MusicPlayerSetSequence(retval->player, retval->sequence) != noErr)
    1.38          goto fail;
    1.39  
    1.40 -    if (freerw)
    1.41 -        SDL_RWclose(rw);
    1.42 +    if (freesrc)
    1.43 +        SDL_RWclose(src);
    1.44  
    1.45      return retval;
    1.46  
    1.47 @@ -241,9 +241,6 @@
    1.48      if (buf)
    1.49          free(buf);
    1.50  
    1.51 -    if (freerw)
    1.52 -        SDL_RWclose(rw);
    1.53 -
    1.54      return NULL;
    1.55  }
    1.56