[Piglit] [PATCH] shader_runner: Cast isspace inputs to int to silence warnings.

Brian Paul brianp at vmware.com
Mon Feb 20 07:37:32 PST 2012


On 02/19/2012 11:45 PM, Vinson Lee wrote:
> Fixes these GCC warnings on Cygwin.
> shader_runner.c: In function ‘strcpy_to_space’:
> shader_runner.c:202:2: warning: array subscript has type ‘char’
> shader_runner.c: In function ‘eat_whitespace’:
> shader_runner.c:216:2: warning: array subscript has type ‘char’
> shader_runner.c: In function ‘eat_text’:
> shader_runner.c:229:2: warning: array subscript has type ‘char’
>
> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> ---
>   tests/shaders/shader_runner.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
> index 0722793..82d20f4 100644
> --- a/tests/shaders/shader_runner.c
> +++ b/tests/shaders/shader_runner.c
> @@ -199,7 +199,7 @@ compile_and_bind_program(GLenum target, const char *start, int len)
>   const char *
>   strcpy_to_space(char *dst, const char *src)
>   {
> -	while (!isspace(*src)&&  (*src != '\0'))
> +	while (!isspace((int) *src)&&  (*src != '\0'))
>   		*(dst++) = *(src++);
>
>   	*dst = '\0';
> @@ -213,7 +213,7 @@ strcpy_to_space(char *dst, const char *src)
>   const char *
>   eat_whitespace(const char *src)
>   {
> -	while (isspace(*src)&&  (*src != '\n'))
> +	while (isspace((int) *src)&&  (*src != '\n'))
>   		src++;
>
>   	return src;
> @@ -226,7 +226,7 @@ eat_whitespace(const char *src)
>   const char *
>   eat_text(const char *src)
>   {
> -	while (!isspace(*src)&&  (*src != '\0'))
> +	while (!isspace((int) *src)&&  (*src != '\0'))
>   		src++;
>
>   	return src;

Both of these patches look OK to me, Vinson.

Reviewed-by: Brian Paul <brianp at vmware.com>


More information about the Piglit mailing list