[Piglit] [PATCH] line-flat-clip-color: Initialize and update test result.
Brian Paul
brianp at vmware.com
Sat Feb 8 12:32:07 PST 2014
On 02/08/2014 12:59 PM, Vinson Lee wrote:
> Fixes "Uninitialized scalar variable" defect reported by Coverity.
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> tests/general/line-flat-clip-color.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tests/general/line-flat-clip-color.c b/tests/general/line-flat-clip-color.c
> index 4cf37b2..0df5421 100644
> --- a/tests/general/line-flat-clip-color.c
> +++ b/tests/general/line-flat-clip-color.c
> @@ -55,7 +55,7 @@ static bool have_pv = false;
> static bool
> test_one(int order, const float expected[3])
> {
> - bool pass;
> + bool pass = true;
> int dy, y = piglit_height / 2;
>
> glClear(GL_COLOR_BUFFER_BIT);
> @@ -77,7 +77,7 @@ test_one(int order, const float expected[3])
> /* test all pixels across middle of window */
> pass = piglit_probe_rect_rgb(0, y + dy, /* x, y */
> piglit_width, 1, /* w, h */
> - expected);
> + expected) && pass;
> break;
> }
> }
>
Actually, the only correct change is to initialize pass = false at the
top of the function. In the dy loop, if we never find a non-black
pixel, something is wrong and the test should report fail.
There's no need to do probe() && pass since we break out of the loop
after the probe.
-Brian
More information about the Piglit
mailing list