Piotr Caban : msvcp90: Added _String_base::Xinvarg implementation.

Alexandre Julliard julliard at winehq.org
Tue Aug 24 11:09:15 CDT 2010


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Aug 23 16:34:15 2010 +0200

msvcp90: Added _String_base::Xinvarg implementation.

---

 dlls/msvcp90/exception.c  |   98 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/msvcp90/msvcp90.h    |    3 +-
 dlls/msvcp90/msvcp90.spec |    2 +-
 dlls/msvcp90/string.c     |    9 ++++
 4 files changed, 110 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index b4c8bff..1b5552c 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -102,6 +102,7 @@ extern const vtable_ptr MSVCP_bad_alloc_vtable;
 extern const vtable_ptr MSVCP_logic_error_vtable;
 extern const vtable_ptr MSVCP_length_error_vtable;
 extern const vtable_ptr MSVCP_out_of_range_vtable;
+extern const vtable_ptr MSVCP_invalid_argument_vtable;
 
 /* exception class data */
 static type_info exception_type_info = {
@@ -611,6 +612,97 @@ static const cxx_exception_type out_of_range_cxx_type = {
     &out_of_range_cxx_type_table
 };
 
+/* invalid_argument class data */
+typedef logic_error invalid_argument;
+
+DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_ctor, 8)
+invalid_argument* __stdcall MSVCP_invalid_argument_ctor(
+        invalid_argument *this, const char **name)
+{
+    TRACE("%p %s\n", this, *name);
+    MSVCP_logic_error_ctor(this, name);
+    this->e.vtable = &MSVCP_invalid_argument_vtable;
+    return this;
+}
+
+DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_copy_ctor, 8)
+invalid_argument* __stdcall MSVCP_invalid_argument_copy_ctor(
+        invalid_argument *this, invalid_argument *rhs)
+{
+    TRACE("%p %p\n", this, rhs);
+    MSVCP_logic_error_copy_ctor(this, rhs);
+    this->e.vtable = &MSVCP_invalid_argument_vtable;
+    return this;
+}
+
+DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_vector_dtor, 8)
+void* __stdcall MSVCP_invalid_argument_vector_dtor(
+        invalid_argument *this, unsigned int flags)
+{
+    TRACE("%p %x\n", this, flags);
+    return MSVCP_logic_error_vector_dtor(this, flags);
+}
+
+static const type_info invalid_argument_type_info = {
+    &MSVCP_invalid_argument_vtable,
+    NULL,
+    ".?AVinvalid_argument at std@@"
+};
+
+static const rtti_base_descriptor invalid_argument_rtti_base_descriptor = {
+    &invalid_argument_type_info,
+    2,
+    { 0, -1, 0 },
+    64
+};
+
+static const rtti_base_array invalid_argument_rtti_base_array = {
+    {
+        &invalid_argument_rtti_base_descriptor,
+        &logic_error_rtti_base_descriptor,
+        &exception_rtti_base_descriptor
+    }
+};
+
+static const rtti_object_hierarchy invalid_argument_type_hierarchy = {
+    0,
+    0,
+    3,
+    &invalid_argument_rtti_base_array
+};
+
+const rtti_object_locator invalid_argument_rtti = {
+    0,
+    0,
+    0,
+    &invalid_argument_type_info,
+    &invalid_argument_type_hierarchy
+};
+
+static const cxx_type_info invalid_argument_cxx_type_info = {
+    0,
+    &invalid_argument_type_info,
+    { 0, -1, 0 },
+    sizeof(invalid_argument),
+    (cxx_copy_ctor)THISCALL(MSVCP_invalid_argument_copy_ctor)
+};
+
+static const cxx_type_info_table invalid_argument_cxx_type_table = {
+    3,
+    {
+        &invalid_argument_cxx_type_info,
+        &logic_error_cxx_type_info,
+        &exception_cxx_type_info
+    }
+};
+
+static const cxx_exception_type invalid_argument_cxx_type = {
+    0,
+    (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
+    NULL,
+    &invalid_argument_cxx_type_table
+};
+
 #ifndef __GNUC__
 void __asm_dummy_vtables(void) {
 #endif
@@ -618,6 +710,7 @@ void __asm_dummy_vtables(void) {
     __ASM_EXCEPTION_STRING_VTABLE(logic_error)
     __ASM_EXCEPTION_STRING_VTABLE(length_error)
     __ASM_EXCEPTION_STRING_VTABLE(out_of_range)
+    __ASM_EXCEPTION_STRING_VTABLE(invalid_argument)
 #ifndef __GNUC__
 }
 #endif
@@ -657,5 +750,10 @@ void throw_exception(exception_type et, const char *str)
         MSVCP_out_of_range_ctor(&e, &addr);
         _CxxThrowException((exception*)&e, &out_of_range_cxx_type);
     }
+    case EXCEPTION_INVALID_ARGUMENT: {
+        invalid_argument e;
+        MSVCP_invalid_argument_ctor(&e, &addr);
+        _CxxThrowException((exception*)&e, &invalid_argument_cxx_type);
+    }
     }
 }
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index bc3c73d..80b971a 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -62,7 +62,8 @@ typedef enum __exception_type {
     EXCEPTION_BAD_ALLOC,
     EXCEPTION_LOGIC_ERROR,
     EXCEPTION_LENGTH_ERROR,
-    EXCEPTION_OUT_OF_RANGE
+    EXCEPTION_OUT_OF_RANGE,
+    EXCEPTION_INVALID_ARGUMENT
 } exception_type;
 void throw_exception(exception_type, const char *);
 void set_exception_vtable(void);
diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index 898cac5..6f6544e 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -2877,7 +2877,7 @@
 @ stub ?_Xfunc at tr1@std@@YAXXZ
 @ stub -arch=win32 ?_Xinvalid at tr1@std@@YAXPBD at Z
 @ stub -arch=win64 ?_Xinvalid at tr1@std@@YAXPEBD at Z
-@ stub ?_Xinvarg at _String_base@std@@SAXXZ
+@ cdecl ?_Xinvarg at _String_base@std@@SAXXZ() MSVCP__String_base_Xinvarg
 @ cdecl ?_Xlen at _String_base@std@@SAXXZ() MSVCP__String_base_Xlen
 @ stub ?_Xmem at tr1@std@@YAXXZ
 @ stub ?_Xoutrange at tr1@std@@YAXXZ
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 97c47d0..0771903 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -485,6 +485,15 @@ void CDECL MSVCP__String_base_Xran(void)
     throw_exception(EXCEPTION_OUT_OF_RANGE, msg);
 }
 
+/* ?_Xinvarg at _String_base@std@@SAXXZ */
+void CDECL MSVCP__String_base_Xinvarg(void)
+{
+    static const char msg[] = "invalid string argument";
+
+    TRACE("\n");
+    throw_exception(EXCEPTION_INVALID_ARGUMENT, msg);
+}
+
 
 /* basic_string<char, char_traits<char>, allocator<char>> */
 /* ?npos@?$basic_string at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@2IB */




More information about the wine-cvs mailing list