Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Pryor <jpryor@novell.com>2009-09-14 22:23:20 +0400
committerJonathan Pryor <jpryor@novell.com>2009-09-14 22:23:20 +0400
commitd3c8efd06321a4dfe952b66e947565ed4fc143b3 (patch)
tree4b30162b71d0e287b12b7ff689f1de154f904dc1 /support
parent3f987a1b6f13bab0520eec76ebbf312380bc4390 (diff)
* zlib-helper.c: support reverse callbacks within MonoTouch.
svn path=/trunk/mono/; revision=141900
Diffstat (limited to 'support')
-rw-r--r--support/ChangeLog4
-rw-r--r--support/zlib-helper.c12
2 files changed, 11 insertions, 5 deletions
diff --git a/support/ChangeLog b/support/ChangeLog
index 86e1c9536a1..36d462ee3f7 100644
--- a/support/ChangeLog
+++ b/support/ChangeLog
@@ -1,3 +1,7 @@
+2009-09-14 Jonathan Pryor <jpryor@novell.com>
+
+ * zlib-helper.c: support reverse callbacks within MonoTouch.
+
2009-09-09 Gonzalo Paniagua Javier <gonzalo@novell.com>
* zconf.h:
diff --git a/support/zlib-helper.c b/support/zlib-helper.c
index 9a692792b10..98fd6879e6b 100644
--- a/support/zlib-helper.c
+++ b/support/zlib-helper.c
@@ -26,17 +26,18 @@
#define ARGUMENT_ERROR -10
#define IO_ERROR -11
-typedef gint (*read_write_func) (guchar *buffer, gint length);
+typedef gint (*read_write_func) (guchar *buffer, gint length, void *gchandle);
struct _ZStream {
z_stream *stream;
guchar *buffer;
read_write_func func;
+ void *gchandle;
guchar compress;
guchar eof;
};
typedef struct _ZStream ZStream;
-ZStream *CreateZStream (gint compress, guchar gzip, read_write_func func);
+ZStream *CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle);
gint CloseZStream (ZStream *zstream);
gint Flush (ZStream *stream);
gint ReadZStream (ZStream *stream, guchar *buffer, gint length);
@@ -55,7 +56,7 @@ z_free (void *opaque, void *ptr)
}
ZStream *
-CreateZStream (gint compress, guchar gzip, read_write_func func)
+CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
{
z_stream *z;
gint retval;
@@ -85,6 +86,7 @@ CreateZStream (gint compress, guchar gzip, read_write_func func)
result = g_new0 (ZStream, 1);
result->stream = z;
result->func = func;
+ result->gchandle = gchandle;
result->compress = compress;
result->buffer = g_new (guchar, BUFFER_SIZE);
return result;
@@ -126,7 +128,7 @@ write_to_managed (ZStream *stream)
zs = stream->stream;
if (zs->avail_out != BUFFER_SIZE) {
- n = stream->func (stream->buffer, BUFFER_SIZE - zs->avail_out);
+ n = stream->func (stream->buffer, BUFFER_SIZE - zs->avail_out, stream->gchandle);
zs->next_out = stream->buffer;
zs->avail_out = BUFFER_SIZE;
if (n < 0)
@@ -162,7 +164,7 @@ ReadZStream (ZStream *stream, guchar *buffer, gint length)
zs->avail_out = length;
while (zs->avail_out > 0) {
if (zs->avail_in == 0) {
- n = stream->func (stream->buffer, BUFFER_SIZE);
+ n = stream->func (stream->buffer, BUFFER_SIZE, stream->gchandle);
if (n <= 0) {
stream->eof = TRUE;
break;