[Spice-devel] [PATCH spice-common] canvas-base: Do not attempt useless cast on stride adjustment
Christophe Fergeau
cfergeau at redhat.com
Wed Jun 21 07:40:04 UTC 2017
Hey,
On Tue, Jun 20, 2017 at 02:52:56PM +0100, Frediano Ziglio wrote:
> memmove already deal with any alignment so there's no
> reason to have row byte pointer cast to uint32_t.
>
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
> common/canvas_base.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/common/canvas_base.c b/common/canvas_base.c
> index 5815e9c..5b3649d 100644
> --- a/common/canvas_base.c
> +++ b/common/canvas_base.c
> @@ -522,9 +522,9 @@ static void canvas_fix_alignment(uint8_t *bits,
> int row;
> uint8_t *dest = bits;
> for (row = height - 1; row > 0; --row) {
> - uint32_t *dest_aligned, *dest_misaligned;
> - dest_aligned = SPICE_ALIGNED_CAST(uint32_t *,dest + stride_pixman*row);
> - dest_misaligned = SPICE_UNALIGNED_CAST(uint32_t*,dest + stride_encoded*row);
> + uint8_t *dest_aligned, *dest_misaligned;
> + dest_aligned = dest + stride_pixman*row;
> + dest_misaligned = dest + stride_encoded*row;
Not related to your change, but 'dest' does not seem useful here, and
"dest_misaligned" seems badly named, it seems to be more of a
"src_misaligned".
I think I'd just kill 'dest', rename 'dest_aligned' to 'dest', and
'dest_misaligned' to 'src' (the "Fix the row alignment" comment should
be good enough to hint that something is misaligned).
Regardless of these OT comments, for this patch
Acked-by: Christophe Fergeau <cfergeau at redhat.com>
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170621/263250ac/attachment-0001.sig>
More information about the Spice-devel
mailing list