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

@@ -683,7 +683,7 @@ EnumKeyboards(DFBInputDeviceID device_id,
#endif
devdata->keyboard[devdata->num_keyboard].id = device_id;
devdata->keyboard[devdata->num_keyboard].is_generic = 0;
if (!strncmp("X11", desc.name, 3))
if (!SDL_strncmp("X11", desc.name, 3))
{
devdata->keyboard[devdata->num_keyboard].map = xfree86_scancode_table2;
devdata->keyboard[devdata->num_keyboard].map_size = SDL_arraysize(xfree86_scancode_table2);

View File

@@ -164,7 +164,7 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
p = surface->pixels;
for (i = 0; i < surface->h; i++)
memcpy((char *) dest + i * pitch,
SDL_memcpy((char *) dest + i * pitch,
(char *) p + i * surface->pitch, 4 * surface->w);
curdata->surf->Unlock(curdata->surf);

View File

@@ -201,7 +201,7 @@ static int readBoolEnv(const char *env_name, int def_val)
stemp = SDL_getenv(env_name);
if (stemp)
return atoi(stemp);
return SDL_atoi(stemp);
else
return def_val;
}

View File

@@ -227,7 +227,7 @@ DirectFB_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon)
p = surface->pixels;
for (i = 0; i < surface->h; i++)
memcpy((char *) dest + i * pitch,
SDL_memcpy((char *) dest + i * pitch,
(char *) p + i * surface->pitch, 4 * surface->w);
SDL_DFB_CHECK(windata->icon->Unlock(windata->icon));

View File

@@ -119,7 +119,7 @@ int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rec
// }
// the following code is faster though, because
// .set() is almost free - easily 10x faster due to
// native memcpy efficiencies, and the remaining loop
// native SDL_memcpy efficiencies, and the remaining loop
// just stores, not load + store, so it is faster
data32.set(HEAP32.subarray(src, src + num));
var data8 = SDL2.data8;

View File

@@ -193,7 +193,7 @@ class SDL_BWin:public BDirectWindow
if (_clips == NULL)
_clips = (clipping_rect *)malloc(_num_clips*sizeof(clipping_rect));
if(_clips) {
memcpy(_clips, info->clip_list,
SDL_memcpy(_clips, info->clip_list,
_num_clips*sizeof(clipping_rect));
_bits = (uint8*) info->bits;

View File

@@ -74,7 +74,7 @@ int VITA_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, vo
&data->buffer_uid
);
// memset the buffer to black
// SDL_memset the buffer to black
SDL_memset(data->buffer, 0x0, SCREEN_W*SCREEN_H*4);
SDL_memset(&framebuf, 0x00, sizeof(SceDisplayFrameBuf));

View File

@@ -90,7 +90,7 @@ VITA_PollTouch(void)
if (Vita_Window == NULL)
return;
memcpy(touch_old, touch, sizeof(touch_old));
SDL_memcpy(touch_old, touch, sizeof(touch_old));
for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
/** Skip polling of Touch Device if environment variable is set **/

View File

@@ -601,7 +601,7 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
d->idle_inhibit_manager = wl_registry_bind(d->registry, id, &zwp_idle_inhibit_manager_v1_interface, 1);
} else if (SDL_strcmp(interface, "xdg_activation_v1") == 0) {
d->activation_manager = wl_registry_bind(d->registry, id, &xdg_activation_v1_interface, 1);
} else if (strcmp(interface, "zwp_text_input_manager_v3") == 0) {
} else if (SDL_strcmp(interface, "zwp_text_input_manager_v3") == 0) {
Wayland_add_text_input_manager(d, id, version);
} else if (SDL_strcmp(interface, "wl_data_device_manager") == 0) {
Wayland_add_data_device_manager(d, id, version);

View File

@@ -270,19 +270,19 @@ static char* X11_URIToLocal(char* uri) {
char *file = NULL;
SDL_bool local;
if (memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */
if (SDL_memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
else if (SDL_strstr(uri,":/") != NULL) return file; /* wrong scheme */
local = uri[0] != '/' || (uri[0] != '\0' && uri[1] == '/');
/* got a hostname? */
if (!local && uri[0] == '/' && uri[2] != '/') {
char* hostname_end = strchr(uri+1, '/');
char* hostname_end = SDL_strchr(uri+1, '/');
if (hostname_end != NULL) {
char hostname[ 257 ];
if (gethostname(hostname, 255) == 0) {
hostname[ 256 ] = '\0';
if (memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) {
if (SDL_memcmp(uri+1, hostname, hostname_end - (uri+1)) == 0) {
uri = hostname_end + 1;
local = SDL_TRUE;
}
@@ -1186,7 +1186,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
/* reply with status */
memset(&m, 0, sizeof(XClientMessageEvent));
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
m.type = ClientMessage;
m.display = xevent->xclient.display;
m.window = xevent->xclient.data.l[0];
@@ -1204,7 +1204,7 @@ X11_DispatchEvent(_THIS, XEvent *xevent)
else if(xevent->xclient.message_type == videodata->XdndDrop) {
if (data->xdnd_req == None) {
/* say again - not interested! */
memset(&m, 0, sizeof(XClientMessageEvent));
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
m.type = ClientMessage;
m.display = xevent->xclient.display;
m.window = xevent->xclient.data.l[0];
@@ -1583,7 +1583,7 @@ X11_SendWakeupEvent(_THIS, SDL_Window *window)
Window xwindow = ((SDL_WindowData *) window->driverdata)->xwindow;
XClientMessageEvent event;
memset(&event, 0, sizeof(XClientMessageEvent));
SDL_memset(&event, 0, sizeof(XClientMessageEvent));
event.type = ClientMessage;
event.display = req_display;
event.send_event = True;

View File

@@ -358,7 +358,7 @@ GetXftDPI(Display* dpy)
}
/*
* It's possible for SDL_atoi to call strtol, if it fails due to a
* It's possible for SDL_atoi to call SDL_strtol, if it fails due to a
* overflow or an underflow, it will return LONG_MAX or LONG_MIN and set
* errno to ERANGE. So we need to check for this so we dont get crazy dpi
* values

View File

@@ -71,7 +71,7 @@ X11_ResizeWindowShape(SDL_Window* window) {
return SDL_SetError("Could not allocate memory for shaped-window bitmap.");
}
}
memset(data->bitmap,0,data->bitmapsize);
SDL_memset(data->bitmap,0,data->bitmapsize);
window->shaper->userx = window->x;
window->shaper->usery = window->y;

View File

@@ -737,9 +737,9 @@ X11_SetWindowTitle(_THIS, SDL_Window * window)
Atom _NET_WM_NAME = data->videodata->_NET_WM_NAME;
Atom WM_NAME = data->videodata->WM_NAME;
X11_XChangeProperty(display, data->xwindow, WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, strlen(title));
X11_XChangeProperty(display, data->xwindow, WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, SDL_strlen(title));
status = X11_XChangeProperty(display, data->xwindow, _NET_WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, strlen(title));
status = X11_XChangeProperty(display, data->xwindow, _NET_WM_NAME, UTF8_STRING, 8, 0, (const unsigned char *) title, SDL_strlen(title));
if (status != 1) {
char *x11_error = NULL;

View File

@@ -50,7 +50,7 @@ get_bits (int in, int begin, int end)
static int
decode_header (const uchar *edid)
{
if (memcmp (edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
if (SDL_memcmp (edid, "\x00\xff\xff\xff\xff\xff\xff\x00", 8) == 0)
return TRUE;
return FALSE;
}