Commit c07f18fb authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

webservices/tests: Use the available ARRAY_SIZE() macro.

parent fb783bc6
......@@ -134,7 +134,7 @@ static void test_WsOpenChannel(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
addr.url.length = sizeof(url)/sizeof(url[0]);
addr.url.length = ARRAY_SIZE( url );
addr.url.chars = url;
hr = WsOpenChannel( NULL, &addr, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
......@@ -179,7 +179,7 @@ static void test_WsResetChannel(void)
ok( hr == S_OK, "got %08x\n", hr );
memset( &addr, 0, sizeof(addr) );
addr.url.length = sizeof(url)/sizeof(url[0]);
addr.url.length = ARRAY_SIZE( url );
addr.url.chars = url;
hr = WsOpenChannel( channel, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -301,7 +301,7 @@ static void test_WsOpenListener(void)
hr = WsOpenListener( listener, NULL, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
url.length = sizeof(str)/sizeof(str[0]);
url.length = ARRAY_SIZE( str );
url.chars = str;
hr = WsOpenListener( NULL, &url, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
......@@ -320,7 +320,7 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
url.length = sizeof(str2)/sizeof(str2[0]);
url.length = ARRAY_SIZE( str2 );
url.chars = str2;
hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -333,7 +333,7 @@ static void test_WsOpenListener(void)
hr = WsCreateListener( WS_CHANNEL_TYPE_DUPLEX_SESSION, WS_TCP_CHANNEL_BINDING, NULL, 0, NULL, &listener, NULL );
ok( hr == S_OK, "got %08x\n", hr );
url.length = sizeof(str3)/sizeof(str3[0]);
url.length = ARRAY_SIZE( str3 );
url.chars = str3;
hr = WsOpenListener( listener, &url, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -387,7 +387,7 @@ static void test_WsResetListener(void)
{
WCHAR str[] =
{'n','e','t','.','t','c','p',':','/','/','+',':','2','0','1','7','/','p','a','t','h'};
WS_STRING url = { sizeof(str)/sizeof(str[0]), str };
WS_STRING url = { ARRAY_SIZE( str ), str };
WS_LISTENER *listener;
WS_LISTENER_STATE state;
WS_LISTENER_PROPERTY prop;
......
......@@ -258,7 +258,7 @@ static void test_WsAddressMessage(void)
memset( &endpoint, 0, sizeof(endpoint) );
endpoint.url.chars = localhost;
endpoint.url.length = sizeof(localhost)/sizeof(localhost[0]);
endpoint.url.length = ARRAY_SIZE( localhost );
hr = WsAddressMessage( msg, &endpoint, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......
......@@ -164,7 +164,7 @@ static void test_WsOpenServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) );
addr.url.length = sizeof(url)/sizeof(url[0]);
addr.url.length = ARRAY_SIZE( url );
addr.url.chars = url;
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -206,7 +206,7 @@ static void test_WsResetServiceProxy(void)
ok( state == WS_SERVICE_PROXY_STATE_CREATED, "got %u\n", state );
memset( &addr, 0, sizeof(addr) );
addr.url.length = sizeof(url)/sizeof(url[0]);
addr.url.length = ARRAY_SIZE( url );
addr.url.chars = url;
hr = WsOpenServiceProxy( proxy, &addr, NULL, NULL );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -385,7 +385,7 @@ static HRESULT create_proxy( int port, WS_SERVICE_PROXY **ret )
*ret = NULL;
hr = WsCreateServiceProxy( WS_CHANNEL_TYPE_REQUEST, WS_HTTP_CHANNEL_BINDING, NULL, NULL,
0, prop, sizeof(prop)/sizeof(prop[0]), &proxy, NULL );
0, prop, ARRAY_SIZE( prop ), &proxy, NULL );
if (hr != S_OK) return hr;
memset( &addr, 0, sizeof(addr) );
......@@ -687,7 +687,7 @@ static DWORD CALLBACK server_proc( void *arg )
}
buf[i] = 0;
for (j = 0; j < sizeof(tests)/sizeof(tests[0]); j++)
for (j = 0; j < ARRAY_SIZE( tests ); j++)
{
if (strstr( buf, tests[j].req_action ))
{
......
......@@ -479,7 +479,7 @@ static void test_WsSetInput(void)
enc.encoding.encodingType = WS_XML_READER_ENCODING_TYPE_TEXT;
enc.charSet = WS_CHARSET_AUTO;
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
input.encodedData = tests[i].data;
input.encodedDataSize = tests[i].size;
......@@ -1174,7 +1174,7 @@ static void test_WsReadNode(void)
hr = WsCreateReader( NULL, 0, &reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_input( reader, tests[i].text, strlen(tests[i].text) );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -1644,7 +1644,7 @@ static void test_WsReadType(void)
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
enum_desc.values = enum_values;
enum_desc.valueCount = sizeof(enum_values)/sizeof(enum_values[0]);
enum_desc.valueCount = ARRAY_SIZE( enum_values );
enum_desc.maxByteCount = 3;
enum_desc.nameIndices = NULL;
......@@ -3526,7 +3526,7 @@ static void test_datetime(void)
hr = WsCreateReader( NULL, 0, &reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
memset( &date, 0, sizeof(date) );
prepare_type_test( reader, tests[i].str, strlen(tests[i].str) );
......@@ -3578,7 +3578,7 @@ static void test_WsDateTimeToFileTime(void)
hr = WsDateTimeToFileTime( NULL, &ft, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
memset( &ft, 0, sizeof(ft) );
hr = WsDateTimeToFileTime( &tests[i].dt, &ft, NULL );
......@@ -3716,7 +3716,7 @@ static void test_double(void)
hr = WsCreateReader( NULL, 0, &reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
val = 0;
prepare_type_test( reader, tests[i].str, strlen(tests[i].str) );
......@@ -4064,7 +4064,7 @@ static void test_entities(void)
hr = WsCreateReader( NULL, 0, &reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_input( reader, tests[i].str, strlen(tests[i].str) );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -4628,7 +4628,7 @@ static void test_WsReadQualifiedName(void)
hr = WsReadQualifiedName( reader, heap, NULL, &localname, NULL, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_input( reader, tests[i].str, strlen(tests[i].str) );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -5647,7 +5647,7 @@ static void test_dictionary(void)
UuidCreate( &dict.guid );
dict.strings = strings;
dict.stringCount = sizeof(strings)/sizeof(strings[0]);
dict.stringCount = ARRAY_SIZE( strings );
dict.isConst = TRUE;
/* short dictionary element */
......@@ -6385,7 +6385,7 @@ static void test_float(void)
hr = WsCreateReader( NULL, 0, &reader, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
val = 0;
prepare_type_test( reader, tests[i].str, strlen(tests[i].str) );
......
......@@ -131,7 +131,7 @@ static void test_WsDecodeUrl(void)
hr = WsDecodeUrl( &str, 0, NULL, (WS_URL **)&url, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
static const WCHAR netpipe[] = {'n','e','t','.','p','i','p','e'};
......@@ -271,7 +271,7 @@ static void test_WsEncodeUrl(void)
hr = WsEncodeUrl( (const WS_URL *)&url, 0, heap, NULL, NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
memset( &url, 0, sizeof(url) );
url.url.scheme = tests[i].scheme;
......
......@@ -710,7 +710,7 @@ static void test_basic_type(void)
ok( hr == S_OK, "got %08x\n", hr );
/* element content type mapping */
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
prepare_basic_type_test( writer );
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, tests[i].type, NULL,
......@@ -723,7 +723,7 @@ static void test_basic_type(void)
}
/* element type mapping is the same as element content type mapping for basic types */
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
const INT64 *ptr = &tests[i].val;
......@@ -738,7 +738,7 @@ static void test_basic_type(void)
}
/* attribute type mapping */
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
prepare_basic_type_test( writer );
hr = WsWriteStartAttribute( writer, NULL, &localname, &ns, FALSE, NULL );
......@@ -1103,7 +1103,7 @@ static void test_WsWriteValue(void)
ok( hr == E_INVALIDARG, "got %08x\n", hr );
/* element type mapping */
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -1120,7 +1120,7 @@ static void test_WsWriteValue(void)
}
/* attribute type mapping */
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -2170,7 +2170,7 @@ static void test_text_types(void)
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -2257,7 +2257,7 @@ static void test_double(void)
ok( hr == S_OK, "got %08x\n", hr );
text.text.textType = WS_XML_TEXT_TYPE_DOUBLE;
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -2772,7 +2772,7 @@ static void test_escapes(void)
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests_elem)/sizeof(tests_elem[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests_elem ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -2789,7 +2789,7 @@ static void test_escapes(void)
check_output( writer, tests_elem[i].result, __LINE__ );
}
for (i = 0; i < sizeof(tests_attr)/sizeof(tests_attr[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests_attr ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -2812,7 +2812,7 @@ static void test_escapes(void)
check_output( writer, tests_attr[i].result, __LINE__ );
}
for (i = 0; i < sizeof(tests_cdata)/sizeof(tests_cdata[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests_cdata ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -2835,7 +2835,7 @@ static void test_escapes(void)
check_output( writer, tests_cdata[i].result, __LINE__ );
}
for (i = 0; i < sizeof(tests_comment)/sizeof(tests_comment[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests_comment ); i++)
{
WS_XML_COMMENT_NODE comment = {{WS_XML_NODE_TYPE_COMMENT}};
......@@ -2954,7 +2954,7 @@ static void test_write_option(void)
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -3041,7 +3041,7 @@ static void test_datetime(void)
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
hr = set_output( writer );
ok( hr == S_OK, "got %08x\n", hr );
......@@ -3231,7 +3231,7 @@ static void test_WsWriteQualifiedName(void)
hr = WsWriteQualifiedName( writer, NULL, NULL, NULL, NULL );
ok( hr == WS_E_INVALID_FORMAT, "got %08x\n", hr );
for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( tests ); i++)
{
WS_XML_STRING prefix2, localname2, ns2;
const WS_XML_STRING *prefix_ptr, *localname_ptr, *ns_ptr;
......@@ -3551,7 +3551,7 @@ static void test_binary_encoding(void)
hr = WsCreateWriter( NULL, 0, &writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
for (i = 0; i < sizeof(elem_tests)/sizeof(elem_tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( elem_tests ); i++)
{
hr = WsSetOutput( writer, &bin.encoding, &buf.output, NULL, 0, NULL );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -3574,7 +3574,7 @@ static void test_binary_encoding(void)
if (hr == S_OK) check_output_bin( writer, elem_tests[i].result, elem_tests[i].len_result, __LINE__ );
}
for (i = 0; i < sizeof(attr_tests)/sizeof(attr_tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( attr_tests ); i++)
{
hr = WsSetOutput( writer, &bin.encoding, &buf.output, NULL, 0, NULL );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -3778,12 +3778,12 @@ static void test_dictionary(void)
UuidCreate( &dict.guid );
dict.strings = strings;
dict.stringCount = sizeof(strings)/sizeof(strings[0]);
dict.stringCount = ARRAY_SIZE( strings );
dict.isConst = TRUE;
bin.staticDictionary = &dict;
for (i = 0; i < sizeof(elem_tests)/sizeof(elem_tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( elem_tests ); i++)
{
hr = WsSetOutput( writer, &bin.encoding, &buf.output, NULL, 0, NULL );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......@@ -3799,7 +3799,7 @@ static void test_dictionary(void)
if (hr == S_OK) check_output_bin( writer, elem_tests[i].result, elem_tests[i].len_result, __LINE__ );
}
for (i = 0; i < sizeof(attr_tests)/sizeof(attr_tests[0]); i++)
for (i = 0; i < ARRAY_SIZE( attr_tests ); i++)
{
hr = WsSetOutput( writer, &bin.encoding, &buf.output, NULL, 0, NULL );
ok( hr == S_OK, "%u: got %08x\n", i, hr );
......
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