When python3 builds C modules, it adds the -Wsign-compare flag to GCC.
This creates lots of warnings where we compare a 'size_t' value against
an 'int' value due to signed/unsigned difference. Change all the size_t
types to ssize_t to address this.
Signed-off-by: Daniel P. Berrange
---
libvirt-lxc-override.c | 2 +-
libvirt-override.c | 108 -
libvirt-utils.c| 8 ++--
typewrappers.c | 2 +-
4 files changed, 60 insertions(+), 60 deletions(-)
diff --git a/libvirt-lxc-override.c b/libvirt-lxc-override.c
index 316a500..60c2e48 100644
--- a/libvirt-lxc-override.c
+++ b/libvirt-lxc-override.c
@@ -63,7 +63,7 @@ libvirt_lxc_virDomainLxcOpenNamespace(PyObject *self
ATTRIBUTE_UNUSED,
unsigned int flags;
int c_retval;
int *fdlist = NULL;
-size_t i;
+ssize_t i;
if (!PyArg_ParseTuple(args, (char *)"OI:virDomainLxcOpenNamespace",
&pyobj_domain, &flags))
diff --git a/libvirt-override.c b/libvirt-override.c
index 9eba4ed..bde7f4b 100644
--- a/libvirt-override.c
+++ b/libvirt-override.c
@@ -187,7 +187,7 @@ libvirt_virDomainGetCPUStats(PyObject *self
ATTRIBUTE_UNUSED,
PyObject *error = NULL;
int ncpus = -1, start_cpu = 0;
int sumparams = 0, nparams = -1;
-size_t i;
+ssize_t i;
int i_retval;
unsigned int flags;
bool totalflag;
@@ -354,7 +354,7 @@ libvirt_virDomainMemoryStats(PyObject *self
ATTRIBUTE_UNUSED,
virDomainPtr domain;
PyObject *pyobj_domain;
unsigned int nr_stats;
-size_t i;
+ssize_t i;
virDomainMemoryStatStruct stats[VIR_DOMAIN_MEMORY_STAT_NR];
PyObject *info;
PyObject *key = NULL, *val = NULL;
@@ -365,7 +365,7 @@ libvirt_virDomainMemoryStats(PyObject *self
ATTRIBUTE_UNUSED,
nr_stats = virDomainMemoryStats(domain, stats,
VIR_DOMAIN_MEMORY_STAT_NR, 0);
-if (nr_stats == -1)
+if (nr_stats == (unsigned int)-1)
return VIR_PY_NONE;
/* convert to a Python dictionary */
@@ -1204,7 +1204,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
virDomainInfo dominfo;
virVcpuInfoPtr cpuinfo = NULL;
unsigned char *cpumap = NULL;
-size_t cpumaplen, i;
+ssize_t cpumaplen, i;
int i_retval, cpunum;
if (!PyArg_ParseTuple(args, (char *)"O:virDomainGetVcpus",
@@ -1274,7 +1274,7 @@ libvirt_virDomainGetVcpus(PyObject *self ATTRIBUTE_UNUSED,
}
for (i = 0; i < dominfo.nrVirtCpu; i++) {
PyObject *info = PyTuple_New(cpunum);
-size_t j;
+ssize_t j;
if (info == NULL)
goto cleanup;
@@ -1384,7 +1384,7 @@ libvirt_virDomainGetVcpuPinInfo(PyObject *self
ATTRIBUTE_UNUSED,
PyObject *pyobj_domain, *pycpumaps = NULL, *error = NULL;
virDomainInfo dominfo;
unsigned char *cpumaps = NULL;
-size_t cpumaplen, vcpu, pcpu;
+ssize_t cpumaplen, vcpu, pcpu;
unsigned int flags;
int i_retval, cpunum;
@@ -1496,8 +1496,8 @@ libvirt_virDomainGetEmulatorPinInfo(PyObject *self
ATTRIBUTE_UNUSED,
PyObject *pyobj_domain;
PyObject *pycpumap;
unsigned char *cpumap;
-size_t cpumaplen;
-size_t pcpu;
+ssize_t cpumaplen;
+ssize_t pcpu;
unsigned int flags;
int ret;
int cpunum;
@@ -1560,7 +1560,7 @@ libvirt_virDomainGetIOThreadInfo(PyObject *self
ATTRIBUTE_UNUSED,
PyObject *py_iothrinfo = NULL;
virDomainIOThreadInfoPtr *iothrinfo = NULL;
unsigned int flags;
-size_t pcpu, i;
+ssize_t pcpu, i;
int niothreads, cpunum;
if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetIOThreadInfo",
@@ -1846,7 +1846,7 @@ virConnectCredCallbackWrapper(virConnectCredentialPtr
cred,
PyObject *pycb;
PyObject *pyret = NULL;
int ret = -1;
-size_t i;
+ssize_t i;
LIBVIRT_ENSURE_THREAD_STATE;
@@ -1953,7 +1953,7 @@ libvirt_virConnectOpenAuth(PyObject *self
ATTRIBUTE_UNUSED,
auth.ncredtype = PyList_Size(pycredtype);
if (auth.ncredtype) {
-size_t i;
+ssize_t i;
if (VIR_ALLOC_N(auth.credtype, auth.ncredtype) < 0)
return PyErr_NoMemory();
for (i = 0; i < auth.ncredtype; i++) {
@@ -2046,7 +2046,7 @@ libvirt_virConnectGetCPUModelNames(PyObject *self
ATTRIBUTE_UNUSED,
virConnectPtr conn;
PyObject *rv = NULL, *pyobj_conn;
char **models = NULL;
-size_t i;
+ssize_t i;
unsigned int flags = 0;
const char *arch = NULL;
@@ -2117,7 +2117,7 @@ libvirt_virConnectListDomainsID(PyObject *self
ATTRIBUTE_UNUSED,
{
PyObject *py_retval;
int *ids = NULL, c_retval;
-size_t i;
+ssize_t i;
virConnectPtr conn;
PyObject *pyobj_conn;
@@ -2172,7 +2172,7 @@ libvirt_virConnectListAllDomains(PyObject *self
ATTRIBUTE_UNUSED,
virConnectPtr conn;
virDomainPtr *doms = NULL;
int c_retval = 0;
-size_t i;
+ssize_t i;
unsigned int flags;
if (!PyArg_ParseTuple(