mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-10 19:17:16 +00:00
webservices: Add support for item ranges.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d53d073ed6
commit
92cb3bc0e2
|
@ -2581,9 +2581,6 @@ static HRESULT read_type_repeating_element( struct reader *reader, const WS_FIEL
|
|||
|
||||
if (size != sizeof(void *)) return E_INVALIDARG;
|
||||
|
||||
if (desc->itemRange)
|
||||
FIXME( "ignoring range (%u-%u)\n", desc->itemRange->minItemCount, desc->itemRange->maxItemCount );
|
||||
|
||||
/* wrapper element */
|
||||
if (desc->localName && ((hr = read_node( reader )) != S_OK)) return hr;
|
||||
|
||||
|
@ -2616,29 +2613,17 @@ static HRESULT read_type_repeating_element( struct reader *reader, const WS_FIEL
|
|||
|
||||
if (desc->localName && ((hr = read_node( reader )) != S_OK)) return hr;
|
||||
|
||||
if (!nb_items)
|
||||
if (desc->itemRange && (nb_items < desc->itemRange->minItemCount || nb_items > desc->itemRange->maxItemCount))
|
||||
{
|
||||
TRACE( "number of items %u out of range (%u-%u)\n", nb_items, desc->itemRange->minItemCount,
|
||||
desc->itemRange->maxItemCount );
|
||||
ws_free( heap, buf );
|
||||
buf = NULL;
|
||||
}
|
||||
|
||||
switch (option)
|
||||
{
|
||||
case WS_READ_REQUIRED_POINTER:
|
||||
if (!nb_items) return WS_E_INVALID_FORMAT;
|
||||
/* fall through */
|
||||
|
||||
case WS_READ_OPTIONAL_POINTER:
|
||||
if (size != sizeof(void *)) return E_INVALIDARG;
|
||||
*ret = buf;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME( "read option %u not supported\n", option );
|
||||
return E_NOTIMPL;
|
||||
return WS_E_INVALID_FORMAT;
|
||||
}
|
||||
|
||||
*count = nb_items;
|
||||
*ret = buf;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,9 @@ static const char data12[] =
|
|||
"<service><id>2</id></service>"
|
||||
"</services>";
|
||||
|
||||
static const char data13[] =
|
||||
"<services></services>";
|
||||
|
||||
static void test_WsCreateError(void)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
@ -2659,6 +2662,7 @@ static void test_repeating_element(void)
|
|||
WS_HEAP *heap;
|
||||
WS_STRUCT_DESCRIPTION s, s2;
|
||||
WS_FIELD_DESCRIPTION f, f2, *fields[1], *fields2[1];
|
||||
WS_ITEM_RANGE range;
|
||||
struct service
|
||||
{
|
||||
UINT32 id;
|
||||
|
@ -2717,6 +2721,18 @@ static void test_repeating_element(void)
|
|||
ok( test->service[0].id == 1, "got %u\n", test->service[0].id );
|
||||
ok( test->service[1].id == 2, "got %u\n", test->service[1].id );
|
||||
|
||||
prepare_struct_type_test( reader, data13 );
|
||||
range.minItemCount = 0;
|
||||
range.maxItemCount = 1;
|
||||
f.itemRange = ⦥
|
||||
test = NULL;
|
||||
hr = WsReadType( reader, WS_ELEMENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
|
||||
WS_READ_REQUIRED_POINTER, heap, &test, sizeof(test), NULL );
|
||||
ok( hr == S_OK, "got %08x\n", hr );
|
||||
ok( test != NULL, "test not set\n" );
|
||||
ok( test->service != NULL, "service not set\n" );
|
||||
ok( !test->service_count, "got %u\n", test->service_count );
|
||||
|
||||
WsFreeReader( reader );
|
||||
WsFreeHeap( heap );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue