mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 19:21:06 +00:00
bad/utils: Simplify get_file_extension
By using g_strrstr Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6715>
This commit is contained in:
parent
131679b9d0
commit
b3c9f598aa
1 changed files with 3 additions and 13 deletions
|
@ -85,22 +85,12 @@ ensure_uri (const gchar * location)
|
||||||
gchar *
|
gchar *
|
||||||
get_file_extension (gchar * uri)
|
get_file_extension (gchar * uri)
|
||||||
{
|
{
|
||||||
size_t len;
|
gchar *dot = g_strrstr (uri, ".");
|
||||||
gint find;
|
|
||||||
|
|
||||||
len = strlen (uri);
|
if (!dot)
|
||||||
find = len - 1;
|
|
||||||
|
|
||||||
while (find >= 0) {
|
|
||||||
if (uri[find] == '.')
|
|
||||||
break;
|
|
||||||
find--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (find < 0)
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &uri[find + 1];
|
return dot + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GList *
|
GList *
|
||||||
|
|
Loading…
Reference in a new issue