Commit 49776353 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Implement WsXmlStringEquals.

parent e86470d4
......@@ -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;
}
......@@ -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();
}
......@@ -190,4 +190,4 @@
@ stub WsWriteXmlBuffer
@ stub WsWriteXmlBufferToBytes
@ stub WsWriteXmlnsAttribute
@ stub WsXmlStringEquals
@ stdcall WsXmlStringEquals(ptr ptr ptr)
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment