WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 1/5] [ioemu]: fix wrong types

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 1/5] [ioemu]: fix wrong types
From: "Andre Przywara" <andre.przywara@xxxxxxx>
Date: Wed, 09 Jan 2008 14:58:26 +0100
Delivery-date: Wed, 09 Jan 2008 06:00:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.10 (X11/20070409)
gcc4 is more picky about the signedness of a pointer. Some variables were declared with an inappropriate signedness, this patch fixes this.

--
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
diff -r 0f0d67f29ccb tools/ioemu/audio/alsaaudio.c
--- a/tools/ioemu/audio/alsaaudio.c     Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/audio/alsaaudio.c     Tue Jan 08 14:48:38 2008 +0100
@@ -85,9 +85,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;
 };
@@ -258,7 +258,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;
diff -r 0f0d67f29ccb tools/ioemu/block-vvfat.c
--- a/tools/ioemu/block-vvfat.c Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/block-vvfat.c Tue Jan 08 14:48:38 2008 +0100
@@ -377,7 +377,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 -r 0f0d67f29ccb tools/ioemu/gdbstub.c
--- a/tools/ioemu/gdbstub.c     Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/gdbstub.c     Tue Jan 08 14:48:38 2008 +0100
@@ -60,7 +60,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;
@@ -185,7 +185,7 @@ static int put_packet(GDBState *s, char 
 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);
@@ -982,7 +982,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) {
@@ -1040,12 +1040,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;
diff -r 0f0d67f29ccb tools/ioemu/hw/fdc.c
--- a/tools/ioemu/hw/fdc.c      Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/fdc.c      Tue Jan 08 14:48:38 2008 +0100
@@ -176,7 +176,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 fd_format_t fd_formats[] = {
diff -r 0f0d67f29ccb tools/ioemu/hw/pass-through.c
--- a/tools/ioemu/hw/pass-through.c     Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/pass-through.c     Tue Jan 08 14:48:38 2008 +0100
@@ -29,15 +29,15 @@
 
 extern FILE *logfile;
 
-static int token_value(char *token)
+static int token_value(const char *token)
 {
     token = strchr(token, 'x') + 1;
     return strtol(token, NULL, 16);
 }
 
-static int next_bdf(char **str, int *seg, int *bus, int *dev, int *func)
-{
-    char *token;
+static int next_bdf(char const ** str, int *seg, int *bus, int *dev, int *func)
+{
+    const char *token;
 
     if ( !(*str) || !strchr(*str, ',') )
         return 0;
@@ -408,7 +408,7 @@ struct pt_dev * register_real_device(PCI
     return assigned_device;
 }
 
-int pt_init(PCIBus *e_bus, char *direct_pci)
+int pt_init(PCIBus *e_bus, const char *direct_pci)
 {
     int seg, b, d, f;
     struct pt_dev *pt_dev;
diff -r 0f0d67f29ccb tools/ioemu/hw/pass-through.h
--- a/tools/ioemu/hw/pass-through.h     Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/pass-through.h     Tue Jan 08 14:48:38 2008 +0100
@@ -83,7 +83,7 @@ struct pci_config_cf8 {
     };
 };
 
-int pt_init(PCIBus * e_bus, char * direct_pci);
+int pt_init(PCIBus * e_bus, const char * direct_pci);
 
 #endif /* __PASSTHROUGH_H__ */
 
diff -r 0f0d67f29ccb tools/ioemu/hw/rtl8139.c
--- a/tools/ioemu/hw/rtl8139.c  Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/rtl8139.c  Tue Jan 08 14:48:38 2008 +0100
@@ -3119,7 +3166,7 @@ static void rtl8139_save(QEMUFile* f,voi
 static void rtl8139_save(QEMUFile* f,void* opaque)
 {
     RTL8139State* s=(RTL8139State*)opaque;
-    int i;
+    unsigned int i;
 
     pci_device_save(s->pci_dev, f);
 
@@ -3204,7 +3251,8 @@ static int rtl8139_load(QEMUFile* f,void
 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 -r 0f0d67f29ccb tools/ioemu/hw/usb-uhci.c
--- a/tools/ioemu/hw/usb-uhci.c Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/hw/usb-uhci.c Tue Jan 08 14:48:38 2008 +0100
@@ -432,7 +432,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)
 {
     uint8_t pid;
     int len, max_len, err, ret;
@@ -630,8 +630,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;
diff -r 0f0d67f29ccb tools/ioemu/monitor.c
--- a/tools/ioemu/monitor.c     Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/monitor.c     Tue Jan 08 14:48:38 2008 +0100
@@ -61,7 +61,7 @@ static term_cmd_t term_cmds[];
 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);
@@ -85,7 +85,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 -r 0f0d67f29ccb tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/vl.c  Tue Jan 08 14:48:38 2008 +0100
@@ -2469,7 +2469,7 @@ typedef struct {
 typedef struct {
     int fd;
     struct sockaddr_in daddr;
-    char buf[1024];
+    uint8_t buf[1024];
     int bufcnt;
     int bufptr;
     int max_size;
@@ -2627,7 +2627,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
diff -r 0f0d67f29ccb tools/ioemu/vnc.c
--- a/tools/ioemu/vnc.c Fri Dec 21 23:58:29 2007 +0100
+++ b/tools/ioemu/vnc.c Tue Jan 08 14:48:38 2008 +0100
@@ -989,7 +989,7 @@ ssize_t vnc_tls_pull(gnutls_transport_pt
 }
 #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)
 {
 }
 
@@ -1542,11 +1542,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)
-{
-    char response[VNC_AUTH_CHALLENGE_SIZE];
+static int protocol_client_auth_vnc(VncState *vs, uint8_t *data, size_t len)
+{
+    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");
@@ -1953,7 +1953,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);
 
@@ -1983,7 +1983,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) {
@@ -2013,7 +2013,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 */
@@ -2062,7 +2062,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];
 
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/5] [ioemu]: fix wrong types, Andre Przywara <=