mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
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.
This commit is contained in:
parent
ed72dcdd45
commit
db0eaa299c
@ -72,6 +72,8 @@ struct _GZlibCompressor
|
|||||||
static void
|
static void
|
||||||
g_zlib_compressor_set_gzheader (GZlibCompressor *compressor)
|
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;
|
const gchar *filename;
|
||||||
|
|
||||||
if (compressor->format != G_ZLIB_COMPRESSOR_FORMAT_GZIP ||
|
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)
|
if (deflateSetHeader (&compressor->zstream, &compressor->gzheader) != Z_OK)
|
||||||
g_warning ("unexpected zlib error: %s\n", compressor->zstream.msg);
|
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,
|
G_DEFINE_TYPE_WITH_CODE (GZlibCompressor, g_zlib_compressor, G_TYPE_OBJECT,
|
||||||
|
@ -75,6 +75,8 @@ struct _GZlibDecompressor
|
|||||||
static void
|
static void
|
||||||
g_zlib_decompressor_set_gzheader (GZlibDecompressor *decompressor)
|
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)
|
if (decompressor->format != G_ZLIB_COMPRESSOR_FORMAT_GZIP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -96,6 +98,7 @@ g_zlib_decompressor_set_gzheader (GZlibDecompressor *decompressor)
|
|||||||
|
|
||||||
if (inflateGetHeader (&decompressor->zstream, &decompressor->header_data->gzheader) != Z_OK)
|
if (inflateGetHeader (&decompressor->zstream, &decompressor->header_data->gzheader) != Z_OK)
|
||||||
g_warning ("unexpected zlib error: %s\n", decompressor->zstream.msg);
|
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,
|
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_read = inbuf_size - decompressor->zstream.avail_in;
|
||||||
*bytes_written = outbuf_size - decompressor->zstream.avail_out;
|
*bytes_written = outbuf_size - decompressor->zstream.avail_out;
|
||||||
|
|
||||||
|
#if !defined (G_OS_WIN32) || ZLIB_VERNUM >= 0x1240
|
||||||
if (decompressor->header_data != NULL &&
|
if (decompressor->header_data != NULL &&
|
||||||
decompressor->header_data->gzheader.done == 1)
|
decompressor->header_data->gzheader.done == 1)
|
||||||
{
|
{
|
||||||
@ -396,6 +400,7 @@ g_zlib_decompressor_convert (GConverter *converter,
|
|||||||
|
|
||||||
g_object_notify (G_OBJECT (decompressor), "file-info");
|
g_object_notify (G_OBJECT (decompressor), "file-info");
|
||||||
}
|
}
|
||||||
|
#endif /* !G_OS_WIN32 || ZLIB >= 1.2.4 */
|
||||||
|
|
||||||
if (res == Z_STREAM_END)
|
if (res == Z_STREAM_END)
|
||||||
return G_CONVERTER_FINISHED;
|
return G_CONVERTER_FINISHED;
|
||||||
|
Loading…
Reference in New Issue
Block a user