From 330836db8ea03d2cee5968f46a9210905d5275de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 26 Mar 2023 16:40:28 +0100 Subject: [PATCH] taglist, plugins: fix compiler warnings with GLib >= 2.76 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: --- .../gst-plugins-bad/ext/teletextdec/gstteletextdec.c | 8 ++++---- subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c | 3 +-- subprojects/gst-plugins-bad/sys/winks/kshelpers.c | 6 +----- subprojects/gst-plugins-bad/tools/gst-app-maker | 2 +- subprojects/gst-plugins-base/gst/subparse/gstsubparse.c | 3 +-- subprojects/gstreamer/gst/gsttaglist.c | 3 +-- 6 files changed, 9 insertions(+), 16 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/teletextdec/gstteletextdec.c b/subprojects/gst-plugins-bad/ext/teletextdec/gstteletextdec.c index 38d6f69b5c..b891f7964c 100644 --- a/subprojects/gst-plugins-bad/ext/teletextdec/gstteletextdec.c +++ b/subprojects/gst-plugins-bad/ext/teletextdec/gstteletextdec.c @@ -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; } diff --git a/subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c b/subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c index 7a379b1eca..ac57ffa70d 100644 --- a/subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c +++ b/subprojects/gst-plugins-bad/sys/winks/gstksvideodevice.c @@ -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); } } diff --git a/subprojects/gst-plugins-bad/sys/winks/kshelpers.c b/subprojects/gst-plugins-bad/sys/winks/kshelpers.c index 80bb4775b2..61484615ec 100644 --- a/subprojects/gst-plugins-bad/sys/winks/kshelpers.c +++ b/subprojects/gst-plugins-bad/sys/winks/kshelpers.c @@ -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 diff --git a/subprojects/gst-plugins-bad/tools/gst-app-maker b/subprojects/gst-plugins-bad/tools/gst-app-maker index c96892a6fd..492ac8cdc9 100755 --- a/subprojects/gst-plugins-bad/tools/gst-app-maker +++ b/subprojects/gst-plugins-bad/tools/gst-app-maker @@ -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); diff --git a/subprojects/gst-plugins-base/gst/subparse/gstsubparse.c b/subprojects/gst-plugins-base/gst/subparse/gstsubparse.c index ffa00d0a15..0f7425d863 100644 --- a/subprojects/gst-plugins-base/gst/subparse/gstsubparse.c +++ b/subprojects/gst-plugins-base/gst/subparse/gstsubparse.c @@ -608,8 +608,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); diff --git a/subprojects/gstreamer/gst/gsttaglist.c b/subprojects/gstreamer/gst/gsttaglist.c index 14fd397d13..eb3f9ce64a 100644 --- a/subprojects/gstreamer/gst/gsttaglist.c +++ b/subprojects/gstreamer/gst/gsttaglist.c @@ -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 *