[Cmake-commits] [cmake-commits] david.cole committed MD5.c 1.1 1.2
cmake-commits at cmake.org
cmake-commits at cmake.org
Wed Jul 8 16:15:23 EDT 2009
Update of /cvsroot/CMake/CMake/Source/kwsys
In directory public:/mounts/ram/cvs-serv14862
Modified Files:
MD5.c
Log Message:
COMP: Eliminate "conversion may change sign of result" warnings by using size_t where appropriate.
Index: MD5.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/MD5.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** MD5.c 14 Mar 2007 19:12:10 -0000 1.1
--- MD5.c 8 Jul 2009 20:15:21 -0000 1.2
***************
*** 21,24 ****
--- 21,25 ----
#endif
+ #include <stddef.h> /* size_t */
#include <stdlib.h> /* malloc, free */
#include <string.h> /* memcpy, strlen */
***************
*** 239,243 ****
# endif
for (i = 0; i < 16; ++i, xp += 4)
! xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24);
}
#endif
--- 240,245 ----
# endif
for (i = 0; i < 16; ++i, xp += 4)
! xbuf[i] = (md5_word_t)(xp[0] + (xp[1] << 8) +
! (xp[2] << 16) + (xp[3] << 24));
}
#endif
***************
*** 370,378 ****
/* Append a string to the message. */
! static void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes)
{
const md5_byte_t *p = data;
! int left = nbytes;
! int offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
--- 372,380 ----
/* Append a string to the message. */
! static void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
{
const md5_byte_t *p = data;
! size_t left = nbytes;
! size_t offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);
***************
*** 388,392 ****
/* Process an initial partial block. */
if (offset) {
! int copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy);
--- 390,394 ----
/* Process an initial partial block. */
if (offset) {
! size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
memcpy(pms->buf + offset, p, copy);
***************
*** 475,479 ****
length = (int)strlen((char const*)data);
}
! md5_append(&md5->md5_state, (md5_byte_t const*)data, length);
}
--- 477,481 ----
length = (int)strlen((char const*)data);
}
! md5_append(&md5->md5_state, (md5_byte_t const*)data, (size_t)length);
}
More information about the Cmake-commits
mailing list