[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/2] Fix strict-aliasing warning in MD5
From: |
Petr Písař |
Subject: |
[PATCH 1/2] Fix strict-aliasing warning in MD5 |
Date: |
Tue, 4 Dec 2012 13:59:21 +0100 |
---
lib/md5.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/md5.c b/lib/md5.c
index 743b8f9..5ed5555 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -104,6 +104,7 @@ md5_finish_ctx (ctx, resbuf)
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
size_t pad;
+ md5_uint32 *file_length_value;
/* Now count remaining bytes. */
ctx->total[0] += bytes;
@@ -114,9 +115,9 @@ md5_finish_ctx (ctx, resbuf)
memcpy (&ctx->buffer[bytes], fillbuf, pad);
/* Put the 64-bit file length in *bits* at the end of the buffer. */
- *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
- *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
- (ctx->total[0] >> 29));
+ file_length_value = (md5_uint32 *)(ctx->buffer + bytes + pad);
+ file_length_value[0] = SWAP (ctx->total[0] << 3);
+ file_length_value[1] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
/* Process last bytes. */
md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
--
1.7.11.7
- [sharutils-4.11.1] Compilation warnings, Petr Písař, 2012/12/04
- [PATCH 1/2] Fix strict-aliasing warning in MD5,
Petr Písař <=
- [PATCH 2/2] Fix unused wariable warning, Petr Písař, 2012/12/04
- Re: [sharutils-4.11.1] Compilation warnings, Bruce Korb, 2012/12/05
- Re: [sharutils-4.11.1] Compilation warnings, Petr Pisar, 2012/12/06
- Re: [sharutils-4.11.1] Compilation warnings, Bruce Korb, 2012/12/06
- Re: [sharutils-4.11.1] Compilation warnings, Paul Eggert, 2012/12/06
- Re: [sharutils-4.11.1] Compilation warnings, Eric Blake, 2012/12/06
- Re: [sharutils-4.11.1] Compilation warnings, Bruce Korb, 2012/12/06
- Re: [sharutils-4.11.1] Compilation warnings, Petr Pisar, 2012/12/07
- Re: [sharutils-4.11.1] Compilation warnings, Eric Blake, 2012/12/07