examples: Resolve sign-compare warnings

For instance:

hellolibvirt/hellolibvirt.c: In function 'showDomains':
hellolibvirt/hellolibvirt.c💯19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < numNames; i++) {
                   ^

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2016-12-20 10:29:52 +01:00
parent 86fd4e305e
commit 3b67fc9f9f
9 changed files with 9 additions and 9 deletions

View File

@ -102,7 +102,7 @@ int main(int argc, char **argv)
virAdmClientPtr clnt = NULL; /* which client get identity for */ virAdmClientPtr clnt = NULL; /* which client get identity for */
virTypedParameterPtr params = NULL; /* where to store identity info */ virTypedParameterPtr params = NULL; /* where to store identity info */
int nparams = 0; int nparams = 0;
size_t i = 0; ssize_t i = 0;
char *timestr = NULL; char *timestr = NULL;
if (argc != 3) { if (argc != 3) {

View File

@ -9,7 +9,7 @@ int main(int argc, char **argv)
virAdmServerPtr srv = NULL; /* which server to work with */ virAdmServerPtr srv = NULL; /* which server to work with */
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
size_t i; ssize_t i;
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "One argument specifying the server which to work " fprintf(stderr, "One argument specifying the server which to work "

View File

@ -50,7 +50,7 @@ int main(int argc, char **argv)
virAdmConnectPtr conn = NULL; virAdmConnectPtr conn = NULL;
virAdmServerPtr srv = NULL; /* which server list the clients from */ virAdmServerPtr srv = NULL; /* which server list the clients from */
virAdmClientPtr *clients = NULL; /* where to store the servers */ virAdmClientPtr *clients = NULL; /* where to store the servers */
size_t i = 0; ssize_t i = 0;
int count = 0; int count = 0;
if (argc != 2) { if (argc != 2) {

View File

@ -8,7 +8,7 @@ int main(void)
virAdmConnectPtr conn = NULL; virAdmConnectPtr conn = NULL;
virAdmServerPtr *servers = NULL; /* where to store the servers */ virAdmServerPtr *servers = NULL; /* where to store the servers */
virAdmServerPtr *tmp = NULL; virAdmServerPtr *tmp = NULL;
size_t i = 0; ssize_t i = 0;
int count = 0; int count = 0;
/* first, open a connection to the daemon */ /* first, open a connection to the daemon */

View File

@ -9,7 +9,7 @@ int main(int argc, char **argv)
virAdmServerPtr srv = NULL; /* which server to work with */ virAdmServerPtr srv = NULL; /* which server to work with */
virTypedParameterPtr params = NULL; virTypedParameterPtr params = NULL;
int nparams = 0; int nparams = 0;
size_t i; ssize_t i;
if (argc != 2) { if (argc != 2) {
fprintf(stderr, "One argument specifying the server which to work " fprintf(stderr, "One argument specifying the server which to work "

View File

@ -156,7 +156,7 @@ fetch_domains(virConnectPtr conn)
{ {
int num_domains, ret = -1; int num_domains, ret = -1;
virDomainPtr *domains = NULL; virDomainPtr *domains = NULL;
size_t i; ssize_t i;
const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE; const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
DEBUG("Fetching list of running domains"); DEBUG("Fetching list of running domains");

View File

@ -161,7 +161,7 @@ fetch_domains(virConnectPtr conn)
{ {
int num_domains, ret = -1; int num_domains, ret = -1;
virDomainPtr *domains = NULL; virDomainPtr *domains = NULL;
size_t i; ssize_t i;
const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE; const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
DEBUG("Fetching list of running domains"); DEBUG("Fetching list of running domains");

View File

@ -55,7 +55,7 @@ static int
showDomains(virConnectPtr conn) showDomains(virConnectPtr conn)
{ {
int ret = 0, numNames, numInactiveDomains, numActiveDomains; int ret = 0, numNames, numInactiveDomains, numActiveDomains;
size_t i; ssize_t i;
int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE | int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE |
VIR_CONNECT_LIST_DOMAINS_INACTIVE; VIR_CONNECT_LIST_DOMAINS_INACTIVE;
virDomainPtr *nameList = NULL; virDomainPtr *nameList = NULL;

View File

@ -91,7 +91,7 @@ static int
showDomains(virConnectPtr conn) showDomains(virConnectPtr conn)
{ {
int ret = 0, numNames, numInactiveDomains, numActiveDomains; int ret = 0, numNames, numInactiveDomains, numActiveDomains;
size_t i; ssize_t i;
char **nameList = NULL; char **nameList = NULL;
numActiveDomains = virConnectNumOfDomains(conn); numActiveDomains = virConnectNumOfDomains(conn);