From 76f28ea120eb6efe2d95bea39b91045679d0df04 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Wed, 25 Sep 2024 21:56:16 +0200
Subject: [PATCH] Fix stdlib usage
---
src/camera/pipewire/SDL_camera_pipewire.c | 10 +++++-----
src/core/android/SDL_android.c | 2 +-
src/video/cocoa/SDL_cocoawindow.m | 2 +-
src/video/haiku/SDL_bmodes.cc | 4 ++--
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/camera/pipewire/SDL_camera_pipewire.c b/src/camera/pipewire/SDL_camera_pipewire.c
index c1c7a8e11fe60..2631e640d4780 100644
--- a/src/camera/pipewire/SDL_camera_pipewire.c
+++ b/src/camera/pipewire/SDL_camera_pipewire.c
@@ -283,7 +283,7 @@ static uint32_t param_clear(struct spa_list *param_list, uint32_t id)
spa_list_for_each_safe(p, t, param_list, link) {
if (id == SPA_ID_INVALID || p->id == id) {
spa_list_remove(&p->link);
- free(p);
+ free(p); // This should NOT be SDL_free()
count++;
}
}
@@ -317,7 +317,7 @@ static struct param *param_add(struct spa_list *params,
p->seq = seq;
if (param != NULL) {
p->param = SPA_PTROFF(p, sizeof(*p), struct spa_pod);
- memcpy(p->param, param, SPA_POD_SIZE(param));
+ SDL_memcpy(p->param, param, SPA_POD_SIZE(param));
} else {
param_clear(params, id);
p->param = NULL;
@@ -339,7 +339,7 @@ static void param_update(struct spa_list *param_list, struct spa_list *pending_l
p->seq != SPA_PARAMS_INFO_SEQ(params[i]) &&
p->param != NULL) {
spa_list_remove(&p->link);
- free(p);
+ free(p); // This should NOT be SDL_free()
}
}
}
@@ -347,7 +347,7 @@ static void param_update(struct spa_list *param_list, struct spa_list *pending_l
spa_list_remove(&p->link);
if (p->param == NULL) {
param_clear(param_list, p->id);
- free(p);
+ free(p); // This should NOT be SDL_free()
} else {
spa_list_append(param_list, &p->link);
}
@@ -840,7 +840,7 @@ static void proxy_destroy(void *data)
}
param_clear(&g->param_list, SPA_ID_INVALID);
param_clear(&g->pending_list, SPA_ID_INVALID);
- free(g->name);
+ free(g->name); // This should NOT be SDL_free()
}
static const struct pw_proxy_events proxy_events = {
diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c
index 75555371db8d3..abf0a016f2d03 100644
--- a/src/core/android/SDL_android.c
+++ b/src/core/android/SDL_android.c
@@ -1526,7 +1526,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)(
// This is only called at startup, to initialize the environment
// Note that we call setenv() directly to avoid affecting SDL environments
- setenv(utfname, utfvalue, 1);
+ setenv(utfname, utfvalue, 1); // This should NOT be SDL_setenv()
(*env)->ReleaseStringUTFChars(env, name, utfname);
(*env)->ReleaseStringUTFChars(env, value, utfvalue);
diff --git a/src/video/cocoa/SDL_cocoawindow.m b/src/video/cocoa/SDL_cocoawindow.m
index f41f532e20fb2..d70c681c88cdf 100644
--- a/src/video/cocoa/SDL_cocoawindow.m
+++ b/src/video/cocoa/SDL_cocoawindow.m
@@ -300,7 +300,7 @@ - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender
". [SDL] In performDragOperation, desiredType '%s', "
"Submitting DropText as (%lu) '%s'\n",
[[desiredType description] UTF8String],
- strlen(token), token);
+ SDL_strlen(token), token);
if (!SDL_SendDropText(sdlwindow, token)) {
SDL_free(buffer);
return NO;
diff --git a/src/video/haiku/SDL_bmodes.cc b/src/video/haiku/SDL_bmodes.cc
index 871df88381072..f479edd2349fc 100644
--- a/src/video/haiku/SDL_bmodes.cc
+++ b/src/video/haiku/SDL_bmodes.cc
@@ -255,7 +255,7 @@ bool HAIKU_GetDisplayModes(SDL_VideoDevice *_this, SDL_VideoDisplay *display)
SDL_AddFullscreenDisplayMode(display, &mode);
}
}
- free(bmodes); // This should not be SDL_free()
+ free(bmodes); // This should NOT be SDL_free()
return true;
}
@@ -289,7 +289,7 @@ bool HAIKU_SetDisplayMode(SDL_VideoDevice *_this, SDL_VideoDisplay *display, SDL
return SDL_SetError("Bad video mode");
}
- free(bmode_list); // This should not be SDL_free()
+ free(bmode_list); // This should NOT be SDL_free()
#ifdef SDL_VIDEO_OPENGL
/* FIXME: Is there some way to reboot the OpenGL context? This doesn't