[Piglit] [PATCH 2/2] gl-1.0-readpixsanity: Eliminate use of variable length arrays.

Jose Fonseca jfonseca at vmware.com
Wed Oct 29 16:46:53 PDT 2014


> Don't cast malloc.

I did it out of habit, as these casts are required on C++ code (or one you'd get "error: invalid conversion from ‘void*’ to ‘GLfloat*’").

But I'll remove them if they bother you.

Jose

________________________________________
From: Matt Turner <mattst88 at gmail.com>
Sent: 29 October 2014 21:17
To: Jose Fonseca
Cc: piglit; Brian Paul
Subject: Re: [Piglit] [PATCH 2/2] gl-1.0-readpixsanity: Eliminate use of variable length arrays.

On Wed, Oct 29, 2014 at 4:48 AM,  <jfonseca at vmware.com> wrote:
> From: José Fonseca <jfonseca at vmware.com>
>
> Non-standard GCC extension.
> ---
>  tests/spec/gl-1.0/readpix.c | 64 ++++++++++++++++++++++++++-------------------
>  1 file changed, 37 insertions(+), 27 deletions(-)
>
> diff --git a/tests/spec/gl-1.0/readpix.c b/tests/spec/gl-1.0/readpix.c
> index 7ee0be9..26f44a6 100644
> --- a/tests/spec/gl-1.0/readpix.c
> +++ b/tests/spec/gl-1.0/readpix.c
> @@ -100,7 +100,9 @@ check_rgba(void)
>         double err;
>         int xerr, yerr;
>         float expected[4], expected_rgba[4], actual_rgba[4];
> -       GLfloat buf[piglit_width][piglit_height][4];
> +       const int w = piglit_width;
> +       const int h = piglit_height;
> +       GLfloat *buf = (GLfloat *)malloc(h * w * 4 * sizeof *buf);

Don't cast malloc.


More information about the Piglit mailing list