Module: wine Branch: master Commit: 24f7abafd754bb7d706f588e97532ce3169ade9c URL: https://source.winehq.org/git/wine.git/?a=commit;h=24f7abafd754bb7d706f588e9...
Author: Piotr Caban piotr@codeweavers.com Date: Thu May 20 21:37:16 2021 +0200
msvcp90: Depend on compiler in _Getcvt implementation if possible.
Signed-off-by: Piotr Caban piotr@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/msvcp100/msvcp100.spec | 2 +- dlls/msvcp110/msvcp110.spec | 2 +- dlls/msvcp120/msvcp120.spec | 2 +- dlls/msvcp120/tests/msvcp120.c | 8 ++++---- dlls/msvcp120_app/msvcp120_app.spec | 2 +- dlls/msvcp140/msvcp140.spec | 2 +- dlls/msvcp60/msvcp60.spec | 2 +- dlls/msvcp70/msvcp70.spec | 2 +- dlls/msvcp71/msvcp71.spec | 2 +- dlls/msvcp80/msvcp80.spec | 2 +- dlls/msvcp90/locale.c | 38 +++++++++++++++++++++++++------------ dlls/msvcp90/msvcp90.spec | 2 +- 12 files changed, 40 insertions(+), 26 deletions(-)
diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec index 657cdc9f217..d964954dc1f 100644 --- a/dlls/msvcp100/msvcp100.spec +++ b/dlls/msvcp100/msvcp100.spec @@ -2917,7 +2917,7 @@ @ stub _GetLocaleForCP @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index 834c4225373..cd2236fe389 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -3780,7 +3780,7 @@ # extern _FZero @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 633b3da8552..2c5e457b2fc 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -3723,7 +3723,7 @@ # extern _FZero @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 35e90cfa29c..495ee9dd6fb 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -209,7 +209,7 @@ static int (__cdecl *p__ismbblead)(unsigned int);
static MSVCRT_long (__cdecl *p__Xtime_diff_to_millis2)(const xtime*, const xtime*); static int (__cdecl *p_xtime_get)(xtime*, int); -static _Cvtvec* (__cdecl *p__Getcvt)(_Cvtvec*); +static _Cvtvec (__cdecl *p__Getcvt)(void); static void (CDECL *p__Call_once)(int *once, void (CDECL *func)(void)); static void (CDECL *p__Call_onceEx)(int *once, void (CDECL *func)(void*), void *argv); static void (CDECL *p__Do_call)(void *this); @@ -930,7 +930,7 @@ static void test__Getcvt(void) _Cvtvec cvtvec; int i;
- p__Getcvt(&cvtvec); + cvtvec = p__Getcvt(); ok(cvtvec.page == 0, "cvtvec.page = %d\n", cvtvec.page); ok(cvtvec.mb_max == 1, "cvtvec.mb_max = %d\n", cvtvec.mb_max); todo_wine ok(cvtvec.unk == 1, "cvtvec.unk = %d\n", cvtvec.unk); @@ -941,7 +941,7 @@ static void test__Getcvt(void) win_skip("_Getcvt tests\n"); return; } - p__Getcvt(&cvtvec); + cvtvec = p__Getcvt(); ok(cvtvec.page == 936, "cvtvec.page = %d\n", cvtvec.page); ok(cvtvec.mb_max == 2, "cvtvec.mb_max = %d\n", cvtvec.mb_max); ok(cvtvec.unk == 0, "cvtvec.unk = %d\n", cvtvec.unk); @@ -955,7 +955,7 @@ static void test__Getcvt(void) }
p__setmbcp(936); - p__Getcvt(&cvtvec); + cvtvec = p__Getcvt(); ok(cvtvec.page == 936, "cvtvec.page = %d\n", cvtvec.page); ok(cvtvec.mb_max == 2, "cvtvec.mb_max = %d\n", cvtvec.mb_max); ok(cvtvec.unk == 0, "cvtvec.unk = %d\n", cvtvec.unk); diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index c35dcb2d427..93e172a944f 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -3723,7 +3723,7 @@ # extern _FZero @ cdecl -ret64 _Getcoll() msvcp120._Getcoll @ cdecl _Getctype(ptr) msvcp120._Getctype -@ cdecl -ret64 _Getcvt() msvcp120._Getcvt +@ cdecl -norelay _Getcvt() msvcp120._Getcvt @ cdecl _Getdateorder() msvcp120._Getdateorder @ cdecl _Getwctype(long ptr) msvcp120._Getwctype @ cdecl _Getwctypes(ptr ptr ptr ptr) msvcp120._Getwctypes diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index 6ad46186cb5..7e7ea012236 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3651,7 +3651,7 @@ @ cdecl _File_size(wstr) @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec index f3ed2e8b667..628e5f7f59e 100644 --- a/dlls/msvcp60/msvcp60.spec +++ b/dlls/msvcp60/msvcp60.spec @@ -4276,7 +4276,7 @@ # extern _FXbig @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ extern _Hugeval _Hugeval @ extern _Inf _Inf @ stub _LCosh diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec index d60e37bcff6..c48945d9509 100644 --- a/dlls/msvcp70/msvcp70.spec +++ b/dlls/msvcp70/msvcp70.spec @@ -5063,7 +5063,7 @@ # extern _FZero @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ extern _Hugeval @ extern _Inf @ stub _LCosh diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec index 1ccdd09825c..f9fc613b7d0 100644 --- a/dlls/msvcp71/msvcp71.spec +++ b/dlls/msvcp71/msvcp71.spec @@ -5117,7 +5117,7 @@ # extern _FZero @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) @ extern _Hugeval diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec index c1f409a1d78..74c0cac3669 100644 --- a/dlls/msvcp80/msvcp80.spec +++ b/dlls/msvcp80/msvcp80.spec @@ -5726,7 +5726,7 @@ # extern _FXbig @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index 0d0af6eac34..bd045333dfc 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -735,9 +735,11 @@ _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret) }
/* _Getcvt */ -#if _MSVCP_VER < 110 +#if _MSVCP_VER < 110 && defined(__i386__) +/* Work around a gcc bug */ ULONGLONG __cdecl _Getcvt(void) { + C_ASSERT(sizeof(_Cvtvec) == sizeof(ULONGLONG)); union { _Cvtvec cvtvec; ULONGLONG ull; @@ -749,20 +751,32 @@ ULONGLONG __cdecl _Getcvt(void) ret.cvtvec.handle = ___lc_handle_func()[LC_CTYPE]; return ret.ull; } +#elif _MSVCP_VER < 110 +_Cvtvec __cdecl _Getcvt(void) +{ + _Cvtvec ret; + + TRACE("\n"); + + ret.page = ___lc_codepage_func(); + ret.handle = ___lc_handle_func()[LC_CTYPE]; + return ret; +} #else -_Cvtvec* __cdecl _Getcvt(_Cvtvec *ret) +_Cvtvec __cdecl _Getcvt(void) { + _Cvtvec ret; int i;
TRACE("\n");
- memset(ret, 0, sizeof(*ret)); - ret->page = ___lc_codepage_func(); - ret->mb_max = ___mb_cur_max_func(); + memset(&ret, 0, sizeof(ret)); + ret.page = ___lc_codepage_func(); + ret.mb_max = ___mb_cur_max_func();
- if(ret->mb_max > 1) { + if(ret.mb_max > 1) { for(i=0; i<256; i++) - if(_ismbblead(i)) ret->isleadbyte[i/8] |= 1 << (i&7); + if(_ismbblead(i)) ret.isleadbyte[i/8] |= 1 << (i&7); } return ret; } @@ -773,14 +787,14 @@ _Cvtvec* __cdecl _Getcvt(_Cvtvec *ret) DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8) _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret) { -#if _MSVCP_VER < 110 - ULONGLONG ull = _Getcvt(); - memcpy(ret, &ull, sizeof(ull)); +#if _MSVCP_VER < 110 && defined(__i386__) + ULONGLONG cvtvec; #else _Cvtvec cvtvec; - _Getcvt(&cvtvec); - memcpy(ret, &cvtvec, sizeof(cvtvec)); #endif + + cvtvec = _Getcvt(); + memcpy(ret, &cvtvec, sizeof(cvtvec)); return ret; }
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index 9274a24b706..ff6fe952053 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -6502,7 +6502,7 @@ # extern _FXbig @ cdecl -ret64 _Getcoll() @ cdecl _Getctype(ptr) -@ cdecl -ret64 _Getcvt() +@ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr)