Module: wine Branch: master Commit: c2b0732108ec9eb59fb26142abbfc5868caf7bfc URL: http://source.winehq.org/git/wine.git/?a=commit;h=c2b0732108ec9eb59fb26142ab...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Jan 13 12:51:53 2014 +0100
msvcp90: Avoid using get_current_locale that doesn't exist in old msvcrt versions.
---
dlls/msvcp90/locale.c | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-)
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index f428396..0ae1d8d 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -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; }