Piotr Caban : msvcp100: Add std::system_category() implementation.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 25 10:56:04 CST 2016


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Feb 25 10:47:41 2016 +0100

msvcp100: Add std::system_category() implementation.

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

---

 dlls/msvcp100/msvcp100.spec |  4 ++--
 dlls/msvcp90/misc.c         | 37 ++++++++++++++++++++++++++++++++++++-
 2 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcp100/msvcp100.spec b/dlls/msvcp100/msvcp100.spec
index 357ca83..62403d5 100644
--- a/dlls/msvcp100/msvcp100.spec
+++ b/dlls/msvcp100/msvcp100.spec
@@ -2731,8 +2731,8 @@
 @ thiscall -arch=win32 ?sync@?$basic_streambuf at _WU?$char_traits at _W@std@@@std@@MAEHXZ(ptr) basic_streambuf_wchar_sync
 @ cdecl -arch=win64 ?sync@?$basic_streambuf at _WU?$char_traits at _W@std@@@std@@MEAAHXZ(ptr) basic_streambuf_wchar_sync
 @ cdecl ?sync_with_stdio at ios_base@std@@SA_N_N at Z(long) ios_base_sync_with_stdio
-@ stub -arch=win32 ?system_category at std@@YAABVerror_category at 1@XZ
-@ stub -arch=win64 ?system_category at std@@YAAEBVerror_category at 1@XZ
+@ cdecl -arch=win32 ?system_category at std@@YAABVerror_category at 1@XZ() std_system_category
+@ cdecl -arch=win64 ?system_category at std@@YAAEBVerror_category at 1@XZ() std_system_category
 @ stub -arch=win32 ?table@?$ctype at D@std@@QBEPBFXZ
 @ stub -arch=win64 ?table@?$ctype at D@std@@QEBAPEBFXZ
 @ extern -arch=win32 ?table_size@?$ctype at D@std@@2IB ctype_char_table_size
diff --git a/dlls/msvcp90/misc.c b/dlls/msvcp90/misc.c
index b1348d5..7ec4f19 100644
--- a/dlls/msvcp90/misc.c
+++ b/dlls/msvcp90/misc.c
@@ -675,7 +675,6 @@ DEFINE_THISCALL_WRAPPER(custom_category_message, 12)
 basic_string_char* __thiscall custom_category_message(const custom_category *this,
         basic_string_char *ret, int err)
 {
-    if(err == 1) return MSVCP_basic_string_char_ctor_cstr(ret, "iostream error");
     return MSVCP_basic_string_char_ctor_cstr(ret, strerror(err));
 }
 
@@ -703,6 +702,14 @@ MSVCP_bool __thiscall custom_category_equivalent_code(custom_category *this,
     return FALSE;
 }
 
+DEFINE_THISCALL_WRAPPER(iostream_category_message, 12)
+basic_string_char* __thiscall iostream_category_message(const custom_category *this,
+        basic_string_char *ret, int err)
+{
+    if(err == 1) return MSVCP_basic_string_char_ctor_cstr(ret, "iostream error");
+    return MSVCP_basic_string_char_ctor_cstr(ret, strerror(err));
+}
+
 /* ?iostream_category at std@@YAABVerror_category at 1@XZ */
 /* ?iostream_category at std@@YAAEBVerror_category at 1@XZ */
 const error_category* __cdecl std_iostream_category(void)
@@ -710,6 +717,25 @@ const error_category* __cdecl std_iostream_category(void)
     TRACE("()\n");
     return &iostream_category.base;
 }
+
+static custom_category system_category;
+DEFINE_RTTI_DATA1(system_category, 0, &error_category_rtti_base_descriptor, ".?AV_System_error_category at std@@")
+
+extern const vtable_ptr MSVCP_system_category_vtable;
+
+static void system_category_ctor(custom_category *this)
+{
+    this->base.vtable = &MSVCP_system_category_vtable;
+    this->type = "system";
+}
+
+/* ?system_category at std@@YAABVerror_category at 1@XZ */
+/* ?system_category at std@@YAAEBVerror_category at 1@XZ */
+const error_category* __cdecl std_system_category(void)
+{
+    TRACE("()\n");
+    return &system_category.base;
+}
 #endif
 
 #if _MSVCP_VER >= 110
@@ -989,6 +1015,13 @@ void __asm_dummy_vtables(void) {
     __ASM_VTABLE(iostream_category,
             VTABLE_ADD_FUNC(custom_category_vector_dtor)
             VTABLE_ADD_FUNC(custom_category_name)
+            VTABLE_ADD_FUNC(iostream_category_message)
+            VTABLE_ADD_FUNC(custom_category_default_error_condition)
+            VTABLE_ADD_FUNC(custom_category_equivalent)
+            VTABLE_ADD_FUNC(custom_category_equivalent_code));
+    __ASM_VTABLE(system_category,
+            VTABLE_ADD_FUNC(custom_category_vector_dtor)
+            VTABLE_ADD_FUNC(custom_category_name)
             VTABLE_ADD_FUNC(custom_category_message)
             VTABLE_ADD_FUNC(custom_category_default_error_condition)
             VTABLE_ADD_FUNC(custom_category_equivalent)
@@ -1008,6 +1041,7 @@ void init_misc(void *base)
 #if _MSVCP_VER == 100
     init_error_category_rtti(base);
     init_iostream_category_rtti(base);
+    init_system_category_rtti(base);
 #endif
 #if _MSVCP_VER >= 110
     init__Pad_rtti(base);
@@ -1016,6 +1050,7 @@ void init_misc(void *base)
 
 #if _MSVCP_VER == 100
     iostream_category_ctor(&iostream_category);
+    system_category_ctor(&system_category);
 #endif
 }
 




More information about the wine-cvs mailing list