Re: [PATCH] build: really silence the 32-bit warning

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

 



On 05/14/2012 11:05 AM, Eric Blake wrote:
Commit cdce2f42d tried to silence a compiler warning on 32-bit builds,
but the gcc shipped with RHEL 5 is old enough that the type conversion
via multiplication by 1 was insufficient for the task.

* src/qemu/qemu_monitor.c (qemuMonitorBlockJob): Previous attempt
didn't get past all gcc versions.
---

Pushing under the build-breaker rule.

  src/qemu/qemu_monitor.c |    5 +++--
  1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 0d4319d..7d69c67 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2785,13 +2785,14 @@ int qemuMonitorBlockJob(qemuMonitorPtr mon,
                modern);

      /* Convert bandwidth MiB to bytes */
-    if (bandwidth * 1ULL>  ULLONG_MAX / 1024 / 1024) {
+    speed = bandwidth;
+    if (speed>  ULLONG_MAX / 1024 / 1024) {
          qemuReportError(VIR_ERR_OVERFLOW,
                          _("bandwidth must be less than %llu"),
                          ULLONG_MAX / 1024 / 1024);
          return -1;
      }
-    speed = bandwidth * 1024ULL * 1024ULL;
+    speed<<= 20;

      if (mon->json)
          ret = qemuMonitorJSONBlockJob(mon, device, base, speed, info, mode,
ACK

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]