Fix wrong signedness, by Andre Przywara.

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3815 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
ths 2007-12-16 03:02:09 +00:00
parent 223d4670a0
commit 60fe76f386
12 changed files with 56 additions and 53 deletions

View File

@ -86,9 +86,9 @@ static struct {
}; };
struct alsa_params_req { struct alsa_params_req {
int freq; unsigned int freq;
audfmt_e fmt; audfmt_e fmt;
int nchannels; unsigned int nchannels;
unsigned int buffer_size; unsigned int buffer_size;
unsigned int period_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_t *handle;
snd_pcm_hw_params_t *hw_params; 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; const char *pcm_name = in ? conf.pcm_name_in : conf.pcm_name_out;
unsigned int period_size, buffer_size; unsigned int period_size, buffer_size;
snd_pcm_uframes_t obt_buffer_size; snd_pcm_uframes_t obt_buffer_size;

View File

@ -412,7 +412,7 @@ static void init_mbr(BDRVVVFATState* s)
/* direntry functions */ /* direntry functions */
/* dest is assumed to hold 258 bytes, and pads with 0xffff up to next multiple of 26 */ /* 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; int i;
for(i=0;i<129 && src[i];i++) { for(i=0;i<129 && src[i];i++) {

View File

@ -63,7 +63,7 @@ typedef struct GDBState {
char line_buf[4096]; char line_buf[4096];
int line_buf_index; int line_buf_index;
int line_csum; int line_csum;
char last_packet[4100]; uint8_t last_packet[4100];
int last_packet_len; int last_packet_len;
#ifdef CONFIG_USER_ONLY #ifdef CONFIG_USER_ONLY
int fd; 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) static int put_packet(GDBState *s, char *buf)
{ {
int len, csum, i; int len, csum, i;
char *p; uint8_t *p;
#ifdef DEBUG_GDB #ifdef DEBUG_GDB
printf("reply='%s'\n", buf); printf("reply='%s'\n", buf);
@ -1179,7 +1179,7 @@ static void gdb_read_byte(GDBState *s, int ch)
{ {
CPUState *env = s->env; CPUState *env = s->env;
int i, csum; int i, csum;
char reply[1]; uint8_t reply;
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY
if (s->last_packet_len) { if (s->last_packet_len) {
@ -1237,12 +1237,12 @@ static void gdb_read_byte(GDBState *s, int ch)
csum += s->line_buf[i]; csum += s->line_buf[i];
} }
if (s->line_csum != (csum & 0xff)) { if (s->line_csum != (csum & 0xff)) {
reply[0] = '-'; reply = '-';
put_buffer(s, reply, 1); put_buffer(s, &reply, 1);
s->state = RS_IDLE; s->state = RS_IDLE;
} else { } else {
reply[0] = '+'; reply = '+';
put_buffer(s, reply, 1); put_buffer(s, &reply, 1);
s->state = gdb_handle_packet(s, env, s->line_buf); s->state = gdb_handle_packet(s, env, s->line_buf);
} }
break; break;

View File

@ -180,7 +180,7 @@ typedef struct fd_format_t {
uint8_t last_sect; uint8_t last_sect;
uint8_t max_track; uint8_t max_track;
uint8_t max_head; uint8_t max_head;
const unsigned char *str; const char *str;
} fd_format_t; } fd_format_t;
static const fd_format_t fd_formats[] = { static const fd_format_t fd_formats[] = {

View File

@ -471,12 +471,12 @@ static void ide_identify(IDEState *s)
put_le16(p + 5, 512); /* XXX: retired, remove ? */ put_le16(p + 5, 512); /* XXX: retired, remove ? */
put_le16(p + 6, s->sectors); put_le16(p + 6, s->sectors);
snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); 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 + 20, 3); /* XXX: retired, remove ? */
put_le16(p + 21, 512); /* cache size in sectors */ put_le16(p + 21, 512); /* cache size in sectors */
put_le16(p + 22, 4); /* ecc bytes */ put_le16(p + 22, 4); /* ecc bytes */
padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */ padstr((char *)(p + 23), QEMU_VERSION, 8); /* firmware version */
padstr((uint8_t *)(p + 27), "QEMU HARDDISK", 40); /* model */ padstr((char *)(p + 27), "QEMU HARDDISK", 40); /* model */
#if MAX_MULT_SECTORS > 1 #if MAX_MULT_SECTORS > 1
put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS); put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
#endif #endif
@ -536,12 +536,12 @@ static void ide_atapi_identify(IDEState *s)
/* Removable CDROM, 50us response, 12 byte packets */ /* Removable CDROM, 50us response, 12 byte packets */
put_le16(p + 0, (2 << 14) | (5 << 8) | (1 << 7) | (2 << 5) | (0 << 0)); put_le16(p + 0, (2 << 14) | (5 << 8) | (1 << 7) | (2 << 5) | (0 << 0));
snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); 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 + 20, 3); /* buffer type */
put_le16(p + 21, 512); /* cache size in sectors */ put_le16(p + 21, 512); /* cache size in sectors */
put_le16(p + 22, 4); /* ecc bytes */ put_le16(p + 22, 4); /* ecc bytes */
padstr((uint8_t *)(p + 23), QEMU_VERSION, 8); /* firmware version */ padstr((char *)(p + 23), QEMU_VERSION, 8); /* firmware version */
padstr((uint8_t *)(p + 27), "QEMU CD-ROM", 40); /* model */ padstr((char *)(p + 27), "QEMU CD-ROM", 40); /* model */
put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */ put_le16(p + 48, 1); /* dword I/O (XXX: should not be set on CDROM) */
#ifdef USE_DMA_CDROM #ifdef USE_DMA_CDROM
put_le16(p + 49, 1 << 9 | 1 << 8); /* DMA and LBA supported */ 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 + 7, s->nb_sectors >> 16); /* Sectors per card */
put_le16(p + 8, s->nb_sectors); /* Sectors per card */ put_le16(p + 8, s->nb_sectors); /* Sectors per card */
snprintf(buf, sizeof(buf), "QM%05d", s->drive_serial); 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 */ put_le16(p + 22, 0x0004); /* ECC bytes */
padstr((uint8_t *) (p + 23), QEMU_VERSION, 8); /* Firmware Revision */ padstr((char *) (p + 23), QEMU_VERSION, 8); /* Firmware Revision */
padstr((uint8_t *) (p + 27), "QEMU MICRODRIVE", 40);/* Model number */ padstr((char *) (p + 27), "QEMU MICRODRIVE", 40);/* Model number */
#if MAX_MULT_SECTORS > 1 #if MAX_MULT_SECTORS > 1
put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS); put_le16(p + 47, 0x8000 | MAX_MULT_SECTORS);
#else #else

