Re: [spice-server v1 1/3] clang: Don't compute absolute value of unsigneds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: Victor Toso <me@xxxxxxxxxxxxxx>
> 
> Clang's warning on absolute-value.
> 
> > red-record-qxl.c:297:39: error: taking the absolute value of unsigned
> > type 'uint32_t' (aka 'unsigned int') has no effect
> >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> >                                   ^
> > red-record-qxl.c:297:39: note: remove the call to 'abs' since unsigned
> > values cannot be negative
> >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> >                                   ^~~
> 
> > red-replay-qxl.c:471:39: error: taking the absolute value of unsigned type
> > 'uint32_t' (aka 'unsigned int') has no effect
> >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> >                                   ^
> > red-replay-qxl.c:471:39: note: remove the call to 'abs' since unsigned
> > values cannot be negative
> >     bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> >                                   ^~~
> 
> Signed-off-by: Victor Toso <victortoso@xxxxxxxxxx>
> ---
>  server/red-record-qxl.c | 2 +-
>  server/red-replay-qxl.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-record-qxl.c b/server/red-record-qxl.c
> index 400d67c4..48b3169f 100644
> --- a/server/red-record-qxl.c
> +++ b/server/red-record-qxl.c
> @@ -294,7 +294,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo
> *slots, int group_id,
>                  fprintf(fd, "ents %d\n", qp->ents[i]);
>              }
>          }
> -        bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> +        bitmap_size = qxl->bitmap.y * qxl->bitmap.stride;
>          if (qxl_flags & QXL_BITMAP_DIRECT) {
>              red_record_image_data_flat(fd, slots, group_id,
>                                                           qxl->bitmap.data,
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index d389b62e..18f348a1 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -468,7 +468,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay,
> uint32_t flags)
>          } else {
>              qxl->bitmap.palette = 0;
>          }
> -        bitmap_size = qxl->bitmap.y * abs(qxl->bitmap.stride);
> +        bitmap_size = qxl->bitmap.y * qxl->bitmap.stride;
>          qxl->bitmap.data = 0;
>          if (qxl_flags & QXL_BITMAP_DIRECT) {
>              qxl->bitmap.data =
>              QXLPHYSICAL_FROM_PTR(red_replay_image_data_flat(replay,
>              &bitmap_size));

Acked-by: Frediano Ziglio <fziglio@xxxxxxxxxx>

Frediano
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]