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