diff options
author | Jes Sorensen <Jes.Sorensen@redhat.com> | 2012-01-05 12:16:41 +0100 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-01-12 00:41:49 +0100 |
commit | 90fa1a292929ff8a6c7357254b6f616608ec01b5 (patch) | |
tree | ebfbf6208009bd4ae7530513fb3e25d3014ac141 /sha1.c | |
parent | fix: Monitor sometimes crashes (diff) | |
download | mdadm-90fa1a292929ff8a6c7357254b6f616608ec01b5.tar.xz mdadm-90fa1a292929ff8a6c7357254b6f616608ec01b5.zip |
Work around gcc-4.7's strict aliasing checks
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'sha1.c')
-rw-r--r-- | sha1.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -101,6 +101,7 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; + md5_uint32 *ptr; /* Now count remaining bytes. */ ctx->total[0] += bytes; @@ -111,9 +112,10 @@ sha1_finish_ctx (struct sha1_ctx *ctx, void *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 + 4] = SWAP (ctx->total[0] << 3); - *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); + ptr = (md5_uint32 *) &ctx->buffer[bytes + pad + 4]; + *ptr = SWAP (ctx->total[0] << 3); + ptr = (md5_uint32 *) &ctx->buffer[bytes + pad]; + *ptr = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ sha1_process_block (ctx->buffer, bytes + pad + 8, ctx); |