Convert 'int i' to 'size_t i' in src/{esx,vmx,vmware} files

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>
This commit is contained in:
Daniel P. Berrange 2013-07-08 15:09:33 +01:00
parent 632180d14f
commit fb8485d2da
10 changed files with 42 additions and 40 deletions

View 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,

View 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;

View 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 */

View 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) {

View 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"));

View 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;

View 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;

View 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));

View 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

View 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);
}
}