aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-05-13 02:27:31 +0000
commit77ad97f199f1bf05e9a7609bbdd239dab825b258 (patch)
treecf117ebf8d4a50bc7ba0e4da4d60a98a944756c8 /coreutils
parentc4f12f59cc907577d787f816b37122809f896bb2 (diff)
downloadbusybox-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.gz
busybox-77ad97f199f1bf05e9a7609bbdd239dab825b258.tar.bz2
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)
/* puts(s) will do, but we can do without stdio this way: */
s[m++] = '\n';
- return full_write(STDOUT_FILENO, s, m) == m;
+ return full_write(STDOUT_FILENO, s, m) == (ssize_t)m;
}
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)
/* print the chars specified in each cut list */
for (; cl_pos < nlists; cl_pos++) {
spos = cut_lists[cl_pos].startpos;
- while (spos < strlen(line)) {
+ while (spos < (int)strlen(line)) {
if (!printed[spos]) {
printed[spos] = 'X';
putchar(line[spos]);
@@ -80,12 +80,12 @@ static void cut_file(FILE *file, char delim)
/* get out if we have no more lists to process or if the lines
* are lower than what we're interested in */
- if (linenum < spos || cl_pos >= nlists)
+ if (((int)linenum < spos) || (cl_pos >= nlists))
goto next_line;
/* if the line we're looking for is lower than the one we were
* passed, it means we displayed it already, so move on */
- while (spos < linenum) {
+ while (spos < (int)linenum) {
spos++;
/* go to the next list if we're at the end of this one */
if (spos > cut_lists[cl_pos].endpos
@@ -97,7 +97,7 @@ static void cut_file(FILE *file, char delim)
spos = cut_lists[cl_pos].startpos;
/* get out if the current line is lower than the one
* we just became interested in */
- if (linenum < spos)
+ if ((int)linenum < spos)
goto next_line;
}
}
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,
ssize_t n = full_write_or_warn(buf, len, filename);
if (n < 0)
return 1;
- if (n == obs)
+ if ((size_t)n == obs)
G.out_full++;
else if (n) /* > 0 */
G.out_part++;
@@ -312,7 +312,7 @@ int dd_main(int argc ATTRIBUTE_UNUSED, char **argv)
while (n) {
size_t d = obs - oc;
- if (d > n)
+ if (d > (size_t)n)
d = n;
memcpy(obuf + oc, tmp, d);
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)
char *line;
char *ptr;
int convert;
- int pos;
+ unsigned pos;
/* Increment tab_size by 1 locally.*/
tab_size++;
@@ -80,7 +80,7 @@ static void unexpand(FILE *file, unsigned int tab_size, unsigned opt)
int convert;
int pos;
int i = 0;
- int column = 0;
+ unsigned column = 0;
while ((line = xmalloc_fgets(file)) != NULL) {
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 {
static char *get_key(char *str, struct sort_key *key, int flags)
{
- int start = 0, end = 0, len, i, j;
+ int start = 0, end = 0, len, j;
+ unsigned i;
/* Special case whole string, so we don't have to make a copy */
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, ...)
{
char buf[128];
va_list args;
- int buflen;
+ unsigned buflen;
va_start(args, message);
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)
size_t tailbufsize;
int taillen = 0;
int newlines_seen = 0;
- int nfiles, nread, nwrite, seen, i, opt;
+ int nfiles, nread, nwrite, i, opt;
+ unsigned seen;
int *fds;
char *s, *buf;
@@ -210,7 +211,7 @@ int tail_main(int argc, char **argv)
} else if (count) {
if (COUNT_BYTES) {
taillen += nread;
- if (taillen > count) {
+ if (taillen > (int)count) {
memmove(tailbuf, tailbuf + taillen - count, count);
taillen = count;
}
@@ -225,7 +226,7 @@ int tail_main(int argc, char **argv)
}
} while (k);
- if (newlines_seen + newlines_in_buf < count) {
+ if (newlines_seen + newlines_in_buf < (int)count) {
newlines_seen += newlines_in_buf;
taillen += nread;
} else {
@@ -243,7 +244,7 @@ int tail_main(int argc, char **argv)
memmove(tailbuf, s, taillen);
newlines_seen = count - extra;
}
- if (tailbufsize < taillen + BUFSIZ) {
+ if (tailbufsize < (size_t)taillen + BUFSIZ) {
tailbufsize = taillen + BUFSIZ;
tailbuf = xrealloc(tailbuf, tailbufsize);
}
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)
static int filstat(char *nm, enum token mode)
{
struct stat s;
- int i = i; /* gcc 3.x thinks it can be used uninitialized */
+ unsigned i = i; /* gcc 3.x thinks it can be used uninitialized */
if (mode == FILSYM) {
#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)
for (;;) {
/* If we're out of input, flush output and read more input. */
- if (in_index == read_chars) {
+ if ((ssize_t)in_index == read_chars) {
if (out_index) {
xwrite(STDOUT_FILENO, (char *)output, out_index);
out_index = 0;