Commit 52d6077f authored by Alexandre Julliard's avatar Alexandre Julliard

crypt32/tests: Don't use sizeof in ok() to avoid printf format warnings.

parent 68e4cf4a
......@@ -71,8 +71,7 @@ static void testCryptHashCert(void)
ret = CryptHashCertificate(0, 0, 0, toHash, sizeof(toHash), NULL,
&hashLen);
ok(ret, "CryptHashCertificate failed: %08lx\n", GetLastError());
ok(hashLen == sizeof(hash),
"Got unexpected size of hash %ld, expected %d\n", hashLen, sizeof(hash));
ok(hashLen == sizeof(hash), "Got unexpected size of hash %ld\n", hashLen);
/* Test with empty buffer */
ret = CryptHashCertificate(0, 0, 0, NULL, 0, hash, &hashLen);
ok(ret, "CryptHashCertificate failed: %08lx\n", GetLastError());
......@@ -89,7 +88,7 @@ static const WCHAR cspNameW[] = { 'W','i','n','e','C','r','y','p','t','T','e',
'm','p',0 };
static void verifySig(HCRYPTPROV csp, const BYTE *toSign, size_t toSignLen,
const BYTE *sig, size_t sigLen)
const BYTE *sig, unsigned int sigLen)
{
HCRYPTHASH hash;
BOOL ret = CryptCreateHash(csp, CALG_SHA1, 0, 0, &hash);
......@@ -451,8 +450,7 @@ static void testKeyUsage(void)
*/
ok(GetLastError() == CRYPT_E_NOT_FOUND,
"Expected CRYPT_E_NOT_FOUND, got %08lx\n", GetLastError());
ok(size == sizeof(CERT_ENHKEY_USAGE), "Expected size %d, got %ld\n",
sizeof(CERT_ENHKEY_USAGE), size);
ok(size == sizeof(CERT_ENHKEY_USAGE), "Wrong size %ld\n", size);
ret = CertGetEnhancedKeyUsage(context, 0, pUsage, &size);
ok(ret, "CertGetEnhancedKeyUsage failed: %08lx\n", GetLastError());
ok(pUsage->cUsageIdentifier == 0, "Expected 0 usages, got %ld\n",
......
......@@ -331,8 +331,7 @@ static void testDupCert(void)
if (context)
{
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected cert of %d bytes, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong cert size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, sizeof(bigCert)),
"Unexpected encoded cert in context\n");
ok(context->hCertStore == store, "Unexpected store\n");
......@@ -685,8 +684,7 @@ static void testMemStore(void)
if (context)
{
ok(context->cbCertEncoded == sizeof(signedBigCert),
"Expected cert of %d bytes, got %ld\n", sizeof(signedBigCert),
context->cbCertEncoded);
"Wrong cert size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, signedBigCert,
sizeof(signedBigCert)), "Unexpected encoded cert in context\n");
/* remove it, the rest of the tests will work on an unsigned cert */
......@@ -712,8 +710,7 @@ static void testMemStore(void)
BYTE *buf;
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected cert of %d bytes, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong cert size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, sizeof(bigCert)),
"Unexpected encoded cert in context\n");
ok(context->hCertStore == store1, "Unexpected store\n");
......@@ -732,8 +729,7 @@ static void testMemStore(void)
if (buf)
{
ret = CertSerializeCertificateStoreElement(context, 0, buf, &size);
ok(size == sizeof(serializedCert), "Expected size %d, got %ld\n",
sizeof(serializedCert), size);
ok(size == sizeof(serializedCert), "Wrong size %ld\n", size);
ok(!memcmp(serializedCert, buf, size),
"Unexpected serialized cert\n");
HeapFree(GetProcessHeap(), 0, buf);
......@@ -800,8 +796,7 @@ static void testMemStore(void)
if (context)
{
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected cert of %d bytes, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong cert size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, sizeof(bigCert)),
"Unexpected encoded cert in context\n");
ok(context->hCertStore == store1, "Unexpected store\n");
......@@ -897,8 +892,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -907,8 +901,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert2),
"Expected size %d, got %ld\n", sizeof(bigCert2),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert2,
context->cbCertEncoded), "Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -923,8 +916,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -933,8 +925,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert2),
"Expected size %d, got %ld\n", sizeof(bigCert2),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert2,
context->cbCertEncoded), "Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -955,8 +946,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection2, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
context = CertEnumCertificatesInStore(collection2, context);
......@@ -965,8 +955,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection2, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert2),
"Expected size %d, got %ld\n", sizeof(bigCert2),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert2,
context->cbCertEncoded), "Unexpected cert\n");
context = CertEnumCertificatesInStore(collection2, context);
......@@ -1021,8 +1010,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -1031,8 +1019,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
context = CertEnumCertificatesInStore(collection, context);
......@@ -1072,8 +1059,7 @@ static void testCollectionStore(void)
{
ok(context->hCertStore == collection, "Unexpected store\n");
ok(context->cbCertEncoded == sizeof(bigCert),
"Expected size %d, got %ld\n", sizeof(bigCert),
context->cbCertEncoded);
"Wrong size %ld\n", context->cbCertEncoded);
ok(!memcmp(context->pbCertEncoded, bigCert, context->cbCertEncoded),
"Unexpected cert\n");
}
......@@ -1223,8 +1209,7 @@ static void testRegStore(void)
if (hdr)
{
ok(hdr->cb == sizeof(bigCert2),
"Unexpected size %ld of cert property, expected %d\n",
hdr->cb, sizeof(bigCert2));
"Wrong size %ld of cert property\n", hdr->cb);
ok(!memcmp((BYTE *)hdr + sizeof(*hdr), bigCert2,
hdr->cb), "Unexpected cert in cert property\n");
}
......@@ -1233,8 +1218,7 @@ static void testRegStore(void)
if (hdr)
{
ok(hdr->cb == sizeof(hash),
"Unexpected size %ld of hash property, expected %d\n",
hdr->cb, sizeof(hash));
"Wrong size %ld of hash property\n", hdr->cb);
ok(!memcmp((BYTE *)hdr + sizeof(*hdr), hash,
hdr->cb), "Unexpected hash in cert property\n");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment