mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-22 07:08:23 +00:00
avoid having to depend on glib 2.2
Original commit message from CVS: avoid having to depend on glib 2.2
This commit is contained in:
parent
5886cb87ab
commit
1bce047ddc
1 changed files with 21 additions and 1 deletions
22
gst/gsturi.c
22
gst/gsturi.c
|
@ -138,6 +138,26 @@ gst_uri_handler_find (const gchar *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* this is a straight copy from glib 2.2
|
||||
* remove this function when glib 2.2 is sufficiently widespread and
|
||||
* then change to using the regular g_str_has_prefix
|
||||
*/
|
||||
static gboolean
|
||||
g_str_has_prefix_glib22 (gchar *haystack, gchar *needle)
|
||||
{
|
||||
if (haystack == NULL && needle == NULL) {
|
||||
return TRUE;
|
||||
}
|
||||
if (haystack == NULL || needle == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
if (strncmp (haystack, needle, strlen (needle)) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_uri_handler_find_by_uri:
|
||||
* @uri: the uri to find a handler for
|
||||
|
@ -159,7 +179,7 @@ gst_uri_handler_find_by_uri (const gchar *uri)
|
|||
while (walk) {
|
||||
handler = GST_URI_HANDLER (walk->data);
|
||||
|
||||
if (g_str_has_prefix (uri, handler->uri))
|
||||
if (g_str_has_prefix_glib22 ((gchar *) uri, handler->uri))
|
||||
break;
|
||||
|
||||
walk = g_list_next (walk);
|
||||
|
|
Loading…
Reference in a new issue