Use g_pattern_spec_match() instead of g_pattern_match() which is deprecated since glib 2.70

Fixes compiler warnings with glib 2.70

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1279>
This commit is contained in:
Tim-Philipp Müller 2021-10-30 00:34:35 +01:00
parent 17bf17b38d
commit d96e44922e
4 changed files with 20 additions and 4 deletions

View file

@ -516,6 +516,10 @@ gst_validate_runner_get_default_reporting_level (GstValidateRunner * runner)
return runner->priv->default_level; return runner->priv->default_level;
} }
#if !GLIB_CHECK_VERSION(2,70,0)
#define g_pattern_spec_match_string g_pattern_match_string
#endif
/* /*
* gst_validate_runner_get_reporting_level_for_name: * gst_validate_runner_get_reporting_level_for_name:
* *
@ -538,7 +542,7 @@ gst_validate_runner_get_reporting_level_for_name (GstValidateRunner * runner,
_replace_double_colons (fixed_name); _replace_double_colons (fixed_name);
for (tmp = runner->priv->report_pattern_levels; tmp; tmp = tmp->next) { for (tmp = runner->priv->report_pattern_levels; tmp; tmp = tmp->next) {
PatternLevel *pattern_level = (PatternLevel *) tmp->data; PatternLevel *pattern_level = (PatternLevel *) tmp->data;
if (g_pattern_match_string (pattern_level->pattern, fixed_name)) { if (g_pattern_spec_match_string (pattern_level->pattern, fixed_name)) {
g_free (fixed_name); g_free (fixed_name);
return pattern_level->level; return pattern_level->level;

View file

@ -2483,6 +2483,10 @@ connect_bus_signals (PlaybackApp * app)
gst_object_unref (bus); gst_object_unref (bus);
} }
#if !GLIB_CHECK_VERSION(2,70,0)
#define g_pattern_spec_match_string g_pattern_match_string
#endif
/* Return GList of paths described in location string */ /* Return GList of paths described in location string */
static GList * static GList *
handle_wildcards (const gchar * location) handle_wildcards (const gchar * location)
@ -2502,7 +2506,7 @@ handle_wildcards (const gchar * location)
} }
while ((name = g_dir_read_name (dir)) != NULL) { while ((name = g_dir_read_name (dir)) != NULL) {
if (g_pattern_match_string (pspec, name)) { if (g_pattern_spec_match_string (pspec, name)) {
res = g_list_append (res, g_strjoin ("/", path, name, NULL)); res = g_list_append (res, g_strjoin ("/", path, name, NULL));
g_print (" found clip %s\n", name); g_print (" found clip %s\n", name);
} }

View file

@ -2552,6 +2552,10 @@ connect_bus_signals (GstElement * pipeline)
gst_object_unref (bus); gst_object_unref (bus);
} }
#if !GLIB_CHECK_VERSION(2,70,0)
#define g_pattern_spec_match_string g_pattern_match_string
#endif
/* Return GList of paths described in location string */ /* Return GList of paths described in location string */
static GList * static GList *
handle_wildcards (const gchar * location) handle_wildcards (const gchar * location)
@ -2571,7 +2575,7 @@ handle_wildcards (const gchar * location)
} }
while ((name = g_dir_read_name (dir)) != NULL) { while ((name = g_dir_read_name (dir)) != NULL) {
if (g_pattern_match_string (pspec, name)) { if (g_pattern_spec_match_string (pspec, name)) {
res = g_list_append (res, g_strjoin ("/", path, name, NULL)); res = g_list_append (res, g_strjoin ("/", path, name, NULL));
g_print (" found clip %s\n", name); g_print (" found clip %s\n", name);
} }

View file

@ -1705,10 +1705,14 @@ gst_debug_get_default_threshold (void)
return (GstDebugLevel) g_atomic_int_get (&__default_level); return (GstDebugLevel) g_atomic_int_get (&__default_level);
} }
#if !GLIB_CHECK_VERSION(2,70,0)
#define g_pattern_spec_match_string g_pattern_match_string
#endif
static gboolean static gboolean
gst_debug_apply_entry (GstDebugCategory * cat, LevelNameEntry * entry) gst_debug_apply_entry (GstDebugCategory * cat, LevelNameEntry * entry)
{ {
if (!g_pattern_match_string (entry->pat, cat->name)) if (!g_pattern_spec_match_string (entry->pat, cat->name))
return FALSE; return FALSE;
if (gst_is_initialized ()) if (gst_is_initialized ())