winrt: Remove SDL_WinRTGetFSPathUNICODE, rename SDL_WinRTGetFSPathUTF8.

Fixes #9470.
This commit is contained in:
Ryan C. Gordon 2024-04-13 08:18:08 -04:00
parent 02da4acf0f
commit 98e9f361a8
No known key found for this signature in database
GPG Key ID: FA148B892AB48044
10 changed files with 27 additions and 53 deletions

View File

@ -3129,3 +3129,8 @@ typedef SDL_Colour, SDL_Color;
@@
- SDL_Colour
+ SDL_Color
@@
@@
- SDL_WinRTGetFSPathUTF8
+ SDL_WinRTGetFSPath
(...)

View File

@ -1491,6 +1491,10 @@ The following functions have been removed:
* SDL_RenderGetD3D11Device() - replaced with the "SDL.renderer.d3d11.device" property
* SDL_RenderGetD3D12Device() - replaced with the "SDL.renderer.d3d12.device" property
* SDL_RenderGetD3D9Device() - replaced with the "SDL.renderer.d3d9.device" property
* SDL_WinRTGetFSPathUNICODE() - Use SDL_WinRTGetFSPath() and SDL_iconv_string to convert from UTF-8 to UTF-16.
The following functions have been renamed:
* SDL_WinRTGetFSPathUTF8() => SDL_WinRTGetFSPath()
## SDL_syswm.h

View File

@ -129,8 +129,7 @@ SDL_GetPrefPath(), starting with SDL 2.0.4, addresses these by:
(and which require less work to use safely, in terms of data integrity).
Apps that wish to get their Roaming folder's path can do so either by using
SDL_WinRTGetFSPathUTF8(), SDL_WinRTGetFSPathUNICODE() (which returns a
UCS-2/wide-char string), or directly through the WinRT class,
SDL_WinRTGetFSPath(), or directly through the WinRT class,
Windows.Storage.ApplicationData.

View File

@ -511,6 +511,9 @@
#define SDL_UpperBlit SDL_BlitSurface
#define SDL_UpperBlitScaled SDL_BlitSurfaceScaled
/* ##SDL_system.h */
#define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPath
/* ##SDL_thread.h */
#define SDL_TLSCleanup SDL_CleanupTLS
#define SDL_TLSCreate SDL_CreateTLS
@ -1012,6 +1015,9 @@
#define SDL_UpperBlit SDL_UpperBlit_renamed_SDL_BlitSurface
#define SDL_UpperBlitScaled SDL_UpperBlitScaled_renamed_SDL_BlitSurfaceScaled
/* ##SDL_system.h */
#define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_renamed_SDL_WinRTGetFSPath
/* ##SDL_thread.h */
#define SDL_TLSCleanup SDL_TLSCleanup_renamed_SDL_CleanupTLS
#define SDL_TLSCreate SDL_TLSCreate_renamed_SDL_CreateTLS

View File

