[Spice-devel] [PATCH spice-common] canvas-base: Do not attempt useless cast on stride adjustment
Uri Lublin
uril at redhat.com
Tue Jun 20 17:39:44 UTC 2017
On 06/20/2017 04:52 PM, Frediano Ziglio wrote:
> memmove already deal with any alignment so there's no
> reason to have row byte pointer cast to uint32_t.
Hi Frediano,
I think the code has no problem with memmove itself, but
with the pointer used later being not-aligned (but only for
non-x86 arch ?).
Specifically this reverts part of commit
858a0bfae9925ea6e363573de4113090c7821133
so I think a longer commit log is needed.
Uri.
>
> 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;
> memmove(dest_aligned, dest_misaligned, stride_encoded);
> }
> }
>
More information about the Spice-devel
mailing list