mirror of
https://github.com/reactos/ccache.git
synced 2024-11-23 19:59:46 +00:00
use size_t when we refer to memory sizes
This commit is contained in:
parent
5c6b15ddee
commit
8f2365f24d
2
ccache.h
2
ccache.h
@ -56,7 +56,7 @@ int hash_fd(struct mdfour *md, int fd);
|
||||
int hash_file(struct mdfour *md, const char *fname);
|
||||
char *hash_result(struct mdfour *md);
|
||||
void hash_result_as_bytes(struct mdfour *md, unsigned char *out);
|
||||
void hash_buffer(struct mdfour *md, const char *s, int len);
|
||||
void hash_buffer(struct mdfour *md, const char *s, size_t len);
|
||||
|
||||
void cc_log(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
|
||||
void fatal(const char *format, ...) ATTR_FORMAT(printf, 1, 2);
|
||||
|
4
hash.c
4
hash.c
@ -25,7 +25,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void hash_buffer(struct mdfour *md, const char *s, int len)
|
||||
void hash_buffer(struct mdfour *md, const char *s, size_t len)
|
||||
{
|
||||
mdfour_update(md, (unsigned char *)s, len);
|
||||
}
|
||||
@ -51,7 +51,7 @@ void hash_int(struct mdfour *md, int x)
|
||||
int hash_fd(struct mdfour *md, int fd)
|
||||
{
|
||||
char buf[1024];
|
||||
int n;
|
||||
size_t n;
|
||||
|
||||
while ((n = read(fd, buf, sizeof(buf))) > 0) {
|
||||
hash_buffer(md, buf, n);
|
||||
|
6
mdfour.c
6
mdfour.c
@ -110,7 +110,7 @@ void mdfour_begin(struct mdfour *md)
|
||||
}
|
||||
|
||||
|
||||
static void mdfour_tail(const unsigned char *in, int n)
|
||||
static void mdfour_tail(const unsigned char *in, size_t n)
|
||||
{
|
||||
unsigned char buf[128];
|
||||
uint32_t M[16];
|
||||
@ -137,7 +137,7 @@ static void mdfour_tail(const unsigned char *in, int n)
|
||||
}
|
||||
}
|
||||
|
||||
void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
|
||||
void mdfour_update(struct mdfour *md, const unsigned char *in, size_t n)
|
||||
{
|
||||
uint32_t M[16];
|
||||
|
||||
@ -149,7 +149,7 @@ void mdfour_update(struct mdfour *md, const unsigned char *in, int n)
|
||||
}
|
||||
|
||||
if (md->tail_len) {
|
||||
int len = 64 - md->tail_len;
|
||||
size_t len = 64 - md->tail_len;
|
||||
if (len > n) len = n;
|
||||
memcpy(md->tail+md->tail_len, in, len);
|
||||
md->tail_len += len;
|
||||
|
7
mdfour.h
7
mdfour.h
@ -22,17 +22,18 @@
|
||||
#ifndef MDFOUR_H
|
||||
#define MDFOUR_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
struct mdfour {
|
||||
uint32_t A, B, C, D;
|
||||
uint32_t totalN;
|
||||
size_t totalN;
|
||||
unsigned char tail[64];
|
||||
unsigned tail_len;
|
||||
size_t tail_len;
|
||||
};
|
||||
|
||||
void mdfour_begin(struct mdfour *md);
|
||||
void mdfour_update(struct mdfour *md, const unsigned char *in, int n);
|
||||
void mdfour_update(struct mdfour *md, const unsigned char *in, size_t n);
|
||||
void mdfour_result(struct mdfour *md, unsigned char *out);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user