+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;
+
+ if (decompressor->header_data != NULL)
+ {
+ if (decompressor->header_data->file_info)
+ g_object_unref (decompressor->header_data->file_info);
+
+ memset (decompressor->header_data, 0, sizeof (HeaderData));
+ }
+ else
+ {
+ decompressor->header_data = g_new0 (HeaderData, 1);
+ }
+
+ decompressor->header_data->gzheader.name = (Bytef*) &decompressor->header_data->filename;
+ /* We keep one byte to guarantee the string is 0-terminated */
+ decompressor->header_data->gzheader.name_max = 256;
+
+ 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 */
+}
+