Piotr Caban : msvcp90: Fix __cdecl functions definitions that returns structures.

Alexandre Julliard julliard at winehq.org
Mon Jul 2 13:22:02 CDT 2012


Module: wine
Branch: master
Commit: 8a15e426b3495b24a3ff30943017efef9c388c1b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8a15e426b3495b24a3ff30943017efef9c388c1b

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Jul  2 18:31:50 2012 +0200

msvcp90: Fix __cdecl functions definitions that returns structures.

---

 dlls/msvcp100/msvcp100.spec |    6 ++--
 dlls/msvcp60/msvcp60.spec   |    6 ++--
 dlls/msvcp70/msvcp70.spec   |    6 ++--
 dlls/msvcp71/msvcp71.spec   |    6 ++--
 dlls/msvcp80/msvcp80.spec   |    6 ++--
 dlls/msvcp90/locale.c       |   46 ++++++++++++++++++++++++------------------
 dlls/msvcp90/msvcp90.spec   |    6 ++--
 dlls/msvcp90/string.c       |   20 +++++++-----------
 8 files changed, 52 insertions(+), 50 deletions(-)

diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec
index fcfe427..523ca2f 100644
--- a/dlls/msvcp100/msvcp100.spec
+++ b/dlls/msvcp100/msvcp100.spec
@@ -2808,9 +2808,9 @@
 @ extern _FSnan msvcp90._FSnan
 # extern _FXbig
 @ stub _GetLocaleForCP
-@ cdecl _Getcoll() msvcp90._Getcoll
-@ cdecl _Getctype() msvcp90._Getctype
-@ cdecl _Getcvt() msvcp90._Getcvt
+@ cdecl -ret64 _Getcoll() msvcp90._Getcoll
+@ cdecl _Getctype(ptr) msvcp90._Getctype
+@ cdecl -ret64 _Getcvt() msvcp90._Getcvt
 @ stub _Getdateorder
 @ cdecl _Getwctype(long ptr) msvcp90._Getwctype
 @ cdecl _Getwctypes(ptr ptr ptr ptr) msvcp90._Getwctypes
diff --git a/dlls/msvcp60/msvcp60.spec b/dlls/msvcp60/msvcp60.spec
index 3c9e2ed..7af0c29 100644
--- a/dlls/msvcp60/msvcp60.spec
+++ b/dlls/msvcp60/msvcp60.spec
@@ -4274,9 +4274,9 @@
 @ stub _FSinh
 @ extern _FSnan msvcp90._FSnan
 # extern _FXbig
-@ cdecl _Getcoll() msvcp90._Getcoll
-@ cdecl _Getctype() msvcp90._Getctype
-@ cdecl _Getcvt() msvcp90._Getcvt
+@ cdecl -ret64 _Getcoll() msvcp90._Getcoll
+@ cdecl _Getctype(ptr) msvcp90._Getctype
+@ cdecl -ret64 _Getcvt() msvcp90._Getcvt
 @ extern _Hugeval msvcp90._Hugeval
 @ extern _Inf msvcp90._Inf
 @ stub _LCosh
diff --git a/dlls/msvcp70/msvcp70.spec b/dlls/msvcp70/msvcp70.spec
index efdced6..0964d83 100644
--- a/dlls/msvcp70/msvcp70.spec
+++ b/dlls/msvcp70/msvcp70.spec
@@ -5061,9 +5061,9 @@
 @ extern _FSnan msvcp90._FSnan
 # extern _FXbig
 # extern _FZero
-@ cdecl _Getcoll() msvcp90._Getcoll
-@ cdecl _Getctype() msvcp90._Getctype
-@ cdecl _Getcvt() msvcp90._Getcvt
+@ cdecl -ret64 _Getcoll() msvcp90._Getcoll
+@ cdecl _Getctype(ptr) msvcp90._Getctype
+@ cdecl -ret64 _Getcvt() msvcp90._Getcvt
 @ extern _Hugeval msvcp90._Hugeval
 @ extern _Inf msvcp90._Inf
 @ stub _LCosh
diff --git a/dlls/msvcp71/msvcp71.spec b/dlls/msvcp71/msvcp71.spec
index a38e1c4..671950b 100644
--- a/dlls/msvcp71/msvcp71.spec
+++ b/dlls/msvcp71/msvcp71.spec
@@ -5115,9 +5115,9 @@
 @ extern _FSnan msvcp90._FSnan
 # extern _FXbig
 # extern _FZero
-@ cdecl _Getcoll() msvcp90._Getcoll
-@ cdecl _Getctype() msvcp90._Getctype
-@ cdecl _Getcvt() msvcp90._Getcvt
+@ cdecl -ret64 _Getcoll() msvcp90._Getcoll
+@ cdecl _Getctype(ptr) msvcp90._Getctype
+@ cdecl -ret64 _Getcvt() msvcp90._Getcvt
 @ cdecl _Getwctype(long ptr) msvcp90._Getwctype
 @ cdecl _Getwctypes(ptr ptr ptr ptr) msvcp90._Getwctypes
 @ extern _Hugeval msvcp90._Hugeval
diff --git a/dlls/msvcp80/msvcp80.spec b/dlls/msvcp80/msvcp80.spec
index 2209c60..61a21ff 100644
--- a/dlls/msvcp80/msvcp80.spec
+++ b/dlls/msvcp80/msvcp80.spec
@@ -5724,9 +5724,9 @@
 @ stub _FSinh
 @ extern _FSnan msvcp90._FSnan
 # extern _FXbig
-@ cdecl _Getcoll() msvcp90._Getcoll
-@ cdecl _Getctype() msvcp90._Getctype
-@ cdecl _Getcvt() msvcp90._Getcvt
+@ cdecl -ret64 _Getcoll() msvcp90._Getcoll
+@ cdecl _Getctype(ptr) msvcp90._Getctype
+@ cdecl -ret64 _Getcvt() msvcp90._Getcvt
 @ stub _Getdateorder
 @ cdecl _Getwctype(long ptr) msvcp90._Getwctype
 @ cdecl _Getwctypes(ptr ptr ptr ptr) msvcp90._Getwctypes
diff --git a/dlls/msvcp90/locale.c b/dlls/msvcp90/locale.c
index 6fbe349..c8d4aca 100644
--- a/dlls/msvcp90/locale.c
+++ b/dlls/msvcp90/locale.c
@@ -542,17 +542,20 @@ _Locinfo* __thiscall _Locinfo__Addcats(_Locinfo *this, int category, const char
 }
 
 /* _Getcoll */
-_Collvec __cdecl _Getcoll(void)
+ULONGLONG __cdecl _Getcoll(void)
 {
-    _Collvec ret;
+    union {
+        _Collvec collvec;
+        ULONGLONG ull;
+    } ret;
     _locale_t locale = _get_current_locale();
 
     TRACE("\n");
 
-    ret.page = locale->locinfo->lc_collate_cp;
-    ret.handle = locale->locinfo->lc_handle[LC_COLLATE];
+    ret.collvec.page = locale->locinfo->lc_collate_cp;
+    ret.collvec.handle = locale->locinfo->lc_handle[LC_COLLATE];
     _free_locale(locale);
-    return ret;
+    return ret.ull;
 }
 
 /* ?_Getcoll at _Locinfo@std@@QBE?AU_Collvec@@XZ */
@@ -560,29 +563,29 @@ _Collvec __cdecl _Getcoll(void)
 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcoll, 8)
 _Collvec* __thiscall _Locinfo__Getcoll(const _Locinfo *this, _Collvec *ret)
 {
-    *ret = _Getcoll();
+    ULONGLONG ull = _Getcoll();
+    memcpy(ret, &ull, sizeof(ull));
     return ret;
 }
 
 /* _Getctype */
-_Ctypevec __cdecl _Getctype(void)
+_Ctypevec* __cdecl _Getctype(_Ctypevec *ret)
 {
-    _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.delfl = TRUE;
+    ret->page = locale->locinfo->lc_codepage;
+    ret->handle = locale->locinfo->lc_handle[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]));
-    ret.table = table;
+    ret->table = table;
     _free_locale(locale);
     return ret;
 }
@@ -592,22 +595,24 @@ _Ctypevec __cdecl _Getctype(void)
 DEFINE_THISCALL_WRAPPER(_Locinfo__Getctype, 8)
 _Ctypevec* __thiscall _Locinfo__Getctype(const _Locinfo *this, _Ctypevec *ret)
 {
-    *ret = _Getctype();
-    return ret;
+    return _Getctype(ret);
 }
 
 /* _Getcvt */
-_Cvtvec __cdecl _Getcvt(void)
+ULONGLONG __cdecl _Getcvt(void)
 {
-    _Cvtvec ret;
     _locale_t locale = _get_current_locale();
+    union {
+        _Cvtvec cvtvec;
+        ULONGLONG ull;
+    } ret;
 
     TRACE("\n");
 
-    ret.page = locale->locinfo->lc_codepage;
-    ret.handle = locale->locinfo->lc_handle[LC_CTYPE];
+    ret.cvtvec.page = locale->locinfo->lc_codepage;
+    ret.cvtvec.handle = locale->locinfo->lc_handle[LC_CTYPE];
     _free_locale(locale);
-    return ret;
+    return ret.ull;
 }
 
 /* ?_Getcvt at _Locinfo@std@@QBE?AU_Cvtvec@@XZ */
@@ -615,7 +620,8 @@ _Cvtvec __cdecl _Getcvt(void)
 DEFINE_THISCALL_WRAPPER(_Locinfo__Getcvt, 8)
 _Cvtvec* __thiscall _Locinfo__Getcvt(const _Locinfo *this, _Cvtvec *ret)
 {
-    *ret = _Getcvt();
+    ULONGLONG ull = _Getcvt();
+    memcpy(ret, &ull, sizeof(ull));
     return ret;
 }
 
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index c0eff7f..35fe11d 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -5750,9 +5750,9 @@
 @ stub _FSinh
 @ extern _FSnan
 # extern _FXbig
-@ cdecl _Getcoll()
-@ cdecl _Getctype()
-@ cdecl _Getcvt()
+@ cdecl -ret64 _Getcoll()
+@ cdecl _Getctype(ptr)
+@ cdecl -ret64 _Getcvt()
 @ stub _Getdateorder
 @ cdecl _Getwctype(long ptr)
 @ cdecl _Getwctypes(ptr ptr ptr ptr)
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 163fce0..f4811cd 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -3218,15 +3218,13 @@ basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate(basic_string_wc
 /* ??$?H_WU?$char_traits at _W@std@@V?$allocator at _W@1@@std@@YA?AV?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@0 at AEBV10@_W at Z */
 /* ??$?HGU?$char_traits at G@std@@V?$allocator at G@1@@std@@YA?AV?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@0 at ABV10@G at Z */
 /* ??$?HGU?$char_traits at G@std@@V?$allocator at G@1@@std@@YA?AV?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@0 at AEBV10@G at Z */
-basic_string_wchar __cdecl MSVCP_basic_string_wchar_concatenate_bstr_ch(
-        const basic_string_wchar *left, wchar_t right)
+basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_bstr_ch(
+        basic_string_wchar *ret, const basic_string_wchar *left, wchar_t right)
 {
-    basic_string_wchar ret = { 0 };
-
     TRACE("%p %c\n", left, right);
 
-    MSVCP_basic_string_wchar_copy_ctor(&ret, left);
-    MSVCP_basic_string_wchar_append_ch(&ret, right);
+    MSVCP_basic_string_wchar_copy_ctor(ret, left);
+    MSVCP_basic_string_wchar_append_ch(ret, right);
     return ret;
 }
 
@@ -3234,15 +3232,13 @@ basic_string_wchar __cdecl MSVCP_basic_string_wchar_concatenate_bstr_ch(
 /* ??$?H_WU?$char_traits at _W@std@@V?$allocator at _W@1@@std@@YA?AV?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@0 at _WAEBV10@@Z */
 /* ??$?HGU?$char_traits at G@std@@V?$allocator at G@1@@std@@YA?AV?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@0 at GABV10@@Z */
 /* ??$?HGU?$char_traits at G@std@@V?$allocator at G@1@@std@@YA?AV?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@0 at GAEBV10@@Z */
-basic_string_wchar __cdecl MSVCP_basic_string_wchar_concatenate_ch_bstr(
-        wchar_t left, const basic_string_wchar *right)
+basic_string_wchar* __cdecl MSVCP_basic_string_wchar_concatenate_ch_bstr(
+        basic_string_wchar* ret, wchar_t left, const basic_string_wchar *right)
 {
-    basic_string_wchar ret = { 0 };
-
     TRACE("%c %p\n", left, right);
 
-    MSVCP_basic_string_wchar_ctor_cstr_len(&ret, &left, 1);
-    MSVCP_basic_string_wchar_append(&ret, right);
+    MSVCP_basic_string_wchar_ctor_cstr_len(ret, &left, 1);
+    MSVCP_basic_string_wchar_append(ret, right);
     return ret;
 }
 




More information about the wine-cvs mailing list