From 01433c7bdd169ae8a59ffe79842de55e318bc3b8 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sat, 23 Feb 2013 09:40:22 -0800 Subject: Fix some integer sign/size conversion warnings flagged by clang xhost.c:154:19: warning: comparison of integers of different signs: 'int' and 'unsigned long' [-Wsign-compare] for (i = 0; i < FAMILIES; i++) ~ ^ ~~~~~~~~ xhost.c:310:15: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32] namelen = strlen(name); ~ ^~~~~~~~~~~~ xhost.c:311:40: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion] if ((lname = (char *)malloc(namelen+1)) == NULL) { ~~~~~~ ~~~~~~~^~ xhost.c:707:46: warning: implicit conversion changes signedness: 'int' to 'socklen_t' (aka 'unsigned int') [-Wsign-conversion] getnameinfo((struct sockaddr *) &saddr, saddrlen, inetname, ~~~~~~~~~~~ ^~~~~~~~ Signed-off-by: Alan Coopersmith --- xhost.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/xhost.c b/xhost.c index 6545fb7..f5633a1 100644 --- a/xhost.c +++ b/xhost.c @@ -131,7 +131,7 @@ static char *ProgramName; static int XFamily(int af) { - int i; + unsigned int i; static struct _familyMap { int af, xf; } familyMap[] = { @@ -290,7 +290,8 @@ change_host(Display *dpy, char *name, Bool add) { XHostAddress ha; char *lname; - int namelen, i, family = FamilyWild; + size_t namelen, i; + int family = FamilyWild; #ifdef K5AUTH krb5_principal princ; krb5_data kbuf; @@ -661,7 +662,7 @@ get_hostname(XHostAddress *ha) if ((ha->family == FamilyInternet) || (ha->family == FamilyInternet6)) { struct sockaddr_storage saddr; static char inetname[NI_MAXHOST]; - int saddrlen; + unsigned int saddrlen; inetname[0] = '\0'; memset(&saddr, 0, sizeof saddr); -- cgit v1.2.3