mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
uri: there are valid URI protocols with only two letters, like fd://
We added a minimum length of three letters originally so we would fail to recognise DOS/Windows-style filenames as valid URIs (as we should). Two should be just fine as well.
This commit is contained in:
parent
c0970867bf
commit
3329f3f4e4
2 changed files with 8 additions and 7 deletions
|
@ -314,7 +314,7 @@ gst_uri_protocol_is_valid (const gchar * protocol)
|
|||
|
||||
gst_uri_protocol_check_internal (protocol, &endptr);
|
||||
|
||||
return *endptr == '\0' && ((gsize) (endptr - protocol)) >= 3;
|
||||
return *endptr == '\0' && ((gsize) (endptr - protocol)) >= 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -335,7 +335,7 @@ gst_uri_is_valid (const gchar * uri)
|
|||
|
||||
gst_uri_protocol_check_internal (uri, &endptr);
|
||||
|
||||
return *endptr == ':' && ((gsize) (endptr - uri)) >= 3;
|
||||
return *endptr == ':' && ((gsize) (endptr - uri)) >= 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,16 +112,17 @@ GST_END_TEST;
|
|||
|
||||
GST_START_TEST (test_uri_misc)
|
||||
{
|
||||
/* require at least three characters for the protocol */
|
||||
/* require at least two characters for the protocol */
|
||||
fail_if (gst_uri_is_valid ("B:\\foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("B:/foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("B://foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("B:foo.txt"));
|
||||
|
||||
fail_if (gst_uri_is_valid ("AB:\\foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("AB:/foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("AB://foo.txt"));
|
||||
fail_if (gst_uri_is_valid ("AB:foo.txt"));
|
||||
fail_unless (gst_uri_is_valid ("fd://0"));
|
||||
fail_unless (gst_uri_is_valid ("AB:\\foo.txt"));
|
||||
fail_unless (gst_uri_is_valid ("AB:/foo.txt"));
|
||||
fail_unless (gst_uri_is_valid ("AB://foo.txt"));
|
||||
fail_unless (gst_uri_is_valid ("AB:foo.txt"));
|
||||
|
||||
fail_unless (gst_uri_is_valid ("ABC:/foo.txt"));
|
||||
fail_unless (gst_uri_is_valid ("ABC://foo.txt"));
|
||||
|
|
Loading…
Reference in a new issue