diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-01 09:39:19 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-04-01 09:39:19 +0000 |
commit | 3eb4b0aa0633e1aa6161e86eb0215e267c905a96 (patch) | |
tree | e7f6d458e477d6e0f98a41c4ccd8db0da7adb185 /ext | |
parent | 318e8835d0d075ce399cb40f6e6c085cc723b049 (diff) | |
download | bundler-3eb4b0aa0633e1aa6161e86eb0215e267c905a96.tar.gz |
sha2.c: suppress warnings
* ext/digest/sha2/sha2.c (SHA256_Final, SHA512_Last): suppress
strict-aliasing warnings on gcc 4.8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/digest/sha2/sha2.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c index 0fe64489ab..3457790eea 100644 --- a/ext/digest/sha2/sha2.c +++ b/ext/digest/sha2/sha2.c @@ -613,7 +613,8 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { *context->buffer = 0x80; } /* Set the bit count: */ - *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; + MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], &context->bitcount, + sizeof(sha2_word64)); /* Final transform: */ SHA256_Transform(context, (sha2_word32*)context->buffer); @@ -930,8 +931,10 @@ void SHA512_Last(SHA512_CTX* context) { *context->buffer = 0x80; } /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], &context->bitcount[1], + sizeof(sha2_word64)); + MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8], &context->bitcount[0], + sizeof(sha2_word64)); /* Final transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer); |