]> xenbits.xensource.com Git - libvirt.git/commitdiff
build: really silence the 32-bit warning
authorEric Blake <eblake@redhat.com>
Sat, 12 May 2012 13:24:08 +0000 (07:24 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 14 May 2012 15:14:58 +0000 (09:14 -0600)
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.

src/qemu/qemu_monitor.c

index 0d4319da86304f51411be6f2f3a32fffe2c172ed..7d69c679c234a9a8ca0a36b103ab4c0cd7b2f586 100644 (file)
@@ -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,