secur32: Use the ARRAY_SIZE() macro.

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-18 23:01:32 +02:00 committed by Alexandre Julliard
parent 3ba9ba7af5
commit baf4cb3958
4 changed files with 9 additions and 9 deletions

View File

@ -195,7 +195,7 @@ static void read_config(void)
if(res == ERROR_SUCCESS) { if(res == ERROR_SUCCESS) {
DWORD type, size, value; DWORD type, size, value;
for(i=0; i < sizeof(protocol_config_keys)/sizeof(*protocol_config_keys); i++) { for(i = 0; i < ARRAY_SIZE(protocol_config_keys); i++) {
strcpyW(subkey_name, protocol_config_keys[i].key_name); strcpyW(subkey_name, protocol_config_keys[i].key_name);
strcatW(subkey_name, clientW); strcatW(subkey_name, clientW);
res = RegOpenKeyExW(protocols_key, subkey_name, 0, KEY_READ, &key); res = RegOpenKeyExW(protocols_key, subkey_name, 0, KEY_READ, &key);
@ -229,7 +229,7 @@ static void read_config(void)
} }
}else { }else {
/* No config, enable all known protocols. */ /* No config, enable all known protocols. */
for(i=0; i < sizeof(protocol_config_keys)/sizeof(*protocol_config_keys); i++) { for(i = 0; i < ARRAY_SIZE(protocol_config_keys); i++) {
if(protocol_config_keys[i].enabled) if(protocol_config_keys[i].enabled)
enabled |= protocol_config_keys[i].prot_client_flag; enabled |= protocol_config_keys[i].prot_client_flag;
if(protocol_config_keys[i].disabled_by_default) if(protocol_config_keys[i].disabled_by_default)
@ -986,7 +986,7 @@ static void *get_alg_name(ALG_ID id, BOOL wide)
}; };
unsigned i; unsigned i;
for (i = 0; i < sizeof(alg_name_map)/sizeof(alg_name_map[0]); i++) for (i = 0; i < ARRAY_SIZE(alg_name_map); i++)
if (alg_name_map[i].alg_id == id) if (alg_name_map[i].alg_id == id)
return wide ? (void*)alg_name_map[i].nameW : (void*)alg_name_map[i].name; return wide ? (void*)alg_name_map[i].nameW : (void*)alg_name_map[i].name;
@ -1545,7 +1545,7 @@ void SECUR32_initSchannelSP(void)
goto fail; goto fail;
} }
SECUR32_addPackages(provider, sizeof(info) / sizeof(info[0]), NULL, info); SECUR32_addPackages(provider, ARRAY_SIZE(info), NULL, info);
return; return;

View File

@ -177,7 +177,7 @@ BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cre
} }
p = priority + strlen(priority); p = priority + strlen(priority);
for(i=0; i < sizeof(protocol_priority_flags)/sizeof(*protocol_priority_flags); i++) { for(i = 0; i < ARRAY_SIZE(protocol_priority_flags); i++) {
*p++ = ':'; *p++ = ':';
*p++ = (cred->enabled_protocols & protocol_priority_flags[i].enable_flag) ? '+' : '-'; *p++ = (cred->enabled_protocols & protocol_priority_flags[i].enable_flag) ? '+' : '-';
strcpy(p, protocol_priority_flags[i].gnutls_flag); strcpy(p, protocol_priority_flags[i].gnutls_flag);

View File

@ -429,7 +429,7 @@ static const struct cipher_suite cipher_suites[] = {
static const struct cipher_suite* get_cipher_suite(SSLCipherSuite cipher_suite) static const struct cipher_suite* get_cipher_suite(SSLCipherSuite cipher_suite)
{ {
int i; int i;
for (i = 0; i < sizeof(cipher_suites)/sizeof(cipher_suites[0]); i++) for (i = 0; i < ARRAY_SIZE(cipher_suites); i++)
{ {
if (cipher_suites[i].suite == cipher_suite) if (cipher_suites[i].suite == cipher_suite)
return &cipher_suites[i]; return &cipher_suites[i];
@ -767,7 +767,7 @@ BOOL schan_imp_create_session(schan_imp_session *session, schan_credentials *cre
goto fail; goto fail;
} }
for(i=0; i < sizeof(protocol_priority_flags)/sizeof(*protocol_priority_flags); i++) { for(i = 0; i < ARRAY_SIZE(protocol_priority_flags); i++) {
if(!(protocol_priority_flags[i].enable_flag & supported_protocols)) if(!(protocol_priority_flags[i].enable_flag & supported_protocols))
continue; continue;

View File

@ -995,7 +995,7 @@ BOOLEAN WINAPI GetComputerObjectNameW(
case NameSamCompatible: case NameSamCompatible:
{ {
WCHAR name[MAX_COMPUTERNAME_LENGTH + 1]; WCHAR name[MAX_COMPUTERNAME_LENGTH + 1];
DWORD size = sizeof(name)/sizeof(name[0]); DWORD size = ARRAY_SIZE(name);
if (GetComputerNameW(name, &size)) if (GetComputerNameW(name, &size))
{ {
DWORD len = domainInfo->Name.Length + size + 3; DWORD len = domainInfo->Name.Length + size + 3;
@ -1038,7 +1038,7 @@ BOOLEAN WINAPI GetComputerObjectNameW(
DWORD len, size; DWORD len, size;
WCHAR *suffix; WCHAR *suffix;
size = sizeof(name) / sizeof(name[0]); size = ARRAY_SIZE(name);
if (!GetComputerNameW(name, &size)) if (!GetComputerNameW(name, &size))
{ {
status = FALSE; status = FALSE;