]> xenbits.xensource.com Git - libvirt.git/commitdiff
Convert 'int i' to 'size_t i' in src/{esx,vmx,vmware} files
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 8 Jul 2013 14:09:33 +0000 (15:09 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 10 Jul 2013 16:40:13 +0000 (17:40 +0100)
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/esx/esx_driver.c
src/esx/esx_interface_driver.c
src/esx/esx_network_driver.c
src/esx/esx_storage_backend_iscsi.c
src/esx/esx_storage_backend_vmfs.c
src/esx/esx_storage_driver.c
src/esx/esx_util.c
src/esx/esx_vi.c
src/vmware/vmware_conf.c
src/vmx/vmx.c

index 26a3f1dfb5931d633b363a4a28d87cff84b96450..fbe43c25e41bddc707097d4a97f9fd8b49e52491 100644 (file)
@@ -2871,7 +2871,7 @@ esxConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxname
     esxVI_ObjectContent *virtualMachine = NULL;
     esxVI_VirtualMachinePowerState powerState;
     int count = 0;
-    int i;
+    size_t i;
 
     if (maxnames == 0) {
         return 0;
@@ -3026,7 +3026,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
     esxPrivate *priv = conn->privateData;
     virDomainDefPtr def = NULL;
     char *vmx = NULL;
-    int i;
+    size_t i;
     virDomainDiskDefPtr disk = NULL;
     esxVI_ObjectContent *virtualMachine = NULL;
     int virtualHW_version;
@@ -3559,7 +3559,7 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
     esxVI_DynamicProperty *dynamicProperty = NULL;
     esxVI_SharesInfo *sharesInfo = NULL;
     unsigned int mask = 0;
-    int i = 0;
+    size_t i = 0;
 
     virCheckFlags(0, -1);
 
@@ -3683,7 +3683,7 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
     char *taskInfoErrorMessage = NULL;
-    int i;
+    size_t i;
 
     virCheckFlags(0, -1);
     if (virTypedParamsValidate(params, nparams,
@@ -4845,7 +4845,7 @@ esxDomainSetMemoryParameters(virDomainPtr domain, virTypedParameterPtr params,
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
     char *taskInfoErrorMessage = NULL;
-    int i;
+    size_t i;
 
     virCheckFlags(0, -1);
     if (virTypedParamsValidate(params, nparams,
index 7875ccfab9c9d2e847baf685d779f785303236e9..2cee3b78463599ecd2a677fb2ad475f909a940a4 100644 (file)
@@ -102,7 +102,7 @@ esxConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames)
     esxVI_PhysicalNic *physicalNicList = NULL;
     esxVI_PhysicalNic *physicalNic = NULL;
     int count = 0;
-    int i;
+    size_t i;
 
     if (maxnames == 0) {
         return 0;
index d51aad15e4093a13e3b22e9034440de36c8e4a14..24059c15d4af5ab4852b2ed8d13ec067991f65f8 100644 (file)
@@ -109,7 +109,7 @@ esxConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
     esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
     esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
     int count = 0;
-    int i;
+    size_t i;
 
     if (maxnames == 0) {
         return 0;
@@ -330,7 +330,7 @@ esxNetworkDefineXML(virConnectPtr conn, const char *xml)
     esxVI_PhysicalNic *physicalNicList = NULL;
     esxVI_PhysicalNic *physicalNic = NULL;
     esxVI_HostPortGroupSpec *hostPortGroupSpec = NULL;
-    int i;
+    size_t i;
 
     unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
 
index 346596f11fc6f7eb9c1fff110c806f6eb1b6b8e4..6d80f90b6be027180e6fd2e842b668829b91c57d 100644 (file)
@@ -103,7 +103,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names,
     esxPrivate *priv = conn->storagePrivateData;
     esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
     esxVI_HostInternetScsiHbaStaticTarget *target;
-    int i;
+    size_t i;
 
     if (maxnames == 0) {
         return 0;
@@ -392,7 +392,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
     esxVI_HostScsiTopologyLun *hostScsiTopologyLun;
     esxVI_ScsiLun *scsiLunList = NULL;
     esxVI_ScsiLun *scsiLun = NULL;
-    int i;
+    size_t i;
 
     if (esxVI_LookupHostScsiTopologyLunListByTargetName
           (priv->primary, pool->name, &hostScsiTopologyLunList) < 0) {
index 648368783cd157d19cf5945193e0c03f44989e39..4f252ff30a3bc65d8edfc68da7a30c1ac43f02bf 100644 (file)
@@ -146,7 +146,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names,
     esxVI_ObjectContent *datastoreList = NULL;
     esxVI_ObjectContent *datastore = NULL;
     int count = 0;
-    int i;
+    size_t i;
 
     if (maxnames == 0) {
         return 0;
@@ -571,7 +571,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
     char *directoryAndFileName = NULL;
     size_t length;
     int count = 0;
-    int i;
+    size_t i;
 
     if (names == NULL || maxnames < 0) {
         virReportError(VIR_ERR_INVALID_ARG, "%s", _("Invalid argument"));
index 3c60f008e5990632cf00287cbf1ba06ed61a9bda..e692167fd766b1cdbdf79014ff8bdb3d9c4d1d55 100644 (file)
@@ -87,7 +87,7 @@ esxConnectNumOfStoragePools(virConnectPtr conn)
 {
     int count = 0;
     esxPrivate *priv = conn->storagePrivateData;
-    int i;
+    size_t i;
     int tmp;
 
     if (esxVI_EnsureSession(priv->primary) < 0) {
@@ -115,7 +115,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names, int maxnames)
     bool success = false;
     esxPrivate *priv = conn->storagePrivateData;
     int count = 0;
-    int i;
+    size_t i;
     int tmp;
 
     if (maxnames == 0) {
@@ -176,7 +176,7 @@ static virStoragePoolPtr
 esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
 {
     esxPrivate *priv = conn->storagePrivateData;
-    int i;
+    size_t i;
     virStoragePoolPtr pool;
 
     virCheckNonNullArgReturn(name, NULL);
@@ -205,7 +205,7 @@ static virStoragePoolPtr
 esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
 {
     esxPrivate *priv = conn->storagePrivateData;
-    int i;
+    size_t i;
     virStoragePoolPtr pool;
     char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
 
@@ -411,7 +411,7 @@ esxStorageVolLookupByKey(virConnectPtr conn, const char *key)
 {
     virStorageVolPtr volume;
     esxPrivate *priv = conn->storagePrivateData;
-    int i;
+    size_t i;
 
     if (esxVI_EnsureSession(priv->primary) < 0) {
         return NULL;
index 536864ddfbf978a29d58180d729854cf8c63add8..2716bdff40079537e684188520524df9c4a270d5 100644 (file)
@@ -44,7 +44,7 @@ int
 esxUtil_ParseUri(esxUtil_ParsedUri **parsedUri, virURIPtr uri)
 {
     int result = -1;
-    int i;
+    size_t i;
     int noVerify;
     int autoAnswer;
     char *tmp;
index e4a58c4c107e2b07757211f904d8d6330ec834fb..77b8ae35925fee32016ff4823efd4930f493fff9 100644 (file)
@@ -487,7 +487,7 @@ static void
 esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
                       curl_lock_access access_ ATTRIBUTE_UNUSED, void *userptr)
 {
-    int i;
+    size_t i;
     esxVI_SharedCURL *shared = userptr;
 
     switch (data) {
@@ -515,7 +515,7 @@ static void
 esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
                         void *userptr)
 {
-    int i;
+    size_t i;
     esxVI_SharedCURL *shared = userptr;
 
     switch (data) {
@@ -545,7 +545,7 @@ ESX_VI__TEMPLATE__ALLOC(SharedCURL)
 /* esxVI_SharedCURL_Free */
 ESX_VI__TEMPLATE__FREE(SharedCURL,
 {
-    int i;
+    size_t i;
 
     if (item->count > 0) {
         /* Better leak than crash */
@@ -565,7 +565,7 @@ ESX_VI__TEMPLATE__FREE(SharedCURL,
 int
 esxVI_SharedCURL_Add(esxVI_SharedCURL *shared, esxVI_CURL *curl)
 {
-    int i;
+    size_t i;
 
     if (curl->handle == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -1431,7 +1431,7 @@ int
 esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
                                   esxVI_AnyType *anyType, int *value)
 {
-    int i;
+    size_t i;
 
     if (anyType == NULL || value == NULL) {
         virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@@ -1466,7 +1466,7 @@ int
 esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
                             int value, const char *element, virBufferPtr output)
 {
-    int i;
+    size_t i;
     const char *name = NULL;
 
     if (element == NULL || output == NULL) {
@@ -1504,7 +1504,7 @@ int
 esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
                               xmlNodePtr node, int *value)
 {
-    int i;
+    size_t i;
     int result = -1;
     char *name = NULL;
 
@@ -2569,7 +2569,7 @@ esxVI_GetSnapshotTreeNames(esxVI_VirtualMachineSnapshotTree *snapshotTreeList,
 {
     int count = 0;
     int result;
-    int i;
+    size_t i;
     esxVI_VirtualMachineSnapshotTree *snapshotTree;
 
     for (snapshotTree = snapshotTreeList;
@@ -4524,7 +4524,7 @@ esxVI_ParseHostCpuIdInfo(esxVI_ParsedHostCpuIdInfo *parsedHostCpuIdInfo,
     char *output[4] = { parsedHostCpuIdInfo->eax, parsedHostCpuIdInfo->ebx,
                         parsedHostCpuIdInfo->ecx, parsedHostCpuIdInfo->edx };
     const char *name[4] = { "eax", "ebx", "ecx", "edx" };
-    int r, i, o;
+    size_t r, i, o;
 
     memset(parsedHostCpuIdInfo, 0, sizeof(*parsedHostCpuIdInfo));
 
index b6d20ea1484f22fab970419d66681d5575ae73a6..96f69b340764c695b5a7094b00a5a294a0df312c 100644 (file)
@@ -259,7 +259,7 @@ cleanup:
 int
 vmwareDomainConfigDisplay(vmwareDomainPtr pDomain, virDomainDefPtr def)
 {
-    int i = 0;
+    size_t i;
 
     if (def->ngraphics == 0) {
         pDomain->gui = true;
@@ -325,7 +325,7 @@ vmwareVmxPath(virDomainDefPtr vmdef, char **vmxPath)
     char *directoryName = NULL;
     char *fileName = NULL;
     int ret = -1;
-    int i = 0;
+    size_t i;
 
     /*
      * Build VMX URL. Use the source of the first file-based harddisk
index 9b0891413a228bd94169019436b205b943a8e2b5..48b7f1d2f344bf3fe2fc5a521f2a5b0477b75764 100644 (file)
@@ -1056,7 +1056,8 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
                                      virDomainDiskDefPtr disk)
 {
     char *tmp;
-    int model, i;
+    int model;
+    size_t i;
     virDomainControllerDefPtr controller = NULL;
 
     if (disk->bus != VIR_DOMAIN_DISK_BUS_SCSI || disk->driverName == NULL) {
@@ -1112,7 +1113,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def,
                             int virtualDev[4], bool present[4])
 {
     int result = -1;
-    int i, k;
+    size_t i, k;
     virDomainDiskDefPtr disk;
     virDomainControllerDefPtr controller;
     bool controllerHasDisksAttached;
@@ -2975,7 +2976,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
                    int virtualHW_version)
 {
     char *vmx = NULL;
-    int i;
+    size_t i;
     int sched_cpu_affinity_length;
     unsigned char zero[VIR_UUID_BUFLEN];
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -3114,12 +3115,13 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
 
     /* def:cpumask -> vmx:sched.cpu.affinity */
     if (def->cpumask && virBitmapSize(def->cpumask) > 0) {
+        int bit;
         virBufferAddLit(&buffer, "sched.cpu.affinity = \"");
 
         sched_cpu_affinity_length = 0;
 
-        i = -1;
-        while ((i = virBitmapNextSetBit(def->cpumask, i)) >= 0) {
+        bit = -1;
+        while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0) {
             ++sched_cpu_affinity_length;
         }
 
@@ -3131,9 +3133,9 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
             goto cleanup;
         }
 
-        i = -1;
-        while ((i = virBitmapNextSetBit(def->cpumask, i)) >= 0) {
-            virBufferAsprintf(&buffer, "%d", i);
+        bit = -1;
+        while ((bit = virBitmapNextSetBit(def->cpumask, bit)) >= 0) {
+            virBufferAsprintf(&buffer, "%d", bit);
 
             if (sched_cpu_affinity_length > 1) {
                 virBufferAddChar(&buffer, ',');
@@ -3193,10 +3195,10 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
 
     for (i = 0; i < 4; ++i) {
         if (scsi_present[i]) {
-            virBufferAsprintf(&buffer, "scsi%d.present = \"true\"\n", i);
+            virBufferAsprintf(&buffer, "scsi%zu.present = \"true\"\n", i);
 
             if (scsi_virtualDev[i] != -1) {
-                virBufferAsprintf(&buffer, "scsi%d.virtualDev = \"%s\"\n", i,
+                virBufferAsprintf(&buffer, "scsi%zu.virtualDev = \"%s\"\n", i,
                                   virVMXControllerModelSCSITypeToString
                                     (scsi_virtualDev[i]));
             }
@@ -3238,7 +3240,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
     for (i = 0; i < 2; ++i) {
         /* floppy[0..1].present defaults to true, disable it explicitly */
         if (! floppy_present[i]) {
-            virBufferAsprintf(&buffer, "floppy%d.present = \"false\"\n", i);
+            virBufferAsprintf(&buffer, "floppy%zu.present = \"false\"\n", i);
         }
     }