From: "Andre Przywara" <andre.przywara@amd.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/5] gcc4 warnings: fix wrong signedness
Date: Thu, 06 Dec 2007 11:51:35 +0100 [thread overview]
Message-ID: <4757D437.8070009@amd.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 527 bytes --]
This fixes the signedness of some variables to fit the signedness of the
functions called.
--
Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany
Tel: +49 351 277-84917
----to satisfy European Law for business letters:
AMD Saxony Limited Liability Company & Co. KG,
Wilschdorfer Landstr. 101, 01109 Dresden, Germany
Register Court Dresden: HRA 4896, General Partner authorized
to represent: AMD Saxony LLC (Wilmington, Delaware, US)
General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy
[-- Attachment #2: wrongtypes.diff --]
[-- Type: text/plain, Size: 16474 bytes --]
Index: audio/alsaaudio.c
===================================================================
RCS file: /sources/qemu/qemu/audio/alsaaudio.c,v
retrieving revision 1.11
diff -p -u -r1.11 alsaaudio.c
--- audio/alsaaudio.c 17 Nov 2007 17:35:54 -0000 1.11
+++ audio/alsaaudio.c 5 Dec 2007 23:38:57 -0000
@@ -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 als
{
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: block-vvfat.c
===================================================================
RCS file: /sources/qemu/qemu/block-vvfat.c,v
retrieving revision 1.13
diff -p -u -r1.13 block-vvfat.c
--- block-vvfat.c 18 Nov 2007 01:44:35 -0000 1.13
+++ block-vvfat.c 5 Dec 2007 23:38:57 -0000
@@ -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: gdbstub.c
===================================================================
RCS file: /sources/qemu/qemu/gdbstub.c,v
retrieving revision 1.71
diff -p -u -r1.71 gdbstub.c
--- gdbstub.c 17 Nov 2007 17:14:37 -0000 1.71
+++ gdbstub.c 5 Dec 2007 23:38:57 -0000
@@ -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
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, i
{
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, i
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: hw/fdc.c
===================================================================
RCS file: /sources/qemu/qemu/hw/fdc.c,v
retrieving revision 1.33
diff -p -u -r1.33 fdc.c
--- hw/fdc.c 17 Nov 2007 17:14:41 -0000 1.33
+++ hw/fdc.c 5 Dec 2007 23:38:57 -0000
@@ -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: hw/ide.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ide.c,v
retrieving revision 1.72
diff -p -u -r1.72 ide.c
--- hw/ide.c 18 Nov 2007 01:44:37 -0000 1.72
+++ hw/ide.c 5 Dec 2007 23:38:57 -0000
@@ -471,12 +470,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 +535,12 @@ static void ide_atapi_identify(IDEState
/* 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 +590,10 @@ static void ide_cfata_identify(IDEState
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: hw/ne2000.c
===================================================================
RCS file: /sources/qemu/qemu/hw/ne2000.c,v
retrieving revision 1.31
diff -p -u -r1.31 ne2000.c
--- hw/ne2000.c 18 Nov 2007 01:44:37 -0000 1.31
+++ hw/ne2000.c 5 Dec 2007 23:38:57 -0000
@@ -647,7 +647,7 @@ static uint32_t ne2000_reset_ioport_read
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*
{
NE2000State* s=(NE2000State*)opaque;
int ret;
- int tmp;
+ uint32_t tmp;
if (version_id > 3)
return -EINVAL;
Index: hw/rtl8139.c
===================================================================
RCS file: /sources/qemu/qemu/hw/rtl8139.c,v
retrieving revision 1.16
diff -p -u -r1.16 rtl8139.c
--- hw/rtl8139.c 18 Nov 2007 01:44:38 -0000 1.16
+++ hw/rtl8139.c 5 Dec 2007 23:38:58 -0000
@@ -3119,7 +3119,7 @@ static uint32_t rtl8139_mmio_readl(void
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,voi
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: hw/usb-uhci.c
===================================================================
RCS file: /sources/qemu/qemu/hw/usb-uhci.c,v
retrieving revision 1.22
diff -p -u -r1.22 usb-uhci.c
--- hw/usb-uhci.c 17 Nov 2007 17:14:50 -0000 1.22
+++ hw/usb-uhci.c 5 Dec 2007 23:38:58 -0000
@@ -508,7 +508,7 @@ static void uhci_async_complete_packet(U
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 *opaqu
{
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: monitor.c
===================================================================
RCS file: /sources/qemu/qemu/monitor.c,v
retrieving revision 1.91
diff -p -u -r1.91 monitor.c
--- monitor.c 3 Dec 2007 17:05:38 -0000 1.91
+++ monitor.c 5 Dec 2007 23:38:57 -0000
@@ -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')
Index: vl.c
===================================================================
RCS file: /sources/qemu/qemu/vl.c,v
retrieving revision 1.376
diff -p -u -r1.376 vl.c
--- vl.c 4 Dec 2007 00:10:34 -0000 1.376
+++ vl.c 5 Dec 2007 23:38:57 -0000
@@ -2876,7 +2877,7 @@ static CharDriverState *qemu_chr_open_wi
typedef struct {
int fd;
struct sockaddr_in daddr;
- char buf[1024];
+ uint8_t buf[1024];
int bufcnt;
int bufptr;
int max_size;
@@ -3034,7 +3035,7 @@ static int tcp_chr_read_poll(void *opaqu
#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
@@ -8257,7 +8259,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++) {
Index: vnc.c
===================================================================
RCS file: /sources/qemu/qemu/vnc.c,v
retrieving revision 1.29
diff -p -u -r1.29 vnc.c
--- vnc.c 18 Nov 2007 01:44:36 -0000 1.29
+++ vnc.c 5 Dec 2007 23:38:57 -0000
@@ -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);
@@ -369,7 +369,7 @@ static void vnc_write_pixels_generic(Vnc
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);
@@ -433,8 +433,8 @@ static void send_framebuffer_update(VncS
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;
@@ -492,7 +492,7 @@ static void vnc_update_client(void *opaq
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;
@@ -509,10 +509,11 @@ static void vnc_update_client(void *opaq
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) {
@@ -615,7 +616,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;
}
@@ -846,7 +847,7 @@ static ssize_t vnc_tls_pull(gnutls_trans
}
#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)
{
}
@@ -1174,7 +1175,7 @@ static void set_pixel_format(VncState *v
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;
@@ -1247,7 +1248,7 @@ static int protocol_client_msg(VncState
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];
@@ -1320,11 +1321,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");
@@ -1731,7 +1732,7 @@ static int vnc_start_tls(struct VncState
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);
@@ -1761,7 +1762,7 @@ static int protocol_client_vencrypt_auth
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) {
@@ -1791,7 +1792,7 @@ static int start_auth_vencrypt(VncState
}
#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 */
@@ -1840,7 +1841,7 @@ static int protocol_client_auth(VncState
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: vnchextile.h
===================================================================
RCS file: /sources/qemu/qemu/vnchextile.h,v
retrieving revision 1.4
diff -p -u -r1.4 vnchextile.h
--- vnchextile.h 16 Sep 2007 21:07:51 -0000 1.4
+++ vnchextile.h 5 Dec 2007 23:38:57 -0000
@@ -13,7 +13,7 @@ static void CONCAT(send_hextile_tile_, N
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;
reply other threads:[~2007-12-06 10:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4757D437.8070009@amd.com \
--to=andre.przywara@amd.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.