@ -527,29 +527,6 @@ typedef enum SDL_WinRT_DeviceFamily
} SDL_WinRT_DeviceFamily;
/**
* Retrieve a WinRT defined path on the local file system.
*
* Not all paths are available on all versions of Windows. This is especially
* true on Windows Phone. Check the documentation for the given SDL_WinRT_Path
* for more information on which path types are supported where.
*
* Documentation on most app-specific path types on WinRT can be found on
* MSDN, at the URL:
*
* https://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx
*
* \param pathType the type of path to retrieve, one of SDL_WinRT_Path
* \returns a UCS-2 string (16-bit, wide-char) containing the path, or NULL if
* the path is not available for any reason; call SDL_GetError() for
* more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_WinRTGetFSPathUTF8
*/
extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType);
/**
* Retrieve a WinRT defined path on the local file system.
*
@ -568,10 +545,8 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path
* more information.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_WinRTGetFSPathUNICODE
*/
extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType);
extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPath(SDL_WinRT_Path pathType);
/**
* Detects the device family of WinRT platform at runtime.

View File

@ -102,16 +102,8 @@ int SDL_WinRTGetDeviceFamily()
return 0; /* SDL_WINRT_DEVICEFAMILY_UNKNOWN */
}
DECLSPEC const wchar_t *SDLCALL SDL_WinRTGetFSPathUNICODE(int pathType); /* SDL_WinRT_Path pathType */
const wchar_t *SDL_WinRTGetFSPathUNICODE(int pathType)
{
(void)pathType;
SDL_Unsupported();
return NULL;
}
DECLSPEC const char *SDLCALL SDL_WinRTGetFSPathUTF8(int pathType); /* SDL_WinRT_Path pathType */
const char *SDL_WinRTGetFSPathUTF8(int pathType)
DECLSPEC const char *SDLCALL SDL_WinRTGetFSPath(int pathType); /* SDL_WinRT_Path pathType */
const char *SDL_WinRTGetFSPath(int pathType)
{
(void)pathType;
SDL_Unsupported();

View File

@ -838,8 +838,7 @@ SDL3_0.0.0 {
SDL_WarpMouseInWindow;
SDL_WasInit;
SDL_WinRTGetDeviceFamily;
SDL_WinRTGetFSPathUNICODE;
SDL_WinRTGetFSPathUTF8;
SDL_WinRTGetFSPath;
SDL_WindowHasSurface;
SDL_WriteIO;
SDL_WriteS16BE;

View File

@ -862,8 +862,7 @@
#define SDL_WarpMouseInWindow SDL_WarpMouseInWindow_REAL
#define SDL_WasInit SDL_WasInit_REAL
#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL
#define SDL_WinRTGetFSPathUNICODE SDL_WinRTGetFSPathUNICODE_REAL
#define SDL_WinRTGetFSPathUTF8 SDL_WinRTGetFSPathUTF8_REAL
#define SDL_WinRTGetFSPath SDL_WinRTGetFSPath_REAL
#define SDL_WindowHasSurface SDL_WindowHasSurface_REAL
#define SDL_WriteIO SDL_WriteIO_REAL
#define SDL_WriteS16BE SDL_WriteS16BE_REAL

View File

@ -882,8 +882,7 @@ SDL_DYNAPI_PROC(int,SDL_WarpMouseGlobal,(float a, float b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_WarpMouseInWindow,(SDL_Window *a, float b, float c),(a,b,c),)
SDL_DYNAPI_PROC(Uint32,SDL_WasInit,(Uint32 a),(a),return)
SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return)
SDL_DYNAPI_PROC(const wchar_t*,SDL_WinRTGetFSPathUNICODE,(SDL_WinRT_Path a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_WinRTGetFSPathUTF8,(SDL_WinRT_Path a),(a),return)
SDL_DYNAPI_PROC(const char*,SDL_WinRTGetFSPath,(SDL_WinRT_Path a),(a),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_WindowHasSurface,(SDL_Window *a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_WriteIO,(SDL_IOStream *a, const void *b, size_t c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_WriteS16BE,(SDL_IOStream *a, Sint16 b),(a,b),return)

View File

@ -35,8 +35,7 @@ extern "C" {
using namespace std;
using namespace Windows::Storage;
extern "C" const wchar_t *
SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
static const wchar_t *SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
{
switch (pathType) {
case SDL_WINRT_PATH_INSTALLED_LOCATION:
@ -94,8 +93,7 @@ SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path pathType)
return NULL;
}
extern "C" const char *
SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
extern "C" const char *SDL_WinRTGetFSPath(SDL_WinRT_Path pathType)
{
typedef unordered_map<SDL_WinRT_Path, string> UTF8PathMap;
static UTF8PathMap utf8Paths;
@ -116,10 +114,9 @@ SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType)
return utf8Paths[pathType].c_str();
}
extern "C" char *
SDL_GetBasePath(void)
extern "C" char *SDL_GetBasePath(void)
{
const char *srcPath = SDL_WinRTGetFSPathUTF8(SDL_WINRT_PATH_INSTALLED_LOCATION);
const char *srcPath = SDL_WinRTGetFSPath(SDL_WINRT_PATH_INSTALLED_LOCATION);
size_t destPathLen;
char *destPath = NULL;
@ -138,8 +135,7 @@ SDL_GetBasePath(void)
return destPath;
}
extern "C" char *
SDL_GetPrefPath(const char *org, const char *app)
extern "C" char *SDL_GetPrefPath(const char *org, const char *app)
{
/* WinRT note: The 'SHGetFolderPath' API that is used in Windows 7 and
* earlier is not available on WinRT or Windows Phone. WinRT provides