Browse Source

use of SDL functions

Sylvain 1 year ago
parent
commit
95727b5c7d

+ 3 - 3
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--;

+ 1 - 1
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);
 

+ 3 - 3
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);
             }
 

+ 1 - 1
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;
             }

+ 2 - 2
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);