Commit 1c3fac4d by Sebastian Schuberth

Add casts to get rid of some warnings when filling zlib structures

parent 353560b4
......@@ -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");
......
......@@ -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");
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment