Commit a5fded6e authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: add FromANSI / ToANSI and use them

parent 2f457682
...@@ -56,22 +56,6 @@ VLC_API void * ToCharset( const char *charset, const char *in, size_t *outsize ) ...@@ -56,22 +56,6 @@ VLC_API void * ToCharset( const char *charset, const char *in, size_t *outsize )
# define ToLocaleDup strdup # define ToLocaleDup strdup
#else #else
VLC_USED
static inline char *FromLocale (const char *locale)
{
return locale ? FromCharset ("", locale, strlen (locale)) : NULL;
}
VLC_USED
static inline char *ToLocale (const char *utf8)
{
size_t outsize;
return utf8 ? (char *)ToCharset ("", utf8, &outsize) : (char *)NULL;
}
# define LocaleFree(s) free((char *)(s))
# define FromLocaleDup FromLocale
# define ToLocaleDup ToLocale
VLC_USED VLC_USED
static inline char *FromWide (const wchar_t *wide) static inline char *FromWide (const wchar_t *wide)
{ {
...@@ -135,13 +119,30 @@ static inline char *FromCodePage (unsigned cp, const char *mb) ...@@ -135,13 +119,30 @@ static inline char *FromCodePage (unsigned cp, const char *mb)
return utf8; return utf8;
} }
VLC_USED VLC_MALLOC
static inline char *FromANSI (const char *ansi)
{
return FromCodePage (GetACP (), ansi);
}
VLC_USED VLC_MALLOC
static inline char *ToANSI (const char *utf8)
{
return ToCodePage (GetACP (), utf8);
}
# ifdef UNICODE # ifdef UNICODE
# define FromT FromWide # define FromT FromWide
# define ToT ToWide # define ToT ToWide
# else # else
# define FromT FromLocaleDup # define FromT FromANSI
# define ToT ToLocaleDup # define ToT ToANSI
# endif # endif
# define FromLocale FromANSI
# define ToLocale ToAnsi
# define LocaleFree(s) free((char *)(s))
# define FromLocaleDup FromANSI
# define ToLocaleDup ToANSI
#endif #endif
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment