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

[libvirt] [PATCH 09/32] Convert 'int i' to 'size_t i' in src/vbox/ files



From: "Daniel P. Berrange" <berrange redhat com>

Convert the type of loop iterators named 'i', 'j', k',
'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or
'unsigned int', also santizing 'ii', 'jj', 'kk' to use
the normal 'i', 'j', 'k' naming

Signed-off-by: Daniel P. Berrange <berrange redhat com>
---
 src/vbox/vbox_XPCOMCGlue.c |   6 +-
 src/vbox/vbox_tmpl.c       | 159 +++++++++++++++++++++++----------------------
 2 files changed, 85 insertions(+), 80 deletions(-)

diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 271d9ef..38d079b 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -186,7 +186,7 @@ cleanup:
 int
 VBoxCGlueInit(unsigned int *version)
 {
-    int i;
+    size_t i;
     static const char *knownDirs[] = {
         "/usr/lib/virtualbox",
         "/usr/lib/virtualbox-ose",
@@ -336,7 +336,7 @@ vboxArrayGetWithUintArg(vboxArray *array, void *self, void *getter, PRUint32 arg
 void
 vboxArrayRelease(vboxArray *array)
 {
-    int i;
+    size_t i;
     nsISupports *supports;
 
     if (array->items == NULL) {
@@ -363,7 +363,7 @@ vboxArrayRelease(vboxArray *array)
 void
 vboxArrayUnalloc(vboxArray *array)
 {
-    int i;
+    size_t i;
     void *item;
 
     if (array->items == NULL) {
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index d6d34c1..f551762 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -289,7 +289,7 @@ static void nsIDtoChar(unsigned char *uuid, const nsID *iid) {
     char uuidstrsrc[VIR_UUID_STRING_BUFLEN];
     char uuidstrdst[VIR_UUID_STRING_BUFLEN];
     unsigned char uuidinterim[VIR_UUID_BUFLEN];
-    int i;
+    size_t i;
 
     memcpy(uuidinterim, iid, VIR_UUID_BUFLEN);
     virUUIDFormat(uuidinterim, uuidstrsrc);
@@ -329,7 +329,7 @@ static void nsIDFromChar(nsID *iid, const unsigned char *uuid) {
     char uuidstrsrc[VIR_UUID_STRING_BUFLEN];
     char uuidstrdst[VIR_UUID_STRING_BUFLEN];
     unsigned char uuidinterim[VIR_UUID_BUFLEN];
-    int i;
+    size_t i;
 
     virUUIDFormat(uuid, uuidstrsrc);
 
@@ -1151,7 +1151,7 @@ static int vboxConnectListDomains(virConnectPtr conn, int *ids, int nids) {
     vboxArray machines = VBOX_ARRAY_INITIALIZER;
     PRUint32 state;
     nsresult rc;
-    int i, j;
+    size_t i, j;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
     if (NS_FAILED(rc)) {
@@ -1188,7 +1188,7 @@ static int vboxConnectNumOfDomains(virConnectPtr conn) {
     vboxArray machines = VBOX_ARRAY_INITIALIZER;
     PRUint32 state;
     nsresult rc;
-    int i;
+    size_t i;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
     if (NS_FAILED(rc)) {
@@ -1319,7 +1319,8 @@ static virDomainPtr vboxDomainLookupByUUID(virConnectPtr conn, const unsigned ch
     char      *machineNameUtf8  = NULL;
     PRUnichar *machineNameUtf16 = NULL;
     unsigned char iid_as_uuid[VIR_UUID_BUFLEN];
-    int i, matched = 0;
+    size_t i;
+    int matched = 0;
     nsresult rc;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
@@ -1389,7 +1390,8 @@ static virDomainPtr vboxDomainLookupByName(virConnectPtr conn, const char *name)
     char      *machineNameUtf8  = NULL;
     PRUnichar *machineNameUtf16 = NULL;
     unsigned char uuid[VIR_UUID_BUFLEN];
-    int i, matched = 0;
+    size_t i;
+    int matched = 0;
     nsresult rc;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
@@ -1457,7 +1459,8 @@ static int vboxDomainIsActive(virDomainPtr dom) {
     char      *machineNameUtf8  = NULL;
     PRUnichar *machineNameUtf16 = NULL;
     unsigned char uuid[VIR_UUID_BUFLEN];
-    int i, matched = 0;
+    size_t i;
+    int matched = 0;
     nsresult rc;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
@@ -1917,7 +1920,7 @@ static int vboxDomainGetInfo(virDomainPtr dom, virDomainInfoPtr info) {
     char *machineName    = NULL;
     PRUnichar *machineNameUtf16 = NULL;
     nsresult rc;
-    int i = 0;
+    size_t i = 0;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
     if (NS_FAILED(rc)) {
@@ -2252,7 +2255,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
 
         machine->vtbl->GetAccessible(machine, &accessible);
         if (accessible) {
-            int i = 0;
+            size_t i = 0;
             PRBool PAEEnabled                   = PR_FALSE;
             PRBool ACPIEnabled                  = PR_FALSE;
             PRBool IOAPICEnabled                = PR_FALSE;
@@ -3459,7 +3462,7 @@ static int vboxConnectListDefinedDomains(virConnectPtr conn, char ** const names
     PRUnichar *machineNameUtf16 = NULL;
     PRUint32 state;
     nsresult rc;
-    int i, j;
+    size_t i, j;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
     if (NS_FAILED(rc)) {
@@ -3469,6 +3472,8 @@ static int vboxConnectListDefinedDomains(virConnectPtr conn, char ** const names
         goto cleanup;
     }
 
+    memset(names, 0, sizeof(names[i]) * maxnames);
+
     ret = 0;
     for (i = 0, j = 0; (i < machines.count) && (j < maxnames); i++) {
         IMachine *machine = machines.items[i];
@@ -3485,7 +3490,7 @@ static int vboxConnectListDefinedDomains(virConnectPtr conn, char ** const names
                     if (VIR_STRDUP(names[j], machineName) < 0) {
                         VBOX_UTF16_FREE(machineNameUtf16);
                         VBOX_UTF8_FREE(machineName);
-                        for (; j >= 0; j--)
+                        for (j = 0; j < maxnames; j++)
                             VIR_FREE(names[j]);
                         ret = -1;
                         goto cleanup;
@@ -3509,7 +3514,7 @@ static int vboxConnectNumOfDefinedDomains(virConnectPtr conn) {
     vboxArray machines = VBOX_ARRAY_INITIALIZER;
     PRUint32 state       = MachineState_Null;
     nsresult rc;
-    int i;
+    size_t i;
 
     rc = vboxArrayGet(&machines, data->vboxObj, data->vboxObj->vtbl->GetMachines);
     if (NS_FAILED(rc)) {
@@ -3543,7 +3548,7 @@ cleanup:
 
 
 static int
-vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
+vboxStartMachine(virDomainPtr dom, int maxDomID, IMachine *machine,
                  vboxIID *iid ATTRIBUTE_UNUSED /* >= 4.0 */)
 {
     VBOX_OBJECT_CHECK(dom->conn, int, -1);
@@ -3694,7 +3699,7 @@ vboxStartMachine(virDomainPtr dom, int i, IMachine *machine,
             ret = -1;
         } else {
             /* all ok set the domid */
-            dom->id = i + 1;
+            dom->id = maxDomID + 1;
             ret = 0;
         }
     }
@@ -3714,7 +3719,7 @@ static int vboxDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) {
     vboxArray machines = VBOX_ARRAY_INITIALIZER;
     unsigned char uuid[VIR_UUID_BUFLEN] = {0};
     nsresult rc;
-    int i = 0;
+    size_t i = 0;
 
     virCheckFlags(0, -1);
 
@@ -3786,7 +3791,7 @@ vboxSetBootDeviceOrder(virDomainDefPtr def, vboxGlobalData *data,
 {
     ISystemProperties *systemProperties = NULL;
     PRUint32 maxBootPosition            = 0;
-    int i = 0;
+    size_t i = 0;
 
     VIR_DEBUG("def->os.type             %s", def->os.type);
     VIR_DEBUG("def->os.arch             %s", virArchToString(def->os.arch));
@@ -3837,7 +3842,7 @@ vboxSetBootDeviceOrder(virDomainDefPtr def, vboxGlobalData *data,
 static void
 vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 {
-    int i;
+    size_t i;
     nsresult rc;
 
 #if VBOX_API_VERSION < 3001
@@ -3845,18 +3850,18 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
         return;
 
     for (i = 0; i < def->ndisks; i++) {
-        VIR_DEBUG("disk(%d) type:       %d", i, def->disks[i]->type);
-        VIR_DEBUG("disk(%d) device:     %d", i, def->disks[i]->device);
-        VIR_DEBUG("disk(%d) bus:        %d", i, def->disks[i]->bus);
-        VIR_DEBUG("disk(%d) src:        %s", i, def->disks[i]->src);
-        VIR_DEBUG("disk(%d) dst:        %s", i, def->disks[i]->dst);
-        VIR_DEBUG("disk(%d) driverName: %s", i, def->disks[i]->driverName);
-        VIR_DEBUG("disk(%d) driverType: %s", i,
+        VIR_DEBUG("disk(%zu) type:       %d", i, def->disks[i]->type);
+        VIR_DEBUG("disk(%zu) device:     %d", i, def->disks[i]->device);
+        VIR_DEBUG("disk(%zu) bus:        %d", i, def->disks[i]->bus);
+        VIR_DEBUG("disk(%zu) src:        %s", i, def->disks[i]->src);
+        VIR_DEBUG("disk(%zu) dst:        %s", i, def->disks[i]->dst);
+        VIR_DEBUG("disk(%zu) driverName: %s", i, def->disks[i]->driverName);
+        VIR_DEBUG("disk(%zu) driverType: %s", i,
                   virStorageFileFormatTypeToString(def->disks[i]->format));
-        VIR_DEBUG("disk(%d) cachemode:  %d", i, def->disks[i]->cachemode);
-        VIR_DEBUG("disk(%d) readonly:   %s", i, (def->disks[i]->readonly
+        VIR_DEBUG("disk(%zu) cachemode:  %d", i, def->disks[i]->cachemode);
+        VIR_DEBUG("disk(%zu) readonly:   %s", i, (def->disks[i]->readonly
                                              ? "True" : "False"));
-        VIR_DEBUG("disk(%d) shared:     %s", i, (def->disks[i]->shared
+        VIR_DEBUG("disk(%zu) shared:     %s", i, (def->disks[i]->shared
                                              ? "True" : "False"));
 
         if (def->disks[i]->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
@@ -4126,18 +4131,18 @@ vboxAttachDrives(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     }
 
     for (i = 0; i < def->ndisks && !error; i++) {
-        VIR_DEBUG("disk(%d) type:       %d", i, def->disks[i]->type);
-        VIR_DEBUG("disk(%d) device:     %d", i, def->disks[i]->device);
-        VIR_DEBUG("disk(%d) bus:        %d", i, def->disks[i]->bus);
-        VIR_DEBUG("disk(%d) src:        %s", i, def->disks[i]->src);
-        VIR_DEBUG("disk(%d) dst:        %s", i, def->disks[i]->dst);
-        VIR_DEBUG("disk(%d) driverName: %s", i, def->disks[i]->driverName);
-        VIR_DEBUG("disk(%d) driverType: %s", i,
+        VIR_DEBUG("disk(%zu) type:       %d", i, def->disks[i]->type);
+        VIR_DEBUG("disk(%zu) device:     %d", i, def->disks[i]->device);
+        VIR_DEBUG("disk(%zu) bus:        %d", i, def->disks[i]->bus);
+        VIR_DEBUG("disk(%zu) src:        %s", i, def->disks[i]->src);
+        VIR_DEBUG("disk(%zu) dst:        %s", i, def->disks[i]->dst);
+        VIR_DEBUG("disk(%zu) driverName: %s", i, def->disks[i]->driverName);
+        VIR_DEBUG("disk(%zu) driverType: %s", i,
                   virStorageFileFormatTypeToString(def->disks[i]->format));
-        VIR_DEBUG("disk(%d) cachemode:  %d", i, def->disks[i]->cachemode);
-        VIR_DEBUG("disk(%d) readonly:   %s", i, (def->disks[i]->readonly
+        VIR_DEBUG("disk(%zu) cachemode:  %d", i, def->disks[i]->cachemode);
+        VIR_DEBUG("disk(%zu) readonly:   %s", i, (def->disks[i]->readonly
                                              ? "True" : "False"));
-        VIR_DEBUG("disk(%d) shared:     %s", i, (def->disks[i]->shared
+        VIR_DEBUG("disk(%zu) shared:     %s", i, (def->disks[i]->shared
                                              ? "True" : "False"));
 
         if (def->disks[i]->type == VIR_DOMAIN_DISK_TYPE_FILE &&
@@ -4368,7 +4373,7 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     PRUint32 chipsetType                = ChipsetType_Null;
 #endif /* VBOX_API_VERSION >= 4001 */
     PRUint32 networkAdapterCount        = 0;
-    int i = 0;
+    size_t i = 0;
 
 #if VBOX_API_VERSION >= 4001
     machine->vtbl->GetChipsetType(machine, &chipsetType);
@@ -4407,20 +4412,20 @@ vboxAttachNetwork(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
                  def->nets[i]->mac.addr[5]);
         macaddrvbox[VIR_MAC_STRING_BUFLEN - 6] = '\0';
 
-        VIR_DEBUG("NIC(%d): Type:   %d", i, def->nets[i]->type);
-        VIR_DEBUG("NIC(%d): Model:  %s", i, def->nets[i]->model);
-        VIR_DEBUG("NIC(%d): Mac:    %s", i, macaddr);
-        VIR_DEBUG("NIC(%d): ifname: %s", i, def->nets[i]->ifname);
+        VIR_DEBUG("NIC(%zu): Type:   %d", i, def->nets[i]->type);
+        VIR_DEBUG("NIC(%zu): Model:  %s", i, def->nets[i]->model);
+        VIR_DEBUG("NIC(%zu): Mac:    %s", i, macaddr);
+        VIR_DEBUG("NIC(%zu): ifname: %s", i, def->nets[i]->ifname);
         if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
-            VIR_DEBUG("NIC(%d): name:    %s", i, def->nets[i]->data.network.name);
+            VIR_DEBUG("NIC(%zu): name:    %s", i, def->nets[i]->data.network.name);
         } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_INTERNAL) {
-            VIR_DEBUG("NIC(%d): name:   %s", i, def->nets[i]->data.internal.name);
+            VIR_DEBUG("NIC(%zu): name:   %s", i, def->nets[i]->data.internal.name);
         } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_USER) {
-            VIR_DEBUG("NIC(%d): NAT.", i);
+            VIR_DEBUG("NIC(%zu): NAT.", i);
         } else if (def->nets[i]->type == VIR_DOMAIN_NET_TYPE_BRIDGE) {
-            VIR_DEBUG("NIC(%d): brname: %s", i, def->nets[i]->data.bridge.brname);
-            VIR_DEBUG("NIC(%d): script: %s", i, def->nets[i]->script);
-            VIR_DEBUG("NIC(%d): ipaddr: %s", i, def->nets[i]->data.bridge.ipaddr);
+            VIR_DEBUG("NIC(%zu): brname: %s", i, def->nets[i]->data.bridge.brname);
+            VIR_DEBUG("NIC(%zu): script: %s", i, def->nets[i]->script);
+            VIR_DEBUG("NIC(%zu): ipaddr: %s", i, def->nets[i]->data.bridge.ipaddr);
         }
 
         machine->vtbl->GetNetworkAdapter(machine, i, &adapter);
@@ -4539,7 +4544,7 @@ vboxAttachSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 {
     ISystemProperties *systemProperties = NULL;
     PRUint32 serialPortCount            = 0;
-    int i = 0;
+    size_t i = 0;
 
     data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties);
     if (systemProperties) {
@@ -4554,8 +4559,8 @@ vboxAttachSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     for (i = 0; (i < def->nserials) && (i < serialPortCount); i++) {
         ISerialPort *serialPort = NULL;
 
-        VIR_DEBUG("SerialPort(%d): Type: %d", i, def->serials[i]->source.type);
-        VIR_DEBUG("SerialPort(%d): target.port: %d", i,
+        VIR_DEBUG("SerialPort(%zu): Type: %d", i, def->serials[i]->source.type);
+        VIR_DEBUG("SerialPort(%zu): target.port: %d", i,
               def->serials[i]->target.port);
 
         machine->vtbl->GetSerialPort(machine, i, &serialPort);
@@ -4582,12 +4587,12 @@ vboxAttachSerial(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
             if (def->serials[i]->target.port == 0) {
                 serialPort->vtbl->SetIRQ(serialPort, 4);
                 serialPort->vtbl->SetIOBase(serialPort, 1016);
-                VIR_DEBUG(" serialPort-%d irq: %d, iobase 0x%x, path: %s",
+                VIR_DEBUG(" serialPort-%zu irq: %d, iobase 0x%x, path: %s",
                       i, 4, 1016, def->serials[i]->source.data.file.path);
             } else if (def->serials[i]->target.port == 1) {
                 serialPort->vtbl->SetIRQ(serialPort, 3);
                 serialPort->vtbl->SetIOBase(serialPort, 760);
-                VIR_DEBUG(" serialPort-%d irq: %d, iobase 0x%x, path: %s",
+                VIR_DEBUG(" serialPort-%zu irq: %d, iobase 0x%x, path: %s",
                       i, 3, 760, def->serials[i]->source.data.file.path);
             }
 
@@ -4615,7 +4620,7 @@ vboxAttachParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 {
     ISystemProperties *systemProperties = NULL;
     PRUint32 parallelPortCount          = 0;
-    int i = 0;
+    size_t i = 0;
 
     data->vboxObj->vtbl->GetSystemProperties(data->vboxObj, &systemProperties);
     if (systemProperties) {
@@ -4630,8 +4635,8 @@ vboxAttachParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     for (i = 0; (i < def->nparallels) && (i < parallelPortCount); i++) {
         IParallelPort *parallelPort = NULL;
 
-        VIR_DEBUG("ParallelPort(%d): Type: %d", i, def->parallels[i]->source.type);
-        VIR_DEBUG("ParallelPort(%d): target.port: %d", i,
+        VIR_DEBUG("ParallelPort(%zu): Type: %d", i, def->parallels[i]->source.type);
+        VIR_DEBUG("ParallelPort(%zu): target.port: %d", i,
               def->parallels[i]->target.port);
 
         machine->vtbl->GetParallelPort(machine, i, &parallelPort);
@@ -4653,12 +4658,12 @@ vboxAttachParallel(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
                 if (i == 0) {
                     parallelPort->vtbl->SetIRQ(parallelPort, 7);
                     parallelPort->vtbl->SetIOBase(parallelPort, 888);
-                    VIR_DEBUG(" parallePort-%d irq: %d, iobase 0x%x, path: %s",
+                    VIR_DEBUG(" parallePort-%zu irq: %d, iobase 0x%x, path: %s",
                           i, 7, 888, def->parallels[i]->source.data.file.path);
                 } else if (i == 1) {
                     parallelPort->vtbl->SetIRQ(parallelPort, 5);
                     parallelPort->vtbl->SetIOBase(parallelPort, 632);
-                    VIR_DEBUG(" parallePort-%d irq: %d, iobase 0x%x, path: %s",
+                    VIR_DEBUG(" parallePort-%zu irq: %d, iobase 0x%x, path: %s",
                           i, 5, 632, def->parallels[i]->source.data.file.path);
                 }
             }
@@ -4706,7 +4711,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
     int guiPresent   = 0;
     char *guiDisplay = NULL;
     char *sdlDisplay = NULL;
-    int i = 0;
+    size_t i = 0;
 
     for (i = 0; i < def->ngraphics; i++) {
 #if VBOX_API_VERSION < 4000
@@ -4895,7 +4900,7 @@ static void
 vboxAttachUSB(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 {
     IUSBController *USBController = NULL;
-    int i = 0;
+    size_t i = 0;
     bool isUSB = false;
 
     if (def->nhostdevs == 0)
@@ -4949,7 +4954,7 @@ vboxAttachUSB(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
                         /* Zero pad for nice alignment when fewer than 9999
                          * devices.
                          */
-                        if (virAsprintf(&filtername, "filter%04d", i) < 0) {
+                        if (virAsprintf(&filtername, "filter%04zu", i) < 0) {
                             virReportOOMError();
                         } else {
                             VBOX_UTF8_TO_UTF16(filtername, &filternameUtf16);
@@ -5002,7 +5007,7 @@ vboxAttachUSB(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 static void
 vboxAttachSharedFolder(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
 {
-    int i;
+    size_t i;
     PRUnichar *nameUtf16;
     PRUnichar *hostPathUtf16;
     PRBool writable;
@@ -5269,7 +5274,7 @@ vboxDomainUndefineFlags(virDomainPtr dom, unsigned int flags)
                  * remove them all so that the machine can be undefined
                  */
                 vboxArray storageControllers = VBOX_ARRAY_INITIALIZER;
-                int i = 0, j = 0;
+                size_t i = 0, j = 0;
 
                 vboxArrayGet(&storageControllers, machine,
                              machine->vtbl->GetStorageControllers);
@@ -5819,7 +5824,7 @@ vboxDomainSnapshotGetAll(virDomainPtr dom,
     top = 1;
     for (next = 0; next < count; next++) {
         vboxArray children = VBOX_ARRAY_INITIALIZER;
-        unsigned int i;
+        size_t i;
 
         if (!list[next]) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
@@ -5874,7 +5879,7 @@ vboxDomainSnapshotGet(vboxGlobalData *data,
     ISnapshot *snapshot = NULL;
     nsresult rc;
     int count = 0;
-    int i;
+    size_t i;
 
     if ((count = vboxDomainSnapshotGetAll(dom, machine, &snapshots)) < 0)
         goto cleanup;
@@ -6208,7 +6213,7 @@ vboxDomainSnapshotListNames(virDomainPtr dom,
     nsresult rc;
     ISnapshot **snapshots = NULL;
     int count = 0;
-    int i;
+    size_t i;
 
     virCheckFlags(VIR_DOMAIN_SNAPSHOT_LIST_ROOTS |
                   VIR_DOMAIN_SNAPSHOT_LIST_METADATA, -1);
@@ -6826,7 +6831,7 @@ vboxDomainSnapshotDeleteTree(vboxGlobalData *data,
     vboxArray children = VBOX_ARRAY_INITIALIZER;
     int ret = -1;
     nsresult rc;
-    unsigned int i;
+    size_t i;
 
     rc = vboxArrayGet(&children, snapshot, snapshot->vtbl->GetChildren);
     if (NS_FAILED(rc)) {
@@ -7489,7 +7494,7 @@ static int vboxNetworkClose(virConnectPtr conn) {
 static int vboxConnectNumOfNetworks(virConnectPtr conn) {
     VBOX_OBJECT_HOST_CHECK(conn, int, 0);
     vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER;
-    int i = 0;
+    size_t i = 0;
 
     vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces);
 
@@ -7522,7 +7527,7 @@ static int vboxConnectNumOfNetworks(virConnectPtr conn) {
 static int vboxConnectListNetworks(virConnectPtr conn, char **const names, int nnames) {
     VBOX_OBJECT_HOST_CHECK(conn, int, 0);
     vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER;
-    int i = 0;
+    size_t i = 0;
 
     vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces);
 
@@ -7567,7 +7572,7 @@ static int vboxConnectListNetworks(virConnectPtr conn, char **const names, int n
 static int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) {
     VBOX_OBJECT_HOST_CHECK(conn, int, 0);
     vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER;
-    int i = 0;
+    size_t i = 0;
 
     vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces);
 
@@ -7600,7 +7605,7 @@ static int vboxConnectNumOfDefinedNetworks(virConnectPtr conn) {
 static int vboxConnectListDefinedNetworks(virConnectPtr conn, char **const names, int nnames) {
     VBOX_OBJECT_HOST_CHECK(conn, int, 0);
     vboxArray networkInterfaces = VBOX_ARRAY_INITIALIZER;
-    int i = 0;
+    size_t i = 0;
 
     vboxArrayGet(&networkInterfaces, host, host->vtbl->GetNetworkInterfaces);
 
@@ -8344,7 +8349,7 @@ static int vboxStoragePoolNumOfVolumes(virStoragePoolPtr pool) {
     vboxArray hardDisks = VBOX_ARRAY_INITIALIZER;
     PRUint32 hardDiskAccessible = 0;
     nsresult rc;
-    int i;
+    size_t i;
 
     rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks);
     if (NS_SUCCEEDED(rc)) {
@@ -8377,7 +8382,7 @@ static int vboxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names
     vboxArray hardDisks = VBOX_ARRAY_INITIALIZER;
     PRUint32 numActive     = 0;
     nsresult rc;
-    int i;
+    size_t i;
 
     rc = vboxArrayGet(&hardDisks, data->vboxObj, data->vboxObj->vtbl->GetHardDisks);
     if (NS_SUCCEEDED(rc)) {
@@ -8424,7 +8429,7 @@ static virStorageVolPtr vboxStorageVolLookupByName(virStoragePoolPtr pool, const
     VBOX_OBJECT_CHECK(pool->conn, virStorageVolPtr, NULL);
     vboxArray hardDisks = VBOX_ARRAY_INITIALIZER;
     nsresult rc;
-    int i;
+    size_t i;
 
     if (!name)
         return ret;
@@ -8729,8 +8734,8 @@ static int vboxStorageVolDelete(virStorageVolPtr vol,
     IHardDisk *hardDisk  = NULL;
     int deregister = 0;
     nsresult rc;
-    int i = 0;
-    int j = 0;
+    size_t i = 0;
+    size_t j = 0;
 
     virCheckFlags(0, -1);
 
@@ -9281,7 +9286,7 @@ vboxConnectListAllDomains(virConnectPtr conn,
     vboxIID iid = VBOX_IID_INITIALIZER;
     PRUint32 state;
     nsresult rc;
-    int i;
+    size_t i;
     virDomainPtr dom;
     virDomainPtr *doms = NULL;
     int count = 0;
-- 
1.8.1.4


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