projects
/
mono.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #2208 from martinbooth/dataannotation_strings_from_corefx_without_resx
[mono.git]
/
support
/
zlib-helper.c
diff --git
a/support/zlib-helper.c
b/support/zlib-helper.c
index 47adde38dbf44a408e189afefded1c3f91e38d66..dbfd1c7e24a27e7dd67283e6c1df7401b17d6100 100644
(file)
--- a/
support/zlib-helper.c
+++ b/
support/zlib-helper.c
@@
-45,7
+45,7
@@
gint WriteZStream (ZStream *stream, guchar *buffer, gint length);
static gint flush_internal (ZStream *stream, gboolean is_final);
static void *
static gint flush_internal (ZStream *stream, gboolean is_final);
static void *
-z_alloc (void *opaque,
gsize nitems, gsize
item_size)
+z_alloc (void *opaque,
unsigned int nitems, unsigned int
item_size)
{
return g_malloc0 (nitems * item_size);
}
{
return g_malloc0 (nitems * item_size);
}
@@
-90,6
+90,8
@@
CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
result->gchandle = gchandle;
result->compress = compress;
result->buffer = g_new (guchar, BUFFER_SIZE);
result->gchandle = gchandle;
result->compress = compress;
result->buffer = g_new (guchar, BUFFER_SIZE);
+ result->stream->next_out = result->buffer;
+ result->stream->avail_out = BUFFER_SIZE;
return result;
}
return result;
}
@@
-148,7
+150,7
@@
flush_internal (ZStream *stream, gboolean is_final)
if (!stream->compress)
return 0;
if (!stream->compress)
return 0;
- if (!is_final) {
+ if (!is_final
&& stream->stream->avail_in != 0
) {
status = deflate (stream->stream, Z_PARTIAL_FLUSH);
if (status != Z_OK && status != Z_STREAM_END)
return status;
status = deflate (stream->stream, Z_PARTIAL_FLUSH);
if (status != Z_OK && status != Z_STREAM_END)
return status;
@@
-185,9
+187,12
@@
ReadZStream (ZStream *stream, guchar *buffer, gint length)
stream->eof = TRUE;
}
zs->next_in = stream->buffer;
stream->eof = TRUE;
}
zs->next_in = stream->buffer;
- zs->avail_in = n;
+ zs->avail_in = n
< 0 ? 0 : n
;
}
}
+ if (zs->avail_in == 0 && zs->total_in == 0)
+ return Z_STREAM_END;
+
status = inflate (stream->stream, Z_SYNC_FLUSH);
if (status == Z_STREAM_END) {
stream->eof = TRUE;
status = inflate (stream->stream, Z_SYNC_FLUSH);
if (status == Z_STREAM_END) {
stream->eof = TRUE;