summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
commit77ad97f199f1bf05e9a7609bbdd239dab825b258 (patch)
treecf117ebf8d4a50bc7ba0e4da4d60a98a944756c8 /coreutils
parentc4f12f59cc907577d787f816b37122809f896bb2 (diff)
downloadbusybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.gz
busybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.bz2
busybox-w32-77ad97f199f1bf05e9a7609bbdd239dab825b258.zip
more -Wall warning fixes from Cristian Ionescu-Idbohrn.
This time it resulted in small code changes: function old new delta nexpr 820 828 +8 tail_main 1200 1202 +2 wrapf 166 167 +1 parse_mount_options 227 209 -18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 11/-18) Total: -7 bytes
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/basename.c2
-rw-r--r--coreutils/cut.c8
-rw-r--r--coreutils/dd.c4
-rw-r--r--coreutils/expand.c4
-rw-r--r--coreutils/sort.c3
-rw-r--r--coreutils/stty.c2
-rw-r--r--coreutils/tail.c9
-rw-r--r--coreutils/test.c2
-rw-r--r--coreutils/tr.c2
9 files changed, 19 insertions, 17 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c
index 2216182e0..a3085ede3 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -48,5 +48,5 @@ int basename_main(int argc, char **argv)
48 48
49 /* puts(s) will do, but we can do without stdio this way: */ 49 /* puts(s) will do, but we can do without stdio this way: */
50 s[m++] = '\n'; 50 s[m++] = '\n';
51 return full_write(STDOUT_FILENO, s, m) == m; 51 return full_write(STDOUT_FILENO, s, m) == (ssize_t)m;
52} 52}
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 7a44d1088..1634fc8c8 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -64,7 +64,7 @@ static void cut_file(FILE *file, char delim)
64 /* print the chars specified in each cut list */ 64 /* print the chars specified in each cut list */
65 for (; cl_pos < nlists; cl_pos++) { 65 for (; cl_pos < nlists; cl_pos++) {
66 spos = cut_lists[cl_pos].startpos; 66 spos = cut_lists[cl_pos].startpos;
67 while (spos < strlen(line)) { 67 while (spos < (int)strlen(line)) {
68 if (!printed[spos]) { 68 if (!printed[spos]) {
69 printed[spos] = 'X'; 69 printed[spos] = 'X';
70 putchar(line[spos]); 70 putchar(line[spos]);
@@ -80,12 +80,12 @@ static void cut_file(FILE *file, char delim)
80 80
81 /* get out if we have no more lists to process or if the lines 81 /* get out if we have no more lists to process or if the lines
82 * are lower than what we're interested in */ 82 * are lower than what we're interested in */
83 if (linenum < spos || cl_pos >= nlists) 83 if (((int)linenum < spos) || (cl_pos >= nlists))
84 goto next_line; 84 goto next_line;
85 85
86 /* if the line we're looking for is lower than the one we were 86 /* if the line we're looking for is lower than the one we were
87 * passed, it means we displayed it already, so move on */ 87 * passed, it means we displayed it already, so move on */
88 while (spos < linenum) { 88 while (spos < (int)linenum) {
89 spos++; 89 spos++;
90 /* go to the next list if we're at the end of this one */ 90 /* go to the next list if we're at the end of this one */
91 if (spos > cut_lists[cl_pos].endpos 91 if (spos > cut_lists[cl_pos].endpos
@@ -97,7 +97,7 @@ static void cut_file(FILE *file, char delim)
97 spos = cut_lists[cl_pos].startpos; 97 spos = cut_lists[cl_pos].startpos;
98 /* get out if the current line is lower than the one 98 /* get out if the current line is lower than the one
99 * we just became interested in */ 99 * we just became interested in */
100 if (linenum < spos) 100 if ((int)linenum < spos)
101 goto next_line; 101 goto next_line;
102 } 102 }
103 } 103 }
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 4d1ef0b76..6b66366b6 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -65,7 +65,7 @@ static bool write_and_stats(const void *buf, size_t len, size_t obs,
65 ssize_t n = full_write_or_warn(buf, len, filename); 65 ssize_t n = full_write_or_warn(buf, len, filename);
66 if (n < 0) 66 if (n < 0)
67 return 1; 67 return 1;
68 if (n == obs) 68 if ((size_t)n == obs)
69 G.out_full++; 69 G.out_full++;
70 else if (n) /* > 0 */ 70 else if (n) /* > 0 */
71 G.out_part++; 71 G.out_part++;
@@ -312,7 +312,7 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
312 while (n) { 312 while (n) {
313 size_t d = obs - oc; 313 size_t d = obs - oc;
314 314
315 if (d > n) 315 if (d > (size_t)n)
316 d = n; 316 d = n;
317 memcpy(obuf + oc, tmp, d); 317 memcpy(obuf + oc, tmp, d);
318 n -= d; 318 n -= d;
diff --git a/coreutils/expand.c b/coreutils/expand.c
index a7ac8ea84..af2ef8675 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -41,7 +41,7 @@ static void expand(FILE *file, unsigned tab_size, unsigned opt)
41 char *line; 41 char *line;
42 char *ptr; 42 char *ptr;
43 int convert; 43 int convert;
44 int pos; 44 unsigned pos;
45 45
46 /* Increment tab_size by 1 locally.*/ 46 /* Increment tab_size by 1 locally.*/
47 tab_size++; 47 tab_size++;
@@ -80,7 +80,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
80 int convert; 80 int convert;
81 int pos; 81 int pos;
82 int i = 0; 82 int i = 0;
83 int column = 0; 83 unsigned column = 0;
84 84
85 while ((line = xmalloc_fgets(file)) != NULL) { 85 while ((line = xmalloc_fgets(file)) != NULL) {
86 convert = 1; 86 convert = 1;
diff --git a/coreutils/sort.c b/coreutils/sort.c
index a54be7269..12b463a6d 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -59,7 +59,8 @@ static struct sort_key {
59 59
60static char *get_key(char *str, struct sort_key *key, int flags) 60static char *get_key(char *str, struct sort_key *key, int flags)
61{ 61{
62 int start = 0, end = 0, len, i, j; 62 int start = 0, end = 0, len, j;
63 unsigned i;
63 64
64 /* Special case whole string, so we don't have to make a copy */ 65 /* Special case whole string, so we don't have to make a copy */
65 if (key->range[0] == 1 && !key->range[1] && !key->range[2] && !key->range[3] 66 if (key->range[0] == 1 && !key->range[1] && !key->range[2] && !key->range[3]
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 298fb5b70..a17955a6a 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -710,7 +710,7 @@ static void wrapf(const char *message, ...)
710{ 710{
711 char buf[128]; 711 char buf[128];
712 va_list args; 712 va_list args;
713 int buflen; 713 unsigned buflen;
714 714
715 va_start(args, message); 715 va_start(args, message);
716 buflen = vsnprintf(buf, sizeof(buf), message, args); 716 buflen = vsnprintf(buf, sizeof(buf), message, args);
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 2f997a9f6..2505fc3a6 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -92,7 +92,8 @@ int tail_main(int argc, char **argv)
92 size_t tailbufsize; 92 size_t tailbufsize;
93 int taillen = 0; 93 int taillen = 0;
94 int newlines_seen = 0; 94 int newlines_seen = 0;
95 int nfiles, nread, nwrite, seen, i, opt; 95 int nfiles, nread, nwrite, i, opt;
96 unsigned seen;
96 97
97 int *fds; 98 int *fds;
98 char *s, *buf; 99 char *s, *buf;
@@ -210,7 +211,7 @@ int tail_main(int argc, char **argv)
210 } else if (count) { 211 } else if (count) {
211 if (COUNT_BYTES) { 212 if (COUNT_BYTES) {
212 taillen += nread; 213 taillen += nread;
213 if (taillen > count) { 214 if (taillen > (int)count) {
214 memmove(tailbuf, tailbuf + taillen - count, count); 215 memmove(tailbuf, tailbuf + taillen - count, count);
215 taillen = count; 216 taillen = count;
216 } 217 }
@@ -225,7 +226,7 @@ int tail_main(int argc, char **argv)
225 } 226 }
226 } while (k); 227 } while (k);
227 228
228 if (newlines_seen + newlines_in_buf < count) { 229 if (newlines_seen + newlines_in_buf < (int)count) {
229 newlines_seen += newlines_in_buf; 230 newlines_seen += newlines_in_buf;
230 taillen += nread; 231 taillen += nread;
231 } else { 232 } else {
@@ -243,7 +244,7 @@ int tail_main(int argc, char **argv)
243 memmove(tailbuf, s, taillen); 244 memmove(tailbuf, s, taillen);
244 newlines_seen = count - extra; 245 newlines_seen = count - extra;
245 } 246 }
246 if (tailbufsize < taillen + BUFSIZ) { 247 if (tailbufsize < (size_t)taillen + BUFSIZ) {
247 tailbufsize = taillen + BUFSIZ; 248 tailbufsize = taillen + BUFSIZ;
248 tailbuf = xrealloc(tailbuf, tailbufsize); 249 tailbuf = xrealloc(tailbuf, tailbufsize);
249 } 250 }
diff --git a/coreutils/test.c b/coreutils/test.c
index 3c725a245..270ca21a9 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -412,7 +412,7 @@ static int test_eaccess(char *path, int mode)
412static int filstat(char *nm, enum token mode) 412static int filstat(char *nm, enum token mode)
413{ 413{
414 struct stat s; 414 struct stat s;
415 int i = i; /* gcc 3.x thinks it can be used uninitialized */ 415 unsigned i = i; /* gcc 3.x thinks it can be used uninitialized */
416 416
417 if (mode == FILSYM) { 417 if (mode == FILSYM) {
418#ifdef S_IFLNK 418#ifdef S_IFLNK
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 0d3284900..8b2d30802 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -219,7 +219,7 @@ int tr_main(int argc ATTRIBUTE_UNUSED, char **argv)
219 219
220 for (;;) { 220 for (;;) {
221 /* If we're out of input, flush output and read more input. */ 221 /* If we're out of input, flush output and read more input. */
222 if (in_index == read_chars) { 222 if ((ssize_t)in_index == read_chars) {
223 if (out_index) { 223 if (out_index) {
224 xwrite(STDOUT_FILENO, (char *)output, out_index); 224 xwrite(STDOUT_FILENO, (char *)output, out_index);
225 out_index = 0; 225 out_index = 0;