SDL_GUIDFromString() renamed SDL_StringToGUID()

This commit is contained in:
Sam Lantinga 2024-07-22 10:33:25 -07:00
parent 5e12706ae0
commit ef21e31a9a
10 changed files with 30 additions and 16 deletions

View File

@ -3581,3 +3581,8 @@ typedef SDL_JoystickGUID, SDL_GUID;
@@
- SDL_JoystickGUID
+ SDL_GUID
@@
@@
- SDL_GUIDFromString
+ SDL_StringToGUID
(...)

View File

@ -698,6 +698,9 @@ functionality to your app and aid migration. That is located in the
SDL_GUIDToString() returns a const pointer to the string representation of a GUID.
The following functions have been renamed:
* SDL_GUIDFromString() => SDL_StringToGUID()
## SDL_haptic.h
Gamepads with simple rumble capability no longer show up in the SDL haptics interface, instead you should use SDL_RumbleGamepad().
@ -872,7 +875,7 @@ The following functions have been renamed:
* SDL_JoystickGetButton() => SDL_GetJoystickButton()
* SDL_JoystickGetFirmwareVersion() => SDL_GetJoystickFirmwareVersion()
* SDL_JoystickGetGUID() => SDL_GetJoystickGUID()
* SDL_JoystickGetGUIDFromString() => SDL_GUIDFromString()
* SDL_JoystickGetGUIDFromString() => SDL_StringToGUID()
* SDL_JoystickGetHat() => SDL_GetJoystickHat()
* SDL_JoystickGetPlayerIndex() => SDL_GetJoystickPlayerIndex()
* SDL_JoystickGetProduct() => SDL_GetJoystickProduct()

View File

