mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 06:42:03 +00:00
win32: fix semantics of POSIX 2008 locale stubs
This sliences some warnings about unused values and statements with no effect, but it also fixes a logic error with freelocale(), since previously it would not work as expected when used in the body of an if statement without braces. Uses real functions, because with macros, I don't think there is a way to silence the "statement with no effect" warnings in the case where the return value of uselocale() is ignored. As for replacing the these functions with working implementations, I don't think this is possible for mpv's use-case, since MSVCRT does not support UTF-8 locales, or any locale with multibyte characters that are three or more bytes long. See: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setlocale-wsetlocale
This commit is contained in:
parent
cd6f964b56
commit
0bdbe2bc53
14
osdep/io.c
14
osdep/io.c
@ -799,4 +799,18 @@ int msync(void *addr, size_t length, int flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
locale_t newlocale(int category, const char *locale, locale_t base)
|
||||
{
|
||||
return (locale_t)1;
|
||||
}
|
||||
|
||||
locale_t uselocale(locale_t locobj)
|
||||
{
|
||||
return (locale_t)1;
|
||||
}
|
||||
|
||||
void freelocale(locale_t locobj)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // __MINGW32__
|
||||
|
@ -193,11 +193,12 @@ int msync(void *addr, size_t length, int flags);
|
||||
#define glob(...) mp_glob(__VA_ARGS__)
|
||||
#define globfree(...) mp_globfree(__VA_ARGS__)
|
||||
|
||||
// There is not anything that helps with this on Windows.
|
||||
// These are stubs since there is not anything that helps with this on Windows.
|
||||
#define locale_t int
|
||||
#define newlocale(a, b, c) 1
|
||||
#define uselocale(a) 1
|
||||
#define freelocale(a)
|
||||
#define LC_ALL_MASK 0
|
||||
locale_t newlocale(int, const char *, locale_t);
|
||||
locale_t uselocale(locale_t);
|
||||
void freelocale(locale_t);
|
||||
|
||||
#else /* __MINGW32__ */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user