summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2009-07-08 20:15:21 (GMT)
committerDavid Cole <david.cole@kitware.com>2009-07-08 20:15:21 (GMT)
commit80d32d96f363cd07e1ad23ec1a2028a8e55e2052 (patch)
tree70aeadd28e4f3eeb54fedc249a94aa4627f80608 /Source
parent6028f3a4c70ee2ad00e8c1c54a31855be7ab3d0f (diff)
downloadCMake-80d32d96f363cd07e1ad23ec1a2028a8e55e2052.zip
CMake-80d32d96f363cd07e1ad23ec1a2028a8e55e2052.tar.gz
CMake-80d32d96f363cd07e1ad23ec1a2028a8e55e2052.tar.bz2
COMP: Eliminate "conversion may change sign of result" warnings by using size_t where appropriate.
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/MD5.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c
index efc84db..8d2905a 100644
--- a/Source/kwsys/MD5.c
+++ b/Source/kwsys/MD5.c
@@ -20,6 +20,7 @@
# include "MD5.h.in"
#endif
+#include <stddef.h> /* size_t */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy, strlen */
@@ -238,7 +239,8 @@ md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
- xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
+ xbuf[i] = (md5_word_t)(xp[0] + (xp[1] << 8) +
+ (xp[2] << 16) + (xp[3] << 24));
}
#endif
}
@@ -369,11 +371,11 @@ static void md5_init(md5_state_t *pms)
}
/* Append a string to the message. */
-static void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
+static void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
{
const md5_byte_t *p = data;
- int left = nbytes;
- int offset = (pms->count[0] >> 3) & 63;
+ size_t left = nbytes;
+ size_t offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
if (nbytes <= 0)
@@ -387,7 +389,7 @@ static void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
/* Process an initial partial block. */
if (offset) {
- int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
+ size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
@@ -474,7 +476,7 @@ void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length)
{
length = (int)strlen((char const*)data);
}
- md5_append(&md5->md5_state, (md5_byte_t const*)data, length);
+ md5_append(&md5->md5_state, (md5_byte_t const*)data, (size_t)length);
}
/*--------------------------------------------------------------------------*/