From e263ec16a93844ceb2f1686f86fe019cd00b0ba8 Mon Sep 17 00:00:00 2001 From: Craig Rodrigues Date: Mon, 14 Sep 2015 18:59:01 +0000 Subject: [PATCH] Use unsigned variables in a few places. Eliminates gcc 4.9 warnings. --- lib/libc/gen/getgrent.c | 4 ++-- lib/libc/gen/getpwent.c | 5 +++-- lib/libc/gen/strtofflags.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/libc/gen/getgrent.c b/lib/libc/gen/getgrent.c index 1f4d7e9fb299..93a82c2db324 100644 --- a/lib/libc/gen/getgrent.c +++ b/lib/libc/gen/getgrent.c @@ -1238,7 +1238,7 @@ compat_setgrent(void *retval, void *mdata, va_list ap) int rv, stayopen; #define set_setent(x, y) do { \ - int i; \ + unsigned int i; \ \ for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++) \ x[i].mdata = (void *)y; \ @@ -1308,7 +1308,7 @@ compat_group(void *retval, void *mdata, va_list ap) int rv, stayopen, *errnop; #define set_lookup_type(x, y) do { \ - int i; \ + unsigned int i; \ \ for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++) \ x[i].mdata = (void *)y; \ diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 09a624785a15..6546f587ae19 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1607,7 +1607,8 @@ compat_redispatch(struct compat_state *st, enum nss_lookup_type how, { NULL, NULL, NULL } }; void *discard; - int rv, e, i; + int rv, e; + unsigned int i; for (i = 0; i < sizeof(dtab)/sizeof(dtab[0]) - 1; i++) dtab[i].mdata = (void *)lookup_how; @@ -1702,7 +1703,7 @@ compat_setpwent(void *retval, void *mdata, va_list ap) int rv, stayopen; #define set_setent(x, y) do { \ - int i; \ + unsigned int i; \ \ for (i = 0; i < (sizeof(x)/sizeof(x[0])) - 1; i++) \ x[i].mdata = (void *)y; \ diff --git a/lib/libc/gen/strtofflags.c b/lib/libc/gen/strtofflags.c index 503f46b36e1f..dba9cd24fb65 100644 --- a/lib/libc/gen/strtofflags.c +++ b/lib/libc/gen/strtofflags.c @@ -100,7 +100,7 @@ fflagstostr(u_long flags) const char *sp; char *dp; u_long setflags; - int i; + u_int i; if ((string = (char *)malloc(nmappings * (longestflaglen + 1))) == NULL) return (NULL);