View 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) static void ne2000_save(QEMUFile* f,void* opaque)
{ {
NE2000State* s=(NE2000State*)opaque; NE2000State* s=(NE2000State*)opaque;
int tmp; uint32_t tmp;
if (s->pci_dev) if (s->pci_dev)
pci_device_save(s->pci_dev, f); 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; NE2000State* s=(NE2000State*)opaque;
int ret; int ret;
int tmp; uint32_t tmp;
if (version_id > 3) if (version_id > 3)
return -EINVAL; return -EINVAL;

View 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) static void rtl8139_save(QEMUFile* f,void* opaque)
{ {
RTL8139State* s=(RTL8139State*)opaque; RTL8139State* s=(RTL8139State*)opaque;
int i; unsigned int i;
pci_device_save(s->pci_dev, f); 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) static int rtl8139_load(QEMUFile* f,void* opaque,int version_id)
{ {
RTL8139State* s=(RTL8139State*)opaque; RTL8139State* s=(RTL8139State*)opaque;
int i, ret; unsigned int i;
int ret;
/* just 2 versions for now */ /* just 2 versions for now */
if (version_id > 3) if (version_id > 3)

View File

@ -508,7 +508,7 @@ static void uhci_async_complete_packet(USBPacket * packet, void *opaque);
0 if TD successful 0 if TD successful
1 if TD unsuccessful or inactive 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) int completion)
{ {
uint8_t pid; uint8_t pid;
@ -733,8 +733,8 @@ static void uhci_frame_timer(void *opaque)
{ {
UHCIState *s = opaque; UHCIState *s = opaque;
int64_t expire_time; int64_t expire_time;
uint32_t frame_addr, link, old_td_ctrl, val; uint32_t frame_addr, link, old_td_ctrl, val, int_mask;
int int_mask, cnt, ret; int cnt, ret;
UHCI_TD td; UHCI_TD td;
UHCI_QH qh; UHCI_QH qh;
uint32_t old_async_qh; uint32_t old_async_qh;

View File

@ -76,7 +76,7 @@ static int hide_banner;
static term_cmd_t term_cmds[]; static term_cmd_t term_cmds[];
static term_cmd_t info_cmds[]; static term_cmd_t info_cmds[];
static char term_outbuf[1024]; static uint8_t term_outbuf[1024];
static int term_outbuf_index; static int term_outbuf_index;
static void monitor_start_input(void); 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 */ /* flush at every end of line or if the buffer is full */
void term_puts(const char *str) void term_puts(const char *str)
{ {
int c; char c;
for(;;) { for(;;) {
c = *str++; c = *str++;
if (c == '\0') if (c == '\0')

6
vl.c
View File

@ -2876,7 +2876,7 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out)
typedef struct { typedef struct {
int fd; int fd;
struct sockaddr_in daddr; struct sockaddr_in daddr;
char buf[1024]; uint8_t buf[1024];
int bufcnt; int bufcnt;
int bufptr; int bufptr;
int max_size; int max_size;
@ -3034,7 +3034,7 @@ static int tcp_chr_read_poll(void *opaque)
#define IAC_BREAK 243 #define IAC_BREAK 243
static void tcp_chr_process_IAC_bytes(CharDriverState *chr, static void tcp_chr_process_IAC_bytes(CharDriverState *chr,
TCPCharDriver *s, TCPCharDriver *s,
char *buf, int *size) uint8_t *buf, int *size)
{ {
/* Handle any telnet client's basic IAC options to satisfy char by /* Handle any telnet client's basic IAC options to satisfy char by
* char mode with no echo. All IAC options will be removed from * 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 */ /* We just do some generic consistency checks */
{ {
/* Could easily be extended to 64 devices if needed */ /* Could easily be extended to 64 devices if needed */
const unsigned char *p; const char *p;
boot_devices_bitmap = 0; boot_devices_bitmap = 0;
for (p = boot_devices; *p != '\0'; p++) { for (p = boot_devices; *p != '\0'; p++) {

39
vnc.c
View File

@ -60,12 +60,12 @@ typedef struct Buffer
{ {
size_t capacity; size_t capacity;
size_t offset; size_t offset;
char *buffer; uint8_t *buffer;
} Buffer; } Buffer;
typedef struct VncState VncState; 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); 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) static void send_framebuffer_update_raw(VncState *vs, int x, int y, int w, int h)
{ {
int i; int i;
char *row; uint8_t *row;
vnc_framebuffer_update(vs, x, y, w, h, 0); 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) 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; int src, dst;
char *src_row; uint8_t *src_row;
char *dst_row; uint8_t *dst_row;
char *old_row; char *old_row;
int y = 0; int y = 0;
int pitch = ds->linesize; int pitch = ds->linesize;
@ -499,7 +499,7 @@ static void vnc_update_client(void *opaque)
if (vs->need_update && vs->csock != -1) { if (vs->need_update && vs->csock != -1) {
int y; int y;
char *row; uint8_t *row;
char *old_row; char *old_row;
uint32_t width_mask[VNC_DIRTY_WORDS]; uint32_t width_mask[VNC_DIRTY_WORDS];
int n_rectangles; int n_rectangles;
@ -516,10 +516,11 @@ static void vnc_update_client(void *opaque)
for (y = 0; y < vs->height; y++) { for (y = 0; y < vs->height; y++) {
if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) { if (vnc_and_bits(vs->dirty_row[y], width_mask, VNC_DIRTY_WORDS)) {
int x; int x;
char *ptr, *old_ptr; uint8_t *ptr;
char *old_ptr;
ptr = row; ptr = row;
old_ptr = old_row; old_ptr = (char*)old_row;
for (x = 0; x < vs->ds->width; x += 16) { for (x = 0; x < vs->ds->width; x += 16) {
if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) { if (memcmp(old_ptr, ptr, 16 * vs->depth) == 0) {
@ -622,7 +623,7 @@ static int buffer_empty(Buffer *buffer)
return buffer->offset == 0; return buffer->offset == 0;
} }
static char *buffer_end(Buffer *buffer) static uint8_t *buffer_end(Buffer *buffer)
{ {
return buffer->buffer + buffer->offset; return buffer->buffer + buffer->offset;
} }
@ -853,7 +854,7 @@ static ssize_t vnc_tls_pull(gnutls_transport_ptr_t transport,
} }
#endif /* CONFIG_VNC_TLS */ #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(); 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; int i;
uint16_t limit; uint16_t limit;
@ -1254,7 +1255,7 @@ static int protocol_client_msg(VncState *vs, char *data, size_t len)
return 0; 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 pad[3] = { 0, 0, 0 };
char buf[1024]; char buf[1024];
@ -1327,11 +1328,11 @@ static void make_challenge(VncState *vs)
vs->challenge[i] = (int) (256.0*rand()/(RAND_MAX+1.0)); 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; int i, j, pwlen;
char key[8]; unsigned char key[8];
if (!vs->password || !vs->password[0]) { if (!vs->password || !vs->password[0]) {
VNC_DEBUG("No password configured on server"); VNC_DEBUG("No password configured on server");
@ -1738,7 +1739,7 @@ static int vnc_start_tls(struct VncState *vs) {
return vnc_continue_handshake(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); 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; 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 || if (data[0] != 0 ||
data[1] != 2) { data[1] != 2) {
@ -1798,7 +1799,7 @@ static int start_auth_vencrypt(VncState *vs)
} }
#endif /* CONFIG_VNC_TLS */ #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 /* We only advertise 1 auth scheme at a time, so client
* must pick the one we sent. Verify this */ * 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; 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]; char local[13];

View File

@ -13,7 +13,7 @@ static void CONCAT(send_hextile_tile_, NAME)(VncState *vs,
uint32_t *last_fg32, uint32_t *last_fg32,
int *has_bg, int *has_fg) 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; pixel_t *irow = (pixel_t *)row;
int j, i; int j, i;
pixel_t *last_bg = (pixel_t *)last_bg32; pixel_t *last_bg = (pixel_t *)last_bg32;