taglist, plugins: fix compiler warnings with GLib >= 2.76
authorTim-Philipp Müller <tim@centricular.com>
Sun, 26 Mar 2023 15:40:28 +0000 (16:40 +0100)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Wed, 12 Jul 2023 08:58:50 +0000 (08:58 +0000)
Fix compiler warnings about not using the return value when
freeing the GString segment with g_string_free(.., FALSE):

    ignoring return value of ‘g_string_free_and_steal’ declared with attribute ‘warn_unused_result’

which we get with newer GLib versions. These were all harmless.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5015>

subprojects/gst-plugins-bad/ext/teletextdec/gstteletextdec.c
subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c
subprojects/gst-plugins-bad/sys/winks/kshelpers.c
subprojects/gst-plugins-bad/tools/gst-app-maker
subprojects/gst-plugins-base/gst/subparse/gstsubparse.c
subprojects/gstreamer/gst/gsttaglist.c

index 38d6f69..b891f79 100644 (file)
@@ -874,9 +874,8 @@ gst_teletextdec_export_text_page (GstTeletextDec * teletext, vbi_page * page,
     if (!g_strcmp0 (subs->str, ""))
       g_string_append (subs, "\n");
 
-    text = subs->str;
     size = subs->len + 1;
-    g_string_free (subs, FALSE);
+    text = g_string_free (subs, FALSE);
     g_strfreev (lines);
   } else {
     size = page->columns * page->rows;
@@ -935,6 +934,7 @@ gst_teletextdec_export_pango_page (GstTeletextDec * teletext, vbi_page * page,
   gchar **lines;
   GString *subs;
   guint start, stop, k;
+  gsize len;
   gint i, j;
 
   colors = (gchar **) g_malloc (sizeof (gchar *) * (rows + 1));
@@ -965,11 +965,11 @@ gst_teletextdec_export_pango_page (GstTeletextDec * teletext, vbi_page * page,
   }
 
   /* Allocate new buffer */
-  *buf = gst_buffer_new_wrapped (subs->str, subs->len + 1);
+  len = subs->len + 1;
+  *buf = gst_buffer_new_wrapped (g_string_free (subs, FALSE), len);
 
   g_strfreev (lines);
   g_strfreev (colors);
-  g_string_free (subs, FALSE);
   return GST_FLOW_OK;
 }
 
index 7a379b1..ac57ffa 100644 (file)
@@ -237,8 +237,7 @@ gst_ks_video_device_parse_win32_error (const gchar * func_name,
           : "failed to retrieve system error message");
     }
 
-    *ret_error_str = message->str;
-    g_string_free (message, FALSE);
+    *ret_error_str = g_string_free (message, FALSE);
   }
 }
 
index 80bb477..6148461 100644 (file)
@@ -383,7 +383,6 @@ ks_state_to_string (KSSTATE state)
 gchar *
 ks_options_flags_to_string (gulong flags)
 {
-  gchar *ret;
   GString *str;
 
   str = g_string_sized_new (128);
@@ -404,10 +403,7 @@ ks_options_flags_to_string (gulong flags)
   if (flags != 0)
     g_string_append_printf (str, "|0x%08x", (guint) flags);
 
-  ret = str->str;
-  g_string_free (str, FALSE);
-
-  return ret;
+  return g_string_free (str, FALSE);
 }
 
 typedef struct
index c96892a..492ac8c 100755 (executable)
@@ -261,7 +261,7 @@ gst_replace_create_pipeline (GstReplace *replace)
   if (verbose) g_print ("pipeline: %s\n", pipe_desc->str);
 
   pipeline = (GstElement *) gst_parse_launch (pipe_desc->str, &error);
-  g_string_free (pipe_desc, FALSE);
+  g_string_free (pipe_desc, TRUE);
 
   if (error) {
     g_print("pipeline parsing error: %s\n", error->message);
index b33ddbb..1867dee 100644 (file)
@@ -610,8 +610,7 @@ parse_mdvdsub (ParserState * state, const gchar * line)
       break;
     }
   }
-  ret = markup->str;
-  g_string_free (markup, FALSE);
+  ret = g_string_free (markup, FALSE);
   GST_DEBUG ("parse_mdvdsub returning (%f+%f): %s",
       state->start_time / (double) GST_SECOND,
       state->duration / (double) GST_SECOND, ret);
index 07519fe..456580c 100644 (file)
@@ -455,8 +455,7 @@ gst_tag_merge_strings_with_comma (GValue * dest, const GValue * src)
   }
 
   g_value_init (dest, G_TYPE_STRING);
-  g_value_take_string (dest, str->str);
-  g_string_free (str, FALSE);
+  g_value_take_string (dest, g_string_free (str, FALSE));
 }
 
 static GstTagInfo *