From 60fe76f38605e0e2eedb436d0945af283029c4e0 Mon Sep 17 00:00:00 2001 From: ths Date: Sun, 16 Dec 2007 03:02:09 +0000 Subject: Fix wrong signedness, by Andre Przywara. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3815 c046a42c-6fe2-441c-8c8c-71466251a162 --- audio/alsaaudio.c | 7 ++++--- block-vvfat.c | 2 +- gdbstub.c | 14 +++++++------- hw/fdc.c | 2 +- hw/ide.c | 18 +++++++++--------- hw/ne2000.c | 4 ++-- hw/rtl8139.c | 5 +++-- hw/usb-uhci.c | 6 +++--- monitor.c | 4 ++-- vl.c | 6 +++--- vnc.c | 39 ++++++++++++++++++++------------------- vnchextile.h | 2 +- 12 files changed, 56 insertions(+), 53 deletions(-) diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c index 101af33..77a08a1 100644 --- a/audio/alsaaudio.c +++ b/audio/alsaaudio.c @@ -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; diff --git a/block-vvfat.c b/block-vvfat.c index 770b2ab..4a3cd35 100644 --- a/block-vvfat.c +++ b/block-vvfat.c @@ -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++) { diff --git a/gdbstub.c b/gdbstub.c index f877e02..3ab89e9 100644 --- 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; diff --git a/hw/fdc.c b/hw/fdc.c index ec9c2a3..868ae07 100644 --- 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[] = { diff --git a/hw/ide.c b/hw/ide.c index 13a880b..3bf8be0 100644 --- 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 diff --git a/hw/ne2000.c b/hw/ne2000.c index e95f537..44f30c2 100644 --- a/hw/ne2000.c +++ b/hw/ne2000.c @@ -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; diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 6e3c023..8a23bb7 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -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) diff --git a/hw/usb-uhci.c b/hw/usb-uhci.c index 1ebe959..b55fd84 100644 --- a/hw/usb-uhci.c +++ b/hw/usb-uhci.c @@ -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; diff --git a/monitor.c b/monitor.c index aa39147..97ac583 100644 --- 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 e88b2a4..596979a 100644 --- 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 b20fe21..9fb8c85 100644 --- 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]; diff --git a/vnchextile.h b/vnchextile.h index 35dcc57..09c1b27 100644 --- a/vnchextile.h +++ b/vnchextile.h @@ -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; -- cgit v1.1