[Spice-devel] [PATCH spice-server 2/3] Remove a warning on MIPS machine
Frediano Ziglio
fziglio at redhat.com
Tue Jun 18 12:49:22 UTC 2019
>
> On 6/3/19 2:22 PM, Frediano Ziglio wrote:
> > The formula is here to make sure glyph is aligned to 4 bytes so
> > tell to the compiler to avoid a warning.
>
> What's the warning ?
Trying to reproduce but the updated environment it's slow like
hell (it's more than 30 minutes that it's compiling 3 files).
> Is it that the pointer may be unaligned (which is imposible
> if you start from an aligned address) ?
>
Yes, was an alignment warning
> Looks complicated to me, especially since after the
> SPICE_ALIGNED_CAST there is another (the "real") cast.
>
Maybe with an additional
@@ -941,7 +941,7 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
spice_assert(glyph_size <= (char*) end - (char*) &start->data[0]);
memcpy(glyph->data, start->data, glyph_size);
start = (QXLRasterGlyph*)(&start->data[glyph_size]);
- glyph = (SpiceRasterGlyph*) SPICE_ALIGNED_CAST(uint32_t*,
+ glyph = SPICE_ALIGNED_CAST(SpiceRasterGlyph*,
(((uint8_t *)glyph) +
SPICE_ALIGN(sizeof(SpiceRasterGlyph) + glyph_size, 4)));
}
would work too. Not sure how long it's going to take to test it.
> On the other hand it doesn't break anything.
>
> >
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
>
> Ack.
>
> > ---
> > server/red-parse-qxl.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/server/red-parse-qxl.c b/server/red-parse-qxl.c
> > index afae94316..89b61c06f 100644
> > --- a/server/red-parse-qxl.c
> > +++ b/server/red-parse-qxl.c
> > @@ -941,9 +941,9 @@ static SpiceString *red_get_string(RedMemSlotInfo
> > *slots, int group_id,
> > spice_assert(glyph_size <= (char*) end - (char*)
> > &start->data[0]);
> > memcpy(glyph->data, start->data, glyph_size);
> > start = (QXLRasterGlyph*)(&start->data[glyph_size]);
> > - glyph = (SpiceRasterGlyph*)
> > + glyph = (SpiceRasterGlyph*) SPICE_ALIGNED_CAST(uint32_t*,
> > (((uint8_t *)glyph) +
> > - SPICE_ALIGN(sizeof(SpiceRasterGlyph) + glyph_size, 4));
> > + SPICE_ALIGN(sizeof(SpiceRasterGlyph) + glyph_size, 4)));
> > }
> >
> > if (free_data) {
> >
>
>
More information about the Spice-devel
mailing list