# HG changeset patch
# User kaf24@localhost.localdomain
# Date 1167325891 0
# Node ID ede2f5280810789c3cb37603cf2e6b34c60982b1
# Parent  a138fabc2120376cfb4bf72596a334a1edf8adb0
[QEMU] Fix a number of signedness issues plus a typo in the version checking in vnc.c.
Signed-off-by:  Anthony Liguori <aliguori@us.ibm.com>

Index: ioemu/vnc.c
===================================================================
--- ioemu.orig/vnc.c	2007-05-10 15:19:29.000000000 +0100
+++ ioemu/vnc.c	2007-05-10 15:19:30.000000000 +0100
@@ -50,12 +50,12 @@
 {
     size_t capacity;
     size_t offset;
-    char *buffer;
+    uint8_t *buffer;
 } Buffer;
 
 typedef struct VncState VncState;
 
-typedef int VncReadEvent(VncState *vs, char *data, size_t len);
+typedef int VncReadEvent(VncState *vs, uint8_t *data, size_t len);
 
 typedef void VncWritePixels(VncState *vs, void *data, int size);
 
@@ -86,7 +86,7 @@
     uint64_t *update_row;	/* outstanding updates */
     int has_update;		/* there's outstanding updates in the
 				 * visible area */
-    char *old_data;
+    uint8_t *old_data;
     int depth; /* internal VNC frame buffer byte per pixel */
     int has_resize;
     int has_hextile;
@@ -161,7 +161,7 @@
 static void vnc_update_client(void *opaque);
 static void vnc_client_read(void *opaque);
 static void framebuffer_set_updated(VncState *vs, int x, int y, int w, int h);
-static int make_challenge(char *random, int size);
+static int make_challenge(unsigned char *random, int size);
 static void set_seed(unsigned int *seedp);
 static void get_random(int len, unsigned char *buf);
 
@@ -353,7 +353,7 @@
 static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h)
 {
     int i;
-    char *row;
+    uint8_t *row;
 
     vnc_framebuffer_update(vs, x, y, w, h, 0);
 
@@ -417,9 +417,9 @@
 static void vnc_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
 {
     int src, dst;
-    char *src_row;
-    char *dst_row;
-    char *old_row;
+    uint8_t *src_row;
+    uint8_t *dst_row;
+    uint8_t *old_row;
     int y = 0;
     int pitch = ds->linesize;
     VncState *vs = ds->opaque;
@@ -488,8 +488,8 @@
     VncState *vs = opaque;
     int64_t now;
     int y;
-    char *row;
-    char *old_row;
+    uint8_t *row;
+    uint8_t *old_row;
     uint64_t width_mask;
     int n_rectangles;
     int saved_offset;
@@ -514,7 +514,7 @@
     for (y = 0; y < vs->ds->height; y++) {
 	if (vs->dirty_row[y] & width_mask) {
 	    int x;
-	    char *ptr, *old_ptr;
+	    uint8_t *ptr, *old_ptr;
 
 	    ptr = row;
 	    old_ptr = old_row;
@@ -677,7 +677,7 @@
     return buffer->offset == 0;
 }
 
-static char *buffer_end(Buffer *buffer)
+static uint8_t *buffer_end(Buffer *buffer)
 {
     return buffer->buffer + buffer->offset;
 }
@@ -811,7 +811,7 @@
 
 static void vnc_write_u8(VncState *vs, uint8_t value)
 {
-    vnc_write(vs, (char *)&value, 1);
+    vnc_write(vs, &value, 1);
 }
 
 static void vnc_flush(VncState *vs)
@@ -1135,11 +1135,10 @@
     vga_hw_update();
 }
 
-static int protocol_client_msg(VncState *vs, char *data, size_t len)
+static int protocol_client_msg(VncState *vs, uint8_t *data, size_t len)
 {
     int i;
     uint16_t limit;
-    int64_t now;
 
     switch (data[0]) {
     case 0:
@@ -1208,7 +1207,7 @@
 		return 8 + v;
 	}
 
-	client_cut_text(vs, read_u32(data, 4), data + 8);
+	client_cut_text(vs, read_u32(data, 4), (char *)(data + 8));
 	break;
     default:
 	printf("Msg: %d\n", data[0]);
@@ -1220,7 +1219,7 @@
     return 0;
 }
 
-static int protocol_client_init(VncState *vs, char *data, size_t len)
+static int protocol_client_init(VncState *vs, uint8_t *data, size_t len)
 {
     size_t l;
     char pad[3] = { 0, 0, 0 };
@@ -1281,7 +1280,7 @@
     return 0;
 }
 
-static int protocol_response(VncState *vs, char *client_response, size_t len)
+static int protocol_response(VncState *vs, uint8_t *client_response, size_t len)
 {
     extern char vncpasswd[64];
     extern unsigned char challenge[AUTHCHALLENGESIZE];
@@ -1319,7 +1318,7 @@
     return 0;
 }
 
-static int protocol_version(VncState *vs, char *version, size_t len)
+static int protocol_version(VncState *vs, uint8_t *version, size_t len)
 {
     extern char vncpasswd[64];
     extern unsigned char challenge[AUTHCHALLENGESIZE];
@@ -1535,7 +1534,7 @@
 
 unsigned int seed;
 
-static int make_challenge(char *random, int size)
+static int make_challenge(unsigned char *random, int size)
 {
  
     set_seed(&seed);
Index: ioemu/vnchextile.h
===================================================================
--- ioemu.orig/vnchextile.h	2007-05-10 15:17:54.000000000 +0100
+++ ioemu/vnchextile.h	2007-05-10 15:19:30.000000000 +0100
@@ -13,7 +13,7 @@
                                              uint32_t *last_fg32,
                                              int *has_bg, int *has_fg)
 {
-    char *row = (vs->ds->data + y * vs->ds->linesize + x * vs->depth);
+    uint8_t *row = (vs->ds->data + y * vs->ds->linesize + x * vs->depth);
     pixel_t *irow = (pixel_t *)row;
     int j, i;
     pixel_t *last_bg = (pixel_t *)last_bg32;
