Browse code

avio: allow any chars in protocols

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2011/11/11 01:02:02
Showing 1 changed files
... ...
@@ -265,17 +265,17 @@ int ffurl_alloc(URLContext **puc, const char *filename, int flags,
265 265
 {
266 266
     URLProtocol *up = NULL;
267 267
     char proto_str[128], proto_nested[128], *ptr;
268
-    size_t proto_len = strspn(filename, URL_SCHEME_CHARS);
268
+    const char *proto_end = strchr(filename, ':');
269 269
 
270 270
     if (!first_protocol) {
271 271
         av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. "
272 272
                                      "Missing call to av_register_all()?\n");
273 273
     }
274 274
 
275
-    if (filename[proto_len] != ':' || is_dos_path(filename))
275
+    if (!proto_end || is_dos_path(filename))
276 276
         strcpy(proto_str, "file");
277 277
     else
278
-        av_strlcpy(proto_str, filename, FFMIN(proto_len+1, sizeof(proto_str)));
278
+        av_strlcpy(proto_str, filename, FFMIN(proto_end-filename+1, sizeof(proto_str)));
279 279
 
280 280
     av_strlcpy(proto_nested, proto_str, sizeof(proto_nested));
281 281
     if ((ptr = strchr(proto_nested, '+')))