Piotr Caban : msvcp90: Added basic_string<wchar>::compare implementation.

Alexandre Julliard julliard at winehq.org
Thu Nov 25 11:18:52 CST 2010


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Wed Nov 24 19:59:26 2010 +0100

msvcp90: Added basic_string<wchar>::compare implementation.

---

 dlls/msvcp90/msvcp90.spec |   24 ++++++------
 dlls/msvcp90/string.c     |   91 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 103 insertions(+), 12 deletions(-)

diff --git a/dlls/msvcp90/msvcp90.spec b/dlls/msvcp90/msvcp90.spec
index c4defd2..8dd5d8a 100644
--- a/dlls/msvcp90/msvcp90.spec
+++ b/dlls/msvcp90/msvcp90.spec
@@ -3138,18 +3138,18 @@
 @ stub -arch=win64 ?compare@?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@std@@QEBAH_K0PEBG0 at Z
 @ stub -arch=win32 ?compare@?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@std@@QBEHPBG at Z
 @ stub -arch=win64 ?compare@?$basic_string at GU?$char_traits at G@std@@V?$allocator at G@2@@std@@QEBAH_K0PEBG at Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHABV12@@Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHAEBV12@@Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12@@Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHPEB_W at Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12 at II@Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12 at 00@Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_W at Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12@@Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_WI at Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W0 at Z
-@ stub -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHPB_W at Z
-@ stub -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W at Z
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHABV12@@Z(ptr ptr) MSVCP_basic_string_wchar_compare
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHAEBV12@@Z(ptr ptr) MSVCP_basic_string_wchar_compare
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12@@Z(ptr long long ptr) MSVCP_basic_string_wchar_compare_substr
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHPEB_W at Z(ptr ptr) MSVCP_basic_string_wchar_compare_cstr
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12 at II@Z(ptr long long ptr long long) MSVCP_basic_string_wchar_compare_substr_substr
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12 at 00@Z(ptr long long ptr long long) MSVCP_basic_string_wchar_compare_substr_substr
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_W at Z(ptr long long ptr) MSVCP_basic_string_wchar_compare_substr_cstr
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12@@Z(ptr long long ptr) MSVCP_basic_string_wchar_compare_substr
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_WI at Z(ptr long long ptr long) MSVCP_basic_string_wchar_compare_substr_cstr_len
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W0 at Z(ptr long long ptr long) MSVCP_basic_string_wchar_compare_substr_cstr_len
+@ thiscall -arch=win32 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHPB_W at Z(ptr ptr) MSVCP_basic_string_wchar_compare_cstr
+@ cdecl -arch=win64 ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W at Z(ptr long long ptr) MSVCP_basic_string_wchar_compare_substr_cstr
 @ cdecl -arch=win32 ?compare@?$char_traits at D@std@@SAHPBD0I at Z(ptr ptr long) MSVCP_char_traits_char_compare
 @ cdecl -arch=win64 ?compare@?$char_traits at D@std@@SAHPEBD0_K at Z(ptr ptr long) MSVCP_char_traits_char_compare
 @ cdecl -arch=win32 ?compare@?$char_traits at G@std@@SAHPBG0I at Z(ptr ptr long) MSVCP_char_traits_short_compare
diff --git a/dlls/msvcp90/string.c b/dlls/msvcp90/string.c
index 49751fe..b7d0a2e 100644
--- a/dlls/msvcp90/string.c
+++ b/dlls/msvcp90/string.c
@@ -1241,3 +1241,94 @@ DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_append, 8)
     return MSVCP_basic_string_wchar_append_substr(this, append,
             0, MSVCP_basic_string_wchar_npos);
 }
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_WI at Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W0 at Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_cstr_len, 20)
+int __thiscall MSVCP_basic_string_wchar_compare_substr_cstr_len(
+        basic_string_wchar *this, size_t pos, size_t num,
+        const wchar_t *str, size_t count)
+{
+    int ans;
+
+    TRACE("%p %lu %lu %s %lu\n", this, (unsigned long)pos,
+            (unsigned long)num, debugstr_w(str), (unsigned long)count);
+
+    if(this->size < pos)
+        MSVCP__String_base_Xran();
+
+    if(pos+num > this->size)
+        num = this->size-pos;
+
+    ans = MSVCP_char_traits_wchar_compare(basic_string_wchar_ptr(this)+pos,
+            str, num>count ? count : num);
+    if(ans)
+        return ans;
+
+    if(num > count)
+        ans = 1;
+    else if(num < count)
+        ans = -1;
+    return ans;
+}
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIPB_W at Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0PEB_W at Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_cstr, 16)
+int __thiscall MSVCP_basic_string_wchar_compare_substr_cstr(basic_string_wchar *this,
+        size_t pos, size_t num, const wchar_t *str)
+{
+    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
+            str, MSVCP_char_traits_wchar_length(str));
+}
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHPB_W at Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHPEB_W at Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_cstr, 8)
+int __thiscall MSVCP_basic_string_wchar_compare_cstr(
+        basic_string_wchar *this, const wchar_t *str)
+{
+    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, 0, this->size,
+            str, MSVCP_char_traits_wchar_length(str));
+}
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12 at II@Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12 at 00@Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr_substr, 24)
+int __thiscall MSVCP_basic_string_wchar_compare_substr_substr(
+        basic_string_wchar *this, size_t pos, size_t num,
+        basic_string_wchar *compare, size_t off, size_t count)
+{
+    TRACE("%p %lu %lu %p %lu %lu\n", this, (unsigned long)pos, (unsigned long)num,
+            compare, (unsigned long)off, (unsigned long)count);
+
+    if(compare->size < off)
+        MSVCP__String_base_Xran();
+
+    if(off+count > compare->size)
+        count = compare->size-off;
+
+    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
+            basic_string_wchar_ptr(compare)+off, count);
+}
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHIIABV12@@Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAH_K0AEBV12@@Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare_substr, 16)
+int __thiscall MSVCP_basic_string_wchar_compare_substr(
+        basic_string_wchar *this, size_t pos, size_t num,
+        basic_string_wchar *compare)
+{
+    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, pos, num,
+            basic_string_wchar_ptr(compare), compare->size);
+}
+
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QBEHABV12@@Z */
+/* ?compare@?$basic_string at _WU?$char_traits at _W@std@@V?$allocator at _W@2@@std@@QEBAHAEBV12@@Z */
+DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_wchar_compare, 8)
+int __thiscall MSVCP_basic_string_wchar_compare(
+        basic_string_wchar *this, basic_string_wchar *compare)
+{
+    return MSVCP_basic_string_wchar_compare_substr_cstr_len(this, 0, this->size,
+            basic_string_wchar_ptr(compare), compare->size);
+}




More information about the wine-cvs mailing list