crypt32: Avoid TRUE:FALSE conditional expressions.

This commit is contained in:
Michael Stefaniuc 2012-08-06 11:19:22 +02:00 committed by Alexandre Julliard
parent fdfb86589e
commit 2793be9c6d
5 changed files with 13 additions and 14 deletions

View File

@ -827,7 +827,7 @@ BOOL WINAPI CryptStringToBinaryA(LPCSTR pszString,
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
if (ret)
SetLastError(ret);
return (ret == ERROR_SUCCESS) ? TRUE : FALSE;
return ret == ERROR_SUCCESS;
}
static LONG decodeBase64BlockW(const WCHAR *in_buf, int in_len,
@ -1159,5 +1159,5 @@ BOOL WINAPI CryptStringToBinaryW(LPCWSTR pszString,
ret = decoder(pszString, cchString, pbBinary, pcbBinary, pdwSkip, pdwFlags);
if (ret)
SetLastError(ret);
return (ret == ERROR_SUCCESS) ? TRUE : FALSE;
return ret == ERROR_SUCCESS;
}

View File

@ -2977,7 +2977,7 @@ static BOOL CRYPT_AsnDecodeBool(const BYTE *pbEncoded, DWORD cbEncoded,
else
{
*pcbStructInfo = sizeof(BOOL);
*(BOOL *)pvStructInfo = pbEncoded[2] ? TRUE : FALSE;
*(BOOL *)pvStructInfo = pbEncoded[2] != 0;
ret = TRUE;
}
TRACE("returning %d (%08x)\n", ret, GetLastError());

View File

@ -140,7 +140,7 @@ BOOL WINAPI CryptVerifyDetachedMessageSignature(
for (i = 0; ret && i < cToBeSigned; i++)
ret = CryptMsgUpdate(msg, rgpbToBeSigned[i], rgcbToBeSigned[i],
i == cToBeSigned - 1 ? TRUE : FALSE);
i == cToBeSigned - 1);
}
if (ret)
{
@ -304,8 +304,7 @@ BOOL WINAPI CryptHashMessage(PCRYPT_HASH_MESSAGE_PARA pHashPara,
if (msg)
{
for (i = 0, ret = TRUE; ret && i < cToBeHashed; i++)
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i], rgcbToBeHashed[i],
i == cToBeHashed - 1 ? TRUE : FALSE);
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i], rgcbToBeHashed[i], i == cToBeHashed - 1);
if (ret)
{
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0, pbHashedBlob,
@ -356,7 +355,7 @@ BOOL WINAPI CryptVerifyDetachedMessageHash(PCRYPT_HASH_MESSAGE_PARA pHashPara,
for (i = 0; ret && i < cToBeHashed; i++)
{
ret = CryptMsgUpdate(msg, rgpbToBeHashed[i],
rgcbToBeHashed[i], i == cToBeHashed - 1 ? TRUE : FALSE);
rgcbToBeHashed[i], i == cToBeHashed - 1);
}
}
else
@ -511,7 +510,7 @@ BOOL WINAPI CryptSignMessage(PCRYPT_SIGN_MESSAGE_PARA pSignPara,
for (i = 0; ret && i < cToBeSigned; ++i)
{
ret = CryptMsgUpdate(msg, rgpbToBeSigned[i], rgcbToBeSigned[i],
i == cToBeSigned - 1 ? TRUE : FALSE);
i == cToBeSigned - 1);
}
}
else

View File

@ -684,7 +684,7 @@ BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName,
CryptMemFree(szKey);
if (rc)
SetLastError(rc);
return rc ? FALSE : TRUE;
return !rc;
}
BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
@ -721,7 +721,7 @@ BOOL WINAPI CryptGetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
SetLastError(rc);
RegCloseKey(hKey);
}
return rc ? FALSE : TRUE;
return !rc;
}
BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
@ -758,7 +758,7 @@ BOOL WINAPI CryptSetOIDFunctionValue(DWORD dwEncodingType, LPCSTR pszFuncName,
SetLastError(rc);
RegCloseKey(hKey);
}
return rc ? FALSE : TRUE;
return !rc;
}
static LPCWSTR CRYPT_FindStringInMultiString(LPCWSTR multi, LPCWSTR toFind)

View File

@ -163,7 +163,7 @@ static BOOL CRYPT_MemAddCert(PWINECRYPT_CERTSTORE store, void *cert,
if (ppStoreContext)
*ppStoreContext = CertDuplicateCertificateContext(context);
}
return context ? TRUE : FALSE;
return context != 0;
}
static void *CRYPT_MemEnumCert(PWINECRYPT_CERTSTORE store, void *pPrev)
@ -208,7 +208,7 @@ static BOOL CRYPT_MemAddCrl(PWINECRYPT_CERTSTORE store, void *crl,
if (ppStoreContext)
*ppStoreContext = CertDuplicateCRLContext(context);
}
return context ? TRUE : FALSE;
return context != 0;
}
static void *CRYPT_MemEnumCrl(PWINECRYPT_CERTSTORE store, void *pPrev)
@ -253,7 +253,7 @@ static BOOL CRYPT_MemAddCtl(PWINECRYPT_CERTSTORE store, void *ctl,
if (ppStoreContext)
*ppStoreContext = CertDuplicateCTLContext(context);
}
return context ? TRUE : FALSE;
return context != 0;
}
static void *CRYPT_MemEnumCtl(PWINECRYPT_CERTSTORE store, void *pPrev)