From dff85646517526562644c23648d11596daeb26d0 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 20 May 2021 21:37:26 +0200 Subject: [PATCH] msvcp90: Depend on compiler to handle returning struct in _Getctype. Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcp100/msvcp100.spec | 2 +- dlls/msvcp110/msvcp110.spec | 2 +- dlls/msvcp120/msvcp120.spec | 2 +- 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 | 22 ++++++++++++---------- dlls/msvcp90/msvcp90.spec | 2 +- dlls/msvcp90/tests/misc.c | 6 +++--- 12 files changed, 25 insertions(+), 23 deletions(-) diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec index 1fc93b05438..c0a4910eb4b 100644 --- a/dlls/msvcp100/msvcp100.spec +++ b/dlls/msvcp100/msvcp100.spec @@ -2916,7 +2916,7 @@ # extern _FXbig @ stub _GetLocaleForCP @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec index aeab529d69a..33f93c9e8cf 100644 --- a/dlls/msvcp110/msvcp110.spec +++ b/dlls/msvcp110/msvcp110.spec @@ -3779,7 +3779,7 @@ @ stub _FXp_subx # extern _FZero @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec index 0b1cb92f8ce..9dfe0b186c5 100644 --- a/dlls/msvcp120/msvcp120.spec +++ b/dlls/msvcp120/msvcp120.spec @@ -3722,7 +3722,7 @@ @ stub _FXp_subx # extern _FZero @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec index eefb9762708..e9ff7256419 100644 --- a/dlls/msvcp120_app/msvcp120_app.spec +++ b/dlls/msvcp120_app/msvcp120_app.spec @@ -3722,7 +3722,7 @@ @ stub _FXp_subx # extern _FZero @ cdecl -norelay _Getcoll() msvcp120._Getcoll -@ cdecl _Getctype(ptr) msvcp120._Getctype +@ cdecl -norelay _Getctype() msvcp120._Getctype @ cdecl -norelay _Getcvt() msvcp120._Getcvt @ cdecl _Getdateorder() msvcp120._Getdateorder @ cdecl _Getwctype(long ptr) msvcp120._Getwctype diff --git a/dlls/msvcp140/msvcp140.spec b/dlls/msvcp140/msvcp140.spec index d2cb4dbed8c..343571ae401 100644 --- a/dlls/msvcp140/msvcp140.spec +++ b/dlls/msvcp140/msvcp140.spec @@ -3650,7 +3650,7 @@ @ extern _FSnan @ cdecl _File_size(wstr) @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec index de7aafa73b7..c616a10b4a4 100644 --- a/dlls/msvcp60/msvcp60.spec +++ b/dlls/msvcp60/msvcp60.spec @@ -4275,7 +4275,7 @@ @ extern _FSnan _FSnan # extern _FXbig @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ extern _Hugeval _Hugeval @ extern _Inf _Inf diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec index d1a152ff0e3..a35949e15fb 100644 --- a/dlls/msvcp70/msvcp70.spec +++ b/dlls/msvcp70/msvcp70.spec @@ -5062,7 +5062,7 @@ # extern _FXbig # extern _FZero @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ extern _Hugeval @ extern _Inf diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec index 6176c9be2df..41c8bb01a9c 100644 --- a/dlls/msvcp71/msvcp71.spec +++ b/dlls/msvcp71/msvcp71.spec @@ -5116,7 +5116,7 @@ # extern _FXbig # extern _FZero @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getwctype(long ptr) @ cdecl _Getwctypes(ptr ptr ptr ptr) diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec index f450286505a..020e8d26fc7 100644 --- a/dlls/msvcp80/msvcp80.spec +++ b/dlls/msvcp80/msvcp80.spec @@ -5725,7 +5725,7 @@ @ extern _FSnan # extern _FXbig @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c index 2f6c103b2a2..ea0729cf4f9 100644 --- a/dlls/msvcp90/locale.c +++ b/dlls/msvcp90/locale.c @@ -698,8 +698,9 @@ _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret) } /* _Getctype */ -_Ctypevec* __cdecl _Getctype(_Ctypevec *ret) +_Ctypevec __cdecl _Getctype(void) { + _Ctypevec ret; short *table; #if _MSVCP_VER >= 110 wchar_t *name; @@ -708,24 +709,24 @@ _Ctypevec* __cdecl _Getctype(_Ctypevec *ret) TRACE("\n"); - ret->page = ___lc_codepage_func(); + ret.page = ___lc_codepage_func(); #if _MSVCP_VER < 110 - ret->handle = ___lc_handle_func()[LC_COLLATE]; + ret.handle = ___lc_handle_func()[LC_COLLATE]; #else if((name = ___lc_locale_name_func()[LC_COLLATE])) { size = wcslen(name)+1; - ret->name = malloc(size*sizeof(*name)); - if(!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL); - memcpy(ret->name, name, size*sizeof(*name)); + ret.name = malloc(size*sizeof(*name)); + if(!ret.name) throw_exception(EXCEPTION_BAD_ALLOC, NULL); + memcpy(ret.name, name, size*sizeof(*name)); } else { - ret->name = NULL; + ret.name = NULL; } #endif - ret->delfl = TRUE; + ret.delfl = TRUE; table = malloc(sizeof(short[256])); if(!table) throw_exception(EXCEPTION_BAD_ALLOC, NULL); memcpy(table, __pctype_func(), sizeof(short[256])); - ret->table = table; + ret.table = table; return ret; } @@ -734,7 +735,8 @@ _Ctypevec* __cdecl _Getctype(_Ctypevec *ret) DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8) _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret) { - return _Getctype(ret); + *ret = _Getctype(); + return ret; } /* _Getcvt */ diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec index 15b16ed7f12..1e79400e469 100644 --- a/dlls/msvcp90/msvcp90.spec +++ b/dlls/msvcp90/msvcp90.spec @@ -6501,7 +6501,7 @@ @ extern _FSnan # extern _FXbig @ cdecl -norelay _Getcoll() -@ cdecl _Getctype(ptr) +@ cdecl -norelay _Getctype() @ cdecl -norelay _Getcvt() @ cdecl _Getdateorder() @ cdecl _Getwctype(long ptr) diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c index 546f10f6858..40858bc5594 100644 --- a/dlls/msvcp90/tests/misc.c +++ b/dlls/msvcp90/tests/misc.c @@ -100,7 +100,7 @@ static BYTE (__cdecl *p_short_eq)(const void*, const void*); static char* (__cdecl *p_Copy_s)(char*, size_t, const char*, size_t); static unsigned short (__cdecl *p_wctype)(const char*); -static MSVCP__Ctypevec* (__cdecl *p__Getctype)(MSVCP__Ctypevec*); +static MSVCP__Ctypevec (__cdecl *p__Getctype)(void); static MSVCP__Collvec (__cdecl *p__Getcoll)(void); static wctrans_t (__cdecl *p_wctrans)(const char*); static wint_t (__cdecl *p_towctrans)(wint_t, wctrans_t); @@ -584,7 +584,7 @@ static void test__Getctype(void) MSVCP__Ctypevec ret; _locale_t locale; - ok(p__Getctype(&ret) == &ret, "__Getctype returned incorrect pointer\n"); + ret = p__Getctype(); ok(ret.handle == 0, "ret.handle = %d\n", ret.handle); ok(ret.page == 0, "ret.page = %d\n", ret.page); ok(ret.delfl == 1, "ret.delfl = %d\n", ret.delfl); @@ -594,7 +594,7 @@ static void test__Getctype(void) locale = p__get_current_locale(); locale->locinfo->lc_handle[LC_COLLATE] = 0x1234567; p__free_locale(locale); - ok(p__Getctype(&ret) == &ret, "__Getctype returned incorrect pointer\n"); + ret = p__Getctype(); ok(ret.handle == 0x1234567, "ret.handle = %d\n", ret.handle); ok(ret.page == 0, "ret.page = %d\n", ret.page); ok(ret.delfl == 1, "ret.delfl = %d\n", ret.delfl);