mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-06 20:27:43 +00:00
Remove conversion warnings
Use casts to avoid all that warning. They should go away once you use more type safe types. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
17a7251e56
commit
e788e6e476
@ -156,9 +156,6 @@ AC_DEFUN([SPICE_COMPILE_WARNINGS],[
|
||||
|
||||
save_CFLAGS="$WARN_CFLAGS"
|
||||
|
||||
# -fpermissive to allow compile C with C++
|
||||
gl_WARN_ADD([-fpermissive])
|
||||
|
||||
# -Wno-suggest-final-methods and -Wno-suggest-final-types to avoid warnings for optimization
|
||||
gl_WARN_ADD([-Wno-suggest-final-methods])
|
||||
gl_WARN_ADD([-Wno-suggest-final-types])
|
||||
|
||||
@ -195,7 +195,6 @@ spice_server_global_cxxflags += [
|
||||
'-fno-exceptions',
|
||||
'-fno-rtti',
|
||||
'--no_rtti',
|
||||
'-fpermissive',
|
||||
'-Wno-suggest-final-methods',
|
||||
'-Wno-suggest-final-types',
|
||||
'-Wno-array-bounds',
|
||||
|
||||
@ -161,7 +161,7 @@ static void red_char_device_write_buffer_free(RedCharDeviceWriteBuffer *buf)
|
||||
static void write_buffers_queue_free(GQueue *write_queue)
|
||||
{
|
||||
RedCharDeviceWriteBuffer *buf;
|
||||
while ((buf = g_queue_pop_tail(write_queue)))
|
||||
while ((buf = (RedCharDeviceWriteBuffer *) g_queue_pop_tail(write_queue)))
|
||||
red_char_device_write_buffer_free(buf);
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ static void red_char_device_client_free(RedCharDevice *dev,
|
||||
spice_debug("write_queue_is_empty %d", g_queue_is_empty(&dev->priv->write_queue) && !dev->priv->cur_write_buf);
|
||||
l = g_queue_peek_head_link(&dev->priv->write_queue);
|
||||
while (l) {
|
||||
RedCharDeviceWriteBuffer *write_buf = l->data;
|
||||
RedCharDeviceWriteBuffer *write_buf = (RedCharDeviceWriteBuffer *) l->data;
|
||||
next = l->next;
|
||||
|
||||
if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
|
||||
@ -225,7 +225,7 @@ static RedCharDeviceClient *red_char_device_client_find(RedCharDevice *dev,
|
||||
|
||||
static void device_client_wait_for_tokens_timeout(void *opaque)
|
||||
{
|
||||
RedCharDeviceClient *dev_client = opaque;
|
||||
RedCharDeviceClient *dev_client = (RedCharDeviceClient *) opaque;
|
||||
|
||||
red_char_device_handle_client_overflow(dev_client);
|
||||
}
|
||||
@ -342,7 +342,7 @@ static void red_char_device_client_send_queue_push(RedCharDeviceClient *dev_clie
|
||||
{
|
||||
while (!g_queue_is_empty(dev_client->send_queue) &&
|
||||
red_char_device_can_send_to_client(dev_client)) {
|
||||
RedPipeItem *msg = g_queue_pop_tail(dev_client->send_queue);
|
||||
RedPipeItem *msg = (RedPipeItem *) g_queue_pop_tail(dev_client->send_queue);
|
||||
g_assert(msg != NULL);
|
||||
dev_client->num_send_tokens--;
|
||||
red_char_device_send_msg_to_client(dev_client->dev, msg,
|
||||
@ -451,7 +451,7 @@ static int red_char_device_write_to_device(RedCharDevice *dev)
|
||||
uint32_t write_len;
|
||||
|
||||
if (!dev->priv->cur_write_buf) {
|
||||
dev->priv->cur_write_buf = g_queue_pop_tail(&dev->priv->write_queue);
|
||||
dev->priv->cur_write_buf = (RedCharDeviceWriteBuffer *) g_queue_pop_tail(&dev->priv->write_queue);
|
||||
if (!dev->priv->cur_write_buf)
|
||||
break;
|
||||
dev->priv->cur_write_buf_pos = dev->priv->cur_write_buf->buf;
|
||||
@ -495,7 +495,7 @@ static int red_char_device_write_to_device(RedCharDevice *dev)
|
||||
|
||||
static void red_char_device_write_retry(void *opaque)
|
||||
{
|
||||
RedCharDevice *dev = opaque;
|
||||
RedCharDevice *dev = (RedCharDevice *) opaque;
|
||||
|
||||
if (dev->priv->write_to_dev_timer) {
|
||||
red_timer_cancel(dev->priv->write_to_dev_timer);
|
||||
@ -517,7 +517,8 @@ red_char_device_write_buffer_get(RedCharDevice *dev, RedCharDeviceClientOpaque *
|
||||
RedCharDeviceWriteBufferPrivate priv;
|
||||
RedCharDeviceWriteBuffer buffer;
|
||||
} *write_buf;
|
||||
write_buf = g_malloc(sizeof(struct RedCharDeviceWriteBufferFull) + size);
|
||||
write_buf = (struct RedCharDeviceWriteBufferFull* )
|
||||
g_malloc(sizeof(struct RedCharDeviceWriteBufferFull) + size);
|
||||
memset(write_buf, 0, sizeof(*write_buf));
|
||||
write_buf->priv.refs = 1;
|
||||
ret = &write_buf->buffer;
|
||||
@ -780,7 +781,7 @@ void red_char_device_reset(RedCharDevice *dev)
|
||||
|
||||
dev->priv->wait_for_migrate_data = FALSE;
|
||||
spice_debug("char device %p", dev);
|
||||
while ((buf = g_queue_pop_tail(&dev->priv->write_queue))) {
|
||||
while ((buf = (RedCharDeviceWriteBuffer *) g_queue_pop_tail(&dev->priv->write_queue))) {
|
||||
red_char_device_write_buffer_release(dev, &buf);
|
||||
}
|
||||
red_char_device_write_buffer_release(dev, &dev->priv->cur_write_buf);
|
||||
@ -840,7 +841,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
|
||||
|
||||
/* multi-clients are not supported */
|
||||
spice_assert(g_list_length(dev->priv->clients) == 1);
|
||||
dev_client = g_list_last(dev->priv->clients)->data;
|
||||
dev_client = (RedCharDeviceClient *) g_list_last(dev->priv->clients)->data;
|
||||
/* FIXME: if there were more than one client before the marshalling,
|
||||
* it is possible that the send_queue length > 0, and the send data
|
||||
* should be migrated as well */
|
||||
@ -869,7 +870,7 @@ void red_char_device_migrate_data_marshall(RedCharDevice *dev,
|
||||
}
|
||||
|
||||
for (item = g_queue_peek_tail_link(&dev->priv->write_queue); item != NULL; item = item->prev) {
|
||||
RedCharDeviceWriteBuffer *write_buf = item->data;
|
||||
RedCharDeviceWriteBuffer *write_buf = (RedCharDeviceWriteBuffer *) item->data;
|
||||
|
||||
spice_marshaller_add_by_ref_full(m2, write_buf->buf, write_buf->buf_used,
|
||||
migrate_data_marshaller_write_buffer_free,
|
||||
@ -896,7 +897,7 @@ bool red_char_device_restore(RedCharDevice *dev,
|
||||
spice_assert(g_list_length(dev->priv->clients) == 1 &&
|
||||
dev->priv->wait_for_migrate_data);
|
||||
|
||||
dev_client = g_list_last(dev->priv->clients)->data;
|
||||
dev_client = (RedCharDeviceClient *) g_list_last(dev->priv->clients)->data;
|
||||
if (mig_data->version > SPICE_MIGRATE_DATA_CHAR_DEVICE_VERSION) {
|
||||
spice_error("dev %p error: migration data version %u is bigger than self %u",
|
||||
dev, mig_data->version, SPICE_MIGRATE_DATA_CHAR_DEVICE_VERSION);
|
||||
@ -1013,10 +1014,10 @@ red_char_device_set_property(GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_CHAR_DEV_INSTANCE:
|
||||
red_char_device_reset_dev_instance(self, g_value_get_pointer(value));
|
||||
red_char_device_reset_dev_instance(self, (SpiceCharDeviceInstance*) g_value_get_pointer(value));
|
||||
break;
|
||||
case PROP_SPICE_SERVER:
|
||||
self->priv->reds = g_value_get_pointer(value);
|
||||
self->priv->reds = (SpiceServer *) g_value_get_pointer(value);
|
||||
break;
|
||||
case PROP_CLIENT_TOKENS_INTERVAL:
|
||||
self->priv->client_tokens_interval = g_value_get_uint64(value);
|
||||
@ -1052,7 +1053,7 @@ red_char_device_finalize(GObject *object)
|
||||
self->priv->cur_write_buf = NULL;
|
||||
|
||||
while (self->priv->clients != NULL) {
|
||||
RedCharDeviceClient *dev_client = self->priv->clients->data;
|
||||
RedCharDeviceClient *dev_client = (RedCharDeviceClient *) self->priv->clients->data;
|
||||
red_char_device_client_free(self, dev_client);
|
||||
}
|
||||
self->priv->running = FALSE;
|
||||
@ -1134,7 +1135,7 @@ SpiceCharDeviceInstance *red_char_device_get_device_instance(RedCharDevice *dev)
|
||||
static void
|
||||
red_char_device_init(RedCharDevice *self)
|
||||
{
|
||||
self->priv = red_char_device_get_instance_private(self);
|
||||
self->priv = (RedCharDevicePrivate*) red_char_device_get_instance_private(self);
|
||||
|
||||
g_queue_init(&self->priv->write_queue);
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ static uint8_t *common_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint
|
||||
|
||||
/* SPICE_MSGC_MIGRATE_DATA is the only client message whose size is dynamic */
|
||||
if (type == SPICE_MSGC_MIGRATE_DATA) {
|
||||
return g_malloc(size);
|
||||
return (uint8_t *) g_malloc(size);
|
||||
}
|
||||
|
||||
if (size > sizeof(common->priv->recv_buf)) {
|
||||
@ -102,7 +102,7 @@ common_graphics_channel_class_init(CommonGraphicsChannelClass *klass)
|
||||
static void
|
||||
common_graphics_channel_init(CommonGraphicsChannel *self)
|
||||
{
|
||||
self->priv = common_graphics_channel_get_instance_private(self);
|
||||
self->priv = (CommonGraphicsChannelPrivate*) common_graphics_channel_get_instance_private(self);
|
||||
}
|
||||
|
||||
void common_graphics_channel_set_during_target_migrate(CommonGraphicsChannel *self, gboolean value)
|
||||
@ -118,7 +118,8 @@ gboolean common_graphics_channel_get_during_target_migrate(CommonGraphicsChannel
|
||||
static void
|
||||
common_graphics_channel_client_init(CommonGraphicsChannelClient *self)
|
||||
{
|
||||
self->priv = common_graphics_channel_client_get_instance_private(self);
|
||||
self->priv = (CommonGraphicsChannelClientPrivate*)
|
||||
common_graphics_channel_client_get_instance_private(self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -56,7 +56,7 @@ cursor_channel_client_class_init(CursorChannelClientClass *klass)
|
||||
static void
|
||||
cursor_channel_client_init(CursorChannelClient *self)
|
||||
{
|
||||
self->priv = cursor_channel_client_get_instance_private(self);
|
||||
self->priv = (CursorChannelClientPrivate*) cursor_channel_client_get_instance_private(self);
|
||||
ring_init(&self->priv->cursor_cache_lru);
|
||||
self->priv->cursor_cache_available = CLIENT_CURSOR_CACHE_SIZE;
|
||||
}
|
||||
@ -69,9 +69,9 @@ cursor_channel_client_init(CursorChannelClient *self)
|
||||
static int _cursor_count = 0;
|
||||
#endif
|
||||
|
||||
void cursor_channel_client_reset_cursor_cache(RedChannelClient *rcc)
|
||||
void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc)
|
||||
{
|
||||
red_cursor_cache_reset(CURSOR_CHANNEL_CLIENT(rcc), CLIENT_CURSOR_CACHE_SIZE);
|
||||
red_cursor_cache_reset(ccc, CLIENT_CURSOR_CACHE_SIZE);
|
||||
}
|
||||
|
||||
static void cursor_channel_client_on_disconnect(RedChannelClient *rcc)
|
||||
@ -79,7 +79,7 @@ static void cursor_channel_client_on_disconnect(RedChannelClient *rcc)
|
||||
if (!rcc) {
|
||||
return;
|
||||
}
|
||||
cursor_channel_client_reset_cursor_cache(rcc);
|
||||
cursor_channel_client_reset_cursor_cache(CURSOR_CHANNEL_CLIENT(rcc));
|
||||
}
|
||||
|
||||
void cursor_channel_client_migrate(RedChannelClient *rcc)
|
||||
@ -96,7 +96,8 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor, RedClient
|
||||
{
|
||||
CursorChannelClient *rcc;
|
||||
|
||||
rcc = g_initable_new(TYPE_CURSOR_CHANNEL_CLIENT,
|
||||
rcc = (CursorChannelClient*)
|
||||
g_initable_new(TYPE_CURSOR_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", cursor,
|
||||
"client", client,
|
||||
|
||||
@ -65,7 +65,7 @@ CursorChannelClient* cursor_channel_client_new(CursorChannel *cursor,
|
||||
int mig_target,
|
||||
RedChannelCapabilities *caps);
|
||||
|
||||
void cursor_channel_client_reset_cursor_cache(RedChannelClient *rcc);
|
||||
void cursor_channel_client_reset_cursor_cache(CursorChannelClient *ccc);
|
||||
RedCacheItem* cursor_channel_client_cache_find(CursorChannelClient *ccc, uint64_t id);
|
||||
int cursor_channel_client_cache_add(CursorChannelClient *ccc, uint64_t id, size_t size);
|
||||
|
||||
|
||||
@ -210,11 +210,11 @@ static void cursor_channel_send_item(RedChannelClient *rcc, RedPipeItem *pipe_it
|
||||
red_marshall_inval(rcc, m, SPICE_CONTAINEROF(pipe_item, RedCacheItem, u.pipe_data));
|
||||
break;
|
||||
case RED_PIPE_ITEM_TYPE_CURSOR_INIT:
|
||||
cursor_channel_client_reset_cursor_cache(rcc);
|
||||
cursor_channel_client_reset_cursor_cache(ccc);
|
||||
red_marshall_cursor_init(ccc, m);
|
||||
break;
|
||||
case RED_PIPE_ITEM_TYPE_INVAL_CURSOR_CACHE:
|
||||
cursor_channel_client_reset_cursor_cache(rcc);
|
||||
cursor_channel_client_reset_cursor_cache(ccc);
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_CURSOR_INVAL_ALL);
|
||||
break;
|
||||
default:
|
||||
@ -229,14 +229,15 @@ CursorChannel* cursor_channel_new(RedsState *server, int id,
|
||||
Dispatcher *dispatcher)
|
||||
{
|
||||
spice_debug("create cursor channel");
|
||||
return g_object_new(TYPE_CURSOR_CHANNEL,
|
||||
"spice-server", server,
|
||||
"core-interface", core,
|
||||
"channel-type", SPICE_CHANNEL_CURSOR,
|
||||
"id", id,
|
||||
"handle-acks", TRUE,
|
||||
"dispatcher", dispatcher,
|
||||
NULL);
|
||||
return (CursorChannel*)
|
||||
g_object_new(TYPE_CURSOR_CHANNEL,
|
||||
"spice-server", server,
|
||||
"core-interface", core,
|
||||
"channel-type", SPICE_CHANNEL_CURSOR,
|
||||
"id", id,
|
||||
"handle-acks", TRUE,
|
||||
"dispatcher", dispatcher,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void cursor_channel_process_cmd(CursorChannel *cursor, RedCursorCmd *cursor_cmd)
|
||||
|
||||
@ -324,7 +324,7 @@ static void fill_base(SpiceMarshaller *base_marshaller, Drawable *drawable)
|
||||
|
||||
static void marshaller_compress_buf_free(uint8_t *data, void *opaque)
|
||||
{
|
||||
compress_buf_free(opaque);
|
||||
compress_buf_free((RedCompressBuf*) opaque);
|
||||
}
|
||||
|
||||
static void marshaller_add_compressed(SpiceMarshaller *m,
|
||||
@ -344,7 +344,7 @@ static void marshaller_add_compressed(SpiceMarshaller *m,
|
||||
|
||||
static void marshaller_unref_drawable(uint8_t *data, void *opaque)
|
||||
{
|
||||
Drawable *drawable = opaque;
|
||||
Drawable *drawable = (Drawable *) opaque;
|
||||
drawable_unref(drawable);
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ static bool pipe_rendered_drawables_intersect_with_areas(DisplayChannelClient *d
|
||||
|
||||
for (l = red_channel_client_get_pipe(RED_CHANNEL_CLIENT(dcc))->head; l != NULL; l = l->next) {
|
||||
Drawable *drawable;
|
||||
RedPipeItem *pipe_item = l->data;
|
||||
RedPipeItem *pipe_item = (RedPipeItem *) l->data;
|
||||
|
||||
if (pipe_item->type != RED_PIPE_ITEM_TYPE_DRAW)
|
||||
continue;
|
||||
@ -722,7 +722,7 @@ static void red_pipe_replace_rendered_drawables_with_images(DisplayChannelClient
|
||||
|
||||
// going from the oldest to the newest
|
||||
for (l = pipe->tail; l != NULL; l = prev) {
|
||||
RedPipeItem *pipe_item = l->data;
|
||||
RedPipeItem *pipe_item = (RedPipeItem *) l->data;
|
||||
Drawable *drawable;
|
||||
RedDrawablePipeItem *dpi;
|
||||
|
||||
@ -2283,7 +2283,7 @@ static void marshall_monitors_config(RedChannelClient *rcc, SpiceMarshaller *bas
|
||||
{
|
||||
int heads_size = sizeof(SpiceHead) * monitors_config->count;
|
||||
int i;
|
||||
SpiceMsgDisplayMonitorsConfig *msg = g_malloc0(sizeof(*msg) + heads_size);
|
||||
SpiceMsgDisplayMonitorsConfig *msg = (SpiceMsgDisplayMonitorsConfig *) g_malloc0(sizeof(*msg) + heads_size);
|
||||
int count = 0; // ignore monitors_config->count, it may contain zero width monitors, remove them now
|
||||
|
||||
red_channel_client_init_send_data(rcc, SPICE_MSG_DISPLAY_MONITORS_CONFIG);
|
||||
|
||||
29
server/dcc.c
29
server/dcc.c
@ -77,13 +77,13 @@ display_channel_client_set_property(GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_IMAGE_COMPRESSION:
|
||||
self->priv->image_compression = g_value_get_enum(value);
|
||||
self->priv->image_compression = (SpiceImageCompression) g_value_get_enum(value);
|
||||
break;
|
||||
case PROP_JPEG_STATE:
|
||||
self->priv->jpeg_state = g_value_get_enum(value);
|
||||
self->priv->jpeg_state = (spice_wan_compression_t) g_value_get_enum(value);
|
||||
break;
|
||||
case PROP_ZLIB_GLZ_STATE:
|
||||
self->priv->zlib_glz_state = g_value_get_enum(value);
|
||||
self->priv->zlib_glz_state = (spice_wan_compression_t) g_value_get_enum(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
@ -112,7 +112,7 @@ display_channel_client_finalize(GObject *object)
|
||||
{
|
||||
DisplayChannelClient *self = DISPLAY_CHANNEL_CLIENT(object);
|
||||
|
||||
g_signal_handlers_disconnect_by_func(DCC_TO_DC(self), on_display_video_codecs_update, self);
|
||||
g_signal_handlers_disconnect_by_func(DCC_TO_DC(self), (void*) on_display_video_codecs_update, self);
|
||||
g_clear_pointer(&self->priv->preferred_video_codecs, g_array_unref);
|
||||
g_clear_pointer(&self->priv->client_preferred_video_codecs, g_array_unref);
|
||||
g_free(self->priv);
|
||||
@ -177,7 +177,7 @@ static void display_channel_client_init(DisplayChannelClient *self)
|
||||
// todo: tune quality according to bandwidth
|
||||
self->priv->encoders.jpeg_quality = 85;
|
||||
|
||||
self->priv->send_data.free_list.res =
|
||||
self->priv->send_data.free_list.res = (SpiceResourceList*)
|
||||
g_malloc(sizeof(SpiceResourceList) +
|
||||
DISPLAY_FREE_LIST_DEFAULT_SIZE * sizeof(SpiceResourceID));
|
||||
self->priv->send_data.free_list.res_size = DISPLAY_FREE_LIST_DEFAULT_SIZE;
|
||||
@ -210,7 +210,7 @@ bool dcc_drawable_is_in_pipe(DisplayChannelClient *dcc, Drawable *drawable)
|
||||
GList *l;
|
||||
|
||||
for (l = drawable->pipes; l != NULL; l = l->next) {
|
||||
dpi = l->data;
|
||||
dpi = (RedDrawablePipeItem *) l->data;
|
||||
if (dpi->dcc == dcc) {
|
||||
return TRUE;
|
||||
}
|
||||
@ -239,7 +239,7 @@ bool dcc_clear_surface_drawables_from_pipe(DisplayChannelClient *dcc, int surfac
|
||||
Drawable *drawable;
|
||||
RedDrawablePipeItem *dpi = NULL;
|
||||
int depend_found = FALSE;
|
||||
RedPipeItem *item = l->data;
|
||||
RedPipeItem *item = (RedPipeItem *) l->data;
|
||||
GList *item_pos = l;
|
||||
|
||||
l = l->next;
|
||||
@ -501,7 +501,8 @@ DisplayChannelClient *dcc_new(DisplayChannel *display,
|
||||
{
|
||||
DisplayChannelClient *dcc;
|
||||
|
||||
dcc = g_initable_new(TYPE_DISPLAY_CHANNEL_CLIENT,
|
||||
dcc = (DisplayChannelClient*)
|
||||
g_initable_new(TYPE_DISPLAY_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", display,
|
||||
"client", client,
|
||||
@ -707,7 +708,7 @@ RedPipeItem *dcc_gl_scanout_item_new(RedChannelClient *rcc, void *data, int num)
|
||||
RedPipeItem *dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
|
||||
{
|
||||
DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
|
||||
const SpiceMsgDisplayGlDraw *draw = data;
|
||||
const SpiceMsgDisplayGlDraw *draw = (const SpiceMsgDisplayGlDraw *) data;
|
||||
RedGlDrawItem *item;
|
||||
|
||||
if (!red_stream_is_plain_unix(red_channel_client_get_stream(rcc)) ||
|
||||
@ -931,7 +932,7 @@ static void dcc_push_release(DisplayChannelClient *dcc, uint8_t type, uint64_t i
|
||||
}
|
||||
|
||||
if (free_list->res->count == free_list->res_size) {
|
||||
free_list->res = g_realloc(free_list->res,
|
||||
free_list->res = (SpiceResourceList*) g_realloc(free_list->res,
|
||||
sizeof(*free_list->res) +
|
||||
free_list->res_size * sizeof(SpiceResourceID) * 2);
|
||||
free_list->res_size *= 2;
|
||||
@ -1087,7 +1088,7 @@ static bool dcc_handle_preferred_compression(DisplayChannelClient *dcc,
|
||||
case SPICE_IMAGE_COMPRESSION_LZ:
|
||||
case SPICE_IMAGE_COMPRESSION_GLZ:
|
||||
case SPICE_IMAGE_COMPRESSION_OFF:
|
||||
dcc->priv->image_compression = pc->image_compression;
|
||||
dcc->priv->image_compression = (SpiceImageCompression) pc->image_compression;
|
||||
break;
|
||||
default:
|
||||
spice_warning("preferred-compression: unsupported image compression setting");
|
||||
@ -1111,9 +1112,9 @@ static gint sort_video_codecs_by_client_preference(gconstpointer a_pointer,
|
||||
gconstpointer b_pointer,
|
||||
gpointer user_data)
|
||||
{
|
||||
const RedVideoCodec *a = a_pointer;
|
||||
const RedVideoCodec *b = b_pointer;
|
||||
GArray *client_pref = user_data;
|
||||
const RedVideoCodec *a = (const RedVideoCodec *) a_pointer;
|
||||
const RedVideoCodec *b = (const RedVideoCodec *) b_pointer;
|
||||
GArray *client_pref = (GArray *) user_data;
|
||||
|
||||
return (g_array_index(client_pref, gint, a->type) -
|
||||
g_array_index(client_pref, gint, b->type));
|
||||
|
||||
@ -153,15 +153,16 @@ dispatcher_class_init(DispatcherClass *klass)
|
||||
static void
|
||||
dispatcher_init(Dispatcher *self)
|
||||
{
|
||||
self->priv = dispatcher_get_instance_private(self);
|
||||
self->priv = (DispatcherPrivate*) dispatcher_get_instance_private(self);
|
||||
}
|
||||
|
||||
Dispatcher *
|
||||
dispatcher_new(size_t max_message_type)
|
||||
{
|
||||
return g_object_new(TYPE_DISPATCHER,
|
||||
"max-message-type", (guint) max_message_type,
|
||||
NULL);
|
||||
return (Dispatcher*)
|
||||
g_object_new(TYPE_DISPATCHER,
|
||||
"max-message-type", (guint) max_message_type,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
@ -263,7 +264,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
|
||||
{
|
||||
int ret;
|
||||
DispatcherMessage msg[1];
|
||||
uint8_t *payload;
|
||||
void *payload;
|
||||
uint32_t ack = ACK;
|
||||
|
||||
if ((ret = read_safe(dispatcher->priv->recv_fd, (uint8_t*)msg, sizeof(msg), 0)) == -1) {
|
||||
@ -279,7 +280,7 @@ static int dispatcher_handle_single_read(Dispatcher *dispatcher)
|
||||
dispatcher->priv->payload_size = msg->size;
|
||||
}
|
||||
payload = dispatcher->priv->payload;
|
||||
if (read_safe(dispatcher->priv->recv_fd, payload, msg->size, 1) == -1) {
|
||||
if (read_safe(dispatcher->priv->recv_fd, (uint8_t*) payload, msg->size, 1) == -1) {
|
||||
g_warning("error reading from dispatcher: %d", errno);
|
||||
/* TODO: close socketpair? */
|
||||
return 0;
|
||||
@ -327,7 +328,7 @@ dispatcher_send_message_internal(Dispatcher *dispatcher, const DispatcherMessage
|
||||
msg->type);
|
||||
goto unlock;
|
||||
}
|
||||
if (write_safe(send_fd, payload, msg->size) == -1) {
|
||||
if (write_safe(send_fd, (uint8_t*) payload, msg->size) == -1) {
|
||||
g_warning("error: failed to send message body for message %d",
|
||||
msg->type);
|
||||
goto unlock;
|
||||
|
||||
@ -74,10 +74,10 @@ display_channel_set_property(GObject *object,
|
||||
self->priv->n_surfaces = MIN(g_value_get_uint(value), NUM_SURFACES);
|
||||
break;
|
||||
case PROP_VIDEO_CODECS:
|
||||
display_channel_set_video_codecs(self, g_value_get_boxed(value));
|
||||
display_channel_set_video_codecs(self, (GArray*) g_value_get_boxed(value));
|
||||
break;
|
||||
case PROP_QXL:
|
||||
self->priv->qxl = g_value_get_pointer(value);
|
||||
self->priv->qxl = (QXLInstance*) g_value_get_pointer(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
@ -193,7 +193,7 @@ static MonitorsConfig* monitors_config_new(const QXLHead *heads, ssize_t nheads,
|
||||
{
|
||||
MonitorsConfig *mc;
|
||||
|
||||
mc = g_malloc(sizeof(MonitorsConfig) + nheads * sizeof(QXLHead));
|
||||
mc = (MonitorsConfig*) g_malloc(sizeof(MonitorsConfig) + nheads * sizeof(QXLHead));
|
||||
mc->refs = 1;
|
||||
mc->count = nheads;
|
||||
mc->max_allowed = max;
|
||||
@ -389,7 +389,7 @@ static void pipes_add_drawable_after(DisplayChannel *display,
|
||||
GList *l;
|
||||
|
||||
for (l = pos_after->pipes; l != NULL; l = l->next) {
|
||||
dpi_pos_after = l->data;
|
||||
dpi_pos_after = (RedDrawablePipeItem*) l->data;
|
||||
|
||||
num_other_linked++;
|
||||
dcc_add_drawable_after(dpi_pos_after->dcc, drawable, &dpi_pos_after->base);
|
||||
@ -405,7 +405,7 @@ static void pipes_add_drawable_after(DisplayChannel *display,
|
||||
int sent = 0;
|
||||
GList *l;
|
||||
for (l = pos_after->pipes; l != NULL; l = l->next) {
|
||||
dpi_pos_after = l->data;
|
||||
dpi_pos_after = (RedDrawablePipeItem*) l->data;
|
||||
if (dpi_pos_after->dcc == dcc) {
|
||||
sent = 1;
|
||||
break;
|
||||
@ -1474,7 +1474,7 @@ bool display_channel_wait_for_migrate_data(DisplayChannel *display)
|
||||
spice_debug("trace");
|
||||
spice_warn_if_fail(g_list_length(clients) == 1);
|
||||
|
||||
rcc = g_list_nth_data(clients, 0);
|
||||
rcc = (RedChannelClient*) g_list_nth_data(clients, 0);
|
||||
|
||||
g_object_ref(rcc);
|
||||
for (;;) {
|
||||
@ -1874,7 +1874,7 @@ static void surface_update_dest(RedSurface *surface, const SpiceRect *area)
|
||||
{
|
||||
SpiceCanvas *canvas = surface->context.canvas;
|
||||
int stride = surface->context.stride;
|
||||
uint8_t *line_0 = surface->context.line_0;
|
||||
uint8_t *line_0 = (uint8_t*) surface->context.line_0;
|
||||
|
||||
if (surface->context.canvas_draws_on_surface)
|
||||
return;
|
||||
@ -2138,7 +2138,7 @@ create_canvas_for_surface(DisplayChannel *display, RedSurface *surface, uint32_t
|
||||
switch (renderer) {
|
||||
case RED_RENDERER_SW:
|
||||
canvas = canvas_create_for_data(surface->context.width, surface->context.height, surface->context.format,
|
||||
surface->context.line_0, surface->context.stride,
|
||||
(uint8_t*) surface->context.line_0, surface->context.stride,
|
||||
&display->priv->image_cache.base,
|
||||
&display->priv->image_surfaces, NULL, NULL, NULL);
|
||||
surface->context.top_down = TRUE;
|
||||
@ -2166,7 +2166,7 @@ void display_channel_create_surface(DisplayChannel *display, uint32_t surface_id
|
||||
surface->context.stride = stride;
|
||||
surface->context.line_0 = line_0;
|
||||
if (!data_is_valid) {
|
||||
char *data = line_0;
|
||||
char *data = (char*) line_0;
|
||||
if (stride < 0) {
|
||||
data -= abs(stride) * (height - 1);
|
||||
}
|
||||
@ -2245,7 +2245,7 @@ DisplayChannel* display_channel_new(RedsState *reds,
|
||||
|
||||
/* FIXME: migrate is not used...? */
|
||||
spice_debug("create display channel");
|
||||
display = g_object_new(TYPE_DISPLAY_CHANNEL,
|
||||
display = (DisplayChannel*) g_object_new(TYPE_DISPLAY_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", core,
|
||||
"channel-type", SPICE_CHANNEL_DISPLAY,
|
||||
|
||||
@ -144,14 +144,14 @@ static void timer_remove(SpiceTimer *timer_base)
|
||||
|
||||
static GIOCondition spice_event_to_giocondition(int event_mask)
|
||||
{
|
||||
GIOCondition condition = 0;
|
||||
int condition = 0;
|
||||
|
||||
if (event_mask & SPICE_WATCH_EVENT_READ)
|
||||
condition |= G_IO_IN;
|
||||
if (event_mask & SPICE_WATCH_EVENT_WRITE)
|
||||
condition |= G_IO_OUT;
|
||||
|
||||
return condition;
|
||||
return (GIOCondition) condition;
|
||||
}
|
||||
|
||||
static int giocondition_to_spice_event(GIOCondition condition)
|
||||
|
||||
@ -828,7 +828,7 @@ static void set_appsrc_caps(SpiceGstEncoder *encoder)
|
||||
|
||||
static GstBusSyncReply handle_pipeline_message(GstBus *bus, GstMessage *msg, gpointer video_encoder)
|
||||
{
|
||||
SpiceGstEncoder *encoder = video_encoder;
|
||||
SpiceGstEncoder *encoder = (SpiceGstEncoder*) video_encoder;
|
||||
|
||||
if (GST_MESSAGE_TYPE(msg) == GST_MESSAGE_ERROR) {
|
||||
GError *err = NULL;
|
||||
@ -1173,7 +1173,7 @@ static BitmapWrapper *bitmap_wrapper_new(SpiceGstEncoder *encoder, gpointer bitm
|
||||
|
||||
static void bitmap_wrapper_unref(gpointer data)
|
||||
{
|
||||
BitmapWrapper *wrapper = data;
|
||||
BitmapWrapper *wrapper = (BitmapWrapper*) data;
|
||||
if (g_atomic_int_dec_and_test(&wrapper->refs)) {
|
||||
g_async_queue_push(wrapper->encoder->unused_bitmap_opaques, wrapper->opaque);
|
||||
g_free(wrapper);
|
||||
@ -1488,13 +1488,13 @@ spice_gst_encoder_encode_frame(VideoEncoder *video_encoder,
|
||||
spice_debug("video format change: width %d -> %d, height %d -> %d, format %d -> %d",
|
||||
encoder->width, width, encoder->height, height,
|
||||
encoder->spice_format, bitmap->format);
|
||||
encoder->format = map_format(bitmap->format);
|
||||
encoder->format = map_format((SpiceBitmapFmt) bitmap->format);
|
||||
if (encoder->format == GSTREAMER_FORMAT_INVALID) {
|
||||
spice_warning("unable to map format type %d", bitmap->format);
|
||||
encoder->errors = 4;
|
||||
return VIDEO_ENCODER_FRAME_UNSUPPORTED;
|
||||
}
|
||||
encoder->spice_format = bitmap->format;
|
||||
encoder->spice_format = (SpiceBitmapFmt) bitmap->format;
|
||||
encoder->width = width;
|
||||
encoder->height = height;
|
||||
if (encoder->bit_rate == 0) {
|
||||
|
||||
@ -709,7 +709,7 @@ static GlzSharedDictionary *find_glz_dictionary(RedClient *client, uint8_t dict_
|
||||
GlzSharedDictionary *ret = NULL;
|
||||
|
||||
for (l = glz_dictionary_list; l != NULL; l = l->next) {
|
||||
GlzSharedDictionary *dict = l->data;
|
||||
GlzSharedDictionary *dict = (GlzSharedDictionary *) l->data;
|
||||
if ((dict->client == client) && (dict->id == dict_id)) {
|
||||
ret = dict;
|
||||
break;
|
||||
|
||||
@ -81,7 +81,7 @@ inputs_channel_client_class_init(InputsChannelClientClass *klass)
|
||||
static void
|
||||
inputs_channel_client_init(InputsChannelClient *self)
|
||||
{
|
||||
self->priv = inputs_channel_client_get_instance_private(self);
|
||||
self->priv = (InputsChannelClientPrivate *) inputs_channel_client_get_instance_private(self);
|
||||
}
|
||||
|
||||
RedChannelClient* inputs_channel_client_create(RedChannel *channel,
|
||||
@ -91,7 +91,8 @@ RedChannelClient* inputs_channel_client_create(RedChannel *channel,
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
rcc = g_initable_new(TYPE_INPUTS_CHANNEL_CLIENT,
|
||||
rcc = (RedChannelClient *)
|
||||
g_initable_new(TYPE_INPUTS_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
|
||||
@ -281,12 +281,12 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
|
||||
switch (type) {
|
||||
case SPICE_MSGC_INPUTS_KEY_DOWN: {
|
||||
SpiceMsgcKeyDown *key_down = message;
|
||||
SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *) message;
|
||||
inputs_channel_sync_locks(inputs_channel, key_down->code);
|
||||
}
|
||||
/* fallthrough */
|
||||
case SPICE_MSGC_INPUTS_KEY_UP: {
|
||||
SpiceMsgcKeyUp *key_up = message;
|
||||
SpiceMsgcKeyUp *key_up = (SpiceMsgcKeyUp *) message;
|
||||
for (i = 0; i < 4; i++) {
|
||||
uint8_t code = (key_up->code >> (i * 8)) & 0xff;
|
||||
if (code == 0) {
|
||||
@ -298,7 +298,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_KEY_SCANCODE: {
|
||||
uint8_t *code = message;
|
||||
uint8_t *code = (uint8_t *) message;
|
||||
for (i = 0; i < size; i++) {
|
||||
kbd_push_scan(inputs_channel_get_keyboard(inputs_channel), code[i]);
|
||||
inputs_channel_sync_locks(inputs_channel, code[i]);
|
||||
@ -307,7 +307,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
|
||||
SpiceMouseInstance *mouse = inputs_channel_get_mouse(inputs_channel);
|
||||
SpiceMsgcMouseMotion *mouse_motion = message;
|
||||
SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *) message;
|
||||
|
||||
inputs_channel_client_on_mouse_motion(icc);
|
||||
if (mouse && reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_SERVER) {
|
||||
@ -320,7 +320,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_POSITION: {
|
||||
SpiceMsgcMousePosition *pos = message;
|
||||
SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *) message;
|
||||
SpiceTabletInstance *tablet = inputs_channel_get_tablet(inputs_channel);
|
||||
|
||||
inputs_channel_client_on_mouse_motion(icc);
|
||||
@ -343,7 +343,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_PRESS: {
|
||||
SpiceMsgcMousePress *mouse_press = message;
|
||||
SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *) message;
|
||||
int dz = 0;
|
||||
if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) {
|
||||
dz = -1;
|
||||
@ -374,7 +374,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
|
||||
SpiceMsgcMouseRelease *mouse_release = message;
|
||||
SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *) message;
|
||||
if (reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_CLIENT) {
|
||||
if (reds_config_get_agent_mouse(reds) && reds_has_vdagent(reds)) {
|
||||
inputs_channel->mouse_state.buttons =
|
||||
@ -397,7 +397,7 @@ static bool inputs_channel_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
|
||||
SpiceMsgcKeyModifiers *modifiers = message;
|
||||
SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *) message;
|
||||
uint8_t leds;
|
||||
SpiceKbdInstance *keyboard = inputs_channel_get_keyboard(inputs_channel);
|
||||
|
||||
@ -521,7 +521,7 @@ SPICE_GNUC_VISIBLE int spice_server_kbd_leds(SpiceKbdInstance *sin, int leds)
|
||||
|
||||
static void key_modifiers_sender(void *opaque)
|
||||
{
|
||||
InputsChannel *inputs = opaque;
|
||||
InputsChannel *inputs = (InputsChannel *) opaque;
|
||||
inputs_channel_push_keyboard_modifiers(inputs, inputs->modifiers);
|
||||
}
|
||||
|
||||
@ -561,15 +561,15 @@ static bool inputs_channel_handle_migrate_data(RedChannelClient *rcc,
|
||||
|
||||
InputsChannel* inputs_channel_new(RedsState *reds)
|
||||
{
|
||||
return g_object_new(TYPE_INPUTS_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", (int)SPICE_CHANNEL_INPUTS,
|
||||
"id", 0,
|
||||
"migration-flags",
|
||||
(guint)(SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER),
|
||||
NULL);
|
||||
|
||||
return (InputsChannel*)
|
||||
g_object_new(TYPE_INPUTS_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", (int)SPICE_CHANNEL_INPUTS,
|
||||
"id", 0,
|
||||
"migration-flags",
|
||||
(guint)(SPICE_MIGRATE_NEED_FLUSH | SPICE_MIGRATE_NEED_DATA_TRANSFER),
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@ -108,7 +108,7 @@ void jpeg_encoder_destroy(JpegEncoderContext* encoder)
|
||||
|
||||
static void convert_RGB16_to_RGB24(void *line, int width, uint8_t **out_line)
|
||||
{
|
||||
uint16_t *src_line = line;
|
||||
uint16_t *src_line = (uint16_t *) line;
|
||||
uint8_t *out_pix;
|
||||
int x;
|
||||
|
||||
@ -129,7 +129,7 @@ static void convert_BGR24_to_RGB24(void *in_line, int width, uint8_t **out_line)
|
||||
{
|
||||
int x;
|
||||
uint8_t *out_pix;
|
||||
uint8_t *line = in_line;
|
||||
uint8_t *line = (uint8_t *) in_line;
|
||||
spice_assert(out_line && *out_line);
|
||||
|
||||
out_pix = *out_line;
|
||||
@ -144,7 +144,7 @@ static void convert_BGR24_to_RGB24(void *in_line, int width, uint8_t **out_line)
|
||||
|
||||
static void convert_BGRX32_to_RGB24(void *line, int width, uint8_t **out_line)
|
||||
{
|
||||
uint32_t *src_line = line;
|
||||
uint32_t *src_line = (uint32_t *) line;
|
||||
uint8_t *out_pix;
|
||||
int x;
|
||||
|
||||
|
||||
@ -228,7 +228,7 @@ static void main_channel_client_class_init(MainChannelClientClass *klass)
|
||||
|
||||
static void main_channel_client_init(MainChannelClient *self)
|
||||
{
|
||||
self->priv = main_channel_client_get_instance_private(self);
|
||||
self->priv = (MainChannelClientPrivate *) main_channel_client_get_instance_private(self);
|
||||
self->priv->bitrate_per_sec = ~0;
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ void main_channel_client_push_init(MainChannelClient *mcc,
|
||||
|
||||
static RedPipeItem *main_name_item_new(const char *name)
|
||||
{
|
||||
RedNamePipeItem *item = g_malloc(sizeof(RedNamePipeItem) + strlen(name) + 1);
|
||||
RedNamePipeItem *item = (RedNamePipeItem*) g_malloc(sizeof(RedNamePipeItem) + strlen(name) + 1);
|
||||
|
||||
red_pipe_item_init(&item->base, RED_PIPE_ITEM_TYPE_MAIN_NAME);
|
||||
item->msg.name_len = strlen(name) + 1;
|
||||
@ -625,7 +625,8 @@ MainChannelClient *main_channel_client_create(MainChannel *main_chan, RedClient
|
||||
{
|
||||
MainChannelClient *mcc;
|
||||
|
||||
mcc = g_initable_new(TYPE_MAIN_CHANNEL_CLIENT,
|
||||
mcc = (MainChannelClient *)
|
||||
g_initable_new(TYPE_MAIN_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", RED_CHANNEL(main_chan),
|
||||
"client", client,
|
||||
|
||||
@ -247,7 +247,7 @@ MainChannelClient *main_channel_link(MainChannel *channel, RedClient *client,
|
||||
MainChannel* main_channel_new(RedsState *reds)
|
||||
{
|
||||
// TODO: set the migration flag of the channel
|
||||
return g_object_new(TYPE_MAIN_CHANNEL,
|
||||
return (MainChannel*) g_object_new(TYPE_MAIN_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", (gint)SPICE_CHANNEL_MAIN,
|
||||
@ -336,7 +336,7 @@ int main_channel_migrate_connect(MainChannel *main_channel, RedsMigSpice *mig_ta
|
||||
GList *clients = red_channel_get_clients(RED_CHANNEL(main_channel));
|
||||
|
||||
/* just test the first one */
|
||||
rcc = g_list_nth_data(clients, 0);
|
||||
rcc = (RedChannelClient*) g_list_nth_data(clients, 0);
|
||||
|
||||
if (!red_channel_client_test_remote_cap(rcc,
|
||||
SPICE_MAIN_CAP_SEAMLESS_MIGRATE)) {
|
||||
|
||||
@ -87,7 +87,7 @@ main_dispatcher_set_property(GObject *object,
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_SPICE_SERVER:
|
||||
self->priv->reds = g_value_get_pointer(value);
|
||||
self->priv->reds = (RedsState*) g_value_get_pointer(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
@ -119,7 +119,7 @@ main_dispatcher_class_init(MainDispatcherClass *klass)
|
||||
static void
|
||||
main_dispatcher_init(MainDispatcher *self)
|
||||
{
|
||||
self->priv = main_dispatcher_get_instance_private(self);
|
||||
self->priv = (MainDispatcherPrivate*) main_dispatcher_get_instance_private(self);
|
||||
self->priv->thread_id = pthread_self();
|
||||
}
|
||||
|
||||
@ -154,8 +154,8 @@ typedef struct MainDispatcherClientDisconnectMessage {
|
||||
static void main_dispatcher_handle_channel_event(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
MainDispatcherChannelEventMessage *channel_event = payload;
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherChannelEventMessage *channel_event = (MainDispatcherChannelEventMessage*) payload;
|
||||
|
||||
reds_handle_channel_event(reds, channel_event->event, channel_event->info);
|
||||
}
|
||||
@ -178,8 +178,8 @@ void main_dispatcher_channel_event(MainDispatcher *self, int event, SpiceChannel
|
||||
static void main_dispatcher_handle_migrate_complete(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
MainDispatcherMigrateSeamlessDstCompleteMessage *mig_complete = payload;
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherMigrateSeamlessDstCompleteMessage *mig_complete = (MainDispatcherMigrateSeamlessDstCompleteMessage*) payload;
|
||||
|
||||
reds_on_client_seamless_migrate_complete(reds, mig_complete->client);
|
||||
g_object_unref(mig_complete->client);
|
||||
@ -188,8 +188,8 @@ static void main_dispatcher_handle_migrate_complete(void *opaque,
|
||||
static void main_dispatcher_handle_mm_time_latency(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
MainDispatcherMmTimeLatencyMessage *msg = payload;
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherMmTimeLatencyMessage *msg = (MainDispatcherMmTimeLatencyMessage*) payload;
|
||||
reds_set_client_mm_time_latency(reds, msg->client, msg->latency);
|
||||
g_object_unref(msg->client);
|
||||
}
|
||||
@ -197,8 +197,8 @@ static void main_dispatcher_handle_mm_time_latency(void *opaque,
|
||||
static void main_dispatcher_handle_client_disconnect(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
MainDispatcherClientDisconnectMessage *msg = payload;
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherClientDisconnectMessage *msg = (MainDispatcherClientDisconnectMessage*) payload;
|
||||
|
||||
spice_debug("client=%p", msg->client);
|
||||
reds_client_disconnect(reds, msg->client);
|
||||
@ -215,7 +215,7 @@ void main_dispatcher_seamless_migrate_dst_complete(MainDispatcher *self,
|
||||
return;
|
||||
}
|
||||
|
||||
msg.client = g_object_ref(client);
|
||||
msg.client = (RedClient*) g_object_ref(client);
|
||||
dispatcher_send_message(DISPATCHER(self), MAIN_DISPATCHER_MIGRATE_SEAMLESS_DST_COMPLETE,
|
||||
&msg);
|
||||
}
|
||||
@ -229,7 +229,7 @@ void main_dispatcher_set_mm_time_latency(MainDispatcher *self, RedClient *client
|
||||
return;
|
||||
}
|
||||
|
||||
msg.client = g_object_ref(client);
|
||||
msg.client = (RedClient*) g_object_ref(client);
|
||||
msg.latency = latency;
|
||||
dispatcher_send_message(DISPATCHER(self), MAIN_DISPATCHER_SET_MM_TIME_LATENCY,
|
||||
&msg);
|
||||
@ -241,7 +241,7 @@ void main_dispatcher_client_disconnect(MainDispatcher *self, RedClient *client)
|
||||
|
||||
if (!red_client_is_disconnecting(client)) {
|
||||
spice_debug("client %p", client);
|
||||
msg.client = g_object_ref(client);
|
||||
msg.client = (RedClient*) g_object_ref(client);
|
||||
dispatcher_send_message(DISPATCHER(self), MAIN_DISPATCHER_CLIENT_DISCONNECT,
|
||||
&msg);
|
||||
} else {
|
||||
@ -256,7 +256,7 @@ void main_dispatcher_client_disconnect(MainDispatcher *self, RedClient *client)
|
||||
*/
|
||||
MainDispatcher* main_dispatcher_new(RedsState *reds)
|
||||
{
|
||||
MainDispatcher *self = g_object_new(TYPE_MAIN_DISPATCHER,
|
||||
MainDispatcher *self = (MainDispatcher*) g_object_new(TYPE_MAIN_DISPATCHER,
|
||||
"spice-server", reds,
|
||||
"max-message-type", MAIN_DISPATCHER_NUM_MESSAGES,
|
||||
NULL);
|
||||
|
||||
@ -206,7 +206,7 @@ static MJpegVideoBuffer* create_mjpeg_video_buffer(void)
|
||||
MJpegVideoBuffer *buffer = g_new0(MJpegVideoBuffer, 1);
|
||||
buffer->base.free = mjpeg_video_buffer_free;
|
||||
buffer->maxsize = MJPEG_INITIAL_BUFFER_SIZE;
|
||||
buffer->base.data = g_try_malloc(buffer->maxsize);
|
||||
buffer->base.data = (uint8_t*) g_try_malloc(buffer->maxsize);
|
||||
if (!buffer->base.data) {
|
||||
g_free(buffer);
|
||||
buffer = NULL;
|
||||
@ -286,7 +286,7 @@ static boolean empty_mem_output_buffer(j_compress_ptr cinfo)
|
||||
|
||||
/* Try to allocate new buffer with double size */
|
||||
nextsize = dest->bufsize * 2;
|
||||
nextbuffer = g_try_realloc(dest->buffer, nextsize);
|
||||
nextbuffer = (uint8_t*) g_try_realloc(dest->buffer, nextsize);
|
||||
|
||||
if (nextbuffer == NULL)
|
||||
ERREXIT1(cinfo, JERR_OUT_OF_MEMORY, 10);
|
||||
@ -798,7 +798,7 @@ mjpeg_encoder_start_frame(MJpegEncoder *encoder,
|
||||
return VIDEO_ENCODER_FRAME_UNSUPPORTED;
|
||||
}
|
||||
if (encoder->row_size < stride) {
|
||||
encoder->row = g_realloc(encoder->row, stride);
|
||||
encoder->row = (uint8_t*) g_realloc(encoder->row, stride);
|
||||
encoder->row_size = stride;
|
||||
}
|
||||
}
|
||||
@ -951,8 +951,8 @@ mjpeg_encoder_encode_frame(VideoEncoder *video_encoder,
|
||||
return VIDEO_ENCODER_FRAME_UNSUPPORTED;
|
||||
}
|
||||
|
||||
VideoEncodeResults ret = mjpeg_encoder_start_frame(encoder, bitmap->format, src,
|
||||
buffer, frame_mm_time);
|
||||
VideoEncodeResults ret = mjpeg_encoder_start_frame(encoder, (SpiceBitmapFmt) bitmap->format,
|
||||
src, buffer, frame_mm_time);
|
||||
if (ret == VIDEO_ENCODER_FRAME_ENCODE_DONE) {
|
||||
if (encode_frame(encoder, src, bitmap, top_down)) {
|
||||
buffer->base.size = mjpeg_encoder_end_frame(encoder);
|
||||
|
||||
@ -28,11 +28,11 @@ void red_channel_capabilities_init(RedChannelCapabilities *dest,
|
||||
{
|
||||
*dest = *caps;
|
||||
if (caps->common_caps) {
|
||||
dest->common_caps = g_memdup(caps->common_caps,
|
||||
dest->common_caps = (uint32_t*) g_memdup(caps->common_caps,
|
||||
caps->num_common_caps * sizeof(uint32_t));
|
||||
}
|
||||
if (caps->num_caps) {
|
||||
dest->caps = g_memdup(caps->caps, caps->num_caps * sizeof(uint32_t));
|
||||
dest->caps = (uint32_t*) g_memdup(caps->caps, caps->num_caps * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -322,22 +322,22 @@ red_channel_client_set_property(GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_STREAM:
|
||||
self->priv->stream = g_value_get_pointer(value);
|
||||
self->priv->stream = (RedStream*) g_value_get_pointer(value);
|
||||
break;
|
||||
case PROP_CHANNEL:
|
||||
if (self->priv->channel)
|
||||
g_object_unref(self->priv->channel);
|
||||
self->priv->channel = g_value_dup_object(value);
|
||||
self->priv->channel = (RedChannel *) g_value_dup_object(value);
|
||||
break;
|
||||
case PROP_CLIENT:
|
||||
self->priv->client = g_value_get_object(value);
|
||||
self->priv->client = (RedClient *) g_value_get_object(value);
|
||||
break;
|
||||
case PROP_MONITOR_LATENCY:
|
||||
self->priv->monitor_latency = g_value_get_boolean(value);
|
||||
break;
|
||||
case PROP_CAPS:
|
||||
{
|
||||
RedChannelCapabilities *caps = g_value_get_boxed(value);
|
||||
RedChannelCapabilities *caps = (RedChannelCapabilities *) g_value_get_boxed(value);
|
||||
if (caps) {
|
||||
red_channel_capabilities_reset(&self->priv->remote_caps);
|
||||
red_channel_capabilities_init(&self->priv->remote_caps, caps);
|
||||
@ -467,7 +467,7 @@ static void red_channel_client_class_init(RedChannelClientClass *klass)
|
||||
static void
|
||||
red_channel_client_init(RedChannelClient *self)
|
||||
{
|
||||
self->priv = red_channel_client_get_instance_private(self);
|
||||
self->priv = (RedChannelClientPrivate *) red_channel_client_get_instance_private(self);
|
||||
// blocks send message (maybe use send_data.blocked + block flags)
|
||||
self->priv->ack_data.messages_window = ~0;
|
||||
self->priv->ack_data.client_generation = ~0;
|
||||
@ -702,7 +702,7 @@ static void red_channel_client_push_ping(RedChannelClient *rcc)
|
||||
|
||||
static void red_channel_client_ping_timer(void *opaque)
|
||||
{
|
||||
RedChannelClient *rcc = opaque;
|
||||
RedChannelClient *rcc = (RedChannelClient *) opaque;
|
||||
|
||||
g_object_ref(rcc);
|
||||
|
||||
@ -754,7 +754,7 @@ static inline int red_channel_client_waiting_for_ack(RedChannelClient *rcc)
|
||||
*/
|
||||
static void red_channel_client_connectivity_timer(void *opaque)
|
||||
{
|
||||
RedChannelClient *rcc = opaque;
|
||||
RedChannelClient *rcc = (RedChannelClient *) opaque;
|
||||
RedChannelClientConnectivityMonitor *monitor = &rcc->priv->connectivity_monitor;
|
||||
int is_alive = TRUE;
|
||||
|
||||
@ -840,7 +840,7 @@ void red_channel_client_start_connectivity_monitoring(RedChannelClient *rcc, uin
|
||||
|
||||
static void red_channel_client_event(int fd, int event, void *data)
|
||||
{
|
||||
RedChannelClient *rcc = RED_CHANNEL_CLIENT(data);
|
||||
RedChannelClient *rcc = (RedChannelClient *) data;
|
||||
|
||||
g_object_ref(rcc);
|
||||
if (event & SPICE_WATCH_EVENT_READ) {
|
||||
@ -1303,7 +1303,7 @@ static inline RedPipeItem *red_channel_client_pipe_item_get(RedChannelClient *rc
|
||||
|| red_channel_client_waiting_for_ack(rcc)) {
|
||||
return NULL;
|
||||
}
|
||||
return g_queue_pop_tail(&rcc->priv->pipe);
|
||||
return (RedPipeItem*) g_queue_pop_tail(&rcc->priv->pipe);
|
||||
}
|
||||
|
||||
void red_channel_client_push(RedChannelClient *rcc)
|
||||
@ -1483,7 +1483,7 @@ bool red_channel_client_handle_message(RedChannelClient *rcc, uint16_t type,
|
||||
red_channel_client_handle_migrate_data(rcc, size, message);
|
||||
break;
|
||||
case SPICE_MSGC_PONG:
|
||||
red_channel_client_handle_pong(rcc, message);
|
||||
red_channel_client_handle_pong(rcc, (SpiceMsgPing*) message);
|
||||
break;
|
||||
default:
|
||||
red_channel_warning(red_channel_client_get_channel(rcc), "invalid message type %u", type);
|
||||
@ -1694,7 +1694,7 @@ static void red_channel_client_pipe_clear(RedChannelClient *rcc)
|
||||
RedPipeItem *item;
|
||||
|
||||
red_channel_client_clear_sent_item(rcc);
|
||||
while ((item = g_queue_pop_head(&rcc->priv->pipe)) != NULL) {
|
||||
while ((item = (RedPipeItem*) g_queue_pop_head(&rcc->priv->pipe)) != NULL) {
|
||||
red_pipe_item_unref(item);
|
||||
}
|
||||
}
|
||||
@ -1872,7 +1872,7 @@ void red_channel_client_pipe_remove_and_release(RedChannelClient *rcc,
|
||||
void red_channel_client_pipe_remove_and_release_pos(RedChannelClient *rcc,
|
||||
GList *item_pos)
|
||||
{
|
||||
RedPipeItem *item = item_pos->data;
|
||||
RedPipeItem *item = (RedPipeItem*) item_pos->data;
|
||||
|
||||
g_queue_delete_link(&rcc->priv->pipe, item_pos);
|
||||
red_pipe_item_unref(item);
|
||||
|
||||
@ -156,10 +156,10 @@ red_channel_set_property(GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_SPICE_SERVER:
|
||||
self->priv->reds = g_value_get_pointer(value);
|
||||
self->priv->reds = (RedsState*) g_value_get_pointer(value);
|
||||
break;
|
||||
case PROP_CORE_INTERFACE:
|
||||
self->priv->core = g_value_get_pointer(value);
|
||||
self->priv->core = (SpiceCoreInterfaceInternal*) g_value_get_pointer(value);
|
||||
break;
|
||||
case PROP_TYPE:
|
||||
self->priv->type = g_value_get_int(value);
|
||||
@ -175,7 +175,7 @@ red_channel_set_property(GObject *object,
|
||||
break;
|
||||
case PROP_DISPATCHER:
|
||||
g_clear_object(&self->priv->dispatcher);
|
||||
self->priv->dispatcher = g_value_dup_object(value);
|
||||
self->priv->dispatcher = (Dispatcher*) g_value_dup_object(value);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
@ -308,7 +308,7 @@ red_channel_class_init(RedChannelClass *klass)
|
||||
static void
|
||||
red_channel_init(RedChannel *self)
|
||||
{
|
||||
self->priv = red_channel_get_instance_private(self);
|
||||
self->priv = (RedChannelPrivate*) red_channel_get_instance_private(self);
|
||||
|
||||
red_channel_set_common_cap(self, SPICE_COMMON_CAP_MINI_HEADER);
|
||||
red_channel_set_common_cap(self, SPICE_COMMON_CAP_PROTOCOL_AUTH_SELECTION);
|
||||
@ -361,7 +361,7 @@ bool red_channel_is_waiting_for_migrate_data(RedChannel *channel)
|
||||
return FALSE;
|
||||
}
|
||||
spice_assert(n_clients == 1);
|
||||
rcc = g_list_nth_data(channel->priv->clients, 0);
|
||||
rcc = (RedChannelClient*) g_list_nth_data(channel->priv->clients, 0);
|
||||
return red_channel_client_is_waiting_for_migrate_data(rcc);
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ typedef struct RedMessageConnect {
|
||||
|
||||
static void handle_dispatcher_connect(void *opaque, void *payload)
|
||||
{
|
||||
RedMessageConnect *msg = payload;
|
||||
RedMessageConnect *msg = (RedMessageConnect*) payload;
|
||||
RedChannel *channel = msg->channel;
|
||||
RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
|
||||
|
||||
@ -526,7 +526,7 @@ void red_channel_connect(RedChannel *channel, RedClient *client,
|
||||
// the main thread causing RedClient to be destroyed before using it
|
||||
RedMessageConnect payload = {
|
||||
.channel = channel,
|
||||
.client = g_object_ref(client),
|
||||
.client = (RedClient*) g_object_ref(client),
|
||||
.stream = stream,
|
||||
.migration = migration
|
||||
};
|
||||
@ -730,7 +730,7 @@ typedef struct RedMessageMigrate {
|
||||
|
||||
static void handle_dispatcher_migrate(void *opaque, void *payload)
|
||||
{
|
||||
RedMessageMigrate *msg = payload;
|
||||
RedMessageMigrate *msg = (RedMessageMigrate*) payload;
|
||||
RedChannel *channel = red_channel_client_get_channel(msg->rcc);
|
||||
RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
|
||||
|
||||
@ -747,7 +747,7 @@ void red_channel_migrate_client(RedChannel *channel, RedChannelClient *rcc)
|
||||
return;
|
||||
}
|
||||
|
||||
RedMessageMigrate payload = { .rcc = g_object_ref(rcc) };
|
||||
RedMessageMigrate payload = { .rcc = (RedChannelClient *) g_object_ref(rcc) };
|
||||
dispatcher_send_message_custom(channel->priv->dispatcher, handle_dispatcher_migrate,
|
||||
&payload, sizeof(payload), false);
|
||||
}
|
||||
@ -758,7 +758,7 @@ typedef struct RedMessageDisconnect {
|
||||
|
||||
static void handle_dispatcher_disconnect(void *opaque, void *payload)
|
||||
{
|
||||
RedMessageDisconnect *msg = payload;
|
||||
RedMessageDisconnect *msg = (RedMessageDisconnect*) payload;
|
||||
RedChannel *channel = red_channel_client_get_channel(msg->rcc);
|
||||
RedChannelClass *klass = RED_CHANNEL_GET_CLASS(channel);
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ red_client_set_property (GObject *object,
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_SPICE_SERVER:
|
||||
self->reds = g_value_get_pointer(value);
|
||||
self->reds = (RedsState*) g_value_get_pointer(value);
|
||||
break;
|
||||
case PROP_MIGRATED:
|
||||
self->during_target_migrate = g_value_get_boolean(value);
|
||||
@ -146,7 +146,7 @@ red_client_init(RedClient *self)
|
||||
|
||||
RedClient *red_client_new(RedsState *reds, int migrated)
|
||||
{
|
||||
return g_object_new(RED_TYPE_CLIENT,
|
||||
return (RedClient*) g_object_new(RED_TYPE_CLIENT,
|
||||
"spice-server", reds,
|
||||
"migrated", migrated,
|
||||
NULL);
|
||||
|
||||
@ -99,7 +99,7 @@ static uint8_t *red_linearize_chunk(RedDataChunk *head, size_t size, bool *free_
|
||||
return head->data;
|
||||
}
|
||||
|
||||
ptr = data = g_malloc(size);
|
||||
ptr = data = (uint8_t*) g_malloc(size);
|
||||
*free_chunk = true;
|
||||
for (chunk = head; chunk != NULL && size > 0; chunk = chunk->next_chunk) {
|
||||
copy = MIN(chunk->data_size, size);
|
||||
@ -277,7 +277,7 @@ static SpicePath *red_get_path(RedMemSlotInfo *slots, int group_id,
|
||||
start = (QXLPathSeg*)(&start->points[count]);
|
||||
}
|
||||
|
||||
red = g_malloc(mem_size);
|
||||
red = (SpicePath*) g_malloc(mem_size);
|
||||
red->num_segments = n_segments;
|
||||
|
||||
start = (QXLPathSeg*)data;
|
||||
@ -346,7 +346,7 @@ static SpiceClipRects *red_get_clip_rects(RedMemSlotInfo *slots, int group_id,
|
||||
*/
|
||||
spice_assert((uint64_t) num_rects * sizeof(QXLRect) == size);
|
||||
SPICE_VERIFY(sizeof(SpiceRect) == sizeof(QXLRect));
|
||||
red = g_malloc(sizeof(*red) + num_rects * sizeof(SpiceRect));
|
||||
red = (SpiceClipRects*) g_malloc(sizeof(*red) + num_rects * sizeof(SpiceRect));
|
||||
red->num_rects = num_rects;
|
||||
|
||||
start = (QXLRect*)data;
|
||||
@ -373,7 +373,7 @@ static SpiceChunks *red_get_image_data_flat(RedMemSlotInfo *slots, int group_id,
|
||||
|
||||
data = spice_chunks_new(1);
|
||||
data->data_size = size;
|
||||
data->chunk[0].data = bitmap_virt;
|
||||
data->chunk[0].data = (uint8_t*) bitmap_virt;
|
||||
data->chunk[0].len = size;
|
||||
return data;
|
||||
}
|
||||
@ -513,7 +513,7 @@ static SpiceImage *red_get_image(RedMemSlotInfo *slots, int group_id,
|
||||
num_ents * sizeof(qp->ents[0]), group_id)) {
|
||||
goto error;
|
||||
}
|
||||
rp = g_malloc(num_ents * sizeof(rp->ents[0]) + sizeof(*rp));
|
||||
rp = (SpicePalette*) g_malloc(num_ents * sizeof(rp->ents[0]) + sizeof(*rp));
|
||||
rp->unique = qp->unique;
|
||||
rp->num_ents = num_ents;
|
||||
if (flags & QXL_COMMAND_FLAG_COMPAT_16BPP) {
|
||||
@ -838,7 +838,7 @@ static bool red_get_stroke_ptr(RedMemSlotInfo *slots, int group_id,
|
||||
uint8_t *buf;
|
||||
|
||||
style_nseg = qxl->attr.style_nseg;
|
||||
red->attr.style = g_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
|
||||
red->attr.style = (SPICE_FIXED28_4*) g_malloc_n(style_nseg, sizeof(SPICE_FIXED28_4));
|
||||
red->attr.style_nseg = style_nseg;
|
||||
spice_assert(qxl->attr.style);
|
||||
buf = (uint8_t *)memslot_get_virt(slots, qxl->attr.style,
|
||||
@ -928,7 +928,7 @@ static SpiceString *red_get_string(RedMemSlotInfo *slots, int group_id,
|
||||
spice_assert(start <= end);
|
||||
spice_assert(glyphs == qxl_length);
|
||||
|
||||
red = g_malloc(red_size);
|
||||
red = (SpiceString*) g_malloc(red_size);
|
||||
red->length = qxl_length;
|
||||
red->flags = qxl_flags;
|
||||
|
||||
@ -1564,7 +1564,7 @@ static bool red_get_cursor(RedMemSlotInfo *slots, int group_id,
|
||||
if (free_data) {
|
||||
red->data = data;
|
||||
} else {
|
||||
red->data = g_memdup(data, size);
|
||||
red->data = (uint8_t*) g_memdup(data, size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -49,6 +49,6 @@ void red_pipe_item_init_full(RedPipeItem *item,
|
||||
|
||||
void marshaller_unref_pipe_item(uint8_t *data G_GNUC_UNUSED, void *opaque)
|
||||
{
|
||||
RedPipeItem *item = opaque;
|
||||
RedPipeItem *item = (RedPipeItem*) opaque;
|
||||
red_pipe_item_unref(item);
|
||||
}
|
||||
|
||||
@ -583,7 +583,7 @@ uint32_t red_qxl_marshall_device_display_info(const QXLInstance *qxl, SpiceMarsh
|
||||
spice_marshaller_add_uint32(m, i);
|
||||
spice_marshaller_add_uint32(m, qxl_state->device_display_ids[i]);
|
||||
spice_marshaller_add_uint32(m, device_address_len);
|
||||
spice_marshaller_add(m, (void*) device_address, device_address_len);
|
||||
spice_marshaller_add(m, (const uint8_t*) (void*) device_address, device_address_len);
|
||||
++device_count;
|
||||
|
||||
g_debug(" (qxl) channel_id: %u monitor_id: %zu, device_address: %s, "
|
||||
|
||||
@ -232,7 +232,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
|
||||
}
|
||||
|
||||
if (*buf == NULL) {
|
||||
*buf = replay_malloc(replay, *size + base_size);
|
||||
*buf = (uint8_t*) replay_malloc(replay, *size + base_size);
|
||||
}
|
||||
#if 0
|
||||
{
|
||||
@ -248,7 +248,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
|
||||
if (replay->error) {
|
||||
return REPLAY_ERROR;
|
||||
}
|
||||
zlib_buffer = replay_malloc(replay, zlib_size);
|
||||
zlib_buffer = (uint8_t*) replay_malloc(replay, zlib_size);
|
||||
if (replay_fread(replay, zlib_buffer, zlib_size) != zlib_size) {
|
||||
return REPLAY_ERROR;
|
||||
}
|
||||
@ -318,7 +318,7 @@ static ssize_t red_replay_data_chunks(SpiceReplay *replay, const char *prefix,
|
||||
}
|
||||
cur->next_chunk = QXLPHYSICAL_FROM_PTR(data);
|
||||
data_size += next_data_size;
|
||||
next = QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
next = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
next->prev_chunk = QXLPHYSICAL_FROM_PTR(cur);
|
||||
next->data_size = next_data_size;
|
||||
next->next_chunk = 0;
|
||||
@ -333,9 +333,9 @@ static void red_replay_data_chunks_free(SpiceReplay *replay, void *data, size_t
|
||||
QXLDataChunk *cur = (QXLDataChunk *)((uint8_t*)data +
|
||||
(base_size ? base_size - sizeof(QXLDataChunk) : 0));
|
||||
|
||||
cur = QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
cur = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
while (cur) {
|
||||
QXLDataChunk *next = QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
QXLDataChunk *next = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
g_free(cur);
|
||||
cur = next;
|
||||
}
|
||||
@ -380,7 +380,7 @@ static QXLPath *red_replay_path(SpiceReplay *replay)
|
||||
|
||||
static void red_replay_path_free(SpiceReplay *replay, QXLPHYSICAL p)
|
||||
{
|
||||
QXLPath *qxl = QXLPHYSICAL_TO_PTR(p);
|
||||
QXLPath *qxl = (QXLPath*) QXLPHYSICAL_TO_PTR(p);
|
||||
|
||||
red_replay_data_chunks_free(replay, qxl, sizeof(*qxl));
|
||||
}
|
||||
@ -459,7 +459,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
|
||||
if (replay->error) {
|
||||
return NULL;
|
||||
}
|
||||
qp = replay_malloc(replay, sizeof(QXLPalette) + num_ents * sizeof(qp->ents[0]));
|
||||
qp = (QXLPalette*) replay_malloc(replay, sizeof(QXLPalette) + num_ents * sizeof(qp->ents[0]));
|
||||
qp->num_ents = num_ents;
|
||||
qxl->bitmap.palette = QXLPHYSICAL_FROM_PTR(qp);
|
||||
replay_fscanf(replay, "unique %" SCNu64 "\n", &qp->unique);
|
||||
@ -515,7 +515,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
|
||||
|
||||
static void red_replay_image_free(SpiceReplay *replay, QXLPHYSICAL p, uint32_t flags)
|
||||
{
|
||||
QXLImage *qxl = QXLPHYSICAL_TO_PTR(p);
|
||||
QXLImage *qxl = (QXLImage*) QXLPHYSICAL_TO_PTR(p);
|
||||
if (!qxl)
|
||||
return;
|
||||
|
||||
@ -781,7 +781,7 @@ static void red_replay_text_ptr(SpiceReplay *replay, QXLText *qxl, uint32_t flag
|
||||
|
||||
static void red_replay_text_free(SpiceReplay *replay, QXLText *qxl, uint32_t flags)
|
||||
{
|
||||
red_replay_string_free(replay, QXLPHYSICAL_TO_PTR(qxl->str));
|
||||
red_replay_string_free(replay, (QXLString*) QXLPHYSICAL_TO_PTR(qxl->str));
|
||||
red_replay_brush_free(replay, &qxl->fore_brush, flags);
|
||||
red_replay_brush_free(replay, &qxl->back_brush, flags);
|
||||
}
|
||||
@ -833,7 +833,7 @@ static void red_replay_clip_free(SpiceReplay *replay, QXLClip *qxl)
|
||||
{
|
||||
switch (qxl->type) {
|
||||
case SPICE_CLIP_TYPE_RECTS:
|
||||
red_replay_clip_rects_free(replay, QXLPHYSICAL_TO_PTR(qxl->data));
|
||||
red_replay_clip_rects_free(replay, (QXLClipRects*) QXLPHYSICAL_TO_PTR(qxl->data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -880,7 +880,7 @@ static void red_replay_composite_free(SpiceReplay *replay, QXLComposite *qxl, ui
|
||||
|
||||
static QXLDrawable *red_replay_native_drawable(SpiceReplay *replay, uint32_t flags)
|
||||
{
|
||||
QXLDrawable *qxl = replay_malloc0(replay, sizeof(QXLDrawable)); // TODO - this is too large usually
|
||||
QXLDrawable *qxl = (QXLDrawable*) replay_malloc0(replay, sizeof(QXLDrawable)); // TODO - this is too large usually
|
||||
int i;
|
||||
int temp;
|
||||
|
||||
@ -1020,7 +1020,7 @@ static void red_replay_native_drawable_free(SpiceReplay *replay, QXLDrawable *qx
|
||||
static QXLCompatDrawable *red_replay_compat_drawable(SpiceReplay *replay, uint32_t flags)
|
||||
{
|
||||
int temp;
|
||||
QXLCompatDrawable *qxl = replay_malloc0(replay, sizeof(QXLCompatDrawable)); // TODO - too large usually
|
||||
QXLCompatDrawable *qxl = (QXLCompatDrawable*) replay_malloc0(replay, sizeof(QXLCompatDrawable)); // TODO - too large usually
|
||||
|
||||
red_replay_rect_ptr(replay, "bbox", &qxl->bbox);
|
||||
red_replay_clip_ptr(replay, &qxl->clip);
|
||||
@ -1098,7 +1098,7 @@ static QXLPHYSICAL red_replay_drawable(SpiceReplay *replay, uint32_t flags)
|
||||
|
||||
static QXLUpdateCmd *red_replay_update_cmd(SpiceReplay *replay)
|
||||
{
|
||||
QXLUpdateCmd *qxl = replay_malloc0(replay, sizeof(QXLUpdateCmd));
|
||||
QXLUpdateCmd *qxl = (QXLUpdateCmd*) replay_malloc0(replay, sizeof(QXLUpdateCmd));
|
||||
|
||||
replay_fscanf(replay, "update\n");
|
||||
red_replay_rect_ptr(replay, "area", &qxl->area);
|
||||
@ -1126,7 +1126,7 @@ static QXLSurfaceCmd *red_replay_surface_cmd(SpiceReplay *replay)
|
||||
size_t size;
|
||||
size_t read_size;
|
||||
int temp;
|
||||
QXLSurfaceCmd *qxl = replay_malloc0(replay, sizeof(QXLSurfaceCmd));
|
||||
QXLSurfaceCmd *qxl = (QXLSurfaceCmd*) replay_malloc0(replay, sizeof(QXLSurfaceCmd));
|
||||
|
||||
replay_fscanf(replay, "surface_cmd\n");
|
||||
replay_fscanf(replay, "surface_id %d\n", &qxl->surface_id);
|
||||
@ -1209,7 +1209,7 @@ static QXLCursor *red_replay_cursor(SpiceReplay *replay)
|
||||
static QXLCursorCmd *red_replay_cursor_cmd(SpiceReplay *replay)
|
||||
{
|
||||
int temp;
|
||||
QXLCursorCmd *qxl = replay_malloc0(replay, sizeof(QXLCursorCmd));
|
||||
QXLCursorCmd *qxl = (QXLCursorCmd*) replay_malloc0(replay, sizeof(QXLCursorCmd));
|
||||
|
||||
replay_fscanf(replay, "cursor_cmd\n");
|
||||
replay_fscanf(replay, "type %d\n", &temp);
|
||||
@ -1240,7 +1240,7 @@ static QXLCursorCmd *red_replay_cursor_cmd(SpiceReplay *replay)
|
||||
static void red_replay_cursor_cmd_free(SpiceReplay *replay, QXLCursorCmd *qxl)
|
||||
{
|
||||
if (qxl->type == QXL_CURSOR_SET) {
|
||||
QXLCursor *cursor = QXLPHYSICAL_TO_PTR(qxl->u.set.shape);
|
||||
QXLCursor *cursor = (QXLCursor*) QXLPHYSICAL_TO_PTR(qxl->u.set.shape);
|
||||
red_replay_data_chunks_free(replay, cursor, sizeof(*cursor));
|
||||
}
|
||||
|
||||
@ -1329,7 +1329,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
|
||||
replay_handle_dev_input(instance, replay, type);
|
||||
}
|
||||
}
|
||||
cmd = replay_malloc0(replay, sizeof(QXLCommandExt));
|
||||
cmd = (QXLCommandExt*) replay_malloc0(replay, sizeof(QXLCommandExt));
|
||||
cmd->cmd.type = type;
|
||||
cmd->group_id = 0;
|
||||
spice_debug("command %" G_GUINT64_FORMAT ", %d", timestamp, cmd->cmd.type);
|
||||
@ -1362,7 +1362,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
|
||||
case QXL_CMD_UPDATE:
|
||||
case QXL_CMD_SURFACE:
|
||||
case QXL_CMD_CURSOR:
|
||||
info = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
info = (QXLReleaseInfo*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
info->id = (uintptr_t)cmd;
|
||||
}
|
||||
|
||||
@ -1396,22 +1396,22 @@ SPICE_GNUC_VISIBLE void spice_replay_free_cmd(SpiceReplay *replay, QXLCommandExt
|
||||
case QXL_CMD_DRAW: {
|
||||
// FIXME: compat flag must be saved somewhere...
|
||||
spice_return_if_fail(cmd->flags == 0);
|
||||
QXLDrawable *qxl = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
QXLDrawable *qxl = (QXLDrawable*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_native_drawable_free(replay, qxl, cmd->flags);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_UPDATE: {
|
||||
QXLUpdateCmd *qxl = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
QXLUpdateCmd *qxl = (QXLUpdateCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
g_free(qxl);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_SURFACE: {
|
||||
QXLSurfaceCmd *qxl = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
QXLSurfaceCmd *qxl = (QXLSurfaceCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_surface_cmd_free(replay, qxl);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_CURSOR: {
|
||||
QXLCursorCmd *qxl = QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
QXLCursorCmd *qxl = (QXLCursorCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_cursor_cmd_free(replay, qxl);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ struct StreamDevice {
|
||||
|
||||
StreamDevHeader hdr;
|
||||
uint8_t hdr_pos;
|
||||
union {
|
||||
union AllMessages {
|
||||
StreamMsgFormat format;
|
||||
StreamMsgCapabilities capabilities;
|
||||
StreamMsgCursorSet cursor_set;
|
||||
@ -77,7 +77,7 @@ RECORDER(stream_device_data, 32, "Stream device data packet");
|
||||
static void
|
||||
close_timer_func(void *opaque)
|
||||
{
|
||||
StreamDevice *dev = opaque;
|
||||
StreamDevice *dev = (StreamDevice *) opaque;
|
||||
|
||||
if (dev->opened && dev->has_error) {
|
||||
char_device_set_state(RED_CHAR_DEVICE(dev), 0);
|
||||
@ -482,7 +482,7 @@ stream_msg_cursor_set_to_cursor_cmd(const StreamMsgCursorSet *msg, size_t msg_si
|
||||
return NULL;
|
||||
}
|
||||
cursor->data_size = size_required;
|
||||
cursor->data = g_memdup(msg->data, size_required);
|
||||
cursor->data = (uint8_t*) g_memdup(msg->data, size_required);
|
||||
return cmd;
|
||||
}
|
||||
|
||||
@ -794,7 +794,7 @@ int32_t stream_device_get_stream_channel_id(StreamDevice *dev)
|
||||
static StreamDevice *
|
||||
stream_device_new(SpiceCharDeviceInstance *sin, RedsState *reds)
|
||||
{
|
||||
return g_object_new(TYPE_STREAM_DEVICE,
|
||||
return (StreamDevice*) g_object_new(TYPE_STREAM_DEVICE,
|
||||
"sin", sin,
|
||||
"spice-server", reds,
|
||||
"client-tokens-interval", 0ULL,
|
||||
|
||||
@ -226,7 +226,7 @@ ssize_t red_stream_read(RedStream *s, void *buf, size_t nbyte)
|
||||
|
||||
#if HAVE_SASL
|
||||
if (s->priv->sasl.conn && s->priv->sasl.runSSF) {
|
||||
ret = red_stream_sasl_read(s, buf, nbyte);
|
||||
ret = red_stream_sasl_read(s, (uint8_t*) buf, nbyte);
|
||||
} else
|
||||
#endif
|
||||
ret = s->priv->read(s, buf, nbyte);
|
||||
@ -483,7 +483,7 @@ RedStream *red_stream_new(RedsState *reds, int socket)
|
||||
{
|
||||
RedStream *stream;
|
||||
|
||||
stream = g_malloc0(sizeof(RedStream) + sizeof(RedStreamPrivate));
|
||||
stream = (RedStream*) g_malloc0(sizeof(RedStream) + sizeof(RedStreamPrivate));
|
||||
stream->priv = (RedStreamPrivate *)(stream+1);
|
||||
stream->priv->info = g_new0(SpiceChannelEventInfo, 1);
|
||||
stream->priv->reds = reds;
|
||||
@ -585,7 +585,7 @@ static void async_read_handler(G_GNUC_UNUSED int fd,
|
||||
G_GNUC_UNUSED int event,
|
||||
void *data)
|
||||
{
|
||||
RedStream *stream = data;
|
||||
RedStream *stream = (RedStream *) data;
|
||||
AsyncRead *async = &stream->priv->async_read;
|
||||
SpiceCoreInterfaceInternal *core = stream->priv->core;
|
||||
|
||||
@ -839,7 +839,7 @@ static void red_sasl_async_result(RedSASLAuth *auth, RedSaslError err)
|
||||
|
||||
static void red_sasl_error(void *opaque, int err)
|
||||
{
|
||||
RedSASLAuth *auth = opaque;
|
||||
RedSASLAuth *auth = (RedSASLAuth*) opaque;
|
||||
red_stream_set_async_error_handler(auth->stream, auth->saved_error_cb);
|
||||
if (auth->saved_error_cb) {
|
||||
auth->saved_error_cb(auth->result_opaque, err);
|
||||
@ -883,7 +883,7 @@ static void red_sasl_handle_auth_steplen(void *opaque);
|
||||
|
||||
static void red_sasl_handle_auth_step(void *opaque)
|
||||
{
|
||||
RedSASLAuth *auth = opaque;
|
||||
RedSASLAuth *auth = (RedSASLAuth*) opaque;
|
||||
RedStream *stream = auth->stream;
|
||||
const char *serverout;
|
||||
unsigned int serveroutlen;
|
||||
@ -980,17 +980,17 @@ authreject:
|
||||
|
||||
static void red_sasl_handle_auth_steplen(void *opaque)
|
||||
{
|
||||
RedSASLAuth *auth = opaque;
|
||||
RedSASLAuth *auth = (RedSASLAuth*) opaque;
|
||||
|
||||
auth->len = GUINT32_FROM_LE(auth->len);
|
||||
uint32_t len = auth->len;
|
||||
spice_debug("Got steplen %d", len);
|
||||
if (len > SASL_DATA_MAX_LEN) {
|
||||
spice_warning("Too much SASL data %d", len);
|
||||
return red_sasl_async_result(opaque, auth->mechname ? RED_SASL_ERROR_INVALID_DATA : RED_SASL_ERROR_GENERIC);
|
||||
return red_sasl_async_result((RedSASLAuth*) opaque, auth->mechname ? RED_SASL_ERROR_INVALID_DATA : RED_SASL_ERROR_GENERIC);
|
||||
}
|
||||
|
||||
auth->data = g_realloc(auth->data, len);
|
||||
auth->data = (char*) g_realloc(auth->data, len);
|
||||
red_stream_async_read(auth->stream, (uint8_t *)auth->data, len,
|
||||
red_sasl_handle_auth_step, auth);
|
||||
}
|
||||
@ -999,7 +999,7 @@ static void red_sasl_handle_auth_steplen(void *opaque)
|
||||
|
||||
static void red_sasl_handle_auth_mechname(void *opaque)
|
||||
{
|
||||
RedSASLAuth *auth = opaque;
|
||||
RedSASLAuth *auth = (RedSASLAuth*) opaque;
|
||||
|
||||
auth->mechname[auth->len] = '\0';
|
||||
spice_debug("Got client mechname '%s' check against '%s'",
|
||||
@ -1020,7 +1020,7 @@ static void red_sasl_handle_auth_mechname(void *opaque)
|
||||
|
||||
static void red_sasl_handle_auth_mechlen(void *opaque)
|
||||
{
|
||||
RedSASLAuth *auth = opaque;
|
||||
RedSASLAuth *auth = (RedSASLAuth*) opaque;
|
||||
|
||||
auth->len = GUINT32_FROM_LE(auth->len);
|
||||
uint32_t len = auth->len;
|
||||
@ -1029,7 +1029,7 @@ static void red_sasl_handle_auth_mechlen(void *opaque)
|
||||
return red_sasl_async_result(auth, RED_SASL_ERROR_GENERIC);
|
||||
}
|
||||
|
||||
auth->mechname = g_malloc(len + 1);
|
||||
auth->mechname = (char*) g_malloc(len + 1);
|
||||
|
||||
spice_debug("Wait for client mechname");
|
||||
red_stream_async_read(auth->stream, (uint8_t *)auth->mechname, len,
|
||||
@ -1165,7 +1165,7 @@ static ssize_t stream_websocket_read(RedStream *s, void *buf, size_t size)
|
||||
int len;
|
||||
|
||||
do {
|
||||
len = websocket_read(s->priv->ws, buf, size, &flags);
|
||||
len = websocket_read(s->priv->ws, (uint8_t *) buf, size, &flags);
|
||||
} while (len == 0 && flags != 0);
|
||||
return len;
|
||||
}
|
||||
|
||||
@ -332,8 +332,8 @@ static void flush_all_qxl_commands(RedWorker *worker)
|
||||
|
||||
static void handle_dev_update_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageUpdateAsync *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageUpdateAsync *msg = (RedWorkerMessageUpdateAsync*) payload;
|
||||
QXLRect *qxl_dirty_rects = NULL;
|
||||
uint32_t num_dirty_rects = 0;
|
||||
|
||||
@ -353,8 +353,8 @@ static void handle_dev_update_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_update(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageUpdate *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageUpdate *msg = (RedWorkerMessageUpdate*) payload;
|
||||
QXLRect *qxl_dirty_rects = msg->qxl_dirty_rects;
|
||||
|
||||
spice_return_if_fail(red_qxl_is_running(worker->qxl));
|
||||
@ -370,8 +370,8 @@ static void handle_dev_update(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_del_memslot(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDelMemslot *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageDelMemslot *msg = (RedWorkerMessageDelMemslot*) payload;
|
||||
uint32_t slot_id = msg->slot_id;
|
||||
uint32_t slot_group_id = msg->slot_group_id;
|
||||
|
||||
@ -380,8 +380,8 @@ static void handle_dev_del_memslot(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageDestroySurfaceWait *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDestroySurfaceWait *msg = (RedWorkerMessageDestroySurfaceWait*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
spice_return_if_fail(msg->surface_id == 0);
|
||||
|
||||
@ -391,7 +391,7 @@ static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_surfaces(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
display_channel_destroy_surfaces(worker->display_channel);
|
||||
@ -454,8 +454,8 @@ static void dev_create_primary_surface(RedWorker *worker, uint32_t surface_id,
|
||||
|
||||
static void handle_dev_create_primary_surface(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageCreatePrimarySurface *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageCreatePrimarySurface *msg = (RedWorkerMessageCreatePrimarySurface*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
dev_create_primary_surface(worker, msg->surface_id, msg->surface);
|
||||
}
|
||||
@ -484,8 +484,8 @@ static void destroy_primary_surface(RedWorker *worker, uint32_t surface_id)
|
||||
|
||||
static void handle_dev_destroy_primary_surface(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageDestroyPrimarySurface *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDestroyPrimarySurface *msg = (RedWorkerMessageDestroyPrimarySurface*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
uint32_t surface_id = msg->surface_id;
|
||||
|
||||
destroy_primary_surface(worker, surface_id);
|
||||
@ -493,8 +493,8 @@ static void handle_dev_destroy_primary_surface(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_primary_surface_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageDestroyPrimarySurfaceAsync *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDestroyPrimarySurfaceAsync *msg = (RedWorkerMessageDestroyPrimarySurfaceAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
uint32_t surface_id = msg->surface_id;
|
||||
|
||||
destroy_primary_surface(worker, surface_id);
|
||||
@ -504,8 +504,8 @@ static void handle_dev_destroy_primary_surface_async(void *opaque, void *payload
|
||||
|
||||
static void handle_dev_flush_surfaces_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageFlushSurfacesAsync *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageFlushSurfacesAsync *msg = (RedWorkerMessageFlushSurfacesAsync*) payload;
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
display_channel_flush_all_surfaces(worker->display_channel);
|
||||
@ -514,7 +514,7 @@ static void handle_dev_flush_surfaces_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_stop(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
spice_debug("stop");
|
||||
spice_assert(red_qxl_is_running(worker->qxl));
|
||||
@ -536,7 +536,7 @@ static void handle_dev_stop(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_start(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
spice_assert(!red_qxl_is_running(worker->qxl));
|
||||
if (worker->cursor_channel) {
|
||||
@ -555,7 +555,7 @@ static void handle_dev_start(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_wakeup(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
stat_inc_counter(worker->wakeup_counter, 1);
|
||||
red_qxl_clear_pending(worker->qxl->st, RED_DISPATCHER_PENDING_WAKEUP);
|
||||
@ -563,7 +563,7 @@ static void handle_dev_wakeup(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_oom(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
DisplayChannel *display = worker->display_channel;
|
||||
|
||||
RedChannel *display_red_channel = RED_CHANNEL(display);
|
||||
@ -585,22 +585,22 @@ static void handle_dev_oom(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_reset_cursor(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
cursor_channel_reset(worker->cursor_channel);
|
||||
}
|
||||
|
||||
static void handle_dev_reset_image_cache(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
display_channel_reset_image_cache(worker->display_channel);
|
||||
}
|
||||
|
||||
static void handle_dev_destroy_surface_wait_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageDestroySurfaceWaitAsync *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDestroySurfaceWaitAsync *msg = (RedWorkerMessageDestroySurfaceWaitAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
display_channel_destroy_surface_wait(worker->display_channel, msg->surface_id);
|
||||
red_qxl_async_complete(worker->qxl, msg->base.cookie);
|
||||
@ -608,8 +608,8 @@ static void handle_dev_destroy_surface_wait_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageDestroySurfacesAsync *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageDestroySurfacesAsync *msg = (RedWorkerMessageDestroySurfacesAsync*) payload;
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
display_channel_destroy_surfaces(worker->display_channel);
|
||||
@ -619,8 +619,8 @@ static void handle_dev_destroy_surfaces_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_create_primary_surface_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageCreatePrimarySurfaceAsync *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageCreatePrimarySurfaceAsync *msg = (RedWorkerMessageCreatePrimarySurfaceAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
dev_create_primary_surface(worker, msg->surface_id, msg->surface);
|
||||
red_qxl_create_primary_surface_complete(worker->qxl->st, &msg->surface);
|
||||
@ -634,8 +634,8 @@ static inline uint32_t qxl_monitors_config_size(uint32_t heads)
|
||||
|
||||
static void handle_dev_monitors_config_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageMonitorsConfigAsync *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageMonitorsConfigAsync *msg = (RedWorkerMessageMonitorsConfigAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
uint16_t count, max_allowed;
|
||||
const QXLMonitorsConfig *dev_monitors_config =
|
||||
(QXLMonitorsConfig*)memslot_get_virt(&worker->mem_slots, msg->monitors_config,
|
||||
@ -678,8 +678,8 @@ async_complete:
|
||||
|
||||
static void handle_dev_set_compression(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageSetCompression *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageSetCompression *msg = (RedWorkerMessageSetCompression*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
SpiceImageCompression image_compression = msg->image_compression;
|
||||
|
||||
display_channel_set_image_compression(worker->display_channel, image_compression);
|
||||
@ -690,16 +690,16 @@ static void handle_dev_set_compression(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_set_streaming_video(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageSetStreamingVideo *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageSetStreamingVideo *msg = (RedWorkerMessageSetStreamingVideo*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
display_channel_set_stream_video(worker->display_channel, msg->streaming_video);
|
||||
}
|
||||
|
||||
static void handle_dev_set_video_codecs(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageSetVideoCodecs *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageSetVideoCodecs *msg = (RedWorkerMessageSetVideoCodecs*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
display_channel_set_video_codecs(worker->display_channel, msg->video_codecs);
|
||||
g_array_unref(msg->video_codecs);
|
||||
@ -707,8 +707,8 @@ static void handle_dev_set_video_codecs(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_set_mouse_mode(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageSetMouseMode *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageSetMouseMode *msg = (RedWorkerMessageSetMouseMode*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
spice_debug("mouse mode %u", msg->mode);
|
||||
cursor_channel_set_mouse_mode(worker->cursor_channel, msg->mode);
|
||||
@ -723,8 +723,8 @@ static void dev_add_memslot(RedWorker *worker, QXLDevMemSlot mem_slot)
|
||||
|
||||
static void handle_dev_add_memslot(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageAddMemslot *msg = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageAddMemslot *msg = (RedWorkerMessageAddMemslot*) payload;
|
||||
QXLDevMemSlot mem_slot = msg->mem_slot;
|
||||
|
||||
memslot_info_add_slot(&worker->mem_slots, mem_slot.slot_group_id, mem_slot.slot_id,
|
||||
@ -734,8 +734,8 @@ static void handle_dev_add_memslot(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_add_memslot_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageAddMemslotAsync *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageAddMemslotAsync *msg = (RedWorkerMessageAddMemslotAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
dev_add_memslot(worker, msg->mem_slot);
|
||||
red_qxl_async_complete(worker->qxl, msg->base.cookie);
|
||||
@ -743,14 +743,14 @@ static void handle_dev_add_memslot_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_reset_memslots(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
memslot_info_reset(&worker->mem_slots);
|
||||
}
|
||||
|
||||
static void handle_dev_driver_unload(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
worker->driver_cap_monitors_config = false;
|
||||
}
|
||||
@ -758,7 +758,7 @@ static void handle_dev_driver_unload(void *opaque, void *payload)
|
||||
static
|
||||
void handle_dev_gl_scanout(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
display_channel_gl_scanout(worker->display_channel);
|
||||
}
|
||||
@ -766,15 +766,15 @@ void handle_dev_gl_scanout(void *opaque, void *payload)
|
||||
static
|
||||
void handle_dev_gl_draw_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageGlDraw *draw = payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageGlDraw *draw = (RedWorkerMessageGlDraw*) payload;
|
||||
|
||||
display_channel_gl_draw(worker->display_channel, &draw->draw);
|
||||
}
|
||||
|
||||
static void handle_dev_close(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
g_main_loop_quit(worker->loop);
|
||||
}
|
||||
|
||||
@ -796,8 +796,8 @@ static bool loadvm_command(RedWorker *worker, QXLCommandExt *ext)
|
||||
|
||||
static void handle_dev_loadvm_commands(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageLoadvmCommands *msg = payload;
|
||||
RedWorker *worker = opaque;
|
||||
RedWorkerMessageLoadvmCommands *msg = (RedWorkerMessageLoadvmCommands*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
uint32_t i;
|
||||
uint32_t count = msg->count;
|
||||
QXLCommandExt *ext = msg->ext;
|
||||
@ -813,7 +813,7 @@ static void handle_dev_loadvm_commands(void *opaque, void *payload)
|
||||
|
||||
static void worker_dispatcher_record(void *opaque, uint32_t message_type, void *payload)
|
||||
{
|
||||
RedWorker *worker = opaque;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
|
||||
red_record_event(worker->record, 1, message_type);
|
||||
}
|
||||
@ -1117,7 +1117,7 @@ RedWorker* red_worker_new(QXLInstance *qxl)
|
||||
|
||||
static void *red_worker_main(void *arg)
|
||||
{
|
||||
RedWorker *worker = arg;
|
||||
RedWorker *worker = (RedWorker *) arg;
|
||||
|
||||
spice_debug("begin");
|
||||
SPICE_VERIFY(MAX_PIPE_SIZE > WIDE_CLIENT_ACK_WINDOW &&
|
||||
|
||||
@ -893,7 +893,7 @@ void reds_marshall_device_display_info(RedsState *reds, SpiceMarshaller *m)
|
||||
spice_marshaller_add_uint32(m, info->stream_id);
|
||||
spice_marshaller_add_uint32(m, info->device_display_id);
|
||||
spice_marshaller_add_uint32(m, device_address_len);
|
||||
spice_marshaller_add(m, (void*) info->device_address, device_address_len);
|
||||
spice_marshaller_add(m, (const uint8_t*) (void*) info->device_address, device_address_len);
|
||||
++device_count;
|
||||
|
||||
g_debug(" (stream) channel_id: %u monitor_id: %u, device_address: %s, "
|
||||
@ -1152,7 +1152,7 @@ uint8_t *reds_get_agent_data_buffer(RedsState *reds, MainChannelClient *mcc, siz
|
||||
* In such case, we will receive and discard the msgs (reds_reset_vdp takes care
|
||||
* of setting dev->write_filter.result = AGENT_MSG_FILTER_DISCARD).
|
||||
*/
|
||||
return g_malloc(size);
|
||||
return (uint8_t*) g_malloc(size);
|
||||
}
|
||||
|
||||
spice_assert(dev->priv->recv_from_client_buf == NULL);
|
||||
@ -1248,7 +1248,7 @@ void reds_on_main_agent_data(RedsState *reds, MainChannelClient *mcc, const void
|
||||
AgentMsgFilterResult res;
|
||||
|
||||
res = agent_msg_filter_process_data(&dev->priv->write_filter,
|
||||
message, size);
|
||||
(const uint8_t*) message, size);
|
||||
switch (res) {
|
||||
case AGENT_MSG_FILTER_OK:
|
||||
break;
|
||||
@ -1480,7 +1480,7 @@ static int reds_agent_state_restore(RedsState *reds, SpiceMigrateDataMain *mig_d
|
||||
agent_dev->priv->current_read_buf = NULL;
|
||||
agent_dev->priv->receive_pos = NULL;
|
||||
agent_dev->priv->read_filter.msg_data_to_read = mig_data->agent2client.msg_remaining;
|
||||
agent_dev->priv->read_filter.result = mig_data->agent2client.msg_filter_result;
|
||||
agent_dev->priv->read_filter.result = (AgentMsgFilterResult) mig_data->agent2client.msg_filter_result;
|
||||
}
|
||||
|
||||
agent_dev->priv->read_filter.discard_all = FALSE;
|
||||
@ -1488,7 +1488,7 @@ static int reds_agent_state_restore(RedsState *reds, SpiceMigrateDataMain *mig_d
|
||||
agent_dev->priv->client_agent_started = mig_data->client_agent_started;
|
||||
|
||||
agent_dev->priv->write_filter.msg_data_to_read = mig_data->client2agent.msg_remaining;
|
||||
agent_dev->priv->write_filter.result = mig_data->client2agent.msg_filter_result;
|
||||
agent_dev->priv->write_filter.result = (AgentMsgFilterResult) mig_data->client2agent.msg_filter_result;
|
||||
|
||||
spice_debug("to agent filter: discard all %d, wait_msg %u, msg_filter_result %d",
|
||||
agent_dev->priv->write_filter.discard_all,
|
||||
@ -1541,7 +1541,7 @@ bool reds_handle_migrate_data(RedsState *reds, MainChannelClient *mcc,
|
||||
/* restore agent state when the agent gets attached */
|
||||
spice_debug("saving mig_data");
|
||||
spice_assert(agent_dev->priv->plug_generation == 0);
|
||||
agent_dev->priv->mig_data = g_memdup(mig_data, size);
|
||||
agent_dev->priv->mig_data = (SpiceMigrateDataMain*) g_memdup(mig_data, size);
|
||||
}
|
||||
} else {
|
||||
spice_debug("agent was not attached on the source host");
|
||||
@ -1739,7 +1739,7 @@ static RedsMigTargetClient* reds_mig_target_client_find(RedsState *reds, RedClie
|
||||
GList *l;
|
||||
|
||||
for (l = reds->mig_target_clients; l != NULL; l = l->next) {
|
||||
RedsMigTargetClient *mig_client = l->data;
|
||||
RedsMigTargetClient *mig_client = (RedsMigTargetClient*) l->data;
|
||||
|
||||
if (mig_client->client == client) {
|
||||
return mig_client;
|
||||
@ -1800,7 +1800,7 @@ static RedClient *reds_get_client(RedsState *reds)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return reds->clients->data;
|
||||
return (RedClient*) reds->clients->data;
|
||||
}
|
||||
|
||||
/* Performs late initializations steps.
|
||||
@ -1832,13 +1832,13 @@ red_channel_capabilities_init_from_link_message(RedChannelCapabilities *caps,
|
||||
caps->num_common_caps = link_mess->num_common_caps;
|
||||
caps->common_caps = NULL;
|
||||
if (caps->num_common_caps) {
|
||||
caps->common_caps = g_memdup(raw_caps,
|
||||
caps->common_caps = (uint32_t*) g_memdup(raw_caps,
|
||||
link_mess->num_common_caps * sizeof(uint32_t));
|
||||
}
|
||||
caps->num_caps = link_mess->num_channel_caps;
|
||||
caps->caps = NULL;
|
||||
if (link_mess->num_channel_caps) {
|
||||
caps->caps = g_memdup(raw_caps + link_mess->num_common_caps * sizeof(uint32_t),
|
||||
caps->caps = (uint32_t*) g_memdup(raw_caps + link_mess->num_common_caps * sizeof(uint32_t),
|
||||
link_mess->num_channel_caps * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
@ -1986,7 +1986,7 @@ static bool reds_link_mig_target_channels(RedsState *reds, RedClient *client)
|
||||
/* Each channel should check if we are during migration, and
|
||||
* act accordingly. */
|
||||
for(item = mig_client->pending_links; item != NULL; item = item->next) {
|
||||
RedsMigPendingLink *mig_link = item->data;
|
||||
RedsMigPendingLink *mig_link = (RedsMigPendingLink*) item->data;
|
||||
RedChannel *channel;
|
||||
|
||||
channel = reds_find_channel(reds, mig_link->link_msg->channel_type,
|
||||
@ -2365,7 +2365,7 @@ static void reds_handle_read_header_done(void *opaque)
|
||||
return;
|
||||
}
|
||||
|
||||
link->link_mess = g_malloc(header->size);
|
||||
link->link_mess = (SpiceLinkMess*) g_malloc(header->size);
|
||||
|
||||
red_stream_async_read(link->stream,
|
||||
(uint8_t *)link->link_mess,
|
||||
@ -2508,7 +2508,7 @@ error:
|
||||
|
||||
static void reds_accept_ssl_connection(int fd, int event, void *data)
|
||||
{
|
||||
RedsState *reds = data;
|
||||
RedsState *reds = (RedsState*) data;
|
||||
RedLinkInfo *link;
|
||||
int socket;
|
||||
|
||||
@ -2526,7 +2526,7 @@ static void reds_accept_ssl_connection(int fd, int event, void *data)
|
||||
|
||||
static void reds_accept(int fd, int event, void *data)
|
||||
{
|
||||
RedsState *reds = data;
|
||||
RedsState *reds = (RedsState*) data;
|
||||
int socket;
|
||||
|
||||
if ((socket = accept(fd, NULL, 0)) == -1) {
|
||||
@ -2779,7 +2779,7 @@ static int load_dh_params(SSL_CTX *ctx, char *file)
|
||||
/*The password code is not thread safe*/
|
||||
static int ssl_password_cb(char *buf, int size, int flags, void *userdata)
|
||||
{
|
||||
RedsState *reds = userdata;
|
||||
RedsState *reds = (RedsState*) userdata;
|
||||
char *pass = reds->config->ssl_parameters.keyfile_password;
|
||||
if (size < strlen(pass) + 1) {
|
||||
return (0);
|
||||
@ -2818,7 +2818,7 @@ static void openssl_thread_setup(void)
|
||||
return;
|
||||
}
|
||||
|
||||
lock_cs = OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
|
||||
lock_cs = (pthread_mutex_t*) OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t));
|
||||
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
pthread_mutex_init(&(lock_cs[i]), NULL);
|
||||
@ -2938,7 +2938,7 @@ SPICE_DESTRUCTOR_FUNC(reds_exit)
|
||||
|
||||
pthread_mutex_lock(&global_reds_lock);
|
||||
for (l = servers; l != NULL; l = l->next) {
|
||||
RedsState *reds = l->data;
|
||||
RedsState *reds = (RedsState*) l->data;
|
||||
reds_cleanup(reds);
|
||||
}
|
||||
pthread_mutex_unlock(&global_reds_lock);
|
||||
@ -3088,7 +3088,7 @@ static void reds_mig_finished(RedsState *reds, int completed)
|
||||
|
||||
static void migrate_timeout(void *opaque)
|
||||
{
|
||||
RedsState *reds = opaque;
|
||||
RedsState *reds = (RedsState *) opaque;
|
||||
spice_debug("trace");
|
||||
spice_assert(reds->mig_wait_connect || reds->mig_wait_disconnect);
|
||||
if (reds->mig_wait_connect) {
|
||||
@ -3773,7 +3773,7 @@ static int reds_set_video_codecs_from_string(RedsState *reds, const char *codecs
|
||||
} else {
|
||||
RedVideoCodec new_codec;
|
||||
new_codec.create = video_encoder_procs[encoder_index];
|
||||
new_codec.type = video_codec_names[codec_index].id;
|
||||
new_codec.type = (SpiceVideoCodecType) video_codec_names[codec_index].id;
|
||||
new_codec.cap = video_codec_caps[codec_index];
|
||||
g_array_append_val(video_codecs, new_codec);
|
||||
}
|
||||
@ -4370,7 +4370,7 @@ SPICE_GNUC_VISIBLE void spice_server_vm_start(SpiceServer *reds)
|
||||
|
||||
reds->vm_running = TRUE;
|
||||
for (it = reds->char_devices; it != NULL; it = it->next) {
|
||||
red_char_device_start(it->data);
|
||||
red_char_device_start((RedCharDevice*) it->data);
|
||||
}
|
||||
reds_on_vm_start(reds);
|
||||
}
|
||||
@ -4381,7 +4381,7 @@ SPICE_GNUC_VISIBLE void spice_server_vm_stop(SpiceServer *reds)
|
||||
|
||||
reds->vm_running = FALSE;
|
||||
for (it = reds->char_devices; it != NULL; it = it->next) {
|
||||
red_char_device_stop(it->data);
|
||||
red_char_device_stop((RedCharDevice*) it->data);
|
||||
}
|
||||
reds_on_vm_stop(reds);
|
||||
}
|
||||
@ -4559,7 +4559,7 @@ uint32_t reds_qxl_ram_size(RedsState *reds)
|
||||
return 0;
|
||||
}
|
||||
|
||||
first = reds->qxl_instances->data;
|
||||
first = (QXLInstance*) reds->qxl_instances->data;
|
||||
return red_qxl_get_ram_size(first);
|
||||
}
|
||||
|
||||
@ -4590,7 +4590,7 @@ static void red_char_device_vdi_port_constructed(GObject *object)
|
||||
static void
|
||||
red_char_device_vdi_port_init(RedCharDeviceVDIPort *self)
|
||||
{
|
||||
self->priv = red_char_device_vdi_port_get_instance_private(self);
|
||||
self->priv = (RedCharDeviceVDIPortPrivate*) red_char_device_vdi_port_get_instance_private(self);
|
||||
|
||||
self->priv->read_state = VDI_PORT_READ_STATE_READ_HEADER;
|
||||
self->priv->receive_pos = (uint8_t *)&self->priv->vdi_chunk_header;
|
||||
@ -4632,7 +4632,7 @@ red_char_device_vdi_port_class_init(RedCharDeviceVDIPortClass *klass)
|
||||
|
||||
static RedCharDeviceVDIPort *red_char_device_vdi_port_new(RedsState *reds)
|
||||
{
|
||||
return g_object_new(RED_TYPE_CHAR_DEVICE_VDIPORT,
|
||||
return (RedCharDeviceVDIPort*) g_object_new(RED_TYPE_CHAR_DEVICE_VDIPORT,
|
||||
"spice-server", reds,
|
||||
"client-tokens-interval", (guint64)REDS_TOKENS_TO_SEND,
|
||||
"self-tokens", (guint64)REDS_NUM_INTERNAL_AGENT_MESSAGES,
|
||||
|
||||
@ -72,7 +72,8 @@ static void smart_card_channel_client_class_init(SmartCardChannelClientClass *kl
|
||||
static void
|
||||
smart_card_channel_client_init(SmartCardChannelClient *self)
|
||||
{
|
||||
self->priv = smart_card_channel_client_get_instance_private(self);
|
||||
self->priv = (SmartCardChannelClientPrivate*)
|
||||
smart_card_channel_client_get_instance_private(self);
|
||||
}
|
||||
|
||||
SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
|
||||
@ -81,7 +82,8 @@ SmartCardChannelClient* smartcard_channel_client_create(RedChannel *channel,
|
||||
{
|
||||
SmartCardChannelClient *rcc;
|
||||
|
||||
rcc = g_initable_new(TYPE_SMARTCARD_CHANNEL_CLIENT,
|
||||
rcc = (SmartCardChannelClient *)
|
||||
g_initable_new(TYPE_SMARTCARD_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
@ -103,7 +105,7 @@ smartcard_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc,
|
||||
* different channels */
|
||||
if (!scc->priv->smartcard) {
|
||||
scc->priv->msg_in_write_buf = FALSE;
|
||||
return g_malloc(size);
|
||||
return (uint8_t*) g_malloc(size);
|
||||
} else {
|
||||
RedCharDeviceSmartcard *smartcard;
|
||||
|
||||
@ -248,7 +250,7 @@ bool smartcard_channel_client_handle_message(RedChannelClient *rcc,
|
||||
uint32_t size,
|
||||
void *message)
|
||||
{
|
||||
VSCMsgHeader* vheader = message;
|
||||
VSCMsgHeader* vheader = (VSCMsgHeader*) message;
|
||||
SmartCardChannelClient *scc = SMARTCARD_CHANNEL_CLIENT(rcc);
|
||||
|
||||
if (type != SPICE_MSGC_SMARTCARD_DATA) {
|
||||
|
||||
@ -68,7 +68,7 @@ red_smartcard_channel_init(RedSmartcardChannel *self)
|
||||
static RedSmartcardChannel *
|
||||
red_smartcard_channel_new(RedsState *reds)
|
||||
{
|
||||
return g_object_new(RED_TYPE_SMARTCARD_CHANNEL,
|
||||
return (RedSmartcardChannel*) g_object_new(RED_TYPE_SMARTCARD_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", SPICE_CHANNEL_SMARTCARD,
|
||||
@ -119,7 +119,7 @@ static void smartcard_read_buf_prepare(RedCharDeviceSmartcard *dev, VSCMsgHeader
|
||||
msg_len = ntohl(vheader->length);
|
||||
if (msg_len > dev->priv->buf_size) {
|
||||
dev->priv->buf_size = MAX(dev->priv->buf_size * 2, msg_len + sizeof(VSCMsgHeader));
|
||||
dev->priv->buf = g_realloc(dev->priv->buf, dev->priv->buf_size);
|
||||
dev->priv->buf = (uint8_t*) g_realloc(dev->priv->buf, dev->priv->buf_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,12 +257,13 @@ static RedCharDeviceSmartcard *smartcard_device_new(RedsState *reds, SpiceCharDe
|
||||
{
|
||||
RedCharDeviceSmartcard *dev;
|
||||
|
||||
dev = g_object_new(RED_TYPE_CHAR_DEVICE_SMARTCARD,
|
||||
"sin", sin,
|
||||
"spice-server", reds,
|
||||
"client-tokens-interval", 0ULL,
|
||||
"self-tokens", ~0ULL,
|
||||
NULL);
|
||||
dev = (RedCharDeviceSmartcard*)
|
||||
g_object_new(RED_TYPE_CHAR_DEVICE_SMARTCARD,
|
||||
"sin", sin,
|
||||
"spice-server", reds,
|
||||
"client-tokens-interval", 0ULL,
|
||||
"self-tokens", ~0ULL,
|
||||
NULL);
|
||||
|
||||
return dev;
|
||||
}
|
||||
@ -458,7 +459,7 @@ static RedMsgItem *smartcard_new_vsc_msg_item(unsigned int reader_id, const VSCM
|
||||
|
||||
red_pipe_item_init_full(&msg_item->base, RED_PIPE_ITEM_TYPE_SMARTCARD_DATA,
|
||||
smartcard_free_vsc_msg_item);
|
||||
msg_item->vheader = g_memdup(vheader, sizeof(*vheader) + vheader->length);
|
||||
msg_item->vheader = (VSCMsgHeader*) g_memdup(vheader, sizeof(*vheader) + vheader->length);
|
||||
/* We patch the reader_id, since the device only knows about itself, and
|
||||
* we know about the sum of readers. */
|
||||
msg_item->vheader->reader_id = reader_id;
|
||||
@ -603,11 +604,11 @@ red_char_device_smartcard_class_init(RedCharDeviceSmartcardClass *klass)
|
||||
static void
|
||||
red_char_device_smartcard_init(RedCharDeviceSmartcard *self)
|
||||
{
|
||||
self->priv = red_char_device_smartcard_get_instance_private(self);
|
||||
self->priv = (RedCharDeviceSmartcardPrivate*) red_char_device_smartcard_get_instance_private(self);
|
||||
|
||||
self->priv->reader_id = VSCARD_UNDEFINED_READER_ID;
|
||||
self->priv->buf_size = APDUBufSize + sizeof(VSCMsgHeader);
|
||||
self->priv->buf = g_malloc(self->priv->buf_size);
|
||||
self->priv->buf = (uint8_t*) g_malloc(self->priv->buf_size);
|
||||
self->priv->buf_pos = self->priv->buf;
|
||||
}
|
||||
|
||||
|
||||
@ -256,7 +256,7 @@ static SndChannelClient *snd_channel_get_client(SndChannel *channel)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return clients->data;
|
||||
return (SndChannelClient*) clients->data;
|
||||
}
|
||||
|
||||
static RedsState* snd_channel_get_server(SndChannelClient *client)
|
||||
@ -361,7 +361,7 @@ record_channel_handle_message(RedChannelClient *rcc, uint16_t type, uint32_t siz
|
||||
SndChannel *channel = SND_CHANNEL(red_channel_client_get_channel(rcc));
|
||||
record_client->mode_time = mode->time;
|
||||
if (mode->mode != SPICE_AUDIO_DATA_MODE_RAW) {
|
||||
if (snd_codec_is_capable(mode->mode, channel->frequency)) {
|
||||
if (snd_codec_is_capable((SpiceAudioDataMode) mode->mode, channel->frequency)) {
|
||||
if (snd_codec_create(&record_client->codec, mode->mode, channel->frequency,
|
||||
SND_CODEC_DECODE) == SND_CODEC_OK) {
|
||||
record_client->mode = mode->mode;
|
||||
@ -429,7 +429,7 @@ static bool snd_send_volume(SndChannelClient *client, uint32_t cap, int msg)
|
||||
return false;
|
||||
}
|
||||
|
||||
vol = alloca(sizeof (SpiceMsgAudioVolume) +
|
||||
vol = (SpiceMsgAudioVolume*) alloca(sizeof (SpiceMsgAudioVolume) +
|
||||
st->volume_nchannels * sizeof (uint16_t));
|
||||
red_channel_client_init_send_data(rcc, msg);
|
||||
vol->nchannels = st->volume_nchannels;
|
||||
@ -812,7 +812,7 @@ snd_channel_client_alloc_recv_buf(RedChannelClient *rcc, uint16_t type, uint32_t
|
||||
SndChannelClient *client = SND_CHANNEL_CLIENT(rcc);
|
||||
// If message is too big allocate one, this should never happen
|
||||
if (size > sizeof(client->receive_buf)) {
|
||||
return g_malloc(size);
|
||||
return (uint8_t*) g_malloc(size);
|
||||
}
|
||||
return client->receive_buf;
|
||||
}
|
||||
@ -843,7 +843,7 @@ static void snd_channel_set_volume(SndChannel *channel,
|
||||
|
||||
st->volume_nchannels = nchannels;
|
||||
g_free(st->volume);
|
||||
st->volume = g_memdup(volume, sizeof(uint16_t) * nchannels);
|
||||
st->volume = (uint16_t*) g_memdup(volume, sizeof(uint16_t) * nchannels);
|
||||
|
||||
if (!client || nchannels == 0)
|
||||
return;
|
||||
@ -994,7 +994,7 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
|
||||
GList *l;
|
||||
|
||||
for (l = snd_channels; l != NULL; l = l->next) {
|
||||
SndChannel *now = l->data;
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
SndChannelClient *scc = snd_channel_get_client(now);
|
||||
uint32_t type;
|
||||
g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
|
||||
@ -1114,7 +1114,8 @@ static gboolean playback_channel_client_initable_init(GInitable *initable,
|
||||
|
||||
static void playback_channel_client_initable_interface_init(GInitableIface *iface)
|
||||
{
|
||||
playback_channel_client_parent_initable_iface = g_type_interface_peek_parent(iface);
|
||||
playback_channel_client_parent_initable_iface =
|
||||
(GInitableIface *) g_type_interface_peek_parent(iface);
|
||||
|
||||
iface->init = playback_channel_client_initable_init;
|
||||
}
|
||||
@ -1130,7 +1131,8 @@ static void snd_set_peer(RedChannel *red_channel, RedClient *client, RedStream *
|
||||
red_channel_client_disconnect(RED_CHANNEL_CLIENT(snd_client));
|
||||
}
|
||||
|
||||
snd_client = g_initable_new(type,
|
||||
snd_client = (SndChannelClient *)
|
||||
g_initable_new(type,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
@ -1299,7 +1301,8 @@ static gboolean record_channel_client_initable_init(GInitable *initable,
|
||||
|
||||
static void record_channel_client_initable_interface_init(GInitableIface *iface)
|
||||
{
|
||||
record_channel_client_parent_initable_iface = g_type_interface_peek_parent(iface);
|
||||
record_channel_client_parent_initable_iface =
|
||||
(GInitableIface *) g_type_interface_peek_parent(iface);
|
||||
|
||||
iface->init = record_channel_client_initable_init;
|
||||
}
|
||||
@ -1387,7 +1390,7 @@ playback_channel_class_init(PlaybackChannelClass *klass)
|
||||
|
||||
void snd_attach_playback(RedsState *reds, SpicePlaybackInstance *sin)
|
||||
{
|
||||
sin->st = g_object_new(TYPE_PLAYBACK_CHANNEL,
|
||||
sin->st = (SpicePlaybackState*) g_object_new(TYPE_PLAYBACK_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", SPICE_CHANNEL_PLAYBACK,
|
||||
@ -1433,7 +1436,7 @@ record_channel_class_init(RecordChannelClass *klass)
|
||||
|
||||
void snd_attach_record(RedsState *reds, SpiceRecordInstance *sin)
|
||||
{
|
||||
sin->st = g_object_new(TYPE_RECORD_CHANNEL,
|
||||
sin->st = (SpiceRecordState*) g_object_new(TYPE_RECORD_CHANNEL,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", SPICE_CHANNEL_RECORD,
|
||||
@ -1465,7 +1468,7 @@ void snd_set_playback_compression(bool on)
|
||||
GList *l;
|
||||
|
||||
for (l = snd_channels; l != NULL; l = l->next) {
|
||||
SndChannel *now = l->data;
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
SndChannelClient *client = snd_channel_get_client(now);
|
||||
uint32_t type;
|
||||
g_object_get(RED_CHANNEL(now), "channel-type", &type, NULL);
|
||||
|
||||
@ -248,7 +248,7 @@ static RedVmcChannel *red_vmc_channel_new(RedsState *reds, uint8_t channel_type)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_object_new(gtype,
|
||||
return (RedVmcChannel*) g_object_new(gtype,
|
||||
"spice-server", reds,
|
||||
"core-interface", reds_get_core_interface(reds),
|
||||
"channel-type", channel_type,
|
||||
@ -583,7 +583,7 @@ static uint8_t *spicevmc_red_channel_alloc_msg_rcv_buf(RedChannelClient *rcc,
|
||||
}
|
||||
|
||||
default:
|
||||
return g_malloc(size);
|
||||
return (uint8_t*) g_malloc(size);
|
||||
}
|
||||
|
||||
}
|
||||
@ -880,7 +880,7 @@ red_char_device_spicevmc_set_property(GObject *object,
|
||||
{
|
||||
case PROP_CHANNEL:
|
||||
spice_assert(self->channel == NULL);
|
||||
self->channel = g_value_dup_object(value);
|
||||
self->channel = (RedVmcChannel*) g_value_dup_object(value);
|
||||
spice_assert(self->channel != NULL);
|
||||
self->channel->chardev = RED_CHAR_DEVICE(self);
|
||||
|
||||
@ -925,7 +925,7 @@ red_char_device_spicevmc_new(SpiceCharDeviceInstance *sin,
|
||||
RedsState *reds,
|
||||
RedVmcChannel *channel)
|
||||
{
|
||||
return g_object_new(RED_TYPE_CHAR_DEVICE_SPICEVMC,
|
||||
return (RedCharDevice*) g_object_new(RED_TYPE_CHAR_DEVICE_SPICEVMC,
|
||||
"sin", sin,
|
||||
"spice-server", reds,
|
||||
"client-tokens-interval", 0ULL,
|
||||
@ -956,7 +956,8 @@ vmc_channel_client_create(RedChannel *channel, RedClient *client,
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
|
||||
rcc = g_initable_new(TYPE_VMC_CHANNEL_CLIENT,
|
||||
rcc = (RedChannelClient *)
|
||||
g_initable_new(TYPE_VMC_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
|
||||
@ -184,7 +184,8 @@ stream_channel_client_new(StreamChannel *channel, RedClient *client, RedStream *
|
||||
{
|
||||
StreamChannelClient *rcc;
|
||||
|
||||
rcc = g_initable_new(TYPE_STREAM_CHANNEL_CLIENT,
|
||||
rcc = (StreamChannelClient *)
|
||||
g_initable_new(TYPE_STREAM_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
@ -353,7 +354,7 @@ handle_message(RedChannelClient *rcc, uint16_t type, uint32_t size, void *msg)
|
||||
StreamChannel*
|
||||
stream_channel_new(RedsState *server, uint32_t id)
|
||||
{
|
||||
return g_object_new(TYPE_STREAM_CHANNEL,
|
||||
return (StreamChannel*) g_object_new(TYPE_STREAM_CHANNEL,
|
||||
"spice-server", server,
|
||||
"core-interface", reds_get_core_interface(server),
|
||||
"channel-type", SPICE_CHANNEL_DISPLAY,
|
||||
@ -588,7 +589,7 @@ stream_channel_send_data(StreamChannel *channel, const void *data, size_t size,
|
||||
|
||||
RedChannel *red_channel = RED_CHANNEL(channel);
|
||||
|
||||
StreamDataItem *item = g_malloc(sizeof(*item) + size);
|
||||
StreamDataItem *item = (StreamDataItem*) g_malloc(sizeof(*item) + size);
|
||||
red_pipe_item_init_full(&item->base, RED_PIPE_ITEM_TYPE_STREAM_DATA,
|
||||
data_item_free);
|
||||
item->data.base.id = channel->stream_id;
|
||||
|
||||
@ -171,7 +171,7 @@ static int get_command_from(QXLInstance *qin, QXLCommandExt *ext, GAsyncQueue *q
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
cmd = g_async_queue_try_pop(queue);
|
||||
cmd = (QXLCommandExt*) g_async_queue_try_pop(queue);
|
||||
if (GPOINTER_TO_INT(cmd) == -1) {
|
||||
g_main_loop_quit(loop);
|
||||
return FALSE;
|
||||
@ -290,7 +290,7 @@ static gboolean start_client(gchar *cmd, GError **error)
|
||||
|
||||
static gboolean progress_timer(gpointer user_data)
|
||||
{
|
||||
FILE *fd = user_data;
|
||||
FILE *fd = (FILE*) user_data;
|
||||
/* it seems somehow thread safe, move to worker thread? */
|
||||
double pos = (double)ftell(fd);
|
||||
|
||||
@ -301,7 +301,7 @@ static gboolean progress_timer(gpointer user_data)
|
||||
static void free_queue(GAsyncQueue *queue)
|
||||
{
|
||||
for (;;) {
|
||||
QXLCommandExt *cmd = g_async_queue_try_pop(queue);
|
||||
QXLCommandExt *cmd = (QXLCommandExt*) g_async_queue_try_pop(queue);
|
||||
if (cmd == GINT_TO_POINTER(-1)) {
|
||||
continue;
|
||||
}
|
||||
@ -425,7 +425,7 @@ int main(int argc, char **argv)
|
||||
core->channel_event = replay_channel_event;
|
||||
|
||||
server = spice_server_new();
|
||||
spice_server_set_image_compression(server, compression);
|
||||
spice_server_set_image_compression(server, (SpiceImageCompression) compression);
|
||||
spice_server_set_streaming_video(server, streaming);
|
||||
|
||||
if (codecs != NULL) {
|
||||
|
||||
@ -83,7 +83,8 @@ test_connect_client(RedChannel *channel, RedClient *client, RedStream *stream,
|
||||
int migration, RedChannelCapabilities *caps)
|
||||
{
|
||||
RedChannelClient *rcc;
|
||||
rcc = g_initable_new(RED_TYPE_TEST_CHANNEL_CLIENT,
|
||||
rcc = (RedChannelClient *)
|
||||
g_initable_new(RED_TYPE_TEST_CHANNEL_CLIENT,
|
||||
NULL, NULL,
|
||||
"channel", channel,
|
||||
"client", client,
|
||||
@ -119,7 +120,7 @@ red_test_channel_class_init(RedTestChannelClass *klass)
|
||||
static uint8_t *
|
||||
red_test_channel_client_alloc_msg_rcv_buf(RedChannelClient *rcc, uint16_t type, uint32_t size)
|
||||
{
|
||||
return g_malloc(size);
|
||||
return (uint8_t*) g_malloc(size);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -191,7 +192,7 @@ static SpiceTimer *waked_up_timer;
|
||||
// timer waiting we get data again
|
||||
static void timer_wakeup(void *opaque)
|
||||
{
|
||||
SpiceCoreInterface *core = opaque;
|
||||
SpiceCoreInterface *core = (SpiceCoreInterface*) opaque;
|
||||
|
||||
// check we are receiving data again
|
||||
size_t got_data = 0;
|
||||
@ -213,7 +214,7 @@ static void timer_wakeup(void *opaque)
|
||||
// if we arrive here it means we didn't receive too many watch events
|
||||
static void timeout_watch_count(void *opaque)
|
||||
{
|
||||
SpiceCoreInterface *core = opaque;
|
||||
SpiceCoreInterface *core = (SpiceCoreInterface*) opaque;
|
||||
|
||||
// get all pending data
|
||||
alarm(1);
|
||||
@ -264,7 +265,7 @@ static void channel_loop(void)
|
||||
|
||||
// create a channel and connect to it
|
||||
RedChannel *channel =
|
||||
g_object_new(RED_TYPE_TEST_CHANNEL,
|
||||
(RedChannel*) g_object_new(RED_TYPE_TEST_CHANNEL,
|
||||
"spice-server", server,
|
||||
"core-interface", reds_get_core_interface(server),
|
||||
"channel-type", SPICE_CHANNEL_PORT, // any other than main is fine
|
||||
@ -277,7 +278,7 @@ static void channel_loop(void)
|
||||
memset(&caps, 0, sizeof(caps));
|
||||
uint32_t common_caps = 1 << SPICE_COMMON_CAP_MINI_HEADER;
|
||||
caps.num_common_caps = 1;
|
||||
caps.common_caps = spice_memdup(&common_caps, sizeof(common_caps));
|
||||
caps.common_caps = (uint32_t*) spice_memdup(&common_caps, sizeof(common_caps));
|
||||
|
||||
RedClient *client = red_client_new(server, FALSE);
|
||||
g_assert_nonnull(client);
|
||||
|
||||
@ -115,7 +115,7 @@ static void regression_test(void)
|
||||
}
|
||||
|
||||
argv = g_strsplit("./regression-test.py", " ", -1);
|
||||
retval = g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD,
|
||||
retval = g_spawn_async(NULL, argv, NULL, (GSpawnFlags) (G_SPAWN_SEARCH_PATH|G_SPAWN_DO_NOT_REAP_CHILD),
|
||||
NULL, NULL, &pid, &error);
|
||||
g_strfreev(argv);
|
||||
g_assert(retval);
|
||||
@ -202,7 +202,7 @@ test_spice_create_update_from_bitmap(uint32_t surface_id,
|
||||
} else {
|
||||
QXLClipRects *cmd_clip;
|
||||
|
||||
cmd_clip = g_malloc0(sizeof(QXLClipRects) + num_clip_rects*sizeof(QXLRect));
|
||||
cmd_clip = (QXLClipRects*) g_malloc0(sizeof(QXLClipRects) + num_clip_rects*sizeof(QXLRect));
|
||||
cmd_clip->num_rects = num_clip_rects;
|
||||
cmd_clip->chunk.data_size = num_clip_rects*sizeof(QXLRect);
|
||||
cmd_clip->chunk.prev_chunk = cmd_clip->chunk.next_chunk = 0;
|
||||
@ -251,7 +251,7 @@ static SimpleSpiceUpdate *test_spice_create_update_solid(uint32_t surface_id, QX
|
||||
bw = bbox.right - bbox.left;
|
||||
bh = bbox.bottom - bbox.top;
|
||||
|
||||
bitmap = g_malloc(bw * bh * 4);
|
||||
bitmap = (uint8_t*) g_malloc(bw * bh * 4);
|
||||
dst = SPICE_ALIGNED_CAST(uint32_t *, bitmap);
|
||||
|
||||
for (i = 0 ; i < bh * bw ; ++i, ++dst) {
|
||||
@ -286,7 +286,7 @@ static SimpleSpiceUpdate *test_spice_create_update_draw(Test *test, uint32_t sur
|
||||
bw = test->primary_width/SINGLE_PART;
|
||||
bh = 48;
|
||||
|
||||
bitmap = dst = g_malloc(bw * bh * 4);
|
||||
bitmap = dst = (uint8_t*) g_malloc(bw * bh * 4);
|
||||
//printf("allocated %p\n", dst);
|
||||
|
||||
for (i = 0 ; i < bh * bw ; ++i, dst+=4) {
|
||||
@ -636,7 +636,7 @@ static int req_cmd_notification(QXLInstance *qin)
|
||||
|
||||
static void do_wakeup(void *opaque)
|
||||
{
|
||||
Test *test = opaque;
|
||||
Test *test = (Test*) opaque;
|
||||
int notify;
|
||||
|
||||
test->cursor_notify = NOTIFY_CURSOR_BATCH;
|
||||
@ -878,7 +878,7 @@ void test_set_simple_command_list(Test *test, const int *simple_commands, int nu
|
||||
test->commands = g_new0(Command, num_commands);
|
||||
test->num_commands = num_commands;
|
||||
for (i = 0 ; i < num_commands; ++i) {
|
||||
test->commands[i].command = simple_commands[i];
|
||||
test->commands[i].command = (CommandType) simple_commands[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ static int ping_ms = 100;
|
||||
|
||||
static void pinger(void *opaque)
|
||||
{
|
||||
Test *test = opaque;
|
||||
Test *test = (Test*) opaque;
|
||||
|
||||
test->core->timer_start(ping_timer, ping_ms);
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ static void create_overlay(Command *command , int width, int height)
|
||||
cmd->bbox.bottom = height;
|
||||
|
||||
cmd->num_clip_rects = 0;
|
||||
cmd->bitmap = g_malloc(width * height * 4 );
|
||||
cmd->bitmap = (uint8_t*) g_malloc(width * height * 4 );
|
||||
dst = SPICE_ALIGNED_CAST(uint32_t *, cmd->bitmap);
|
||||
for (int i = 0; i < width * height; i++, dst++) {
|
||||
*dst = 0x8B008B;
|
||||
@ -123,7 +123,7 @@ static void create_clipped_frame(Test *test, Command *command, int clipping_fact
|
||||
end_line += 50;
|
||||
}
|
||||
|
||||
cmd->bitmap = g_malloc(width*height*4);
|
||||
cmd->bitmap = (uint8_t*) g_malloc(width*height*4);
|
||||
memset(cmd->bitmap, 0xff, width*height*4);
|
||||
dst = SPICE_ALIGNED_CAST(uint32_t *, cmd->bitmap + cur_line*width*4);
|
||||
for (; cur_line < end_line; cur_line++) {
|
||||
@ -215,7 +215,7 @@ static void get_stream_commands(Command *commands, int num_commands,
|
||||
static void get_commands(Command **commands, int *num_commands)
|
||||
{
|
||||
*num_commands = NUM_COMMANDS * 2;
|
||||
*commands = calloc(sizeof(Command), *num_commands);
|
||||
*commands = (Command*) calloc(sizeof(Command), *num_commands);
|
||||
|
||||
get_stream_commands(*commands, NUM_COMMANDS, create_frame1);
|
||||
get_stream_commands((*commands) + NUM_COMMANDS, NUM_COMMANDS, create_frame2);
|
||||
|
||||
@ -30,7 +30,7 @@ static int ping_ms = 100;
|
||||
|
||||
static void pinger(void *opaque)
|
||||
{
|
||||
Test *test = opaque;
|
||||
Test *test = (Test*) opaque;
|
||||
|
||||
test->core->timer_start(ping_timer, ping_ms);
|
||||
}
|
||||
@ -64,7 +64,7 @@ set_surface_params(SPICE_GNUC_UNUSED Test *test, Command *command)
|
||||
create->format = SPICE_SURFACE_FMT_8_A;
|
||||
create->width = 128;
|
||||
create->height = 128;
|
||||
g_surface_data = g_realloc(g_surface_data, create->width * create->height * 1);
|
||||
g_surface_data = (uint8_t*) g_realloc(g_surface_data, create->width * create->height * 1);
|
||||
create->surface_id = g_surface_id;
|
||||
create->data = g_surface_data;
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ output_frames(GstSample *sample, void *param)
|
||||
|
||||
// get first frame queued
|
||||
pthread_mutex_lock(&frame_queue_mtx);
|
||||
TestFrame *expected_frame = g_queue_pop_head(&frame_queue);
|
||||
TestFrame *expected_frame = (TestFrame*) g_queue_pop_head(&frame_queue);
|
||||
pthread_cond_signal(&frame_queue_cond);
|
||||
pthread_mutex_unlock(&frame_queue_mtx);
|
||||
if (!expected_frame) {
|
||||
@ -432,7 +432,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// check queue is now empty
|
||||
pthread_mutex_lock(&frame_queue_mtx);
|
||||
TestFrame *frame = g_queue_pop_head(&frame_queue);
|
||||
TestFrame *frame = (TestFrame*) g_queue_pop_head(&frame_queue);
|
||||
pthread_mutex_unlock(&frame_queue_mtx);
|
||||
if (frame) {
|
||||
g_printerr("Queue not empty at the end\n");
|
||||
@ -558,7 +558,7 @@ get_encoder_info(const char *encoder_name)
|
||||
static GstFlowReturn
|
||||
new_sample(GstAppSink *gstappsink, gpointer test_pipeline)
|
||||
{
|
||||
TestPipeline *pipeline = test_pipeline;
|
||||
TestPipeline *pipeline = (TestPipeline*) test_pipeline;
|
||||
|
||||
GstSample *sample = gst_app_sink_pull_sample(pipeline->appsink);
|
||||
if (sample) {
|
||||
@ -798,7 +798,7 @@ gst_to_spice_bitmap(GstSample *sample)
|
||||
bitmap->flags = top_down ? SPICE_BITMAP_FLAGS_TOP_DOWN : 0;
|
||||
bitmap->x = width;
|
||||
bitmap->y = height;
|
||||
bitmap->stride = compute_stride(width, bitmap->format);
|
||||
bitmap->stride = compute_stride(width, (SpiceBitmapFmt) bitmap->format);
|
||||
bitmap->data = chunks_alloc(bitmap->stride, height, image_split_lines);
|
||||
|
||||
GstBuffer *buffer = gst_sample_get_buffer(sample);
|
||||
@ -809,7 +809,7 @@ gst_to_spice_bitmap(GstSample *sample)
|
||||
|
||||
// convert image
|
||||
gint y;
|
||||
convert_line_t *convert_line = get_convert_line(bitmap->format);
|
||||
convert_line_t *convert_line = get_convert_line((SpiceBitmapFmt) bitmap->format);
|
||||
for (y = 0; y < height; ++y) {
|
||||
convert_line(bitmap_get_line(bitmap, y),
|
||||
mapinfo.data + y * width * 4,
|
||||
@ -846,7 +846,7 @@ chunks_alloc(uint32_t stride, uint32_t height, uint32_t split)
|
||||
{
|
||||
spice_assert(stride && height && split);
|
||||
const uint32_t num_chunks = (height + split - 1u) / split;
|
||||
SpiceChunks *chunks = spice_malloc0(sizeof(SpiceChunks) + sizeof(SpiceChunk) * num_chunks);
|
||||
SpiceChunks *chunks = (SpiceChunks*) spice_malloc0(sizeof(SpiceChunks) + sizeof(SpiceChunk) * num_chunks);
|
||||
|
||||
chunks->data_size = stride * height;
|
||||
chunks->num_chunks = num_chunks;
|
||||
@ -858,7 +858,7 @@ chunks_alloc(uint32_t stride, uint32_t height, uint32_t split)
|
||||
uint32_t len = stride * split;
|
||||
spice_assert(chunks->data_size > allocated);
|
||||
len = MIN(len, chunks->data_size - allocated);
|
||||
chunk->data = spice_malloc0(len);
|
||||
chunk->data = (uint8_t*) spice_malloc0(len);
|
||||
chunk->len = len;
|
||||
allocated += len;
|
||||
}
|
||||
@ -1000,8 +1000,8 @@ compute_psnr(SpiceBitmap *bitmap1, int32_t x1, int32_t y1,
|
||||
int y;
|
||||
uint64_t diff_sum = 0;
|
||||
uint8_t pixels[2][w*3];
|
||||
bitmap_extract_rgb_line_t *extract1 = get_bitmap_extract(bitmap1->format);
|
||||
bitmap_extract_rgb_line_t *extract2 = get_bitmap_extract(bitmap2->format);
|
||||
bitmap_extract_rgb_line_t *extract1 = get_bitmap_extract((SpiceBitmapFmt) bitmap1->format);
|
||||
bitmap_extract_rgb_line_t *extract2 = get_bitmap_extract((SpiceBitmapFmt) bitmap2->format);
|
||||
for (y = 0; y < h; ++y) {
|
||||
uint8_t *line1 = extract1(bitmap1, pixels[0], x1, y1 + y, w);
|
||||
uint8_t *line2 = extract2(bitmap2, pixels[1], x2, y2 + y, w);
|
||||
|
||||
@ -120,7 +120,7 @@ static GIOStream *fake_client_connect_tls(GSocketConnectable *connectable, GErro
|
||||
error);
|
||||
g_assert_no_error(*error);
|
||||
/* Disable all certificate checks as our test setup is known to be invalid */
|
||||
g_tls_client_connection_set_validation_flags(G_TLS_CLIENT_CONNECTION(tls_connection), 0);
|
||||
g_tls_client_connection_set_validation_flags(G_TLS_CLIENT_CONNECTION(tls_connection), (GTlsCertificateFlags) 0);
|
||||
|
||||
g_object_unref(connection);
|
||||
g_object_unref(client);
|
||||
@ -163,7 +163,7 @@ typedef struct
|
||||
static gpointer check_magic_thread(gpointer data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ThreadData *thread_data = data;
|
||||
ThreadData *thread_data = (ThreadData*) data;
|
||||
GSocketConnectable *connectable = G_SOCKET_CONNECTABLE(thread_data->connectable);
|
||||
GIOStream *stream;
|
||||
|
||||
@ -188,7 +188,7 @@ static gpointer check_magic_thread(gpointer data)
|
||||
static gpointer check_no_connect_thread(gpointer data)
|
||||
{
|
||||
GError *error = NULL;
|
||||
ThreadData *thread_data = data;
|
||||
ThreadData *thread_data = (ThreadData*) data;
|
||||
GSocketConnectable *connectable = G_SOCKET_CONNECTABLE(thread_data->connectable);
|
||||
GIOStream *stream;
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ from_physical(QXLPHYSICAL physical)
|
||||
static void*
|
||||
create_chunk(size_t prefix, uint32_t size, QXLDataChunk* prev, int fill)
|
||||
{
|
||||
uint8_t *ptr = g_malloc0(prefix + sizeof(QXLDataChunk) + size);
|
||||
uint8_t *ptr = (uint8_t*) g_malloc0(prefix + sizeof(QXLDataChunk) + size);
|
||||
QXLDataChunk *qxl = (QXLDataChunk *) (ptr + prefix);
|
||||
memset(&qxl->data[0], fill, size);
|
||||
qxl->data_size = size;
|
||||
@ -101,10 +101,10 @@ static void test_memslot_invalid_slot_id(void)
|
||||
|
||||
static void test_memslot_invalid_addresses(void)
|
||||
{
|
||||
g_test_trap_subprocess("/server/memslot-invalid-addresses/subprocess/group_id", 0, 0);
|
||||
g_test_trap_subprocess("/server/memslot-invalid-addresses/subprocess/group_id", 0, (GTestSubprocessFlags) 0);
|
||||
g_test_trap_assert_stderr("*group_id too big*");
|
||||
|
||||
g_test_trap_subprocess("/server/memslot-invalid-addresses/subprocess/slot_id", 0, 0);
|
||||
g_test_trap_subprocess("/server/memslot-invalid-addresses/subprocess/slot_id", 0, (GTestSubprocessFlags) 0);
|
||||
g_test_trap_assert_stderr("*slot_id 1 too big*");
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ static void test_cursor_command(void)
|
||||
memset(&cursor_cmd, 0, sizeof(cursor_cmd));
|
||||
cursor_cmd.type = QXL_CURSOR_SET;
|
||||
|
||||
cursor = create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 128 * 128 * 4, NULL, 0xaa);
|
||||
cursor = (QXLCursor*) create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 128 * 128 * 4, NULL, 0xaa);
|
||||
cursor->header.unique = 1;
|
||||
cursor->header.width = 128;
|
||||
cursor->header.height = 128;
|
||||
@ -217,13 +217,13 @@ static void test_circular_empty_chunks(void)
|
||||
memset(&cursor_cmd, 0, sizeof(cursor_cmd));
|
||||
cursor_cmd.type = QXL_CURSOR_SET;
|
||||
|
||||
cursor = create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 0, NULL, 0xaa);
|
||||
cursor = (QXLCursor*) create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 0, NULL, 0xaa);
|
||||
cursor->header.unique = 1;
|
||||
cursor->header.width = 128;
|
||||
cursor->header.height = 128;
|
||||
cursor->data_size = 128 * 128 * 4;
|
||||
|
||||
chunks[0] = create_chunk(0, 0, &cursor->chunk, 0xaa);
|
||||
chunks[0] = (QXLDataChunk*) create_chunk(0, 0, &cursor->chunk, 0xaa);
|
||||
chunks[0]->next_chunk = to_physical(&cursor->chunk);
|
||||
|
||||
cursor_cmd.u.set.shape = to_physical(cursor);
|
||||
@ -260,13 +260,13 @@ static void test_circular_small_chunks(void)
|
||||
memset(&cursor_cmd, 0, sizeof(cursor_cmd));
|
||||
cursor_cmd.type = QXL_CURSOR_SET;
|
||||
|
||||
cursor = create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 1, NULL, 0xaa);
|
||||
cursor = (QXLCursor*) create_chunk(SPICE_OFFSETOF(QXLCursor, chunk), 1, NULL, 0xaa);
|
||||
cursor->header.unique = 1;
|
||||
cursor->header.width = 128;
|
||||
cursor->header.height = 128;
|
||||
cursor->data_size = 128 * 128 * 4;
|
||||
|
||||
chunks[0] = create_chunk(0, 1, &cursor->chunk, 0xaa);
|
||||
chunks[0] = (QXLDataChunk*) create_chunk(0, 1, &cursor->chunk, 0xaa);
|
||||
chunks[0]->next_chunk = to_physical(&cursor->chunk);
|
||||
|
||||
cursor_cmd.u.set.shape = to_physical(cursor);
|
||||
|
||||
@ -177,7 +177,7 @@ sasl_server_new(const char *service,
|
||||
g_assert_nonnull(pconn);
|
||||
g_assert_null(callbacks);
|
||||
|
||||
*pconn = GUINT_TO_POINTER(0xdeadbeef);
|
||||
*pconn = (sasl_conn_t *) GUINT_TO_POINTER(0xdeadbeef);
|
||||
return SASL_OK;
|
||||
}
|
||||
|
||||
@ -290,7 +290,7 @@ static void
|
||||
start_test(void)
|
||||
{
|
||||
g_assert_null(big_data);
|
||||
big_data = g_malloc(1024 * 1024 + 10);
|
||||
big_data = (char*) g_malloc(1024 * 1024 + 10);
|
||||
for (unsigned n = 0; n < 1024 * 1024 + 10; ++n) {
|
||||
big_data[n] = ' ' + (n % 94);
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ void stream_channel_register_queue_stat_cb(StreamChannel *channel,
|
||||
|
||||
StreamChannel* stream_channel_new(RedsState *server, uint32_t id)
|
||||
{
|
||||
return g_object_new(TYPE_STREAM_CHANNEL,
|
||||
return (StreamChannel*) g_object_new(TYPE_STREAM_CHANNEL,
|
||||
"spice-server", server,
|
||||
"core-interface", reds_get_core_interface(server),
|
||||
"channel-type", SPICE_CHANNEL_DISPLAY,
|
||||
|
||||
@ -114,7 +114,7 @@ typedef struct DumpItem {
|
||||
|
||||
static void dump_item(TreeItem *item, void *data)
|
||||
{
|
||||
DumpItem *di = data;
|
||||
DumpItem *di = (DumpItem*) data;
|
||||
const char *item_prefix = "|--";
|
||||
int i;
|
||||
|
||||
|
||||
@ -189,7 +189,7 @@ VideoStreamClipItem *video_stream_clip_item_new(VideoStreamAgent *agent)
|
||||
item->clip_type = SPICE_CLIP_TYPE_RECTS;
|
||||
|
||||
int n_rects = pixman_region32_n_rects(&agent->clip);
|
||||
item->rects = g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
|
||||
item->rects = (SpiceClipRects*) g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
|
||||
item->rects->num_rects = n_rects;
|
||||
region_ret_rects(&agent->clip, item->rects->rects, n_rects);
|
||||
|
||||
@ -360,7 +360,7 @@ static void before_reattach_stream(DisplayChannel *display,
|
||||
|
||||
index = display_channel_get_video_stream_id(display, stream);
|
||||
for (dpi_link = stream->current->pipes; dpi_link; dpi_link = dpi_next) {
|
||||
RedDrawablePipeItem *dpi = dpi_link->data;
|
||||
RedDrawablePipeItem *dpi = (RedDrawablePipeItem*) dpi_link->data;
|
||||
dpi_next = dpi_link->next;
|
||||
dcc = dpi->dcc;
|
||||
agent = dcc_get_video_stream_agent(dcc, index);
|
||||
@ -669,7 +669,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, VideoStream *str
|
||||
|
||||
static uint32_t get_roundtrip_ms(void *opaque)
|
||||
{
|
||||
VideoStreamAgent *agent = opaque;
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
int roundtrip;
|
||||
RedChannelClient *rcc = RED_CHANNEL_CLIENT(agent->dcc);
|
||||
|
||||
@ -690,14 +690,14 @@ static uint32_t get_roundtrip_ms(void *opaque)
|
||||
|
||||
static uint32_t get_source_fps(void *opaque)
|
||||
{
|
||||
VideoStreamAgent *agent = opaque;
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
|
||||
return agent->stream->input_fps;
|
||||
}
|
||||
|
||||
static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
|
||||
{
|
||||
VideoStreamAgent *agent = opaque;
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
DisplayChannelClient *dcc = agent->dcc;
|
||||
RedClient *client = red_channel_client_get_client(RED_CHANNEL_CLIENT(dcc));
|
||||
RedsState *reds = red_client_get_server(client);
|
||||
@ -875,7 +875,7 @@ static void dcc_detach_stream_gracefully(DisplayChannelClient *dcc,
|
||||
upgrade_item->drawable = stream->current;
|
||||
upgrade_item->drawable->refs++;
|
||||
n_rects = pixman_region32_n_rects(&upgrade_item->drawable->tree_item.base.rgn);
|
||||
upgrade_item->rects = g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
|
||||
upgrade_item->rects = (SpiceClipRects*) g_malloc(sizeof(SpiceClipRects) + n_rects * sizeof(SpiceRect));
|
||||
upgrade_item->rects->num_rects = n_rects;
|
||||
region_ret_rects(&upgrade_item->drawable->tree_item.base.rgn,
|
||||
upgrade_item->rects->rects, n_rects);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user