winhttp: Avoid a variable that holds an ARRAY_SIZE() result.

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:
Michael Stefaniuc 2018-09-25 19:35:01 +02:00 committed by Alexandre Julliard
parent dbaaee8e4d
commit 8c8ea309a4
1 changed files with 3 additions and 4 deletions

View File

@ -866,13 +866,12 @@ auth_schemes[] =
{ digestW, ARRAY_SIZE(digestW) - 1, WINHTTP_AUTH_SCHEME_DIGEST }, { digestW, ARRAY_SIZE(digestW) - 1, WINHTTP_AUTH_SCHEME_DIGEST },
{ negotiateW, ARRAY_SIZE(negotiateW) - 1, WINHTTP_AUTH_SCHEME_NEGOTIATE } { negotiateW, ARRAY_SIZE(negotiateW) - 1, WINHTTP_AUTH_SCHEME_NEGOTIATE }
}; };
static const unsigned int num_auth_schemes = sizeof(auth_schemes)/sizeof(auth_schemes[0]);
static enum auth_scheme scheme_from_flag( DWORD flag ) static enum auth_scheme scheme_from_flag( DWORD flag )
{ {
int i; int i;
for (i = 0; i < num_auth_schemes; i++) if (flag == auth_schemes[i].scheme) return i; for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++) if (flag == auth_schemes[i].scheme) return i;
return SCHEME_INVALID; return SCHEME_INVALID;
} }
@ -880,7 +879,7 @@ static DWORD auth_scheme_from_header( WCHAR *header )
{ {
unsigned int i; unsigned int i;
for (i = 0; i < num_auth_schemes; i++) for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++)
{ {
if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) && if (!strncmpiW( header, auth_schemes[i].str, auth_schemes[i].len ) &&
(header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme; (header[auth_schemes[i].len] == ' ' || !header[auth_schemes[i].len])) return auth_schemes[i].scheme;
@ -2310,7 +2309,7 @@ static BOOL handle_authorization( request_t *request, DWORD status )
if (do_authorization( request, target, first )) return TRUE; if (do_authorization( request, target, first )) return TRUE;
schemes &= ~first; schemes &= ~first;
for (i = 0; i < num_auth_schemes; i++) for (i = 0; i < ARRAY_SIZE( auth_schemes ); i++)
{ {
if (!(schemes & auth_schemes[i].scheme)) continue; if (!(schemes & auth_schemes[i].scheme)) continue;
if (do_authorization( request, target, auth_schemes[i].scheme )) return TRUE; if (do_authorization( request, target, auth_schemes[i].scheme )) return TRUE;