From e115b2e6a892e0af3b011475c0deed093284e7b4 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 3 Apr 2017 17:27:11 -0700 Subject: Remove unneeded void* casts. Change-Id: Icf6b0ec88dfc8dc707b18ca4ad25dd77610b4c91 Reviewed-on: https://pdfium-review.googlesource.com/3622 Commit-Queue: dsinclair Reviewed-by: dsinclair --- core/fdrm/crypto/fx_crypt.cpp | 4 ++-- core/fdrm/crypto/fx_crypt_sha.cpp | 31 ++++++++++++++----------------- 2 files changed, 16 insertions(+), 19 deletions(-) (limited to 'core/fdrm/crypto') diff --git a/core/fdrm/crypto/fx_crypt.cpp b/core/fdrm/crypto/fx_crypt.cpp index 693b2ef1cf..aac4edb317 100644 --- a/core/fdrm/crypto/fx_crypt.cpp +++ b/core/fdrm/crypto/fx_crypt.cpp @@ -209,7 +209,7 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx, ctx->total[0] &= 0xFFFFFFFF; ctx->total[1] += ctx->total[0] < length << 3; if (left && length >= fill) { - memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy(ctx->buffer + left, input, fill); md5_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -221,7 +221,7 @@ void CRYPT_MD5Update(CRYPT_md5_context* ctx, input += 64; } if (length) { - memcpy((void*)(ctx->buffer + left), (void*)input, length); + memcpy(ctx->buffer + left, input, length); } } diff --git a/core/fdrm/crypto/fx_crypt_sha.cpp b/core/fdrm/crypto/fx_crypt_sha.cpp index e0643d547f..d2745e82b1 100644 --- a/core/fdrm/crypto/fx_crypt_sha.cpp +++ b/core/fdrm/crypto/fx_crypt_sha.cpp @@ -481,11 +481,11 @@ void CRYPT_SHA256Update(CRYPT_sha256_context* ctx, uint32_t fill = 64 - left; ctx->total[0] += length; ctx->total[0] &= 0xFFFFFFFF; - if (ctx->total[0] < length) { + if (ctx->total[0] < length) ctx->total[1]++; - } + if (left && length >= fill) { - memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy(ctx->buffer + left, input, fill); sha256_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -496,9 +496,8 @@ void CRYPT_SHA256Update(CRYPT_sha256_context* ctx, length -= 64; input += 64; } - if (length) { - memcpy((void*)(ctx->buffer + left), (void*)input, length); - } + if (length) + memcpy(ctx->buffer + left, input, length); } void CRYPT_SHA256Finish(CRYPT_sha256_context* ctx, uint8_t digest[32]) { @@ -550,18 +549,17 @@ void CRYPT_SHA384Start(CRYPT_sha384_context* ctx) { void CRYPT_SHA384Update(CRYPT_sha384_context* ctx, const uint8_t* input, uint32_t length) { - uint32_t left, fill; - if (!length) { + if (!length) return; - } - left = (uint32_t)ctx->total[0] & 0x7F; - fill = 128 - left; + + uint32_t left = static_cast(ctx->total[0]) & 0x7F; + uint32_t fill = 128 - left; ctx->total[0] += length; - if (ctx->total[0] < length) { + if (ctx->total[0] < length) ctx->total[1]++; - } + if (left && length >= fill) { - memcpy((void*)(ctx->buffer + left), (void*)input, fill); + memcpy(ctx->buffer + left, input, fill); sha384_process(ctx, ctx->buffer); length -= fill; input += fill; @@ -572,9 +570,8 @@ void CRYPT_SHA384Update(CRYPT_sha384_context* ctx, length -= 128; input += 128; } - if (length) { - memcpy((void*)(ctx->buffer + left), (void*)input, length); - } + if (length) + memcpy(ctx->buffer + left, input, length); } void CRYPT_SHA384Finish(CRYPT_sha384_context* ctx, uint8_t digest[48]) { -- cgit v1.2.3