summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2010-04-26 20:10:44 +0100
committerRamsay Jones <ramsay@ramsay1.demon.co.uk>2010-04-28 20:55:56 +0100
commite272b10388ebc4b7ed9fe2b42dd46e367193c218 (patch)
tree3e337843bf57f0fd5b29d56e8678d23bedb78b49 /src
parente2337f39c3a4ab046b7a572fce89df27451fd2bb (diff)
downloadlibgit2-e272b10388ebc4b7ed9fe2b42dd46e367193c218.tar.gz
MSVC: Fix some compiler warnings
In particular, using the normal (or production) compiler warning level (-W3), msvc complains as follows: .../sha1.c(244) : warning C4018: '<' : signed/unsigned mismatch .../sha1.c(270) : warning C4244: 'function' : conversion from \ 'unsigned __int64' to 'unsigned long', possible loss of data .../sha1.c(271) : warning C4244: 'function' : conversion from \ 'unsigned __int64' to 'unsigned long', possible loss of data Note that gcc issues a similar complaint about line 244 when compiling with -Wextra. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/block-sha1/sha1.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/block-sha1/sha1.c b/src/block-sha1/sha1.c
index 50b20c4bd..b433410c8 100644
--- a/src/block-sha1/sha1.c
+++ b/src/block-sha1/sha1.c
@@ -234,13 +234,13 @@ void blk_SHA1_Init(blk_SHA_CTX *ctx)
void blk_SHA1_Update(blk_SHA_CTX *ctx, const void *data, unsigned long len)
{
- int lenW = ctx->size & 63;
+ unsigned int lenW = ctx->size & 63;
ctx->size += len;
/* Read the data into W and process blocks as they get full */
if (lenW) {
- int left = 64 - lenW;
+ unsigned int left = 64 - lenW;
if (len < left)
left = len;
memcpy(lenW + (char *)ctx->W, data, left);
@@ -267,8 +267,8 @@ void blk_SHA1_Final(unsigned char hashout[20], blk_SHA_CTX *ctx)
int i;
/* Pad with a binary 1 (ie 0x80), then zeroes, then length */
- padlen[0] = htonl(ctx->size >> 29);
- padlen[1] = htonl(ctx->size << 3);
+ padlen[0] = htonl((uint32_t)(ctx->size >> 29));
+ padlen[1] = htonl((uint32_t)(ctx->size << 3));
i = ctx->size & 63;
blk_SHA1_Update(ctx, pad, 1+ (63 & (55 - i)));