提交 921d67e0 编写于 作者: D Daniel P. Berrange

Convert 'int i' to 'size_t i' in src/conf/ 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: NDaniel P. Berrange <berrange@redhat.com>
上级 8849fc38
...@@ -123,7 +123,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine) ...@@ -123,7 +123,7 @@ virCapabilitiesFreeGuestMachine(virCapsGuestMachinePtr machine)
static void static void
virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom) virCapabilitiesFreeGuestDomain(virCapsGuestDomainPtr dom)
{ {
int i; size_t i;
if (dom == NULL) if (dom == NULL)
return; return;
...@@ -149,7 +149,7 @@ virCapabilitiesFreeGuestFeature(virCapsGuestFeaturePtr feature) ...@@ -149,7 +149,7 @@ virCapabilitiesFreeGuestFeature(virCapsGuestFeaturePtr feature)
static void static void
virCapabilitiesFreeGuest(virCapsGuestPtr guest) virCapabilitiesFreeGuest(virCapsGuestPtr guest)
{ {
int i; size_t i;
if (guest == NULL) if (guest == NULL)
return; return;
...@@ -175,7 +175,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest) ...@@ -175,7 +175,7 @@ virCapabilitiesFreeGuest(virCapsGuestPtr guest)
void void
virCapabilitiesFreeNUMAInfo(virCapsPtr caps) virCapabilitiesFreeNUMAInfo(virCapsPtr caps)
{ {
int i; size_t i;
for (i = 0; i < caps->host.nnumaCell; i++) for (i = 0; i < caps->host.nnumaCell; i++)
virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]); virCapabilitiesFreeHostNUMACell(caps->host.numaCell[i]);
...@@ -187,7 +187,7 @@ static void ...@@ -187,7 +187,7 @@ static void
virCapabilitiesDispose(void *object) virCapabilitiesDispose(void *object)
{ {
virCapsPtr caps = object; virCapsPtr caps = object;
int i; size_t i;
for (i = 0; i < caps->nguests; i++) for (i = 0; i < caps->nguests; i++)
virCapabilitiesFreeGuest(caps->guests[i]); virCapabilitiesFreeGuest(caps->guests[i]);
...@@ -327,7 +327,7 @@ virCapsGuestMachinePtr * ...@@ -327,7 +327,7 @@ virCapsGuestMachinePtr *
virCapabilitiesAllocMachines(const char *const *names, int nnames) virCapabilitiesAllocMachines(const char *const *names, int nnames)
{ {
virCapsGuestMachinePtr *machines; virCapsGuestMachinePtr *machines;
int i; size_t i;
if (VIR_ALLOC_N(machines, nnames) < 0) if (VIR_ALLOC_N(machines, nnames) < 0)
return NULL; return NULL;
...@@ -353,7 +353,7 @@ void ...@@ -353,7 +353,7 @@ void
virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines, virCapabilitiesFreeMachines(virCapsGuestMachinePtr *machines,
int nmachines) int nmachines)
{ {
int i; size_t i;
if (!machines) if (!machines)
return; return;
for (i = 0; i < nmachines && machines[i]; i++) { for (i = 0; i < nmachines && machines[i]; i++) {
...@@ -518,7 +518,7 @@ extern int ...@@ -518,7 +518,7 @@ extern int
virCapabilitiesSupportsGuestArch(virCapsPtr caps, virCapabilitiesSupportsGuestArch(virCapsPtr caps,
virArch arch) virArch arch)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (caps->guests[i]->arch.id == arch) if (caps->guests[i]->arch.id == arch)
return 1; return 1;
...@@ -539,7 +539,7 @@ extern int ...@@ -539,7 +539,7 @@ extern int
virCapabilitiesSupportsGuestOSType(virCapsPtr caps, virCapabilitiesSupportsGuestOSType(virCapsPtr caps,
const char *ostype) const char *ostype)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype)) if (STREQ(caps->guests[i]->ostype, ostype))
return 1; return 1;
...@@ -562,7 +562,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps, ...@@ -562,7 +562,7 @@ virCapabilitiesSupportsGuestOSTypeArch(virCapsPtr caps,
const char *ostype, const char *ostype,
virArch arch) virArch arch)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
if (STREQ(caps->guests[i]->ostype, ostype) && if (STREQ(caps->guests[i]->ostype, ostype) &&
caps->guests[i]->arch.id == arch) caps->guests[i]->arch.id == arch)
...@@ -585,7 +585,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps, ...@@ -585,7 +585,7 @@ virCapabilitiesDefaultGuestArch(virCapsPtr caps,
const char *ostype, const char *ostype,
const char *domain) const char *domain)
{ {
int i, j; size_t i, j;
/* First try to find one matching host arch */ /* First try to find one matching host arch */
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
...@@ -628,11 +628,11 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps, ...@@ -628,11 +628,11 @@ virCapabilitiesDefaultGuestMachine(virCapsPtr caps,
virArch arch, virArch arch,
const char *domain) const char *domain)
{ {
int i; size_t i;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
virCapsGuestPtr guest = caps->guests[i]; virCapsGuestPtr guest = caps->guests[i];
int j; size_t j;
if (!STREQ(guest->ostype, ostype) || if (!STREQ(guest->ostype, ostype) ||
guest->arch.id != arch) guest->arch.id != arch)
...@@ -674,7 +674,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps, ...@@ -674,7 +674,7 @@ virCapabilitiesDefaultGuestEmulator(virCapsPtr caps,
virArch arch, virArch arch,
const char *domain) const char *domain)
{ {
int i, j; size_t i, j;
for (i = 0; i < caps->nguests; i++) { for (i = 0; i < caps->nguests; i++) {
char *emulator; char *emulator;
if (STREQ(caps->guests[i]->ostype, ostype) && if (STREQ(caps->guests[i]->ostype, ostype) &&
...@@ -697,8 +697,8 @@ virCapabilitiesFormatNUMATopology(virBufferPtr xml, ...@@ -697,8 +697,8 @@ virCapabilitiesFormatNUMATopology(virBufferPtr xml,
size_t ncells, size_t ncells,
virCapsHostNUMACellPtr *cells) virCapsHostNUMACellPtr *cells)
{ {
int i; size_t i;
int j; size_t j;
char *siblings; char *siblings;
virBufferAddLit(xml, " <topology>\n"); virBufferAddLit(xml, " <topology>\n");
...@@ -754,7 +754,7 @@ char * ...@@ -754,7 +754,7 @@ char *
virCapabilitiesFormatXML(virCapsPtr caps) virCapabilitiesFormatXML(virCapsPtr caps)
{ {
virBuffer xml = VIR_BUFFER_INITIALIZER; virBuffer xml = VIR_BUFFER_INITIALIZER;
int i, j, k; size_t i, j, k;
char host_uuid[VIR_UUID_STRING_BUFLEN]; char host_uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(&xml, "<capabilities>\n\n"); virBufferAddLit(&xml, "<capabilities>\n\n");
......
...@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST, ...@@ -60,7 +60,7 @@ VIR_ENUM_IMPL(virCPUFeaturePolicy, VIR_CPU_FEATURE_LAST,
void ATTRIBUTE_NONNULL(1) void ATTRIBUTE_NONNULL(1)
virCPUDefFreeModel(virCPUDefPtr def) virCPUDefFreeModel(virCPUDefPtr def)
{ {
unsigned int i; size_t i;
VIR_FREE(def->model); VIR_FREE(def->model);
VIR_FREE(def->vendor); VIR_FREE(def->vendor);
...@@ -74,7 +74,7 @@ virCPUDefFreeModel(virCPUDefPtr def) ...@@ -74,7 +74,7 @@ virCPUDefFreeModel(virCPUDefPtr def)
void void
virCPUDefFree(virCPUDefPtr def) virCPUDefFree(virCPUDefPtr def)
{ {
unsigned int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -97,7 +97,7 @@ virCPUDefCopyModel(virCPUDefPtr dst, ...@@ -97,7 +97,7 @@ virCPUDefCopyModel(virCPUDefPtr dst,
const virCPUDefPtr src, const virCPUDefPtr src,
bool resetPolicy) bool resetPolicy)
{ {
unsigned int i; size_t i;
if (VIR_STRDUP(dst->model, src->model) < 0 || if (VIR_STRDUP(dst->model, src->model) < 0 ||
VIR_STRDUP(dst->vendor, src->vendor) < 0 || VIR_STRDUP(dst->vendor, src->vendor) < 0 ||
...@@ -129,7 +129,7 @@ virCPUDefPtr ...@@ -129,7 +129,7 @@ virCPUDefPtr
virCPUDefCopy(const virCPUDefPtr cpu) virCPUDefCopy(const virCPUDefPtr cpu)
{ {
virCPUDefPtr copy; virCPUDefPtr copy;
unsigned int i; size_t i;
if (!cpu || VIR_ALLOC(copy) < 0) if (!cpu || VIR_ALLOC(copy) < 0)
return NULL; return NULL;
...@@ -181,7 +181,7 @@ virCPUDefParseXML(const xmlNodePtr node, ...@@ -181,7 +181,7 @@ virCPUDefParseXML(const xmlNodePtr node,
virCPUDefPtr def; virCPUDefPtr def;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int n; int n;
unsigned int i; size_t i;
char *cpuMode; char *cpuMode;
char *fallback = NULL; char *fallback = NULL;
char *vendor_id = NULL; char *vendor_id = NULL;
...@@ -379,7 +379,7 @@ virCPUDefParseXML(const xmlNodePtr node, ...@@ -379,7 +379,7 @@ virCPUDefParseXML(const xmlNodePtr node,
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
char *name; char *name;
int policy; /* enum virDomainCPUFeaturePolicy */ int policy; /* enum virDomainCPUFeaturePolicy */
unsigned int j; size_t j;
if (def->type == VIR_CPU_TYPE_GUEST) { if (def->type == VIR_CPU_TYPE_GUEST) {
char *strpolicy; char *strpolicy;
...@@ -562,7 +562,7 @@ virCPUDefFormatBuf(virBufferPtr buf, ...@@ -562,7 +562,7 @@ virCPUDefFormatBuf(virBufferPtr buf,
virCPUDefPtr def, virCPUDefPtr def,
unsigned int flags) unsigned int flags)
{ {
unsigned int i; size_t i;
bool formatModel; bool formatModel;
bool formatFallback; bool formatFallback;
...@@ -663,7 +663,7 @@ virCPUDefAddFeature(virCPUDefPtr def, ...@@ -663,7 +663,7 @@ virCPUDefAddFeature(virCPUDefPtr def,
const char *name, const char *name,
int policy) int policy)
{ {
int i; size_t i;
for (i = 0; i < def->nfeatures; i++) { for (i = 0; i < def->nfeatures; i++) {
if (STREQ(name, def->features[i].name)) { if (STREQ(name, def->features[i].name)) {
...@@ -694,7 +694,7 @@ virCPUDefIsEqual(virCPUDefPtr src, ...@@ -694,7 +694,7 @@ virCPUDefIsEqual(virCPUDefPtr src,
virCPUDefPtr dst) virCPUDefPtr dst)
{ {
bool identical = false; bool identical = false;
int i; size_t i;
if (!src && !dst) if (!src && !dst)
return true; return true;
......
...@@ -793,7 +793,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op, ...@@ -793,7 +793,7 @@ virDomainAuditLifecycle(virDomainObjPtr vm, const char *op,
void void
virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success) virDomainAuditStart(virDomainObjPtr vm, const char *reason, bool success)
{ {
int i; size_t i;
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
virDomainDiskDefPtr disk = vm->def->disks[i]; virDomainDiskDefPtr disk = vm->def->disks[i];
...@@ -874,7 +874,7 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success) ...@@ -874,7 +874,7 @@ virDomainAuditSecurityLabel(virDomainObjPtr vm, bool success)
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
char *vmname; char *vmname;
const char *virt; const char *virt;
int i; size_t i;
virUUIDFormat(vm->def->uuid, uuidstr); virUUIDFormat(vm->def->uuid, uuidstr);
if (!(vmname = virAuditEncode("vm", vm->def->name))) { if (!(vmname = virAuditEncode("vm", vm->def->name))) {
......
...@@ -869,7 +869,7 @@ void ...@@ -869,7 +869,7 @@ void
virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights, virBlkioDeviceWeightArrayClear(virBlkioDeviceWeightPtr deviceWeights,
int ndevices) int ndevices)
{ {
int i; size_t i;
for (i = 0; i < ndevices; i++) for (i = 0; i < ndevices; i++)
VIR_FREE(deviceWeights[i].path); VIR_FREE(deviceWeights[i].path);
...@@ -1101,7 +1101,7 @@ virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def) ...@@ -1101,7 +1101,7 @@ virSecurityDeviceLabelDefFree(virSecurityDeviceLabelDefPtr def)
void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
{ {
int ii; size_t i;
if (!def) if (!def)
return; return;
...@@ -1131,8 +1131,8 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def) ...@@ -1131,8 +1131,8 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def)
break; break;
} }
for (ii = 0; ii < def->nListens; ii++) for (i = 0; i < def->nListens; i++)
virDomainGraphicsListenDefClear(&def->listens[ii]); virDomainGraphicsListenDefClear(&def->listens[i]);
VIR_FREE(def->listens); VIR_FREE(def->listens);
VIR_FREE(def); VIR_FREE(def);
...@@ -1173,7 +1173,7 @@ virDomainDiskSourcePoolDefFree(virDomainDiskSourcePoolDefPtr def) ...@@ -1173,7 +1173,7 @@ virDomainDiskSourcePoolDefFree(virDomainDiskSourcePoolDefPtr def)
void virDomainDiskDefFree(virDomainDiskDefPtr def) void virDomainDiskDefFree(virDomainDiskDefPtr def)
{ {
unsigned int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -1550,7 +1550,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def) ...@@ -1550,7 +1550,7 @@ void virDomainSoundDefFree(virDomainSoundDefPtr def)
virDomainDeviceInfoClear(&def->info); virDomainDeviceInfoClear(&def->info);
int i; size_t i;
for (i = 0; i < def->ncodecs; i++) for (i = 0; i < def->ncodecs; i++)
virDomainSoundCodecDefFree(def->codecs[i]); virDomainSoundCodecDefFree(def->codecs[i]);
VIR_FREE(def->codecs); VIR_FREE(def->codecs);
...@@ -1775,7 +1775,7 @@ virDomainClockDefClear(virDomainClockDefPtr def) ...@@ -1775,7 +1775,7 @@ virDomainClockDefClear(virDomainClockDefPtr def)
if (def->offset == VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE) if (def->offset == VIR_DOMAIN_CLOCK_OFFSET_TIMEZONE)
VIR_FREE(def->data.timezone); VIR_FREE(def->data.timezone);
int i; size_t i;
for (i = 0; i < def->ntimers; i++) for (i = 0; i < def->ntimers; i++)
VIR_FREE(def->timers[i]); VIR_FREE(def->timers[i]);
VIR_FREE(def->timers); VIR_FREE(def->timers);
...@@ -1784,7 +1784,7 @@ virDomainClockDefClear(virDomainClockDefPtr def) ...@@ -1784,7 +1784,7 @@ virDomainClockDefClear(virDomainClockDefPtr def)
virDomainVcpuPinDefPtr * virDomainVcpuPinDefPtr *
virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin) virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
{ {
int i = 0; size_t i;
virDomainVcpuPinDefPtr *ret = NULL; virDomainVcpuPinDefPtr *ret = NULL;
if (VIR_ALLOC_N(ret, nvcpupin) < 0) if (VIR_ALLOC_N(ret, nvcpupin) < 0)
...@@ -1802,7 +1802,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin) ...@@ -1802,7 +1802,7 @@ virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
error: error:
if (ret) { if (ret) {
for (; i >= 0; --i) { for (i = 0; i < nvcpupin; i++) {
if (ret[i]) { if (ret[i]) {
virBitmapFree(ret[i]->cpumask); virBitmapFree(ret[i]->cpumask);
VIR_FREE(ret[i]); VIR_FREE(ret[i]);
...@@ -1827,7 +1827,7 @@ void ...@@ -1827,7 +1827,7 @@ void
virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def, virDomainVcpuPinDefArrayFree(virDomainVcpuPinDefPtr *def,
int nvcpupin) int nvcpupin)
{ {
int i; size_t i;
if (!def || !nvcpupin) if (!def || !nvcpupin)
return; return;
...@@ -1853,7 +1853,7 @@ virDomainResourceDefFree(virDomainResourceDefPtr resource) ...@@ -1853,7 +1853,7 @@ virDomainResourceDefFree(virDomainResourceDefPtr resource)
void virDomainDefFree(virDomainDefPtr def) void virDomainDefFree(virDomainDefPtr def)
{ {
unsigned int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -2470,7 +2470,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def, ...@@ -2470,7 +2470,7 @@ virDomainDeviceInfoIterateInternal(virDomainDefPtr def,
bool all, bool all,
void *opaque) void *opaque)
{ {
int i; size_t i;
virDomainDeviceDef device; virDomainDeviceDef device;
device.type = VIR_DOMAIN_DEVICE_DISK; device.type = VIR_DOMAIN_DEVICE_DISK;
...@@ -2637,7 +2637,7 @@ virDomainDefRejectDuplicateControllers(virDomainDefPtr def) ...@@ -2637,7 +2637,7 @@ virDomainDefRejectDuplicateControllers(virDomainDefPtr def)
size_t nbitmaps = 0; size_t nbitmaps = 0;
int ret = -1; int ret = -1;
bool b; bool b;
int i; size_t i;
memset(max_idx, -1, sizeof(max_idx)); memset(max_idx, -1, sizeof(max_idx));
...@@ -2685,7 +2685,7 @@ static int ...@@ -2685,7 +2685,7 @@ static int
virDomainDefPostParseInternal(virDomainDefPtr def, virDomainDefPostParseInternal(virDomainDefPtr def,
virCapsPtr caps ATTRIBUTE_UNUSED) virCapsPtr caps ATTRIBUTE_UNUSED)
{ {
int i; size_t i;
/* verify init path for container based domains */ /* verify init path for container based domains */
if (STREQ(def->os.type, "exe") && !def->os.init) { if (STREQ(def->os.type, "exe") && !def->os.init) {
...@@ -3800,7 +3800,7 @@ virDomainDriveAddressIsUsedByDisk(virDomainDefPtr def, ...@@ -3800,7 +3800,7 @@ virDomainDriveAddressIsUsedByDisk(virDomainDefPtr def,
unsigned int unit) unsigned int unit)
{ {
virDomainDiskDefPtr disk; virDomainDiskDefPtr disk;
int i; size_t i;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
disk = def->disks[i]; disk = def->disks[i];
...@@ -3829,7 +3829,7 @@ virDomainDriveAddressIsUsedByHostdev(virDomainDefPtr def, ...@@ -3829,7 +3829,7 @@ virDomainDriveAddressIsUsedByHostdev(virDomainDefPtr def,
unsigned int unit) unsigned int unit)
{ {
virDomainHostdevDefPtr hostdev; virDomainHostdevDefPtr hostdev;
int i; size_t i;
for (i = 0; i < def->nhostdevs; i++) { for (i = 0; i < def->nhostdevs; i++) {
hostdev = def->hostdevs[i]; hostdev = def->hostdevs[i];
...@@ -3873,7 +3873,7 @@ virDomainControllerSCSINextUnit(virDomainDefPtr def, ...@@ -3873,7 +3873,7 @@ virDomainControllerSCSINextUnit(virDomainDefPtr def,
unsigned int max_unit, unsigned int max_unit,
unsigned int controller) unsigned int controller)
{ {
int i; size_t i;
for (i = 0; i < max_unit; i++) { for (i = 0; i < max_unit; i++) {
if (!virDomainSCSIDriveAddressIsUsed(def, controller, i)) if (!virDomainSCSIDriveAddressIsUsed(def, controller, i))
...@@ -3893,7 +3893,7 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt, ...@@ -3893,7 +3893,7 @@ virDomainHostdevAssignAddress(virDomainXMLOptionPtr xmlopt,
{ {
int next_unit = 0; int next_unit = 0;
unsigned controller = 0; unsigned controller = 0;
int i; size_t i;
int ret; int ret;
if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI) if (hostdev->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI)
...@@ -4125,7 +4125,7 @@ virDomainDeviceFindControllerModel(virDomainDefPtr def, ...@@ -4125,7 +4125,7 @@ virDomainDeviceFindControllerModel(virDomainDefPtr def,
int controllerType) int controllerType)
{ {
int model = -1; int model = -1;
int i; size_t i;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == controllerType && if (def->controllers[i]->type == controllerType &&
...@@ -4141,7 +4141,7 @@ virDomainDiskFindByBusAndDst(virDomainDefPtr def, ...@@ -4141,7 +4141,7 @@ virDomainDiskFindByBusAndDst(virDomainDefPtr def,
int bus, int bus,
char *dst) char *dst)
{ {
int i; size_t i;
if (!dst) if (!dst)
return NULL; return NULL;
...@@ -4345,7 +4345,8 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def, ...@@ -4345,7 +4345,8 @@ virSecurityLabelDefsParseXML(virDomainDefPtr def,
virCapsPtr caps, virCapsPtr caps,
unsigned int flags) unsigned int flags)
{ {
int i = 0, n; size_t i = 0;
int n;
xmlNodePtr *list = NULL, saved_node; xmlNodePtr *list = NULL, saved_node;
virCapsHostPtr host = &caps->host; virCapsHostPtr host = &caps->host;
...@@ -4434,7 +4435,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn, ...@@ -4434,7 +4435,8 @@ virSecurityDeviceLabelDefParseXML(virSecurityDeviceLabelDefPtr **seclabels_rtn,
{ {
virSecurityDeviceLabelDefPtr *seclabels; virSecurityDeviceLabelDefPtr *seclabels;
size_t nseclabels = 0; size_t nseclabels = 0;
int n, i, j; int n;
size_t i, j;
xmlNodePtr *list = NULL; xmlNodePtr *list = NULL;
virSecurityLabelDefPtr vmDef = NULL; virSecurityLabelDefPtr vmDef = NULL;
char *model, *relabel, *label; char *model, *relabel, *label;
...@@ -5318,6 +5320,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -5318,6 +5320,8 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
if (ioeventfd) { if (ioeventfd) {
int val;
if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) { if (def->bus != VIR_DOMAIN_DISK_BUS_VIRTIO) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("disk ioeventfd mode supported " _("disk ioeventfd mode supported "
...@@ -5325,14 +5329,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -5325,14 +5329,13 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
goto error; goto error;
} }
int i; if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown disk ioeventfd mode '%s'"), _("unknown disk ioeventfd mode '%s'"),
ioeventfd); ioeventfd);
goto error; goto error;
} }
def->ioeventfd=i; def->ioeventfd = val;
} }
if (event_idx) { if (event_idx) {
...@@ -5388,9 +5391,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -5388,9 +5391,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
} }
if (startupPolicy) { if (startupPolicy) {
int i; int val;
if ((i = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) { if ((val = virDomainStartupPolicyTypeFromString(startupPolicy)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown startupPolicy value '%s'"), _("unknown startupPolicy value '%s'"),
startupPolicy); startupPolicy);
...@@ -5405,7 +5408,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -5405,7 +5408,7 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
startupPolicy); startupPolicy);
goto error; goto error;
} }
def->startupPolicy = i; def->startupPolicy = val;
} }
def->src = source; def->src = source;
...@@ -6469,14 +6472,14 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt, ...@@ -6469,14 +6472,14 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
def->driver.virtio.txmode = m; def->driver.virtio.txmode = m;
} }
if (ioeventfd) { if (ioeventfd) {
int i; int val;
if ((i = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) { if ((val = virDomainIoEventFdTypeFromString(ioeventfd)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown interface ioeventfd mode '%s'"), _("unknown interface ioeventfd mode '%s'"),
ioeventfd); ioeventfd);
goto error; goto error;
} }
def->driver.virtio.ioeventfd = i; def->driver.virtio.ioeventfd = val;
} }
if (event_idx) { if (event_idx) {
int idx; int idx;
...@@ -7092,7 +7095,7 @@ virDomainSmartcardDefParseXML(xmlNodePtr node, ...@@ -7092,7 +7095,7 @@ virDomainSmartcardDefParseXML(xmlNodePtr node,
char *mode = NULL; char *mode = NULL;
char *type = NULL; char *type = NULL;
virDomainSmartcardDefPtr def; virDomainSmartcardDefPtr def;
int i; size_t i;
if (VIR_ALLOC(def) < 0) if (VIR_ALLOC(def) < 0)
return NULL; return NULL;
...@@ -7762,14 +7765,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, ...@@ -7762,14 +7765,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
goto error; goto error;
if (nListens > 0) { if (nListens > 0) {
int ii; size_t i;
if (VIR_ALLOC_N(def->listens, nListens) < 0) if (VIR_ALLOC_N(def->listens, nListens) < 0)
goto error; goto error;
for (ii = 0; ii < nListens; ii++) { for (i = 0; i < nListens; i++) {
int ret = virDomainGraphicsListenDefParseXML(&def->listens[ii], int ret = virDomainGraphicsListenDefParseXML(&def->listens[i],
listenNodes[ii], listenNodes[i],
flags); flags);
if (ret < 0) if (ret < 0)
goto error; goto error;
...@@ -7799,12 +7802,12 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, ...@@ -7799,12 +7802,12 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
* graphics. */ * graphics. */
bool matched = false; bool matched = false;
const char *found = NULL; const char *found = NULL;
int ii; size_t i;
for (ii = 0; ii < nListens; ii++) { for (i = 0; i < nListens; i++) {
if (virDomainGraphicsListenGetType(def, ii) if (virDomainGraphicsListenGetType(def, i)
== VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) { == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS) {
found = virDomainGraphicsListenGetAddress(def, ii); found = virDomainGraphicsListenGetAddress(def, i);
if (STREQ_NULLABLE(found, listenAddr)) { if (STREQ_NULLABLE(found, listenAddr)) {
matched = true; matched = true;
} }
...@@ -8306,15 +8309,15 @@ virDomainSoundDefParseXML(const xmlNodePtr node, ...@@ -8306,15 +8309,15 @@ virDomainSoundDefParseXML(const xmlNodePtr node,
goto error; goto error;
if (ncodecs > 0) { if (ncodecs > 0) {
int ii; size_t i;
if (VIR_ALLOC_N(def->codecs, ncodecs) < 0) { if (VIR_ALLOC_N(def->codecs, ncodecs) < 0) {
VIR_FREE(codecNodes); VIR_FREE(codecNodes);
goto error; goto error;
} }
for (ii = 0; ii < ncodecs; ii++) { for (i = 0; i < ncodecs; i++) {
virDomainSoundCodecDefPtr codec = virDomainSoundCodecDefParseXML(codecNodes[ii]); virDomainSoundCodecDefPtr codec = virDomainSoundCodecDefParseXML(codecNodes[i]);
if (codec == NULL) if (codec == NULL)
goto error; goto error;
...@@ -9592,7 +9595,7 @@ virDomainHostdevFind(virDomainDefPtr def, ...@@ -9592,7 +9595,7 @@ virDomainHostdevFind(virDomainDefPtr def,
virDomainHostdevDefPtr *found) virDomainHostdevDefPtr *found)
{ {
virDomainHostdevDefPtr local_found; virDomainHostdevDefPtr local_found;
int i; size_t i;
if (!found) if (!found)
found = &local_found; found = &local_found;
...@@ -9612,7 +9615,7 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name, ...@@ -9612,7 +9615,7 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
bool allow_ambiguous) bool allow_ambiguous)
{ {
virDomainDiskDefPtr vdisk; virDomainDiskDefPtr vdisk;
int i; size_t i;
int candidate = -1; int candidate = -1;
/* We prefer the <target dev='name'/> name (it's shorter, required /* We prefer the <target dev='name'/> name (it's shorter, required
...@@ -9642,9 +9645,9 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name, ...@@ -9642,9 +9645,9 @@ virDomainDiskIndexByName(virDomainDefPtr def, const char *name,
const char * const char *
virDomainDiskPathByName(virDomainDefPtr def, const char *name) virDomainDiskPathByName(virDomainDefPtr def, const char *name)
{ {
int i = virDomainDiskIndexByName(def, name, true); int idx = virDomainDiskIndexByName(def, name, true);
return i < 0 ? NULL : def->disks[i]->src; return idx < 0 ? NULL : def->disks[idx]->src;
} }
int virDomainDiskInsert(virDomainDefPtr def, int virDomainDiskInsert(virDomainDefPtr def,
...@@ -9662,7 +9665,7 @@ int virDomainDiskInsert(virDomainDefPtr def, ...@@ -9662,7 +9665,7 @@ int virDomainDiskInsert(virDomainDefPtr def,
void virDomainDiskInsertPreAlloced(virDomainDefPtr def, void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
virDomainDiskDefPtr disk) virDomainDiskDefPtr disk)
{ {
int i; int idx;
/* Tenatively plan to insert disk at the end. */ /* Tenatively plan to insert disk at the end. */
int insertAt = -1; int insertAt = -1;
...@@ -9671,19 +9674,19 @@ void virDomainDiskInsertPreAlloced(virDomainDefPtr def, ...@@ -9671,19 +9674,19 @@ void virDomainDiskInsertPreAlloced(virDomainDefPtr def,
* index greater than the new one, insert at * index greater than the new one, insert at
* that position * that position
*/ */
for (i = (def->ndisks - 1); i >= 0; i--) { for (idx = (def->ndisks - 1); idx >= 0; idx--) {
/* If bus matches and current disk is after /* If bus matches and current disk is after
* new disk, then new disk should go here */ * new disk, then new disk should go here */
if (def->disks[i]->bus == disk->bus && if (def->disks[idx]->bus == disk->bus &&
(virDiskNameToIndex(def->disks[i]->dst) > (virDiskNameToIndex(def->disks[idx]->dst) >
virDiskNameToIndex(disk->dst))) { virDiskNameToIndex(disk->dst))) {
insertAt = i; insertAt = idx;
} else if (def->disks[i]->bus == disk->bus && } else if (def->disks[idx]->bus == disk->bus &&
insertAt == -1) { insertAt == -1) {
/* Last disk with match bus is before the /* Last disk with match bus is before the
* new disk, then put new disk just after * new disk, then put new disk just after
*/ */
insertAt = i + 1; insertAt = idx + 1;
} }
} }
...@@ -9725,10 +9728,10 @@ virDomainDiskRemove(virDomainDefPtr def, size_t i) ...@@ -9725,10 +9728,10 @@ virDomainDiskRemove(virDomainDefPtr def, size_t i)
virDomainDiskDefPtr virDomainDiskDefPtr
virDomainDiskRemoveByName(virDomainDefPtr def, const char *name) virDomainDiskRemoveByName(virDomainDefPtr def, const char *name)
{ {
int i = virDomainDiskIndexByName(def, name, false); int idx = virDomainDiskIndexByName(def, name, false);
if (i < 0) if (idx < 0)
return NULL; return NULL;
return virDomainDiskRemove(def, i); return virDomainDiskRemove(def, idx);
} }
/* Return true if VM has at least one disk involved in a current block /* Return true if VM has at least one disk involved in a current block
...@@ -9736,7 +9739,7 @@ virDomainDiskRemoveByName(virDomainDefPtr def, const char *name) ...@@ -9736,7 +9739,7 @@ virDomainDiskRemoveByName(virDomainDefPtr def, const char *name)
bool bool
virDomainHasDiskMirror(virDomainObjPtr vm) virDomainHasDiskMirror(virDomainObjPtr vm)
{ {
int i; size_t i;
for (i = 0; i < vm->def->ndisks; i++) for (i = 0; i < vm->def->ndisks; i++)
if (vm->def->disks[i]->mirror) if (vm->def->disks[i]->mirror)
return true; return true;
...@@ -9766,12 +9769,13 @@ int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net) ...@@ -9766,12 +9769,13 @@ int virDomainNetInsert(virDomainDefPtr def, virDomainNetDefPtr net)
int int
virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net) virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
{ {
int ii, matchidx = -1; size_t i;
int matchidx = -1;
bool PCIAddrSpecified = virDomainDeviceAddressIsValid(&net->info, bool PCIAddrSpecified = virDomainDeviceAddressIsValid(&net->info,
VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI); VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI);
for (ii = 0; ii < def->nnets; ii++) { for (i = 0; i < def->nnets; i++) {
if (virMacAddrCmp(&def->nets[ii]->mac, &net->mac)) if (virMacAddrCmp(&def->nets[i]->mac, &net->mac))
continue; continue;
if ((matchidx >= 0) && !PCIAddrSpecified) { if ((matchidx >= 0) && !PCIAddrSpecified) {
...@@ -9785,17 +9789,17 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net) ...@@ -9785,17 +9789,17 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net)
break; break;
} }
if (PCIAddrSpecified) { if (PCIAddrSpecified) {
if (virDevicePCIAddressEqual(&def->nets[ii]->info.addr.pci, if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci,
&net->info.addr.pci)) { &net->info.addr.pci)) {
/* exit early if the pci address was specified and /* exit early if the pci address was specified and
* it matches, as this guarantees no duplicates. * it matches, as this guarantees no duplicates.
*/ */
matchidx = ii; matchidx = i;
break; break;
} }
} else { } else {
/* no PCI address given, so there may be multiple matches */ /* no PCI address given, so there may be multiple matches */
matchidx = ii; matchidx = i;
} }
} }
return matchidx; return matchidx;
...@@ -9851,7 +9855,7 @@ int virDomainControllerInsert(virDomainDefPtr def, ...@@ -9851,7 +9855,7 @@ int virDomainControllerInsert(virDomainDefPtr def,
void virDomainControllerInsertPreAlloced(virDomainDefPtr def, void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
virDomainControllerDefPtr controller) virDomainControllerDefPtr controller)
{ {
int i; int idx;
/* Tenatively plan to insert controller at the end. */ /* Tenatively plan to insert controller at the end. */
int insertAt = -1; int insertAt = -1;
...@@ -9860,18 +9864,18 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def, ...@@ -9860,18 +9864,18 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def,
* index greater than the new one, insert at * index greater than the new one, insert at
* that position * that position
*/ */
for (i = (def->ncontrollers - 1); i >= 0; i--) { for (idx = (def->ncontrollers - 1); idx >= 0; idx--) {
/* If bus matches and current controller is after /* If bus matches and current controller is after
* new controller, then new controller should go here */ * new controller, then new controller should go here */
if (def->controllers[i]->type == controller->type && if (def->controllers[idx]->type == controller->type &&
def->controllers[i]->idx > controller->idx) { def->controllers[idx]->idx > controller->idx) {
insertAt = i; insertAt = idx;
} else if (def->controllers[i]->type == controller->type && } else if (def->controllers[idx]->type == controller->type &&
insertAt == -1) { insertAt == -1) {
/* Last controller with match bus is before the /* Last controller with match bus is before the
* new controller, then put new controller just after * new controller, then put new controller just after
*/ */
insertAt = i + 1; insertAt = idx + 1;
} }
} }
...@@ -9892,7 +9896,7 @@ int ...@@ -9892,7 +9896,7 @@ int
virDomainControllerFind(virDomainDefPtr def, virDomainControllerFind(virDomainDefPtr def,
int type, int idx) int type, int idx)
{ {
int i; size_t i;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
if ((def->controllers[i]->type == type) && if ((def->controllers[i]->type == type) &&
...@@ -9930,7 +9934,7 @@ int virDomainLeaseIndex(virDomainDefPtr def, ...@@ -9930,7 +9934,7 @@ int virDomainLeaseIndex(virDomainDefPtr def,
virDomainLeaseDefPtr lease) virDomainLeaseDefPtr lease)
{ {
virDomainLeaseDefPtr vlease; virDomainLeaseDefPtr vlease;
int i; size_t i;
for (i = 0; i < def->nleases; i++) { for (i = 0; i < def->nleases; i++) {
vlease = def->leases[i]; vlease = def->leases[i];
...@@ -9998,10 +10002,10 @@ virDomainLeaseDefPtr ...@@ -9998,10 +10002,10 @@ virDomainLeaseDefPtr
virDomainLeaseRemove(virDomainDefPtr def, virDomainLeaseRemove(virDomainDefPtr def,
virDomainLeaseDefPtr lease) virDomainLeaseDefPtr lease)
{ {
int i = virDomainLeaseIndex(def, lease); int idx = virDomainLeaseIndex(def, lease);
if (i < 0) if (idx < 0)
return NULL; return NULL;
return virDomainLeaseRemoveAt(def, i); return virDomainLeaseRemoveAt(def, idx);
} }
...@@ -10042,7 +10046,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt, ...@@ -10042,7 +10046,8 @@ virDomainDefParseBootXML(xmlXPathContextPtr ctxt,
virDomainDefPtr def) virDomainDefPtr def)
{ {
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i, n; size_t i;
int n;
char *tmp = NULL; char *tmp = NULL;
int ret = -1; int ret = -1;
unsigned long deviceBoot, serialPorts; unsigned long deviceBoot, serialPorts;
...@@ -10288,7 +10293,7 @@ virDomainVcpuPinDefPtr ...@@ -10288,7 +10293,7 @@ virDomainVcpuPinDefPtr
virDomainLookupVcpuPin(virDomainDefPtr def, virDomainLookupVcpuPin(virDomainDefPtr def,
int vcpuid) int vcpuid)
{ {
int i; size_t i;
if (!def->cputune.vcpupin) if (!def->cputune.vcpupin)
return NULL; return NULL;
...@@ -10307,7 +10312,7 @@ virDomainDefMaybeAddController(virDomainDefPtr def, ...@@ -10307,7 +10312,7 @@ virDomainDefMaybeAddController(virDomainDefPtr def,
int idx, int idx,
int model) int model)
{ {
int i; size_t i;
virDomainControllerDefPtr cont; virDomainControllerDefPtr cont;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
...@@ -10399,7 +10404,7 @@ static int ...@@ -10399,7 +10404,7 @@ static int
virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def) virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
{ {
/* Look for any hostdev scsi dev */ /* Look for any hostdev scsi dev */
int i; size_t i;
int maxController = -1; int maxController = -1;
virDomainHostdevDefPtr hostdev; virDomainHostdevDefPtr hostdev;
...@@ -10412,6 +10417,9 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def) ...@@ -10412,6 +10417,9 @@ virDomainDefMaybeAddHostdevSCSIcontroller(virDomainDefPtr def)
} }
} }
if (maxController == -1)
return 0;
for (i = 0; i <= maxController; i++) { for (i = 0; i <= maxController; i++) {
if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_SCSI, i, -1) < 0) if (virDomainDefMaybeAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_SCSI, i, -1) < 0)
return -1; return -1;
...@@ -10431,7 +10439,8 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -10431,7 +10439,8 @@ virDomainDefParseXML(xmlDocPtr xml,
{ {
xmlNodePtr *nodes = NULL, node = NULL; xmlNodePtr *nodes = NULL, node = NULL;
char *tmp = NULL; char *tmp = NULL;
int i, n; size_t i;
int n;
long id = -1; long id = -1;
virDomainDefPtr def; virDomainDefPtr def;
unsigned long count; unsigned long count;
...@@ -10607,7 +10616,7 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -10607,7 +10616,7 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
int j; size_t j;
if (virDomainBlkioDeviceWeightParseXML(nodes[i], if (virDomainBlkioDeviceWeightParseXML(nodes[i],
&def->blkio.devices[i]) < 0) &def->blkio.devices[i]) < 0)
goto error; goto error;
...@@ -11558,7 +11567,7 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -11558,7 +11567,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->target.port == -1) { if (chr->target.port == -1) {
int maxport = -1; int maxport = -1;
int j; size_t j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (def->parallels[j]->target.port > maxport) if (def->parallels[j]->target.port > maxport)
maxport = def->parallels[j]->target.port; maxport = def->parallels[j]->target.port;
...@@ -11586,7 +11595,7 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -11586,7 +11595,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->target.port == -1) { if (chr->target.port == -1) {
int maxport = -1; int maxport = -1;
int j; size_t j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
if (def->serials[j]->target.port > maxport) if (def->serials[j]->target.port > maxport)
maxport = def->serials[j]->target.port; maxport = def->serials[j]->target.port;
...@@ -11644,7 +11653,7 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -11644,7 +11653,7 @@ virDomainDefParseXML(xmlDocPtr xml,
if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL && if (chr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
chr->info.addr.vioserial.port == 0) { chr->info.addr.vioserial.port == 0) {
int maxport = 0; int maxport = 0;
int j; size_t j;
for (j = 0; j < i; j++) { for (j = 0; j < i; j++) {
virDomainChrDefPtr thischr = def->channels[j]; virDomainChrDefPtr thischr = def->channels[j];
if (thischr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL && if (thischr->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL &&
...@@ -11764,8 +11773,8 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -11764,8 +11773,8 @@ virDomainDefParseXML(xmlDocPtr xml,
if (n && VIR_ALLOC_N(def->videos, n) < 0) if (n && VIR_ALLOC_N(def->videos, n) < 0)
goto error; goto error;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
size_t ii = def->nvideos; size_t j = def->nvideos;
virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[i], virDomainVideoDefPtr video = virDomainVideoDefParseXML(nodes[j],
def, def,
flags); flags);
if (!video) if (!video)
...@@ -11779,11 +11788,11 @@ virDomainDefParseXML(xmlDocPtr xml, ...@@ -11779,11 +11788,11 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error; goto error;
} }
ii = 0; j = 0;
primaryVideo = true; primaryVideo = true;
} }
if (VIR_INSERT_ELEMENT_INPLACE(def->videos, if (VIR_INSERT_ELEMENT_INPLACE(def->videos,
ii, j,
def->nvideos, def->nvideos,
video) < 0) { video) < 0) {
virDomainVideoDefFree(video); virDomainVideoDefFree(video);
...@@ -12142,7 +12151,8 @@ virDomainObjParseXML(xmlDocPtr xml, ...@@ -12142,7 +12151,8 @@ virDomainObjParseXML(xmlDocPtr xml,
xmlNodePtr oldnode; xmlNodePtr oldnode;
virDomainObjPtr obj; virDomainObjPtr obj;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i, n; size_t i;
int n;
int state; int state;
int reason = 0; int reason = 0;
...@@ -12969,7 +12979,7 @@ static bool ...@@ -12969,7 +12979,7 @@ static bool
virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src, virDomainRedirFilterDefCheckABIStability(virDomainRedirFilterDefPtr src,
virDomainRedirFilterDefPtr dst) virDomainRedirFilterDefPtr dst)
{ {
int i; size_t i;
if (src->nusbdevs != dst->nusbdevs) { if (src->nusbdevs != dst->nusbdevs) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...@@ -13026,7 +13036,7 @@ bool ...@@ -13026,7 +13036,7 @@ bool
virDomainDefCheckABIStability(virDomainDefPtr src, virDomainDefCheckABIStability(virDomainDefPtr src,
virDomainDefPtr dst) virDomainDefPtr dst)
{ {
int i; size_t i;
if (src->virtType != dst->virtType) { if (src->virtType != dst->virtType) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
...@@ -13371,7 +13381,7 @@ virDomainDefAddDiskControllersForType(virDomainDefPtr def, ...@@ -13371,7 +13381,7 @@ virDomainDefAddDiskControllersForType(virDomainDefPtr def,
int controllerType, int controllerType,
int diskBus) int diskBus)
{ {
int i; size_t i;
int maxController = -1; int maxController = -1;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
...@@ -13385,6 +13395,9 @@ virDomainDefAddDiskControllersForType(virDomainDefPtr def, ...@@ -13385,6 +13395,9 @@ virDomainDefAddDiskControllersForType(virDomainDefPtr def,
maxController = def->disks[i]->info.addr.drive.controller; maxController = def->disks[i]->info.addr.drive.controller;
} }
if (maxController == -1)
return 0;
for (i = 0; i <= maxController; i++) { for (i = 0; i <= maxController; i++) {
if (virDomainDefMaybeAddController(def, controllerType, i, -1) < 0) if (virDomainDefMaybeAddController(def, controllerType, i, -1) < 0)
return -1; return -1;
...@@ -13398,7 +13411,7 @@ static int ...@@ -13398,7 +13411,7 @@ static int
virDomainDefMaybeAddVirtioSerialController(virDomainDefPtr def) virDomainDefMaybeAddVirtioSerialController(virDomainDefPtr def)
{ {
/* Look for any virtio serial or virtio console devs */ /* Look for any virtio serial or virtio console devs */
int i; size_t i;
for (i = 0; i < def->nchannels; i++) { for (i = 0; i < def->nchannels; i++) {
virDomainChrDefPtr channel = def->channels[i]; virDomainChrDefPtr channel = def->channels[i];
...@@ -13437,7 +13450,7 @@ static int ...@@ -13437,7 +13450,7 @@ static int
virDomainDefMaybeAddSmartcardController(virDomainDefPtr def) virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
{ {
/* Look for any smartcard devs */ /* Look for any smartcard devs */
int i; size_t i;
for (i = 0; i < def->nsmartcards; i++) { for (i = 0; i < def->nsmartcards; i++) {
virDomainSmartcardDefPtr smartcard = def->smartcards[i]; virDomainSmartcardDefPtr smartcard = def->smartcards[i];
...@@ -13447,7 +13460,7 @@ virDomainDefMaybeAddSmartcardController(virDomainDefPtr def) ...@@ -13447,7 +13460,7 @@ virDomainDefMaybeAddSmartcardController(virDomainDefPtr def)
idx = smartcard->info.addr.ccid.controller; idx = smartcard->info.addr.ccid.controller;
} else if (smartcard->info.type } else if (smartcard->info.type
== VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) {
int j; size_t j;
int max = -1; int max = -1;
for (j = 0; j < def->nsmartcards; j++) { for (j = 0; j < def->nsmartcards; j++) {
...@@ -13519,7 +13532,7 @@ virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def, ...@@ -13519,7 +13532,7 @@ virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin, int nvcpupin,
int vcpu) int vcpu)
{ {
int i; size_t i;
if (!def || !nvcpupin) if (!def || !nvcpupin)
return 0; return 0;
...@@ -13537,7 +13550,7 @@ virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def, ...@@ -13537,7 +13550,7 @@ virDomainVcpuPinFindByVcpu(virDomainVcpuPinDefPtr *def,
int nvcpupin, int nvcpupin,
int vcpu) int vcpu)
{ {
int i; size_t i;
if (!def || !nvcpupin) if (!def || !nvcpupin)
return NULL; return NULL;
...@@ -13883,7 +13896,7 @@ virDomainDiskSourceDefFormat(virBufferPtr buf, ...@@ -13883,7 +13896,7 @@ virDomainDiskSourceDefFormat(virBufferPtr buf,
if (def->nhosts == 0) { if (def->nhosts == 0) {
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} else { } else {
int i; size_t i;
virBufferAddLit(buf, ">\n"); virBufferAddLit(buf, ">\n");
for (i = 0; i < def->nhosts; i++) { for (i = 0; i < def->nhosts; i++) {
...@@ -14237,7 +14250,7 @@ int ...@@ -14237,7 +14250,7 @@ int
virDomainFSIndexByName(virDomainDefPtr def, const char *name) virDomainFSIndexByName(virDomainDefPtr def, const char *name)
{ {
virDomainFSDefPtr fs; virDomainFSDefPtr fs;
int i; size_t i;
for (i = 0; i < def->nfss; i++) { for (i = 0; i < def->nfss; i++) {
fs = def->fss[i]; fs = def->fss[i];
...@@ -15024,7 +15037,7 @@ virDomainSoundDefFormat(virBufferPtr buf, ...@@ -15024,7 +15037,7 @@ virDomainSoundDefFormat(virBufferPtr buf,
{ {
const char *model = virDomainSoundModelTypeToString(def->model); const char *model = virDomainSoundModelTypeToString(def->model);
bool children = false; bool children = false;
int i; size_t i;
if (!model) { if (!model) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
...@@ -15460,7 +15473,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf, ...@@ -15460,7 +15473,7 @@ virDomainGraphicsDefFormat(virBufferPtr buf,
const char *type = virDomainGraphicsTypeToString(def->type); const char *type = virDomainGraphicsTypeToString(def->type);
const char *listenAddr = NULL; const char *listenAddr = NULL;
bool children = false; bool children = false;
int i; size_t i;
if (!type) { if (!type) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
...@@ -15830,7 +15843,7 @@ virDomainHubDefFormat(virBufferPtr buf, ...@@ -15830,7 +15843,7 @@ virDomainHubDefFormat(virBufferPtr buf,
static bool static bool
virDomainIsAllVcpupinInherited(virDomainDefPtr def) virDomainIsAllVcpupinInherited(virDomainDefPtr def)
{ {
int i; size_t i;
if (!def->cpumask) { if (!def->cpumask) {
if (def->cputune.nvcpupin) if (def->cputune.nvcpupin)
...@@ -15884,7 +15897,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -15884,7 +15897,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
const char *type = NULL; const char *type = NULL;
int n; int n;
int i; size_t i;
bool blkio = false; bool blkio = false;
virCheckFlags(DUMPXML_FLAGS | virCheckFlags(DUMPXML_FLAGS |
...@@ -16259,7 +16272,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, ...@@ -16259,7 +16272,7 @@ virDomainDefFormatInternal(virDomainDefPtr def,
const char *name = virDomainFeatureTypeToString(i); const char *name = virDomainFeatureTypeToString(i);
if (!name) { if (!name) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected feature %d"), i); _("unexpected feature %zu"), i);
goto error; goto error;
} }
virBufferAsprintf(buf, " <%s", name); virBufferAsprintf(buf, " <%s", name);
...@@ -16562,7 +16575,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt, ...@@ -16562,7 +16575,7 @@ virDomainObjFormat(virDomainXMLOptionPtr xmlopt,
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
int state; int state;
int reason; int reason;
int i; size_t i;
state = virDomainObjGetState(obj, &reason); state = virDomainObjGetState(obj, &reason);
virBufferAsprintf(&buf, "<domstatus state='%s' reason='%s' pid='%lld'>\n", virBufferAsprintf(&buf, "<domstatus state='%s' reason='%s' pid='%lld'>\n",
...@@ -16602,7 +16615,7 @@ error: ...@@ -16602,7 +16615,7 @@ error:
static bool static bool
virDomainDefHasUSB(virDomainDefPtr def) virDomainDefHasUSB(virDomainDefPtr def)
{ {
int i; size_t i;
for (i = 0; i < def->ncontrollers; i++) { for (i = 0; i < def->ncontrollers; i++) {
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB && if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
...@@ -16979,7 +16992,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk, ...@@ -16979,7 +16992,7 @@ virDiskNameToBusDeviceIndex(const virDomainDiskDefPtr disk,
virDomainFSDefPtr virDomainFSDefPtr
virDomainGetRootFilesystem(virDomainDefPtr def) virDomainGetRootFilesystem(virDomainDefPtr def)
{ {
int i; size_t i;
for (i = 0; i < def->nfss; i++) { for (i = 0; i < def->nfss; i++) {
if (STREQ(def->fss[i]->dst, "/")) if (STREQ(def->fss[i]->dst, "/"))
...@@ -17116,7 +17129,7 @@ virDomainObjListGetInactiveNames(virDomainObjListPtr doms, ...@@ -17116,7 +17129,7 @@ virDomainObjListGetInactiveNames(virDomainObjListPtr doms,
{ {
struct virDomainNameData data = { filter, conn, struct virDomainNameData data = { filter, conn,
0, 0, maxnames, names }; 0, 0, maxnames, names };
int i; size_t i;
virObjectLock(doms); virObjectLock(doms);
virHashForEach(doms->objs, virDomainObjListCopyInactiveNames, &data); virHashForEach(doms->objs, virDomainObjListCopyInactiveNames, &data);
virObjectUnlock(doms); virObjectUnlock(doms);
...@@ -17168,7 +17181,7 @@ virDomainChrDefForeach(virDomainDefPtr def, ...@@ -17168,7 +17181,7 @@ virDomainChrDefForeach(virDomainDefPtr def,
virDomainChrDefIterator iter, virDomainChrDefIterator iter,
void *opaque) void *opaque)
{ {
int i; size_t i;
int rc = 0; int rc = 0;
for (i = 0; i < def->nserials; i++) { for (i = 0; i < def->nserials; i++) {
...@@ -17221,7 +17234,7 @@ virDomainSmartcardDefForeach(virDomainDefPtr def, ...@@ -17221,7 +17234,7 @@ virDomainSmartcardDefForeach(virDomainDefPtr def,
virDomainSmartcardDefIterator iter, virDomainSmartcardDefIterator iter,
void *opaque) void *opaque)
{ {
int i; size_t i;
int rc = 0; int rc = 0;
for (i = 0; i < def->nsmartcards; i++) { for (i = 0; i < def->nsmartcards; i++) {
...@@ -17546,26 +17559,26 @@ virDomainNetGetActualVlan(virDomainNetDefPtr iface) ...@@ -17546,26 +17559,26 @@ virDomainNetGetActualVlan(virDomainNetDefPtr iface)
return 0; return 0;
} }
/* Return listens[ii] from the appropriate union for the graphics /* Return listens[i] from the appropriate union for the graphics
* type, or NULL if this is an unsuitable type, or the index is out of * type, or NULL if this is an unsuitable type, or the index is out of
* bounds. If force0 is TRUE, ii == 0, and there is no listen array, * bounds. If force0 is TRUE, i == 0, and there is no listen array,
* allocate one with a single item. */ * allocate one with a single item. */
static virDomainGraphicsListenDefPtr static virDomainGraphicsListenDefPtr
virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t ii, bool force0) virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i, bool force0)
{ {
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC || if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP || def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP ||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) { def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
if (!def->listens && (ii == 0) && force0) { if (!def->listens && (i == 0) && force0) {
if (VIR_ALLOC(def->listens) >= 0) if (VIR_ALLOC(def->listens) >= 0)
def->nListens = 1; def->nListens = 1;
} }
if (!def->listens || (def->nListens <= ii)) if (!def->listens || (def->nListens <= i))
return NULL; return NULL;
return &def->listens[ii]; return &def->listens[i];
} }
/* it's a type that has no listens array */ /* it's a type that has no listens array */
...@@ -17587,10 +17600,10 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t ii, bool force0) ...@@ -17587,10 +17600,10 @@ virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t ii, bool force0)
* return 0 on success, -1 on failure. */ * return 0 on success, -1 on failure. */
int int
virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii) virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, false); = virDomainGraphicsGetListen(def, i, false);
if (!listenInfo) if (!listenInfo)
return VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE; return VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
...@@ -17602,10 +17615,10 @@ virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii) ...@@ -17602,10 +17615,10 @@ virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii)
* *will not* free any existing address or network based on a change * *will not* free any existing address or network based on a change
* in value of type. */ * in value of type. */
int int
virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val) virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, true); = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo) if (!listenInfo)
return -1; return -1;
...@@ -17615,10 +17628,10 @@ virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val) ...@@ -17615,10 +17628,10 @@ virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val)
const char * const char *
virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii) virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t i)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, false); = virDomainGraphicsGetListen(def, i, false);
/* even a network can have a listen address */ /* even a network can have a listen address */
if (!listenInfo || if (!listenInfo ||
...@@ -17630,15 +17643,15 @@ virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii) ...@@ -17630,15 +17643,15 @@ virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t ii)
/* Make a copy of up to len characters of address, and store it in /* Make a copy of up to len characters of address, and store it in
* listens[ii].address. If setType is true, set the listen's type * listens[i].address. If setType is true, set the listen's type
* to 'address', otherwise leave type alone. */ * to 'address', otherwise leave type alone. */
int int
virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def, virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
size_t ii, const char *address, size_t i, const char *address,
int len, bool setType) int len, bool setType)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, true); = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo) if (!listenInfo)
return -1; return -1;
...@@ -17658,10 +17671,10 @@ virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def, ...@@ -17658,10 +17671,10 @@ virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
const char * const char *
virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t ii) virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t i)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, false); = virDomainGraphicsGetListen(def, i, false);
if (!listenInfo || if (!listenInfo ||
(listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK)) (listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
...@@ -17671,13 +17684,13 @@ virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t ii) ...@@ -17671,13 +17684,13 @@ virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t ii)
/* Make a copy of up to len characters of address, and store it in /* Make a copy of up to len characters of address, and store it in
* listens[ii].network */ * listens[i].network */
int int
virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def, virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
size_t ii, const char *network, int len) size_t i, const char *network, int len)
{ {
virDomainGraphicsListenDefPtr listenInfo virDomainGraphicsListenDefPtr listenInfo
= virDomainGraphicsGetListen(def, ii, true); = virDomainGraphicsGetListen(def, i, true);
if (!listenInfo) if (!listenInfo)
return -1; return -1;
...@@ -17709,7 +17722,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device) ...@@ -17709,7 +17722,7 @@ virDomainNetFind(virDomainDefPtr def, const char *device)
bool isMac = false; bool isMac = false;
virDomainNetDefPtr net = NULL; virDomainNetDefPtr net = NULL;
virMacAddr mac; virMacAddr mac;
int i; size_t i;
if (virMacAddrParse(device, &mac) == 0) if (virMacAddrParse(device, &mac) == 0)
isMac = true; isMac = true;
...@@ -17939,7 +17952,7 @@ virDomainObjListExport(virDomainObjListPtr doms, ...@@ -17939,7 +17952,7 @@ virDomainObjListExport(virDomainObjListPtr doms,
unsigned int flags) unsigned int flags)
{ {
int ret = -1; int ret = -1;
int i; size_t i;
struct virDomainListData data = { struct virDomainListData data = {
conn, NULL, conn, NULL,
...@@ -17981,7 +17994,7 @@ cleanup: ...@@ -17981,7 +17994,7 @@ cleanup:
virSecurityLabelDefPtr virSecurityLabelDefPtr
virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model) virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model)
{ {
int i; size_t i;
virSecurityLabelDefPtr seclabel = NULL; virSecurityLabelDefPtr seclabel = NULL;
if (def == NULL || model == NULL) if (def == NULL || model == NULL)
...@@ -18000,7 +18013,7 @@ virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model) ...@@ -18000,7 +18013,7 @@ virDomainDefGetSecurityLabelDef(virDomainDefPtr def, const char *model)
virSecurityDeviceLabelDefPtr virSecurityDeviceLabelDefPtr
virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model) virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model)
{ {
int i; size_t i;
if (def == NULL) if (def == NULL)
return NULL; return NULL;
...@@ -18015,7 +18028,7 @@ virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model) ...@@ -18015,7 +18028,7 @@ virDomainDiskDefGetSecurityLabelDef(virDomainDiskDefPtr def, const char *model)
virSecurityDeviceLabelDefPtr virSecurityDeviceLabelDefPtr
virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model) virDomainChrDefGetSecurityLabelDef(virDomainChrDefPtr def, const char *model)
{ {
int i; size_t i;
if (def == NULL) if (def == NULL)
return NULL; return NULL;
......
...@@ -2342,22 +2342,22 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i); ...@@ -2342,22 +2342,22 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i);
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match, int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
virDomainHostdevDefPtr *found); virDomainHostdevDefPtr *found);
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t ii) int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t ii, int val) int virDomainGraphicsListenSetType(virDomainGraphicsDefPtr def, size_t i, int val)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
size_t ii) size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def, int virDomainGraphicsListenSetAddress(virDomainGraphicsDefPtr def,
size_t ii, const char *address, size_t i, const char *address,
int len, bool setType) int len, bool setType)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, const char *virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def,
size_t ii) size_t i)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def, int virDomainGraphicsListenSetNetwork(virDomainGraphicsDefPtr def,
size_t ii, const char *network, int len) size_t i, const char *network, int len)
ATTRIBUTE_NONNULL(1); ATTRIBUTE_NONNULL(1);
int virDomainNetGetActualType(virDomainNetDefPtr iface); int virDomainNetGetActualType(virDomainNetDefPtr iface);
......
...@@ -134,7 +134,7 @@ struct _virDomainEvent { ...@@ -134,7 +134,7 @@ struct _virDomainEvent {
static void static void
virDomainEventCallbackListFree(virDomainEventCallbackListPtr list) virDomainEventCallbackListFree(virDomainEventCallbackListPtr list)
{ {
int i; size_t i;
if (!list) if (!list)
return; return;
...@@ -162,7 +162,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn, ...@@ -162,7 +162,7 @@ virDomainEventCallbackListRemove(virConnectPtr conn,
virConnectDomainEventCallback callback) virConnectDomainEventCallback callback)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) && if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE && cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
...@@ -213,7 +213,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn, ...@@ -213,7 +213,7 @@ virDomainEventCallbackListRemoveID(virConnectPtr conn,
int callbackID) int callbackID)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID && if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) { cbList->callbacks[i]->conn == conn) {
...@@ -255,7 +255,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn, ...@@ -255,7 +255,7 @@ virDomainEventCallbackListMarkDelete(virConnectPtr conn,
virConnectDomainEventCallback callback) virConnectDomainEventCallback callback)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) && if (cbList->callbacks[i]->cb == VIR_DOMAIN_EVENT_CALLBACK(callback) &&
cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE && cbList->callbacks[i]->eventID == VIR_DOMAIN_EVENT_ID_LIFECYCLE &&
...@@ -281,7 +281,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn, ...@@ -281,7 +281,7 @@ virDomainEventCallbackListMarkDeleteID(virConnectPtr conn,
int callbackID) int callbackID)
{ {
int ret = 0; int ret = 0;
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->callbackID == callbackID && if (cbList->callbacks[i]->callbackID == callbackID &&
cbList->callbacks[i]->conn == conn) { cbList->callbacks[i]->conn == conn) {
...@@ -304,22 +304,22 @@ static int ...@@ -304,22 +304,22 @@ static int
virDomainEventCallbackListPurgeMarked(virDomainEventCallbackListPtr cbList) virDomainEventCallbackListPurgeMarked(virDomainEventCallbackListPtr cbList)
{ {
int old_count = cbList->count; int old_count = cbList->count;
int i; int n;
for (i = 0; i < cbList->count; i++) { for (n = 0; n < cbList->count; n++) {
if (cbList->callbacks[i]->deleted) { if (cbList->callbacks[n]->deleted) {
virFreeCallback freecb = cbList->callbacks[i]->freecb; virFreeCallback freecb = cbList->callbacks[n]->freecb;
if (freecb) if (freecb)
(*freecb)(cbList->callbacks[i]->opaque); (*freecb)(cbList->callbacks[n]->opaque);
virObjectUnref(cbList->callbacks[i]->conn); virObjectUnref(cbList->callbacks[n]->conn);
VIR_FREE(cbList->callbacks[i]); VIR_FREE(cbList->callbacks[n]);
if (i < (cbList->count - 1)) if (n < (cbList->count - 1))
memmove(cbList->callbacks + i, memmove(cbList->callbacks + n,
cbList->callbacks + i + 1, cbList->callbacks + n + 1,
sizeof(*(cbList->callbacks)) * sizeof(*(cbList->callbacks)) *
(cbList->count - (i + 1))); (cbList->count - (n + 1)));
cbList->count--; cbList->count--;
i--; n--;
} }
} }
if (cbList->count < old_count && if (cbList->count < old_count &&
...@@ -352,7 +352,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn, ...@@ -352,7 +352,7 @@ virDomainEventCallbackListAddID(virConnectPtr conn,
int *callbackID) int *callbackID)
{ {
virDomainEventCallbackPtr event; virDomainEventCallbackPtr event;
int i; size_t i;
int ret = 0; int ret = 0;
/* Check incoming */ /* Check incoming */
...@@ -455,7 +455,7 @@ virDomainEventCallbackListEventID(virConnectPtr conn, ...@@ -455,7 +455,7 @@ virDomainEventCallbackListEventID(virConnectPtr conn,
virDomainEventCallbackListPtr cbList, virDomainEventCallbackListPtr cbList,
int callbackID) int callbackID)
{ {
int i; size_t i;
for (i = 0; i < cbList->count; i++) { for (i = 0; i < cbList->count; i++) {
if (cbList->callbacks[i]->deleted) if (cbList->callbacks[i]->deleted)
...@@ -496,7 +496,7 @@ void virDomainEventFree(virDomainEventPtr event) ...@@ -496,7 +496,7 @@ void virDomainEventFree(virDomainEventPtr event)
} }
VIR_FREE(event->data.graphics.authScheme); VIR_FREE(event->data.graphics.authScheme);
if (event->data.graphics.subject) { if (event->data.graphics.subject) {
int i; size_t i;
for (i = 0; i < event->data.graphics.subject->nidentity; i++) { for (i = 0; i < event->data.graphics.subject->nidentity; i++) {
VIR_FREE(event->data.graphics.subject->identities[i].type); VIR_FREE(event->data.graphics.subject->identities[i].type);
VIR_FREE(event->data.graphics.subject->identities[i].name); VIR_FREE(event->data.graphics.subject->identities[i].name);
...@@ -532,7 +532,7 @@ void virDomainEventFree(virDomainEventPtr event) ...@@ -532,7 +532,7 @@ void virDomainEventFree(virDomainEventPtr event)
static void static void
virDomainEventQueueClear(virDomainEventQueuePtr queue) virDomainEventQueueClear(virDomainEventQueuePtr queue)
{ {
int i; size_t i;
if (!queue) if (!queue)
return; return;
...@@ -1345,7 +1345,7 @@ virDomainEventDispatch(virDomainEventPtr event, ...@@ -1345,7 +1345,7 @@ virDomainEventDispatch(virDomainEventPtr event,
virDomainEventDispatchFunc dispatch, virDomainEventDispatchFunc dispatch,
void *opaque) void *opaque)
{ {
int i; size_t i;
/* Cache this now, since we may be dropping the lock, /* Cache this now, since we may be dropping the lock,
and have more callbacks added. We're guaranteed not and have more callbacks added. We're guaranteed not
to have any removed */ to have any removed */
...@@ -1370,7 +1370,7 @@ virDomainEventQueueDispatch(virDomainEventQueuePtr queue, ...@@ -1370,7 +1370,7 @@ virDomainEventQueueDispatch(virDomainEventQueuePtr queue,
virDomainEventDispatchFunc dispatch, virDomainEventDispatchFunc dispatch,
void *opaque) void *opaque)
{ {
int i; size_t i;
for (i = 0; i < queue->count; i++) { for (i = 0; i < queue->count; i++) {
virDomainEventDispatch(queue->events[i], callbacks, dispatch, opaque); virDomainEventDispatch(queue->events[i], callbacks, dispatch, opaque);
......
...@@ -53,7 +53,7 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net) { ...@@ -53,7 +53,7 @@ virDomainConfNWFilterTeardown(virDomainNetDefPtr net) {
void void
virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) { virDomainConfVMNWFilterTeardown(virDomainObjPtr vm) {
int i; size_t i;
if (nwfilterDriver != NULL) { if (nwfilterDriver != NULL) {
for (i = 0; i < vm->def->nnets; i++) for (i = 0; i < vm->def->nnets; i++)
......
...@@ -54,12 +54,12 @@ void virInterfaceIpDefFree(virInterfaceIpDefPtr def) { ...@@ -54,12 +54,12 @@ void virInterfaceIpDefFree(virInterfaceIpDefPtr def) {
static static
void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) { void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
int ii; size_t i;
if (def == NULL) if (def == NULL)
return; return;
for (ii = 0; ii < def->nips; ii++) { for (i = 0; i < def->nips; i++) {
virInterfaceIpDefFree(def->ips[ii]); virInterfaceIpDefFree(def->ips[i]);
} }
VIR_FREE(def->ips); VIR_FREE(def->ips);
VIR_FREE(def->family); VIR_FREE(def->family);
...@@ -69,7 +69,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) { ...@@ -69,7 +69,8 @@ void virInterfaceProtocolDefFree(virInterfaceProtocolDefPtr def) {
void virInterfaceDefFree(virInterfaceDefPtr def) void virInterfaceDefFree(virInterfaceDefPtr def)
{ {
int i, pp; size_t i;
int pp;
if (def == NULL) if (def == NULL)
return; return;
...@@ -299,7 +300,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, ...@@ -299,7 +300,8 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) { xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp; xmlNodePtr dhcp;
xmlNodePtr *ipNodes = NULL; xmlNodePtr *ipNodes = NULL;
int nIpNodes, ii, ret = -1; int nIpNodes, ret = -1;
size_t i;
char *tmp; char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt); tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
...@@ -322,14 +324,14 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def, ...@@ -322,14 +324,14 @@ virInterfaceDefParseProtoIPv4(virInterfaceProtocolDefPtr def,
goto error; goto error;
def->nips = 0; def->nips = 0;
for (ii = 0; ii < nIpNodes; ii++) { for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip; virInterfaceIpDefPtr ip;
if (VIR_ALLOC(ip) < 0) if (VIR_ALLOC(ip) < 0)
goto error; goto error;
ctxt->node = ipNodes[ii]; ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt); ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) { if (ret != 0) {
virInterfaceIpDefFree(ip); virInterfaceIpDefFree(ip);
...@@ -350,7 +352,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, ...@@ -350,7 +352,8 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
xmlXPathContextPtr ctxt) { xmlXPathContextPtr ctxt) {
xmlNodePtr dhcp, autoconf; xmlNodePtr dhcp, autoconf;
xmlNodePtr *ipNodes = NULL; xmlNodePtr *ipNodes = NULL;
int nIpNodes, ii, ret = -1; int nIpNodes, ret = -1;
size_t i;
char *tmp; char *tmp;
tmp = virXPathString("string(./route[1]/@gateway)", ctxt); tmp = virXPathString("string(./route[1]/@gateway)", ctxt);
...@@ -377,14 +380,14 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def, ...@@ -377,14 +380,14 @@ virInterfaceDefParseProtoIPv6(virInterfaceProtocolDefPtr def,
goto error; goto error;
def->nips = 0; def->nips = 0;
for (ii = 0; ii < nIpNodes; ii++) { for (i = 0; i < nIpNodes; i++) {
virInterfaceIpDefPtr ip; virInterfaceIpDefPtr ip;
if (VIR_ALLOC(ip) < 0) if (VIR_ALLOC(ip) < 0)
goto error; goto error;
ctxt->node = ipNodes[ii]; ctxt->node = ipNodes[i];
ret = virInterfaceDefParseIp(ip, ctxt); ret = virInterfaceDefParseIp(ip, ctxt);
if (ret != 0) { if (ret != 0) {
virInterfaceIpDefFree(ip); virInterfaceIpDefFree(ip);
...@@ -475,7 +478,8 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def, ...@@ -475,7 +478,8 @@ virInterfaceDefParseBridge(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
xmlNodePtr bridge; xmlNodePtr bridge;
virInterfaceDefPtr itf; virInterfaceDefPtr itf;
int nbItf, i; int nbItf;
size_t i;
int ret = 0; int ret = 0;
bridge = ctxt->node; bridge = ctxt->node;
...@@ -515,7 +519,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def, ...@@ -515,7 +519,8 @@ virInterfaceDefParseBondItfs(virInterfaceDefPtr def,
xmlNodePtr *interfaces = NULL; xmlNodePtr *interfaces = NULL;
xmlNodePtr bond = ctxt->node; xmlNodePtr bond = ctxt->node;
virInterfaceDefPtr itf; virInterfaceDefPtr itf;
int nbItf, i; int nbItf;
size_t i;
int ret = 0; int ret = 0;
nbItf = virXPathNodeSet("./interface", ctxt, &interfaces); nbItf = virXPathNodeSet("./interface", ctxt, &interfaces);
...@@ -858,7 +863,7 @@ virInterfaceDefPtr virInterfaceDefParseFile(const char *filename) ...@@ -858,7 +863,7 @@ virInterfaceDefPtr virInterfaceDefParseFile(const char *filename)
static int static int
virInterfaceBridgeDefFormat(virBufferPtr buf, virInterfaceBridgeDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) { const virInterfaceDefPtr def, int level) {
int i; size_t i;
int ret = 0; int ret = 0;
virBufferAsprintf(buf, "%*s <bridge", level*2, ""); virBufferAsprintf(buf, "%*s <bridge", level*2, "");
...@@ -883,7 +888,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf, ...@@ -883,7 +888,7 @@ virInterfaceBridgeDefFormat(virBufferPtr buf,
static int static int
virInterfaceBondDefFormat(virBufferPtr buf, virInterfaceBondDefFormat(virBufferPtr buf,
const virInterfaceDefPtr def, int level) { const virInterfaceDefPtr def, int level) {
int i; size_t i;
int ret = 0; int ret = 0;
virBufferAsprintf(buf, "%*s <bond", level*2, ""); virBufferAsprintf(buf, "%*s <bond", level*2, "");
...@@ -965,43 +970,43 @@ virInterfaceVlanDefFormat(virBufferPtr buf, ...@@ -965,43 +970,43 @@ virInterfaceVlanDefFormat(virBufferPtr buf,
static int static int
virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def, virInterfaceProtocolDefFormat(virBufferPtr buf, const virInterfaceDefPtr def,
int level) { int level) {
int pp, ii; size_t i, j;
for (pp = 0; pp < def->nprotos; pp++) { for (i = 0; i < def->nprotos; i++) {
virBufferAsprintf(buf, "%*s <protocol family='%s'>\n", virBufferAsprintf(buf, "%*s <protocol family='%s'>\n",
level*2, "", def->protos[pp]->family); level*2, "", def->protos[i]->family);
if (def->protos[pp]->autoconf) { if (def->protos[i]->autoconf) {
virBufferAsprintf(buf, "%*s <autoconf/>\n", level*2, ""); virBufferAsprintf(buf, "%*s <autoconf/>\n", level*2, "");
} }
if (def->protos[pp]->dhcp) { if (def->protos[i]->dhcp) {
if (def->protos[pp]->peerdns == 0) if (def->protos[i]->peerdns == 0)
virBufferAsprintf(buf, "%*s <dhcp peerdns='no'/>\n", virBufferAsprintf(buf, "%*s <dhcp peerdns='no'/>\n",
level*2, ""); level*2, "");
else if (def->protos[pp]->peerdns == 1) else if (def->protos[i]->peerdns == 1)
virBufferAsprintf(buf, "%*s <dhcp peerdns='yes'/>\n", virBufferAsprintf(buf, "%*s <dhcp peerdns='yes'/>\n",
level*2, ""); level*2, "");
else else
virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2, ""); virBufferAsprintf(buf, "%*s <dhcp/>\n", level*2, "");
} }
for (ii = 0; ii < def->protos[pp]->nips; ii++) { for (j = 0; j < def->protos[i]->nips; j++) {
if (def->protos[pp]->ips[ii]->address != NULL) { if (def->protos[i]->ips[j]->address != NULL) {
virBufferAsprintf(buf, "%*s <ip address='%s'", level*2, "", virBufferAsprintf(buf, "%*s <ip address='%s'", level*2, "",
def->protos[pp]->ips[ii]->address); def->protos[i]->ips[j]->address);
if (def->protos[pp]->ips[ii]->prefix != 0) { if (def->protos[i]->ips[j]->prefix != 0) {
virBufferAsprintf(buf, " prefix='%d'", virBufferAsprintf(buf, " prefix='%d'",
def->protos[pp]->ips[ii]->prefix); def->protos[i]->ips[j]->prefix);
} }
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
} }
if (def->protos[pp]->gateway != NULL) { if (def->protos[i]->gateway != NULL) {
virBufferAsprintf(buf, "%*s <route gateway='%s'/>\n", virBufferAsprintf(buf, "%*s <route gateway='%s'/>\n",
level*2, "", def->protos[pp]->gateway); level*2, "", def->protos[i]->gateway);
} }
virBufferAsprintf(buf, "%*s </protocol>\n", level*2, ""); virBufferAsprintf(buf, "%*s </protocol>\n", level*2, "");
...@@ -1153,7 +1158,8 @@ int virInterfaceFindByMACString(const virInterfaceObjListPtr interfaces, ...@@ -1153,7 +1158,8 @@ int virInterfaceFindByMACString(const virInterfaceObjListPtr interfaces,
const char *mac, const char *mac,
virInterfaceObjPtr *matches, int maxmatches) virInterfaceObjPtr *matches, int maxmatches)
{ {
unsigned int i, matchct = 0; size_t i;
unsigned int matchct = 0;
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
...@@ -1177,7 +1183,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr ...@@ -1177,7 +1183,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr
interfaces, interfaces,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
virInterfaceObjLock(interfaces->objs[i]); virInterfaceObjLock(interfaces->objs[i]);
...@@ -1191,7 +1197,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr ...@@ -1191,7 +1197,7 @@ virInterfaceObjPtr virInterfaceFindByName(const virInterfaceObjListPtr
void virInterfaceObjListFree(virInterfaceObjListPtr interfaces) void virInterfaceObjListFree(virInterfaceObjListPtr interfaces)
{ {
unsigned int i; size_t i;
for (i = 0; i < interfaces->count; i++) for (i = 0; i < interfaces->count; i++)
virInterfaceObjFree(interfaces->objs[i]); virInterfaceObjFree(interfaces->objs[i]);
...@@ -1204,7 +1210,8 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src, ...@@ -1204,7 +1210,8 @@ int virInterfaceObjListClone(virInterfaceObjListPtr src,
virInterfaceObjListPtr dest) virInterfaceObjListPtr dest)
{ {
int ret = -1; int ret = -1;
unsigned int i, cnt; size_t i;
unsigned int cnt;
if (!src || !dest) if (!src || !dest)
goto cleanup; goto cleanup;
...@@ -1276,7 +1283,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces, ...@@ -1276,7 +1283,7 @@ virInterfaceObjPtr virInterfaceAssignDef(virInterfaceObjListPtr interfaces,
void virInterfaceRemove(virInterfaceObjListPtr interfaces, void virInterfaceRemove(virInterfaceObjListPtr interfaces,
const virInterfaceObjPtr iface) const virInterfaceObjPtr iface)
{ {
unsigned int i; size_t i;
virInterfaceObjUnlock(iface); virInterfaceObjUnlock(iface);
for (i = 0; i < interfaces->count; i++) { for (i = 0; i < interfaces->count; i++) {
......
...@@ -39,7 +39,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -39,7 +39,8 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
const char *trunk = NULL; const char *trunk = NULL;
const char *nativeMode = NULL; const char *nativeMode = NULL;
xmlNodePtr *tagNodes = NULL; xmlNodePtr *tagNodes = NULL;
int nTags, ii; int nTags;
size_t i;
ctxt->node = node; ctxt->node = node;
...@@ -59,10 +60,10 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -59,10 +60,10 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
def->nativeMode = 0; def->nativeMode = 0;
def->nativeTag = 0; def->nativeTag = 0;
for (ii = 0; ii < nTags; ii++) { for (i = 0; i < nTags; i++) {
unsigned long id; unsigned long id;
ctxt->node = tagNodes[ii]; ctxt->node = tagNodes[i];
if (virXPathULong("string(./@id)", ctxt, &id) < 0) { if (virXPathULong("string(./@id)", ctxt, &id) < 0) {
virReportError(VIR_ERR_XML_ERROR, "%s", virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing or invalid vlan tag id attribute")); _("missing or invalid vlan tag id attribute"));
...@@ -90,7 +91,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de ...@@ -90,7 +91,7 @@ virNetDevVlanParse(xmlNodePtr node, xmlXPathContextPtr ctxt, virNetDevVlanPtr de
VIR_FREE(nativeMode); VIR_FREE(nativeMode);
def->nativeTag = id; def->nativeTag = id;
} }
def->tag[ii] = id; def->tag[i] = id;
} }
def->nTags = nTags; def->nTags = nTags;
...@@ -141,7 +142,7 @@ cleanup: ...@@ -141,7 +142,7 @@ cleanup:
int int
virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
{ {
int ii; size_t i;
if (def->nTags == 0) if (def->nTags == 0)
return 0; return 0;
...@@ -153,9 +154,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) ...@@ -153,9 +154,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
} }
virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : ""); virBufferAsprintf(buf, "<vlan%s>\n", def->trunk ? " trunk='yes'" : "");
for (ii = 0; ii < def->nTags; ii++) { for (i = 0; i < def->nTags; i++) {
if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT && if (def->nativeMode != VIR_NATIVE_VLAN_MODE_DEFAULT &&
def->nativeTag == def->tag[ii]) { def->nativeTag == def->tag[i]) {
/* check the nativeMode in case we get <tag id='0'/>*/ /* check the nativeMode in case we get <tag id='0'/>*/
const char *mode = virNativeVlanModeTypeToString(def->nativeMode); const char *mode = virNativeVlanModeTypeToString(def->nativeMode);
if (!mode) { if (!mode) {
...@@ -163,9 +164,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf) ...@@ -163,9 +164,9 @@ virNetDevVlanFormat(virNetDevVlanPtr def, virBufferPtr buf)
_("Bad value for nativeMode")); _("Bad value for nativeMode"));
} }
virBufferAsprintf(buf, " <tag id='%u' nativeMode='%s'/>\n", virBufferAsprintf(buf, " <tag id='%u' nativeMode='%s'/>\n",
def->tag[ii], mode); def->tag[i], mode);
} else { } else {
virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[ii]); virBufferAsprintf(buf, " <tag id='%u'/>\n", def->tag[i]);
} }
} }
virBufferAddLit(buf, "</vlan>\n"); virBufferAddLit(buf, "</vlan>\n");
......
...@@ -69,7 +69,7 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName, ...@@ -69,7 +69,7 @@ VIR_ENUM_IMPL(virNetworkForwardDriverName,
virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
const unsigned char *uuid) const unsigned char *uuid)
{ {
unsigned int i; size_t i;
for (i = 0; i < nets->count; i++) { for (i = 0; i < nets->count; i++) {
virNetworkObjLock(nets->objs[i]); virNetworkObjLock(nets->objs[i]);
...@@ -84,7 +84,7 @@ virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets, ...@@ -84,7 +84,7 @@ virNetworkObjPtr virNetworkFindByUUID(const virNetworkObjListPtr nets,
virNetworkObjPtr virNetworkFindByName(const virNetworkObjListPtr nets, virNetworkObjPtr virNetworkFindByName(const virNetworkObjListPtr nets,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < nets->count; i++) { for (i = 0; i < nets->count; i++) {
virNetworkObjLock(nets->objs[i]); virNetworkObjLock(nets->objs[i]);
...@@ -195,15 +195,15 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def) ...@@ -195,15 +195,15 @@ virNetworkDNSDefClear(virNetworkDNSDefPtr def)
static void static void
virNetworkForwardDefClear(virNetworkForwardDefPtr def) virNetworkForwardDefClear(virNetworkForwardDefPtr def)
{ {
int ii; size_t i;
for (ii = 0; ii < def->npfs && def->pfs; ii++) { for (i = 0; i < def->npfs && def->pfs; i++) {
virNetworkForwardPfDefClear(&def->pfs[ii]); virNetworkForwardPfDefClear(&def->pfs[i]);
} }
VIR_FREE(def->pfs); VIR_FREE(def->pfs);
for (ii = 0; ii < def->nifs && def->ifs; ii++) { for (i = 0; i < def->nifs && def->ifs; i++) {
virNetworkForwardIfDefClear(&def->ifs[ii]); virNetworkForwardIfDefClear(&def->ifs[i]);
} }
VIR_FREE(def->ifs); VIR_FREE(def->ifs);
} }
...@@ -211,7 +211,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def) ...@@ -211,7 +211,7 @@ virNetworkForwardDefClear(virNetworkForwardDefPtr def)
void void
virNetworkDefFree(virNetworkDefPtr def) virNetworkDefFree(virNetworkDefPtr def)
{ {
int ii; size_t i;
if (!def) if (!def)
return; return;
...@@ -222,18 +222,18 @@ virNetworkDefFree(virNetworkDefPtr def) ...@@ -222,18 +222,18 @@ virNetworkDefFree(virNetworkDefPtr def)
virNetworkForwardDefClear(&def->forward); virNetworkForwardDefClear(&def->forward);
for (ii = 0; ii < def->nips && def->ips; ii++) { for (i = 0; i < def->nips && def->ips; i++) {
virNetworkIpDefClear(&def->ips[ii]); virNetworkIpDefClear(&def->ips[i]);
} }
VIR_FREE(def->ips); VIR_FREE(def->ips);
for (ii = 0; ii < def->nroutes && def->routes; ii++) { for (i = 0; i < def->nroutes && def->routes; i++) {
virNetworkRouteDefClear(&def->routes[ii]); virNetworkRouteDefClear(&def->routes[i]);
} }
VIR_FREE(def->routes); VIR_FREE(def->routes);
for (ii = 0; ii < def->nPortGroups && def->portGroups; ii++) { for (i = 0; i < def->nPortGroups && def->portGroups; i++) {
virPortGroupDefClear(&def->portGroups[ii]); virPortGroupDefClear(&def->portGroups[i]);
} }
VIR_FREE(def->portGroups); VIR_FREE(def->portGroups);
...@@ -262,7 +262,7 @@ void virNetworkObjFree(virNetworkObjPtr net) ...@@ -262,7 +262,7 @@ void virNetworkObjFree(virNetworkObjPtr net)
void virNetworkObjListFree(virNetworkObjListPtr nets) void virNetworkObjListFree(virNetworkObjListPtr nets)
{ {
unsigned int i; size_t i;
for (i = 0; i < nets->count; i++) for (i = 0; i < nets->count; i++)
virNetworkObjFree(nets->objs[i]); virNetworkObjFree(nets->objs[i]);
...@@ -539,7 +539,7 @@ cleanup: ...@@ -539,7 +539,7 @@ cleanup:
void virNetworkRemoveInactive(virNetworkObjListPtr nets, void virNetworkRemoveInactive(virNetworkObjListPtr nets,
const virNetworkObjPtr net) const virNetworkObjPtr net)
{ {
unsigned int i; size_t i;
virNetworkObjUnlock(net); virNetworkObjUnlock(net);
for (i = 0; i < nets->count; i++) { for (i = 0; i < nets->count; i++) {
...@@ -568,7 +568,7 @@ virNetworkIpDefPtr ...@@ -568,7 +568,7 @@ virNetworkIpDefPtr
virNetworkDefGetIpByIndex(const virNetworkDefPtr def, virNetworkDefGetIpByIndex(const virNetworkDefPtr def,
int family, size_t n) int family, size_t n)
{ {
int ii; size_t i;
if (!def->ips || n >= def->nips) if (!def->ips || n >= def->nips)
return NULL; return NULL;
...@@ -578,10 +578,10 @@ virNetworkDefGetIpByIndex(const virNetworkDefPtr def, ...@@ -578,10 +578,10 @@ virNetworkDefGetIpByIndex(const virNetworkDefPtr def,
} }
/* find the nth ip of type "family" */ /* find the nth ip of type "family" */
for (ii = 0; ii < def->nips; ii++) { for (i = 0; i < def->nips; i++) {
if (VIR_SOCKET_ADDR_IS_FAMILY(&def->ips[ii].address, family) if (VIR_SOCKET_ADDR_IS_FAMILY(&def->ips[i].address, family)
&& (n-- <= 0)) { && (n-- <= 0)) {
return &def->ips[ii]; return &def->ips[i];
} }
} }
/* failed to find enough of the right family */ /* failed to find enough of the right family */
...@@ -1037,7 +1037,8 @@ virNetworkDNSDefParseXML(const char *networkName, ...@@ -1037,7 +1037,8 @@ virNetworkDNSDefParseXML(const char *networkName,
xmlNodePtr *srvNodes = NULL; xmlNodePtr *srvNodes = NULL;
xmlNodePtr *txtNodes = NULL; xmlNodePtr *txtNodes = NULL;
int nhosts, nsrvs, ntxts; int nhosts, nsrvs, ntxts;
int ii, ret = -1; size_t i;
int ret = -1;
xmlNodePtr save = ctxt->node; xmlNodePtr save = ctxt->node;
ctxt->node = node; ctxt->node = node;
...@@ -1053,8 +1054,8 @@ virNetworkDNSDefParseXML(const char *networkName, ...@@ -1053,8 +1054,8 @@ virNetworkDNSDefParseXML(const char *networkName,
if (VIR_ALLOC_N(def->hosts, nhosts) < 0) if (VIR_ALLOC_N(def->hosts, nhosts) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < nhosts; ii++) { for (i = 0; i < nhosts; i++) {
if (virNetworkDNSHostDefParseXML(networkName, hostNodes[ii], if (virNetworkDNSHostDefParseXML(networkName, hostNodes[i],
&def->hosts[def->nhosts], false) < 0) { &def->hosts[def->nhosts], false) < 0) {
goto cleanup; goto cleanup;
} }
...@@ -1073,8 +1074,8 @@ virNetworkDNSDefParseXML(const char *networkName, ...@@ -1073,8 +1074,8 @@ virNetworkDNSDefParseXML(const char *networkName,
if (VIR_ALLOC_N(def->srvs, nsrvs) < 0) if (VIR_ALLOC_N(def->srvs, nsrvs) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < nsrvs; ii++) { for (i = 0; i < nsrvs; i++) {
if (virNetworkDNSSrvDefParseXML(networkName, srvNodes[ii], ctxt, if (virNetworkDNSSrvDefParseXML(networkName, srvNodes[i], ctxt,
&def->srvs[def->nsrvs], false) < 0) { &def->srvs[def->nsrvs], false) < 0) {
goto cleanup; goto cleanup;
} }
...@@ -1093,8 +1094,8 @@ virNetworkDNSDefParseXML(const char *networkName, ...@@ -1093,8 +1094,8 @@ virNetworkDNSDefParseXML(const char *networkName,
if (VIR_ALLOC_N(def->txts, ntxts) < 0) if (VIR_ALLOC_N(def->txts, ntxts) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < ntxts; ii++) { for (i = 0; i < ntxts; i++) {
if (virNetworkDNSTxtDefParseXML(networkName, txtNodes[ii], if (virNetworkDNSTxtDefParseXML(networkName, txtNodes[i],
&def->txts[def->ntxts], false) < 0) { &def->txts[def->ntxts], false) < 0) {
goto cleanup; goto cleanup;
} }
...@@ -1661,7 +1662,8 @@ virNetworkForwardDefParseXML(const char *networkName, ...@@ -1661,7 +1662,8 @@ virNetworkForwardDefParseXML(const char *networkName,
xmlXPathContextPtr ctxt, xmlXPathContextPtr ctxt,
virNetworkForwardDefPtr def) virNetworkForwardDefPtr def)
{ {
int ii, ret = -1; size_t i;
int ret = -1;
xmlNodePtr *forwardIfNodes = NULL; xmlNodePtr *forwardIfNodes = NULL;
xmlNodePtr *forwardPfNodes = NULL; xmlNodePtr *forwardPfNodes = NULL;
xmlNodePtr *forwardAddrNodes = NULL; xmlNodePtr *forwardAddrNodes = NULL;
...@@ -1779,8 +1781,8 @@ virNetworkForwardDefParseXML(const char *networkName, ...@@ -1779,8 +1781,8 @@ virNetworkForwardDefParseXML(const char *networkName,
} }
/* parse each <interface> */ /* parse each <interface> */
for (ii = 0; ii < nForwardIfs; ii++) { for (i = 0; i < nForwardIfs; i++) {
forwardDev = virXMLPropString(forwardIfNodes[ii], "dev"); forwardDev = virXMLPropString(forwardIfNodes[i], "dev");
if (!forwardDev) { if (!forwardDev) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("Missing required dev attribute in " _("Missing required dev attribute in "
...@@ -1789,7 +1791,7 @@ virNetworkForwardDefParseXML(const char *networkName, ...@@ -1789,7 +1791,7 @@ virNetworkForwardDefParseXML(const char *networkName,
goto cleanup; goto cleanup;
} }
if ((ii == 0) && (def->nifs == 1)) { if ((i == 0) && (def->nifs == 1)) {
/* both <forward dev='x'> and <interface dev='x'/> are /* both <forward dev='x'> and <interface dev='x'/> are
* present. If they don't match, it's an error. * present. If they don't match, it's an error.
*/ */
...@@ -1805,9 +1807,9 @@ virNetworkForwardDefParseXML(const char *networkName, ...@@ -1805,9 +1807,9 @@ virNetworkForwardDefParseXML(const char *networkName,
continue; continue;
} }
def->ifs[ii].device.dev = forwardDev; def->ifs[i].device.dev = forwardDev;
forwardDev = NULL; forwardDev = NULL;
def->ifs[ii].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV; def->ifs[i].type = VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV;
def->nifs++; def->nifs++;
} }
...@@ -1815,25 +1817,25 @@ virNetworkForwardDefParseXML(const char *networkName, ...@@ -1815,25 +1817,25 @@ virNetworkForwardDefParseXML(const char *networkName,
if (VIR_ALLOC_N(def->ifs, nForwardAddrs) < 0) if (VIR_ALLOC_N(def->ifs, nForwardAddrs) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < nForwardAddrs; ii++) { for (i = 0; i < nForwardAddrs; i++) {
if (!(type = virXMLPropString(forwardAddrNodes[ii], "type"))) { if (!(type = virXMLPropString(forwardAddrNodes[i], "type"))) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("missing address type in network %s"), _("missing address type in network %s"),
networkName); networkName);
goto cleanup; goto cleanup;
} }
if ((def->ifs[ii].type = virNetworkForwardHostdevDeviceTypeFromString(type)) < 0) { if ((def->ifs[i].type = virNetworkForwardHostdevDeviceTypeFromString(type)) < 0) {
virReportError(VIR_ERR_XML_ERROR, virReportError(VIR_ERR_XML_ERROR,
_("unknown address type '%s' in network %s"), _("unknown address type '%s' in network %s"),
type, networkName); type, networkName);
goto cleanup; goto cleanup;
} }
switch (def->ifs[ii].type) { switch (def->ifs[i].type) {
case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI: case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI:
if (virDevicePCIAddressParseXML(forwardAddrNodes[ii], if (virDevicePCIAddressParseXML(forwardAddrNodes[i],
&def->ifs[ii].device.pci) < 0) { &def->ifs[i].device.pci) < 0) {
goto cleanup; goto cleanup;
} }
break; break;
...@@ -2007,15 +2009,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) ...@@ -2007,15 +2009,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error; goto error;
if (nPortGroups > 0) { if (nPortGroups > 0) {
int ii; size_t i;
/* allocate array to hold all the portgroups */ /* allocate array to hold all the portgroups */
if (VIR_ALLOC_N(def->portGroups, nPortGroups) < 0) if (VIR_ALLOC_N(def->portGroups, nPortGroups) < 0)
goto error; goto error;
/* parse each portgroup */ /* parse each portgroup */
for (ii = 0; ii < nPortGroups; ii++) { for (i = 0; i < nPortGroups; i++) {
int ret = virNetworkPortGroupParseXML(&def->portGroups[ii], int ret = virNetworkPortGroupParseXML(&def->portGroups[i],
portGroupNodes[ii], ctxt); portGroupNodes[i], ctxt);
if (ret < 0) if (ret < 0)
goto error; goto error;
def->nPortGroups++; def->nPortGroups++;
...@@ -2028,15 +2030,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) ...@@ -2028,15 +2030,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error; goto error;
if (nIps > 0) { if (nIps > 0) {
int ii; size_t i;
/* allocate array to hold all the addrs */ /* allocate array to hold all the addrs */
if (VIR_ALLOC_N(def->ips, nIps) < 0) if (VIR_ALLOC_N(def->ips, nIps) < 0)
goto error; goto error;
/* parse each addr */ /* parse each addr */
for (ii = 0; ii < nIps; ii++) { for (i = 0; i < nIps; i++) {
int ret = virNetworkIPDefParseXML(def->name, ipNodes[ii], int ret = virNetworkIPDefParseXML(def->name, ipNodes[i],
ctxt, &def->ips[ii]); ctxt, &def->ips[i]);
if (ret < 0) if (ret < 0)
goto error; goto error;
def->nips++; def->nips++;
...@@ -2049,15 +2051,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) ...@@ -2049,15 +2051,15 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
goto error; goto error;
if (nRoutes > 0) { if (nRoutes > 0) {
int ii; size_t i;
/* allocate array to hold all the route definitions */ /* allocate array to hold all the route definitions */
if (VIR_ALLOC_N(def->routes, nRoutes) < 0) if (VIR_ALLOC_N(def->routes, nRoutes) < 0)
goto error; goto error;
/* parse each definition */ /* parse each definition */
for (ii = 0; ii < nRoutes; ii++) { for (i = 0; i < nRoutes; i++) {
int ret = virNetworkRouteDefParseXML(def->name, routeNodes[ii], int ret = virNetworkRouteDefParseXML(def->name, routeNodes[i],
ctxt, &def->routes[ii]); ctxt, &def->routes[i]);
if (ret < 0) if (ret < 0)
goto error; goto error;
def->nroutes++; def->nroutes++;
...@@ -2071,14 +2073,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) ...@@ -2071,14 +2073,14 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt)
*/ */
nRoutes = def->nroutes; nRoutes = def->nroutes;
nIps = def->nips; nIps = def->nips;
for (ii = 0; ii < nRoutes; ii++) { for (i = 0; i < nRoutes; i++) {
int jj; size_t j;
virSocketAddr testAddr, testGw; virSocketAddr testAddr, testGw;
bool addrMatch; bool addrMatch;
virNetworkRouteDefPtr gwdef = &def->routes[ii]; virNetworkRouteDefPtr gwdef = &def->routes[i];
addrMatch = false; addrMatch = false;
for (jj = 0; jj < nIps; jj++) { for (j = 0; j < nIps; j++) {
virNetworkIpDefPtr def2 = &def->ips[jj]; virNetworkIpDefPtr def2 = &def->ips[j];
if (VIR_SOCKET_ADDR_FAMILY(&gwdef->gateway) if (VIR_SOCKET_ADDR_FAMILY(&gwdef->gateway)
!= VIR_SOCKET_ADDR_FAMILY(&def2->address)) { != VIR_SOCKET_ADDR_FAMILY(&def2->address)) {
continue; continue;
...@@ -2247,7 +2249,7 @@ virNetworkDNSDefFormat(virBufferPtr buf, ...@@ -2247,7 +2249,7 @@ virNetworkDNSDefFormat(virBufferPtr buf,
virNetworkDNSDefPtr def) virNetworkDNSDefPtr def)
{ {
int result = 0; int result = 0;
int i; size_t i, j;
if (!(def->nhosts || def->nsrvs || def->ntxts)) if (!(def->nhosts || def->nsrvs || def->ntxts))
goto out; goto out;
...@@ -2283,16 +2285,14 @@ virNetworkDNSDefFormat(virBufferPtr buf, ...@@ -2283,16 +2285,14 @@ virNetworkDNSDefFormat(virBufferPtr buf,
} }
if (def->nhosts) { if (def->nhosts) {
int ii, j; for (i = 0; i < def->nhosts; i++) {
char *ip = virSocketAddrFormat(&def->hosts[i].ip);
for (ii = 0; ii < def->nhosts; ii++) {
char *ip = virSocketAddrFormat(&def->hosts[ii].ip);
virBufferAsprintf(buf, "<host ip='%s'>\n", ip); virBufferAsprintf(buf, "<host ip='%s'>\n", ip);
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (j = 0; j < def->hosts[ii].nnames; j++) for (j = 0; j < def->hosts[i].nnames; j++)
virBufferAsprintf(buf, "<hostname>%s</hostname>\n", virBufferAsprintf(buf, "<hostname>%s</hostname>\n",
def->hosts[ii].names[j]); def->hosts[i].names[j]);
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</host>\n"); virBufferAddLit(buf, "</host>\n");
...@@ -2341,15 +2341,15 @@ virNetworkIpDefFormat(virBufferPtr buf, ...@@ -2341,15 +2341,15 @@ virNetworkIpDefFormat(virBufferPtr buf,
def->tftproot); def->tftproot);
} }
if ((def->nranges || def->nhosts)) { if ((def->nranges || def->nhosts)) {
int ii; size_t i;
virBufferAddLit(buf, "<dhcp>\n"); virBufferAddLit(buf, "<dhcp>\n");
virBufferAdjustIndent(buf, 2); virBufferAdjustIndent(buf, 2);
for (ii = 0; ii < def->nranges; ii++) { for (i = 0; i < def->nranges; i++) {
char *saddr = virSocketAddrFormat(&def->ranges[ii].start); char *saddr = virSocketAddrFormat(&def->ranges[i].start);
if (!saddr) if (!saddr)
goto error; goto error;
char *eaddr = virSocketAddrFormat(&def->ranges[ii].end); char *eaddr = virSocketAddrFormat(&def->ranges[i].end);
if (!eaddr) { if (!eaddr) {
VIR_FREE(saddr); VIR_FREE(saddr);
goto error; goto error;
...@@ -2359,16 +2359,16 @@ virNetworkIpDefFormat(virBufferPtr buf, ...@@ -2359,16 +2359,16 @@ virNetworkIpDefFormat(virBufferPtr buf,
VIR_FREE(saddr); VIR_FREE(saddr);
VIR_FREE(eaddr); VIR_FREE(eaddr);
} }
for (ii = 0; ii < def->nhosts; ii++) { for (i = 0; i < def->nhosts; i++) {
virBufferAddLit(buf, "<host "); virBufferAddLit(buf, "<host ");
if (def->hosts[ii].mac) if (def->hosts[i].mac)
virBufferAsprintf(buf, "mac='%s' ", def->hosts[ii].mac); virBufferAsprintf(buf, "mac='%s' ", def->hosts[i].mac);
if (def->hosts[ii].id) if (def->hosts[i].id)
virBufferAsprintf(buf, "id='%s' ", def->hosts[ii].id); virBufferAsprintf(buf, "id='%s' ", def->hosts[i].id);
if (def->hosts[ii].name) if (def->hosts[i].name)
virBufferAsprintf(buf, "name='%s' ", def->hosts[ii].name); virBufferAsprintf(buf, "name='%s' ", def->hosts[i].name);
if (VIR_SOCKET_ADDR_VALID(&def->hosts[ii].ip)) { if (VIR_SOCKET_ADDR_VALID(&def->hosts[i].ip)) {
char *ipaddr = virSocketAddrFormat(&def->hosts[ii].ip); char *ipaddr = virSocketAddrFormat(&def->hosts[i].ip);
if (!ipaddr) if (!ipaddr)
goto error; goto error;
virBufferAsprintf(buf, "ip='%s' ", ipaddr); virBufferAsprintf(buf, "ip='%s' ", ipaddr);
...@@ -2526,7 +2526,8 @@ virNetworkDefFormatInternal(virBufferPtr buf, ...@@ -2526,7 +2526,8 @@ virNetworkDefFormatInternal(virBufferPtr buf,
{ {
unsigned char *uuid; unsigned char *uuid;
char uuidstr[VIR_UUID_STRING_BUFLEN]; char uuidstr[VIR_UUID_STRING_BUFLEN];
int ii, shortforward; size_t i;
int shortforward;
virBufferAddLit(buf, "<network"); virBufferAddLit(buf, "<network");
if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0)) { if (!(flags & VIR_NETWORK_XML_INACTIVE) && (def->connections > 0)) {
...@@ -2597,21 +2598,21 @@ virNetworkDefFormatInternal(virBufferPtr buf, ...@@ -2597,21 +2598,21 @@ virNetworkDefFormatInternal(virBufferPtr buf,
if (def->forward.nifs && if (def->forward.nifs &&
(!def->forward.npfs || !(flags & VIR_NETWORK_XML_INACTIVE))) { (!def->forward.npfs || !(flags & VIR_NETWORK_XML_INACTIVE))) {
for (ii = 0; ii < def->forward.nifs; ii++) { for (i = 0; i < def->forward.nifs; i++) {
if (def->forward.type != VIR_NETWORK_FORWARD_HOSTDEV) { if (def->forward.type != VIR_NETWORK_FORWARD_HOSTDEV) {
virBufferEscapeString(buf, "<interface dev='%s'", virBufferEscapeString(buf, "<interface dev='%s'",
def->forward.ifs[ii].device.dev); def->forward.ifs[i].device.dev);
if (!(flags & VIR_NETWORK_XML_INACTIVE) && if (!(flags & VIR_NETWORK_XML_INACTIVE) &&
(def->forward.ifs[ii].connections > 0)) { (def->forward.ifs[i].connections > 0)) {
virBufferAsprintf(buf, " connections='%d'", virBufferAsprintf(buf, " connections='%d'",
def->forward.ifs[ii].connections); def->forward.ifs[i].connections);
} }
virBufferAddLit(buf, "/>\n"); virBufferAddLit(buf, "/>\n");
} }
else { else {
if (def->forward.ifs[ii].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) { if (def->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) {
if (virDevicePCIAddressFormat(buf, if (virDevicePCIAddressFormat(buf,
def->forward.ifs[ii].device.pci, def->forward.ifs[i].device.pci,
true) < 0) true) < 0)
goto error; goto error;
} }
...@@ -2656,21 +2657,21 @@ virNetworkDefFormatInternal(virBufferPtr buf, ...@@ -2656,21 +2657,21 @@ virNetworkDefFormatInternal(virBufferPtr buf,
if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0) if (virNetDevBandwidthFormat(def->bandwidth, buf) < 0)
goto error; goto error;
for (ii = 0; ii < def->nips; ii++) { for (i = 0; i < def->nips; i++) {
if (virNetworkIpDefFormat(buf, &def->ips[ii]) < 0) if (virNetworkIpDefFormat(buf, &def->ips[i]) < 0)
goto error; goto error;
} }
for (ii = 0; ii < def->nroutes; ii++) { for (i = 0; i < def->nroutes; i++) {
if (virNetworkRouteDefFormat(buf, &def->routes[ii]) < 0) if (virNetworkRouteDefFormat(buf, &def->routes[i]) < 0)
goto error; goto error;
} }
if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0) if (virNetDevVPortProfileFormat(def->virtPortProfile, buf) < 0)
goto error; goto error;
for (ii = 0; ii < def->nPortGroups; ii++) for (i = 0; i < def->nPortGroups; i++)
if (virPortGroupDefFormat(buf, &def->portGroups[ii]) < 0) if (virPortGroupDefFormat(buf, &def->portGroups[i]) < 0)
goto error; goto error;
virBufferAdjustIndent(buf, -2); virBufferAdjustIndent(buf, -2);
...@@ -2740,14 +2741,14 @@ error: ...@@ -2740,14 +2741,14 @@ error:
virPortGroupDefPtr virPortGroupFindByName(virNetworkDefPtr net, virPortGroupDefPtr virPortGroupFindByName(virNetworkDefPtr net,
const char *portgroup) const char *portgroup)
{ {
int ii; size_t i;
for (ii = 0; ii < net->nPortGroups; ii++) { for (i = 0; i < net->nPortGroups; i++) {
if (portgroup) { if (portgroup) {
if (STREQ(portgroup, net->portGroups[ii].name)) if (STREQ(portgroup, net->portGroups[i].name))
return &net->portGroups[ii]; return &net->portGroups[i];
} else { } else {
if (net->portGroups[ii].isDefault) if (net->portGroups[i].isDefault)
return &net->portGroups[ii]; return &net->portGroups[i];
} }
} }
return NULL; return NULL;
...@@ -3093,7 +3094,7 @@ int virNetworkBridgeInUse(const virNetworkObjListPtr nets, ...@@ -3093,7 +3094,7 @@ int virNetworkBridgeInUse(const virNetworkObjListPtr nets,
const char *bridge, const char *bridge,
const char *skipname) const char *skipname)
{ {
unsigned int i; size_t i;
unsigned int ret = 0; unsigned int ret = 0;
for (i = 0; i < nets->count; i++) { for (i = 0; i < nets->count; i++) {
...@@ -3247,7 +3248,7 @@ static virNetworkIpDefPtr ...@@ -3247,7 +3248,7 @@ static virNetworkIpDefPtr
virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex) virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex)
{ {
virNetworkIpDefPtr ipdef = NULL; virNetworkIpDefPtr ipdef = NULL;
int ii; size_t i;
/* first find which ip element's dhcp host list to work on */ /* first find which ip element's dhcp host list to work on */
if (parentIndex >= 0) { if (parentIndex >= 0) {
...@@ -3264,9 +3265,9 @@ virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex) ...@@ -3264,9 +3265,9 @@ virNetworkIpDefByIndex(virNetworkDefPtr def, int parentIndex)
/* -1 means "find the most appropriate", which in this case /* -1 means "find the most appropriate", which in this case
* means the one and only <ip> that has <dhcp> element * means the one and only <ip> that has <dhcp> element
*/ */
for (ii = 0; for (i = 0;
(ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, ii)); (ipdef = virNetworkDefGetIpByIndex(def, AF_UNSPEC, i));
ii++) { i++) {
if (ipdef->nranges || ipdef->nhosts) if (ipdef->nranges || ipdef->nhosts)
break; break;
} }
...@@ -3291,7 +3292,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3291,7 +3292,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, ret = -1; size_t i;
int ret = -1;
virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex); virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex);
virNetworkDHCPHostDef host; virNetworkDHCPHostDef host;
...@@ -3314,16 +3316,16 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3314,16 +3316,16 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
/* search for the entry with this (mac|name), /* search for the entry with this (mac|name),
* and update the IP+(mac|name) */ * and update the IP+(mac|name) */
for (ii = 0; ii < ipdef->nhosts; ii++) { for (i = 0; i < ipdef->nhosts; i++) {
if ((host.mac && if ((host.mac &&
!virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) || !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(host.name && (host.name &&
STREQ_NULLABLE(host.name, ipdef->hosts[ii].name))) { STREQ_NULLABLE(host.name, ipdef->hosts[i].name))) {
break; break;
} }
} }
if (ii == ipdef->nhosts) { if (i == ipdef->nhosts) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate an existing dhcp host entry with " _("couldn't locate an existing dhcp host entry with "
"\"mac='%s'\" in network '%s'"), "\"mac='%s'\" in network '%s'"),
...@@ -3335,8 +3337,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3335,8 +3337,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
* then clear out the extra copy to get rid of the duplicate pointers * then clear out the extra copy to get rid of the duplicate pointers
* to its data (mac and name strings). * to its data (mac and name strings).
*/ */
virNetworkDHCPHostDefClear(&ipdef->hosts[ii]); virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
ipdef->hosts[ii] = host; ipdef->hosts[i] = host;
memset(&host, 0, sizeof(host)); memset(&host, 0, sizeof(host));
} else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) || } else if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
...@@ -3348,13 +3350,13 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3348,13 +3350,13 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
} }
/* log error if an entry with same name/address/ip already exists */ /* log error if an entry with same name/address/ip already exists */
for (ii = 0; ii < ipdef->nhosts; ii++) { for (i = 0; i < ipdef->nhosts; i++) {
if ((host.mac && if ((host.mac &&
!virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) || !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) ||
(host.name && (host.name &&
STREQ_NULLABLE(host.name, ipdef->hosts[ii].name)) || STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) ||
(VIR_SOCKET_ADDR_VALID(&host.ip) && (VIR_SOCKET_ADDR_VALID(&host.ip) &&
virSocketAddrEqual(&host.ip, &ipdef->hosts[ii].ip))) { virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
char *ip = virSocketAddrFormat(&host.ip); char *ip = virSocketAddrFormat(&host.ip);
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
...@@ -3382,17 +3384,17 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3382,17 +3384,17 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
} }
/* find matching entry - all specified attributes must match */ /* find matching entry - all specified attributes must match */
for (ii = 0; ii < ipdef->nhosts; ii++) { for (i = 0; i < ipdef->nhosts; i++) {
if ((!host.mac || if ((!host.mac ||
!virMacAddrCompare(host.mac, ipdef->hosts[ii].mac)) && !virMacAddrCompare(host.mac, ipdef->hosts[i].mac)) &&
(!host.name || (!host.name ||
STREQ_NULLABLE(host.name, ipdef->hosts[ii].name)) && STREQ_NULLABLE(host.name, ipdef->hosts[i].name)) &&
(!VIR_SOCKET_ADDR_VALID(&host.ip) || (!VIR_SOCKET_ADDR_VALID(&host.ip) ||
virSocketAddrEqual(&host.ip, &ipdef->hosts[ii].ip))) { virSocketAddrEqual(&host.ip, &ipdef->hosts[i].ip))) {
break; break;
} }
} }
if (ii == ipdef->nhosts) { if (i == ipdef->nhosts) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate a matching dhcp host entry " _("couldn't locate a matching dhcp host entry "
"in network '%s'"), def->name); "in network '%s'"), def->name);
...@@ -3400,8 +3402,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def, ...@@ -3400,8 +3402,8 @@ virNetworkDefUpdateIPDHCPHost(virNetworkDefPtr def,
} }
/* remove it */ /* remove it */
virNetworkDHCPHostDefClear(&ipdef->hosts[ii]); virNetworkDHCPHostDefClear(&ipdef->hosts[i]);
VIR_DELETE_ELEMENT(ipdef->hosts, ii, ipdef->nhosts); VIR_DELETE_ELEMENT(ipdef->hosts, i, ipdef->nhosts);
} else { } else {
virNetworkDefUpdateUnknownCommand(command); virNetworkDefUpdateUnknownCommand(command);
...@@ -3422,7 +3424,8 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, ...@@ -3422,7 +3424,8 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, ret = -1; size_t i;
int ret = -1;
virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex); virNetworkIpDefPtr ipdef = virNetworkIpDefByIndex(def, parentIndex);
virSocketAddrRange range; virSocketAddrRange range;
...@@ -3448,9 +3451,9 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, ...@@ -3448,9 +3451,9 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
goto cleanup; goto cleanup;
/* check if an entry with same name/address/ip already exists */ /* check if an entry with same name/address/ip already exists */
for (ii = 0; ii < ipdef->nranges; ii++) { for (i = 0; i < ipdef->nranges; i++) {
if (virSocketAddrEqual(&range.start, &ipdef->ranges[ii].start) && if (virSocketAddrEqual(&range.start, &ipdef->ranges[i].start) &&
virSocketAddrEqual(&range.end, &ipdef->ranges[ii].end)) { virSocketAddrEqual(&range.end, &ipdef->ranges[i].end)) {
break; break;
} }
} }
...@@ -3458,7 +3461,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, ...@@ -3458,7 +3461,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) || if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
(command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) { (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
if (ii < ipdef->nranges) { if (i < ipdef->nranges) {
char *startip = virSocketAddrFormat(&range.start); char *startip = virSocketAddrFormat(&range.start);
char *endip = virSocketAddrFormat(&range.end); char *endip = virSocketAddrFormat(&range.end);
...@@ -3480,7 +3483,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, ...@@ -3480,7 +3483,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
goto cleanup; goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) { } else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
if (ii == ipdef->nranges) { if (i == ipdef->nranges) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't locate a matching dhcp range entry " _("couldn't locate a matching dhcp range entry "
"in network '%s'"), def->name); "in network '%s'"), def->name);
...@@ -3489,7 +3492,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def, ...@@ -3489,7 +3492,7 @@ virNetworkDefUpdateIPDHCPRange(virNetworkDefPtr def,
/* remove it */ /* remove it */
/* NB: nothing to clear from a RangeDef that's being freed */ /* NB: nothing to clear from a RangeDef that's being freed */
VIR_DELETE_ELEMENT(ipdef->ranges, ii, ipdef->nranges); VIR_DELETE_ELEMENT(ipdef->ranges, i, ipdef->nranges);
} else { } else {
virNetworkDefUpdateUnknownCommand(command); virNetworkDefUpdateUnknownCommand(command);
...@@ -3521,7 +3524,8 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, ...@@ -3521,7 +3524,8 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, ret = -1; size_t i;
int ret = -1;
virNetworkForwardIfDef iface; virNetworkForwardIfDef iface;
memset(&iface, 0, sizeof(iface)); memset(&iface, 0, sizeof(iface));
...@@ -3545,17 +3549,17 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, ...@@ -3545,17 +3549,17 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
} }
/* check if an <interface> with same dev name already exists */ /* check if an <interface> with same dev name already exists */
for (ii = 0; ii < def->forward.nifs; ii++) { for (i = 0; i < def->forward.nifs; i++) {
if (def->forward.ifs[ii].type if (def->forward.ifs[i].type
== VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV && == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_NETDEV &&
STREQ(iface.device.dev, def->forward.ifs[ii].device.dev)) STREQ(iface.device.dev, def->forward.ifs[i].device.dev))
break; break;
} }
if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) || if ((command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST) ||
(command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) { (command == VIR_NETWORK_UPDATE_COMMAND_ADD_LAST)) {
if (ii < def->forward.nifs) { if (i < def->forward.nifs) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("there is an existing interface entry " _("there is an existing interface entry "
"in network '%s' that matches " "in network '%s' that matches "
...@@ -3572,7 +3576,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, ...@@ -3572,7 +3576,7 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
goto cleanup; goto cleanup;
} else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) { } else if (command == VIR_NETWORK_UPDATE_COMMAND_DELETE) {
if (ii == def->forward.nifs) { if (i == def->forward.nifs) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("couldn't find an interface entry " _("couldn't find an interface entry "
"in network '%s' matching <interface dev='%s'>"), "in network '%s' matching <interface dev='%s'>"),
...@@ -3581,19 +3585,19 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def, ...@@ -3581,19 +3585,19 @@ virNetworkDefUpdateForwardInterface(virNetworkDefPtr def,
} }
/* fail if the interface is being used */ /* fail if the interface is being used */
if (def->forward.ifs[ii].connections > 0) { if (def->forward.ifs[i].connections > 0) {
virReportError(VIR_ERR_OPERATION_INVALID, virReportError(VIR_ERR_OPERATION_INVALID,
_("unable to delete interface '%s' " _("unable to delete interface '%s' "
"in network '%s'. It is currently being used " "in network '%s'. It is currently being used "
" by %d domains."), " by %d domains."),
iface.device.dev, def->name, iface.device.dev, def->name,
def->forward.ifs[ii].connections); def->forward.ifs[i].connections);
goto cleanup; goto cleanup;
} }
/* remove it */ /* remove it */
virNetworkForwardIfDefClear(&def->forward.ifs[ii]); virNetworkForwardIfDefClear(&def->forward.ifs[i]);
VIR_DELETE_ELEMENT(def->forward.ifs, ii, def->forward.nifs); VIR_DELETE_ELEMENT(def->forward.ifs, i, def->forward.nifs);
} else { } else {
virNetworkDefUpdateUnknownCommand(command); virNetworkDefUpdateUnknownCommand(command);
...@@ -3626,7 +3630,8 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def, ...@@ -3626,7 +3630,8 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, foundName = -1, foundDefault = -1; size_t i;
int foundName = -1, foundDefault = -1;
int ret = -1; int ret = -1;
virPortGroupDef portgroup; virPortGroupDef portgroup;
...@@ -3639,11 +3644,11 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def, ...@@ -3639,11 +3644,11 @@ virNetworkDefUpdatePortGroup(virNetworkDefPtr def,
goto cleanup; goto cleanup;
/* check if a portgroup with same name already exists */ /* check if a portgroup with same name already exists */
for (ii = 0; ii < def->nPortGroups; ii++) { for (i = 0; i < def->nPortGroups; i++) {
if (STREQ(portgroup.name, def->portGroups[ii].name)) if (STREQ(portgroup.name, def->portGroups[i].name))
foundName = ii; foundName = i;
if (def->portGroups[ii].isDefault) if (def->portGroups[i].isDefault)
foundDefault = ii; foundDefault = i;
} }
if (foundName == -1 && if (foundName == -1 &&
((command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) || ((command == VIR_NETWORK_UPDATE_COMMAND_MODIFY) ||
...@@ -3719,7 +3724,8 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def, ...@@ -3719,7 +3724,8 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, jj, kk, foundIdx = -1, ret = -1; size_t i, j, k;
int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns; virNetworkDNSDefPtr dns = &def->dns;
virNetworkDNSHostDef host; virNetworkDNSHostDef host;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST || bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
...@@ -3741,21 +3747,21 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def, ...@@ -3741,21 +3747,21 @@ virNetworkDefUpdateDNSHost(virNetworkDefPtr def,
if (virNetworkDNSHostDefParseXML(def->name, ctxt->node, &host, !isAdd) < 0) if (virNetworkDNSHostDefParseXML(def->name, ctxt->node, &host, !isAdd) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < dns->nhosts; ii++) { for (i = 0; i < dns->nhosts; i++) {
bool foundThisTime = false; bool foundThisTime = false;
if (virSocketAddrEqual(&host.ip, &dns->hosts[ii].ip)) if (virSocketAddrEqual(&host.ip, &dns->hosts[i].ip))
foundThisTime = true; foundThisTime = true;
for (jj = 0; jj < host.nnames && !foundThisTime; jj++) { for (j = 0; j < host.nnames && !foundThisTime; j++) {
for (kk = 0; kk < dns->hosts[ii].nnames && !foundThisTime; kk++) { for (k = 0; k < dns->hosts[i].nnames && !foundThisTime; k++) {
if (STREQ(host.names[jj], dns->hosts[ii].names[kk])) if (STREQ(host.names[j], dns->hosts[i].names[k]))
foundThisTime = true; foundThisTime = true;
} }
} }
if (foundThisTime) { if (foundThisTime) {
foundCt++; foundCt++;
foundIdx = ii; foundIdx = i;
} }
} }
...@@ -3812,7 +3818,8 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def, ...@@ -3812,7 +3818,8 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
/* virNetworkUpdateFlags */ /* virNetworkUpdateFlags */
unsigned int fflags ATTRIBUTE_UNUSED) unsigned int fflags ATTRIBUTE_UNUSED)
{ {
int ii, foundIdx = -1, ret = -1; size_t i;
int foundIdx = -1, ret = -1;
virNetworkDNSDefPtr dns = &def->dns; virNetworkDNSDefPtr dns = &def->dns;
virNetworkDNSSrvDef srv; virNetworkDNSSrvDef srv;
bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST || bool isAdd = (command == VIR_NETWORK_UPDATE_COMMAND_ADD_FIRST ||
...@@ -3834,13 +3841,13 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def, ...@@ -3834,13 +3841,13 @@ virNetworkDefUpdateDNSSrv(virNetworkDefPtr def,
if (virNetworkDNSSrvDefParseXML(def->name, ctxt->node, ctxt, &srv, !isAdd) < 0) if (virNetworkDNSSrvDefParseXML(def->name, ctxt->node, ctxt, &srv, !isAdd) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < dns->nsrvs; ii++) { for (i = 0; i < dns->nsrvs; i++) {
if ((!srv.domain || STREQ_NULLABLE(srv.domain, dns->srvs[ii].domain)) && if ((!srv.domain || STREQ_NULLABLE(srv.domain, dns->srvs[i].domain)) &&
(!srv.service || STREQ_NULLABLE(srv.service, dns->srvs[ii].service)) && (!srv.service || STREQ_NULLABLE(srv.service, dns->srvs[i].service)) &&
(!srv.protocol || STREQ_NULLABLE(srv.protocol, dns->srvs[ii].protocol)) && (!srv.protocol || STREQ_NULLABLE(srv.protocol, dns->srvs[i].protocol)) &&
(!srv.target || STREQ_NULLABLE(srv.target, dns->srvs[ii].target))) { (!srv.target || STREQ_NULLABLE(srv.target, dns->srvs[i].target))) {
foundCt++; foundCt++;
foundIdx = ii; foundIdx = i;
} }
} }
...@@ -4237,7 +4244,7 @@ virNetworkObjListExport(virConnectPtr conn, ...@@ -4237,7 +4244,7 @@ virNetworkObjListExport(virConnectPtr conn,
virNetworkPtr net = NULL; virNetworkPtr net = NULL;
int nnets = 0; int nnets = 0;
int ret = -1; int ret = -1;
int i; size_t i;
if (nets && VIR_ALLOC_N(tmp_nets, netobjs.count + 1) < 0) if (nets && VIR_ALLOC_N(tmp_nets, netobjs.count + 1) < 0)
goto cleanup; goto cleanup;
......
...@@ -88,7 +88,7 @@ virNodeDeviceObjPtr ...@@ -88,7 +88,7 @@ virNodeDeviceObjPtr
virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs, virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
const char *sysfs_path) const char *sysfs_path)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) { for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
...@@ -106,7 +106,7 @@ virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs, ...@@ -106,7 +106,7 @@ virNodeDeviceFindBySysfsPath(const virNodeDeviceObjListPtr devs,
virNodeDeviceObjPtr virNodeDeviceFindByName(const virNodeDeviceObjListPtr devs, virNodeDeviceObjPtr virNodeDeviceFindByName(const virNodeDeviceObjListPtr devs,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) { for (i = 0; i < devs->count; i++) {
virNodeDeviceObjLock(devs->objs[i]); virNodeDeviceObjLock(devs->objs[i]);
...@@ -158,7 +158,7 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev) ...@@ -158,7 +158,7 @@ void virNodeDeviceObjFree(virNodeDeviceObjPtr dev)
void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs) void virNodeDeviceObjListFree(virNodeDeviceObjListPtr devs)
{ {
unsigned int i; size_t i;
for (i = 0; i < devs->count; i++) for (i = 0; i < devs->count; i++)
virNodeDeviceObjFree(devs->objs[i]); virNodeDeviceObjFree(devs->objs[i]);
VIR_FREE(devs->objs); VIR_FREE(devs->objs);
...@@ -203,7 +203,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs, ...@@ -203,7 +203,7 @@ virNodeDeviceObjPtr virNodeDeviceAssignDef(virNodeDeviceObjListPtr devs,
void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs, void virNodeDeviceObjRemove(virNodeDeviceObjListPtr devs,
const virNodeDeviceObjPtr dev) const virNodeDeviceObjPtr dev)
{ {
unsigned int i; size_t i;
virNodeDeviceObjUnlock(dev); virNodeDeviceObjUnlock(dev);
...@@ -232,7 +232,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def) ...@@ -232,7 +232,7 @@ char *virNodeDeviceDefFormat(const virNodeDeviceDefPtr def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virNodeDevCapsDefPtr caps; virNodeDevCapsDefPtr caps;
unsigned int i = 0; size_t i = 0;
virBufferAddLit(&buf, "<device>\n"); virBufferAddLit(&buf, "<device>\n");
virBufferEscapeString(&buf, " <name>%s</name>\n", def->name); virBufferEscapeString(&buf, " <name>%s</name>\n", def->name);
...@@ -566,7 +566,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt, ...@@ -566,7 +566,8 @@ virNodeDevCapStorageParseXML(xmlXPathContextPtr ctxt,
union _virNodeDevCapData *data) union _virNodeDevCapData *data)
{ {
xmlNodePtr orignode, *nodes = NULL; xmlNodePtr orignode, *nodes = NULL;
int i, n, ret = -1; size_t i;
int n, ret = -1;
unsigned long long val; unsigned long long val;
orignode = ctxt->node; orignode = ctxt->node;
...@@ -735,7 +736,8 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt, ...@@ -735,7 +736,8 @@ virNodeDevCapScsiHostParseXML(xmlXPathContextPtr ctxt,
const char *virt_type) const char *virt_type)
{ {
xmlNodePtr orignode, *nodes = NULL; xmlNodePtr orignode, *nodes = NULL;
int ret = -1, n = 0, i; int ret = -1, n = 0;
size_t i;
char *type = NULL; char *type = NULL;
orignode = ctxt->node; orignode = ctxt->node;
...@@ -986,7 +988,8 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt, ...@@ -986,7 +988,8 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
xmlNodePtr origNode = ctxt->node; xmlNodePtr origNode = ctxt->node;
xmlNodePtr *addrNodes = NULL; xmlNodePtr *addrNodes = NULL;
char *numberStr = NULL; char *numberStr = NULL;
int nAddrNodes, ii, ret = -1; int nAddrNodes, ret = -1;
size_t i;
virPCIDeviceAddressPtr pciAddr = NULL; virPCIDeviceAddressPtr pciAddr = NULL;
ctxt->node = iommuGroupNode; ctxt->node = iommuGroupNode;
...@@ -1008,9 +1011,9 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt, ...@@ -1008,9 +1011,9 @@ virNodeDevCapPciDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
if ((nAddrNodes = virXPathNodeSet("./address", ctxt, &addrNodes)) < 0) if ((nAddrNodes = virXPathNodeSet("./address", ctxt, &addrNodes)) < 0)
goto cleanup; goto cleanup;
for (ii = 0; ii < nAddrNodes; ii++) { for (i = 0; i < nAddrNodes; i++) {
virDevicePCIAddress addr = { 0, 0, 0, 0, 0 }; virDevicePCIAddress addr = { 0, 0, 0, 0, 0 };
if (virDevicePCIAddressParseXML(addrNodes[ii], &addr) < 0) if (virDevicePCIAddressParseXML(addrNodes[i], &addr) < 0)
goto cleanup; goto cleanup;
if (VIR_ALLOC(pciAddr) < 0) if (VIR_ALLOC(pciAddr) < 0)
goto cleanup; goto cleanup;
...@@ -1227,7 +1230,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt, ...@@ -1227,7 +1230,8 @@ virNodeDeviceDefParseXML(xmlXPathContextPtr ctxt,
virNodeDeviceDefPtr def; virNodeDeviceDefPtr def;
virNodeDevCapsDefPtr *next_cap; virNodeDevCapsDefPtr *next_cap;
xmlNodePtr *nodes; xmlNodePtr *nodes;
int n, i; int n;
size_t i;
if (VIR_ALLOC(def) < 0) if (VIR_ALLOC(def) < 0)
return NULL; return NULL;
...@@ -1436,7 +1440,7 @@ out: ...@@ -1436,7 +1440,7 @@ out:
void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps) void virNodeDevCapsDefFree(virNodeDevCapsDefPtr caps)
{ {
int i = 0; size_t i = 0;
union _virNodeDevCapData *data = &caps->data; union _virNodeDevCapData *data = &caps->data;
switch (caps->type) { switch (caps->type) {
...@@ -1593,7 +1597,7 @@ virNodeDeviceObjListExport(virConnectPtr conn, ...@@ -1593,7 +1597,7 @@ virNodeDeviceObjListExport(virConnectPtr conn,
virNodeDevicePtr device = NULL; virNodeDevicePtr device = NULL;
int ndevices = 0; int ndevices = 0;
int ret = -1; int ret = -1;
int i; size_t i;
if (devices && VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0) if (devices && VIR_ALLOC_N(tmp_devices, devobjs.count + 1) < 0)
goto cleanup; goto cleanup;
......
...@@ -225,7 +225,7 @@ static const char ipsetflags_str[] = "ipsetflags"; ...@@ -225,7 +225,7 @@ static const char ipsetflags_str[] = "ipsetflags";
static int static int
intMapGetByInt(const struct int_map *intmap, int32_t attr, const char **res) intMapGetByInt(const struct int_map *intmap, int32_t attr, const char **res)
{ {
int i = 0; size_t i = 0;
bool found = false; bool found = false;
while (intmap[i].val && !found) { while (intmap[i].val && !found) {
...@@ -255,7 +255,7 @@ static int ...@@ -255,7 +255,7 @@ static int
intMapGetByString(const struct int_map *intmap, const char *str, int casecmp, intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
int32_t *result) int32_t *result)
{ {
int i = 0; size_t i = 0;
bool found = false; bool found = false;
while (intmap[i].val && !found) { while (intmap[i].val && !found) {
...@@ -272,7 +272,7 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp, ...@@ -272,7 +272,7 @@ intMapGetByString(const struct int_map *intmap, const char *str, int casecmp,
void void
virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) { virNWFilterRuleDefFree(virNWFilterRuleDefPtr def) {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -312,7 +312,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry) { ...@@ -312,7 +312,7 @@ virNWFilterEntryFree(virNWFilterEntryPtr entry) {
void void
virNWFilterDefFree(virNWFilterDefPtr def) { virNWFilterDefFree(virNWFilterDefPtr def) {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -348,7 +348,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj) ...@@ -348,7 +348,7 @@ virNWFilterObjFree(virNWFilterObjPtr obj)
void void
virNWFilterObjListFree(virNWFilterObjListPtr nwfilters) virNWFilterObjListFree(virNWFilterObjListPtr nwfilters)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) for (i = 0; i < nwfilters->count; i++)
virNWFilterObjFree(nwfilters->objs[i]); virNWFilterObjFree(nwfilters->objs[i]);
VIR_FREE(nwfilters->objs); VIR_FREE(nwfilters->objs);
...@@ -361,7 +361,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf, ...@@ -361,7 +361,7 @@ virNWFilterRuleDefAddVar(virNWFilterRuleDefPtr nwf,
nwItemDesc *item, nwItemDesc *item,
const char *var) const char *var)
{ {
int i = 0; size_t i = 0;
virNWFilterVarAccessPtr varAccess; virNWFilterVarAccessPtr varAccess;
varAccess = virNWFilterVarAccessParse(var); varAccess = virNWFilterVarAccessParse(var);
...@@ -410,7 +410,7 @@ void ...@@ -410,7 +410,7 @@ void
virNWFilterObjRemove(virNWFilterObjListPtr nwfilters, virNWFilterObjRemove(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr nwfilter) virNWFilterObjPtr nwfilter)
{ {
unsigned int i; size_t i;
virNWFilterObjUnlock(nwfilter); virNWFilterObjUnlock(nwfilter);
...@@ -786,7 +786,7 @@ parseStringItems(const struct int_map *int_map, ...@@ -786,7 +786,7 @@ parseStringItems(const struct int_map *int_map,
const char *input, int32_t *flags, char sep) const char *input, int32_t *flags, char sep)
{ {
int rc = 0; int rc = 0;
unsigned int i, j; size_t i, j;
bool found; bool found;
i = 0; i = 0;
...@@ -818,7 +818,8 @@ static int ...@@ -818,7 +818,8 @@ static int
printStringItems(virBufferPtr buf, const struct int_map *int_map, printStringItems(virBufferPtr buf, const struct int_map *int_map,
int32_t flags, const char *sep) int32_t flags, const char *sep)
{ {
unsigned int i, c = 0; size_t i;
unsigned int c = 0;
int32_t mask = 0x1; int32_t mask = 0x1;
while (mask) { while (mask) {
...@@ -2354,7 +2355,7 @@ virNWFilterRuleParse(xmlNodePtr node) ...@@ -2354,7 +2355,7 @@ virNWFilterRuleParse(xmlNodePtr node)
while (cur != NULL) { while (cur != NULL) {
if (cur->type == XML_ELEMENT_NODE) { if (cur->type == XML_ELEMENT_NODE) {
int i = 0; size_t i = 0;
while (1) { while (1) {
if (found) if (found)
i = found_i; i = found_i;
...@@ -2667,7 +2668,7 @@ virNWFilterObjPtr ...@@ -2667,7 +2668,7 @@ virNWFilterObjPtr
virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
const unsigned char *uuid) const unsigned char *uuid)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) { for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]); virNWFilterObjLock(nwfilters->objs[i]);
...@@ -2683,7 +2684,7 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters, ...@@ -2683,7 +2684,7 @@ virNWFilterObjFindByUUID(virNWFilterObjListPtr nwfilters,
virNWFilterObjPtr virNWFilterObjPtr
virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name) virNWFilterObjFindByName(virNWFilterObjListPtr nwfilters, const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < nwfilters->count; i++) { for (i = 0; i < nwfilters->count; i++) {
virNWFilterObjLock(nwfilters->objs[i]); virNWFilterObjLock(nwfilters->objs[i]);
...@@ -2751,7 +2752,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn, ...@@ -2751,7 +2752,7 @@ _virNWFilterDefLoopDetect(virConnectPtr conn,
const char *filtername) const char *filtername)
{ {
int rc = 0; int rc = 0;
int i; size_t i;
virNWFilterEntryPtr entry; virNWFilterEntryPtr entry;
virNWFilterObjPtr obj; virNWFilterObjPtr obj;
...@@ -2818,7 +2819,7 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) ...@@ -2818,7 +2819,7 @@ virNWFilterRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
void void
virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
{ {
int i = 0; size_t i = 0;
while (i < nCallbackDriver && callbackDrvArray[i] != cbd) while (i < nCallbackDriver && callbackDrvArray[i] != cbd)
i++; i++;
...@@ -2834,7 +2835,7 @@ virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd) ...@@ -2834,7 +2835,7 @@ virNWFilterUnRegisterCallbackDriver(virNWFilterCallbackDriverPtr cbd)
void void
virNWFilterCallbackDriversLock(void) virNWFilterCallbackDriversLock(void)
{ {
int i; size_t i;
for (i = 0; i < nCallbackDriver; i++) for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverLock(); callbackDrvArray[i]->vmDriverLock();
...@@ -2843,7 +2844,7 @@ virNWFilterCallbackDriversLock(void) ...@@ -2843,7 +2844,7 @@ virNWFilterCallbackDriversLock(void)
void void
virNWFilterCallbackDriversUnlock(void) virNWFilterCallbackDriversUnlock(void)
{ {
int i; size_t i;
for (i = 0; i < nCallbackDriver; i++) for (i = 0; i < nCallbackDriver; i++)
callbackDrvArray[i]->vmDriverUnlock(); callbackDrvArray[i]->vmDriverUnlock();
...@@ -2860,7 +2861,7 @@ static virDomainObjListIterator virNWFilterDomainFWUpdateCB; ...@@ -2860,7 +2861,7 @@ static virDomainObjListIterator virNWFilterDomainFWUpdateCB;
int int
virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
{ {
int i; size_t i;
struct domUpdateCBStruct cb = { struct domUpdateCBStruct cb = {
.conn = conn, .conn = conn,
.step = STEP_APPLY_CURRENT, .step = STEP_APPLY_CURRENT,
...@@ -2878,7 +2879,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn) ...@@ -2878,7 +2879,7 @@ virNWFilterInstFiltersOnAllVMs(virConnectPtr conn)
static int static int
virNWFilterTriggerVMFilterRebuild(virConnectPtr conn) virNWFilterTriggerVMFilterRebuild(virConnectPtr conn)
{ {
int i; size_t i;
int ret = 0; int ret = 0;
struct domUpdateCBStruct cb = { struct domUpdateCBStruct cb = {
.conn = conn, .conn = conn,
...@@ -3201,7 +3202,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf, ...@@ -3201,7 +3202,7 @@ virNWFilterRuleDefDetailsFormat(virBufferPtr buf,
const virXMLAttr2Struct *att, const virXMLAttr2Struct *att,
virNWFilterRuleDefPtr def) virNWFilterRuleDefPtr def)
{ {
int i = 0, j; size_t i = 0, j;
bool typeShown = false; bool typeShown = false;
bool neverShown = true; bool neverShown = true;
bool asHex; bool asHex;
...@@ -3340,7 +3341,7 @@ err_exit: ...@@ -3340,7 +3341,7 @@ err_exit:
static char * static char *
virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def) virNWFilterRuleDefFormat(virNWFilterRuleDefPtr def)
{ {
int i; size_t i;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
virBuffer buf2 = VIR_BUFFER_INITIALIZER; virBuffer buf2 = VIR_BUFFER_INITIALIZER;
char *data; char *data;
...@@ -3427,7 +3428,7 @@ virNWFilterDefFormat(virNWFilterDefPtr def) ...@@ -3427,7 +3428,7 @@ virNWFilterDefFormat(virNWFilterDefPtr def)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
int i; size_t i;
char *xml; char *xml;
virBufferAsprintf(&buf, "<filter name='%s' chain='%s'", virBufferAsprintf(&buf, "<filter name='%s' chain='%s'",
......
...@@ -44,7 +44,7 @@ static unsigned int virNWFilterVarAccessGetIntIterId( ...@@ -44,7 +44,7 @@ static unsigned int virNWFilterVarAccessGetIntIterId(
void void
virNWFilterVarValueFree(virNWFilterVarValuePtr val) virNWFilterVarValueFree(virNWFilterVarValuePtr val)
{ {
unsigned i; size_t i;
if (!val) if (!val)
return; return;
...@@ -68,7 +68,7 @@ virNWFilterVarValuePtr ...@@ -68,7 +68,7 @@ virNWFilterVarValuePtr
virNWFilterVarValueCopy(const virNWFilterVarValuePtr val) virNWFilterVarValueCopy(const virNWFilterVarValuePtr val)
{ {
virNWFilterVarValuePtr res; virNWFilterVarValuePtr res;
unsigned i; size_t i;
char *str; char *str;
if (VIR_ALLOC(res) < 0) if (VIR_ALLOC(res) < 0)
...@@ -183,7 +183,8 @@ bool ...@@ -183,7 +183,8 @@ bool
virNWFilterVarValueEqual(const virNWFilterVarValuePtr a, virNWFilterVarValueEqual(const virNWFilterVarValuePtr a,
const virNWFilterVarValuePtr b) const virNWFilterVarValuePtr b)
{ {
unsigned int card, i, j; unsigned int card;
size_t i, j;
const char *s; const char *s;
if (!a || !b) if (!a || !b)
...@@ -277,7 +278,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos) ...@@ -277,7 +278,7 @@ virNWFilterVarValueDelNthValue(virNWFilterVarValuePtr val, unsigned int pos)
int int
virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value) virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
{ {
unsigned int i; size_t i;
switch (val->valType) { switch (val->valType) {
case NWFILTER_VALUE_TYPE_SIMPLE: case NWFILTER_VALUE_TYPE_SIMPLE:
...@@ -299,7 +300,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value) ...@@ -299,7 +300,7 @@ virNWFilterVarValueDelValue(virNWFilterVarValuePtr val, const char *value)
void void
virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterFree(virNWFilterVarCombIterPtr ci)
{ {
unsigned int i; size_t i;
if (!ci) if (!ci)
return; return;
...@@ -314,7 +315,7 @@ static int ...@@ -314,7 +315,7 @@ static int
virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetIndexByIterId(virNWFilterVarCombIterPtr ci,
unsigned int iterId) unsigned int iterId)
{ {
unsigned int i; size_t i;
for (i = 0; i < ci->nIter; i++) for (i = 0; i < ci->nIter; i++)
if (ci->iter[i].iterId == iterId) if (ci->iter[i].iterId == iterId)
...@@ -402,7 +403,7 @@ static bool ...@@ -402,7 +403,7 @@ static bool
virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie, virNWFilterVarCombIterEntryAreUniqueEntries(virNWFilterVarCombIterEntryPtr cie,
virNWFilterHashTablePtr hash) virNWFilterHashTablePtr hash)
{ {
unsigned int i, j; size_t i, j;
virNWFilterVarValuePtr varValue, tmp; virNWFilterVarValuePtr varValue, tmp;
const char *value; const char *value;
...@@ -463,7 +464,8 @@ virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash, ...@@ -463,7 +464,8 @@ virNWFilterVarCombIterCreate(virNWFilterHashTablePtr hash,
size_t nVarAccess) size_t nVarAccess)
{ {
virNWFilterVarCombIterPtr res; virNWFilterVarCombIterPtr res;
unsigned int i, iterId; size_t i;
unsigned int iterId;
int iterIndex = -1; int iterIndex = -1;
unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1; unsigned int nextIntIterId = VIR_NWFILTER_MAX_ITERID + 1;
...@@ -516,7 +518,7 @@ err_exit: ...@@ -516,7 +518,7 @@ err_exit:
virNWFilterVarCombIterPtr virNWFilterVarCombIterPtr
virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci) virNWFilterVarCombIterNext(virNWFilterVarCombIterPtr ci)
{ {
unsigned int i; size_t i;
for (i = 0; i < ci->nIter; i++) { for (i = 0; i < ci->nIter; i++) {
next: next:
...@@ -543,7 +545,8 @@ const char * ...@@ -543,7 +545,8 @@ const char *
virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci, virNWFilterVarCombIterGetVarValue(virNWFilterVarCombIterPtr ci,
const virNWFilterVarAccessPtr vap) const virNWFilterVarAccessPtr vap)
{ {
unsigned int i, iterId; size_t i;
unsigned int iterId;
bool found = false; bool found = false;
const char *res = NULL; const char *res = NULL;
virNWFilterVarValuePtr value; virNWFilterVarValuePtr value;
...@@ -675,7 +678,7 @@ virNWFilterHashTablePut(virNWFilterHashTablePtr table, ...@@ -675,7 +678,7 @@ virNWFilterHashTablePut(virNWFilterHashTablePtr table,
void void
virNWFilterHashTableFree(virNWFilterHashTablePtr table) virNWFilterHashTableFree(virNWFilterHashTablePtr table)
{ {
int i; size_t i;
if (!table) if (!table)
return; return;
virHashFree(table->hashTable); virHashFree(table->hashTable);
...@@ -706,7 +709,7 @@ void * ...@@ -706,7 +709,7 @@ void *
virNWFilterHashTableRemoveEntry(virNWFilterHashTablePtr ht, virNWFilterHashTableRemoveEntry(virNWFilterHashTablePtr ht,
const char *entry) const char *entry)
{ {
int i; size_t i;
void *value = virHashSteal(ht->hashTable, entry); void *value = virHashSteal(ht->hashTable, entry);
if (value) { if (value) {
...@@ -886,7 +889,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf, ...@@ -886,7 +889,8 @@ virNWFilterFormatParamAttributes(virBufferPtr buf,
const char *filterref) const char *filterref)
{ {
virHashKeyValuePairPtr items; virHashKeyValuePairPtr items;
int i, j, card, numKeys; size_t i, j;
int card, numKeys;
numKeys = virHashSize(table->hashTable); numKeys = virHashSize(table->hashTable);
......
...@@ -86,7 +86,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk) ...@@ -86,7 +86,7 @@ virDomainSnapshotDiskDefClear(virDomainSnapshotDiskDefPtr disk)
void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def) void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def)
{ {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -178,7 +178,8 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -178,7 +178,8 @@ virDomainSnapshotDefParseString(const char *xmlStr,
virDomainSnapshotDefPtr def = NULL; virDomainSnapshotDefPtr def = NULL;
virDomainSnapshotDefPtr ret = NULL; virDomainSnapshotDefPtr ret = NULL;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i; size_t i;
int n;
char *creation = NULL, *state = NULL; char *creation = NULL, *state = NULL;
struct timeval tv; struct timeval tv;
int active; int active;
...@@ -313,10 +314,10 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -313,10 +314,10 @@ virDomainSnapshotDefParseString(const char *xmlStr,
def->file = memoryFile; def->file = memoryFile;
memoryFile = NULL; memoryFile = NULL;
if ((i = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0) if ((n = virXPathNodeSet("./disks/*", ctxt, &nodes)) < 0)
goto cleanup; goto cleanup;
if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) { if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_DISKS) {
def->ndisks = i; def->ndisks = n;
if (def->ndisks && VIR_ALLOC_N(def->disks, def->ndisks) < 0) if (def->ndisks && VIR_ALLOC_N(def->disks, def->ndisks) < 0)
goto cleanup; goto cleanup;
for (i = 0; i < def->ndisks; i++) { for (i = 0; i < def->ndisks; i++) {
...@@ -324,7 +325,7 @@ virDomainSnapshotDefParseString(const char *xmlStr, ...@@ -324,7 +325,7 @@ virDomainSnapshotDefParseString(const char *xmlStr,
goto cleanup; goto cleanup;
} }
VIR_FREE(nodes); VIR_FREE(nodes);
} else if (i) { } else if (n) {
virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s", virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
_("unable to handle disk requests in snapshot")); _("unable to handle disk requests in snapshot"));
goto cleanup; goto cleanup;
...@@ -379,7 +380,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, ...@@ -379,7 +380,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def,
{ {
int ret = -1; int ret = -1;
virBitmapPtr map = NULL; virBitmapPtr map = NULL;
int i; size_t i;
int ndisks; int ndisks;
bool inuse; bool inuse;
...@@ -568,7 +569,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid, ...@@ -568,7 +569,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uuid,
int internal) int internal)
{ {
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
int i; size_t i;
virCheckFlags(VIR_DOMAIN_XML_SECURE | virCheckFlags(VIR_DOMAIN_XML_SECURE |
VIR_DOMAIN_XML_UPDATE_CPU, NULL); VIR_DOMAIN_XML_UPDATE_CPU, NULL);
...@@ -767,7 +768,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots, ...@@ -767,7 +768,7 @@ virDomainSnapshotObjListGetNames(virDomainSnapshotObjListPtr snapshots,
{ {
struct virDomainSnapshotNameData data = { names, maxnames, flags, 0, struct virDomainSnapshotNameData data = { names, maxnames, flags, 0,
false }; false };
int i; size_t i;
if (!from) { if (!from) {
/* LIST_ROOTS and LIST_DESCENDANTS have the same bit value, /* LIST_ROOTS and LIST_DESCENDANTS have the same bit value,
...@@ -1009,7 +1010,7 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots, ...@@ -1009,7 +1010,7 @@ virDomainListSnapshots(virDomainSnapshotObjListPtr snapshots,
virDomainSnapshotPtr *list = NULL; virDomainSnapshotPtr *list = NULL;
char **names; char **names;
int ret = -1; int ret = -1;
int i; size_t i;
if (!snaps || count < 0) if (!snaps || count < 0)
return count; return count;
...@@ -1043,7 +1044,7 @@ cleanup: ...@@ -1043,7 +1044,7 @@ cleanup:
bool bool
virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def) virDomainSnapshotDefIsExternal(virDomainSnapshotDefPtr def)
{ {
int i; size_t i;
if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) if (def->memory == VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)
return true; return true;
......
...@@ -264,7 +264,7 @@ static virStoragePoolTypeInfo poolTypeInfo[] = { ...@@ -264,7 +264,7 @@ static virStoragePoolTypeInfo poolTypeInfo[] = {
static virStoragePoolTypeInfoPtr static virStoragePoolTypeInfoPtr
virStoragePoolTypeInfoLookup(int type) virStoragePoolTypeInfoLookup(int type)
{ {
unsigned int i; size_t i;
for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++) for (i = 0; i < ARRAY_CARDINALITY(poolTypeInfo); i++)
if (poolTypeInfo[i].poolType == type) if (poolTypeInfo[i].poolType == type)
return &poolTypeInfo[i]; return &poolTypeInfo[i];
...@@ -296,7 +296,7 @@ virStorageVolOptionsForPoolType(int type) ...@@ -296,7 +296,7 @@ virStorageVolOptionsForPoolType(int type)
void void
virStorageVolDefFree(virStorageVolDefPtr def) virStorageVolDefFree(virStorageVolDefPtr def)
{ {
int i; size_t i;
if (!def) if (!def)
return; return;
...@@ -338,7 +338,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter) ...@@ -338,7 +338,7 @@ virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
void void
virStoragePoolSourceClear(virStoragePoolSourcePtr source) virStoragePoolSourceClear(virStoragePoolSourcePtr source)
{ {
int i; size_t i;
if (!source) if (!source)
return; return;
...@@ -416,7 +416,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj) ...@@ -416,7 +416,7 @@ virStoragePoolObjFree(virStoragePoolObjPtr obj)
void void
virStoragePoolObjListFree(virStoragePoolObjListPtr pools) virStoragePoolObjListFree(virStoragePoolObjListPtr pools)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) for (i = 0; i < pools->count; i++)
virStoragePoolObjFree(pools->objs[i]); virStoragePoolObjFree(pools->objs[i]);
VIR_FREE(pools->objs); VIR_FREE(pools->objs);
...@@ -427,7 +427,7 @@ void ...@@ -427,7 +427,7 @@ void
virStoragePoolObjRemove(virStoragePoolObjListPtr pools, virStoragePoolObjRemove(virStoragePoolObjListPtr pools,
virStoragePoolObjPtr pool) virStoragePoolObjPtr pool)
{ {
unsigned int i; size_t i;
virStoragePoolObjUnlock(pool); virStoragePoolObjUnlock(pool);
...@@ -527,7 +527,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, ...@@ -527,7 +527,8 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt,
int ret = -1; int ret = -1;
xmlNodePtr relnode, *nodeset = NULL; xmlNodePtr relnode, *nodeset = NULL;
char *authType = NULL; char *authType = NULL;
int nsource, i; int nsource;
size_t i;
virStoragePoolOptionsPtr options; virStoragePoolOptionsPtr options;
char *name = NULL; char *name = NULL;
char *port = NULL; char *port = NULL;
...@@ -1039,7 +1040,7 @@ virStoragePoolSourceFormat(virBufferPtr buf, ...@@ -1039,7 +1040,7 @@ virStoragePoolSourceFormat(virBufferPtr buf,
virStoragePoolOptionsPtr options, virStoragePoolOptionsPtr options,
virStoragePoolSourcePtr src) virStoragePoolSourcePtr src)
{ {
int i, j; size_t i, j;
char uuid[VIR_UUID_STRING_BUFLEN]; char uuid[VIR_UUID_STRING_BUFLEN];
virBufferAddLit(buf," <source>\n"); virBufferAddLit(buf," <source>\n");
...@@ -1254,7 +1255,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, ...@@ -1254,7 +1255,8 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool,
char *unit = NULL; char *unit = NULL;
xmlNodePtr node; xmlNodePtr node;
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
int i, n; size_t i;
int n;
options = virStorageVolOptionsForPoolType(pool->type); options = virStorageVolOptionsForPoolType(pool->type);
if (options == NULL) if (options == NULL)
...@@ -1524,7 +1526,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options, ...@@ -1524,7 +1526,7 @@ virStorageVolTargetDefFormat(virStorageVolOptionsPtr options,
virBufferEscapeString(buf, " <compat>%s</compat>\n", def->compat); virBufferEscapeString(buf, " <compat>%s</compat>\n", def->compat);
if (options->featureToString && def->features) { if (options->featureToString && def->features) {
int i; size_t i;
bool b; bool b;
bool empty = virBitmapIsAllClear(def->features); bool empty = virBitmapIsAllClear(def->features);
...@@ -1565,7 +1567,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool, ...@@ -1565,7 +1567,7 @@ virStorageVolDefFormat(virStoragePoolDefPtr pool,
virBufferAddLit(&buf, " <source>\n"); virBufferAddLit(&buf, " <source>\n");
if (def->source.nextent) { if (def->source.nextent) {
int i; size_t i;
const char *thispath = NULL; const char *thispath = NULL;
for (i = 0; i < def->source.nextent; i++) { for (i = 0; i < def->source.nextent; i++) {
if (thispath == NULL || if (thispath == NULL ||
...@@ -1621,7 +1623,7 @@ virStoragePoolObjPtr ...@@ -1621,7 +1623,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools, virStoragePoolObjFindByUUID(virStoragePoolObjListPtr pools,
const unsigned char *uuid) const unsigned char *uuid)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) { for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]); virStoragePoolObjLock(pools->objs[i]);
...@@ -1637,7 +1639,7 @@ virStoragePoolObjPtr ...@@ -1637,7 +1639,7 @@ virStoragePoolObjPtr
virStoragePoolObjFindByName(virStoragePoolObjListPtr pools, virStoragePoolObjFindByName(virStoragePoolObjListPtr pools,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < pools->count; i++) { for (i = 0; i < pools->count; i++) {
virStoragePoolObjLock(pools->objs[i]); virStoragePoolObjLock(pools->objs[i]);
...@@ -1653,7 +1655,7 @@ virStoragePoolObjPtr ...@@ -1653,7 +1655,7 @@ virStoragePoolObjPtr
virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool, virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
virStoragePoolDefPtr def) virStoragePoolDefPtr def)
{ {
unsigned int i, j; size_t i, j;
for (i = 0; i < pool->def->source.ndevice; i++) { for (i = 0; i < pool->def->source.ndevice; i++) {
for (j = 0; j < def->source.ndevice; j++) { for (j = 0; j < def->source.ndevice; j++) {
...@@ -1668,7 +1670,7 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool, ...@@ -1668,7 +1670,7 @@ virStoragePoolSourceFindDuplicateDevices(virStoragePoolObjPtr pool,
void void
virStoragePoolObjClearVols(virStoragePoolObjPtr pool) virStoragePoolObjClearVols(virStoragePoolObjPtr pool)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
virStorageVolDefFree(pool->volumes.objs[i]); virStorageVolDefFree(pool->volumes.objs[i]);
...@@ -1680,7 +1682,7 @@ virStorageVolDefPtr ...@@ -1680,7 +1682,7 @@ virStorageVolDefPtr
virStorageVolDefFindByKey(virStoragePoolObjPtr pool, virStorageVolDefFindByKey(virStoragePoolObjPtr pool,
const char *key) const char *key)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->key, key)) if (STREQ(pool->volumes.objs[i]->key, key))
...@@ -1693,7 +1695,7 @@ virStorageVolDefPtr ...@@ -1693,7 +1695,7 @@ virStorageVolDefPtr
virStorageVolDefFindByPath(virStoragePoolObjPtr pool, virStorageVolDefFindByPath(virStoragePoolObjPtr pool,
const char *path) const char *path)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->target.path, path)) if (STREQ(pool->volumes.objs[i]->target.path, path))
...@@ -1706,7 +1708,7 @@ virStorageVolDefPtr ...@@ -1706,7 +1708,7 @@ virStorageVolDefPtr
virStorageVolDefFindByName(virStoragePoolObjPtr pool, virStorageVolDefFindByName(virStoragePoolObjPtr pool,
const char *name) const char *name)
{ {
unsigned int i; size_t i;
for (i = 0; i < pool->volumes.count; i++) for (i = 0; i < pool->volumes.count; i++)
if (STREQ(pool->volumes.objs[i]->name, name)) if (STREQ(pool->volumes.objs[i]->name, name))
...@@ -1934,7 +1936,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def) ...@@ -1934,7 +1936,7 @@ virStoragePoolSourceListFormat(virStoragePoolSourceListPtr def)
virStoragePoolOptionsPtr options; virStoragePoolOptionsPtr options;
virBuffer buf = VIR_BUFFER_INITIALIZER; virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *type; const char *type;
int i; size_t i;
options = virStoragePoolOptionsForPoolType(def->type); options = virStoragePoolOptionsForPoolType(def->type);
if (options == NULL) if (options == NULL)
...@@ -2034,7 +2036,7 @@ int ...@@ -2034,7 +2036,7 @@ int
virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools, virStoragePoolSourceFindDuplicate(virStoragePoolObjListPtr pools,
virStoragePoolDefPtr def) virStoragePoolDefPtr def)
{ {
int i; size_t i;
int ret = 1; int ret = 1;
virStoragePoolObjPtr pool = NULL; virStoragePoolObjPtr pool = NULL;
virStoragePoolObjPtr matchpool = NULL; virStoragePoolObjPtr matchpool = NULL;
...@@ -2197,7 +2199,7 @@ virStoragePoolObjListExport(virConnectPtr conn, ...@@ -2197,7 +2199,7 @@ virStoragePoolObjListExport(virConnectPtr conn,
virStoragePoolPtr pool = NULL; virStoragePoolPtr pool = NULL;
int npools = 0; int npools = 0;
int ret = -1; int ret = -1;
int i; size_t i;
if (pools && VIR_ALLOC_N(tmp_pools, poolobjs.count + 1) < 0) if (pools && VIR_ALLOC_N(tmp_pools, poolobjs.count + 1) < 0)
goto cleanup; goto cleanup;
......
...@@ -130,7 +130,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt) ...@@ -130,7 +130,8 @@ virStorageEncryptionParseXML(xmlXPathContextPtr ctxt)
xmlNodePtr *nodes = NULL; xmlNodePtr *nodes = NULL;
virStorageEncryptionPtr ret; virStorageEncryptionPtr ret;
char *format_str; char *format_str;
int format, i, n; int format, n;
size_t i;
if (VIR_ALLOC(ret) < 0) if (VIR_ALLOC(ret) < 0)
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册