[vlc-devel] [PATCH] demux/mkv: include dot when checking extensions

Filip Roséen filip at atch.se
Mon Feb 20 18:16:37 CET 2017


Hi Rémi,

On 2017-02-20 18:41, Rémi Denis-Courmont wrote:

> Le maanantaina 20. helmikuuta 2017, 14.54.08 EET Filip Roséen a écrit :
> > Previously a filename lacking an extension could still pass the check,
> > for example if a file is found with the name "abc123mkv".
> > 
> > There is also no need to use strncasecmp as
> > std::basic_string<...>::c_str guarantees that the data referred to by
> > the return-value is null-terminated.
> > ---
> >  modules/demux/mkv/mkv.cpp | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
> > index 47e4d3ee61..26c11d5a5f 100644
> > --- a/modules/demux/mkv/mkv.cpp
> > +++ b/modules/demux/mkv/mkv.cpp
> > @@ -192,8 +192,8 @@ static int Open( vlc_object_t * p_this )
> >                              continue; // don't reuse the original opened
> > file }
> > 
> > -                        if (!strncasecmp(s_filename.c_str() +
> > s_filename.length() - 3, "mkv", 3) || -                           
> > !strncasecmp(s_filename.c_str() + s_filename.length() - 3, "mka", 3)) +    
> >                    if (!strcasecmp(s_filename.c_str() + s_filename.length()
> > - 4, ".mkv") || +                            !strcasecmp(s_filename.c_str()
> > + s_filename.length() - 4, ".mka")) {
> >                              // test whether this file belongs to our family
> > const uint8_t *p_peek;
> 
> Why not use the <vlc_demux.h> helpers?

Are you referring to `demux_IsPathExtension`? If so the reason is that
the probed files are not part of the `demux_t` associated with the
module (the mkv demuxer conditionally queries files within the same
directory to find related files).

Though maybe there is a relavant helper that I have yet to
discover/recall?

Best Regards,\
Filip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170220/9fffd51a/attachment.html>


More information about the vlc-devel mailing list