mirror of https://github.com/neutrinolabs/xrdp
Remove g_mbstowcs() and g_wcstombs()
These calls are now replaced with explicit UTF conversion routines in the common/string_calls.[hc] and common/parse.[hc] modules. Also removed:- - The support code in common/os_calls.c to set the locale to use these routines. - The twchar type in arch.h
This commit is contained in:
parent
d722ffe357
commit
f5f67e2e80
|
@ -145,12 +145,10 @@ typedef bool_t tbool;
|
|||
typedef intptr_t tbus;
|
||||
typedef intptr_t tintptr;
|
||||
|
||||
/* wide char, socket */
|
||||
/* socket */
|
||||
#if defined(_WIN32)
|
||||
typedef unsigned short twchar;
|
||||
typedef unsigned int tsock;
|
||||
#else
|
||||
typedef int twchar;
|
||||
typedef int tsock;
|
||||
#endif
|
||||
#endif /* DEFINED_Ts */
|
||||
|
|
|
@ -181,20 +181,6 @@ g_init(const char *app_name)
|
|||
|
||||
WSAStartup(2, &wsadata);
|
||||
#endif
|
||||
|
||||
/* In order to get g_mbstowcs and g_wcstombs to work properly with
|
||||
UTF-8 non-ASCII characters, LC_CTYPE cannot be "C" or blank.
|
||||
To select UTF-8 encoding without specifying any countries/languages,
|
||||
"C.UTF-8" is used but provided in few systems.
|
||||
|
||||
See also: https://sourceware.org/glibc/wiki/Proposals/C.UTF-8 */
|
||||
char *lc_ctype;
|
||||
lc_ctype = setlocale(LC_CTYPE, "C.UTF-8");
|
||||
if (lc_ctype == NULL)
|
||||
{
|
||||
/* use en_US.UTF-8 instead if not available */
|
||||
setlocale(LC_CTYPE, "en_US.UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -710,30 +710,6 @@ g_strstr(const char *haystack, const char *needle)
|
|||
return (char *)strstr(haystack, needle);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
g_mbstowcs(twchar *dest, const char *src, int n)
|
||||
{
|
||||
wchar_t *ldest;
|
||||
int rv;
|
||||
|
||||
ldest = (wchar_t *)dest;
|
||||
rv = mbstowcs(ldest, src, n);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
int
|
||||
g_wcstombs(char *dest, const twchar *src, int n)
|
||||
{
|
||||
const wchar_t *lsrc;
|
||||
int rv;
|
||||
|
||||
lsrc = (const wchar_t *)src;
|
||||
rv = wcstombs(dest, lsrc, n);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* returns error */
|
||||
int
|
||||
|
|
|
@ -310,8 +310,6 @@ int g_bytes_to_hexstr(const void *bytes, int num_bytes, char *out_str,
|
|||
int bytes_out_str);
|
||||
int g_pos(const char *str, const char *to_find);
|
||||
char *g_strstr(const char *haystack, const char *needle);
|
||||
int g_mbstowcs(twchar *dest, const char *src, int n);
|
||||
int g_wcstombs(char *dest, const twchar *src, int n);
|
||||
|
||||
/** trim spaces and tabs, anything <= space
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue