Piotr Caban : msvcp120: Fix tr2::sys::__Statvfs header for gcc.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Oct 30 08:22:25 CDT 2015


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Oct 29 17:58:12 2015 +0100

msvcp120: Fix tr2::sys::__Statvfs header for gcc.

__cdecl calling convention is not compatible between Visual C++ and GCC
when return is made in memory. In GCC callee pops the hidden argument
while in Visual C++ it's done by caller.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msvcp110/msvcp110.spec         |  8 ++++----
 dlls/msvcp120/msvcp120.spec         |  8 ++++----
 dlls/msvcp120/tests/msvcp120.c      | 12 ++++++------
 dlls/msvcp120_app/msvcp120_app.spec |  8 ++++----
 dlls/msvcp90/ios.c                  | 28 ++++++++++++++--------------
 5 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/dlls/msvcp110/msvcp110.spec b/dlls/msvcp110/msvcp110.spec
index 9fb938a..02ccf44 100644
--- a/dlls/msvcp110/msvcp110.spec
+++ b/dlls/msvcp110/msvcp110.spec
@@ -1761,10 +1761,10 @@
 @ cdecl -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEBDAEAH at Z(str ptr) tr2_sys__Stat
 @ stub -arch=win32 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PB_WAAH at Z
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) tr2_sys__Statvfs
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) tr2_sys__Statvfs
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) tr2_sys__Statvfs_wchar
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(ptr str) tr2_sys__Statvfs
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(ptr str) tr2_sys__Statvfs
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(ptr wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(ptr wstr) tr2_sys__Statvfs_wchar
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all
diff --git a/dlls/msvcp120/msvcp120.spec b/dlls/msvcp120/msvcp120.spec
index c25e2e4..5b7ac61 100644
--- a/dlls/msvcp120/msvcp120.spec
+++ b/dlls/msvcp120/msvcp120.spec
@@ -1722,10 +1722,10 @@
 @ cdecl -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEBDAEAH at Z(str ptr) tr2_sys__Stat
 @ stub -arch=win32 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PB_WAAH at Z
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) tr2_sys__Statvfs
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) tr2_sys__Statvfs
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) tr2_sys__Statvfs_wchar
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(ptr str) tr2_sys__Statvfs
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(ptr str) tr2_sys__Statvfs
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(ptr wstr) tr2_sys__Statvfs_wchar
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(ptr wstr) tr2_sys__Statvfs_wchar
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) Container_base0_Swap_all
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) Container_base0_Swap_all
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index fc69fd0..3f24d05 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -123,8 +123,8 @@ static int (__cdecl *p_tr2_sys__Copy_file)(char const*, char const*, MSVCP_bool)
 static int (__cdecl *p_tr2_sys__Copy_file_wchar)(WCHAR const*, WCHAR const*, MSVCP_bool);
 static int (__cdecl *p_tr2_sys__Rename)(char const*, char const*);
 static int (__cdecl *p_tr2_sys__Rename_wchar)(WCHAR const*, WCHAR const*);
-static struct space_info (__cdecl *p_tr2_sys__Statvfs)(char const*);
-static struct space_info (__cdecl *p_tr2_sys__Statvfs_wchar)(WCHAR const*);
+static struct space_info* (__cdecl *p_tr2_sys__Statvfs)(struct space_info*, char const*);
+static struct space_info* (__cdecl *p_tr2_sys__Statvfs_wchar)(struct space_info*, WCHAR const*);
 static enum file_type (__cdecl *p_tr2_sys__Stat)(char const*, int *);
 static enum file_type (__cdecl *p_tr2_sys__Lstat)(char const*, int *);
 static __int64 (__cdecl *p_tr2_sys__Last_write_time)(char const*);
@@ -984,15 +984,15 @@ static void test_tr2_sys__Statvfs(void)
     memset(current_path_wchar, 0, MAX_PATH);
     p_tr2_sys__Current_get_wchar(current_path_wchar);
 
-    info = p_tr2_sys__Statvfs(current_path);
+    p_tr2_sys__Statvfs(&info, current_path);
     ok(info.capacity >= info.free, "test_tr2_sys__Statvfs(): info.capacity < info.free\n");
     ok(info.free >= info.available, "test_tr2_sys__Statvfs(): info.free < info.available\n");
 
-    info = p_tr2_sys__Statvfs_wchar(current_path_wchar);
+    p_tr2_sys__Statvfs_wchar(&info, current_path_wchar);
     ok(info.capacity >= info.free, "tr2_sys__Statvfs_wchar(): info.capacity < info.free\n");
     ok(info.free >= info.available, "tr2_sys__Statvfs_wchar(): info.free < info.available\n");
 
