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

webservices: Allow structures to be passed by value in WsWriteType.

parent 06fb21c5
...@@ -791,6 +791,21 @@ static void test_simple_struct_type(void) ...@@ -791,6 +791,21 @@ static void test_simple_struct_type(void)
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<struct>value</struct>", __LINE__ ); check_output( writer, "<struct>value</struct>", __LINE__ );
/* required value */
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
WS_WRITE_REQUIRED_VALUE, test, sizeof(*test), NULL );
ok( hr == S_OK, "got %08x\n", hr );
hr = WsWriteEndElement( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<struct>value</struct>", __LINE__ );
hr = set_output( writer ); hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr ); ok( hr == S_OK, "got %08x\n", hr );
......
...@@ -1695,9 +1695,7 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY ...@@ -1695,9 +1695,7 @@ static HRESULT write_type( struct writer *writer, WS_TYPE_MAPPING mapping, WS_TY
case WS_STRUCT_TYPE: case WS_STRUCT_TYPE:
{ {
const void *ptr; const void *ptr;
if (!desc) return E_INVALIDARG;
if (!desc || option == WS_WRITE_REQUIRED_VALUE) return E_INVALIDARG;
if (!option) option = WS_WRITE_REQUIRED_POINTER; if (!option) option = WS_WRITE_REQUIRED_POINTER;
if ((hr = get_value_ptr( option, value, size, (const void **)&ptr )) != S_OK) return hr; if ((hr = get_value_ptr( option, value, size, (const void **)&ptr )) != S_OK) return hr;
return write_type_struct( writer, mapping, desc, ptr ); return write_type_struct( writer, mapping, desc, ptr );
......
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