summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2014-12-10 17:26:04 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2014-12-15 12:02:24 +0100
commita19867e7137860efa6c2569b3da3845081698223 (patch)
treebf76d135bd7f07e53f2f079181e60b003cb3dad1
parent0d35c3e9302308390262252e3a793d9431f31090 (diff)
inputs: Remove unneeded variable
inputs_channel_handle_parsed() is casting its void * argument to a uint8_t * buf before recasting this 'buf' variable to different other types. This intermediate 'buf' variable is not needed, especially as we can then benefit from implicit casts from void * to the type we need.
-rw-r--r--server/inputs_channel.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index 5059e98..b0ba1d6 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -325,13 +325,12 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
{
InputsChannel *inputs_channel = (InputsChannel *)rcc->channel;
InputsChannelClient *icc = (InputsChannelClient *)rcc;
- uint8_t *buf = (uint8_t *)message;
uint32_t i;
spice_assert(g_inputs_channel == inputs_channel);
switch (type) {
case SPICE_MSGC_INPUTS_KEY_DOWN: {
- SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
+ SpiceMsgcKeyDown *key_down = message;
if (key_down->code == CAPS_LOCK_SCAN_CODE ||
key_down->code == NUM_LOCK_SCAN_CODE ||
key_down->code == SCROLL_LOCK_SCAN_CODE) {
@@ -339,7 +338,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
}
}
case SPICE_MSGC_INPUTS_KEY_UP: {
- SpiceMsgcKeyUp *key_up = (SpiceMsgcKeyUp *)buf;
+ SpiceMsgcKeyUp *key_up = message;
for (i = 0; i < 4; i++) {
uint8_t code = (key_up->code >> (i * 8)) & 0xff;
if (code == 0) {
@@ -350,14 +349,14 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
break;
}
case SPICE_MSGC_INPUTS_KEY_SCANCODE: {
- uint8_t *code = (uint8_t *)buf;
+ uint8_t *code = message;
for (i = 0; i < size; i++) {
kbd_push_scan(keyboard, code[i]);
}
break;
}
case SPICE_MSGC_INPUTS_MOUSE_MOTION: {
- SpiceMsgcMouseMotion *mouse_motion = (SpiceMsgcMouseMotion *)buf;
+ SpiceMsgcMouseMotion *mouse_motion = message;
if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
!g_inputs_channel->src_during_migrate) {
@@ -374,7 +373,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
break;
}
case SPICE_MSGC_INPUTS_MOUSE_POSITION: {
- SpiceMsgcMousePosition *pos = (SpiceMsgcMousePosition *)buf;
+ SpiceMsgcMousePosition *pos = message;
if (++icc->motion_count % SPICE_INPUT_MOTION_ACK_BUNCH == 0 &&
!g_inputs_channel->src_during_migrate) {
@@ -400,7 +399,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
break;
}
case SPICE_MSGC_INPUTS_MOUSE_PRESS: {
- SpiceMsgcMousePress *mouse_press = (SpiceMsgcMousePress *)buf;
+ SpiceMsgcMousePress *mouse_press = message;
int dz = 0;
if (mouse_press->button == SPICE_MOUSE_BUTTON_UP) {
dz = -1;
@@ -428,7 +427,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
break;
}
case SPICE_MSGC_INPUTS_MOUSE_RELEASE: {
- SpiceMsgcMouseRelease *mouse_release = (SpiceMsgcMouseRelease *)buf;
+ SpiceMsgcMouseRelease *mouse_release = message;
if (reds_get_mouse_mode() == SPICE_MOUSE_MODE_CLIENT) {
if (reds_get_agent_mouse() && reds_has_vdagent()) {
inputs_channel->mouse_state.buttons =
@@ -448,7 +447,7 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
break;
}
case SPICE_MSGC_INPUTS_KEY_MODIFIERS: {
- SpiceMsgcKeyModifiers *modifiers = (SpiceMsgcKeyModifiers *)buf;
+ SpiceMsgcKeyModifiers *modifiers = message;
uint8_t leds;
if (!keyboard) {