Fix wrong signedness, by Andre Przywara.
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 16 Dec 2007 03:02:09 +0000 (03:02 +0000)
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>
Sun, 16 Dec 2007 03:02:09 +0000 (03:02 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3815 c046a42c-6fe2-441c-8c8c-71466251a162

12 files changed:
audio/alsaaudio.c
block-vvfat.c
gdbstub.c
hw/fdc.c
hw/ide.c
hw/ne2000.c
hw/rtl8139.c
hw/usb-uhci.c
monitor.c
vl.c
vnc.c
vnchextile.h

index 101af3367e953de2b68dffef3728f89776a26492..77a08a1c586d2af8edca053a4484eda97e218cb0 100644 (file)
@@ -86,9 +86,9 @@ static struct {
 };
 
 struct alsa_params_req {
-    int freq;
+    unsigned int freq;
     audfmt_e fmt;
-    int nchannels;
+    unsigned int nchannels;
     unsigned int buffer_size;
     unsigned int period_size;
 };
@@ -285,7 +285,8 @@ static int alsa_open (int in, struct alsa_params_req *req,
 {
     snd_pcm_t *handle;
     snd_pcm_hw_params_t *hw_params;
-    int err, freq, nchannels;
+    int err;
+    unsigned int freq, nchannels;
     const char *pcm_name = in ? conf.pcm_name_in : conf.pcm_name_out;
     unsigned int period_size, buffer_size;
     snd_pcm_uframes_t obt_buffer_size;
index 770b2ab8c1161251ad94b38249be4550bae276c9..4a3cd356e4f5ed2cb7ddefe14ddebac59bd7c3b1 100644 (file)
@@ -412,7 +412,7 @@ static void init_mbr(BDRVVVFATState* s)
 /* direntry functions */
 
 /* dest is assumed to hold 258 bytes, and pads with 0xffff up to next multiple of 26 */
-static inline int short2long_name(unsigned char* dest,const char* src)
+static inline int short2long_name(char* dest,const char* src)
 {
     int i;
     for(i=0;i<129 && src[i];i++) {
index f877e02137ec7a8922dbf0275dddd6c87db9ffb5..3ab89e9df45e646c2f149061536b1df1f61eacd9 100644 (file)
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -63,7 +63,7 @@ typedef struct GDBState {
     char line_buf[4096];
     int line_buf_index;
     int line_csum;
-    char last_packet[4100];
+    uint8_t last_packet[4100];
     int last_packet_len;
 #ifdef CONFIG_USER_ONLY
     int fd;
@@ -188,7 +188,7 @@ static void hextomem(uint8_t *mem, const char *buf, int len)
 static int put_packet(GDBState *s, char *buf)
 {
     int len, csum, i;
-    char *p;
+    uint8_t *p;
 
 #ifdef DEBUG_GDB
     printf("reply='%s'\n", buf);
@@ -1179,7 +1179,7 @@ static void gdb_read_byte(GDBState *s, int ch)
 {
     CPUState *env = s->env;
     int i, csum;
-    char reply[1];
+    uint8_t reply;
 
 #ifndef CONFIG_USER_ONLY
     if (s->last_packet_len) {
@@ -1237,12 +1237,12 @@ static void gdb_read_byte(GDBState *s, int ch)
                 csum += s->line_buf[i];
             }
             if (s->line_csum != (csum & 0xff)) {
-                reply[0] = '-';
-                put_buffer(s, reply, 1);
+                reply = '-';
+                put_buffer(s, &reply, 1);
                 s->state = RS_IDLE;
             } else {
-                reply[0] = '+';
-                put_buffer(s, reply, 1);
+                reply = '+';
+                put_buffer(s, &reply, 1);
                 s->state = gdb_handle_packet(s, env, s->line_buf);
             }
             break;
index ec9c2a3a98916227749fd991034c97166b221ea9..868ae076a4e374a570cba9b4f933c530b89bbc7b 100644 (file)
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -180,7 +180,7 @@ typedef struct fd_format_t {
     uint8_t last_sect;
     uint8_t max_track;
     uint8_t max_head;
-    const unsigned char *str;
+    const char *str;
 } fd_format_t;
 
 static const fd_format_t fd_formats[] = {
index 13a880bec6f62d31cf21e8bc3a11aa9e04fa2d77..3bf8be01e56dc0abdc7d908a7f094d96db608b7f 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -471,12 +471,12 @@ static void ide_identify(IDEState *s)
     put_le16(p + 5, 512); /* XXX: retired, remove ? */
     put_le16(p + 6, s->sectors);
     snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial);
-    padstr((uint8_t *)(p + 10), buf, 20); /* serial number */
+    padstr((char *)(p + 10), buf, 20); /* serial number */
     put_le16(p + 20, 3); /* XXX: retired, remove ? */
     put_le16(p + 21, 512); /* cache size in sectors */
     put_le16(p + 22, 4); /* ecc bytes */
-    padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
-    padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */
+    padstr((char *)(p + 23), QEMU_VERSION, 8); /* firmware version */
+    padstr((char *)(p + 27), "QEMU HARDDISK", 40); /* model */
 #if MAX_MULT_SECTORS > 1
     put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
 #endif
@@ -536,12 +536,12 @@ static void ide_atapi_identify(IDEState *s)
     /* Removable CDROM, 50us response, 12 byte packets */
     put_le16(p + 0, (2 << 14) | (5 << 8) | (1 << 7) | (2 << 5) | (0 << 0));
     snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial);
-    padstr((uint8_t *)(p + 10), buf, 20); /* serial number */
+    padstr((char *)(p + 10), buf, 20); /* serial number */
     put_le16(p + 20, 3); /* buffer type */
     put_le16(p + 21, 512); /* cache size in sectors */
     put_le16(p + 22, 4); /* ecc bytes */
-    padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */
-    padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */
+    padstr((char *)(p + 23), QEMU_VERSION, 8); /* firmware version */
+    padstr((char *)(p + 27), "QEMU CD-ROM", 40); /* model */
     put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
 #ifdef USE_DMA_CDROM
     put_le16(p + 49, 1 << 9 | 1 << 8); /* DMA and LBA supported */
@@ -591,10 +591,10 @@ static void ide_cfata_identify(IDEState *s)
     put_le16(p + 7, s->nb_sectors >> 16);      /* Sectors per card */
     put_le16(p + 8, s->nb_sectors);            /* Sectors per card */
     snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial);
-    padstr((uint8_t *)(p + 10), buf, 20);      /* Serial number in ASCII */
+    padstr((char *)(p + 10), buf, 20); /* Serial number in ASCII */
     put_le16(p + 22, 0x0004);                  /* ECC bytes */
-    padstr((uint8_t *) (p + 23), QEMU_VERSION, 8);     /* Firmware Revision */
-    padstr((uint8_t *) (p + 27), "QEMU MICRODRIVE", 40);/* Model number */
+    padstr((char *) (p + 23), QEMU_VERSION, 8);        /* Firmware Revision */
+    padstr((char *) (p + 27), "QEMU MICRODRIVE", 40);/* Model number */
 #if MAX_MULT_SECTORS > 1
     put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
 #else
index e95f537c945eda3937bbcabf5a6b8b5a90c5b1ff..44f30c2afbbeaaf3dae137908a690994ea41bffc 100644 (file)
@@ -647,7 +647,7 @@ static uint32_t ne2000_reset_ioport_read(void *opaque, uint32_t addr)
 static void ne2000_save(QEMUFile* f,void* opaque)
 {
        NE2000State* s=(NE2000State*)opaque;
-        int tmp;
+        uint32_t tmp;
 
         if (s->pci_dev)
             pci_device_save(s->pci_dev, f);
@@ -679,7 +679,7 @@ static int ne2000_load(QEMUFile* f,void* opaque,int version_id)
 {
        NE2000State* s=(NE2000State*)opaque;
         int ret;
-        int tmp;
+        uint32_t tmp;
 
         if (version_id > 3)
             return -EINVAL;
index 6e3c023b3d661a73788d4f1bb3800abea0d6b525..8a23bb7b9a851ca27216225ebf2c061bb4aec1e2 100644 (file)
@@ -3119,7 +3119,7 @@ static uint32_t rtl8139_mmio_readl(void *opaque, target_phys_addr_t addr)
 static void rtl8139_save(QEMUFile* f,void* opaque)
 {
     RTL8139State* s=(RTL8139State*)opaque;
-    int i;
+    unsigned int i;
 
     pci_device_save(s->pci_dev, f);
 
@@ -3205,7 +3205,8 @@ static void rtl8139_save(QEMUFile* f,void* opaque)
 static int rtl8139_load(QEMUFile* f,void* opaque,int version_id)
 {
     RTL8139State* s=(RTL8139State*)opaque;
-    int i, ret;
+    unsigned int i;
+    int ret;
 
     /* just 2 versions for now */
     if (version_id > 3)
index 1ebe9591ef62bf9a63f3ce0a8712a1ea047baa51..b55fd849aef58082423b9434321488d95af4b4eb 100644 (file)
@@ -508,7 +508,7 @@ static void uhci_async_complete_packet(USBPacket * packet, void *opaque);
           0 if TD successful
           1 if TD unsuccessful or inactive
 */
-static int uhci_handle_td(UHCIState *s, UHCI_TD *td, int *int_mask,
+static int uhci_handle_td(UHCIState *s, UHCI_TD *td, uint32_t *int_mask,
                           int completion)
 {
     uint8_t pid;
@@ -733,8 +733,8 @@ static void uhci_frame_timer(void *opaque)
 {
     UHCIState *s = opaque;
     int64_t expire_time;
-    uint32_t frame_addr, link, old_td_ctrl, val;
-    int int_mask, cnt, ret;
+    uint32_t frame_addr, link, old_td_ctrl, val, int_mask;
+    int cnt, ret;
     UHCI_TD td;
     UHCI_QH qh;
     uint32_t old_async_qh;
index aa39147b63f958aa967f98d8bc17333e321cb153..97ac583e12a617fbbd875a89d014fb7dc486df45 100644 (file)
--- a/monitor.c
+++ b/monitor.c
@@ -76,7 +76,7 @@ static int hide_banner;
 static term_cmd_t term_cmds[];
 static term_cmd_t info_cmds[];
 
-static char term_outbuf[1024];
+static uint8_t term_outbuf[1024];
 static int term_outbuf_index;
 
 static void monitor_start_input(void);
@@ -97,7 +97,7 @@ void term_flush(void)
 /* flush at every end of line or if the buffer is full */
 void term_puts(const char *str)
 {
-    int c;
+    char c;
     for(;;) {
         c = *str++;
         if (c == '\0')
diff --git a/vl.c b/vl.c
index e88b2a4c3b8b0495c75bc9cb9ea7f32d9522700b..596979ab936930ae4ffddd7304504baccd4abd3c 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -2876,7 +2876,7 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out)
 typedef struct {
     int fd;
     struct sockaddr_in daddr;
-    char buf[1024];
+    uint8_t buf[1024];
     int bufcnt;
     int bufptr;
     int max_size;
@@ -3034,7 +3034,7 @@ static int tcp_chr_read_poll(void *opaque)
 #define IAC_BREAK 243
 static void tcp_chr_process_IAC_bytes(CharDriverState *chr,
                                       TCPCharDriver *s,
-                                      char *buf, int *size)
+                                      uint8_t *buf, int *size)
 {
     /* Handle any telnet client's basic IAC options to satisfy char by
      * char mode with no echo.  All IAC options will be removed from
@@ -8266,7 +8266,7 @@ int main(int argc, char **argv)
                 /* We just do some generic consistency checks */
                 {
                     /* Could easily be extended to 64 devices if needed */
-                    const unsigned char *p;
+                    const char *p;
                     
                     boot_devices_bitmap = 0;
                     for (p = boot_devices; *p != '\0'; p++) {
diff --git a/vnc.c b/vnc.c
index b20fe21d7d48f27e803c3af00ef0d56f2d9ff5d2..9fb8c85a1a033b0c4a911648230159ef07ed9523 100644 (file)
--- a/vnc.c
+++ b/vnc.c
@@ -60,12 +60,12 @@ typedef struct Buffer
 {
     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);
 
@@ -376,7 +376,7 @@ static void vnc_write_pixels_generic(VncState *vs, void *pixels1, int size)
 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);
 
@@ -440,8 +440,8 @@ static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
 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;
+    uint8_t *src_row;
+    uint8_t *dst_row;
     char *old_row;
     int y = 0;
     int pitch = ds->linesize;
@@ -499,7 +499,7 @@ static void vnc_update_client(void *opaque)
 
     if (vs->need_update && vs->csock != -1) {
        int y;
-       char *row;
+       uint8_t *row;
        char *old_row;
        uint32_t width_mask[VNC_DIRTY_WORDS];
        int n_rectangles;
@@ -516,10 +516,11 @@ static void vnc_update_client(void *opaque)
        for (y = 0; y < vs->height; y++) {
            if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) {
                int x;
-               char *ptr, *old_ptr;
+               uint8_t *ptr;
+               char *old_ptr;
 
                ptr = row;
-               old_ptr = old_row;
+               old_ptr = (char*)old_row;
 
                for (x = 0; x < vs->ds->width; x += 16) {
                    if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
@@ -622,7 +623,7 @@ static int buffer_empty(Buffer *buffer)
     return buffer->offset == 0;
 }
 
-static char *buffer_end(Buffer *buffer)
+static uint8_t *buffer_end(Buffer *buffer)
 {
     return buffer->buffer + buffer->offset;
 }
@@ -853,7 +854,7 @@ static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,
 }
 #endif /* CONFIG_VNC_TLS */
 
-static void client_cut_text(VncState *vs, size_t len, char *text)
+static void client_cut_text(VncState *vs, size_t len, uint8_t *text)
 {
 }
 
@@ -1181,7 +1182,7 @@ static void set_pixel_format(VncState *vs,
     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;
@@ -1254,7 +1255,7 @@ static int protocol_client_msg(VncState *vs, char *data, size_t len)
     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)
 {
     char pad[3] = { 0, 0, 0 };
     char buf[1024];
@@ -1327,11 +1328,11 @@ static void make_challenge(VncState *vs)
         vs->challenge[i] = (int) (256.0*rand()/(RAND_MAX+1.0));
 }
 
-static int protocol_client_auth_vnc(VncState *vs, char *data, size_t len)
+static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
 {
-    char response[VNC_AUTH_CHALLENGE_SIZE];
+    unsigned char response[VNC_AUTH_CHALLENGE_SIZE];
     int i, j, pwlen;
-    char key[8];
+    unsigned char key[8];
 
     if (!vs->password || !vs->password[0]) {
        VNC_DEBUG("No password configured on server");
@@ -1738,7 +1739,7 @@ static int vnc_start_tls(struct VncState *vs) {
     return vnc_continue_handshake(vs);
 }
 
-static int protocol_client_vencrypt_auth(VncState *vs, char *data, size_t len)
+static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len)
 {
     int auth = read_u32(data, 0);
 
@@ -1768,7 +1769,7 @@ static int protocol_client_vencrypt_auth(VncState *vs, char *data, size_t len)
     return 0;
 }
 
-static int protocol_client_vencrypt_init(VncState *vs, char *data, size_t len)
+static int protocol_client_vencrypt_init(VncState *vs, uint8_t *data, size_t len)
 {
     if (data[0] != 0 ||
        data[1] != 2) {
@@ -1798,7 +1799,7 @@ static int start_auth_vencrypt(VncState *vs)
 }
 #endif /* CONFIG_VNC_TLS */
 
-static int protocol_client_auth(VncState *vs, char *data, size_t len)
+static int protocol_client_auth(VncState *vs, uint8_t *data, size_t len)
 {
     /* We only advertise 1 auth scheme at a time, so client
      * must pick the one we sent. Verify this */
@@ -1847,7 +1848,7 @@ static int protocol_client_auth(VncState *vs, char *data, size_t len)
     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)
 {
     char local[13];
 
index 35dcc57271bcd27a0abcf3f9c3b2ca9575934db5..09c1b278553b4832814869ab757f6debd854edec 100644 (file)
@@ -13,7 +13,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
                                              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;