clang: Don't compute absolute value of unsigned

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@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Victor Toso 2017-12-21 16:18:07 +01:00 committed by Frediano Ziglio
parent 4458cc372b
commit e005e7017b
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

@ -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));