msvcrt: Added _configthreadlocale implementation.
This commit is contained in:
parent
59c2201a9c
commit
20b77f4428
|
@ -324,7 +324,7 @@
|
|||
@ cdecl _close(long) msvcrt._close
|
||||
@ cdecl _commit(long) msvcrt._commit
|
||||
@ extern _commode msvcrt._commode
|
||||
@ stub _configthreadlocale
|
||||
@ cdecl _configthreadlocale(long) msvcrt._configthreadlocale
|
||||
@ cdecl _control87(long long) msvcrt._control87
|
||||
@ cdecl _controlfp(long long) msvcrt._controlfp
|
||||
@ cdecl _controlfp_s(ptr long long) msvcrt._controlfp_s
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
@ cdecl _close(long) msvcrt._close
|
||||
@ cdecl _commit(long) msvcrt._commit
|
||||
@ extern _commode msvcrt._commode
|
||||
@ stub _configthreadlocale
|
||||
@ cdecl _configthreadlocale(long) msvcrt._configthreadlocale
|
||||
@ cdecl _control87(long long) msvcrt._control87
|
||||
@ cdecl _controlfp(long long) msvcrt._controlfp
|
||||
@ cdecl _controlfp_s(ptr long long) msvcrt._controlfp_s
|
||||
|
|
|
@ -954,6 +954,43 @@ MSVCRT__locale_t _create_locale(int category, const char *locale)
|
|||
return loc;
|
||||
}
|
||||
|
||||
/* _configthreadlocale - not exported in native msvcrt */
|
||||
int CDECL _configthreadlocale(int type)
|
||||
{
|
||||
thread_data_t *data = msvcrt_get_thread_data();
|
||||
int ret;
|
||||
|
||||
if(!data)
|
||||
return -1;
|
||||
|
||||
ret = (data->locale ? MSVCRT__ENABLE_PER_THREAD_LOCALE : MSVCRT__DISABLE_PER_THREAD_LOCALE);
|
||||
|
||||
if(type == MSVCRT__ENABLE_PER_THREAD_LOCALE) {
|
||||
if(!data->locale) {
|
||||
/* Copy current global locale */
|
||||
data->locale = _create_locale(MSVCRT_LC_ALL, MSVCRT_setlocale(MSVCRT_LC_ALL, NULL));
|
||||
if(!data->locale)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(type == MSVCRT__DISABLE_PER_THREAD_LOCALE) {
|
||||
if(data->locale) {
|
||||
_free_locale(data->locale);
|
||||
data->locale = NULL;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if(!type)
|
||||
return ret;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* setlocale (MSVCRT.@)
|
||||
*/
|
||||
|
|
|
@ -791,6 +791,9 @@ typedef struct MSVCRT_localeinfo_struct
|
|||
MSVCRT_pthreadmbcinfo mbcinfo;
|
||||
} MSVCRT__locale_tstruct, *MSVCRT__locale_t;
|
||||
|
||||
#define MSVCRT__ENABLE_PER_THREAD_LOCALE 1
|
||||
#define MSVCRT__DISABLE_PER_THREAD_LOCALE 2
|
||||
|
||||
extern MSVCRT__locale_t MSVCRT_locale;
|
||||
MSVCRT__locale_t get_locale(void);
|
||||
void __cdecl _free_locale(MSVCRT__locale_t);
|
||||
|
|
|
@ -1417,3 +1417,4 @@
|
|||
@ cdecl _set_invalid_parameter_handler(ptr)
|
||||
@ cdecl _create_locale(long str)
|
||||
@ cdecl _free_locale(ptr)
|
||||
@ cdecl _configthreadlocale(long)
|
||||
|
|
Loading…
Reference in New Issue