mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r5973) -Codechange: md5_append only uses size_t as nbytes param, so use that (michi_cc)
This commit is contained in:
parent
054dd2802b
commit
bd7fabb647
10
md5.c
10
md5.c
@ -323,25 +323,25 @@ md5_init(md5_state_t *pms)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
md5_append(md5_state_t *pms, const void *data, int nbytes)
|
md5_append(md5_state_t *pms, const void *data, size_t nbytes)
|
||||||
{
|
{
|
||||||
const md5_byte_t *p = (const md5_byte_t *)data;
|
const md5_byte_t *p = (const md5_byte_t *)data;
|
||||||
int left = nbytes;
|
size_t left = nbytes;
|
||||||
int offset = (pms->count[0] >> 3) & 63;
|
size_t offset = (pms->count[0] >> 3) & 63;
|
||||||
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
md5_word_t nbits = (md5_word_t)(nbytes << 3);
|
||||||
|
|
||||||
if (nbytes <= 0)
|
if (nbytes <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Update the message length. */
|
/* Update the message length. */
|
||||||
pms->count[1] += nbytes >> 29;
|
pms->count[1] += (md5_word_t)(nbytes >> 29);
|
||||||
pms->count[0] += nbits;
|
pms->count[0] += nbits;
|
||||||
if (pms->count[0] < nbits)
|
if (pms->count[0] < nbits)
|
||||||
pms->count[1]++;
|
pms->count[1]++;
|
||||||
|
|
||||||
/* Process an initial partial block. */
|
/* Process an initial partial block. */
|
||||||
if (offset) {
|
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);
|
memcpy(pms->buf + offset, p, copy);
|
||||||
if (offset + copy < 64)
|
if (offset + copy < 64)
|
||||||
|
2
md5.h
2
md5.h
@ -81,7 +81,7 @@ extern "C"
|
|||||||
void md5_init(md5_state_t *pms);
|
void md5_init(md5_state_t *pms);
|
||||||
|
|
||||||
/* Append a string to the message. */
|
/* Append a string to the message. */
|
||||||
void md5_append(md5_state_t *pms, const void *data, int nbytes);
|
void md5_append(md5_state_t *pms, const void *data, size_t nbytes);
|
||||||
|
|
||||||
/* Finish the message and return the digest. */
|
/* Finish the message and return the digest. */
|
||||||
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
|
||||||
|
Loading…
Reference in New Issue
Block a user