wintrust: 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:37 +02:00 committed by Alexandre Julliard
parent 6c6af6412c
commit c77defede1
2 changed files with 34 additions and 45 deletions

View File

@ -673,8 +673,8 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
items[1].pvStructInfo = &algo->Parameters;
else
items[1].pvStructInfo = &nullBlob;
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
return ret;
}
@ -688,8 +688,8 @@ static BOOL WINAPI CRYPT_AsnEncodeAttributeTypeValue(DWORD dwCertEncodingType,
{ &typeValue->Value, CRYPT_CopyEncodedBlob, 0 },
};
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
struct SPCDigest
@ -708,8 +708,8 @@ static BOOL WINAPI CRYPT_AsnEncodeSPCDigest(DWORD dwCertEncodingType,
{ &digest->Digest, CRYPT_CopyEncodedBlob, 0 },
};
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
return CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
@ -729,8 +729,8 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
{ &data->DigestAlgorithm, CRYPT_AsnEncodeSPCDigest, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
@ -996,8 +996,8 @@ BOOL WINAPI WVTAsn1CatMemberInfoEncode(DWORD dwCertEncodingType,
{ &info->dwCertVersion, CRYPT_AsnEncodeInt, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
@ -1025,8 +1025,8 @@ BOOL WINAPI WVTAsn1CatNameValueEncode(DWORD dwCertEncodingType,
{ &value->Value, CRYPT_AsnEncodeOctets, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
@ -1084,8 +1084,8 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoEncode(DWORD dwCertEncodingType,
{ &criteria->fMeetsCriteria, CRYPT_AsnEncodeBool, 0 },
};
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING,
items, sizeof(items) / sizeof(items[0]), pbEncoded, pcbEncoded);
ret = CRYPT_AsnEncodeSequence(X509_ASN_ENCODING, items, ARRAY_SIZE(items),
pbEncoded, pcbEncoded);
}
__EXCEPT_PAGE_FAULT
{
@ -1808,9 +1808,8 @@ BOOL WINAPI WVTAsn1SpcPeImageDataDecode(DWORD dwCertEncodingType,
offsetof(SPC_PE_IMAGE_DATA, pFile), 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
@ -1995,9 +1994,8 @@ static BOOL WINAPI CRYPT_AsnDecodeAttributeTypeValue(DWORD dwCertEncodingType,
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo,
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo,
typeValue ? typeValue->pszObjId : NULL);
}
@ -2019,9 +2017,8 @@ static BOOL WINAPI CRYPT_AsnDecodeAlgorithmId(DWORD dwCertEncodingType,
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, algo ? algo->pszObjId : NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, algo ? algo->pszObjId : NULL);
if (ret && pvStructInfo)
{
TRACE("pszObjId is %p (%s)\n", algo->pszObjId,
@ -2048,9 +2045,8 @@ static BOOL WINAPI CRYPT_AsnDecodeSPCDigest(DWORD dwCertEncodingType,
TRACE("%p, %d, %08x, %p, %d\n", pbEncoded, cbEncoded, dwFlags,
pvStructInfo, *pcbStructInfo);
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo,
return CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo,
digest ? digest->DigestAlgorithm.pszObjId : NULL);
}
@ -2076,9 +2072,8 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentDecode(DWORD dwCertEncodingType,
offsetof(SPC_INDIRECT_DATA_CONTENT, DigestAlgorithm.pszObjId), 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
@ -2174,9 +2169,8 @@ BOOL WINAPI WVTAsn1SpcSpOpusInfoDecode(DWORD dwCertEncodingType,
offsetof(SPC_SP_OPUS_INFO, pPublisherInfo), 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
@ -2256,9 +2250,8 @@ BOOL WINAPI WVTAsn1CatMemberInfoDecode(DWORD dwCertEncodingType,
FALSE, FALSE, 0, 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
@ -2292,9 +2285,8 @@ BOOL WINAPI WVTAsn1CatNameValueDecode(DWORD dwCertEncodingType,
offsetof(CAT_NAMEVALUE, Value.pbData), 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{
@ -2367,9 +2359,8 @@ BOOL WINAPI WVTAsn1SpcFinancialCriteriaInfoDecode(DWORD dwCertEncodingType,
fMeetsCriteria), FALSE, FALSE, 0, 0 },
};
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items,
sizeof(items) / sizeof(items[0]), pbEncoded, cbEncoded, dwFlags,
pvStructInfo, pcbStructInfo, NULL);
ret = CRYPT_AsnDecodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
pbEncoded, cbEncoded, dwFlags, pvStructInfo, pcbStructInfo, NULL);
}
__EXCEPT_PAGE_FAULT
{

View File

@ -522,11 +522,9 @@ static LPCSTR filetime_to_str(const FILETIME *time)
if (!time) return NULL;
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt,
sizeof(dateFmt) / sizeof(dateFmt[0]));
GetLocaleInfoA(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt, ARRAY_SIZE(dateFmt));
FileTimeToSystemTime(time, &sysTime);
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date,
sizeof(date) / sizeof(date[0]));
GetDateFormatA(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date, ARRAY_SIZE(date));
return date;
}