msvcp90: Avoid using get_current_locale that doesn't exist in old msvcrt versions.

This commit is contained in:
Alexandre Julliard 2014-01-13 12:51:53 +01:00
parent 581dd68c8a
commit c2b0732108
1 changed files with 10 additions and 17 deletions

View File

@ -43,6 +43,8 @@ char* __cdecl _Getdays(void);
char* __cdecl _Getmonths(void);
void* __cdecl _Gettnames(void);
unsigned int __cdecl ___lc_codepage_func(void);
int __cdecl ___lc_collate_cp_func(void);
const unsigned short* __cdecl __pctype_func(void);
const locale_facet* __thiscall locale__Getfacet(const locale*, MSVCP_size_t);
MSVCP_size_t __cdecl _Strftime(char*, MSVCP_size_t, const char*,
const struct tm*, struct __lc_time_data*);
@ -589,13 +591,11 @@ ULONGLONG __cdecl _Getcoll(void)
_Collvec collvec;
ULONGLONG ull;
} ret;
_locale_t locale = _get_current_locale();
TRACE("\n");
ret.collvec.page = locale->locinfo->lc_collate_cp;
ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
_free_locale(locale);
ret.collvec.page = ___lc_collate_cp_func();
ret.collvec.handle = ___lc_handle_func()[LC_COLLATE];
return ret.ull;
}
@ -612,22 +612,17 @@ _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
/* _Getctype */
_Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
{
_locale_t locale = _get_current_locale();
short *table;
TRACE("\n");
ret->page = locale->locinfo->lc_codepage;
ret->handle = locale->locinfo->lc_handle[LC_COLLATE];
ret->page = ___lc_codepage_func();
ret->handle = ___lc_handle_func()[LC_COLLATE];
ret->delfl = TRUE;
table = malloc(sizeof(short[256]));
if(!table) {
_free_locale(locale);
throw_exception(EXCEPTION_BAD_ALLOC, NULL);
}
memcpy(table, locale->locinfo->pctype, sizeof(short[256]));
if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL);
memcpy(table, __pctype_func(), sizeof(short[256]));
ret->table = table;
_free_locale(locale);
return ret;
}
@ -642,7 +637,6 @@ _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
/* _Getcvt */
ULONGLONG __cdecl _Getcvt(void)
{
_locale_t locale = _get_current_locale();
union {
_Cvtvec cvtvec;
ULONGLONG ull;
@ -650,9 +644,8 @@ ULONGLONG __cdecl _Getcvt(void)
TRACE("\n");
ret.cvtvec.page = locale->locinfo->lc_codepage;
ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
_free_locale(locale);
ret.cvtvec.page = ___lc_codepage_func();
ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE];
return ret.ull;
}