[vlc-devel] [WIP PATCH 3/4] text: deduce magnet links as if the scheme was provided

Jonathan Calmels jbjcalmels at gmail.com
Thu Jan 29 18:20:01 CET 2015


2015-01-29 16:25 GMT+01:00 Rémi Denis-Courmont <remi at remlab.net>:

> Le jeudi 29 janvier 2015, 16:04:01 Jonathan Calmels a écrit :
> > ---
> >  src/text/url.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/src/text/url.c b/src/text/url.c
> > index cd7e488..860e073 100644
> > --- a/src/text/url.c
> > +++ b/src/text/url.c
> > @@ -146,7 +146,7 @@ char *encode_URI_component (const char *str)
> >  /**
> >   * Builds a URL representation from a local file path.
> >   * @param path path to convert (or URI to copy)
> > - * @param scheme URI scheme to use (default is auto: "file", "fd" or
> "smb")
> > + * @param scheme URI scheme to use (default is auto: "file", "fd",
> > "magnet" or "smb") * @return a nul-terminated URI string (use free() to
> > release it), * or NULL in case of error (errno will be set accordingly)
> >   */
> > @@ -164,6 +164,12 @@ char *vlc_path2uri (const char *path, const char
> > *scheme)
> >
> >      char *buf;
> >
> > +    if (scheme == NULL && !strncmp (path, "magnet:?", 8)) {
> > +        if (asprintf (&buf, "%s://%s", "magnet", path) == -1)
> > +            buf = NULL;
> > +        return buf;
> > +    }
>
> "magnet:?" is a legal local file name on my system and I can no longer
> open it
> with this patch.
>
>
Ok, well I can't play "\\myAwesomeVacation.mp4" either. What's the correct
approach then ?


> --
> Rémi Denis-Courmont
> http://www.remlab.net/
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20150129/16f2c3f8/attachment.html>


More information about the vlc-devel mailing list