<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Style-Type" content="text/css" />
  <meta name="generator" content="pandoc" />
  <title></title>
  <style type="text/css">code{white-space: pre;}</style>
</head>
<body>
<p>Hi Rémi,</p>
<p>On 2017-02-20 18:41, Rémi Denis-Courmont wrote:</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> Le maanantaina 20. helmikuuta 2017, 14.54.08 EET Filip Roséen a écrit :</code></pre>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code> 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;</code></pre>
</blockquote>
<pre><code> Why not use the <vlc_demux.h> helpers?</code></pre>
</blockquote>
<p>Are you referring to <code>demux_IsPathExtension</code>? If so the reason is that the probed files are not part of the <code>demux_t</code> associated with the module (the mkv demuxer conditionally queries files within the same directory to find related files).</p>
<p>Though maybe there is a relavant helper that I have yet to discover/recall?</p>
<p>Best Regards,<br />
Filip</p>
</body>
</html>