aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/md5.cc
diff options
context:
space:
mode:
authorGravatar Sasha Smundak <asmundak@google.com>2016-07-25 17:54:00 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2016-07-26 09:30:15 +0000
commit1fdd31daf223c0811de6849937415e48272f436a (patch)
tree7e8c8952d0471a24c215c2c0c2cff1cffb3f307a /src/main/cpp/util/md5.cc
parent2c7d7b3db78484706fd62f926452eb8d1c86e317 (diff)
Placate the compiler.
Address the following warnings from the compiler: * "control reaches end of non-void function [-Wreturn-type]" * "dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]" * "ignoring return value of 'ssize_t write(int, const void*, size_t)', declared with attribute warn_unused_result [-Wunused-result]" * "ignoring return value of 'int ftruncate(int, __off_t)', declared with attribute warn_unused_result [-Wunused-result]" * "ignoring return value of 'int dup(int)', declared with attribute warn_unused_result [-Wunused-result]" -- MOS_MIGRATED_REVID=128375065
Diffstat (limited to 'src/main/cpp/util/md5.cc')
-rw-r--r--src/main/cpp/util/md5.cc5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/main/cpp/util/md5.cc b/src/main/cpp/util/md5.cc
index 05d2ba276c..d25c292787 100644
--- a/src/main/cpp/util/md5.cc
+++ b/src/main/cpp/util/md5.cc
@@ -156,9 +156,8 @@ void Md5Digest::Finish(unsigned char digest[16]) {
/* Put the 64-bit file length in *bits* at the end of the buffer. */
unsigned int size = (ctx_buffer_len < 56 ? 64 : 128);
- *(reinterpret_cast<uint32_t*>(ctx_buffer + size - 8)) = count[0] << 3;
- *(reinterpret_cast<uint32_t*>(ctx_buffer + size - 4)) =
- (count[1] << 3) | (count[0] >> 29);
+ uint32_t words[2] = { count[0] << 3, (count[1] << 3) | (count[0] >> 29) };
+ memcpy(ctx_buffer + size - 8, words, 8);
memcpy(ctx_buffer + ctx_buffer_len, kPadding, size - 8 - ctx_buffer_len);