[Spice-devel] [spice-server PATCH v1 5/12] red_parse_qxl: Do not compute abs unsigned int

Frediano Ziglio fziglio at redhat.com
Thu Aug 6 05:28:50 PDT 2015


> SpiceBitmap's stride is uint32_t.
> 
> from clang:
> red_parse_qxl.c:452:41: error: taking the absolute value of unsigned
> type 'uint32_t' (aka 'unsigned int') has no effect
> 
> bitmap_size = red->u.bitmap.y * abs(red->u.bitmap.stride);
>                                 ^
> ---
>  server/red_parse_qxl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/red_parse_qxl.c b/server/red_parse_qxl.c
> index d2329a3..07c3cac 100644
> --- a/server/red_parse_qxl.c
> +++ b/server/red_parse_qxl.c
> @@ -449,7 +449,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots,
> int group_id,
>              red->u.bitmap.palette = rp;
>              red->u.bitmap.palette_id = rp->unique;
>          }
> -        bitmap_size = red->u.bitmap.y * abs(red->u.bitmap.stride);
> +        bitmap_size = red->u.bitmap.y * red->u.bitmap.stride;
>          if (qxl_flags & QXL_BITMAP_DIRECT) {
>              red->u.bitmap.data = red_get_image_data_flat(slots, group_id,
>                                                           qxl->bitmap.data,
> --
> 2.4.3
> 

Acked

Frediano


More information about the Spice-devel mailing list