Rename SDL_strtokr() to SDL_strtok_r()

Fixes https://github.com/libsdl-org/SDL/issues/7914
main
Sam Lantinga 2023-07-03 06:19:30 -07:00
parent b8d6023a91
commit f010411492
12 changed files with 29 additions and 15 deletions

View File

@ -2685,3 +2685,8 @@ typedef SDL_cond, SDL_Condition;
@@
- SDL_PIXELFORMAT_BGR888
+ SDL_PIXELFORMAT_XBGR8888
@@
@@
- SDL_strtokr
+ SDL_strtok_r
(...)

View File

@ -949,6 +949,9 @@ The standard C headers like stdio.h and stdlib.h are no longer included, you sho
M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_PI_D (double) and SDL_PI_F (float) instead.
The following functions have been renamed:
* SDL_strtokr() => SDL_strtok_r()
## SDL_surface.h
Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat.

View File

@ -438,6 +438,9 @@
#define SDL_SensorOpen SDL_OpenSensor
#define SDL_SensorUpdate SDL_UpdateSensors
/* ##SDL_stdinc.h */
#define SDL_strtokr SDL_strtok_r
/* ##SDL_surface.h */
#define SDL_FillRect SDL_FillSurfaceRect
#define SDL_FillRects SDL_FillSurfaceRects
@ -878,6 +881,9 @@
#define SDL_SensorOpen SDL_SensorOpen_renamed_SDL_OpenSensor
#define SDL_SensorUpdate SDL_SensorUpdate_renamed_SDL_UpdateSensors
/* ##SDL_stdinc.h */
#define SDL_strtokr SDL_strtokr_renamed_SDL_strtok_r
/* ##SDL_surface.h */
#define SDL_FillRect SDL_FillRect_renamed_SDL_FillSurfaceRect
#define SDL_FillRects SDL_FillRects_renamed_SDL_FillSurfaceRects

View File

@ -556,7 +556,7 @@ extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c);
extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle);
extern DECLSPEC char *SDLCALL SDL_strcasestr(const char *haystack, const char *needle);
extern DECLSPEC char *SDLCALL SDL_strtokr(char *s1, const char *s2, char **saveptr);
extern DECLSPEC char *SDLCALL SDL_strtok_r(char *s1, const char *s2, char **saveptr);
extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str);
extern DECLSPEC size_t SDLCALL SDL_utf8strnlen(const char *str, size_t bytes);
@ -733,7 +733,7 @@ size_t wcslcat(wchar_t *dst, const wchar_t *src, size_t size);
#define SDL_strrchr strrchr
#define SDL_strstr strstr
#define SDL_wcsstr wcsstr
#define SDL_strtokr strtok_r
#define SDL_strtok_r strtok_r
#define SDL_strcmp strcmp
#define SDL_wcscmp wcscmp
#define SDL_strncmp strncmp

View File

