rsaenh: Use NULL instead of casting 0.

Francois Gouget fgouget at free.fr
Sat Mar 20 09:23:49 CDT 2010


---
 dlls/rsaenh/sha2.c |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/dlls/rsaenh/sha2.c b/dlls/rsaenh/sha2.c
index 559323c..d15e6fb 100644
--- a/dlls/rsaenh/sha2.c
+++ b/dlls/rsaenh/sha2.c
@@ -273,7 +273,7 @@ static const char sha2_hex_digits[] = "0123456789abcdef";
 
 /*** SHA-256: *********************************************************/
 void SHA256_Init(SHA256_CTX* context) {
-	if (context == (SHA256_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	MEMCPY_BCOPY(context->state, sha256_initial_hash_value, SHA256_DIGEST_LENGTH);
@@ -465,7 +465,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) {
 	}
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0 && data != (sha2_byte*)0);
+	assert(context != NULL && data != NULL);
 
 	usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
 	if (usedspace > 0) {
@@ -509,10 +509,10 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
 	unsigned int	usedspace;
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		usedspace = (context->bitcount >> 3) % SHA256_BLOCK_LENGTH;
 #ifndef WORDS_BIGENDIAN
 		/* Convert FROM host byte order */
@@ -572,9 +572,9 @@ char *SHA256_End(SHA256_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA256_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA256_Final(digest, context);
 
 		for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
@@ -601,7 +601,7 @@ char* SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_S
 
 /*** SHA-512: *********************************************************/
 void SHA512_Init(SHA512_CTX* context) {
-	if (context == (SHA512_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	MEMCPY_BCOPY(context->state, sha512_initial_hash_value, SHA512_DIGEST_LENGTH);
@@ -787,7 +787,7 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) {
 	}
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0 && data != (sha2_byte*)0);
+	assert(context != NULL && data != NULL);
 
 	usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH;
 	if (usedspace > 0) {
@@ -871,10 +871,10 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
 	sha2_word64	*d = (sha2_word64*)digest;
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		SHA512_Last(context);
 
 		/* Save the hash data for output: */
@@ -901,9 +901,9 @@ char *SHA512_End(SHA512_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA512_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA512_Final(digest, context);
 
 		for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
@@ -930,7 +930,7 @@ char* SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_S
 
 /*** SHA-384: *********************************************************/
 void SHA384_Init(SHA384_CTX* context) {
-	if (context == (SHA384_CTX*)0) {
+	if (context == NULL) {
 		return;
 	}
 	MEMCPY_BCOPY(context->state, sha384_initial_hash_value, SHA512_DIGEST_LENGTH);
@@ -946,10 +946,10 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
 	sha2_word64	*d = (sha2_word64*)digest;
 
 	/* Sanity check: */
-	assert(context != (SHA384_CTX*)0);
+	assert(context != NULL);
 
 	/* If no digest buffer is passed, we don't bother doing this: */
-	if (digest != (sha2_byte*)0) {
+	if (digest != NULL) {
 		SHA512_Last((SHA512_CTX*)context);
 
 		/* Save the hash data for output: */
@@ -976,9 +976,9 @@ char *SHA384_End(SHA384_CTX* context, char buffer[]) {
 	int		i;
 
 	/* Sanity check: */
-	assert(context != (SHA384_CTX*)0);
+	assert(context != NULL);
 
-	if (buffer != (char*)0) {
+	if (buffer != NULL) {
 		SHA384_Final(digest, context);
 
 		for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
-- 
1.6.5




More information about the wine-patches mailing list