-    info = p_tr2_sys__Statvfs(NULL);
+    p_tr2_sys__Statvfs(&info, NULL);
     ok(info.available == 0, "test_tr2_sys__Statvfs(): info.available expect: %d, got %s\n",
             0, debugstr_longlong(info.available));
     ok(info.capacity == 0, "test_tr2_sys__Statvfs(): info.capacity expect: %d, got %s\n",
@@ -1000,7 +1000,7 @@ static void test_tr2_sys__Statvfs(void)
     ok(info.free == 0, "test_tr2_sys__Statvfs(): info.free expect: %d, got %s\n",
             0, debugstr_longlong(info.free));
 
-    info = p_tr2_sys__Statvfs("not_exist");
+    p_tr2_sys__Statvfs(&info, "not_exist");
     ok(info.available == 0, "test_tr2_sys__Statvfs(): info.available expect: %d, got %s\n",
             0, debugstr_longlong(info.available));
     ok(info.capacity == 0, "test_tr2_sys__Statvfs(): info.capacity expect: %d, got %s\n",
diff --git a/dlls/msvcp120_app/msvcp120_app.spec b/dlls/msvcp120_app/msvcp120_app.spec
index 6fd94ae..2701eee 100644
--- a/dlls/msvcp120_app/msvcp120_app.spec
+++ b/dlls/msvcp120_app/msvcp120_app.spec
@@ -1722,10 +1722,10 @@
 @ cdecl -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEBDAEAH at Z(str ptr) msvcp120.?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEBDAEAH at Z
 @ stub -arch=win32 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PB_WAAH at Z
 @ stub -arch=win64 ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PEB_WAEAH at Z
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z
-@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
-@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z(ptr str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z(ptr str) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z
+@ cdecl -arch=win32 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z(ptr wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z
+@ cdecl -arch=win64 ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z(ptr wstr) msvcp120.?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z
 @ cdecl -arch=arm ?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QAAXAAU12@@Z
 @ thiscall -arch=i386 ?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QAEXAAU12@@Z
 @ cdecl -arch=win64 ?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z(ptr ptr) msvcp120.?_Swap_all at _Container_base0@std@@QEAAXAEAU12@@Z
diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c
index cabeaee..4005290 100644
--- a/dlls/msvcp90/ios.c
+++ b/dlls/msvcp90/ios.c
@@ -14329,20 +14329,20 @@ int __cdecl tr2_sys__Rename(char const* old_path, char const* new_path)
 
 /* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PBD at Z */
 /* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEBD at Z */
-struct space_info __cdecl tr2_sys__Statvfs(const char* path)
+struct space_info* __cdecl tr2_sys__Statvfs(struct space_info *ret, const char* path)
 {
     ULARGE_INTEGER available, total, free;
-    struct space_info info;
+
     TRACE("(%s)\n", debugstr_a(path));
 
     if(!path || !GetDiskFreeSpaceExA(path, &available, &total, &free)) {
-        info.capacity = info.free = info.available = 0;
+        ret->capacity = ret->free = ret->available = 0;
     }else {
-        info.capacity = total.QuadPart;
-        info.free = free.QuadPart;
-        info.available = available.QuadPart;
+        ret->capacity = total.QuadPart;
+        ret->free = free.QuadPart;
+        ret->available = available.QuadPart;
     }
-    return info;
+    return ret;
 }
 
 /* ?_Stat at sys@tr2 at std@@YA?AW4file_type at 123@PBDAAH at Z */
@@ -14919,20 +14919,20 @@ int __cdecl tr2_sys__Rename_wchar(WCHAR const* old_path, WCHAR const* new_path)
 
 /* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PB_W at Z */
 /* ?_Statvfs at sys@tr2 at std@@YA?AUspace_info at 123@PEB_W at Z */
-struct space_info __cdecl tr2_sys__Statvfs_wchar(const WCHAR* path)
+struct space_info* __cdecl tr2_sys__Statvfs_wchar(struct space_info *ret, const WCHAR* path)
 {
     ULARGE_INTEGER available, total, free;
-    struct space_info info;
+
     TRACE("(%s)\n", debugstr_w(path));
 
     if(!path || !GetDiskFreeSpaceExW(path, &available, &total, &free)) {
-        info.capacity = info.free = info.available = 0;
+        ret->capacity = ret->free = ret->available = 0;
     }else {
-        info.capacity = total.QuadPart;
-        info.free = free.QuadPart;
-        info.available = available.QuadPart;
+        ret->capacity = total.QuadPart;
+        ret->free = free.QuadPart;
+        ret->available = available.QuadPart;
     }
-    return info;
+    return ret;
 }
 
 /* ??1_Winit at std@@QAE at XZ */




More information about the wine-cvs mailing list