<div dir="ltr"><div><span style="font-size:12.8px">"The logic here seems dubious to me. How can the inner if statement ever be true,</span><br style="font-size:12.8px"><span style="font-size:12.8px">given that you've already checked that the extension string is empty or starts</span><br style="font-size:12.8px"><span style="font-size:12.8px">with 'GL_'?"</span></div><div><br></div><div>Strncmp returns 0 if contents of both strings are equal, so it checks that the string does not start with "GL_".</div><div><br></div><div><span style="font-size:12.8px">"if (!ext || strncmp(ext, "GL_", 3) || strncmp(ext, "WGL_EXT_swap_control", 20)) {</span><br style="font-size:12.8px"><span style="font-size:12.8px">...</span><br style="font-size:12.8px"><span style="font-size:12.8px">}"</span><br></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">So this will not work, because if string begins with "GL_" the third condition will be met and PIGLIT_FAIL will be returned.</span></div><div><span style="font-size:12.8px"><br></span></div><div>But you have a point when it comes to the first condition (!ext). I will extract this one and check the others after this.</div><div>I will also add a comment about WGL_EXT_swap_control and update the patch.</div><div><br></div><div>Thanks,</div><div>Sandra</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 27, 2017 at 6:41 PM, Dylan Baker <span dir="ltr"><<a href="mailto:dylan@pnwbakers.com" target="_blank">dylan@pnwbakers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Quoting Sandra Koroniewska (2017-06-27 06:52:02)<br>
<div><div class="h5">> WGL_EXT_SWAP_CONTROL is added for historical reasons.<br>
> ---<br>
>  tests/general/gl30basic.c | 13 +++++++------<br>
>  1 file changed, 7 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/tests/general/gl30basic.c b/tests/general/gl30basic.c<br>
> index 2207787bb..d6bcd34ad 100644<br>
> --- a/tests/general/gl30basic.c<br>
> +++ b/tests/general/gl30basic.c<br>
> @@ -95,12 +95,13 @@ test_extension_list(void)<br>
>        const GLubyte *ext = glGetStringi(GL_EXTENSIONS, k);<br>
>        if (0)<br>
>           printf("Ext[%d] = %s\n", k, (char *) ext);<br>
> -      if (!ext ||<br>
> -          ext[0] != 'G' ||<br>
> -          ext[1] != 'L' ||<br>
> -          ext[2] != '_') {<br>
> -         printf("%s: bad extension string [%d]: %s\n", Prog, k, ext);<br>
> -         return PIGLIT_FAIL;<br>
> +      if (!ext || strncmp(ext, "GL_", 3))<br>
> +      {<br>
> +          if (strncmp(ext, "WGL_EXT_swap_control", 20))<br>
> +          {<br>
> +              printf("%s: bad extension string [%d]: %s\n", Prog, k, ext);<br>
> +              return PIGLIT_FAIL;<br>
> +          }<br>
>        }<br>
<br>
</div></div>The logic here seems dubious to me. How can the inner if statement ever be true,<br>
given that you've already checked that the extension string is empty or starts<br>
with 'GL_'? Also, unless I'm misreading this the PIGLIT_FAIL will only be<br>
generated if the extension is WGL_EXT_swap_control, which also seems wrong.<br>
<br>
I think this should be:<br>
<br>
if (!ext || strncmp(ext, "GL_", 3) || strncmp(ext, "WGL_EXT_swap_control", 20)) {<br>
...<br>
}<br>
<span class="HOEnZb"><font color="#888888"><br>
Dylan<br>
</font></span></blockquote></div><br></div>