Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 13 Apr 2009 16:31:01 +0000 (16:31 +0000)
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Mon, 13 Apr 2009 16:31:01 +0000 (16:31 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162

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

index b9a1971..17e3292 100644 (file)
@@ -95,10 +95,10 @@ static int cow_open(BlockDriverState *bs, const char *filename, int flags)
 
     /* 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 int cow_write(BlockDriverState *bs, int64_t sector_num,
 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);
 }
 
index b60f4c1..b66ade3 100644 (file)
@@ -583,7 +583,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
     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 @@ static void qcow_aio_read_cb(void *opaque, int ret)
             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 @@ static BlockDriverAIOCB *qcow_aio_readv(BlockDriverState *bs,
     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 @@ static BlockDriverAIOCB *qcow_aio_writev(BlockDriverState *bs,
     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;
 
index 3bd38b0..da8fb42 100644 (file)
@@ -1346,7 +1346,7 @@ static void qcow_aio_read_cb(void *opaque, int ret)
             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 @@ static void qcow_aio_read_cb(void *opaque, int ret)
             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 @@ static QCowAIOCB *qcow_aio_setup(BlockDriverState *bs,
         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;
index 01e9c04..429c37c 100644 (file)
@@ -1778,7 +1778,7 @@ DLOG(fprintf(stderr, "read cluster %d (sector %d)\n", (int)cluster_num, (int)clu
        }
 
        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) ||
diff --git a/block.c b/block.c
index 74d19ad..836a6e5 100644 (file)
--- a/block.c
+++ b/block.c
@@ -1434,7 +1434,7 @@ static int bdrv_read_em(BlockDriverState *bs, int64_t sector_num,
     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,
index 3701fbd..9a06578 100644 (file)
--- a/bt-host.c
+++ b/bt-host.c
@@ -53,7 +53,7 @@ static void bt_host_send(struct HCIInfo *hci,
     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;
index 0502fb8..7838228 100644 (file)
@@ -590,12 +590,12 @@ static bits32 estimateSqrt32( int16 aExp, bits32 a )
 
     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 );
index f187546..fc70f36 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1469,7 +1469,7 @@ static void ide_atapi_cmd_read_dma_cb(void *opaque, int ret)
 #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,
index 2edd047..8f1afab 100644 (file)
@@ -335,7 +335,7 @@ static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag)
         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 @@ static int32_t scsi_send_command(SCSIDevice *d, uint32_t tag,
     /* ??? 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) {
index 92455c8..b263281 100644 (file)
@@ -38,8 +38,10 @@ static void virtio_console_handle_output(VirtIODevice *vdev, VirtQueue *vq)
         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);
     }
index ae9b7d9..88ec1ac 100644 (file)
@@ -313,7 +313,7 @@ static int iov_fill(struct iovec *iov, int iovcnt, const void *buf, int count)
 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;
diff --git a/net.c b/net.c
index f67b5b8..5365891 100644 (file)
--- a/net.c
+++ b/net.c
@@ -626,7 +626,7 @@ void net_slirp_smb(const char *exported_dir)
     }
 
     /* 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 @@ static void tap_send(void *opaque)
     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 @@ static int tap_open(char *ifname, int ifname_size)
  * 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;
index 7a852b7..664cbfd 100644 (file)
@@ -754,8 +754,8 @@ static CharDriverState *qemu_chr_open_stdio(void)
 
 #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 @@ err:
         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);