Hopefully this will help with some of the keycode problems that have
been reported. Please let me know if this helps for you.
Thanks to Eduardo Felipe for spotting this.
Regards,
Anthony Liguori
# HG changeset patch
# User Anthony Liguori <[EMAIL PROTECTED]>
# Date 1154483284 18000
# Node ID 7fd54fda0e694562d0f0574da3208f4f7c8e28ff
# Parent b790da7061d1bde769ee2103faaff8f14ce6f489
Use unsigned types to avoid sign extension
diff -r b790da7061d1 -r 7fd54fda0e69 vnc.c
--- a/vnc.c Tue Aug 01 21:21:11 2006 +0000
+++ b/vnc.c Tue Aug 01 20:48:04 2006 -0500
@@ -622,7 +622,7 @@ static void vnc_write_u32(VncState *vs,
static void vnc_write_u16(VncState *vs, uint16_t value)
{
- char buf[2];
+ uint8_t buf[2];
buf[0] = (value >> 8) & 0xFF;
buf[1] = value & 0xFF;
@@ -643,24 +643,28 @@ static void vnc_flush(VncState *vs)
static uint8_t read_u8(char *data, size_t offset)
{
- return data[offset];
+ uint8_t *ptr = (uint8_t *)data;
+ return ptr[offset];
}
static uint16_t read_u16(char *data, size_t offset)
{
- return ((data[offset] & 0xFF) << 8) | (data[offset + 1] & 0xFF);
+ uint8_t *ptr = (uint8_t *)data;
+ return ((ptr[offset] & 0xFF) << 8) | (ptr[offset + 1] & 0xFF);
}
static int32_t read_s32(char *data, size_t offset)
{
- return (int32_t)((data[offset] << 24) | (data[offset + 1] << 16) |
- (data[offset + 2] << 8) | data[offset + 3]);
+ uint8_t *ptr = (uint8_t *)data;
+ return (int32_t)((ptr[offset] << 24) | (ptr[offset + 1] << 16) |
+ (ptr[offset + 2] << 8) | ptr[offset + 3]);
}
static uint32_t read_u32(char *data, size_t offset)
{
- return ((data[offset] << 24) | (data[offset + 1] << 16) |
- (data[offset + 2] << 8) | data[offset + 3]);
+ uint8_t *ptr = (uint8_t *)data;
+ return ((ptr[offset] << 24) | (ptr[offset + 1] << 16) |
+ (ptr[offset + 2] << 8) | ptr[offset + 3]);
}
static void client_cut_text(VncState *vs, size_t len, char *text)
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel