[PATCH] examples: Resolve sign-compare warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For instance:

hellolibvirt/hellolibvirt.c: In function 'showDomains':
hellolibvirt/hellolibvirt.c:100:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < numNames; i++) {
                   ^
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 examples/admin/client_info.c         | 2 +-
 examples/admin/client_limits.c       | 2 +-
 examples/admin/list_clients.c        | 2 +-
 examples/admin/list_servers.c        | 2 +-
 examples/admin/threadpool_params.c   | 2 +-
 examples/domsuspend/suspend.c        | 2 +-
 examples/domtop/domtop.c             | 7 +++----
 examples/hellolibvirt/hellolibvirt.c | 2 +-
 examples/openauth/openauth.c         | 2 +-
 9 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/examples/admin/client_info.c b/examples/admin/client_info.c
index 314a0902b..57e9cd71e 100644
--- a/examples/admin/client_info.c
+++ b/examples/admin/client_info.c
@@ -102,7 +102,7 @@ int main(int argc, char **argv)
     virAdmClientPtr clnt = NULL;   /* which client get identity for */
     virTypedParameterPtr params = NULL;     /* where to store identity info */
     int nparams = 0;
-    size_t i = 0;
+    ssize_t i = 0;
     char *timestr = NULL;
 
     if (argc != 3) {
diff --git a/examples/admin/client_limits.c b/examples/admin/client_limits.c
index 2d5b75489..2a1d6314c 100644
--- a/examples/admin/client_limits.c
+++ b/examples/admin/client_limits.c
@@ -9,7 +9,7 @@ int main(int argc, char **argv)
     virAdmServerPtr srv = NULL;     /* which server to work with */
     virTypedParameterPtr params = NULL;
     int nparams = 0;
-    size_t i;
+    ssize_t i;
 
     if (argc != 2) {
         fprintf(stderr, "One argument specifying the server which to work "
diff --git a/examples/admin/list_clients.c b/examples/admin/list_clients.c
index 3b4496e30..21ea4d818 100644
--- a/examples/admin/list_clients.c
+++ b/examples/admin/list_clients.c
@@ -50,7 +50,7 @@ int main(int argc, char **argv)
     virAdmConnectPtr conn = NULL;
     virAdmServerPtr srv = NULL;      /* which server list the clients from */
     virAdmClientPtr *clients = NULL;    /* where to store the servers */
-    size_t i = 0;
+    ssize_t i = 0;
     int count = 0;
 
     if (argc != 2) {
diff --git a/examples/admin/list_servers.c b/examples/admin/list_servers.c
index 1f6f4c6cf..420fd5fb7 100644
--- a/examples/admin/list_servers.c
+++ b/examples/admin/list_servers.c
@@ -8,7 +8,7 @@ int main(void)
     virAdmConnectPtr conn = NULL;
     virAdmServerPtr *servers = NULL;    /* where to store the servers */
     virAdmServerPtr *tmp = NULL;
-    size_t i = 0;
+    ssize_t i = 0;
     int count = 0;
 
     /* first, open a connection to the daemon */
diff --git a/examples/admin/threadpool_params.c b/examples/admin/threadpool_params.c
index ee9ce83c1..43c71184a 100644
--- a/examples/admin/threadpool_params.c
+++ b/examples/admin/threadpool_params.c
@@ -9,7 +9,7 @@ int main(int argc, char **argv)
     virAdmServerPtr srv = NULL;     /* which server to work with */
     virTypedParameterPtr params = NULL;
     int nparams = 0;
-    size_t i;
+    ssize_t i;
 
     if (argc != 2) {
         fprintf(stderr, "One argument specifying the server which to work "
diff --git a/examples/domsuspend/suspend.c b/examples/domsuspend/suspend.c
index 3e3f70e23..493a4b7b2 100644
--- a/examples/domsuspend/suspend.c
+++ b/examples/domsuspend/suspend.c
@@ -156,7 +156,7 @@ fetch_domains(virConnectPtr conn)
 {
     int num_domains, ret = -1;
     virDomainPtr *domains = NULL;
-    size_t i;
+    ssize_t i;
     const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
 
     DEBUG("Fetching list of running domains");
diff --git a/examples/domtop/domtop.c b/examples/domtop/domtop.c
index 22839947d..5a798154a 100644
--- a/examples/domtop/domtop.c
+++ b/examples/domtop/domtop.c
@@ -161,7 +161,7 @@ fetch_domains(virConnectPtr conn)
 {
     int num_domains, ret = -1;
     virDomainPtr *domains = NULL;
-    size_t i;
+    ssize_t i;
     const int list_flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE;
 
     DEBUG("Fetching list of running domains");
@@ -189,8 +189,7 @@ fetch_domains(virConnectPtr conn)
 }
 
 static void
-print_cpu_usage(const char *dom_name,
-                size_t cpu,
+print_cpu_usage(size_t cpu,
                 size_t ncpus,
                 unsigned long long then,
                 virTypedParameterPtr then_params,
@@ -334,7 +333,7 @@ do_top(virConnectPtr conn,
             goto cleanup;
         }
 
-        print_cpu_usage(dom_name, 0, max_id,
+        print_cpu_usage(0, max_id,
                         then.tv_sec * 1000000 + then.tv_usec,
                         then_params, then_nparams,
                         now.tv_sec * 1000000 + now.tv_usec,
diff --git a/examples/hellolibvirt/hellolibvirt.c b/examples/hellolibvirt/hellolibvirt.c
index c64fa9658..02c440198 100644
--- a/examples/hellolibvirt/hellolibvirt.c
+++ b/examples/hellolibvirt/hellolibvirt.c
@@ -55,7 +55,7 @@ static int
 showDomains(virConnectPtr conn)
 {
     int ret = 0, numNames, numInactiveDomains, numActiveDomains;
-    size_t i;
+    ssize_t i;
     int flags = VIR_CONNECT_LIST_DOMAINS_ACTIVE |
                 VIR_CONNECT_LIST_DOMAINS_INACTIVE;
     virDomainPtr *nameList = NULL;
diff --git a/examples/openauth/openauth.c b/examples/openauth/openauth.c
index 0be977ef8..7a8254bb1 100644
--- a/examples/openauth/openauth.c
+++ b/examples/openauth/openauth.c
@@ -91,7 +91,7 @@ static int
 showDomains(virConnectPtr conn)
 {
     int ret = 0, numNames, numInactiveDomains, numActiveDomains;
-    size_t i;
+    ssize_t i;
     char **nameList = NULL;
 
     numActiveDomains = virConnectNumOfDomains(conn);
-- 
2.11.0

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux