[vlc-devel] [PATCH] demux/mkv: include dot when checking extensions
Rémi Denis-Courmont
remi at remlab.net
Mon Feb 20 17:41:59 CET 2017
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?
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list