From 0cd3a98c788f69a90d3ec1c7aec53b21b7fb1cdd Mon Sep 17 00:00:00 2001 From: Jonas K Danielsson Date: Wed, 17 Jan 2024 15:58:50 +0100 Subject: [PATCH] gst-play: Use gst_util_filename_compare The added benefit is not assuming UTF-8 in filenames. Part-of: --- subprojects/gst-plugins-base/tools/gst-play.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/subprojects/gst-plugins-base/tools/gst-play.c b/subprojects/gst-plugins-base/tools/gst-play.c index 83ec344cf8..9d3bdf0a1b 100644 --- a/subprojects/gst-plugins-base/tools/gst-play.c +++ b/subprojects/gst-plugins-base/tools/gst-play.c @@ -855,21 +855,6 @@ do_play (GstPlay * play) g_main_loop_run (play->loop); } -static gint -compare (gconstpointer a, gconstpointer b) -{ - gchar *a1, *b1; - gint ret; - - a1 = g_utf8_collate_key_for_filename ((gchar *) a, -1); - b1 = g_utf8_collate_key_for_filename ((gchar *) b, -1); - ret = strcmp (a1, b1); - g_free (a1); - g_free (b1); - - return ret; -} - static void add_to_playlist (GPtrArray * playlist, const gchar * filename) { @@ -889,7 +874,9 @@ add_to_playlist (GPtrArray * playlist, const gchar * filename) gchar *path; path = g_build_filename (filename, entry, NULL); - files = g_list_insert_sorted (files, path, compare); + files = + g_list_insert_sorted (files, path, + (GCompareFunc) gst_util_filename_compare); } g_dir_close (dir);