mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 13:15:10 +00:00
use SDL's functions version inplace of libc version
This commit is contained in:
@@ -210,7 +210,7 @@ static int SDLCALL ping_thread(void *ptr)
|
||||
{
|
||||
int cnt;
|
||||
SDL_Event sdlevent;
|
||||
memset(&sdlevent, 0 , sizeof(SDL_Event));
|
||||
SDL_memset(&sdlevent, 0 , sizeof(SDL_Event));
|
||||
for (cnt = 0; cnt < 10; ++cnt) {
|
||||
fprintf(stderr, "sending event (%d/%d) from thread.\n", cnt + 1, 10); fflush(stderr);
|
||||
sdlevent.type = SDL_KEYDOWN;
|
||||
|
||||
@@ -1131,7 +1131,7 @@ sdltest_randomAsciiString(void *arg)
|
||||
SDLTest_AssertCheck(len >= 1 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", (int) len);
|
||||
nonAsciiCharacters = 0;
|
||||
for (i=0; i<len; i++) {
|
||||
if (iscntrl(result[i])) {
|
||||
if (SDL_iscntrl(result[i])) {
|
||||
nonAsciiCharacters++;
|
||||
}
|
||||
}
|
||||
@@ -1169,7 +1169,7 @@ sdltest_randomAsciiStringWithMaximumLength(void *arg)
|
||||
SDLTest_AssertCheck(len >= 1 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", (int) targetLen, (int) len);
|
||||
nonAsciiCharacters = 0;
|
||||
for (i=0; i<len; i++) {
|
||||
if (iscntrl(result[i])) {
|
||||
if (SDL_iscntrl(result[i])) {
|
||||
nonAsciiCharacters++;
|
||||
}
|
||||
}
|
||||
@@ -1223,7 +1223,7 @@ sdltest_randomAsciiStringOfSize(void *arg)
|
||||
SDLTest_AssertCheck(len == targetLen, "Validate that result length; expected: len=%d, got: %d", (int) targetLen, (int) len);
|
||||
nonAsciiCharacters = 0;
|
||||
for (i=0; i<len; i++) {
|
||||
if (iscntrl(result[i])) {
|
||||
if (SDL_iscntrl(result[i])) {
|
||||
nonAsciiCharacters++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -961,11 +961,11 @@ run_test(void)
|
||||
|
||||
printf("%s...\n", t->name);
|
||||
|
||||
memset(&caps, '\0', sizeof(caps));
|
||||
memcpy(caps.ev, t->ev, sizeof(t->ev));
|
||||
memcpy(caps.keys, t->keys, sizeof(t->keys));
|
||||
memcpy(caps.abs, t->abs, sizeof(t->abs));
|
||||
memcpy(caps.rel, t->rel, sizeof(t->rel));
|
||||
SDL_memset(&caps, '\0', sizeof(caps));
|
||||
SDL_memcpy(caps.ev, t->ev, sizeof(t->ev));
|
||||
SDL_memcpy(caps.keys, t->keys, sizeof(t->keys));
|
||||
SDL_memcpy(caps.abs, t->abs, sizeof(t->abs));
|
||||
SDL_memcpy(caps.rel, t->rel, sizeof(t->rel));
|
||||
|
||||
for (j = 0; j < SDL_arraysize(caps.ev); j++) {
|
||||
caps.ev[j] = SwapLongLE(caps.ev[j]);
|
||||
|
||||
@@ -238,10 +238,10 @@ main(int argc, char *argv[])
|
||||
consumed = SDLTest_CommonArg(state, i);
|
||||
if (consumed == 0) {
|
||||
if (SDL_strcasecmp(argv[i], "--fsaa") == 0 && i+1 < argc) {
|
||||
fsaa = atoi(argv[i+1]);
|
||||
fsaa = SDL_atoi(argv[i+1]);
|
||||
consumed = 2;
|
||||
} else if (SDL_strcasecmp(argv[i], "--accel") == 0 && i+1 < argc) {
|
||||
accel = atoi(argv[i+1]);
|
||||
accel = SDL_atoi(argv[i+1]);
|
||||
consumed = 2;
|
||||
} else {
|
||||
consumed = -1;
|
||||
|
||||
@@ -163,8 +163,8 @@ process_shader(GLuint *shader, const char * source, GLint shader_type)
|
||||
}
|
||||
|
||||
/* Notes on a_angle:
|
||||
* It is a vector containing sin and cos for rotation matrix
|
||||
* To get correct rotation for most cases when a_angle is disabled cos
|
||||
* It is a vector containing sine and cosine for rotation matrix
|
||||
* To get correct rotation for most cases when a_angle is disabled SDL_cos
|
||||
value is decremented by 1.0 to get proper output with 0.0 which is
|
||||
default value
|
||||
*/
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -648,12 +648,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
for (argc--, argv++; argc > 0; argc--, argv++)
|
||||
{
|
||||
if (strcmp(argv[0], "--help") == 0) {
|
||||
if (SDL_strcmp(argv[0], "--help") == 0) {
|
||||
usage();
|
||||
return 0;
|
||||
}
|
||||
|
||||
else if (strcmp(argv[0], "--font") == 0)
|
||||
else if (SDL_strcmp(argv[0], "--font") == 0)
|
||||
{
|
||||
argc--;
|
||||
argv++;
|
||||
|
||||
@@ -44,7 +44,7 @@ main(int argc, char *argv[])
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--hello") == 0) {
|
||||
if (SDL_strcmp(argv[1], "--hello") == 0) {
|
||||
hello = 1;
|
||||
libname = argv[2];
|
||||
symname = "puts";
|
||||
|
||||
@@ -25,10 +25,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
|
||||
@@ -56,7 +52,7 @@ main(int argc, char **argv)
|
||||
if (argc > 1) {
|
||||
size_t l;
|
||||
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",
|
||||
@@ -83,7 +79,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ main(int argc, char **argv)
|
||||
signal(SIGTERM, killed);
|
||||
signal(SIGINT, killed);
|
||||
|
||||
init_sem = atoi(argv[1]);
|
||||
init_sem = SDL_atoi(argv[1]);
|
||||
if (init_sem > 0) {
|
||||
TestRealWorld(init_sem);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ main(int argc, char *argv[])
|
||||
/* Start the timer */
|
||||
desired = 0;
|
||||
if (argv[1]) {
|
||||
desired = atoi(argv[1]);
|
||||
desired = SDL_atoi(argv[1]);
|
||||
}
|
||||
if (desired == 0) {
|
||||
desired = DEFAULT_RESOLUTION;
|
||||
|
||||
@@ -31,9 +31,9 @@ static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int mo
|
||||
// This formula is from Microsoft's documentation:
|
||||
// https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx
|
||||
// L = Kr * R + Kb * B + (1 - Kr - Kb) * G
|
||||
// Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5);
|
||||
// U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5));
|
||||
// V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5));
|
||||
// Y = SDL_floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5);
|
||||
// U = clip3(0, (2^M)-1, SDL_floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5));
|
||||
// V = clip3(0, (2^M)-1, SDL_floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5));
|
||||
float S, Z, R, G, B, L, Kr, Kb, Y, U, V;
|
||||
|
||||
if (mode == SDL_YUV_CONVERSION_BT709) {
|
||||
|
||||
Reference in New Issue
Block a user