Commit 2f4f1399 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

netapi32: Use the ARRAY_SIZE() macro.

parent 4341c449
......@@ -1095,8 +1095,7 @@ static UCHAR NetBTSend(void *adapt, void *sess, PNCB ncb)
wsaBufs[1].len = ncb->ncb_length;
wsaBufs[1].buf = (char*)ncb->ncb_buffer;
r = WSASend(session->fd, wsaBufs, sizeof(wsaBufs) / sizeof(wsaBufs[0]),
&bytesSent, 0, NULL, NULL);
r = WSASend(session->fd, wsaBufs, ARRAY_SIZE(wsaBufs), &bytesSent, 0, NULL, NULL);
if (r == SOCKET_ERROR)
{
NetBIOSHangupSession(ncb);
......@@ -1523,10 +1522,9 @@ void NetBTInit(void)
char nsString[16];
DWORD size, ndx;
for (ndx = 0; ndx < sizeof(nsValueNames) / sizeof(nsValueNames[0]);
ndx++)
for (ndx = 0; ndx < ARRAY_SIZE(nsValueNames); ndx++)
{
size = sizeof(nsString) / sizeof(char);
size = ARRAY_SIZE(nsString);
if (RegQueryValueExA(hKey, nsValueNames[ndx], NULL, NULL,
(LPBYTE)nsString, &size) == ERROR_SUCCESS)
{
......
......@@ -923,7 +923,7 @@ static NET_API_STATUS wksta_getinfo( LMSTR servername, DWORD level, LPBYTE *buf
static BOOL NETAPI_IsLocalComputer( LMCSTR name )
{
WCHAR buf[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = sizeof(buf) / sizeof(buf[0]);
DWORD size = ARRAY_SIZE(buf);
BOOL ret;
if (!name || !name[0]) return TRUE;
......@@ -2360,7 +2360,7 @@ NetUserEnum(LPCWSTR servername, DWORD level, DWORD filter, LPBYTE* bufptr,
{
NET_API_STATUS status;
WCHAR user[UNLEN + 1];
DWORD size, len = sizeof(user)/sizeof(user[0]);
DWORD size, len = ARRAY_SIZE(user);
TRACE("(%s, %u, 0x%x, %p, %u, %p, %p, %p)\n", debugstr_w(servername), level,
filter, bufptr, prefmaxlen, entriesread, totalentries, resume_handle);
......@@ -3477,8 +3477,8 @@ DWORD WINAPI DavGetUNCFromHTTPPath(const WCHAR *http_path, WCHAR *buf, DWORD *bu
TRACE("(%s %p %p)\n", debugstr_w(http_path), buf, buflen);
while (*p && *p != ':') { p++; len++; };
if (len == sizeof(httpW)/sizeof(httpW[0]) && !memicmpW( http_path, httpW, len )) ssl = FALSE;
else if (len == sizeof(httpsW)/sizeof(httpsW[0]) && !memicmpW( http_path, httpsW, len )) ssl = TRUE;
if (len == ARRAY_SIZE(httpW) && !memicmpW( http_path, httpW, len )) ssl = FALSE;
else if (len == ARRAY_SIZE(httpsW) && !memicmpW( http_path, httpsW, len )) ssl = TRUE;
else return ERROR_INVALID_PARAMETER;
if (p[0] != ':' || p[1] != '/' || p[2] != '/') return ERROR_INVALID_PARAMETER;
......@@ -3506,7 +3506,7 @@ DWORD WINAPI DavGetUNCFromHTTPPath(const WCHAR *http_path, WCHAR *buf, DWORD *bu
len = len_server + 2; /* \\ */
if (ssl) len += 4; /* @SSL */
if (port) len += len_port + 1 /* @ */;
len += sizeof(davrootW)/sizeof(davrootW[0]);
len += ARRAY_SIZE(davrootW);
len += len_path + 1; /* nul */
if (*buflen < len)
......@@ -3531,7 +3531,7 @@ DWORD WINAPI DavGetUNCFromHTTPPath(const WCHAR *http_path, WCHAR *buf, DWORD *bu
buf += len_port;
}
memcpy( buf, davrootW, sizeof(davrootW) );
buf += sizeof(davrootW)/sizeof(davrootW[0]);
buf += ARRAY_SIZE(davrootW);
for (i = 0; i < len_path; i++)
{
if (path[i] == '/') *buf++ = '\\';
......
......@@ -135,7 +135,7 @@ BOOL NetBIOSRegisterTransport(ULONG id, NetBIOSTransport *transport)
TRACE(": transport 0x%08x, p %p\n", id, transport);
if (!transport)
ret = FALSE;
else if (gNumTransports >= sizeof(gTransports) / sizeof(gTransports[0]))
else if (gNumTransports >= ARRAY_SIZE(gTransports))
{
FIXME("Too many transports %d\n", gNumTransports + 1);
ret = FALSE;
......
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