@ -75,7 +75,7 @@ typedef struct SDL_GUID {
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_GUIDFromString
* \sa SDL_StringToGUID
*/
extern SDL_DECLSPEC const char * SDLCALL SDL_GUIDToString(SDL_GUID guid);
@ -93,7 +93,7 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GUIDToString(SDL_GUID guid);
*
* \sa SDL_GUIDToString
*/
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_GUIDFromString(const char *pchGUID);
extern SDL_DECLSPEC SDL_GUID SDLCALL SDL_StringToGUID(const char *pchGUID);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus

View File

@ -266,6 +266,9 @@
#define SDL_INIT_GAMECONTROLLER SDL_INIT_GAMEPAD
#define SDL_IsGameController SDL_IsGamepad
/* ##SDL_guid.h */
#define SDL_GUIDFromString SDL_StringToGUID
/* ##SDL_haptic.h */
#define SDL_HapticClose SDL_CloseHaptic
#define SDL_HapticDestroyEffect SDL_DestroyHapticEffect
@ -317,7 +320,7 @@
#define SDL_JoystickGetButton SDL_GetJoystickButton
#define SDL_JoystickGetFirmwareVersion SDL_GetJoystickFirmwareVersion
#define SDL_JoystickGetGUID SDL_GetJoystickGUID
#define SDL_JoystickGetGUIDFromString SDL_GUIDFromString
#define SDL_JoystickGetGUIDFromString SDL_StringToGUID
#define SDL_JoystickGetHat SDL_GetJoystickHat
#define SDL_JoystickGetPlayerIndex SDL_GetJoystickPlayerIndex
#define SDL_JoystickGetProduct SDL_GetJoystickProduct
@ -882,6 +885,9 @@
#define SDL_INIT_GAMECONTROLLER SDL_INIT_GAMECONTROLLER_renamed_SDL_INIT_GAMEPAD
#define SDL_IsGameController SDL_IsGameController_renamed_SDL_IsGamepad
/* ##SDL_guid.h */
#define SDL_GUIDFromString SDL_GUIDFromString_renamed_SDL_StringToGUID
/* ##SDL_haptic.h */
#define SDL_HapticClose SDL_HapticClose_renamed_SDL_CloseHaptic
#define SDL_HapticDestroyEffect SDL_HapticDestroyEffect_renamed_SDL_DestroyHapticEffect

View File

@ -63,7 +63,7 @@ static unsigned char nibble(unsigned char c)
}
/* convert the string version of a guid to the struct */
SDL_GUID SDL_GUIDFromString(const char *pchGUID)
SDL_GUID SDL_StringToGUID(const char *pchGUID)
{
SDL_GUID guid;
int maxoutputbytes = sizeof(guid);

View File

@ -146,7 +146,6 @@ SDL3_0.0.0 {
SDL_GL_SetSwapInterval;
SDL_GL_SwapWindow;
SDL_GL_UnloadLibrary;
SDL_GUIDFromString;
SDL_GUIDToString;
SDL_GamepadConnected;
SDL_GamepadEventsEnabled;
@ -816,6 +815,7 @@ SDL3_0.0.0 {
SDL_StopHapticRumble;
SDL_StopTextInput;
SDL_StorageReady;
SDL_StringToGUID;
SDL_SurfaceHasColorKey;
SDL_SurfaceHasRLE;
SDL_SyncWindow;

View File

@ -171,7 +171,6 @@
#define SDL_GL_SetSwapInterval SDL_GL_SetSwapInterval_REAL
#define SDL_GL_SwapWindow SDL_GL_SwapWindow_REAL
#define SDL_GL_UnloadLibrary SDL_GL_UnloadLibrary_REAL
#define SDL_GUIDFromString SDL_GUIDFromString_REAL
#define SDL_GUIDToString SDL_GUIDToString_REAL
#define SDL_GamepadConnected SDL_GamepadConnected_REAL
#define SDL_GamepadEventsEnabled SDL_GamepadEventsEnabled_REAL
@ -841,6 +840,7 @@
#define SDL_StopHapticRumble SDL_StopHapticRumble_REAL
#define SDL_StopTextInput SDL_StopTextInput_REAL
#define SDL_StorageReady SDL_StorageReady_REAL
#define SDL_StringToGUID SDL_StringToGUID_REAL
#define SDL_SurfaceHasColorKey SDL_SurfaceHasColorKey_REAL
#define SDL_SurfaceHasRLE SDL_SurfaceHasRLE_REAL
#define SDL_SyncWindow SDL_SyncWindow_REAL

View File

@ -191,7 +191,6 @@ SDL_DYNAPI_PROC(int,SDL_GL_SetAttribute,(SDL_GLattr a, int b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_GL_SetSwapInterval,(int a),(a),return)
SDL_DYNAPI_PROC(int,SDL_GL_SwapWindow,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_GL_UnloadLibrary,(void),(),)
SDL_DYNAPI_PROC(SDL_GUID,SDL_GUIDFromString,(const char *a),(a),return)
SDL_DYNAPI_PROC(const char *,SDL_GUIDToString,(SDL_GUID a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadConnected,(SDL_Gamepad *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadEventsEnabled,(void),(),return)
@ -851,6 +850,7 @@ SDL_DYNAPI_PROC(int,SDL_StopHapticEffects,(SDL_Haptic *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_StopHapticRumble,(SDL_Haptic *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_StopTextInput,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_StorageReady,(SDL_Storage *a),(a),return)
SDL_DYNAPI_PROC(SDL_GUID,SDL_StringToGUID,(const char *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasColorKey,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SurfaceHasRLE,(SDL_Surface *a),(a),return)
SDL_DYNAPI_PROC(int,SDL_SyncWindow,(SDL_Window *a),(a),return)

View File

@ -2028,7 +2028,7 @@ static int SDL_PrivateAddGamepadMapping(const char *mappingString, SDL_GamepadMa
} else if (!SDL_strcasecmp(pchGUID, "xinput")) {
is_xinput_mapping = SDL_TRUE;
}
jGUID = SDL_GUIDFromString(pchGUID);
jGUID = SDL_StringToGUID(pchGUID);
SDL_free(pchGUID);
pGamepadMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority);

View File

@ -72,14 +72,14 @@ upper_lower_to_bytestring(Uint8 *out, Uint64 upper, Uint64 lower)
/**
* Check String-to-GUID conversion
*
* \sa SDL_GUIDFromString
* \sa SDL_StringToGUID
*/
static int
TestGuidFromString(void *arg)
TestStringToGUID(void *arg)
{
int i;
SDLTest_AssertPass("Call to SDL_GUIDFromString");
SDLTest_AssertPass("Call to SDL_StringToGUID");
for (i = 0; i < NUM_TEST_GUIDS; ++i) {
Uint8 expected[16];
SDL_GUID guid;
@ -87,7 +87,7 @@ TestGuidFromString(void *arg)
upper_lower_to_bytestring(expected,
test_guids[i].upper, test_guids[i].lower);
guid = SDL_GUIDFromString(test_guids[i].str);
guid = SDL_StringToGUID(test_guids[i].str);
SDLTest_AssertCheck(SDL_memcmp(expected, guid.data, 16) == 0, "GUID from string, GUID was: '%s'", test_guids[i].str);
}
@ -100,7 +100,7 @@ TestGuidFromString(void *arg)
* \sa SDL_GUIDToString
*/
static int
TestGuidToString(void *arg)
TestGUIDToString(void *arg)
{
int i;
@ -123,11 +123,11 @@ TestGuidToString(void *arg)
/* GUID routine test cases */
static const SDLTest_TestCaseReference guidTest1 = {
(SDLTest_TestCaseFp)TestGuidFromString, "TestGuidFromString", "Call to SDL_GUIDFromString", TEST_ENABLED
(SDLTest_TestCaseFp)TestStringToGUID, "TestStringToGUID", "Call to SDL_StringToGUID", TEST_ENABLED
};
static const SDLTest_TestCaseReference guidTest2 = {
(SDLTest_TestCaseFp)TestGuidToString, "TestGuidToString", "Call to SDL_GUIDToString", TEST_ENABLED
(SDLTest_TestCaseFp)TestGUIDToString, "TestGUIDToString", "Call to SDL_GUIDToString", TEST_ENABLED
};
/* Sequence of GUID routine test cases */