From 3f4cb3d37fb74db3580029624c8acd83dd5f4787 Mon Sep 17 00:00:00 2001 From: blueswir1 Date: Mon, 13 Apr 2009 16:31:01 +0000 Subject: Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static' git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162 --- block-cow.c | 10 +++++----- block-qcow.c | 11 ++++++----- block-qcow2.c | 9 +++++---- block-vvfat.c | 2 +- block.c | 2 +- bt-host.c | 2 +- fpu/softfloat-macros.h | 4 ++-- hw/ide.c | 2 +- hw/scsi-disk.c | 4 ++-- hw/virtio-console.c | 6 ++++-- hw/virtio-net.c | 2 +- net.c | 6 +++--- qemu-char.c | 6 +++--- 13 files changed, 35 insertions(+), 31 deletions(-) diff --git a/block-cow.c b/block-cow.c index b9a1971b17..17e3292258 100644 --- a/block-cow.c +++ b/block-cow.c @@ -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); } diff --git a/block-qcow.c b/block-qcow.c index b60f4c1921..b66ade35a7 100644 --- a/block-qcow.c +++ b/block-qcow.c @@ -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; diff --git a/block-qcow2.c b/block-qcow2.c index 3bd38b0d9d..da8fb42b0c 100644 --- a/block-qcow2.c +++ b/block-qcow2.c @@ -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; diff --git a/block-vvfat.c b/block-vvfat.c index 01e9c0400c..429c37c5e7 100644 --- a/block-vvfat.c +++ b/block-vvfat.c @@ -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 74d19ad288..836a6e5107 100644 --- 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, diff --git a/bt-host.c b/bt-host.c index 3701fbdbe7..9a06578c99 100644 --- 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; diff --git a/fpu/softfloat-macros.h b/fpu/softfloat-macros.h index 0502fb8949..783822820e 100644 --- a/fpu/softfloat-macros.h +++ b/fpu/softfloat-macros.h @@ -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 ); diff --git a/hw/ide.c b/hw/ide.c index f187546b4c..fc70f36967 100644 --- 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, diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 2edd047a8f..8f1afab51a 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -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) { diff --git a/hw/virtio-console.c b/hw/virtio-console.c index 92455c850f..b263281d8f 100644 --- a/hw/virtio-console.c +++ b/hw/virtio-console.c @@ -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); } diff --git a/hw/virtio-net.c b/hw/virtio-net.c index ae9b7d92c7..88ec1ac793 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -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 f67b5b807a..536589130b 100644 --- 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; diff --git a/qemu-char.c b/qemu-char.c index 7a852b7ba0..664cbfdbd5 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -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); -- cgit v1.2.1