Piotr Caban : msvcp90: Added _String_base::Xlen implementation.
Alexandre Julliard
julliard at winehq.org
Fri Aug 20 10:19:13 CDT 2010
Module: wine
Branch: master
Commit: 1ba4fff9894c8b9145c2dbdea5026e55e6f0378a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1ba4fff9894c8b9145c2dbdea5026e55e6f0378a
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Aug 19 23:49:08 2010 +0200
msvcp90: Added _String_base::Xlen implementation.
---
dlls/msvcp90/exception.c | 99 +++++++++++++++++++++++++++++++++++++++++++++
dlls/msvcp90/msvcp90.h | 3 +-
dlls/msvcp90/msvcp90.spec | 2 +-
dlls/msvcp90/string.c | 11 +++++
4 files changed, 113 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcp90/exception.c b/dlls/msvcp90/exception.c
index 69da38a..d795b66 100644
--- a/dlls/msvcp90/exception.c
+++ b/dlls/msvcp90/exception.c
@@ -100,6 +100,7 @@ void CDECL _CxxThrowException(exception*,const cxx_exception_type*);
extern const vtable_ptr MSVCP_bad_alloc_vtable;
extern const vtable_ptr MSVCP_logic_error_vtable;
+extern const vtable_ptr MSVCP_length_error_vtable;
/* exception class data */
static type_info exception_type_info = {
@@ -427,11 +428,103 @@ static const cxx_exception_type logic_error_cxx_type = {
&logic_error_cxx_type_table
};
+/* length_error class data */
+typedef logic_error length_error;
+
+DEFINE_THISCALL_WRAPPER(MSVCP_length_error_ctor, 8)
+length_error* __stdcall MSVCP_length_error_ctor(
+ length_error *this, const char **name)
+{
+ TRACE("%p %s\n", this, *name);
+ MSVCP_logic_error_ctor(this, name);
+ this->e.vtable = &MSVCP_length_error_vtable;
+ return this;
+}
+
+DEFINE_THISCALL_WRAPPER(MSVCP_length_error_copy_ctor, 8)
+length_error* __stdcall MSVCP_length_error_copy_ctor(
+ length_error *this, length_error *rhs)
+{
+ TRACE("%p %p\n", this, rhs);
+ MSVCP_logic_error_copy_ctor(this, rhs);
+ this->e.vtable = &MSVCP_length_error_vtable;
+ return this;
+}
+
+DEFINE_THISCALL_WRAPPER(MSVCP_length_error_vector_dtor, 8)
+void* __stdcall MSVCP_length_error_vector_dtor(
+ length_error *this, unsigned int flags)
+{
+ TRACE("%p %x\n", this, flags);
+ return MSVCP_logic_error_vector_dtor(this, flags);
+}
+
+static const type_info length_error_type_info = {
+ &MSVCP_length_error_vtable,
+ NULL,
+ ".?AVlength_error at std@@"
+};
+
+static const rtti_base_descriptor length_error_rtti_base_descriptor = {
+ &length_error_type_info,
+ 2,
+ { 0, -1, 0 },
+ 64
+};
+
+static const rtti_base_array length_error_rtti_base_array = {
+ {
+ &length_error_rtti_base_descriptor,
+ &logic_error_rtti_base_descriptor,
+ &exception_rtti_base_descriptor
+ }
+};
+
+static const rtti_object_hierarchy length_error_type_hierarchy = {
+ 0,
+ 0,
+ 3,
+ &length_error_rtti_base_array
+};
+
+const rtti_object_locator length_error_rtti = {
+ 0,
+ 0,
+ 0,
+ &length_error_type_info,
+ &length_error_type_hierarchy
+};
+
+static const cxx_type_info length_error_cxx_type_info = {
+ 0,
+ &length_error_type_info,
+ { 0, -1, 0 },
+ sizeof(length_error),
+ (cxx_copy_ctor)THISCALL(MSVCP_length_error_copy_ctor)
+};
+
+static const cxx_type_info_table length_error_cxx_type_table = {
+ 3,
+ {
+ &length_error_cxx_type_info,
+ &logic_error_cxx_type_info,
+ &exception_cxx_type_info
+ }
+};
+
+static const cxx_exception_type length_error_cxx_type = {
+ 0,
+ (cxx_copy_ctor)THISCALL(MSVCP_logic_error_dtor),
+ NULL,
+ &length_error_cxx_type_table
+};
+
#ifndef __GNUC__
void __asm_dummy_vtables(void) {
#endif
__ASM_EXCEPTION_VTABLE(bad_alloc)
__ASM_EXCEPTION_STRING_VTABLE(logic_error)
+ __ASM_EXCEPTION_STRING_VTABLE(length_error)
#ifndef __GNUC__
}
#endif
@@ -460,5 +553,11 @@ void throw_exception(exception_type et, const char *str)
_CxxThrowException((exception*)&e, &logic_error_cxx_type);
return;
}
+ case EXCEPTION_LENGTH_ERROR: {
+ length_error e;
+ MSVCP_length_error_ctor(&e, &addr);
+ _CxxThrowException((exception*)&e, &length_error_cxx_type);
+ return;
+ }
}
}
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index b2e45bd..3c43117 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -60,7 +60,8 @@ typedef struct __exception
typedef enum __exception_type {
EXCEPTION,
EXCEPTION_BAD_ALLOC,
- EXCEPTION_LOGIC_ERROR
+ EXCEPTION_LOGIC_ERROR,
+ EXCEPTION_LENGTH_ERROR
} 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 0db56fa..4a442c6 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -2878,7 +2878,7 @@
@ 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
-@ stub ?_Xlen at _String_base@std@@SAXXZ
+@ cdecl ?_Xlen at _String_base@std@@SAXXZ() MSVCP__String_base_Xlen
@ stub ?_Xmem at tr1@std@@YAXXZ
@ stub ?_Xoutrange at tr1@std@@YAXXZ
@ stub ?_Xran at _String_base@std@@SAXXZ
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index b71af40..3b8fc66 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -466,6 +466,17 @@ unsigned short CDECL MSVCP_char_traits_short_not_eof(const unsigned short *in)
}
+/* _String_base */
+/* ?_Xlen at _String_base@std@@SAXXZ */
+void CDECL MSVCP__String_base_Xlen(void)
+{
+ static const char msg[] = "string too long";
+
+ TRACE("\n");
+ throw_exception(EXCEPTION_LENGTH_ERROR, 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 */
const size_t MSVCP_basic_string_char_npos = -1;
More information about the wine-cvs
mailing list