two little build fixes
PATCH 2/2 scsi: fix warning
In reply to Gerd Hoffmannhw/scsi-bus.c:758: warning: ‘xfer’ may be used uninitialized in this function
Isn't true, but older gcc versions (for example 4.1 as shipped in rhel5) are not clever enougth to figure, so sprinkle in a default: line to make them happy.
--- hw/scsi-bus.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
hw/scsi-bus.c +2 -0
@@ -761,6 +761,7 @@ static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
@@ -784,6 +785,7 @@ static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
Signature · 1 line
1.7.1
cover two little build fixes
Hi,
$subject says all.
cheers,
Gerd
Gerd Hoffmann (2):
avoid asprintf (not available on mingw)
scsi: fix warning
hw/msix.c | 5 ++--- hw/scsi-bus.c | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-)
PATCH 1/2 avoid asprintf (not available on mingw64)
--- hw/msix.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)
hw/msix.c +2 -3
@@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,return -EINVAL ; } -if (asprintf (&name,"%s-msix" , dev->name) ==-1 ) { -return -ENOMEM ; - } + name =g_malloc (sizeof (dev->name) +5 ); +snprintf (name,sizeof (dev->name) +5 ,"%s-msix" , dev->name);memory_region_init (&dev->msix_exclusive_bar, name,MSIX_EXCLUSIVE_BAR_SIZE );
Signature · 1 line
1.7.1
Re: [Qemu-devel] [PATCH 2/2] scsi: fix warning
In reply to Gerd HoffmannIl 10/08/2012 15:26, Gerd Hoffmann ha scritto:
Quoted 26 lines
hw/scsi-bus.c:758: warning: ‘xfer’ may be used uninitialized in this functionIsn't true, but older gcc versions (for example 4.1 as shipped in rhel5) are not clever enougth to figure, so sprinkle in a default: line to make them happy.
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/scsi-bus.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)hw/scsi-bus.c +1
-0@@ -761,6 +761,7 @@ static int ata_passthrough_12_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
hw/scsi-bus.c static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf) · line 791
Quoted 7 lines
hw/scsi-bus.c +1
-0@@ -784,6 +785,7 @@ static int ata_passthrough_16_xfer_size(SCSIDevice *dev, uint8_t *buf)switch (length) {case 0 :case 3 :/* USB-specific. */ +default : xfer =0 ;break ;case 1 :
Paolo
Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
In reply to Gerd HoffmannQuoted 10 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/msix.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)hw/msix.c +0
-0
hw/msix.c int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, · line 313
Quoted 10 lines
hw/msix.c +2
-3@@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,return -EINVAL ; } -if (asprintf (&name,"%s-msix" , dev->name) ==-1 ) { -return -ENOMEM ; - } + name =g_malloc (sizeof (dev->name) +5 ); +snprintf (name,sizeof (dev->name) +5 ,"%s-msix" , dev->name);memory_region_init (&dev->msix_exclusive_bar, name,MSIX_EXCLUSIVE_BAR_SIZE );
What about g_strdup_printf()?
Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
Quoted 21 lines · Markus Armbruster
Quoted 19 lines · Gerd Hoffmann
Signed-off-by Gerd Hoffmann <[email protected]>--- hw/msix.c | 5 ++--- 1 files changed, 2 insertions(+), 3 deletions(-)hw/msix.c +2
-3@@ -307,9 +307,8 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,return -EINVAL ; } -if (asprintf (&name,"%s-msix" , dev->name) ==-1 ) { -return -ENOMEM ; - } + name =g_malloc (sizeof (dev->name) +5 ); +snprintf (name,sizeof (dev->name) +5 ,"%s-msix" , dev->name);
Quoted 3 lines
hw/msix.c int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries, · line 313
Quoted 1 line
hw/msix.c +0
-0memory_region_init (&dev->msix_exclusive_bar, name,MSIX_EXCLUSIVE_BAR_SIZE );What about
g_strdup_printf()?
+1
In either case, free() below needs to be changed to g_free().
Re: [Qemu-devel] [PATCH 1/2] avoid asprintf (not available on mingw64)
In reply to Markus ArmbrusterQuoted 3 lines · Markus Armbruster
Quoted 1 line
- if (
asprintf(&name, "%s-msix", dev->name)== -1) {What about
g_strdup_printf()?
Ah, nice. Didn't know glib has this.
cheers,
Gerd