diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index de2d82cbbc..8f417715a9 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -1471,7 +1471,7 @@ elsif ($mode eq "client") { } if ($single_ret_as_list) { - print " int i;\n"; + print " size_t i;\n"; } if ($call->{streamflag} ne "none") { @@ -1590,8 +1590,9 @@ elsif ($mode eq "client") { print " for (i = 0; i < ret.$single_ret_list_name.${single_ret_list_name}_len; ++i) {\n"; print " if (VIR_STRDUP(${single_ret_list_name}[i],\n"; print " ret.$single_ret_list_name.${single_ret_list_name}_val[i]) < 0) {\n"; - print " for (--i; i >= 0; --i)\n"; - print " VIR_FREE(${single_ret_list_name}[i]);\n"; + print " size_t j;\n"; + print " for (j = 0; j < i; j++)\n"; + print " VIR_FREE(${single_ret_list_name}[j]);\n"; print "\n"; print " goto cleanup;\n"; print " }\n"; diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c index bc282f820b..fb5c108370 100644 --- a/src/rpc/virnetclient.c +++ b/src/rpc/virnetclient.c @@ -592,7 +592,7 @@ bool virNetClientHasPassFD(virNetClientPtr client) void virNetClientDispose(void *obj) { virNetClientPtr client = obj; - int i; + size_t i; PROBE(RPC_CLIENT_DISPOSE, "client=%p", client); diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c index 1c4e4ba7a9..cbd628a66b 100644 --- a/src/rpc/virnetclientprogram.c +++ b/src/rpc/virnetclientprogram.c @@ -195,7 +195,7 @@ cleanup: static virNetClientProgramEventPtr virNetClientProgramGetEvent(virNetClientProgramPtr prog, int procedure) { - int i; + size_t i; for (i = 0; i < prog->nevents; i++) { if (prog->events[i].proc == procedure) diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c index c8b0ba4950..cb770c3bf3 100644 --- a/src/rpc/virnetserver.c +++ b/src/rpc/virnetserver.c @@ -852,7 +852,7 @@ virNetServerSignalEvent(int watch, void *opaque) { virNetServerPtr srv = opaque; siginfo_t siginfo; - int i; + size_t i; virObjectLock(srv); @@ -1037,7 +1037,7 @@ static void virNetServerAutoShutdownTimer(int timerid ATTRIBUTE_UNUSED, void virNetServerUpdateServices(virNetServerPtr srv, bool enabled) { - int i; + size_t i; virObjectLock(srv); for (i = 0; i < srv->nservices; i++) @@ -1051,7 +1051,7 @@ void virNetServerRun(virNetServerPtr srv) { int timerid = -1; bool timerActive = false; - int i; + size_t i; virObjectLock(srv); @@ -1147,7 +1147,7 @@ void virNetServerQuit(virNetServerPtr srv) void virNetServerDispose(void *obj) { virNetServerPtr srv = obj; - int i; + size_t i; VIR_FORCE_CLOSE(srv->autoShutdownInhibitFd); @@ -1186,7 +1186,7 @@ void virNetServerDispose(void *obj) void virNetServerClose(virNetServerPtr srv) { - int i; + size_t i; if (!srv) return; diff --git a/src/rpc/virnetserverservice.c b/src/rpc/virnetserverservice.c index 53f78ab477..632f03d39f 100644 --- a/src/rpc/virnetserverservice.c +++ b/src/rpc/virnetserverservice.c @@ -158,7 +158,7 @@ virNetServerServicePtr virNetServerServiceNewUNIX(const char *path, size_t nrequests_client_max) { virNetServerServicePtr svc; - int i; + size_t i; if (virNetServerServiceInitialize() < 0) return NULL; @@ -218,7 +218,7 @@ virNetServerServicePtr virNetServerServiceNewFD(int fd, size_t nrequests_client_max) { virNetServerServicePtr svc; - int i; + size_t i; if (virNetServerServiceInitialize() < 0) return NULL; @@ -429,7 +429,7 @@ void virNetServerServiceSetDispatcher(virNetServerServicePtr svc, void virNetServerServiceDispose(void *obj) { virNetServerServicePtr svc = obj; - int i; + size_t i; for (i = 0; i < svc->nsocks; i++) virObjectUnref(svc->socks[i]); @@ -443,7 +443,7 @@ void virNetServerServiceDispose(void *obj) void virNetServerServiceToggle(virNetServerServicePtr svc, bool enabled) { - int i; + size_t i; for (i = 0; i < svc->nsocks; i++) virNetSocketUpdateIOCallback(svc->socks[i], @@ -454,7 +454,7 @@ void virNetServerServiceToggle(virNetServerServicePtr svc, void virNetServerServiceClose(virNetServerServicePtr svc) { - int i; + size_t i; if (!svc) return; diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 45dd8b4483..1bfd87bf85 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -223,7 +223,7 @@ int virNetSocketNewListenTCP(const char *nodename, struct addrinfo *ai = NULL; struct addrinfo hints; int fd = -1; - int i; + size_t i; int addrInUse = false; *retsocks = NULL; diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c index 77b5c88bf4..211b7d75e8 100644 --- a/src/rpc/virnetsshsession.c +++ b/src/rpc/virnetsshsession.c @@ -114,7 +114,7 @@ struct _virNetSSHSession { static void virNetSSHSessionAuthMethodsFree(virNetSSHSessionPtr sess) { - int i; + size_t i; for (i = 0; i < sess->nauths; i++) { VIR_FREE(sess->auths[i]->username); @@ -205,7 +205,7 @@ virNetSSHKbIntCb(const char *name ATTRIBUTE_UNUSED, { virNetSSHSessionPtr priv = *opaque; virConnectCredentialPtr askcred = NULL; - int i; + size_t i; int credtype_echo = -1; int credtype_noecho = -1; char *tmp; @@ -294,7 +294,7 @@ virNetSSHCheckHostKey(virNetSSHSessionPtr sess) virBuffer buff = VIR_BUFFER_INITIALIZER; virConnectCredential askKey; struct libssh2_knownhost *knownHostEntry = NULL; - int i; + size_t i; char *hostnameStr = NULL; if (sess->hostKeyVerify == VIR_NET_SSH_HOSTKEY_VERIFY_IGNORE) @@ -584,7 +584,7 @@ virNetSSHAuthenticatePrivkey(virNetSSHSessionPtr sess, virNetSSHAuthMethodPtr priv) { virConnectCredential retr_passphrase; - int i; + size_t i; char *errmsg; int ret; @@ -780,7 +780,7 @@ virNetSSHAuthenticate(virNetSSHSessionPtr sess) bool auth_failed = false; char *auth_list; char *errmsg; - int i; + size_t i; int ret; if (!sess->nauths) { diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c index 482c86094e..af0ec21454 100644 --- a/src/rpc/virnettlscontext.c +++ b/src/rpc/virnettlscontext.c @@ -287,7 +287,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, bool isServer) { int status; - int i; + size_t i; unsigned int purposeCritical; unsigned int critical; char *buffer = NULL; @@ -300,7 +300,7 @@ static int virNetTLSContextCheckCertKeyPurpose(gnutls_x509_crt_t cert, status = gnutls_x509_crt_get_key_purpose_oid(cert, i, buffer, &size, NULL); if (status == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) { - VIR_DEBUG("No key purpose data available at slot %d", i); + VIR_DEBUG("No key purpose data available at slot %zu", i); /* If there is no data at all, then we must allow client/server to pass */ if (i == 0) @@ -950,7 +950,8 @@ static int virNetTLSContextValidCertificate(virNetTLSContextPtr ctxt, int ret; unsigned int status; const gnutls_datum_t *certs; - unsigned int nCerts, i; + unsigned int nCerts; + size_t i; char dname[256]; char *dnameptr = dname; size_t dnamesize = sizeof(dname);