wininet: Use the more common ARRAY_SIZE spelling.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-07-05 22:07:15 +02:00 committed by Alexandre Julliard
parent b412c166b3
commit d870d4105d
1 changed files with 9 additions and 11 deletions

View File

@ -145,8 +145,6 @@ static const WCHAR emptyW[] = {0};
#define COLLECT_TIME 60000 #define COLLECT_TIME 60000
#define ARRAYSIZE(array) (sizeof(array)/sizeof((array)[0]))
struct HttpAuthInfo struct HttpAuthInfo
{ {
LPWSTR scheme; LPWSTR scheme;
@ -810,12 +808,12 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm )
static const WCHAR szBasic[] = {'B','a','s','i','c'}; /* Note: not nul-terminated */ static const WCHAR szBasic[] = {'B','a','s','i','c'}; /* Note: not nul-terminated */
static const WCHAR szRealm[] = {'r','e','a','l','m'}; /* Note: not nul-terminated */ static const WCHAR szRealm[] = {'r','e','a','l','m'}; /* Note: not nul-terminated */
BOOL is_basic; BOOL is_basic;
is_basic = !strncmpiW(pszAuthValue, szBasic, ARRAYSIZE(szBasic)) && is_basic = !strncmpiW(pszAuthValue, szBasic, ARRAY_SIZE(szBasic)) &&
((pszAuthValue[ARRAYSIZE(szBasic)] == ' ') || !pszAuthValue[ARRAYSIZE(szBasic)]); ((pszAuthValue[ARRAY_SIZE(szBasic)] == ' ') || !pszAuthValue[ARRAY_SIZE(szBasic)]);
if (is_basic && pszRealm) if (is_basic && pszRealm)
{ {
LPCWSTR token; LPCWSTR token;
LPCWSTR ptr = &pszAuthValue[ARRAYSIZE(szBasic)]; LPCWSTR ptr = &pszAuthValue[ARRAY_SIZE(szBasic)];
LPCWSTR realm; LPCWSTR realm;
ptr++; ptr++;
*pszRealm=NULL; *pszRealm=NULL;
@ -825,8 +823,8 @@ static inline BOOL is_basic_auth_value( LPCWSTR pszAuthValue, LPWSTR *pszRealm )
realm = ptr; realm = ptr;
while (*realm == ' ') while (*realm == ' ')
realm++; realm++;
if(!strncmpiW(realm, szRealm, ARRAYSIZE(szRealm)) && if(!strncmpiW(realm, szRealm, ARRAY_SIZE(szRealm)) &&
(realm[ARRAYSIZE(szRealm)] == ' ' || realm[ARRAYSIZE(szRealm)] == '=')) (realm[ARRAY_SIZE(szRealm)] == ' ' || realm[ARRAY_SIZE(szRealm)] == '='))
{ {
token++; token++;
while (*token == ' ') while (*token == ' ')
@ -1566,9 +1564,9 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin )
{ {
signed char in[4]; signed char in[4];
if (base64[0] >= ARRAYSIZE(HTTP_Base64Dec) || if (base64[0] >= ARRAY_SIZE(HTTP_Base64Dec) ||
((in[0] = HTTP_Base64Dec[base64[0]]) == -1) || ((in[0] = HTTP_Base64Dec[base64[0]]) == -1) ||
base64[1] >= ARRAYSIZE(HTTP_Base64Dec) || base64[1] >= ARRAY_SIZE(HTTP_Base64Dec) ||
((in[1] = HTTP_Base64Dec[base64[1]]) == -1)) ((in[1] = HTTP_Base64Dec[base64[1]]) == -1))
{ {
WARN("invalid base64: %s\n", debugstr_w(base64)); WARN("invalid base64: %s\n", debugstr_w(base64));
@ -1580,7 +1578,7 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin )
if ((base64[2] == '=') && (base64[3] == '=')) if ((base64[2] == '=') && (base64[3] == '='))
break; break;
if (base64[2] > ARRAYSIZE(HTTP_Base64Dec) || if (base64[2] > ARRAY_SIZE(HTTP_Base64Dec) ||
((in[2] = HTTP_Base64Dec[base64[2]]) == -1)) ((in[2] = HTTP_Base64Dec[base64[2]]) == -1))
{ {
WARN("invalid base64: %s\n", debugstr_w(&base64[2])); WARN("invalid base64: %s\n", debugstr_w(&base64[2]));
@ -1592,7 +1590,7 @@ static UINT HTTP_DecodeBase64( LPCWSTR base64, LPSTR bin )
if (base64[3] == '=') if (base64[3] == '=')
break; break;
if (base64[3] > ARRAYSIZE(HTTP_Base64Dec) || if (base64[3] > ARRAY_SIZE(HTTP_Base64Dec) ||
((in[3] = HTTP_Base64Dec[base64[3]]) == -1)) ((in[3] = HTTP_Base64Dec[base64[3]]) == -1))
{ {
WARN("invalid base64: %s\n", debugstr_w(&base64[3])); WARN("invalid base64: %s\n", debugstr_w(&base64[3]));