On Wed, May 17, 2017 at 07:08:26AM +0200, Christophe de Dinechin wrote: > From: Christophe de Dinechin <dinechin@xxxxxxxxxx> > > Signed-off-by: Christophe de Dinechin <dinechin@xxxxxxxxxx> > --- > configure.ac | 3 ++- > src/channel-cursor.c | 6 +++--- > src/channel-display-mjpeg.c | 2 +- > src/continuation.h | 6 ++++-- > src/decode-glz-tmpl.c | 2 +- > src/spice-channel.c | 10 +++++----- > 6 files changed, 16 insertions(+), 13 deletions(-) > > diff --git a/configure.ac b/configure.ac > index ecab365..8b433ba 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -481,7 +481,8 @@ if test "$with_coroutine" = "auto"; then > if test "$os_win32" = "yes"; then > with_coroutine=winfiber > elif test "$os_mac" = "yes"; then > - with_coroutine=gthread > + with_coroutine=ucontext > + AC_DEFINE([_XOPEN_SOURCE], [1], [Define _XOPEN_SOURCE on macOS for ucontext]) > else > with_coroutine=ucontext > fi > diff --git a/src/channel-cursor.c b/src/channel-cursor.c > index 50de5ce..650d408 100644 > --- a/src/channel-cursor.c > +++ b/src/channel-cursor.c > @@ -340,7 +340,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) > memcpy(cursor->data, data, size); > for (i = 0; i < hdr->width * hdr->height; i++) { > pix_mask = get_pix_mask(data, size, i); > - if (pix_mask && *(SPICE_ALIGNED_CAST(guint32*, data) + i) == 0xffffff) { > + if (pix_mask && *(SPICE_ALIGNED_CAST(guint32 *, data) + i) == 0xffffff) { > cursor->data[i] = get_pix_hack(i, hdr->width); > } else { > cursor->data[i] |= (pix_mask ? 0 : 0xff000000); > @@ -350,7 +350,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) > case SPICE_CURSOR_TYPE_COLOR16: > for (i = 0; i < hdr->width * hdr->height; i++) { > pix_mask = get_pix_mask(data, size, i); > - pix = *(SPICE_ALIGNED_CAST(guint16*,data) + i); > + pix = *(SPICE_ALIGNED_CAST(guint16 *, data) + i); > if (pix_mask && pix == 0x7fff) { > cursor->data[i] = get_pix_hack(i, hdr->width); > } else { > @@ -364,7 +364,7 @@ static display_cursor *set_cursor(SpiceChannel *channel, SpiceCursor *scursor) > for (i = 0; i < hdr->width * hdr->height; i++) { > pix_mask = get_pix_mask(data, size + (sizeof(uint32_t) << 4), i); > int idx = (i & 1) ? (data[i >> 1] & 0x0f) : ((data[i >> 1] & 0xf0) >> 4); > - pix = *(SPICE_UNALIGNED_CAST(uint32_t*,(data + size)) + idx); > + pix = *(SPICE_UNALIGNED_CAST(uint32_t *, (data + size)) + idx); > if (pix_mask && pix == 0xffffff) { > cursor->data[i] = get_pix_hack(i, hdr->width); > } else { > diff --git a/src/channel-display-mjpeg.c b/src/channel-display-mjpeg.c > index 17c0f4f..ee33b01 100644 > --- a/src/channel-display-mjpeg.c > +++ b/src/channel-display-mjpeg.c > @@ -151,7 +151,7 @@ static gboolean mjpeg_decoder_decode_frame(gpointer video_decoder) > #ifndef JCS_EXTENSIONS > { > uint8_t *s = lines[0]; > - uint32_t *d = SPICE_ALIGNED_CAST(uint32_t *,s); > + uint32_t *d = SPICE_ALIGNED_CAST(uint32_t *, s); > > if (back_compat) { > for (unsigned int j = lines_read * width; j > 0; ) { While these whitespace changes make sense, they are not related to the commit message. > diff --git a/src/continuation.h b/src/continuation.h > index 675a257..d1fd137 100644 > --- a/src/continuation.h > +++ b/src/continuation.h > @@ -21,6 +21,7 @@ > #ifndef _CONTINUATION_H_ > #define _CONTINUATION_H_ > > +#include "spice-common.h" > #include <stddef.h> > #include <ucontext.h> > #include <setjmp.h> > @@ -48,8 +49,9 @@ int cc_release(struct continuation *cc); > int cc_swap(struct continuation *from, struct continuation *to); > > #define offset_of(type, member) ((unsigned long)(&((type *)0)->member)) > -#define container_of(obj, type, member) \ > - (type *)(((char *)obj) - offset_of(type, member)) > +#define container_of(obj, type, member) \ > + SPICE_ALIGNED_CAST(type *, \ > + (((char *)obj) - offset_of(type, member))) > > #endif > /* Yep, makes sense. > diff --git a/src/decode-glz-tmpl.c b/src/decode-glz-tmpl.c > index 7695a28..76d832c 100644 > --- a/src/decode-glz-tmpl.c > +++ b/src/decode-glz-tmpl.c > @@ -178,7 +178,7 @@ static size_t FNAME(decode)(SpiceGlzDecoderWindow *window, > uint64_t image_id, SpicePalette *plt) > { > uint8_t *ip = in_buf; > - OUT_PIXEL *out_pix_buf = SPICE_ALIGNED_CAST(OUT_PIXEL *,out_buf); > + OUT_PIXEL *out_pix_buf = SPICE_ALIGNED_CAST(OUT_PIXEL *, out_buf); > OUT_PIXEL *op = out_pix_buf; > OUT_PIXEL *op_limit = out_pix_buf + size; > More unrelated whitespace changes. > diff --git a/src/spice-channel.c b/src/spice-channel.c > index 88d0567..89934a0 100644 > --- a/src/spice-channel.c > +++ b/src/spice-channel.c > @@ -1312,7 +1312,7 @@ static void spice_channel_send_link(SpiceChannel *channel) > { > SpiceChannelPrivate *c = channel->priv; > uint8_t *buffer, *p; > - uint32_t *p32; > + uint32_t *caps; > int protocol, i; > > c->link_hdr.magic = SPICE_MAGIC; > @@ -1358,14 +1358,14 @@ static void spice_channel_send_link(SpiceChannel *channel) > memcpy(p, &c->link_msg, sizeof(c->link_msg)); p += sizeof(c->link_msg); > > // Need this to avoid error with -Wcast-align > - p32 = SPICE_UNALIGNED_CAST(uint32_t *,p); > + caps = SPICE_UNALIGNED_CAST(uint32_t *, p); > for (i = 0; i < c->common_caps->len; i++) { > - *p32++ = GUINT32_TO_LE(g_array_index(c->common_caps, uint32_t, i)); > + *caps++ = GUINT32_TO_LE(g_array_index(c->common_caps, uint32_t, i)); > } > for (i = 0; i < c->caps->len; i++) { > - *p32++ = GUINT32_TO_LE(g_array_index(c->caps, uint32_t, i)); > + *caps++ = GUINT32_TO_LE(g_array_index(c->caps, uint32_t, i)); > } > - p = (uint8_t *) p32; > + p = (uint8_t *) caps; > CHANNEL_DEBUG(channel, "channel type %d id %d num common caps %u num caps %u", > c->channel_type, > c->channel_id, The rename should be a separate patch of its own too. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel