webservices: Implement WsXmlStringEquals.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2015-11-10 10:46:34 +01:00 committed by Alexandre Julliard
parent e86470d426
commit 4977635361
4 changed files with 65 additions and 1 deletions

View File

@ -1564,3 +1564,18 @@ HRESULT WINAPI WsSetInputToBuffer( WS_XML_READER *handle, WS_XML_BUFFER *buffer,
reader->read_bufptr = reader->input_data; reader->read_bufptr = reader->input_data;
return S_OK; 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;
}

View File

@ -1406,6 +1406,53 @@ static void test_WsGetXmlAttribute(void)
WsFreeHeap( heap ); 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) START_TEST(reader)
{ {
test_WsCreateError(); test_WsCreateError();
@ -1420,4 +1467,5 @@ START_TEST(reader)
test_WsReadNode(); test_WsReadNode();
test_WsReadType(); test_WsReadType();
test_WsGetXmlAttribute(); test_WsGetXmlAttribute();
test_WsXmlStringEquals();
} }

View File

@ -190,4 +190,4 @@
@ stub WsWriteXmlBuffer @ stub WsWriteXmlBuffer
@ stub WsWriteXmlBufferToBytes @ stub WsWriteXmlBufferToBytes
@ stub WsWriteXmlnsAttribute @ stub WsWriteXmlnsAttribute
@ stub WsXmlStringEquals @ stdcall WsXmlStringEquals(ptr ptr ptr)

View File

@ -498,6 +498,7 @@ HRESULT WINAPI WsWriteStartElement(WS_XML_WRITER*, const WS_XML_STRING*, const W
const WS_XML_STRING*, WS_ERROR*); const WS_XML_STRING*, WS_ERROR*);
HRESULT WINAPI WsWriteType(WS_XML_WRITER*, WS_TYPE_MAPPING, WS_TYPE, const void*, WS_WRITE_OPTION, HRESULT WINAPI WsWriteType(WS_XML_WRITER*, WS_TYPE_MAPPING, WS_TYPE, const void*, WS_WRITE_OPTION,
const void*, ULONG, WS_ERROR*); 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_ASYNC 0x003d0000
#define WS_S_END 0x003d0001 #define WS_S_END 0x003d0001