Michael Stefaniuc : webservices: Use the ARRAY_SIZE() macro.
Alexandre Julliard
julliard at winehq.org
Wed Sep 12 16:40:34 CDT 2018
Module: wine
Branch: master
Commit: 9d52b5f8479ae375cbee8e03f4d8b34740e6724f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9d52b5f8479ae375cbee8e03f4d8b34740e6724f
Author: Michael Stefaniuc <mstefani at winehq.org>
Date: Tue Sep 11 22:08:08 2018 +0200
webservices: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/channel.c | 4 ++--
dlls/webservices/error.c | 4 ++--
dlls/webservices/heap.c | 4 ++--
dlls/webservices/listener.c | 4 ++--
dlls/webservices/msg.c | 6 +++---
dlls/webservices/proxy.c | 4 ++--
dlls/webservices/reader.c | 4 ++--
dlls/webservices/string.c | 2 +-
dlls/webservices/url.c | 20 ++++++++++----------
dlls/webservices/writer.c | 4 ++--
10 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/dlls/webservices/channel.c b/dlls/webservices/channel.c
index 5963faf..0cd8b91 100644
--- a/dlls/webservices/channel.c
+++ b/dlls/webservices/channel.c
@@ -236,14 +236,14 @@ struct channel
ULONG read_buflen;
ULONG read_size;
ULONG prop_count;
- struct prop prop[sizeof(channel_props)/sizeof(channel_props[0])];
+ struct prop prop[ARRAY_SIZE( channel_props )];
};
#define CHANNEL_MAGIC (('C' << 24) | ('H' << 16) | ('A' << 8) | 'N')
static struct channel *alloc_channel(void)
{
- static const ULONG count = sizeof(channel_props)/sizeof(channel_props[0]);
+ static const ULONG count = ARRAY_SIZE( channel_props );
struct channel *ret;
ULONG size = sizeof(*ret) + prop_size( channel_props, count );
diff --git a/dlls/webservices/error.c b/dlls/webservices/error.c
index e4292db..780040e 100644
--- a/dlls/webservices/error.c
+++ b/dlls/webservices/error.c
@@ -42,14 +42,14 @@ struct error
ULONG magic;
CRITICAL_SECTION cs;
ULONG prop_count;
- struct prop prop[sizeof(error_props)/sizeof(error_props[0])];
+ struct prop prop[ARRAY_SIZE( error_props )];
};
#define ERROR_MAGIC (('E' << 24) | ('R' << 16) | ('R' << 8) | 'O')
static struct error *alloc_error(void)
{
- static const ULONG count = sizeof(error_props)/sizeof(error_props[0]);
+ static const ULONG count = ARRAY_SIZE( error_props );
struct error *ret;
ULONG size = sizeof(*ret) + prop_size( error_props, count );
diff --git a/dlls/webservices/heap.c b/dlls/webservices/heap.c
index e44cf72..93e647a 100644
--- a/dlls/webservices/heap.c
+++ b/dlls/webservices/heap.c
@@ -46,7 +46,7 @@ struct heap
SIZE_T max_size;
SIZE_T allocated;
ULONG prop_count;
- struct prop prop[sizeof(heap_props)/sizeof(heap_props[0])];
+ struct prop prop[ARRAY_SIZE( heap_props )];
};
#define HEAP_MAGIC (('H' << 24) | ('E' << 16) | ('A' << 8) | 'P')
@@ -177,7 +177,7 @@ HRESULT WINAPI WsAlloc( WS_HEAP *handle, SIZE_T size, void **ptr, WS_ERROR *erro
static struct heap *alloc_heap(void)
{
- static const ULONG count = sizeof(heap_props)/sizeof(heap_props[0]);
+ static const ULONG count = ARRAY_SIZE( heap_props );
struct heap *ret;
ULONG size = sizeof(*ret) + prop_size( heap_props, count );
diff --git a/dlls/webservices/listener.c b/dlls/webservices/listener.c
index 357a1c6..0189059 100644
--- a/dlls/webservices/listener.c
+++ b/dlls/webservices/listener.c
@@ -113,14 +113,14 @@ struct listener
} udp;
} u;
ULONG prop_count;
- struct prop prop[sizeof(listener_props)/sizeof(listener_props[0])];
+ struct prop prop[ARRAY_SIZE( listener_props )];
};
#define LISTENER_MAGIC (('L' << 24) | ('I' << 16) | ('S' << 8) | 'T')
static struct listener *alloc_listener(void)
{
- static const ULONG count = sizeof(listener_props)/sizeof(listener_props[0]);
+ static const ULONG count = ARRAY_SIZE( listener_props );
struct listener *ret;
ULONG size = sizeof(*ret) + prop_size( listener_props, count );
diff --git a/dlls/webservices/msg.c b/dlls/webservices/msg.c
index 19a1076..0706346 100644
--- a/dlls/webservices/msg.c
+++ b/dlls/webservices/msg.c
@@ -83,7 +83,7 @@ struct msg
WS_PROXY_MESSAGE_CALLBACK_CONTEXT ctx_send;
WS_PROXY_MESSAGE_CALLBACK_CONTEXT ctx_receive;
ULONG prop_count;
- struct prop prop[sizeof(msg_props)/sizeof(msg_props[0])];
+ struct prop prop[ARRAY_SIZE( msg_props )];
};
#define MSG_MAGIC (('M' << 24) | ('E' << 16) | ('S' << 8) | 'S')
@@ -91,7 +91,7 @@ struct msg
static struct msg *alloc_msg(void)
{
- static const ULONG count = sizeof(msg_props)/sizeof(msg_props[0]);
+ static const ULONG count = ARRAY_SIZE( msg_props );
struct msg *ret;
ULONG size = sizeof(*ret) + prop_size( msg_props, count );
@@ -1785,7 +1785,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
case WS_ENVELOPE_VERSION_SOAP_1_2:
{
static const WCHAR actionW[] = {'a','c','t','i','o','n','=','"'};
- ULONG len_action = sizeof(actionW)/sizeof(actionW[0]);
+ ULONG len_action = ARRAY_SIZE( actionW );
if (!(len = MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, NULL, 0 )))
break;
diff --git a/dlls/webservices/proxy.c b/dlls/webservices/proxy.c
index da30cb0..5122892 100644
--- a/dlls/webservices/proxy.c
+++ b/dlls/webservices/proxy.c
@@ -48,14 +48,14 @@ struct proxy
WS_SERVICE_PROXY_STATE state;
WS_CHANNEL *channel;
ULONG prop_count;
- struct prop prop[sizeof(proxy_props)/sizeof(proxy_props[0])];
+ struct prop prop[ARRAY_SIZE( proxy_props )];
};
#define PROXY_MAGIC (('P' << 24) | ('R' << 16) | ('O' << 8) | 'X')
static struct proxy *alloc_proxy(void)
{
- static const ULONG count = sizeof(proxy_props)/sizeof(proxy_props[0]);
+ static const ULONG count = ARRAY_SIZE( proxy_props );
struct proxy *ret;
ULONG size = sizeof(*ret) + prop_size( proxy_props, count );
diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
index 087ad0a..296043f 100644
--- a/dlls/webservices/reader.c
+++ b/dlls/webservices/reader.c
@@ -397,14 +397,14 @@ struct reader
const WS_XML_DICTIONARY *dict_static;
WS_XML_DICTIONARY *dict;
ULONG prop_count;
- struct prop prop[sizeof(reader_props)/sizeof(reader_props[0])];
+ struct prop prop[ARRAY_SIZE( reader_props )];
};
#define READER_MAGIC (('R' << 24) | ('E' << 16) | ('A' << 8) | 'D')
static struct reader *alloc_reader(void)
{
- static const ULONG count = sizeof(reader_props)/sizeof(reader_props[0]);
+ static const ULONG count = ARRAY_SIZE( reader_props );
struct reader *ret;
ULONG size = sizeof(*ret) + prop_size( reader_props, count );
diff --git a/dlls/webservices/string.c b/dlls/webservices/string.c
index 0bb77df..42af8fd 100644
--- a/dlls/webservices/string.c
+++ b/dlls/webservices/string.c
@@ -791,7 +791,7 @@ static const ULONG dict_sorted[] =
const struct dictionary dict_builtin_static =
{
{{0xf93578f8,0x5852,0x4eb7,{0xa6,0xfc,0xe7,0x2b,0xb7,0x1d,0xb6,0x22}},
- (WS_XML_STRING *)dict_strings, sizeof(dict_strings)/sizeof(dict_strings[0]), TRUE},
+ (WS_XML_STRING *)dict_strings, ARRAY_SIZE( dict_strings ), TRUE},
(ULONG *)dict_sorted
};
diff --git a/dlls/webservices/url.c b/dlls/webservices/url.c
index 465857a..731b74e 100644
--- a/dlls/webservices/url.c
+++ b/dlls/webservices/url.c
@@ -39,19 +39,19 @@ static const WCHAR netpipe[] = {'n','e','t','.','p','i','p','e'};
static WS_URL_SCHEME_TYPE scheme_type( const WCHAR *str, ULONG len )
{
- if (len == sizeof(http)/sizeof(http[0]) && !memicmpW( str, http, sizeof(http)/sizeof(http[0]) ))
+ if (len == ARRAY_SIZE( http ) && !memicmpW( str, http, ARRAY_SIZE( http )))
return WS_URL_HTTP_SCHEME_TYPE;
- if (len == sizeof(https)/sizeof(https[0]) && !memicmpW( str, https, sizeof(https)/sizeof(https[0]) ))
+ if (len == ARRAY_SIZE( https ) && !memicmpW( str, https, ARRAY_SIZE( https )))
return WS_URL_HTTPS_SCHEME_TYPE;
- if (len == sizeof(nettcp)/sizeof(nettcp[0]) && !memicmpW( str, nettcp, sizeof(nettcp)/sizeof(nettcp[0]) ))
+ if (len == ARRAY_SIZE( nettcp ) && !memicmpW( str, nettcp, ARRAY_SIZE( nettcp )))
return WS_URL_NETTCP_SCHEME_TYPE;
- if (len == sizeof(soapudp)/sizeof(soapudp[0]) && !memicmpW( str, soapudp, sizeof(soapudp)/sizeof(soapudp[0]) ))
+ if (len == ARRAY_SIZE( soapudp ) && !memicmpW( str, soapudp, ARRAY_SIZE( soapudp )))
return WS_URL_SOAPUDP_SCHEME_TYPE;
- if (len == sizeof(netpipe)/sizeof(netpipe[0]) && !memicmpW( str, netpipe, sizeof(netpipe)/sizeof(netpipe[0]) ))
+ if (len == ARRAY_SIZE( netpipe ) && !memicmpW( str, netpipe, ARRAY_SIZE( netpipe )))
return WS_URL_NETPIPE_SCHEME_TYPE;
return ~0u;
@@ -271,23 +271,23 @@ static const WCHAR *scheme_str( WS_URL_SCHEME_TYPE scheme, ULONG *len )
switch (scheme)
{
case WS_URL_HTTP_SCHEME_TYPE:
- *len = sizeof(http)/sizeof(http[0]);
+ *len = ARRAY_SIZE( http );
return http;
case WS_URL_HTTPS_SCHEME_TYPE:
- *len = sizeof(https)/sizeof(https[0]);
+ *len = ARRAY_SIZE( https );
return https;
case WS_URL_NETTCP_SCHEME_TYPE:
- *len = sizeof(nettcp)/sizeof(nettcp[0]);
+ *len = ARRAY_SIZE( nettcp );
return nettcp;
case WS_URL_SOAPUDP_SCHEME_TYPE:
- *len = sizeof(soapudp)/sizeof(soapudp[0]);
+ *len = ARRAY_SIZE( soapudp );
return soapudp;
case WS_URL_NETPIPE_SCHEME_TYPE:
- *len = sizeof(netpipe)/sizeof(netpipe[0]);
+ *len = ARRAY_SIZE( netpipe );
return netpipe;
default:
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index 95d4cad..ef8f919 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -92,14 +92,14 @@ struct writer
WS_DYNAMIC_STRING_CALLBACK dict_cb;
void *dict_cb_state;
ULONG prop_count;
- struct prop prop[sizeof(writer_props)/sizeof(writer_props[0])];
+ struct prop prop[ARRAY_SIZE( writer_props )];
};
#define WRITER_MAGIC (('W' << 24) | ('R' << 16) | ('I' << 8) | 'T')
static struct writer *alloc_writer(void)
{
- static const ULONG count = sizeof(writer_props)/sizeof(writer_props[0]);
+ static const ULONG count = ARRAY_SIZE( writer_props );
struct writer *ret;
ULONG size = sizeof(*ret) + prop_size( writer_props, count );
More information about the wine-cvs
mailing list