[PATCH xquartz 02/10] randr: Correct a miscall of abs() to instead call fabs()

Alan Coopersmith alan.coopersmith at oracle.com
Wed Oct 14 15:24:58 PDT 2015


Long long ago, the xserver's include/misc.h had:
#define abs(a) ((a) > 0 ? (a) : -(a))
which worked for code like this, but git history says that was removed in
XFree86 4.3.0.1 (commit d568221710959cf in the current xserver git repo)
and we've just been sloppy ever since.

Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>

	-alan-


On 10/14/15 03:13 PM, Jeremy Huddleston Sequoia wrote:
> rrtransform.c:124:22: warning: using integer absolute value function 'abs' when
>        argument is of floating point type [-Wabsolute-value,Semantic Issue]
>              if ((v = abs(f_transform->m[j][i])) > max)
>                       ^
> rrtransform.c:124:22: note: use function 'fabs' instead [Semantic Issue]
>              if ((v = abs(f_transform->m[j][i])) > max)
>                       ^~~
>                       fabs
>
> Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu at apple.com>
> ---
>   randr/rrtransform.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/randr/rrtransform.c b/randr/rrtransform.c
> index 6137f85..26b0649 100644
> --- a/randr/rrtransform.c
> +++ b/randr/rrtransform.c
> @@ -121,7 +121,7 @@ RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
>
>       for (j = 0; j < 3; j++)
>           for (i = 0; i < 3; i++)
> -            if ((v = abs(f_transform->m[j][i])) > max)
> +            if ((v = fabs(f_transform->m[j][i])) > max)
>                   max = v;
>       scale = limit / max;
>       for (j = 0; j < 3; j++)
>


-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the xorg-devel mailing list