[gmime-devel] Problem with GMimeFilterGZip



I don't know why but the GZip filter doesn't process the string completely. I have a base64 filter and gzip. If I remove the gzip everything works as expected and the base64 represents the original text but with the gzip the result is inconsistent.
  
string zip_b64(string s)
{
   const char *filename = "z002.txt.gz";
   GMimeStream *stream_out, *stream_filter_out;
   GMimeFilter *gzip_filter, *b64_filter, *dos2unix_filter;
   GByteArray *array;
   array = g_byte_array_sized_new(s.size());
   /* Stream / Filter setup */
   stream_out = g_mime_stream_mem_new_with_byte_array(array);
   g_mime_stream_mem_set_owner ((GMimeStreamMem *) stream_out, FALSE);
   stream_filter_out = g_mime_stream_filter_new(stream_out);
   /* zip filter */
   gzip_filter = g_mime_filter_gzip_new (GMIME_FILTER_GZIP_MODE_ZIP, 9);
   g_mime_filter_gzip_set_filename ((GMimeFilterGZip *) gzip_filter, filename);
   g_mime_stream_filter_add ((GMimeStreamFilter *) stream_filter_out, gzip_filter);

   /* b64 filter */
   b64_filter = g_mime_filter_basic_new(GMIME_CONTENT_ENCODING_BASE64, TRUE);
   g_mime_stream_filter_add ((GMimeStreamFilter *) stream_filter_out, b64_filter);
   g_mime_stream_write(stream_filter_out, s.c_str(), s.size());
   g_mime_stream_flush (stream_filter_out);
   string res((char*)array->data, g_mime_stream_length((GMimeStream*)stream_out));
   //======================================================================
   g_mime_filter_reset (b64_filter);
   g_mime_filter_reset (gzip_filter);
   g_object_unref (b64_filter);
   g_object_unref (gzip_filter);
   g_object_unref (stream_out);
   g_byte_array_unref (array);
   return res;
}

The result is inreality incomplete, it's missing 2 lines at the bottom.

H4sICAAAAAAC/3owMDIudHh0Lmd6ANSaX3OiMBDA3+9T8N7BSTYJCY8Sda497VmxXts3T+mMM1U7
am+m3/5A5E9bUBY9L+4LS9zAj2WzmwQtKxb/fb0J5nnt8zGSQbBevq0mwUc93/rxrLucjDez5cLC
SvNlE6wW403w9TxVvyXGi/F8Z7d5f91q8+U0eAmP62A1G798tsrsLOt1vNpkt83bT8JrWHXkeZW7
U3Sh8Wq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