@ -192,7 +192,7 @@ int SDL_EVDEV_Init(void)
ROM. */
char *rest = (char *)devices;
char *spec;
while ((spec = SDL_strtokr(rest, ",", &rest))) {
while ((spec = SDL_strtok_r(rest, ",", &rest))) {
char *endofcls = 0;
long cls = SDL_strtol(spec, &endofcls, 0);
if (endofcls) {

View File

@ -836,7 +836,7 @@ SDL3_0.0.0 {
SDL_strrev;
SDL_strstr;
SDL_strtod;
SDL_strtokr;
SDL_strtok_r;
SDL_strtol;
SDL_strtoll;
SDL_strtoul;

View File

@ -860,7 +860,7 @@
#define SDL_strrev SDL_strrev_REAL
#define SDL_strstr SDL_strstr_REAL
#define SDL_strtod SDL_strtod_REAL
#define SDL_strtokr SDL_strtokr_REAL
#define SDL_strtok_r SDL_strtok_r_REAL
#define SDL_strtol SDL_strtol_REAL
#define SDL_strtoll SDL_strtoll_REAL
#define SDL_strtoul SDL_strtoul_REAL

View File

@ -906,7 +906,7 @@ SDL_DYNAPI_PROC(char*,SDL_strrchr,(const char *a, int b),(a,b),return)
SDL_DYNAPI_PROC(char*,SDL_strrev,(char *a),(a),return)
SDL_DYNAPI_PROC(char*,SDL_strstr,(const char *a, const char *b),(a,b),return)
SDL_DYNAPI_PROC(double,SDL_strtod,(const char *a, char **b),(a,b),return)
SDL_DYNAPI_PROC(char*,SDL_strtokr,(char *a, const char *b, char **c),(a,b,c),return)
SDL_DYNAPI_PROC(char*,SDL_strtok_r,(char *a, const char *b, char **c),(a,b,c),return)
SDL_DYNAPI_PROC(long,SDL_strtol,(const char *a, char **b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(Sint64,SDL_strtoll,(const char *a, char **b, int c),(a,b,c),return)
SDL_DYNAPI_PROC(unsigned long,SDL_strtoul,(const char *a, char **b, int c),(a,b,c),return)

View File

@ -21,7 +21,7 @@
#include "SDL_internal.h"
char *SDL_strtokr(char *s1, const char *s2, char **ptr)
char *SDL_strtok_r(char *s1, const char *s2, char **ptr)
{
#ifdef HAVE_STRTOK_R
return strtok_r(s1, s2, ptr);

View File

@ -1876,7 +1876,7 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
&length, FILE_MIME, SDL_TRUE);
if (buffer) {
char *saveptr = NULL;
char *token = SDL_strtokr((char *)buffer, "\r\n", &saveptr);
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
while (token != NULL) {
char *fn = Wayland_URIToLocal(token);
if (fn) {
@ -1886,7 +1886,7 @@ static void data_device_handle_motion(void *data, struct wl_data_device *wl_data
dy = wl_fixed_to_double(y);
SDL_SendDropPosition(data_device->dnd_window, fn, (float)dx, (float)dy);
}
token = SDL_strtokr(NULL, "\r\n", &saveptr);
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
}
SDL_free(buffer);
}
@ -2025,13 +2025,13 @@ static void data_device_handle_drop(void *data, struct wl_data_device *wl_data_d
&length, FILE_MIME, SDL_TRUE);
if (buffer) {
char *saveptr = NULL;
char *token = SDL_strtokr((char *)buffer, "\r\n", &saveptr);
char *token = SDL_strtok_r((char *)buffer, "\r\n", &saveptr);
while (token != NULL) {
char *fn = Wayland_URIToLocal(token);
if (fn) {
SDL_SendDropFile(data_device->dnd_window, fn);
}
token = SDL_strtokr(NULL, "\r\n", &saveptr);
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
}
SDL_SendDropComplete(data_device->dnd_window);
SDL_free(buffer);

View File

@ -1808,7 +1808,7 @@ static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char *
char *tmp = SDL_strdup(newValue);
char *saveptr = NULL;
char *flag = SDL_strtokr(tmp, " ", &saveptr);
char *flag = SDL_strtok_r(tmp, " ", &saveptr);
while (flag) {
if (SDL_strcmp(flag, "OverridesSystemGestures") == 0) {
flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES;
@ -1819,7 +1819,7 @@ static void SDLCALL QtExtendedSurface_OnHintChanged(void *userdata, const char *
flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */;
}
flag = SDL_strtokr(NULL, " ", &saveptr);
flag = SDL_strtok_r(NULL, " ", &saveptr);
}
SDL_free(tmp);

View File

@ -1591,7 +1591,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
char *saveptr = NULL;
char *name = X11_XGetAtomName(display, target);
if (name) {
char *token = SDL_strtokr((char *)p.data, "\r\n", &saveptr);
char *token = SDL_strtok_r((char *)p.data, "\r\n", &saveptr);
while (token != NULL) {
if (SDL_strcmp("text/plain", name) == 0) {
SDL_SendDropText(data->window, token);
@ -1601,7 +1601,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
SDL_SendDropFile(data->window, fn);
}
}
token = SDL_strtokr(NULL, "\r\n", &saveptr);
token = SDL_strtok_r(NULL, "\r\n", &saveptr);
}
X11_XFree(name);
}