From 67a92e45a23249c8e9742a20579332638fcd3014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 13 Feb 2007 13:40:05 +0000 Subject: [PATCH] plugins/elements/: Also check for an absolute path following file:// in the filesrc element. Remove redundant check a... Original commit message from CVS: * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): Also check for an absolute path following file:// in the filesrc element. Remove redundant check and call g_path_is_absolute() on the unescaped location. --- ChangeLog | 8 ++++++++ plugins/elements/gstfilesink.c | 8 ++++++-- plugins/elements/gstfilesrc.c | 10 ++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 45a9c7f63d..1ed8a79e8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-02-13 Sebastian Dröge + + * plugins/elements/gstfilesink.c: (gst_file_sink_uri_set_uri): + * plugins/elements/gstfilesrc.c: (gst_file_src_uri_set_uri): + Also check for an absolute path following file:// in the filesrc + element. Remove redundant check and call g_path_is_absolute() on the + unescaped location. + 2007-02-13 Stefan Kost * docs/design/draft-klass.txt: diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index 762121c148..09c3be6a27 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -554,10 +554,14 @@ gst_file_sink_uri_set_uri (GstURIHandler * handler, const gchar * uri) * "location" with uri + 16 because it provides unescaping */ location = gst_uri_get_location (tmp); g_free (tmp); - } else if (!g_str_has_prefix (uri, "file:///")) { - return FALSE; } else { location = gst_uri_get_location (uri); + if (!location) + return FALSE; + if (!g_path_is_absolute (location)) { + g_free (location); + return FALSE; + } } ret = gst_file_sink_set_location (sink, location); diff --git a/plugins/elements/gstfilesrc.c b/plugins/elements/gstfilesrc.c index dfd88db377..2300bc120c 100644 --- a/plugins/elements/gstfilesrc.c +++ b/plugins/elements/gstfilesrc.c @@ -1074,12 +1074,14 @@ gst_file_src_uri_set_uri (GstURIHandler * handler, const gchar * uri) * "location" with uri + 16 because it provides unescaping */ location = gst_uri_get_location (tmp); g_free (tmp); - } else if (!g_str_has_prefix (uri, "file://")) { - return FALSE; - } else if (!g_path_is_absolute (uri + strlen ("file://"))) { - return FALSE; } else { location = gst_uri_get_location (uri); + if (!location) + return FALSE; + if (!g_path_is_absolute (location)) { + g_free (location); + return FALSE; + } } ret = gst_file_src_set_location (src, location);