winhttp: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8c8ea309a4
commit
9c1298a0e5
|
@ -312,7 +312,7 @@ BOOL add_cookie_headers( request_t *request )
|
|||
if (strstrW( request->path, cookie->path ) == request->path)
|
||||
{
|
||||
const WCHAR cookieW[] = {'C','o','o','k','i','e',':',' '};
|
||||
int len, len_cookie = sizeof(cookieW) / sizeof(cookieW[0]), len_name = strlenW( cookie->name );
|
||||
int len, len_cookie = ARRAY_SIZE( cookieW ), len_name = strlenW( cookie->name );
|
||||
WCHAR *header;
|
||||
|
||||
len = len_cookie + len_name;
|
||||
|
|
|
@ -397,7 +397,7 @@ static BOOL send_ssl_chunk(netconn_t *conn, const void *msg, size_t size)
|
|||
{conn->ssl_sizes.cbTrailer, SECBUFFER_STREAM_TRAILER, conn->ssl_buf+conn->ssl_sizes.cbHeader+size},
|
||||
{0, SECBUFFER_EMPTY, NULL}
|
||||
};
|
||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, sizeof(bufs)/sizeof(*bufs), bufs};
|
||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, ARRAY_SIZE(bufs), bufs};
|
||||
SECURITY_STATUS res;
|
||||
|
||||
memcpy(bufs[1].pvBuffer, msg, size);
|
||||
|
@ -443,7 +443,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
|||
{
|
||||
const SIZE_T ssl_buf_size = conn->ssl_sizes.cbHeader+conn->ssl_sizes.cbMaximumMessage+conn->ssl_sizes.cbTrailer;
|
||||
SecBuffer bufs[4];
|
||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, sizeof(bufs)/sizeof(*bufs), bufs};
|
||||
SecBufferDesc buf_desc = {SECBUFFER_VERSION, ARRAY_SIZE(bufs), bufs};
|
||||
SSIZE_T size, buf_len;
|
||||
unsigned int i;
|
||||
SECURITY_STATUS res;
|
||||
|
@ -499,7 +499,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
|||
}
|
||||
} while(res != SEC_E_OK);
|
||||
|
||||
for(i=0; i < sizeof(bufs)/sizeof(*bufs); i++) {
|
||||
for(i = 0; i < ARRAY_SIZE(bufs); i++) {
|
||||
if(bufs[i].BufferType == SECBUFFER_DATA) {
|
||||
size = min(buf_size, bufs[i].cbBuffer);
|
||||
memcpy(buf, bufs[i].pvBuffer, size);
|
||||
|
@ -516,7 +516,7 @@ static BOOL read_ssl_chunk(netconn_t *conn, void *buf, SIZE_T buf_size, SIZE_T *
|
|||
}
|
||||
}
|
||||
|
||||
for(i=0; i < sizeof(bufs)/sizeof(*bufs); i++) {
|
||||
for(i = 0; i < ARRAY_SIZE(bufs); i++) {
|
||||
if(bufs[i].BufferType == SECBUFFER_EXTRA) {
|
||||
conn->extra_buf = heap_alloc(bufs[i].cbBuffer);
|
||||
if(!conn->extra_buf)
|
||||
|
|
|
@ -747,7 +747,7 @@ static BOOL query_headers( request_t *request, DWORD level, LPCWSTR name, LPVOID
|
|||
return ret;
|
||||
|
||||
default:
|
||||
if (attr >= sizeof(attribute_table)/sizeof(attribute_table[0]) || !attribute_table[attr])
|
||||
if (attr >= ARRAY_SIZE(attribute_table) || !attribute_table[attr])
|
||||
{
|
||||
FIXME("attribute %u not implemented\n", attr);
|
||||
return FALSE;
|
||||
|
@ -3120,7 +3120,7 @@ void release_typelib(void)
|
|||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < sizeof(winhttp_typeinfo)/sizeof(*winhttp_typeinfo); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(winhttp_typeinfo); i++)
|
||||
if (winhttp_typeinfo[i])
|
||||
ITypeInfo_Release(winhttp_typeinfo[i]);
|
||||
|
||||
|
@ -3446,7 +3446,7 @@ static HRESULT WINAPI winhttp_request_Open(
|
|||
goto error;
|
||||
}
|
||||
|
||||
len = sizeof(httpsW) / sizeof(WCHAR);
|
||||
len = ARRAY_SIZE( httpsW );
|
||||
if (uc.dwSchemeLength == len && !memcmp( uc.lpszScheme, httpsW, len * sizeof(WCHAR) ))
|
||||
{
|
||||
flags |= WINHTTP_FLAG_SECURE;
|
||||
|
|
|
@ -479,7 +479,7 @@ BOOL WINAPI WinHttpCreateUrl( LPURL_COMPONENTS uc, DWORD flags, LPWSTR url, LPDW
|
|||
if (uc->lpszHostName)
|
||||
{
|
||||
memcpy( url, twoslashW, sizeof(twoslashW) );
|
||||
url += sizeof(twoslashW) / sizeof(twoslashW[0]);
|
||||
url += ARRAY_SIZE( twoslashW );
|
||||
}
|
||||
if (uc->lpszUserName)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue