From 95727b5c7de2d6af97cd1793340c1864bcad874f Mon Sep 17 00:00:00 2001 From: Sylvain Date: Sun, 25 Jun 2023 22:46:54 +0200 Subject: [PATCH] use of SDL functions --- src/audio/coreaudio/SDL_coreaudio.m | 6 +++--- src/audio/n3ds/SDL_n3dsaudio.c | 2 +- src/filesystem/ps2/SDL_sysfilesystem.c | 6 +++--- src/video/cocoa/SDL_cocoaclipboard.m | 2 +- src/video/cocoa/SDL_cocoawindow.m | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/audio/coreaudio/SDL_coreaudio.m b/src/audio/coreaudio/SDL_coreaudio.m index 1628c2c49f..08af17c41e 100644 --- a/src/audio/coreaudio/SDL_coreaudio.m +++ b/src/audio/coreaudio/SDL_coreaudio.m @@ -190,7 +190,7 @@ static void build_device_list(int iscapture, addDevFn addfn, void *addfndata) CFRelease(cfstr); if (usable) { - len = strlen(ptr); + len = SDL_strlen(ptr); /* Some devices have whitespace at the end...trim it. */ while ((len > 0) && (ptr[len - 1] == ' ')) { len--; @@ -894,7 +894,7 @@ static int prepare_audioqueue(SDL_AudioDevice *_this) /* Make sure we can feed the device a minimum amount of time */ MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; #ifdef __IOS__ - if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { + if (SDL_floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { /* Older iOS hardware, use 40 ms as a minimum time */ MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; } @@ -1213,7 +1213,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i if (usable) { usable = 0; - len = strlen(devname); + len = SDL_strlen(devname); /* Some devices have whitespace at the end...trim it. */ while ((len > 0) && (devname[len - 1] == ' ')) { len--; diff --git a/src/audio/n3ds/SDL_n3dsaudio.c b/src/audio/n3ds/SDL_n3dsaudio.c index 3c484996e6..254bca0198 100644 --- a/src/audio/n3ds/SDL_n3dsaudio.c +++ b/src/audio/n3ds/SDL_n3dsaudio.c @@ -207,7 +207,7 @@ static void N3DSAUDIO_PlayDevice(SDL_AudioDevice *_this) contextUnlock(_this); - memcpy((void *)_this->hidden->waveBuf[nextbuf].data_vaddr, + SDL_memcpy((void *)_this->hidden->waveBuf[nextbuf].data_vaddr, _this->hidden->mixbuf, sampleLen); DSP_FlushDataCache(_this->hidden->waveBuf[nextbuf].data_vaddr, sampleLen); diff --git a/src/filesystem/ps2/SDL_sysfilesystem.c b/src/filesystem/ps2/SDL_sysfilesystem.c index e0167ddec0..92e87a4d07 100644 --- a/src/filesystem/ps2/SDL_sysfilesystem.c +++ b/src/filesystem/ps2/SDL_sysfilesystem.c @@ -52,8 +52,8 @@ static void recursive_mkdir(const char *dir) char *p = NULL; size_t len; - snprintf(tmp, sizeof(tmp), "%s", dir); - len = strlen(tmp); + SDL_snprintf(tmp, sizeof(tmp), "%s", dir); + len = SDL_strlen(tmp); if (tmp[len - 1] == '/') { tmp[len - 1] = 0; } @@ -62,7 +62,7 @@ static void recursive_mkdir(const char *dir) if (*p == '/') { *p = 0; // Just creating subfolders from current path - if (strstr(tmp, base) != NULL) { + if (SDL_strstr(tmp, base) != NULL) { mkdir(tmp, S_IRWXU); } diff --git a/src/video/cocoa/SDL_cocoaclipboard.m b/src/video/cocoa/SDL_cocoaclipboard.m index 5926e6fa1b..f2b295fc3a 100644 --- a/src/video/cocoa/SDL_cocoaclipboard.m +++ b/src/video/cocoa/SDL_cocoaclipboard.m @@ -164,7 +164,7 @@ void *Cocoa_GetClipboardData(SDL_VideoDevice *_this, size_t *len, const char *mi CFRelease(utiType); if (itemData != nil) { *len = (size_t)[itemData length]; - data = malloc(*len); + data = SDL_malloc(*len); [itemData getBytes: data length: *len]; return data; } diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m index fa6db64d02..7abd873f95 100644 --- a/src/video/cocoa/SDL_cocoawindow.m +++ b/src/video/cocoa/SDL_cocoawindow.m @@ -2201,7 +2201,7 @@ void Cocoa_RaiseWindow(SDL_VideoDevice *_this, SDL_Window *window) NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow; [nsparent addChildWindow:nswindow ordered:NSWindowAbove]; } - + if (bActivate) { [nswindow makeKeyAndOrderFront:nil]; } else { @@ -2323,7 +2323,7 @@ void Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_V /* Hack to fix origin on macOS 10.4 This is no longer needed as of macOS 10.15, according to bug 4822. */ - if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14) { + if (SDL_floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_14) { NSRect screenRect = [[nswindow screen] frame]; if (screenRect.size.height >= 1.0f) { rect.origin.y += (screenRect.size.height - rect.size.height);