diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-04-22 01:07:01 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-04-22 11:11:19 +0100 |
commit | 8878c4ef1b88fd07a48ccd7df6bff7ba0929dad7 (patch) | |
tree | f427316aa66d271bfc031d1701629d5e2a69a212 /src/wc.c | |
parent | 01f4065b129c6ad55eef765e701d0e20342867c7 (diff) | |
download | coreutils-8878c4ef1b88fd07a48ccd7df6bff7ba0929dad7.tar.xz |
maint: avoid -Werror=strict-overflow warnings with GCC 5
All warnings were of the form: "assuming signed overflow does not occur
when simplifying conditional to constant [-Werror=strict-overflow]"
* src/dd.c (cache_round): Use an appropriately sized unsigned type,
to avoid possibility of undefined signed overflow.
* src/mknod.c (main): Likewise.
* src/pr.c (pad_down): Likewise.
* src/wc.c (main): Likewise.
* src/tail.c (main): Assert that argc >= 0 thus allowing the
compiler to assume without implication that argc - optind
is positive.
Diffstat (limited to 'src/wc.c')
-rw-r--r-- | src/wc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -558,7 +558,7 @@ wc_file (char const *file, struct fstatus *fstatus) that happens when we don't know how long the list of file names will be. */ static struct fstatus * -get_input_fstatus (int nfiles, char *const *file) +get_input_fstatus (size_t nfiles, char *const *file) { struct fstatus *fstatus = xnmalloc (nfiles ? nfiles : 1, sizeof *fstatus); @@ -570,7 +570,7 @@ get_input_fstatus (int nfiles, char *const *file) fstatus[0].failed = 1; else { - int i; + size_t i; for (i = 0; i < nfiles; i++) fstatus[i].failed = (! file[i] || STREQ (file[i], "-") @@ -586,7 +586,7 @@ get_input_fstatus (int nfiles, char *const *file) get_input_fstatus optimizes. */ static int _GL_ATTRIBUTE_PURE -compute_number_width (int nfiles, struct fstatus const *fstatus) +compute_number_width (size_t nfiles, struct fstatus const *fstatus) { int width = 1; @@ -594,7 +594,7 @@ compute_number_width (int nfiles, struct fstatus const *fstatus) { int minimum_width = 1; uintmax_t regular_total = 0; - int i; + size_t i; for (i = 0; i < nfiles; i++) if (! fstatus[i].failed) @@ -620,7 +620,7 @@ main (int argc, char **argv) { bool ok; int optc; - int nfiles; + size_t nfiles; char **files; char *files_from = NULL; struct fstatus *fstatus; |