mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 01:38:37 +12:00
C-style cast cleanup (partial)
Replace C-style casts with C++ casts.
This commit is contained in:
parent
8bd52c9843
commit
5b9df53c13
20 changed files with 280 additions and 334 deletions
|
@ -27,7 +27,7 @@
|
|||
*
|
||||
* http://www.itl.nist.gov/fipspubs/fip180-1.htm
|
||||
*/
|
||||
|
||||
|
||||
#include "sha1.h"
|
||||
|
||||
/*
|
||||
|
@ -36,20 +36,20 @@
|
|||
#ifndef GET_UINT32_BE
|
||||
#define GET_UINT32_BE(n,b,i) \
|
||||
{ \
|
||||
(n) = ( (uint32_t) (b)[(i) ] << 24 ) \
|
||||
| ( (uint32_t) (b)[(i) + 1] << 16 ) \
|
||||
| ( (uint32_t) (b)[(i) + 2] << 8 ) \
|
||||
| ( (uint32_t) (b)[(i) + 3] ); \
|
||||
(n) = ( static_cast<uint32_t>((b)[(i) ]) << 24 ) \
|
||||
| ( static_cast<uint32_t>((b)[(i) + 1]) << 16 ) \
|
||||
| ( static_cast<uint32_t>((b)[(i) + 2]) << 8 ) \
|
||||
| ( static_cast<uint32_t>((b)[(i) + 3]) );\
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PUT_UINT32_BE
|
||||
#define PUT_UINT32_BE(n,b,i) \
|
||||
{ \
|
||||
(b)[(i) ] = (unsigned char) ( (n) >> 24 ); \
|
||||
(b)[(i) + 1] = (unsigned char) ( (n) >> 16 ); \
|
||||
(b)[(i) + 2] = (unsigned char) ( (n) >> 8 ); \
|
||||
(b)[(i) + 3] = (unsigned char) ( (n) ); \
|
||||
(b)[(i) ] = static_cast<unsigned char> ( (n) >> 24 ); \
|
||||
(b)[(i) + 1] = static_cast<unsigned char> ( (n) >> 16 ); \
|
||||
(b)[(i) + 2] = static_cast<unsigned char> ( (n) >> 8 ); \
|
||||
(b)[(i) + 3] = static_cast<unsigned char> ( (n) ); \
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -239,15 +239,15 @@ void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
|||
left = ctx->total[0] & 0x3F;
|
||||
fill = 64 - left;
|
||||
|
||||
ctx->total[0] += (uint32_t) ilen;
|
||||
ctx->total[0] += static_cast<uint32_t>(ilen);
|
||||
ctx->total[0] &= 0xFFFFFFFF;
|
||||
|
||||
if( ctx->total[0] < (uint32_t) ilen )
|
||||
if( ctx->total[0] < static_cast<uint32_t>(ilen) )
|
||||
ctx->total[1]++;
|
||||
|
||||
if( left && ilen >= fill )
|
||||
{
|
||||
memcpy( (void *) (ctx->buffer + left), input, fill );
|
||||
memcpy( ctx->buffer + left, input, fill );
|
||||
sha1_process( ctx, ctx->buffer );
|
||||
input += fill;
|
||||
ilen -= fill;
|
||||
|
@ -262,7 +262,7 @@ void sha1_update( sha1_context *ctx, const unsigned char *input, size_t ilen )
|
|||
}
|
||||
|
||||
if( ilen > 0 )
|
||||
memcpy( (void *) (ctx->buffer + left), input, ilen );
|
||||
memcpy( ctx->buffer + left, input, ilen );
|
||||
}
|
||||
|
||||
static const unsigned char sha1_padding[64] =
|
||||
|
@ -336,8 +336,8 @@ void sha1_hmac_starts( sha1_context *ctx, const unsigned char *key, size_t keyle
|
|||
|
||||
for( i = 0; i < keylen; i++ )
|
||||
{
|
||||
ctx->ipad[i] = (unsigned char)( ctx->ipad[i] ^ key[i] );
|
||||
ctx->opad[i] = (unsigned char)( ctx->opad[i] ^ key[i] );
|
||||
ctx->ipad[i] ^= key[i];
|
||||
ctx->opad[i] ^= key[i];
|
||||
}
|
||||
|
||||
sha1_starts( ctx );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue