Silence a bunch of -Wunused-but-set-variable warnings
[platform/upstream/glib.git] / gio / tests / converter-stream.c
index c2625ad..8017015 100644 (file)
@@ -92,14 +92,11 @@ g_expander_converter_convert (GConverter *converter,
                              gsize      *bytes_written,
                              GError    **error)
 {
-  GExpanderConverter  *conv;
   const guint8 *in, *in_end;
   guint8 v, *out;
   int i;
   gsize block_size;
 
-  conv = G_EXPANDER_CONVERTER (converter);
-
   in = inbuf;
   out = outbuf;
   in_end = in + inbuf_size;
@@ -211,14 +208,11 @@ g_compressor_converter_convert (GConverter *converter,
                                gsize      *bytes_written,
                                GError    **error)
 {
-  GCompressorConverter  *conv;
   const guint8 *in, *in_end;
   guint8 v, *out;
   int i;
   gsize block_size;
 
-  conv = G_COMPRESSOR_CONVERTER (converter);
-
   in = inbuf;
   out = outbuf;
   in_end = in + inbuf_size;
@@ -592,7 +586,7 @@ test_corruption (GZlibCompressorFormat format, gint level)
   istream0 = g_memory_input_stream_new_from_data (data0,
     DATA_LENGTH * sizeof (guint32), NULL);
 
-  ostream1 = g_memory_output_stream_new (NULL, 0, g_realloc, NULL);
+  ostream1 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
   compressor = G_CONVERTER (g_zlib_compressor_new (format, level));
   costream1 = g_converter_output_stream_new (ostream1, compressor);
   g_assert (g_converter_output_stream_get_converter (G_CONVERTER_OUTPUT_STREAM (costream1)) == compressor);
@@ -607,17 +601,17 @@ test_corruption (GZlibCompressorFormat format, gint level)
   g_assert_cmpint (fmt, ==, format);
   g_assert_cmpint (lvl, ==, level);
   g_object_unref (compressor);
-  data1 = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (ostream1));
+  data1 = g_memory_output_stream_steal_data (G_MEMORY_OUTPUT_STREAM (ostream1));
   data1_size = g_memory_output_stream_get_data_size (
     G_MEMORY_OUTPUT_STREAM (ostream1));
   g_object_unref (ostream1);
   g_object_unref (istream0);
 
-  istream1 = g_memory_input_stream_new_from_data (data1, data1_size, NULL);
+  istream1 = g_memory_input_stream_new_from_data (data1, data1_size, g_free);
   decompressor = G_CONVERTER (g_zlib_decompressor_new (format));
   cistream1 = g_converter_input_stream_new (istream1, decompressor);
 
-  ostream2 = g_memory_output_stream_new (NULL, 0, g_realloc, NULL);
+  ostream2 = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
 
   g_output_stream_splice (ostream2, cistream1, 0, NULL, &error);
   g_assert_no_error (error);
@@ -633,6 +627,7 @@ test_corruption (GZlibCompressorFormat format, gint level)
   g_object_unref (decompressor);
   g_object_unref (cistream1);
   g_object_unref (ostream2);
+  g_free (data0);
 }
 
 typedef struct {
@@ -700,7 +695,10 @@ test_charset (gconstpointer data)
   g_object_unref (in);
 
   if (test->n_fallbacks == 0)
-    return;
+    {
+       g_object_unref (conv);
+       return;
+    }
 
   g_converter_reset (conv);