Browse Source

use of SDL functions

Sylvain 2 years 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);
         CFRelease(cfstr);
 
 
         if (usable) {
         if (usable) {
-            len = strlen(ptr);
+            len = SDL_strlen(ptr);
             /* Some devices have whitespace at the end...trim it. */
             /* Some devices have whitespace at the end...trim it. */
             while ((len > 0) && (ptr[len - 1] == ' ')) {
             while ((len > 0) && (ptr[len - 1] == ' ')) {
                 len--;
                 len--;
@@ -894,7 +894,7 @@ static int prepare_audioqueue(SDL_AudioDevice *_this)
     /* Make sure we can feed the device a minimum amount of time */
     /* Make sure we can feed the device a minimum amount of time */
     MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0;
     MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0;
 #ifdef __IOS__
 #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 */
         /* Older iOS hardware, use 40 ms as a minimum time */
         MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;
         MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0;
     }
     }
@@ -1213,7 +1213,7 @@ static int COREAUDIO_GetDefaultAudioInfo(char **name, SDL_AudioSpec *spec, int i
 
 
         if (usable) {
         if (usable) {
             usable = 0;
             usable = 0;
-            len = strlen(devname);
+            len = SDL_strlen(devname);
             /* Some devices have whitespace at the end...trim it. */
             /* Some devices have whitespace at the end...trim it. */
             while ((len > 0) && (devname[len - 1] == ' ')) {
             while ((len > 0) && (devname[len - 1] == ' ')) {
                 len--;
                 len--;

+ 1 - 1
src/audio/n3ds/SDL_n3dsaudio.c

@@ -207,7 +207,7 @@ static void N3DSAUDIO_PlayDevice(SDL_AudioDevice *_this)
 
 
     contextUnlock(_this);
     contextUnlock(_this);
 
 
-    memcpy((void *)_this->hidden->waveBuf[nextbuf].data_vaddr,
+    SDL_memcpy((void *)_this->hidden->waveBuf[nextbuf].data_vaddr,
            _this->hidden->mixbuf, sampleLen);
            _this->hidden->mixbuf, sampleLen);
     DSP_FlushDataCache(_this->hidden->waveBuf[nextbuf].data_vaddr, 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;
     char *p = NULL;
     size_t len;
     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] == '/') {
     if (tmp[len - 1] == '/') {
         tmp[len - 1] = 0;
         tmp[len - 1] = 0;
     }
     }
@@ -62,7 +62,7 @@ static void recursive_mkdir(const char *dir)
         if (*p == '/') {
         if (*p == '/') {
             *p = 0;
             *p = 0;
             // Just creating subfolders from current path
             // Just creating subfolders from current path
-            if (strstr(tmp, base) != NULL) {
+            if (SDL_strstr(tmp, base) != NULL) {
                 mkdir(tmp, S_IRWXU);
                 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);
             CFRelease(utiType);
             if (itemData != nil) {
             if (itemData != nil) {
                 *len = (size_t)[itemData length];
                 *len = (size_t)[itemData length];
-                data = malloc(*len);
+                data = SDL_malloc(*len);
                 [itemData getBytes: data length: *len];
                 [itemData getBytes: data length: *len];
                 return data;
                 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;
                 NSWindow *nsparent = ((__bridge SDL_CocoaWindowData *)window->parent->driverdata).nswindow;
                 [nsparent addChildWindow:nswindow ordered:NSWindowAbove];
                 [nsparent addChildWindow:nswindow ordered:NSWindowAbove];
             }
             }
-            
+
             if (bActivate) {
             if (bActivate) {
                 [nswindow makeKeyAndOrderFront:nil];
                 [nswindow makeKeyAndOrderFront:nil];
             } else {
             } else {
@@ -2323,7 +2323,7 @@ void Cocoa_SetWindowFullscreen(SDL_VideoDevice *_this, SDL_Window *window, SDL_V
             /* Hack to fix origin on macOS 10.4
             /* Hack to fix origin on macOS 10.4
                This is no longer needed as of macOS 10.15, according to bug 4822.
                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];
                 NSRect screenRect = [[nswindow screen] frame];
                 if (screenRect.size.height >= 1.0f) {
                 if (screenRect.size.height >= 1.0f) {
                     rect.origin.y += (screenRect.size.height - rect.size.height);
                     rect.origin.y += (screenRect.size.height - rect.size.height);