[1/8] webservices: Implement WsXmlStringEquals.

Hans Leidekker hans at codeweavers.com
Tue Nov 10 03:46:34 CST 2015


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/webservices/reader.c         | 15 ++++++++++++
 dlls/webservices/tests/reader.c   | 48 +++++++++++++++++++++++++++++++++++++++
 dlls/webservices/webservices.spec |  2 +-
 include/webservices.h             |  1 +
 4 files changed, 65 insertions(+), 1 deletion(-)

diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index aeba36c..4195184 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -1564,3 +1564,18 @@ HRESULT WINAPI WsSetInputToBuffer( WS_XML_READER *handle, WS_XML_BUFFER *buffer,
     reader->read_bufptr = reader->input_data;
     return S_OK;
 }
+
+/**************************************************************************
+ *          WsXmlStringEquals		[webservices.@]
+ */
+HRESULT WINAPI WsXmlStringEquals( const WS_XML_STRING *str1, const WS_XML_STRING *str2, WS_ERROR *error )
+{
+    TRACE( "%s %s %p\n", debugstr_xmlstr(str1), debugstr_xmlstr(str2), error );
+    if (error) FIXME( "ignoring error parameter\n" );
+
+    if (!str1 || !str2) return E_INVALIDARG;
+
+    if (str1->length != str2->length) return S_FALSE;
+    if (!memcmp( str1->bytes, str2->bytes, str1->length )) return S_OK;
+    return S_FALSE;
+}
diff --git a/dlls/webservices/tests/reader.c b/dlls/webservices/tests/reader.c
index 3f23d90..1f9558c 100644
--- a/dlls/webservices/tests/reader.c
+++ b/dlls/webservices/tests/reader.c
@@ -1406,6 +1406,53 @@ static void test_WsGetXmlAttribute(void)
     WsFreeHeap( heap );
 }
 
+static void test_WsXmlStringEquals(void)
+{
+    BYTE bom[] = {0xef,0xbb,0xbf};
+    WS_XML_STRING str1 = {0, NULL}, str2 = {0, NULL};
+    HRESULT hr;
+
+    hr = WsXmlStringEquals( NULL, NULL, NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsXmlStringEquals( &str1, NULL, NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsXmlStringEquals( NULL, &str2, NULL );
+    ok( hr == E_INVALIDARG, "got %08x\n", hr );
+
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    str1.length = 1;
+    str1.bytes  = (BYTE *)"a";
+    hr = WsXmlStringEquals( &str1, &str1, NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+
+    str2.length = 1;
+    str2.bytes  = (BYTE *)"b";
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_FALSE, "got %08x\n", hr );
+
+    str2.length = 1;
+    str2.bytes  = bom;
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_FALSE, "got %08x\n", hr );
+
+    str1.length = 3;
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_FALSE, "got %08x\n", hr );
+
+    str2.length = 3;
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_FALSE, "got %08x\n", hr );
+
+    str1.length = 3;
+    str1.bytes  = bom;
+    hr = WsXmlStringEquals( &str1, &str2, NULL );
+    ok( hr == S_OK, "got %08x\n", hr );
+}
+
 START_TEST(reader)
 {
     test_WsCreateError();
@@ -1420,4 +1467,5 @@ START_TEST(reader)
     test_WsReadNode();
     test_WsReadType();
     test_WsGetXmlAttribute();
+    test_WsXmlStringEquals();
 }
diff --git a/dlls/webservices/webservices.spec b/dlls/webservices/webservices.spec
index 6e0f4f2..3378ea9 100644
--- a/dlls/webservices/webservices.spec
+++ b/dlls/webservices/webservices.spec
@@ -190,4 +190,4 @@
 @ stub WsWriteXmlBuffer
 @ stub WsWriteXmlBufferToBytes
 @ stub WsWriteXmlnsAttribute
-@ stub WsXmlStringEquals
+@ stdcall WsXmlStringEquals(ptr ptr ptr)
diff --git a/include/webservices.h b/include/webservices.h
index 8bef315..a6e892e 100644
--- a/include/webservices.h
+++ b/include/webservices.h
@@ -498,6 +498,7 @@ HRESULT WINAPI WsWriteStartElement(WS_XML_WRITER*, const WS_XML_STRING*, const W
                                    const WS_XML_STRING*, WS_ERROR*);
 HRESULT WINAPI WsWriteType(WS_XML_WRITER*, WS_TYPE_MAPPING, WS_TYPE, const void*, WS_WRITE_OPTION,
                            const void*, ULONG, WS_ERROR*);
+HRESULT WINAPI WsXmlStringEquals(const WS_XML_STRING*, const WS_XML_STRING*, WS_ERROR*);
 
 #define WS_S_ASYNC                          0x003d0000
 #define WS_S_END                            0x003d0001
-- 
2.6.2




More information about the wine-patches mailing list