use SDL's functions version inplace of libc version

This commit is contained in:
Sylvain
2021-11-21 22:30:48 +01:00
committed by Sam Lantinga
parent 35b7ce1893
commit d31251b014
46 changed files with 114 additions and 124 deletions

View File

@@ -14,10 +14,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
/*
* includes
*/
#include <stdlib.h>
#include <string.h> /* strstr */
#include <ctype.h> /* isdigit */
#include "SDL.h"
#ifndef SDL_HAPTIC_DISABLED
@@ -55,7 +51,7 @@ main(int argc, char **argv)
index = -1;
if (argc > 1) {
name = argv[1];
if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) {
if ((SDL_strcmp(name, "--help") == 0) || (SDL_strcmp(name, "-h") == 0)) {
SDL_Log("USAGE: %s [device]\n"
"If device is a two-digit number it'll use it as an index, otherwise\n"
"it'll use it as if it were part of the device's name.\n",
@@ -63,9 +59,9 @@ main(int argc, char **argv)
return 0;
}
i = strlen(name);
if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) {
index = atoi(name);
i = SDL_strlen(name);
if ((i < 3) && SDL_isdigit(name[0]) && ((i == 1) || SDL_isdigit(name[1]))) {
index = SDL_atoi(name);
name = NULL;
}
}
@@ -82,7 +78,7 @@ main(int argc, char **argv)
/* Try to find matching device */
else {
for (i = 0; i < SDL_NumHaptics(); i++) {
if (strstr(SDL_HapticName(i), name) != NULL)
if (SDL_strstr(SDL_HapticName(i), name) != NULL)
break;
}
@@ -110,7 +106,7 @@ main(int argc, char **argv)
SDL_ClearError();
/* Create effects. */
memset(&efx, 0, sizeof(efx));
SDL_memset(&efx, 0, sizeof(efx));
nefx = 0;
supported = SDL_HapticQuery(haptic);