[Mesa-dev] [PATCH 11/11] glsl: add cast to silence MSVC double->float assignment warning

Ian Romanick idr at freedesktop.org
Wed Jan 23 06:25:43 PST 2013


On 01/22/2013 07:51 PM, Brian Paul wrote:
> ---
>   src/glsl/s_expression.cpp |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/glsl/s_expression.cpp b/src/glsl/s_expression.cpp
> index 57de9d3..52fa7ae 100644
> --- a/src/glsl/s_expression.cpp
> +++ b/src/glsl/s_expression.cpp
> @@ -79,7 +79,7 @@ read_atom(void *ctx, const char *&src, char *&symbol_buffer)
>            int i = strtol(src, &int_end, 10);
>            // If strtod matched more characters, it must have a decimal part
>            if (float_end > int_end)
> -            expr = new(ctx) s_float(f);
> +            expr = new(ctx) s_float((float) f);

I think changing the type of f and the return type (and name?) of 
glsl_strtod is better.  Every single user of that function assigns the 
result to a float.

>            else
>               expr = new(ctx) s_int(i);
>         } else {
>



More information about the mesa-dev mailing list