提交 3b67fc9f 编写于 作者: M Michal Privoznik

examples: Resolve sign-compare warnings

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: NMichal Privoznik <mprivozn@redhat.com>
上级 86fd4e30
...@@ -102,7 +102,7 @@ int main(int argc, char **argv) ...@@ -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) {
......
...@@ -9,7 +9,7 @@ int main(int argc, char **argv) ...@@ -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 "
......
...@@ -50,7 +50,7 @@ int main(int argc, char **argv) ...@@ -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) {
......
...@@ -8,7 +8,7 @@ int main(void) ...@@ -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 */
......
...@@ -9,7 +9,7 @@ int main(int argc, char **argv) ...@@ -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 "
......
...@@ -156,7 +156,7 @@ fetch_domains(virConnectPtr conn) ...@@ -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");
......
...@@ -161,7 +161,7 @@ fetch_domains(virConnectPtr conn) ...@@ -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");
......
...@@ -55,7 +55,7 @@ static int ...@@ -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;
......
...@@ -91,7 +91,7 @@ static int ...@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册