From 4442fdb76b12f63502bed7662eb4f521b9516472 Mon Sep 17 00:00:00 2001 From: krw Date: Tue, 16 Aug 2016 16:09:24 +0000 Subject: [PATCH] Bring types of variables used with struct stat into the modern world. Replace a couple of u_long paramaters with int as they were only passed int values and the function re-cast them to (int) anyway. Weird. ok tedu@ --- bin/ls/ls.c | 15 +++++++++------ bin/ls/print.c | 14 +++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 44cc4eeb5c9..9cb9d469797 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.46 2016/03/28 11:25:35 chl Exp $ */ +/* $OpenBSD: ls.c,v 1.47 2016/08/16 16:09:24 krw Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -424,10 +424,11 @@ display(FTSENT *p, FTSENT *list) FTSENT *cur; NAMES *np; off_t maxsize; - u_long maxlen, maxnlink; - unsigned long long btotal, maxblock; + nlink_t maxnlink; + unsigned long long btotal; + blkcnt_t maxblock; ino_t maxinode; - int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser; + int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser, maxlen; int entries, needstats; int width; char *user, *group, buf[21]; /* 64 bits == 20 digits */ @@ -547,14 +548,16 @@ display(FTSENT *p, FTSENT *list) if (needstats) { d.bcfile = bcfile; d.btotal = btotal; - (void)snprintf(buf, sizeof(buf), "%llu", maxblock); + (void)snprintf(buf, sizeof(buf), "%llu", + (unsigned long long)maxblock); d.s_block = strlen(buf); d.s_flags = maxflags; d.s_group = maxgroup; (void)snprintf(buf, sizeof(buf), "%llu", (unsigned long long)maxinode); d.s_inode = strlen(buf); - (void)snprintf(buf, sizeof(buf), "%lu", maxnlink); + (void)snprintf(buf, sizeof(buf), "%lu", + (unsigned long)maxnlink); d.s_nlink = strlen(buf); if (!f_humanval) { (void)snprintf(buf, sizeof(buf), "%lld", diff --git a/bin/ls/print.c b/bin/ls/print.c index c96f9b4d34a..6810e92a169 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.36 2016/08/15 16:57:53 krw Exp $ */ +/* $OpenBSD: print.c,v 1.37 2016/08/16 16:09:24 krw Exp $ */ /* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */ /* @@ -52,11 +52,11 @@ #include "ls.h" #include "extern.h" -static int printaname(FTSENT *, u_long, u_long); +static int printaname(FTSENT *, int, int); static void printlink(FTSENT *); static void printsize(int, off_t); static void printtime(time_t); -static int printtype(u_int); +static int printtype(mode_t); static int compute_columns(DISPLAY *, int *); #define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT) @@ -219,7 +219,7 @@ printcol(DISPLAY *dp) * return # of characters printed, no trailing characters. */ static int -printaname(FTSENT *p, u_long inodefield, u_long sizefield) +printaname(FTSENT *p, int inodefield, int sizefield) { struct stat *sp; int chcnt; @@ -227,10 +227,10 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefield) sp = p->fts_statp; chcnt = 0; if (f_inode) - chcnt += printf("%*llu ", (int)inodefield, + chcnt += printf("%*llu ", inodefield, (unsigned long long)sp->st_ino); if (f_size) - chcnt += printf("%*lld ", (int)sizefield, + chcnt += printf("%*lld ", sizefield, howmany((long long)sp->st_blocks, blocksize)); chcnt += mbsprint(p->fts_name, 1); if (f_type || (f_typedir && S_ISDIR(sp->st_mode))) @@ -323,7 +323,7 @@ printstream(DISPLAY *dp) } static int -printtype(u_int mode) +printtype(mode_t mode) { switch (mode & S_IFMT) { case S_IFDIR: -- 2.20.1