Add casts to get rid of some warnings when filling zlib structures
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/src/filebuf.c b/src/filebuf.c
index 70245b5..e8c5087 100644
--- a/src/filebuf.c
+++ b/src/filebuf.c
@@ -117,18 +117,18 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
if (len > 0 || file->flush_mode == Z_FINISH) {
zs->next_in = source;
- zs->avail_in = len;
+ zs->avail_in = (uInt)len;
do {
- int have;
+ size_t have;
zs->next_out = file->z_buf;
- zs->avail_out = file->buf_size;
+ zs->avail_out = (uInt)file->buf_size;
result = deflate(zs, file->flush_mode);
assert(result != Z_STREAM_ERROR);
- have = file->buf_size - zs->avail_out;
+ have = file->buf_size - (size_t)zs->avail_out;
if (p_write(file->fd, file->z_buf, have) < GIT_SUCCESS)
return git__throw(GIT_EOSERR, "Failed to write to file");
diff --git a/src/odb_loose.c b/src/odb_loose.c
index a3a4e5b..e6aecc6 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -183,19 +183,19 @@ static void init_stream(z_stream *s, void *out, size_t len)
{
memset(s, 0, sizeof(*s));
s->next_out = out;
- s->avail_out = len;
+ s->avail_out = (uInt)len;
}
static void set_stream_input(z_stream *s, void *in, size_t len)
{
s->next_in = in;
- s->avail_in = len;
+ s->avail_in = (uInt)len;
}
static void set_stream_output(z_stream *s, void *out, size_t len)
{
s->next_out = out;
- s->avail_out = len;
+ s->avail_out = (uInt)len;
}
@@ -243,10 +243,10 @@ static int inflate_buffer(void *in, size_t inlen, void *out, size_t outlen)
memset(&zs, 0x0, sizeof(zs));
zs.next_out = out;
- zs.avail_out = outlen;
+ zs.avail_out = (uInt)outlen;
zs.next_in = in;
- zs.avail_in = inlen;
+ zs.avail_in = (uInt)inlen;
if (inflateInit(&zs) < Z_OK)
return git__throw(GIT_ERROR, "Failed to inflate buffer");
diff --git a/src/pack.c b/src/pack.c
index d882516..d5e069a 100644
--- a/src/pack.c
+++ b/src/pack.c
@@ -404,7 +404,7 @@ int packfile_unpack_compressed(
memset(&stream, 0, sizeof(stream));
stream.next_out = buffer;
- stream.avail_out = size + 1;
+ stream.avail_out = (uInt)size + 1;
st = inflateInit(&stream);
if (st != Z_OK) {