webservices: Implement WsReadValue.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ec0cae49d2
commit
177d8d781f
|
@ -3615,6 +3615,24 @@ HRESULT WINAPI WsReadElement( WS_XML_READER *handle, const WS_ELEMENT_DESCRIPTIO
|
|||
desc->elementNs, desc->typeDescription, option, heap, value, size );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsReadValue [webservices.@]
|
||||
*/
|
||||
HRESULT WINAPI WsReadValue( WS_XML_READER *handle, WS_VALUE_TYPE value_type, void *value, ULONG size,
|
||||
WS_ERROR *error )
|
||||
{
|
||||
struct reader *reader = (struct reader *)handle;
|
||||
WS_TYPE type = map_value_type( value_type );
|
||||
|
||||
TRACE( "%p %u %p %u %p\n", handle, type, value, size, error );
|
||||
if (error) FIXME( "ignoring error parameter\n" );
|
||||
|
||||
if (!reader || !value || type == ~0u) return E_INVALIDARG;
|
||||
|
||||
return read_type( reader, WS_ELEMENT_TYPE_MAPPING, type, NULL, NULL, NULL, WS_READ_REQUIRED_VALUE,
|
||||
NULL, value, size );
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* WsSetErrorProperty [webservices.@]
|
||||
*/
|
||||
|
|
|
@ -3308,6 +3308,57 @@ static void test_WsReadElement(void)
|
|||
WsFreeReader( reader );
|
||||
}
|
||||
|
||||
static void test_WsReadValue(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
WS_XML_READER *reader;
|
||||
UINT32 val;
|
||||
|
||||
hr = WsCreateReader( NULL, 0, &reader, NULL ) ;
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
prepare_struct_type_test( reader, "<t>1</t>" );
|
||||
hr = WsReadValue( NULL, WS_UINT32_TYPE, &val, sizeof(val), NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
prepare_struct_type_test( reader, "<t>1</t>" );
|
||||
hr = WsReadValue( reader, WS_UINT32_TYPE, NULL, sizeof(val), NULL );
|
||||
ok( hr == E_INVALIDARG, "got %08x\n", hr );
|
||||
|
||||
/* reader must be positioned correctly */
|
||||
prepare_struct_type_test( reader, "<t>1</t>" );
|
||||
hr = WsReadValue( reader, WS_UINT32_TYPE, &val, sizeof(val), NULL );
|
||||
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
|
||||
|
||||
prepare_struct_type_test( reader, "<t>1</t>" );
|
||||
hr = WsReadToStartElement( reader, NULL, NULL, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsReadValue( reader, WS_UINT32_TYPE, &val, sizeof(val), NULL );
|
||||
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
|
||||
|
||||
prepare_struct_type_test( reader, "<t>1</t>" );
|
||||
hr = WsReadToStartElement( reader, NULL, NULL, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsReadStartElement( reader, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
val = 0xdeadbeef;
|
||||
hr = WsReadValue( reader, WS_UINT32_TYPE, &val, sizeof(val), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( val == 1, "got %u\n", val );
|
||||
|
||||
prepare_struct_type_test( reader, "<u t='1'></u>" );
|
||||
hr = WsReadToStartElement( reader, NULL, NULL, NULL, NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
|
||||
hr = WsReadValue( reader, WS_UINT32_TYPE, &val, sizeof(val), NULL );
|
||||
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
|
||||
|
||||
WsFreeReader( reader );
|
||||
}
|
||||
|
||||
START_TEST(reader)
|
||||
{
|
||||
test_WsCreateError();
|
||||
|
@ -3338,4 +3389,5 @@ START_TEST(reader)
|
|||
test_WsFileTimeToDateTime();
|
||||
test_double();
|
||||
test_WsReadElement();
|
||||
test_WsReadValue();
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@
|
|||
@ stdcall WsReadStartElement(ptr ptr)
|
||||
@ stdcall WsReadToStartElement(ptr ptr ptr ptr ptr)
|
||||
@ stdcall WsReadType(ptr long long ptr long ptr ptr long ptr)
|
||||
@ stub WsReadValue
|
||||
@ stdcall WsReadValue(ptr long ptr long ptr)
|
||||
@ stub WsReadXmlBuffer
|
||||
@ stub WsReadXmlBufferFromBytes
|
||||
@ stub WsReceiveMessage
|
||||
|
|
|
@ -32,6 +32,7 @@ WS_XML_STRING *alloc_xml_string( const unsigned char *, ULONG ) DECLSPEC_HIDDEN;
|
|||
WS_XML_UTF8_TEXT *alloc_utf8_text( const unsigned char *, ULONG ) DECLSPEC_HIDDEN;
|
||||
HRESULT append_attribute( WS_XML_ELEMENT_NODE *, WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN;
|
||||
void free_attribute( WS_XML_ATTRIBUTE * ) DECLSPEC_HIDDEN;
|
||||
WS_TYPE map_value_type( WS_VALUE_TYPE ) DECLSPEC_HIDDEN;
|
||||
|
||||
struct node
|
||||
{
|
||||
|
|
|
@ -1559,7 +1559,7 @@ HRESULT WINAPI WsWriteType( WS_XML_WRITER *handle, WS_TYPE_MAPPING mapping, WS_T
|
|||
return hr;
|
||||
}
|
||||
|
||||
static WS_TYPE map_value_type( WS_VALUE_TYPE type )
|
||||
WS_TYPE map_value_type( WS_VALUE_TYPE type )
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue