qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [7103] Fix OpenSolaris gcc4 warnings: iovec type mismatches


From: Blue Swirl
Subject: [Qemu-devel] [7103] Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing ' static'
Date: Mon, 13 Apr 2009 16:31:01 +0000

Revision: 7103
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=7103
Author:   blueswir1
Date:     2009-04-13 16:31:01 +0000 (Mon, 13 Apr 2009)
Log Message:
-----------
Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'

Modified Paths:
--------------
    trunk/block-cow.c
    trunk/block-qcow.c
    trunk/block-qcow2.c
    trunk/block-vvfat.c
    trunk/block.c
    trunk/bt-host.c
    trunk/fpu/softfloat-macros.h
    trunk/hw/ide.c
    trunk/hw/scsi-disk.c
    trunk/hw/virtio-console.c
    trunk/hw/virtio-net.c
    trunk/net.c
    trunk/qemu-char.c

Modified: trunk/block-cow.c
===================================================================
--- trunk/block-cow.c   2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/block-cow.c   2009-04-13 16:31:01 UTC (rev 7103)
@@ -95,10 +95,10 @@
 
     /* mmap the bitmap */
     s->cow_bitmap_size = ((bs->total_sectors + 7) >> 3) + sizeof(cow_header);
-    s->cow_bitmap_addr = mmap(get_mmap_addr(s->cow_bitmap_size),
-                              s->cow_bitmap_size,
-                              PROT_READ | PROT_WRITE,
-                              MAP_SHARED, s->fd, 0);
+    s->cow_bitmap_addr = (void *)mmap(get_mmap_addr(s->cow_bitmap_size),
+                                      s->cow_bitmap_size,
+                                      PROT_READ | PROT_WRITE,
+                                      MAP_SHARED, s->fd, 0);
     if (s->cow_bitmap_addr == MAP_FAILED)
         goto fail;
     s->cow_bitmap = s->cow_bitmap_addr + sizeof(cow_header);
@@ -197,7 +197,7 @@
 static void cow_close(BlockDriverState *bs)
 {
     BDRVCowState *s = bs->opaque;
-    munmap(s->cow_bitmap_addr, s->cow_bitmap_size);
+    munmap((void *)s->cow_bitmap_addr, s->cow_bitmap_size);
     close(s->fd);
 }
 

Modified: trunk/block-qcow.c
===================================================================
--- trunk/block-qcow.c  2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/block-qcow.c  2009-04-13 16:31:01 UTC (rev 7103)
@@ -583,7 +583,7 @@
     if (!acb->cluster_offset) {
         if (bs->backing_hd) {
             /* read from the base image */
-            acb->hd_iov.iov_base = acb->buf;
+            acb->hd_iov.iov_base = (void *)acb->buf;
             acb->hd_iov.iov_len = acb->n * 512;
             qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1);
             acb->hd_aiocb = bdrv_aio_readv(bs->backing_hd, acb->sector_num,
@@ -607,7 +607,7 @@
             ret = -EIO;
             goto done;
         }
-        acb->hd_iov.iov_base = acb->buf;
+        acb->hd_iov.iov_base = (void *)acb->buf;
         acb->hd_iov.iov_len = acb->n * 512;
         qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1);
         acb->hd_aiocb = bdrv_aio_readv(s->hd,
@@ -643,7 +643,7 @@
     if (qiov->niov > 1)
         acb->buf = acb->orig_buf = qemu_memalign(512, qiov->size);
     else
-        acb->buf = qiov->iov->iov_base;
+        acb->buf = (uint8_t *)qiov->iov->iov_base;
     acb->nb_sectors = nb_sectors;
     acb->n = 0;
     acb->cluster_offset = 0;
@@ -738,8 +738,9 @@
     if (qiov->niov > 1) {
         acb->buf = acb->orig_buf = qemu_memalign(512, qiov->size);
         qemu_iovec_to_buffer(qiov, acb->buf);
-    } else
-        acb->buf = qiov->iov->iov_base;
+    } else {
+        acb->buf = (uint8_t *)qiov->iov->iov_base;
+    }
     acb->nb_sectors = nb_sectors;
     acb->n = 0;
 

Modified: trunk/block-qcow2.c
===================================================================
--- trunk/block-qcow2.c 2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/block-qcow2.c 2009-04-13 16:31:01 UTC (rev 7103)
@@ -1346,7 +1346,7 @@
             n1 = backing_read1(bs->backing_hd, acb->sector_num,
                                acb->buf, acb->n);
             if (n1 > 0) {
-                acb->hd_iov.iov_base = acb->buf;
+                acb->hd_iov.iov_base = (void *)acb->buf;
                 acb->hd_iov.iov_len = acb->n * 512;
                 qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1);
                 acb->hd_aiocb = bdrv_aio_readv(bs->backing_hd, acb->sector_num,
@@ -1381,7 +1381,7 @@
             goto done;
         }
 
-        acb->hd_iov.iov_base = acb->buf;
+        acb->hd_iov.iov_base = (void *)acb->buf;
         acb->hd_iov.iov_len = acb->n * 512;
         qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1);
         acb->hd_aiocb = bdrv_aio_readv(s->hd,
@@ -1417,8 +1417,9 @@
         acb->buf = acb->orig_buf = qemu_memalign(512, qiov->size);
         if (is_write)
             qemu_iovec_to_buffer(qiov, acb->buf);
-    } else
-        acb->buf = qiov->iov->iov_base;
+    } else {
+        acb->buf = (uint8_t *)qiov->iov->iov_base;
+    }
     acb->nb_sectors = nb_sectors;
     acb->n = 0;
     acb->cluster_offset = 0;

Modified: trunk/block-vvfat.c
===================================================================
--- trunk/block-vvfat.c 2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/block-vvfat.c 2009-04-13 16:31:01 UTC (rev 7103)
@@ -1778,7 +1778,7 @@
        }
 
        for (i = 0; i < 0x10 * s->sectors_per_cluster; i++) {
-           int cluster_count;
+           int cluster_count = 0;
 
 DLOG(fprintf(stderr, "check direntry %d: \n", i); print_direntry(direntries + 
i));
            if (is_volume_label(direntries + i) || is_dot(direntries + i) ||

Modified: trunk/block.c
===================================================================
--- trunk/block.c       2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/block.c       2009-04-13 16:31:01 UTC (rev 7103)
@@ -1434,7 +1434,7 @@
     QEMUIOVector qiov;
 
     async_ret = NOT_DONE;
-    iov.iov_base = buf;
+    iov.iov_base = (void *)buf;
     iov.iov_len = nb_sectors * 512;
     qemu_iovec_init_external(&qiov, &iov, 1);
     acb = bdrv_aio_readv(bs, sector_num, &qiov, nb_sectors,

Modified: trunk/bt-host.c
===================================================================
--- trunk/bt-host.c     2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/bt-host.c     2009-04-13 16:31:01 UTC (rev 7103)
@@ -53,7 +53,7 @@
     struct iovec iv[2];
     int ret;
 
-    iv[0].iov_base = &pkt;
+    iv[0].iov_base = (void *)&pkt;
     iv[0].iov_len  = 1;
     iv[1].iov_base = (void *) data;
     iv[1].iov_len  = len;

Modified: trunk/fpu/softfloat-macros.h
===================================================================
--- trunk/fpu/softfloat-macros.h        2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/fpu/softfloat-macros.h        2009-04-13 16:31:01 UTC (rev 7103)
@@ -590,12 +590,12 @@
 
     index = ( a>>27 ) & 15;
     if ( aExp & 1 ) {
-        z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ index ];
+        z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ (int)index ];
         z = ( ( a / z )<<14 ) + ( z<<15 );
         a >>= 1;
     }
     else {
-        z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ index ];
+        z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ (int)index ];
         z = a / z + z;
         z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
         if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );

Modified: trunk/hw/ide.c
===================================================================
--- trunk/hw/ide.c      2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/hw/ide.c      2009-04-13 16:31:01 UTC (rev 7103)
@@ -1469,7 +1469,7 @@
 #ifdef DEBUG_AIO
     printf("aio_read_cd: lba=%u n=%d\n", s->lba, n);
 #endif
-    bm->iov.iov_base = s->io_buffer + data_offset;
+    bm->iov.iov_base = (void *)(s->io_buffer + data_offset);
     bm->iov.iov_len = n * 4 * 512;
     qemu_iovec_init_external(&bm->qiov, &bm->iov, 1);
     bm->aiocb = bdrv_aio_readv(s->bs, (int64_t)s->lba << 2, &bm->qiov,

Modified: trunk/hw/scsi-disk.c
===================================================================
--- trunk/hw/scsi-disk.c        2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/hw/scsi-disk.c        2009-04-13 16:31:01 UTC (rev 7103)
@@ -335,7 +335,7 @@
         BADF("Bad buffer tag 0x%x\n", tag);
         return NULL;
     }
-    return r->iov.iov_base;
+    return (uint8_t *)r->iov.iov_base;
 }
 
 /* Execute a scsi command.  Returns the length of the data expected by the
@@ -365,7 +365,7 @@
     /* ??? Tags are not unique for different luns.  We only implement a
        single lun, so this should not matter.  */
     r = scsi_new_request(s, tag);
-    outbuf = r->iov.iov_base;
+    outbuf = (uint8_t *)r->iov.iov_base;
     is_write = 0;
     DPRINTF("Command: lun=%d tag=0x%x data=0x%02x", lun, tag, buf[0]);
     switch (command >> 5) {

Modified: trunk/hw/virtio-console.c
===================================================================
--- trunk/hw/virtio-console.c   2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/hw/virtio-console.c   2009-04-13 16:31:01 UTC (rev 7103)
@@ -38,8 +38,10 @@
         ssize_t len = 0;
         int d;
 
-        for (d=0; d < elem.out_num; d++)
-            len += qemu_chr_write(s->chr, 
elem.out_sg[d].iov_base,elem.out_sg[d].iov_len);
+        for (d = 0; d < elem.out_num; d++) {
+            len += qemu_chr_write(s->chr, (uint8_t *)elem.out_sg[d].iov_base,
+                                  elem.out_sg[d].iov_len);
+        }
         virtqueue_push(vq, &elem, len);
         virtio_notify(vdev, vq);
     }

Modified: trunk/hw/virtio-net.c
===================================================================
--- trunk/hw/virtio-net.c       2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/hw/virtio-net.c       2009-04-13 16:31:01 UTC (rev 7103)
@@ -313,7 +313,7 @@
 static int receive_header(VirtIONet *n, struct iovec *iov, int iovcnt,
                           const void *buf, size_t size, size_t hdr_len)
 {
-    struct virtio_net_hdr *hdr = iov[0].iov_base;
+    struct virtio_net_hdr *hdr = (struct virtio_net_hdr *)iov[0].iov_base;
     int offset = 0;
 
     hdr->flags = 0;

Modified: trunk/net.c
===================================================================
--- trunk/net.c 2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/net.c 2009-04-13 16:31:01 UTC (rev 7103)
@@ -626,7 +626,7 @@
     }
 
     /* XXX: better tmp dir construction */
-    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
+    snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%ld", (long)getpid());
     if (mkdir(smb_dir, 0700) < 0) {
         fprintf(stderr, "qemu: could not create samba server dir '%s'\n", 
smb_dir);
         exit(1);
@@ -740,7 +740,7 @@
     struct strbuf sbuf;
     int f = 0;
     sbuf.maxlen = sizeof(buf);
-    sbuf.buf = buf;
+    sbuf.buf = (char *)buf;
     size = getmsg(s->fd, NULL, &sbuf, &f) >=0 ? sbuf.len : -1;
 #else
     size = read(s->fd, buf, sizeof(buf));
@@ -796,7 +796,7 @@
  * Allocate TAP device, returns opened fd.
  * Stores dev name in the first arg(must be large enough).
  */
-int tap_alloc(char *dev, size_t dev_size)
+static int tap_alloc(char *dev, size_t dev_size)
 {
     int tap_fd, if_fd, ppa = -1;
     static int ip_fd = 0;

Modified: trunk/qemu-char.c
===================================================================
--- trunk/qemu-char.c   2009-04-13 16:27:08 UTC (rev 7102)
+++ trunk/qemu-char.c   2009-04-13 16:31:01 UTC (rev 7103)
@@ -754,8 +754,8 @@
 
 #ifdef __sun__
 /* Once Solaris has openpty(), this is going to be removed. */
-int openpty(int *amaster, int *aslave, char *name,
-            struct termios *termp, struct winsize *winp)
+static int openpty(int *amaster, int *aslave, char *name,
+                   struct termios *termp, struct winsize *winp)
 {
         const char *slave;
         int mfd = -1, sfd = -1;
@@ -795,7 +795,7 @@
         return -1;
 }
 
-void cfmakeraw (struct termios *termios_p)
+static void cfmakeraw (struct termios *termios_p)
 {
         termios_p->c_iflag &=
                 ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]