msvcrt: Added _get_current_locale implementation.
This commit is contained in:
parent
8d6354c5b2
commit
f84858ac2c
|
@ -675,7 +675,7 @@
|
|||
@ varargs _fwscanf_s_l(ptr wstr ptr) msvcrt._fwscanf_s_l
|
||||
@ cdecl _gcvt(double long str) msvcrt._gcvt
|
||||
@ cdecl _gcvt_s(ptr long double long) msvcrt._gcvt_s
|
||||
@ stub _get_current_locale
|
||||
@ cdecl _get_current_locale() msvcrt._get_current_locale
|
||||
@ stub _get_daylight
|
||||
@ cdecl _get_doserrno(ptr) msvcrt._get_doserrno
|
||||
@ stub _get_dstbias
|
||||
|
|
|
@ -517,7 +517,7 @@
|
|||
@ cdecl _gcvt(double long str) msvcrt._gcvt
|
||||
@ cdecl _gcvt_s(ptr long double long) msvcrt._gcvt_s
|
||||
@ stub _get_amblksiz
|
||||
@ stub _get_current_locale
|
||||
@ cdecl _get_current_locale() msvcrt._get_current_locale
|
||||
@ stub _get_daylight
|
||||
@ cdecl _get_doserrno(ptr) msvcrt._get_doserrno
|
||||
@ stub _get_dstbias
|
||||
|
|
|
@ -512,7 +512,7 @@
|
|||
@ cdecl _gcvt(double long str) msvcrt._gcvt
|
||||
@ cdecl _gcvt_s(ptr long double long) msvcrt._gcvt_s
|
||||
@ stub _get_amblksiz
|
||||
@ stub _get_current_locale
|
||||
@ cdecl _get_current_locale() msvcrt._get_current_locale
|
||||
@ stub _get_daylight
|
||||
@ cdecl _get_doserrno(ptr) msvcrt._get_doserrno
|
||||
@ stub _get_dstbias
|
||||
|
|
|
@ -603,6 +603,9 @@ void free_locinfo(MSVCRT_pthreadlocinfo locinfo)
|
|||
if(!locinfo)
|
||||
return;
|
||||
|
||||
if(InterlockedDecrement(&locinfo->refcount))
|
||||
return;
|
||||
|
||||
for(i=MSVCRT_LC_MIN+1; i<=MSVCRT_LC_MAX; i++) {
|
||||
MSVCRT_free(locinfo->lc_category[i].locale);
|
||||
MSVCRT_free(locinfo->lc_category[i].refcount);
|
||||
|
@ -640,9 +643,26 @@ void free_mbcinfo(MSVCRT_pthreadmbcinfo mbcinfo)
|
|||
if(!mbcinfo)
|
||||
return;
|
||||
|
||||
if(InterlockedDecrement(&mbcinfo->refcount))
|
||||
return;
|
||||
|
||||
MSVCRT_free(mbcinfo);
|
||||
}
|
||||
|
||||
/* _get_current_locale - not exported in native msvcrt */
|
||||
MSVCRT__locale_t CDECL MSVCRT__get_current_locale(void)
|
||||
{
|
||||
MSVCRT__locale_t loc = MSVCRT_malloc(sizeof(MSVCRT__locale_tstruct));
|
||||
if(!loc)
|
||||
return NULL;
|
||||
|
||||
loc->locinfo = get_locinfo();
|
||||
loc->mbcinfo = get_mbcinfo();
|
||||
InterlockedIncrement(&loc->locinfo->refcount);
|
||||
InterlockedIncrement(&loc->mbcinfo->refcount);
|
||||
return loc;
|
||||
}
|
||||
|
||||
/* _free_locale - not exported in native msvcrt */
|
||||
void CDECL MSVCRT__free_locale(MSVCRT__locale_t locale)
|
||||
{
|
||||
|
@ -747,6 +767,8 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
|
|||
}
|
||||
|
||||
memset(loc->locinfo, 0, sizeof(MSVCRT_threadlocinfo));
|
||||
loc->locinfo->refcount = 1;
|
||||
loc->mbcinfo->refcount = 1;
|
||||
|
||||
loc->locinfo->lconv = MSVCRT_malloc(sizeof(struct MSVCRT_lconv));
|
||||
if(!loc->locinfo->lconv) {
|
||||
|
@ -762,8 +784,6 @@ MSVCRT__locale_t CDECL MSVCRT__create_locale(int category, const char *locale)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
loc->locinfo->refcount = 1;
|
||||
|
||||
if(lcid[MSVCRT_LC_COLLATE] && (category==MSVCRT_LC_ALL || category==MSVCRT_LC_COLLATE)) {
|
||||
if(update_threadlocinfo_category(lcid[MSVCRT_LC_COLLATE], loc, MSVCRT_LC_COLLATE)) {
|
||||
MSVCRT__free_locale(loc);
|
||||
|
|
|
@ -1490,6 +1490,7 @@
|
|||
@ cdecl -arch=i386 __control87_2(long long ptr ptr)
|
||||
@ cdecl _configthreadlocale(long)
|
||||
@ cdecl _create_locale(long str) MSVCRT__create_locale
|
||||
@ cdecl _get_current_locale() MSVCRT__get_current_locale
|
||||
@ cdecl _dupenv_s(ptr ptr str)
|
||||
@ cdecl _free_locale(ptr) MSVCRT__free_locale
|
||||
@ cdecl _get_invalid_parameter_handler()
|
||||
|
|
Loading…
Reference in New Issue