mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
clang-tidy: use auto
Found with modernize-use-auto auto is shorter and can sometimes disambiguate pointer constness. Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
04e885b291
commit
944dc8662e
@ -133,7 +133,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 = (RedCharDeviceWriteBuffer *) l->data;
|
||||
auto write_buf = (RedCharDeviceWriteBuffer *) l->data;
|
||||
next = l->next;
|
||||
|
||||
if (write_buf->priv->origin == WRITE_BUFFER_ORIGIN_CLIENT &&
|
||||
@ -755,7 +755,7 @@ void RedCharDevice::migrate_data_marshall_empty(SpiceMarshaller *m)
|
||||
|
||||
static void migrate_data_marshaller_write_buffer_free(uint8_t *data, void *opaque)
|
||||
{
|
||||
RedCharDeviceWriteBuffer *write_buf = (RedCharDeviceWriteBuffer *)opaque;
|
||||
auto write_buf = (RedCharDeviceWriteBuffer *)opaque;
|
||||
|
||||
red_char_device_write_buffer_unref(write_buf);
|
||||
}
|
||||
@ -800,7 +800,7 @@ void RedCharDevice::migrate_data_marshall(SpiceMarshaller *m)
|
||||
}
|
||||
|
||||
for (item = g_queue_peek_tail_link(&priv->write_queue); item != NULL; item = item->prev) {
|
||||
RedCharDeviceWriteBuffer *write_buf = (RedCharDeviceWriteBuffer *) item->data;
|
||||
auto 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,
|
||||
@ -915,7 +915,7 @@ RedCharDevice::~RedCharDevice()
|
||||
priv->cur_write_buf = NULL;
|
||||
|
||||
while (priv->clients != NULL) {
|
||||
RedCharDeviceClient *dev_client = (RedCharDeviceClient *) priv->clients->data;
|
||||
auto dev_client = (RedCharDeviceClient *) priv->clients->data;
|
||||
red_char_device_client_free(this, dev_client);
|
||||
}
|
||||
priv->running = FALSE;
|
||||
|
||||
@ -338,7 +338,7 @@ static void marshaller_add_compressed(SpiceMarshaller *m,
|
||||
|
||||
static void marshaller_unref_drawable(uint8_t *data, void *opaque)
|
||||
{
|
||||
Drawable *drawable = (Drawable *) opaque;
|
||||
auto drawable = (Drawable *) opaque;
|
||||
drawable_unref(drawable);
|
||||
}
|
||||
|
||||
@ -1634,7 +1634,7 @@ static void red_lossy_marshall_qxl_draw_text(DisplayChannelClient *dcc,
|
||||
|
||||
static void red_release_video_encoder_buffer(uint8_t *data, void *opaque)
|
||||
{
|
||||
VideoBuffer *buffer = (VideoBuffer*)opaque;
|
||||
auto buffer = (VideoBuffer*)opaque;
|
||||
buffer->free(buffer);
|
||||
}
|
||||
|
||||
@ -2224,7 +2224,7 @@ static void marshall_monitors_config(RedChannelClient *rcc, SpiceMarshaller *bas
|
||||
{
|
||||
int heads_size = sizeof(SpiceHead) * monitors_config->count;
|
||||
int i;
|
||||
SpiceMsgDisplayMonitorsConfig *msg = (SpiceMsgDisplayMonitorsConfig *) g_malloc0(sizeof(*msg) + heads_size);
|
||||
auto msg = (SpiceMsgDisplayMonitorsConfig *) g_malloc0(sizeof(SpiceMsgDisplayMonitorsConfig) + heads_size);
|
||||
int count = 0; // ignore monitors_config->count, it may contain zero width monitors, remove them now
|
||||
|
||||
rcc->init_send_data(SPICE_MSG_DISPLAY_MONITORS_CONFIG);
|
||||
@ -2279,7 +2279,7 @@ static void marshall_gl_draw(RedChannelClient *rcc,
|
||||
SpiceMarshaller *m,
|
||||
RedPipeItem *item)
|
||||
{
|
||||
RedGlDrawItem *p = static_cast<RedGlDrawItem*>(item);
|
||||
auto p = static_cast<RedGlDrawItem*>(item);
|
||||
|
||||
rcc->init_send_data(SPICE_MSG_DISPLAY_GL_DRAW);
|
||||
spice_marshall_msg_display_gl_draw(m, &p->draw);
|
||||
@ -2328,7 +2328,7 @@ void DisplayChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
::reset_send_data(dcc);
|
||||
switch (pipe_item->type) {
|
||||
case RED_PIPE_ITEM_TYPE_DRAW: {
|
||||
RedDrawablePipeItem *dpi = static_cast<RedDrawablePipeItem*>(pipe_item);
|
||||
auto dpi = static_cast<RedDrawablePipeItem*>(pipe_item);
|
||||
marshall_qxl_drawable(this, m, dpi);
|
||||
break;
|
||||
}
|
||||
@ -2336,7 +2336,7 @@ void DisplayChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
marshall_inval_palette(this, m, static_cast<RedCachePipeItem*>(pipe_item));
|
||||
break;
|
||||
case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
|
||||
StreamCreateDestroyItem *item = static_cast<StreamCreateDestroyItem*>(pipe_item);
|
||||
auto item = static_cast<StreamCreateDestroyItem*>(pipe_item);
|
||||
marshall_stream_start(this, m, item->agent);
|
||||
break;
|
||||
}
|
||||
@ -2344,7 +2344,7 @@ void DisplayChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
marshall_stream_clip(this, m, static_cast<VideoStreamClipItem*>(pipe_item));
|
||||
break;
|
||||
case RED_PIPE_ITEM_TYPE_STREAM_DESTROY: {
|
||||
StreamCreateDestroyItem *item = static_cast<StreamCreateDestroyItem*>(pipe_item);
|
||||
auto item = static_cast<StreamCreateDestroyItem*>(pipe_item);
|
||||
marshall_stream_end(this, m, item->agent);
|
||||
break;
|
||||
}
|
||||
@ -2368,22 +2368,22 @@ void DisplayChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
init_send_data(SPICE_MSG_DISPLAY_INVAL_ALL_PALETTES);
|
||||
break;
|
||||
case RED_PIPE_ITEM_TYPE_CREATE_SURFACE: {
|
||||
RedSurfaceCreateItem *surface_create = static_cast<RedSurfaceCreateItem*>(pipe_item);
|
||||
auto surface_create = static_cast<RedSurfaceCreateItem*>(pipe_item);
|
||||
marshall_surface_create(this, m, &surface_create->surface_create);
|
||||
break;
|
||||
}
|
||||
case RED_PIPE_ITEM_TYPE_DESTROY_SURFACE: {
|
||||
RedSurfaceDestroyItem *surface_destroy = static_cast<RedSurfaceDestroyItem*>(pipe_item);
|
||||
auto surface_destroy = static_cast<RedSurfaceDestroyItem*>(pipe_item);
|
||||
marshall_surface_destroy(this, m, surface_destroy->surface_destroy.surface_id);
|
||||
break;
|
||||
}
|
||||
case RED_PIPE_ITEM_TYPE_MONITORS_CONFIG: {
|
||||
RedMonitorsConfigItem *monconf_item = static_cast<RedMonitorsConfigItem*>(pipe_item);
|
||||
auto monconf_item = static_cast<RedMonitorsConfigItem*>(pipe_item);
|
||||
marshall_monitors_config(this, m, monconf_item->monitors_config);
|
||||
break;
|
||||
}
|
||||
case RED_PIPE_ITEM_TYPE_STREAM_ACTIVATE_REPORT: {
|
||||
RedStreamActivateReportItem *report_item =
|
||||
auto report_item =
|
||||
static_cast<RedStreamActivateReportItem*>(pipe_item);
|
||||
marshall_stream_activate_report(this, m, report_item);
|
||||
break;
|
||||
|
||||
@ -530,7 +530,7 @@ XXX_CAST(RedChannelClient, DisplayChannelClient, DISPLAY_CHANNEL_CLIENT);
|
||||
RedPipeItemPtr dcc_gl_draw_item_new(RedChannelClient *rcc, void *data, int num)
|
||||
{
|
||||
DisplayChannelClient *dcc = DISPLAY_CHANNEL_CLIENT(rcc);
|
||||
const SpiceMsgDisplayGlDraw *draw = (const SpiceMsgDisplayGlDraw *) data;
|
||||
auto draw = (const SpiceMsgDisplayGlDraw *) data;
|
||||
|
||||
if (!red_stream_is_plain_unix(rcc->get_stream()) ||
|
||||
!rcc->test_remote_cap(SPICE_DISPLAY_CAP_GL_SCANOUT)) {
|
||||
@ -928,9 +928,9 @@ static gint sort_video_codecs_by_client_preference(gconstpointer a_pointer,
|
||||
gconstpointer b_pointer,
|
||||
gpointer user_data)
|
||||
{
|
||||
const RedVideoCodec *a = (const RedVideoCodec *) a_pointer;
|
||||
const RedVideoCodec *b = (const RedVideoCodec *) b_pointer;
|
||||
GArray *client_pref = (GArray *) user_data;
|
||||
auto a = (const RedVideoCodec *) a_pointer;
|
||||
auto b = (const RedVideoCodec *) b_pointer;
|
||||
auto client_pref = (GArray *) user_data;
|
||||
|
||||
return (g_array_index(client_pref, gint, a->type) -
|
||||
g_array_index(client_pref, gint, b->type));
|
||||
@ -1097,8 +1097,8 @@ bool DisplayChannelClient::handle_migrate_data(uint32_t size, void *message)
|
||||
DisplayChannelClient *dcc = this;
|
||||
DisplayChannel *display = DCC_TO_DC(dcc);
|
||||
int surfaces_restored = FALSE;
|
||||
SpiceMigrateDataHeader *header = (SpiceMigrateDataHeader *)message;
|
||||
SpiceMigrateDataDisplay *migrate_data = (SpiceMigrateDataDisplay *)(header + 1);
|
||||
auto header = (SpiceMigrateDataHeader *)message;
|
||||
auto migrate_data = (SpiceMigrateDataDisplay *)(header + 1);
|
||||
uint8_t *surfaces;
|
||||
int i;
|
||||
|
||||
|
||||
@ -1807,7 +1807,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 = (uint8_t*) surface->context.line_0;
|
||||
auto line_0 = (uint8_t*) surface->context.line_0;
|
||||
|
||||
if (surface->context.canvas_draws_on_surface)
|
||||
return;
|
||||
@ -2099,7 +2099,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 = (char*) line_0;
|
||||
auto data = (char*) line_0;
|
||||
if (stride < 0) {
|
||||
data -= abs(stride) * (height - 1);
|
||||
}
|
||||
|
||||
@ -387,7 +387,7 @@ static void image_encoders_init_lz(ImageEncoders *enc)
|
||||
static void glz_usr_free_image(GlzEncoderUsrContext *usr, GlzUsrImageContext *image)
|
||||
{
|
||||
GlzData *lz_data = SPICE_CONTAINEROF(usr, GlzData, usr);
|
||||
GlzDrawableInstanceItem *glz_drawable_instance = (GlzDrawableInstanceItem *)image;
|
||||
auto glz_drawable_instance = (GlzDrawableInstanceItem *)image;
|
||||
ImageEncoders *drawable_enc = glz_drawable_instance->glz_drawable->encoders;
|
||||
ImageEncoders *this_enc = SPICE_CONTAINEROF(lz_data, ImageEncoders, glz_data);
|
||||
if (this_enc == drawable_enc) {
|
||||
@ -688,7 +688,7 @@ static GlzSharedDictionary *glz_shared_dictionary_new(RedClient *client, uint8_t
|
||||
{
|
||||
spice_return_val_if_fail(dict != NULL, NULL);
|
||||
|
||||
GlzSharedDictionary *shared_dict = g_new0(GlzSharedDictionary, 1);
|
||||
auto shared_dict = g_new0(GlzSharedDictionary, 1);
|
||||
|
||||
shared_dict->dict = dict;
|
||||
shared_dict->id = id;
|
||||
@ -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 = (GlzSharedDictionary *) l->data;
|
||||
auto dict = (GlzSharedDictionary *) l->data;
|
||||
if ((dict->client == client) && (dict->id == dict_id)) {
|
||||
ret = dict;
|
||||
break;
|
||||
|
||||
@ -51,7 +51,7 @@ struct SpiceKbdState {
|
||||
|
||||
static SpiceKbdState* spice_kbd_state_new(InputsChannel *inputs)
|
||||
{
|
||||
SpiceKbdState *st = g_new0(SpiceKbdState, 1);
|
||||
auto st = g_new0(SpiceKbdState, 1);
|
||||
st->inputs = inputs;
|
||||
return st;
|
||||
}
|
||||
@ -71,7 +71,7 @@ struct SpiceTabletState {
|
||||
|
||||
static SpiceTabletState* spice_tablet_state_new(RedsState* reds)
|
||||
{
|
||||
SpiceTabletState *st = g_new0(SpiceTabletState, 1);
|
||||
auto st = g_new0(SpiceTabletState, 1);
|
||||
st->reds = reds;
|
||||
return st;
|
||||
}
|
||||
@ -247,12 +247,12 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
|
||||
switch (type) {
|
||||
case SPICE_MSGC_INPUTS_KEY_DOWN: {
|
||||
SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *) message;
|
||||
auto key_down = (SpiceMsgcKeyDown *) message;
|
||||
inputs_channel->sync_locks(key_down->code);
|
||||
}
|
||||
/* fallthrough */
|
||||
case SPICE_MSGC_INPUTS_KEY_UP: {
|
||||
SpiceMsgcKeyUp *key_up = (SpiceMsgcKeyUp *) message;
|
||||
auto key_up = (SpiceMsgcKeyUp *) message;
|
||||
for (i = 0; i < 4; i++) {
|
||||
uint8_t code = (key_up->code >> (i * 8)) & 0xff;
|
||||
if (code == 0) {
|
||||
@ -264,7 +264,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_KEY_SCANCODE: {
|
||||
uint8_t *code = (uint8_t *) message;
|
||||
auto code = (uint8_t *) message;
|
||||
for (i = 0; i < size; i++) {
|
||||
kbd_push_scan(inputs_channel->keyboard, code[i]);
|
||||
inputs_channel->sync_locks(code[i]);
|
||||
@ -273,7 +273,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
|
||||
SpiceMouseInstance *mouse = inputs_channel->mouse;
|
||||
SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *) message;
|
||||
auto mouse_motion = (SpiceMsgcMouseMotion *) message;
|
||||
|
||||
on_mouse_motion();
|
||||
if (mouse && reds_get_mouse_mode(reds) == SPICE_MOUSE_MODE_SERVER) {
|
||||
@ -286,7 +286,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_POSITION: {
|
||||
SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *) message;
|
||||
auto pos = (SpiceMsgcMousePosition *) message;
|
||||
SpiceTabletInstance *tablet = inputs_channel->tablet;
|
||||
|
||||
on_mouse_motion();
|
||||
@ -309,7 +309,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_PRESS: {
|
||||
SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *) message;
|
||||
auto mouse_press = (SpiceMsgcMousePress *) message;
|
||||
int dz = 0;
|
||||
if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) {
|
||||
dz = -1;
|
||||
@ -340,7 +340,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
|
||||
SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *) message;
|
||||
auto 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 =
|
||||
@ -363,7 +363,7 @@ bool InputsChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
break;
|
||||
}
|
||||
case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
|
||||
SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *) message;
|
||||
auto modifiers = (SpiceMsgcKeyModifiers *) message;
|
||||
uint8_t leds;
|
||||
SpiceKbdInstance *keyboard = inputs_channel->keyboard;
|
||||
|
||||
|
||||
@ -236,7 +236,7 @@ void MainChannelClient::push_init(int display_channels_hint,
|
||||
|
||||
static RedPipeItemPtr main_name_item_new(const char *name)
|
||||
{
|
||||
RedNamePipeItem *item = new (strlen(name) + 1) RedNamePipeItem();
|
||||
auto item = new (strlen(name) + 1) RedNamePipeItem();
|
||||
item->msg.name_len = strlen(name) + 1;
|
||||
memcpy(&item->msg.name, name, item->msg.name_len);
|
||||
|
||||
|
||||
@ -82,7 +82,7 @@ bool MainChannelClient::handle_migrate_data(uint32_t size, void *message)
|
||||
{
|
||||
RedChannel *channel = get_channel();
|
||||
MainChannelClient *mcc = this;
|
||||
SpiceMigrateDataHeader *header = (SpiceMigrateDataHeader *)message;
|
||||
auto header = (SpiceMigrateDataHeader *)message;
|
||||
|
||||
/* not supported with multi-clients */
|
||||
spice_assert(channel->get_n_clients() == 1);
|
||||
|
||||
@ -78,8 +78,8 @@ struct MainDispatcherClientDisconnectMessage {
|
||||
static void main_dispatcher_handle_channel_event(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherChannelEventMessage *channel_event = (MainDispatcherChannelEventMessage*) payload;
|
||||
auto reds = (RedsState*) opaque;
|
||||
auto channel_event = (MainDispatcherChannelEventMessage*) payload;
|
||||
|
||||
reds_handle_channel_event(reds, channel_event->event, channel_event->info);
|
||||
}
|
||||
@ -101,8 +101,8 @@ void MainDispatcher::channel_event(int event, SpiceChannelEventInfo *info)
|
||||
static void main_dispatcher_handle_migrate_complete(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherMigrateSeamlessDstCompleteMessage *mig_complete = (MainDispatcherMigrateSeamlessDstCompleteMessage*) payload;
|
||||
auto reds = (RedsState*) opaque;
|
||||
auto mig_complete = (MainDispatcherMigrateSeamlessDstCompleteMessage*) payload;
|
||||
|
||||
reds_on_client_seamless_migrate_complete(reds, mig_complete->client);
|
||||
mig_complete->client->unref();
|
||||
@ -111,8 +111,8 @@ static void main_dispatcher_handle_migrate_complete(void *opaque,
|
||||
static void main_dispatcher_handle_mm_time_latency(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherMmTimeLatencyMessage *msg = (MainDispatcherMmTimeLatencyMessage*) payload;
|
||||
auto reds = (RedsState*) opaque;
|
||||
auto msg = (MainDispatcherMmTimeLatencyMessage*) payload;
|
||||
reds_set_client_mm_time_latency(reds, msg->client, msg->latency);
|
||||
msg->client->unref();
|
||||
}
|
||||
@ -120,8 +120,8 @@ static void main_dispatcher_handle_mm_time_latency(void *opaque,
|
||||
static void main_dispatcher_handle_client_disconnect(void *opaque,
|
||||
void *payload)
|
||||
{
|
||||
RedsState *reds = (RedsState*) opaque;
|
||||
MainDispatcherClientDisconnectMessage *msg = (MainDispatcherClientDisconnectMessage*) payload;
|
||||
auto reds = (RedsState*) opaque;
|
||||
auto msg = (MainDispatcherClientDisconnectMessage*) payload;
|
||||
|
||||
spice_debug("client=%p", msg->client);
|
||||
reds_client_disconnect(reds, msg->client);
|
||||
|
||||
@ -90,7 +90,7 @@ static Ring pixmap_cache_list = {&pixmap_cache_list, &pixmap_cache_list};
|
||||
|
||||
static PixmapCache *pixmap_cache_new(RedClient *client, uint8_t id, int64_t size)
|
||||
{
|
||||
PixmapCache *cache = g_new0(PixmapCache, 1);
|
||||
auto cache = g_new0(PixmapCache, 1);
|
||||
|
||||
ring_item_init(&cache->base);
|
||||
pthread_mutex_init(&cache->lock, NULL);
|
||||
|
||||
@ -482,7 +482,7 @@ void RedChannelClient::send_ping()
|
||||
|
||||
void RedChannelClient::send_empty_msg(RedPipeItem *base)
|
||||
{
|
||||
RedEmptyMsgPipeItem *msg_pipe_item = static_cast<RedEmptyMsgPipeItem*>(base);
|
||||
auto msg_pipe_item = static_cast<RedEmptyMsgPipeItem*>(base);
|
||||
|
||||
init_send_data(msg_pipe_item->msg);
|
||||
begin_send_message();
|
||||
|
||||
@ -1244,7 +1244,7 @@ RedDrawable *red_drawable_new(QXLInstance *qxl, RedMemSlotInfo *slots,
|
||||
int group_id, QXLPHYSICAL addr,
|
||||
uint32_t flags)
|
||||
{
|
||||
RedDrawable *red = g_new0(RedDrawable, 1);
|
||||
auto red = g_new0(RedDrawable, 1);
|
||||
|
||||
red->refs = 1;
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ RedPipeItem::RedPipeItem(int init_type):
|
||||
|
||||
static void marshaller_unref_pipe_item(uint8_t *, void *opaque)
|
||||
{
|
||||
RedPipeItem *item = (RedPipeItem*) opaque;
|
||||
auto item = (RedPipeItem*) opaque;
|
||||
shared_ptr_unref(item);
|
||||
}
|
||||
|
||||
|
||||
@ -334,12 +334,12 @@ static ssize_t red_replay_data_chunks(SpiceReplay *replay, const char *prefix,
|
||||
|
||||
static void red_replay_data_chunks_free(SpiceReplay *replay, void *data, size_t base_size)
|
||||
{
|
||||
QXLDataChunk *cur = (QXLDataChunk *)((uint8_t*)data +
|
||||
auto cur = (QXLDataChunk *)((uint8_t*)data +
|
||||
(base_size ? base_size - sizeof(QXLDataChunk) : 0));
|
||||
|
||||
cur = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
while (cur) {
|
||||
QXLDataChunk *next = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
auto next = (QXLDataChunk*) QXLPHYSICAL_TO_PTR(cur->next_chunk);
|
||||
g_free(cur);
|
||||
cur = next;
|
||||
}
|
||||
@ -384,7 +384,7 @@ static QXLPath *red_replay_path(SpiceReplay *replay)
|
||||
|
||||
static void red_replay_path_free(SpiceReplay *replay, QXLPHYSICAL p)
|
||||
{
|
||||
QXLPath *qxl = (QXLPath*) QXLPHYSICAL_TO_PTR(p);
|
||||
auto qxl = (QXLPath*) QXLPHYSICAL_TO_PTR(p);
|
||||
|
||||
red_replay_data_chunks_free(replay, qxl, sizeof(*qxl));
|
||||
}
|
||||
@ -519,7 +519,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 = (QXLImage*) QXLPHYSICAL_TO_PTR(p);
|
||||
auto qxl = (QXLImage*) QXLPHYSICAL_TO_PTR(p);
|
||||
if (!qxl)
|
||||
return;
|
||||
|
||||
@ -884,7 +884,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 = (QXLDrawable*) replay_malloc0(replay, sizeof(QXLDrawable)); // TODO - this is too large usually
|
||||
auto qxl = (QXLDrawable*) replay_malloc0(replay, sizeof(QXLDrawable)); // TODO - this is too large usually
|
||||
int i;
|
||||
int temp;
|
||||
|
||||
@ -1024,7 +1024,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 = (QXLCompatDrawable*) replay_malloc0(replay, sizeof(QXLCompatDrawable)); // TODO - too large usually
|
||||
auto 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);
|
||||
@ -1102,7 +1102,7 @@ static QXLPHYSICAL red_replay_drawable(SpiceReplay *replay, uint32_t flags)
|
||||
|
||||
static QXLUpdateCmd *red_replay_update_cmd(SpiceReplay *replay)
|
||||
{
|
||||
QXLUpdateCmd *qxl = (QXLUpdateCmd*) replay_malloc0(replay, sizeof(QXLUpdateCmd));
|
||||
auto qxl = (QXLUpdateCmd*) replay_malloc0(replay, sizeof(QXLUpdateCmd));
|
||||
|
||||
replay_fscanf(replay, "update\n");
|
||||
red_replay_rect_ptr(replay, "area", &qxl->area);
|
||||
@ -1130,7 +1130,7 @@ static QXLSurfaceCmd *red_replay_surface_cmd(SpiceReplay *replay)
|
||||
size_t size;
|
||||
size_t read_size;
|
||||
int temp;
|
||||
QXLSurfaceCmd *qxl = (QXLSurfaceCmd*) replay_malloc0(replay, sizeof(QXLSurfaceCmd));
|
||||
auto qxl = (QXLSurfaceCmd*) replay_malloc0(replay, sizeof(QXLSurfaceCmd));
|
||||
|
||||
replay_fscanf(replay, "surface_cmd\n");
|
||||
replay_fscanf(replay, "surface_id %d\n", &qxl->surface_id);
|
||||
@ -1213,7 +1213,7 @@ static QXLCursor *red_replay_cursor(SpiceReplay *replay)
|
||||
static QXLCursorCmd *red_replay_cursor_cmd(SpiceReplay *replay)
|
||||
{
|
||||
int temp;
|
||||
QXLCursorCmd *qxl = (QXLCursorCmd*) replay_malloc0(replay, sizeof(QXLCursorCmd));
|
||||
auto qxl = (QXLCursorCmd*) replay_malloc0(replay, sizeof(QXLCursorCmd));
|
||||
|
||||
replay_fscanf(replay, "cursor_cmd\n");
|
||||
replay_fscanf(replay, "type %d\n", &temp);
|
||||
@ -1244,7 +1244,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 = (QXLCursor*) QXLPHYSICAL_TO_PTR(qxl->u.set.shape);
|
||||
auto cursor = (QXLCursor*) QXLPHYSICAL_TO_PTR(qxl->u.set.shape);
|
||||
red_replay_data_chunks_free(replay, cursor, sizeof(*cursor));
|
||||
}
|
||||
|
||||
@ -1400,22 +1400,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 = (QXLDrawable*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
auto qxl = (QXLDrawable*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_native_drawable_free(replay, qxl, cmd->flags);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_UPDATE: {
|
||||
QXLUpdateCmd *qxl = (QXLUpdateCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
auto qxl = (QXLUpdateCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
g_free(qxl);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_SURFACE: {
|
||||
QXLSurfaceCmd *qxl = (QXLSurfaceCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
auto qxl = (QXLSurfaceCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_surface_cmd_free(replay, qxl);
|
||||
break;
|
||||
}
|
||||
case QXL_CMD_CURSOR: {
|
||||
QXLCursorCmd *qxl = (QXLCursorCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
auto qxl = (QXLCursorCmd*) QXLPHYSICAL_TO_PTR(cmd->cmd.data);
|
||||
red_replay_cursor_cmd_free(replay, qxl);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -182,10 +182,10 @@ StreamDevice::handle_msg_invalid(const char *error_msg)
|
||||
write_buffer_get_server(total_size, false);
|
||||
buf->buf_used = total_size;
|
||||
|
||||
StreamDevHeader *const header = (StreamDevHeader *)buf->buf;
|
||||
auto const header = (StreamDevHeader *)buf->buf;
|
||||
fill_dev_hdr(header, STREAM_TYPE_NOTIFY_ERROR, msg_size);
|
||||
|
||||
StreamMsgNotifyError *const error = (StreamMsgNotifyError *)(header+1);
|
||||
auto const error = (StreamMsgNotifyError *)(header+1);
|
||||
error->error_code = GUINT32_TO_LE(0);
|
||||
strcpy((char *) error->msg, error_msg);
|
||||
|
||||
@ -380,7 +380,7 @@ get_cursor_type_bits(unsigned int cursor_type)
|
||||
static RedCursorCmd *
|
||||
stream_msg_cursor_set_to_cursor_cmd(const StreamMsgCursorSet *msg, size_t msg_size)
|
||||
{
|
||||
RedCursorCmd *cmd = g_new0(RedCursorCmd, 1);
|
||||
auto cmd = g_new0(RedCursorCmd, 1);
|
||||
cmd->type = QXL_CURSOR_SET;
|
||||
cmd->u.set.position.x = 0; // TODO
|
||||
cmd->u.set.position.y = 0; // TODO
|
||||
@ -477,7 +477,7 @@ StreamDevice::handle_msg_cursor_move()
|
||||
move->x = GINT32_FROM_LE(move->x);
|
||||
move->y = GINT32_FROM_LE(move->y);
|
||||
|
||||
RedCursorCmd *cmd = g_new0(RedCursorCmd, 1);
|
||||
auto cmd = g_new0(RedCursorCmd, 1);
|
||||
cmd->type = QXL_CURSOR_MOVE;
|
||||
cmd->u.position.x = move->x;
|
||||
cmd->u.position.y = move->y;
|
||||
@ -495,7 +495,7 @@ void
|
||||
StreamDevice::stream_start(void *opaque, StreamMsgStartStop *start,
|
||||
StreamChannel *stream_channel G_GNUC_UNUSED)
|
||||
{
|
||||
StreamDevice *dev = (StreamDevice *) opaque;
|
||||
auto dev = (StreamDevice *) opaque;
|
||||
|
||||
if (!dev->opened) {
|
||||
return;
|
||||
@ -508,7 +508,7 @@ StreamDevice::stream_start(void *opaque, StreamMsgStartStop *start,
|
||||
dev->write_buffer_get_server(total_size, false);
|
||||
buf->buf_used = total_size;
|
||||
|
||||
StreamDevHeader *hdr = (StreamDevHeader *)buf->buf;
|
||||
auto hdr = (StreamDevHeader *)buf->buf;
|
||||
fill_dev_hdr(hdr, STREAM_TYPE_START_STOP, msg_size);
|
||||
|
||||
memcpy(&hdr[1], start, msg_size);
|
||||
@ -520,7 +520,7 @@ void
|
||||
StreamDevice::stream_queue_stat(void *opaque, const StreamQueueStat *stats G_GNUC_UNUSED,
|
||||
StreamChannel *stream_channel G_GNUC_UNUSED)
|
||||
{
|
||||
StreamDevice *dev = (StreamDevice *) opaque;
|
||||
auto dev = (StreamDevice *) opaque;
|
||||
|
||||
if (!dev->opened) {
|
||||
return;
|
||||
@ -632,10 +632,10 @@ send_capabilities(RedCharDevice *char_dev)
|
||||
char_dev->write_buffer_get_server(total_size, false);
|
||||
buf->buf_used = total_size;
|
||||
|
||||
StreamDevHeader *const hdr = (StreamDevHeader *)buf->buf;
|
||||
auto const hdr = (StreamDevHeader *)buf->buf;
|
||||
fill_dev_hdr(hdr, STREAM_TYPE_CAPABILITIES, msg_size);
|
||||
|
||||
StreamMsgCapabilities *const caps = (StreamMsgCapabilities *)(hdr+1);
|
||||
auto const caps = (StreamMsgCapabilities *)(hdr+1);
|
||||
memset(caps, 0, msg_size);
|
||||
|
||||
char_dev->write_buffer_add(buf);
|
||||
|
||||
@ -331,8 +331,8 @@ static void flush_all_qxl_commands(RedWorker *worker)
|
||||
|
||||
static void handle_dev_update_async(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageUpdateAsync *msg = (RedWorkerMessageUpdateAsync*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageUpdateAsync*) payload;
|
||||
QXLRect *qxl_dirty_rects = NULL;
|
||||
uint32_t num_dirty_rects = 0;
|
||||
|
||||
@ -352,8 +352,8 @@ static void handle_dev_update_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_update(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageUpdate *msg = (RedWorkerMessageUpdate*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageUpdate*) payload;
|
||||
QXLRect *qxl_dirty_rects = msg->qxl_dirty_rects;
|
||||
|
||||
spice_return_if_fail(red_qxl_is_running(worker->qxl));
|
||||
@ -369,8 +369,8 @@ static void handle_dev_update(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_del_memslot(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
RedWorkerMessageDelMemslot *msg = (RedWorkerMessageDelMemslot*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageDelMemslot*) payload;
|
||||
uint32_t slot_id = msg->slot_id;
|
||||
uint32_t slot_group_id = msg->slot_group_id;
|
||||
|
||||
@ -379,8 +379,8 @@ static void handle_dev_del_memslot(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
|
||||
{
|
||||
RedWorkerMessageDestroySurfaceWait *msg = (RedWorkerMessageDestroySurfaceWait*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageDestroySurfaceWait*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
spice_return_if_fail(msg->surface_id == 0);
|
||||
|
||||
@ -390,7 +390,7 @@ static void handle_dev_destroy_surface_wait(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_destroy_surfaces(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
display_channel_destroy_surfaces(worker->display_channel);
|
||||
@ -452,8 +452,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 = (RedWorkerMessageCreatePrimarySurface*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageCreatePrimarySurface*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
dev_create_primary_surface(worker, msg->surface_id, msg->surface);
|
||||
}
|
||||
@ -482,8 +482,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 = (RedWorkerMessageDestroyPrimarySurface*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageDestroyPrimarySurface*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
uint32_t surface_id = msg->surface_id;
|
||||
|
||||
destroy_primary_surface(worker, surface_id);
|
||||
@ -491,8 +491,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 = (RedWorkerMessageDestroyPrimarySurfaceAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageDestroyPrimarySurfaceAsync*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
uint32_t surface_id = msg->surface_id;
|
||||
|
||||
destroy_primary_surface(worker, surface_id);
|
||||
@ -502,8 +502,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 = (RedWorker*) opaque;
|
||||
RedWorkerMessageFlushSurfacesAsync *msg = (RedWorkerMessageFlushSurfacesAsync*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageFlushSurfacesAsync*) payload;
|
||||
|
||||
flush_all_qxl_commands(worker);
|
||||
display_channel_flush_all_surfaces(worker->display_channel);
|
||||
@ -512,7 +512,7 @@ static void handle_dev_flush_surfaces_async(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_stop(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
spice_debug("stop");
|
||||
if (!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 = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
if (red_qxl_is_running(worker->qxl)) {
|
||||
return;
|
||||
@ -556,7 +556,7 @@ static void handle_dev_start(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_wakeup(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
stat_inc_counter(worker->wakeup_counter, 1);
|
||||
red_qxl_clear_pending(worker->qxl->st, RED_DISPATCHER_PENDING_WAKEUP);
|
||||
@ -564,7 +564,7 @@ static void handle_dev_wakeup(void *opaque, void *payload)
|
||||
|
||||
static void handle_dev_oom(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
DisplayChannel *display = worker->display_channel;
|
||||
|
||||
int ring_is_empty;
|
||||
@ -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 = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
worker->cursor_channel->reset();
|
||||
}
|
||||
|
||||
static void handle_dev_reset_image_cache(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorkerMessageDestroySurfaceWaitAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageDestroySurfaceWaitAsync*) payload;
|
||||
auto 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 = (RedWorker*) opaque;
|
||||
RedWorkerMessageDestroySurfacesAsync *msg = (RedWorkerMessageDestroySurfacesAsync*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorkerMessageCreatePrimarySurfaceAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageCreatePrimarySurfaceAsync*) payload;
|
||||
auto 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 = (RedWorkerMessageMonitorsConfigAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageMonitorsConfigAsync*) payload;
|
||||
auto 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 = (RedWorkerMessageSetCompression*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageSetCompression*) payload;
|
||||
auto 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 = (RedWorkerMessageSetStreamingVideo*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageSetStreamingVideo*) payload;
|
||||
auto 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 = (RedWorkerMessageSetVideoCodecs*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageSetVideoCodecs*) payload;
|
||||
auto 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 = (RedWorkerMessageSetMouseMode*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageSetMouseMode*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
spice_debug("mouse mode %u", msg->mode);
|
||||
worker->cursor_channel->set_mouse_mode(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 = (RedWorker*) opaque;
|
||||
RedWorkerMessageAddMemslot *msg = (RedWorkerMessageAddMemslot*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorkerMessageAddMemslotAsync*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageAddMemslotAsync*) payload;
|
||||
auto 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 = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
memslot_info_reset(&worker->mem_slots);
|
||||
}
|
||||
|
||||
static void handle_dev_driver_unload(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorker*) opaque;
|
||||
RedWorkerMessageGlDraw *draw = (RedWorkerMessageGlDraw*) payload;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
auto draw = (RedWorkerMessageGlDraw*) payload;
|
||||
|
||||
display_channel_gl_draw(worker->display_channel, &draw->draw);
|
||||
}
|
||||
|
||||
static void handle_dev_close(void *opaque, void *payload)
|
||||
{
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto 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 = (RedWorkerMessageLoadvmCommands*) payload;
|
||||
RedWorker *worker = (RedWorker*) opaque;
|
||||
auto msg = (RedWorkerMessageLoadvmCommands*) payload;
|
||||
auto 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 = (RedWorker*) opaque;
|
||||
auto worker = (RedWorker*) opaque;
|
||||
|
||||
red_record_event(worker->record, 1, message_type);
|
||||
}
|
||||
@ -1085,7 +1085,7 @@ RedWorker* red_worker_new(QXLInstance *qxl)
|
||||
|
||||
static void *red_worker_main(void *arg)
|
||||
{
|
||||
RedWorker *worker = (RedWorker *) arg;
|
||||
auto worker = (RedWorker *) arg;
|
||||
|
||||
spice_debug("begin");
|
||||
#if defined(__APPLE__)
|
||||
|
||||
@ -453,7 +453,7 @@ static RedCharDeviceWriteBuffer *vdagent_new_write_buffer(RedCharDeviceVDIPort *
|
||||
}
|
||||
|
||||
char_dev_buf->buf_used = total_msg_size;
|
||||
VDInternalBuf *internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
auto internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
internal_buf->chunk_header.port = VDP_SERVER_PORT;
|
||||
internal_buf->chunk_header.size = sizeof(VDAgentMessage) + size;
|
||||
internal_buf->header.protocol = VD_AGENT_PROTOCOL;
|
||||
@ -505,7 +505,7 @@ void reds_client_disconnect(RedsState *reds, RedClient *client)
|
||||
|
||||
/* note that client might be NULL, if the vdagent was once
|
||||
* up and than was removed */
|
||||
RedCharDeviceClientOpaque *client_opaque = (RedCharDeviceClientOpaque *) client;
|
||||
auto client_opaque = (RedCharDeviceClientOpaque *) client;
|
||||
if (reds->agent_dev->client_exists(client_opaque)) {
|
||||
reds->agent_dev->client_remove(client_opaque);
|
||||
}
|
||||
@ -868,7 +868,7 @@ void reds_send_device_display_info(RedsState *reds)
|
||||
return;
|
||||
}
|
||||
|
||||
VDInternalBuf *internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
auto internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
|
||||
int free_info;
|
||||
size_t len_info;
|
||||
@ -887,15 +887,15 @@ void reds_send_device_display_info(RedsState *reds)
|
||||
/* after calling this, we unref the message, and the ref is in the instance side */
|
||||
void RedCharDeviceVDIPort::send_msg_to_client(RedPipeItem *msg, RedCharDeviceClientOpaque *opaque)
|
||||
{
|
||||
RedClient *client = (RedClient *) opaque;
|
||||
RedVDIReadBuf *agent_data_buf = static_cast<RedVDIReadBuf*>(msg);
|
||||
auto client = (RedClient *) opaque;
|
||||
auto agent_data_buf = static_cast<RedVDIReadBuf*>(msg);
|
||||
|
||||
client->get_main()->push_agent_data(red::shared_ptr<RedAgentDataPipeItem>(agent_data_buf));
|
||||
}
|
||||
|
||||
void RedCharDeviceVDIPort::send_tokens_to_client(RedCharDeviceClientOpaque *opaque, uint32_t tokens)
|
||||
{
|
||||
RedClient *client = (RedClient *) opaque;
|
||||
auto client = (RedClient *) opaque;
|
||||
client->get_main()->push_agent_tokens(tokens);
|
||||
}
|
||||
|
||||
@ -916,7 +916,7 @@ void RedCharDeviceVDIPort::on_free_self_token()
|
||||
|
||||
void RedCharDeviceVDIPort::remove_client(RedCharDeviceClientOpaque *opaque)
|
||||
{
|
||||
RedClient *client = (RedClient *) opaque;
|
||||
auto client = (RedClient *) opaque;
|
||||
client->get_main()->shutdown();
|
||||
}
|
||||
|
||||
@ -945,7 +945,7 @@ void reds_handle_agent_mouse_event(RedsState *reds, const VDAgentMouseState *mou
|
||||
|
||||
reds->pending_mouse_event = FALSE;
|
||||
|
||||
VDInternalBuf *internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
auto internal_buf = (VDInternalBuf *)char_dev_buf->buf;
|
||||
internal_buf->u.mouse_state = *mouse_state;
|
||||
|
||||
reds->agent_dev->write_buffer_add(char_dev_buf);
|
||||
@ -1020,7 +1020,7 @@ void reds_on_main_agent_start(RedsState *reds, MainChannelClient *mcc, uint32_t
|
||||
* and vice versa, the sending from the server to the client won't have
|
||||
* flow control, but will have no other problem.
|
||||
*/
|
||||
RedCharDeviceClientOpaque *client_opaque = (RedCharDeviceClientOpaque *) client;
|
||||
auto client_opaque = (RedCharDeviceClientOpaque *) client;
|
||||
if (!dev_state->client_exists(client_opaque)) {
|
||||
int client_added;
|
||||
|
||||
@ -1463,7 +1463,7 @@ bool reds_handle_migrate_data(RedsState *reds, MainChannelClient *mcc,
|
||||
} else {
|
||||
spice_debug("agent was not attached on the source host");
|
||||
if (reds->vdagent) {
|
||||
RedCharDeviceClientOpaque *client_opaque =
|
||||
auto client_opaque =
|
||||
(RedCharDeviceClientOpaque *) mcc->get_client();
|
||||
/* red_char_device_client_remove disables waiting for migration data */
|
||||
agent_dev->client_remove(client_opaque);
|
||||
@ -1487,7 +1487,7 @@ static void reds_channel_init_auth_caps(RedLinkInfo *link, RedChannel *channel)
|
||||
|
||||
static const uint32_t *red_link_info_get_caps(const RedLinkInfo *link)
|
||||
{
|
||||
const uint8_t *caps_start = (const uint8_t *)link->link_mess;
|
||||
const auto caps_start = (const uint8_t *)link->link_mess;
|
||||
|
||||
return (const uint32_t *)(caps_start + link->link_mess->caps_offset);
|
||||
}
|
||||
@ -1657,7 +1657,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 = (RedsMigTargetClient*) l->data;
|
||||
auto mig_client = (RedsMigTargetClient*) l->data;
|
||||
|
||||
if (mig_client->client == client) {
|
||||
return mig_client;
|
||||
@ -1890,7 +1890,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 = (RedsMigPendingLink*) item->data;
|
||||
auto mig_link = (RedsMigPendingLink*) item->data;
|
||||
RedChannel *channel;
|
||||
|
||||
channel = reds_find_channel(reds, mig_link->link_msg->channel_type,
|
||||
@ -2018,7 +2018,7 @@ static void reds_handle_link(RedLinkInfo *link)
|
||||
|
||||
static void reds_handle_ticket(void *opaque)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
RedsState *reds = link->reds;
|
||||
char *password;
|
||||
int password_size;
|
||||
@ -2113,7 +2113,7 @@ static void reds_start_auth_sasl(RedLinkInfo *link)
|
||||
|
||||
static void reds_handle_auth_mechanism(void *opaque)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
RedsState *reds = link->reds;
|
||||
|
||||
spice_debug("Auth method: %d", link->auth_mechanism.auth_mechanism);
|
||||
@ -2149,7 +2149,7 @@ static int reds_security_check(RedLinkInfo *link)
|
||||
|
||||
static void reds_handle_read_link_done(void *opaque)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
RedsState *reds = link->reds;
|
||||
SpiceLinkMess *link_mess = link->link_mess;
|
||||
uint32_t num_caps;
|
||||
@ -2223,7 +2223,7 @@ static void reds_handle_read_link_done(void *opaque)
|
||||
|
||||
static void reds_handle_link_error(void *opaque, int err)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
switch (err) {
|
||||
case 0:
|
||||
case EPIPE:
|
||||
@ -2238,7 +2238,7 @@ static void reds_handle_link_error(void *opaque, int err)
|
||||
static void reds_handle_new_link(RedLinkInfo *link);
|
||||
static void reds_handle_read_header_done(void *opaque)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
SpiceLinkHeader *header = &link->link_header;
|
||||
|
||||
header->major_version = GUINT32_FROM_LE(header->major_version);
|
||||
@ -2274,7 +2274,7 @@ static void reds_handle_read_header_done(void *opaque)
|
||||
|
||||
static void reds_handle_read_magic_done(void *opaque)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)opaque;
|
||||
auto link = (RedLinkInfo *)opaque;
|
||||
const SpiceLinkHeader *header = &link->link_header;
|
||||
|
||||
if (header->magic != SPICE_MAGIC) {
|
||||
@ -2314,7 +2314,7 @@ static void reds_handle_new_link(RedLinkInfo *link)
|
||||
|
||||
static void reds_handle_ssl_accept(int fd, int event, void *data)
|
||||
{
|
||||
RedLinkInfo *link = (RedLinkInfo *)data;
|
||||
auto link = (RedLinkInfo *)data;
|
||||
RedStreamSslStatus return_code = red_stream_ssl_accept(link->stream);
|
||||
|
||||
switch (return_code) {
|
||||
@ -2404,7 +2404,7 @@ error:
|
||||
|
||||
static void reds_accept_ssl_connection(int fd, int event, void *data)
|
||||
{
|
||||
RedsState *reds = (RedsState*) data;
|
||||
auto reds = (RedsState*) data;
|
||||
RedLinkInfo *link;
|
||||
int socket;
|
||||
|
||||
@ -2421,7 +2421,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 = (RedsState*) data;
|
||||
auto reds = (RedsState*) data;
|
||||
int socket;
|
||||
|
||||
if ((socket = accept(fd, NULL, 0)) == -1) {
|
||||
@ -2674,7 +2674,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 = (RedsState*) userdata;
|
||||
auto reds = (RedsState*) userdata;
|
||||
char *pass = reds->config->ssl_parameters.keyfile_password;
|
||||
int len = g_strlcpy(buf, pass, size);
|
||||
if (len >= size) {
|
||||
@ -2837,7 +2837,7 @@ SPICE_DESTRUCTOR_FUNC(reds_exit)
|
||||
|
||||
pthread_mutex_lock(&global_reds_lock);
|
||||
for (l = servers; l != NULL; l = l->next) {
|
||||
RedsState *reds = (RedsState*) l->data;
|
||||
auto reds = (RedsState*) l->data;
|
||||
reds_cleanup(reds);
|
||||
}
|
||||
pthread_mutex_unlock(&global_reds_lock);
|
||||
@ -3047,7 +3047,7 @@ attach_to_red_agent(RedsState *reds, SpiceCharDeviceInstance *sin)
|
||||
* 2.b If this happens second ==> we already have spice migrate data
|
||||
* then restore state
|
||||
*/
|
||||
RedCharDeviceClientOpaque *client_opaque =
|
||||
auto client_opaque =
|
||||
(RedCharDeviceClientOpaque *) reds_get_client(reds);
|
||||
if (!dev->client_exists(client_opaque)) {
|
||||
int client_added;
|
||||
@ -3438,7 +3438,7 @@ static const char default_video_codecs[] = "spice:mjpeg;" GSTREAMER_CODECS;
|
||||
SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
|
||||
{
|
||||
const char *record_filename;
|
||||
RedsState *reds = new RedsState;
|
||||
auto reds = new RedsState;
|
||||
|
||||
reds->config = g_new0(RedServerConfig, 1);
|
||||
reds->config->default_channel_security =
|
||||
|
||||
@ -252,7 +252,7 @@ static void snd_playback_free_frame(PlaybackChannelClient *playback_client, Audi
|
||||
|
||||
void PlaybackChannelClient::on_message_marshalled(uint8_t *, void *opaque)
|
||||
{
|
||||
PlaybackChannelClient *client = reinterpret_cast<PlaybackChannelClient*>(opaque);
|
||||
auto client = reinterpret_cast<PlaybackChannelClient*>(opaque);
|
||||
|
||||
if (client->in_progress) {
|
||||
snd_playback_free_frame(client, client->in_progress);
|
||||
@ -335,7 +335,7 @@ bool RecordChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
case SPICE_MSGC_RECORD_DATA:
|
||||
return snd_record_handle_write(this, size, message);
|
||||
case SPICE_MSGC_RECORD_MODE: {
|
||||
SpiceMsgcRecordMode *msg_mode = (SpiceMsgcRecordMode *)message;
|
||||
auto msg_mode = (SpiceMsgcRecordMode *)message;
|
||||
SndChannel *channel = get_channel();
|
||||
mode_time = msg_mode->time;
|
||||
if (msg_mode->mode != SPICE_AUDIO_DATA_MODE_RAW) {
|
||||
@ -362,7 +362,7 @@ bool RecordChannelClient::handle_message(uint16_t type, uint32_t size, void *mes
|
||||
}
|
||||
|
||||
case SPICE_MSGC_RECORD_START_MARK: {
|
||||
SpiceMsgcRecordStartMark *mark = (SpiceMsgcRecordStartMark *)message;
|
||||
auto mark = (SpiceMsgcRecordStartMark *)message;
|
||||
start_time = mark->time;
|
||||
break;
|
||||
}
|
||||
@ -941,13 +941,13 @@ void snd_set_playback_latency(RedClient *client, uint32_t latency)
|
||||
GList *l;
|
||||
|
||||
for (l = snd_channels; l != NULL; l = l->next) {
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
auto now = (SndChannel*) l->data;
|
||||
SndChannelClient *scc = snd_channel_get_client(now);
|
||||
if (now->type() == SPICE_CHANNEL_PLAYBACK && scc &&
|
||||
scc->get_client() == client) {
|
||||
|
||||
if (scc->test_remote_cap(SPICE_PLAYBACK_CAP_LATENCY)) {
|
||||
PlaybackChannelClient* playback = (PlaybackChannelClient*)scc;
|
||||
auto playback = (PlaybackChannelClient*)scc;
|
||||
|
||||
playback->latency = latency;
|
||||
snd_set_command(scc, SND_PLAYBACK_LATENCY_MASK);
|
||||
@ -1277,7 +1277,7 @@ void snd_set_playback_compression(bool on)
|
||||
GList *l;
|
||||
|
||||
for (l = snd_channels; l != NULL; l = l->next) {
|
||||
SndChannel *now = (SndChannel*) l->data;
|
||||
auto now = (SndChannel*) l->data;
|
||||
SndChannelClient *client = snd_channel_get_client(now);
|
||||
if (now->type() == SPICE_CHANNEL_PLAYBACK && client) {
|
||||
PlaybackChannelClient* playback = PLAYBACK_CHANNEL_CLIENT(client);
|
||||
|
||||
@ -283,7 +283,7 @@ static void spicevmc_port_send_event(RedChannelClient *rcc, uint8_t event)
|
||||
|
||||
void RedCharDeviceSpiceVmc::remove_client(RedCharDeviceClientOpaque *opaque)
|
||||
{
|
||||
RedClient *client = (RedClient *) opaque;
|
||||
auto client = (RedClient *) opaque;
|
||||
|
||||
spice_assert(channel->rcc &&
|
||||
channel->rcc->get_client() == client);
|
||||
@ -480,7 +480,7 @@ static void spicevmc_red_channel_send_data(VmcChannelClient *rcc,
|
||||
SpiceMarshaller *m,
|
||||
RedPipeItem *item)
|
||||
{
|
||||
RedVmcPipeItem *i = static_cast<RedVmcPipeItem*>(item);
|
||||
auto i = static_cast<RedVmcPipeItem*>(item);
|
||||
RedVmcChannel *channel = rcc->get_channel();
|
||||
|
||||
/* for compatibility send using not compressed data message */
|
||||
@ -524,7 +524,7 @@ static void spicevmc_red_channel_send_port_init(RedChannelClient *rcc,
|
||||
SpiceMarshaller *m,
|
||||
RedPipeItem *item)
|
||||
{
|
||||
RedPortInitPipeItem *i = static_cast<RedPortInitPipeItem*>(item);
|
||||
auto i = static_cast<RedPortInitPipeItem*>(item);
|
||||
SpiceMsgPortInit init;
|
||||
|
||||
rcc->init_send_data(SPICE_MSG_PORT_INIT);
|
||||
@ -538,7 +538,7 @@ static void spicevmc_red_channel_send_port_event(RedChannelClient *rcc,
|
||||
SpiceMarshaller *m,
|
||||
RedPipeItem *item)
|
||||
{
|
||||
RedPortEventPipeItem *i = static_cast<RedPortEventPipeItem*>(item);
|
||||
auto i = static_cast<RedPortEventPipeItem*>(item);
|
||||
SpiceMsgPortEvent event;
|
||||
|
||||
rcc->init_send_data(SPICE_MSG_PORT_EVENT);
|
||||
|
||||
@ -210,7 +210,7 @@ void StreamChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
break;
|
||||
}
|
||||
case RED_PIPE_ITEM_TYPE_STREAM_CREATE: {
|
||||
StreamCreateItem *item = static_cast<StreamCreateItem*>(pipe_item);
|
||||
auto item = static_cast<StreamCreateItem*>(pipe_item);
|
||||
stream_id = item->stream_create.id;
|
||||
init_send_data(SPICE_MSG_DISPLAY_STREAM_CREATE);
|
||||
spice_marshall_msg_display_stream_create(m, &item->stream_create);
|
||||
@ -231,7 +231,7 @@ void StreamChannelClient::send_item(RedPipeItem *pipe_item)
|
||||
break;
|
||||
}
|
||||
case RED_PIPE_ITEM_TYPE_STREAM_DATA: {
|
||||
StreamDataItem *item = static_cast<StreamDataItem*>(pipe_item);
|
||||
auto item = static_cast<StreamDataItem*>(pipe_item);
|
||||
init_send_data(SPICE_MSG_DISPLAY_STREAM_DATA);
|
||||
spice_marshall_msg_display_stream_data(m, &item->data);
|
||||
pipe_item->add_to_marshaller(m, item->data.data, item->data.data_size);
|
||||
@ -465,7 +465,7 @@ StreamChannel::send_data(const void *data, size_t size, uint32_t mm_time)
|
||||
return;
|
||||
}
|
||||
|
||||
StreamDataItem *item = new (size) StreamDataItem();
|
||||
auto item = new (size) StreamDataItem();
|
||||
item->data.base.id = stream_id;
|
||||
item->data.base.multi_media_time = mm_time;
|
||||
item->data.data_size = size;
|
||||
|
||||
@ -137,7 +137,7 @@ static SpiceTimer *waked_up_timer;
|
||||
// timer waiting we get data again
|
||||
static void timer_wakeup(void *opaque)
|
||||
{
|
||||
SpiceCoreInterface *core = (SpiceCoreInterface*) opaque;
|
||||
auto core = (SpiceCoreInterface*) opaque;
|
||||
|
||||
// check we are receiving data again
|
||||
size_t got_data = 0;
|
||||
@ -159,7 +159,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 = (SpiceCoreInterface*) opaque;
|
||||
auto core = (SpiceCoreInterface*) opaque;
|
||||
|
||||
// get all pending data
|
||||
alarm(1);
|
||||
|
||||
@ -65,7 +65,7 @@ static void test_spice_destroy_update(SimpleSpiceUpdate *update)
|
||||
return;
|
||||
}
|
||||
if (update->drawable.clip.type != SPICE_CLIP_TYPE_NONE) {
|
||||
uint8_t *ptr = (uint8_t*)(uintptr_t)update->drawable.clip.data;
|
||||
auto ptr = (uint8_t*)(uintptr_t)update->drawable.clip.data;
|
||||
g_free(ptr);
|
||||
}
|
||||
g_free(update->bitmap);
|
||||
@ -357,7 +357,7 @@ static int format_to_bpp(int format)
|
||||
|
||||
static SimpleSurfaceCmd *create_surface(int surface_id, int format, int width, int height, uint8_t *data)
|
||||
{
|
||||
SimpleSurfaceCmd *simple_cmd = g_new0(SimpleSurfaceCmd, 1);
|
||||
auto simple_cmd = g_new0(SimpleSurfaceCmd, 1);
|
||||
QXLSurfaceCmd *surface_cmd = &simple_cmd->surface_cmd;
|
||||
int bpp = format_to_bpp(format);
|
||||
|
||||
@ -376,7 +376,7 @@ static SimpleSurfaceCmd *create_surface(int surface_id, int format, int width, i
|
||||
|
||||
static SimpleSurfaceCmd *destroy_surface(int surface_id)
|
||||
{
|
||||
SimpleSurfaceCmd *simple_cmd = g_new0(SimpleSurfaceCmd, 1);
|
||||
auto simple_cmd = g_new0(SimpleSurfaceCmd, 1);
|
||||
QXLSurfaceCmd *surface_cmd = &simple_cmd->surface_cmd;
|
||||
|
||||
set_cmd(&simple_cmd->ext, QXL_CMD_SURFACE, (intptr_t)surface_cmd);
|
||||
@ -637,7 +637,7 @@ static int req_cmd_notification(QXLInstance *qin)
|
||||
|
||||
static void do_wakeup(void *opaque)
|
||||
{
|
||||
Test *test = (Test*) opaque;
|
||||
auto test = (Test*) opaque;
|
||||
int notify;
|
||||
|
||||
test->cursor_notify = NOTIFY_CURSOR_BATCH;
|
||||
@ -654,7 +654,7 @@ static void do_wakeup(void *opaque)
|
||||
static void release_resource(SPICE_GNUC_UNUSED QXLInstance *qin,
|
||||
struct QXLReleaseInfoExt release_info)
|
||||
{
|
||||
QXLCommandExt *ext = (QXLCommandExt*)(uintptr_t)release_info.info->id;
|
||||
auto ext = (QXLCommandExt*)(uintptr_t)release_info.info->id;
|
||||
//printf("%s\n", __func__);
|
||||
spice_assert(release_info.group_id == MEM_SLOT_GROUP_ID);
|
||||
switch (ext->cmd.type) {
|
||||
@ -665,7 +665,7 @@ static void release_resource(SPICE_GNUC_UNUSED QXLInstance *qin,
|
||||
g_free(ext);
|
||||
break;
|
||||
case QXL_CMD_CURSOR: {
|
||||
QXLCursorCmd *cmd = (QXLCursorCmd *)(uintptr_t)ext->cmd.data;
|
||||
auto cmd = (QXLCursorCmd *)(uintptr_t)ext->cmd.data;
|
||||
if (cmd->type == QXL_CURSOR_SET || cmd->type == QXL_CURSOR_MOVE) {
|
||||
g_free(cmd);
|
||||
}
|
||||
@ -914,7 +914,7 @@ static gboolean ignore_in_use_failures(const gchar *log_domain,
|
||||
|
||||
Test* test_new(SpiceCoreInterface* core)
|
||||
{
|
||||
Test *test = g_new0(Test, 1);
|
||||
auto test = g_new0(Test, 1);
|
||||
int port = -1;
|
||||
|
||||
test->qxl_instance.base.sif = &display_sif.base;
|
||||
|
||||
@ -309,7 +309,7 @@ static void test_stream_device_format_after_data(TestFixture *fixture, gconstpoi
|
||||
// check empty message
|
||||
static void test_stream_device_empty(TestFixture *fixture, gconstpointer user_data)
|
||||
{
|
||||
const StreamMsgType msg_type = (StreamMsgType) GPOINTER_TO_INT(user_data);
|
||||
const auto msg_type = (StreamMsgType) GPOINTER_TO_INT(user_data);
|
||||
uint8_t *p = vmc->message;
|
||||
|
||||
// add some messages into device buffer
|
||||
|
||||
@ -84,7 +84,7 @@ static const SpiceCharDeviceInterface vmc_interface = {
|
||||
|
||||
VmcEmu *vmc_emu_new(const char *subtype, const char *portname)
|
||||
{
|
||||
VmcEmu *vmc = g_new0(VmcEmu, 1);
|
||||
auto vmc = g_new0(VmcEmu, 1);
|
||||
vmc->vmc_interface = vmc_interface;
|
||||
vmc->instance.base.sif = &vmc->vmc_interface.base;
|
||||
vmc->instance.subtype = g_strdup(subtype);
|
||||
|
||||
@ -114,7 +114,7 @@ struct DumpItem {
|
||||
|
||||
static void dump_item(TreeItem *item, void *data)
|
||||
{
|
||||
DumpItem *di = (DumpItem*) data;
|
||||
auto di = (DumpItem*) data;
|
||||
const char *item_prefix = "|--";
|
||||
int i;
|
||||
|
||||
@ -193,7 +193,7 @@ Shadow* shadow_new(DrawItem *item, const SpicePoint *delta)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Shadow *shadow = g_new(Shadow, 1);
|
||||
auto shadow = g_new(Shadow, 1);
|
||||
|
||||
shadow->base.type = TREE_ITEM_TYPE_SHADOW;
|
||||
shadow->base.container = NULL;
|
||||
@ -213,7 +213,7 @@ Shadow* shadow_new(DrawItem *item, const SpicePoint *delta)
|
||||
* container */
|
||||
Container* container_new(DrawItem *item)
|
||||
{
|
||||
Container *container = g_new(Container, 1);
|
||||
auto container = g_new(Container, 1);
|
||||
|
||||
container->base.type = TREE_ITEM_TYPE_CONTAINER;
|
||||
container->base.container = item->base.container;
|
||||
@ -246,7 +246,7 @@ void container_cleanup(Container *container)
|
||||
Container *next = container->base.container;
|
||||
if (container->items.next != &container->items) {
|
||||
SPICE_VERIFY(SPICE_OFFSETOF(TreeItem, siblings_link) == 0);
|
||||
TreeItem *item = (TreeItem *)ring_get_head(&container->items);
|
||||
auto item = (TreeItem *)ring_get_head(&container->items);
|
||||
spice_assert(item);
|
||||
ring_remove(&item->siblings_link);
|
||||
ring_add_after(&item->siblings_link, &container->base.siblings_link);
|
||||
|
||||
@ -341,7 +341,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 = (RedDrawablePipeItem*) dpi_link->data;
|
||||
auto dpi = (RedDrawablePipeItem*) dpi_link->data;
|
||||
dpi_next = dpi_link->next;
|
||||
dcc = dpi->dcc;
|
||||
agent = dcc_get_video_stream_agent(dcc, index);
|
||||
@ -649,7 +649,7 @@ static uint64_t get_initial_bit_rate(DisplayChannelClient *dcc, VideoStream *str
|
||||
|
||||
static uint32_t get_roundtrip_ms(void *opaque)
|
||||
{
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
auto agent = (VideoStreamAgent*) opaque;
|
||||
int roundtrip;
|
||||
RedChannelClient *rcc = agent->dcc;
|
||||
|
||||
@ -670,14 +670,14 @@ static uint32_t get_roundtrip_ms(void *opaque)
|
||||
|
||||
static uint32_t get_source_fps(void *opaque)
|
||||
{
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
auto agent = (VideoStreamAgent*) opaque;
|
||||
|
||||
return agent->stream->input_fps;
|
||||
}
|
||||
|
||||
static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
|
||||
{
|
||||
VideoStreamAgent *agent = (VideoStreamAgent*) opaque;
|
||||
auto agent = (VideoStreamAgent*) opaque;
|
||||
DisplayChannelClient *dcc = agent->dcc;
|
||||
RedClient *client = dcc->get_client();
|
||||
RedsState *reds = client->get_server();
|
||||
@ -694,13 +694,13 @@ static void update_client_playback_delay(void *opaque, uint32_t delay_ms)
|
||||
|
||||
static void bitmap_ref(gpointer data)
|
||||
{
|
||||
RedDrawable *red_drawable = (RedDrawable*)data;
|
||||
auto red_drawable = (RedDrawable*)data;
|
||||
red_drawable_ref(red_drawable);
|
||||
}
|
||||
|
||||
static void bitmap_unref(gpointer data)
|
||||
{
|
||||
RedDrawable *red_drawable = (RedDrawable*)data;
|
||||
auto red_drawable = (RedDrawable*)data;
|
||||
red_drawable_unref(red_drawable);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user