summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-23 09:40:22 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-02-23 09:40:22 -0800
commit01433c7bdd169ae8a59ffe79842de55e318bc3b8 (patch)
tree55fa0ef113d252886d5f23fde3db71df43bb8c86
parent59da6b7438ab624593fe4ce52a402755cce25b12 (diff)
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 <alan.coopersmith@oracle.com>
-rw-r--r--xhost.c7
1 files 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);