[Spice-devel] [PATCH 5/7] spice-ppc: avoid casts to lessers types!

Erlon Cruz sombrafam at gmail.com
Tue Aug 7 11:43:12 PDT 2012


From: Fabiano Fidêncio <fabiano at fidencio.org>

    It's breaking PPC's keyboard functionality, once this cast is
    getting the first byte (from left to right) on any architecture,
    what's wrong when we think in a PPC (we should get the last one,
    instead).

Signed-off-by: Erlon R. Cruz <erlon.cruz at br.flextronics.com>
Signed-off-by: Fabiano Fidêncio <Fabiano.Fidêncio at fit-tecnologia.org.br>
Signed-off-by: Rafael F. Santos <Rafael.Santos at fit-tecnologia.org.br>

---
 server/inputs_channel.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/server/inputs_channel.c b/server/inputs_channel.c
index e14e995..015f7b5 100644
--- a/server/inputs_channel.c
+++ b/server/inputs_channel.c
@@ -289,7 +289,7 @@ 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 *buf = message;
 
     spice_assert(g_inputs_channel == inputs_channel);
     switch (type) {
@@ -302,8 +302,8 @@ static int inputs_channel_handle_parsed(RedChannelClient *rcc, uint32_t size, ui
     }
     case SPICE_MSGC_INPUTS_KEY_UP: {
         SpiceMsgcKeyDown *key_down = (SpiceMsgcKeyDown *)buf;
-        uint8_t *now = (uint8_t *)&key_down->code;
-        uint8_t *end = now + sizeof(key_down->code);
+        uint32_t *now = &key_down->code;
+        uint32_t *end = now + sizeof(key_down->code);
         for (; now < end && *now; now++) {
             kbd_push_scan(keyboard, *now);
         }
-- 
1.7.4.1



More information about the Spice-devel mailing list