mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +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 *
|
||||
get_file_extension (gchar * uri)
|
||||
{
|
||||
size_t len;
|
||||
gint find;
|
||||
gchar *dot = g_strrstr (uri, ".");
|
||||
|
||||
len = strlen (uri);
|
||||
find = len - 1;
|
||||
|
||||
while (find >= 0) {
|
||||
if (uri[find] == '.')
|
||||
break;
|
||||
find--;
|
||||
}
|
||||
|
||||
if (find < 0)
|
||||
if (!dot)
|
||||
return NULL;
|
||||
|
||||
return &uri[find + 1];
|
||||
return dot + 1;
|
||||
}
|
||||
|
||||
GList *
|
||||
|
|
Loading…
Reference in a new issue