From 1fdd31daf223c0811de6849937415e48272f436a Mon Sep 17 00:00:00 2001 From: Sasha Smundak Date: Mon, 25 Jul 2016 17:54:00 +0000 Subject: 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 --- src/main/cpp/util/md5.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/main/cpp/util/md5.cc') 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(ctx_buffer + size - 8)) = count[0] << 3; - *(reinterpret_cast(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); -- cgit v1.2.3