summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbsimonnet@chromium.org <bsimonnet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-28 15:03:01 +0000
committerbsimonnet@chromium.org <bsimonnet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-28 15:03:01 +0000
commitf10c6b66e4042b86f2d9658f52b0cbf155ae00ce (patch)
tree88175e2d6e6d2155a398c4aeb40d30accfec6323
parentaac21867488c94be2fa22f5d34896de723ba4ae8 (diff)
downloadchromium_src-f10c6b66e4042b86f2d9658f52b0cbf155ae00ce.zip
chromium_src-f10c6b66e4042b86f2d9658f52b0cbf155ae00ce.tar.gz
chromium_src-f10c6b66e4042b86f2d9658f52b0cbf155ae00ce.tar.bz2
Fixing compiler warnings on md5.cc
md5.cc compiles with a warning on Chrome OS and it fails the compilation. This replace the unsafe static cast with a safer memcpy. BUG=chromium:377085 TEST=Running MD5 unit tests. R=thakis@chromium.org Review URL: https://codereview.chromium.org/295333002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273235 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/md5.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/base/md5.cc b/base/md5.cc
index e77885e..6227ee6 100644
--- a/base/md5.cc
+++ b/base/md5.cc
@@ -251,8 +251,12 @@ void MD5Final(MD5Digest* digest, MD5Context* context) {
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
- ((uint32 *)ctx->in)[ 14 ] = ctx->bits[0];
- ((uint32 *)ctx->in)[ 15 ] = ctx->bits[1];
+ memcpy(&ctx->in[14 * sizeof(ctx->bits[0])],
+ &ctx->bits[0],
+ sizeof(ctx->bits[0]));
+ memcpy(&ctx->in[15 * sizeof(ctx->bits[1])],
+ &ctx->bits[1],
+ sizeof(ctx->bits[1]));
MD5Transform(ctx->buf, (uint32 *)ctx->in);
byteReverse((unsigned char *)ctx->buf, 4);