mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-14 22:05:59 +00:00
rwops: Reworked RWops for SDL3.
- SDL_RWops is now an opaque struct. - SDL_AllocRW is gone. If an app is creating a custom RWops, they pass the function pointers to SDL_CreateRW(), which are stored internally. - SDL_RWclose is gone, there is only SDL_DestroyRW(), which calls the implementation's `->close` method before freeing other things. - There is only one path to create and use RWops now, so we don't have to worry about whether `->close` will call SDL_DestroyRW, or if this will risk any Properties not being released, etc. - SDL_RWFrom* still works as expected, for getting a RWops without having to supply your own implementation. Objects from these functions are also destroyed with SDL_DestroyRW. - Lots of other cleanup and SDL3ization of the library code.
This commit is contained in:
@@ -68,7 +68,7 @@ static int DISKAUDIO_CaptureFromDevice(SDL_AudioDevice *device, void *buffer, in
|
||||
buflen -= br;
|
||||
buffer = ((Uint8 *)buffer) + br;
|
||||
if (buflen > 0) { // EOF (or error, but whatever).
|
||||
SDL_RWclose(h->io);
|
||||
SDL_DestroyRW(h->io);
|
||||
h->io = NULL;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ static void DISKAUDIO_CloseDevice(SDL_AudioDevice *device)
|
||||
{
|
||||
if (device->hidden) {
|
||||
if (device->hidden->io) {
|
||||
SDL_RWclose(device->hidden->io);
|
||||
SDL_DestroyRW(device->hidden->io);
|
||||
}
|
||||
SDL_free(device->hidden->mixbuf);
|
||||
SDL_free(device->hidden);
|
||||
|
Reference in New Issue
Block a user