[glib] Fix building with zlib < 1.2.4 on win32
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix building with zlib < 1.2.4 on win32
- Date: Wed, 1 Sep 2010 13:11:42 +0000 (UTC)
commit db0eaa299c66d82552645fa42f20d13a791bc53c
Author: Christian Persch <chpe gnome org>
Date: Wed Sep 1 15:05:59 2010 +0200
Fix building with zlib < 1.2.4 on win32
The gzip header processing functions were only exported
since 1.2.4 on win32, so #ifdef this code accordingly.
Bug #628505.
gio/gzlibcompressor.c | 3 +++
gio/gzlibdecompressor.c | 5 +++++
2 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gio/gzlibcompressor.c b/gio/gzlibcompressor.c
index bfcbcff..3c54753 100644
--- a/gio/gzlibcompressor.c
+++ b/gio/gzlibcompressor.c
@@ -72,6 +72,8 @@ struct _GZlibCompressor
static void
g_zlib_compressor_set_gzheader (GZlibCompressor *compressor)
{
+ /* On win32, these functions were not exported before 1.2.4 */
+#if !defined (G_OS_WIN32) || ZLIB_VERNUM >= 0x1240
const gchar *filename;
if (compressor->format != G_ZLIB_COMPRESSOR_FORMAT_GZIP ||
@@ -91,6 +93,7 @@ g_zlib_compressor_set_gzheader (GZlibCompressor *compressor)
if (deflateSetHeader (&compressor->zstream, &compressor->gzheader) != Z_OK)
g_warning ("unexpected zlib error: %s\n", compressor->zstream.msg);
+#endif /* !G_OS_WIN32 || ZLIB >= 1.2.4 */
}
G_DEFINE_TYPE_WITH_CODE (GZlibCompressor, g_zlib_compressor, G_TYPE_OBJECT,
diff --git a/gio/gzlibdecompressor.c b/gio/gzlibdecompressor.c
index f072613..df70e7e 100644
--- a/gio/gzlibdecompressor.c
+++ b/gio/gzlibdecompressor.c
@@ -75,6 +75,8 @@ struct _GZlibDecompressor
static void
g_zlib_decompressor_set_gzheader (GZlibDecompressor *decompressor)
{
+ /* On win32, these functions were not exported before 1.2.4 */
+#if !defined (G_OS_WIN32) || ZLIB_VERNUM >= 0x1240
if (decompressor->format != G_ZLIB_COMPRESSOR_FORMAT_GZIP)
return;
@@ -96,6 +98,7 @@ g_zlib_decompressor_set_gzheader (GZlibDecompressor *decompressor)
if (inflateGetHeader (&decompressor->zstream, &decompressor->header_data->gzheader) != Z_OK)
g_warning ("unexpected zlib error: %s\n", decompressor->zstream.msg);
+#endif /* !G_OS_WIN32 || ZLIB >= 1.2.4 */
}
G_DEFINE_TYPE_WITH_CODE (GZlibDecompressor, g_zlib_decompressor, G_TYPE_OBJECT,
@@ -373,6 +376,7 @@ g_zlib_decompressor_convert (GConverter *converter,
*bytes_read = inbuf_size - decompressor->zstream.avail_in;
*bytes_written = outbuf_size - decompressor->zstream.avail_out;
+#if !defined (G_OS_WIN32) || ZLIB_VERNUM >= 0x1240
if (decompressor->header_data != NULL &&
decompressor->header_data->gzheader.done == 1)
{
@@ -396,6 +400,7 @@ g_zlib_decompressor_convert (GConverter *converter,
g_object_notify (G_OBJECT (decompressor), "file-info");
}
+#endif /* !G_OS_WIN32 || ZLIB >= 1.2.4 */
if (res == Z_STREAM_END)
return G_CONVERTER_FINISHED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]