summaryrefslogtreecommitdiff
authorTanguy Pruvot <tanguy.pruvot@gmail.com>2012-05-05 13:26:43 (GMT)
committer Tanguy Pruvot <tanguy.pruvot@gmail.com>2012-05-05 23:55:10 (GMT)
commit6fef6a3ae6362b1885b50b5c3e30654dd65bee46 (patch)
treebff28cf7942b7b8bfd129e517e86f4590c5360b5
parent8a6c2c22300b567db5b1ce2ea9ce9282e60bc0c5 (diff)
downloadbusybox-6fef6a3ae6362b1885b50b5c3e30654dd65bee46.zip
busybox-6fef6a3ae6362b1885b50b5c3e30654dd65bee46.tar.gz
busybox-6fef6a3ae6362b1885b50b5c3e30654dd65bee46.tar.bz2
fix most sign and variable initialization warnings
Change-Id: I56e08db791152a9c95fc0d16bc75b702e403274d
Diffstat
-rw-r--r--Android.mk1
-rw-r--r--android/regex/cs_config.h1
-rw-r--r--android/regex/regex.c46
-rw-r--r--applets/usage_pod.c2
-rw-r--r--archival/libarchive/bz/blocksort.c2
-rw-r--r--archival/libarchive/data_extract_all.c2
-rw-r--r--archival/libarchive/decompress_bunzip2.c4
-rw-r--r--archival/libarchive/decompress_gunzip.c4
-rw-r--r--archival/unzip.c2
-rw-r--r--coreutils/cal.c2
-rw-r--r--coreutils/expr.c4
-rw-r--r--coreutils/ls.c2
-rw-r--r--coreutils/seq.c4
-rw-r--r--coreutils/tail.c4
-rw-r--r--editors/awk.c16
-rw-r--r--editors/diff.c2
-rw-r--r--editors/vi.c8
-rw-r--r--findutils/find.c6
-rw-r--r--findutils/grep.c4
-rw-r--r--include-full/autoconf.h4
-rw-r--r--include-minimal/autoconf.h4
-rw-r--r--include/android.h7
-rw-r--r--include/libbb.h6
-rw-r--r--libbb/fgets_str.c4
-rw-r--r--libbb/lineedit.c21
-rw-r--r--libbb/parse_config.c2
-rw-r--r--libbb/time.c6
-rw-r--r--miscutils/crond.c2
-rw-r--r--miscutils/devmem.c2
-rw-r--r--miscutils/fbsplash.c4
-rw-r--r--miscutils/flash_lock_unlock.c2
-rw-r--r--miscutils/flashcp.c4
-rw-r--r--miscutils/less.c10
-rw-r--r--miscutils/nandwrite.c4
-rw-r--r--miscutils/rx.c12
-rw-r--r--miscutils/strings.c4
-rw-r--r--miscutils/taskset.c2
-rw-r--r--modutils/modinfo.c2
-rw-r--r--networking/libiproute/ipaddress.c12
-rw-r--r--networking/libiproute/iplink.c4
-rw-r--r--networking/libiproute/iproute.c2
-rw-r--r--networking/libiproute/utils.c4
-rw-r--r--networking/nc.c2
-rw-r--r--networking/ntpd.c12
-rw-r--r--networking/ping.c6
-rw-r--r--networking/telnetd.c4
-rw-r--r--networking/tftp.c4
-rw-r--r--procps/kill.c2
-rw-r--r--procps/lsof.c2
-rw-r--r--procps/mpstat.c21
-rw-r--r--procps/pgrep.c4
-rw-r--r--procps/ps.c2
-rw-r--r--procps/pstree.c2
-rw-r--r--scripts/Makefile.host4
-rw-r--r--shell/ash.c6
-rw-r--r--util-linux/mount.c2
56 files changed, 161 insertions, 152 deletions
diff --git a/Android.mk b/Android.mk
index bf7bd02..fcefe56 100644
--- a/Android.mk
+++ b/Android.mk
@@ -9,6 +9,7 @@ BIONIC_ICS := true
include $(CLEAR_VARS)
LOCAL_SRC_FILES := android/regex/regex.c
LOCAL_C_INCLUDES := $(BB_PATH)/android/regex
+LOCAL_CFLAGS := -Wno-sign-compare
LOCAL_MODULE := libclearsilverregex
include $(BUILD_STATIC_LIBRARY)
diff --git a/android/regex/cs_config.h b/android/regex/cs_config.h
index ad9e92e..7d14e2c 100644
--- a/android/regex/cs_config.h
+++ b/android/regex/cs_config.h
@@ -50,6 +50,7 @@
#define HAVE_REGEX 1
/* Does your system have pthreads? */
+#undef HAVE_PTHREADS
#define HAVE_PTHREADS 1
/* Does your system have lockf ? */
diff --git a/android/regex/regex.c b/android/regex/regex.c
index 3d4a9bc..b348d6c 100644
--- a/android/regex/regex.c
+++ b/android/regex/regex.c
@@ -455,10 +455,10 @@ typedef enum
wordend, /* Succeeds if at word end. */
wordbound, /* Succeeds if at a word boundary. */
- notwordbound /* Succeeds if not at a word boundary. */
+ notwordbound, /* Succeeds if not at a word boundary. */
#ifdef emacs
- ,before_dot, /* Succeeds if before point. */
+ before_dot, /* Succeeds if before point. */
at_dot, /* Succeeds if at point. */
after_dot, /* Succeeds if after point. */
@@ -467,7 +467,7 @@ typedef enum
syntaxspec,
/* Matches any character whose syntax is not that specified. */
- notsyntaxspec
+ notsyntaxspec,
#endif /* emacs */
} re_opcode_t;
@@ -1157,7 +1157,7 @@ typedef struct
DEBUG_PRINT2 (" available: %d\n", REMAINING_AVAIL_SLOTS); \
\
/* Ensure we have enough space allocated for what we will push. */ \
- while (REMAINING_AVAIL_SLOTS < NUM_FAILURE_ITEMS) \
+ while ((int) REMAINING_AVAIL_SLOTS < (int) NUM_FAILURE_ITEMS) \
{ \
if (!DOUBLE_FAIL_STACK (fail_stack)) \
return failure_code; \
@@ -1171,7 +1171,8 @@ typedef struct
DEBUG_PRINT1 ("\n"); \
\
if (1) \
- for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \
+ for (this_reg = lowest_active_reg; \
+ this_reg <= (int) highest_active_reg; \
this_reg++) \
{ \
DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \
@@ -1195,23 +1196,23 @@ typedef struct
PUSH_FAILURE_ELT (reg_info[this_reg].word); \
} \
\
- DEBUG_PRINT2 (" Pushing low active reg: %d\n", lowest_active_reg);\
+ DEBUG_PRINT2(" Pushing low active reg: %d\n", lowest_active_reg); \
PUSH_FAILURE_INT (lowest_active_reg); \
\
- DEBUG_PRINT2 (" Pushing high active reg: %d\n", highest_active_reg);\
+ DEBUG_PRINT2(" Pushing high active reg: %d\n", highest_active_reg);\
PUSH_FAILURE_INT (highest_active_reg); \
\
- DEBUG_PRINT2 (" Pushing pattern 0x%x: ", pattern_place); \
+ DEBUG_PRINT2(" Pushing pattern 0x%x: ", pattern_place); \
DEBUG_PRINT_COMPILED_PATTERN (bufp, pattern_place, pend); \
PUSH_FAILURE_POINTER (pattern_place); \
\
- DEBUG_PRINT2 (" Pushing string 0x%x: `", string_place); \
+ DEBUG_PRINT2(" Pushing string 0x%x: `", string_place); \
DEBUG_PRINT_DOUBLE_STRING (string_place, string1, size1, string2, \
size2); \
- DEBUG_PRINT1 ("'\n"); \
+ DEBUG_PRINT1("'\n"); \
PUSH_FAILURE_POINTER (string_place); \
\
- DEBUG_PRINT2 (" Pushing failure id: %u\n", failure_id); \
+ DEBUG_PRINT2(" Pushing failure id: %u\n", failure_id); \
DEBUG_PUSH (failure_id); \
} while (0)
@@ -1268,7 +1269,7 @@ typedef struct
DEBUG_PRINT2 (" Before pop, next avail: %d\n", fail_stack.avail); \
DEBUG_PRINT2 (" size: %d\n", fail_stack.size); \
\
- assert (fail_stack.avail >= NUM_NONREG_ITEMS); \
+ assert ((int) fail_stack.avail >= (int) NUM_NONREG_ITEMS); \
\
DEBUG_POP (&failure_id); \
DEBUG_PRINT2 (" Popping failure id: %u\n", failure_id); \
@@ -1296,7 +1297,7 @@ typedef struct
DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \
\
if (1) \
- for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \
+ for (this_reg = high_reg; this_reg >= (int) low_reg; this_reg--) \
{ \
DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \
\
@@ -1311,7 +1312,8 @@ typedef struct
} \
else \
{ \
- for (this_reg = highest_active_reg; this_reg > high_reg; this_reg--) \
+ for (this_reg = highest_active_reg; this_reg > (int) high_reg; \
+ this_reg--) \
{ \
reg_info[this_reg].word.integer = 0; \
regend[this_reg] = 0; \
@@ -1431,14 +1433,14 @@ static reg_errcode_t compile_range ();
/* Make sure we have at least N more bytes of space in buffer. */
#define GET_BUFFER_SPACE(n) \
- while (b - bufp->buffer + (n) > bufp->allocated) \
+ while (b - bufp->buffer + (n) > (int) bufp->allocated) \
EXTEND_BUFFER ()
/* Make sure we have one more byte of buffer space and then add C to it. */
#define BUF_PUSH(c) \
do { \
GET_BUFFER_SPACE (1); \
- *b++ = (unsigned char) (c); \
+ *b++ = (unsigned char) (c); \
} while (0)
@@ -3490,7 +3492,7 @@ static boolean alt_match_null_string_p (),
/* Free everything we malloc. */
#ifdef MATCH_MAY_ALLOCATE
-#define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else
+#define FREE_VAR(var) if (var) { REGEX_FREE (var); var = NULL; } else {}
#define FREE_VARIABLES() \
do { \
REGEX_FREE_STACK (fail_stack.stack); \
@@ -3746,7 +3748,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Initialize subexpression text positions to -1 to mark ones that no
start_memory/stop_memory has been seen for. Also initialize the
register information struct. */
- for (mcnt = 1; mcnt < num_regs; mcnt++)
+ for (mcnt = 1; mcnt < (int) num_regs; mcnt++)
{
regstart[mcnt] = regend[mcnt]
= old_regstart[mcnt] = old_regend[mcnt] = REG_UNSET_VALUE;
@@ -3846,7 +3848,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
DEBUG_PRINT1 ("\nSAVING match as best so far.\n");
- for (mcnt = 1; mcnt < num_regs; mcnt++)
+ for (mcnt = 1; mcnt < (int) num_regs; mcnt++)
{
best_regstart[mcnt] = regstart[mcnt];
best_regend[mcnt] = regend[mcnt];
@@ -3872,7 +3874,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
dend = ((d >= string1 && d <= end1)
? end_match_1 : end_match_2);
- for (mcnt = 1; mcnt < num_regs; mcnt++)
+ for (mcnt = 1; mcnt < (int) num_regs; mcnt++)
{
regstart[mcnt] = best_regstart[mcnt];
regend[mcnt] = best_regend[mcnt];
@@ -3937,7 +3939,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
/* Go through the first `min (num_regs, regs->num_regs)'
registers, since that is all we initialized. */
- for (mcnt = 1; mcnt < MIN (num_regs, regs->num_regs); mcnt++)
+ for (mcnt = 1; mcnt < (int) MIN (num_regs, regs->num_regs); mcnt++)
{
if (REG_UNSET (regstart[mcnt]) || REG_UNSET (regend[mcnt]))
regs->start[mcnt] = regs->end[mcnt] = -1;
@@ -3955,7 +3957,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop)
we (re)allocated the registers, this is the case,
because we always allocate enough to have at least one
-1 at the end. */
- for (mcnt = num_regs; mcnt < regs->num_regs; mcnt++)
+ for (mcnt = num_regs; mcnt < (int) regs->num_regs; mcnt++)
regs->start[mcnt] = regs->end[mcnt] = -1;
} /* regs && !bufp->no_sub */
diff --git a/applets/usage_pod.c b/applets/usage_pod.c
index 0b1c4aa..a67e8b4 100644
--- a/applets/usage_pod.c
+++ b/applets/usage_pod.c
@@ -71,7 +71,7 @@ int main(void)
} else {
printf(", ");
}
- printf(usage_array[i].aname);
+ printf("%s", usage_array[i].aname);
col += len2;
}
printf("\n\n");
diff --git a/archival/libarchive/bz/blocksort.c b/archival/libarchive/bz/blocksort.c
index e600cb7..d329f44 100644
--- a/archival/libarchive/bz/blocksort.c
+++ b/archival/libarchive/bz/blocksort.c
@@ -828,7 +828,7 @@ void mainSort(EState* state,
int32_t vv;
/* bbox: was: int32_t h = 1; */
/* do h = 3 * h + 1; while (h <= 256); */
- uint32_t h = 364;
+ int32_t h = 364;
do {
/*h = h / 3;*/
diff --git a/archival/libarchive/data_extract_all.c b/archival/libarchive/data_extract_all.c
index 3f67b83..aaab437 100644
--- a/archival/libarchive/data_extract_all.c
+++ b/archival/libarchive/data_extract_all.c
@@ -68,7 +68,7 @@ void FAST_FUNC data_extract_all(archive_handle_t *archive_handle)
bb_perror_msg_and_die("can't stat old file");
}
}
- else if (existing_sb.st_mtime >= file_header->mtime) {
+ else if ((time_t) existing_sb.st_mtime >= (time_t) file_header->mtime) {
if (!(archive_handle->ah_flags & ARCHIVE_EXTRACT_QUIET)
&& !S_ISDIR(file_header->mode)
) {
diff --git a/archival/libarchive/decompress_bunzip2.c b/archival/libarchive/decompress_bunzip2.c
index dc252bb..53bf47a 100644
--- a/archival/libarchive/decompress_bunzip2.c
+++ b/archival/libarchive/decompress_bunzip2.c
@@ -153,7 +153,7 @@ static int get_next_block(bunzip_data *bd)
struct group_data *hufGroup;
int dbufCount, dbufSize, groupCount, *base, *limit, selector,
i, j, t, runPos, symCount, symTotal, nSelectors, byteCount[256];
- int runCnt = runCnt; /* for compiler */
+ int runCnt = 0;
uint8_t uc, symToByte[256], mtfSymbol[256], *selectors;
uint32_t *dbuf;
unsigned origPtr;
@@ -780,7 +780,7 @@ unpack_bz2_stream(transformer_aux_data_t *aux, int src_fd, int dst_fd)
len = bd->inbufCount - bd->inbufPos;
memcpy(outbuf, &bd->inbuf[bd->inbufPos], len);
if (len < 2) {
- if (safe_read(src_fd, outbuf + len, 2 - len) != 2 - len)
+ if (safe_read(src_fd, outbuf + len, 2 - len) != (int)(2 - len))
break;
len = 2;
}
diff --git a/archival/libarchive/decompress_gunzip.c b/archival/libarchive/decompress_gunzip.c
index 2d5ab3e..94204de 100644
--- a/archival/libarchive/decompress_gunzip.c
+++ b/archival/libarchive/decompress_gunzip.c
@@ -256,7 +256,7 @@ static unsigned fill_bitbuffer(STATE_PARAM unsigned bitbuffer, unsigned *current
while (*current < required) {
if (bytebuffer_offset >= bytebuffer_size) {
unsigned sz = bytebuffer_max - 4;
- if (to_read >= 0 && to_read < sz) /* unzip only */
+ if (to_read >= 0 && (unsigned) to_read < sz) /* unzip only */
sz = to_read;
/* Leave the first 4 bytes empty so we can always unwind the bitbuffer
* to the front of the bytebuffer */
@@ -409,7 +409,7 @@ static int huft_build(const unsigned *b, const unsigned n,
f -= *xp; /* else deduct codes from patterns */
}
}
- j = (w + j > eob_len && w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
+ j = ((unsigned) (w + j) > eob_len && w > 0 && (unsigned) w < eob_len) ? eob_len - w : j; /* make EOB code end at table */
z = 1 << j; /* table entries for j-bit table */
ws[htl+1] = w + j; /* set bits decoded in stack */
diff --git a/archival/unzip.c b/archival/unzip.c
index 3c76cda..a4fa890 100644
--- a/archival/unzip.c
+++ b/archival/unzip.c
@@ -259,7 +259,7 @@ static void unzip_extract(zip_header_t *zip_header, int dst_fd)
bb_error_msg_and_die("crc error");
}
/* Validate decompression - size */
- if (zip_header->formatted.ucmpsize != aux.bytes_out) {
+ if (zip_header->formatted.ucmpsize != (uint32_t) aux.bytes_out) {
/* Don't die. Who knows, maybe len calculation
* was botched somewhere. After all, crc matched! */
bb_error_msg("bad length");
diff --git a/coreutils/cal.c b/coreutils/cal.c
index b470ad9..bd1ab2a 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -325,7 +325,7 @@ static char *build_row(char *p, unsigned *dp)
col = 0;
do {
day = *dp++;
- if (day != SPACE) {
+ if (day != (unsigned) SPACE) {
if (julian) {
++p;
if (day >= 100) {
diff --git a/coreutils/expr.c b/coreutils/expr.c
index c986f93..86c5709 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -323,8 +323,8 @@ static VALUE *eval6(void)
"quote\0""length\0""match\0""index\0""substr\0";
VALUE *r, *i1, *i2;
- VALUE *l = l; /* silence gcc */
- VALUE *v = v; /* silence gcc */
+ VALUE *l = NULL;
+ VALUE *v = NULL;
int key = *G.args ? index_in_strings(keywords, *G.args) + 1 : 0;
if (key == 0) /* not a keyword */
diff --git a/coreutils/ls.c b/coreutils/ls.c
index b1ba08b..e4717e0 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -677,7 +677,7 @@ static void display_files(struct dnode **dn, unsigned nfiles)
/* find the longest file name, use that as the column width */
for (i = 0; dn[i]; i++) {
int len = calc_name_len(dn[i]->name);
- if (column_width < len)
+ if ((int)column_width < len)
column_width = len;
}
column_width += 1 +
diff --git a/coreutils/seq.c b/coreutils/seq.c
index 8986192..10dabe9 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -28,7 +28,7 @@ int seq_main(int argc, char **argv)
};
double first, last, increment, v;
unsigned n;
- unsigned width;
+ int width;
unsigned frac_part;
const char *sep, *opt_s = "\n";
unsigned opt;
@@ -70,7 +70,7 @@ int seq_main(int argc, char **argv)
while (1) {
char *dot = strchrnul(*argv, '.');
int w = (dot - *argv);
- int f = strlen(dot);
+ unsigned f = strlen(dot);
if (width < w)
width = w;
argv++;
diff --git a/coreutils/tail.c b/coreutils/tail.c
index b376ec8..96fd011 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -114,8 +114,8 @@ int tail_main(int argc, char **argv)
char *tailbuf;
size_t tailbufsize;
- unsigned header_threshhold = 1;
- unsigned nfiles;
+ int header_threshhold = 1;
+ int nfiles;
int i, opt;
int *fds;
diff --git a/editors/awk.c b/editors/awk.c
index 71abca2..51fd392 100644
--- a/editors/awk.c
+++ b/editors/awk.c
@@ -2410,15 +2410,15 @@ static var *evaluate(node *op, var *res)
v1 = nvalloc(2);
while (op) {
- struct {
+ static struct {
var *v;
const char *s;
- } L = L; /* for compiler */
- struct {
+ } L;
+ static struct {
var *v;
const char *s;
- } R = R;
- double L_d = L_d;
+ } R;
+ static double L_d;
uint32_t opinfo;
int opn;
node *op1;
@@ -2645,7 +2645,7 @@ static var *evaluate(node *op, var *res)
copyvar(v, arg);
v->type |= VF_CHILD;
v->x.parent = arg;
- if (++v - vbeg >= op->r.f->nargs)
+ if (++v - vbeg >= (int) op->r.f->nargs)
break;
}
@@ -2703,7 +2703,7 @@ static var *evaluate(node *op, var *res)
/* simple builtins */
case XC( OC_FBLTIN ): {
- double R_d = R_d; /* for compiler */
+ static double R_d;
switch (opn) {
case F_in:
@@ -2914,7 +2914,7 @@ static var *evaluate(node *op, var *res)
}
case XC( OC_COMPARE ): {
- int i = i; /* for compiler */
+ static int i;
double Ld;
if (is_numeric(L.v) && is_numeric(R.v)) {
diff --git a/editors/diff.c b/editors/diff.c
index 2a89806..70c6f67 100644
--- a/editors/diff.c
+++ b/editors/diff.c
@@ -448,7 +448,7 @@ static NOINLINE int *create_J(FILE_and_pos_t ft[2], int nlen[2], off_t *ix[2])
for (i = 0; i < 2; i++) {
unsigned hash;
token_t tok;
- size_t sz = 100;
+ int sz = 100;
nfile[i] = xmalloc((sz + 3) * sizeof(nfile[i][0]));
/* ft gets here without the correct position, cant use seek_ft */
ft[i].ft_pos = 0;
diff --git a/editors/vi.c b/editors/vi.c
index b4ad12e..5245aca 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -280,7 +280,7 @@ struct globals {
int last_file_modified; // = -1;
int save_argc; // how many file names on cmd line
int cmdcnt; // repetition count
- unsigned rows, columns; // the terminal screen is this size
+ int rows, columns; // the terminal screen is this size
#if ENABLE_FEATURE_VI_ASK_TERMINAL
int get_rowcol_error;
#endif
@@ -648,7 +648,9 @@ static int init_text_buffer(char *fn)
#if ENABLE_FEATURE_VI_WIN_RESIZE
static int query_screen_dimensions(void)
{
- int err = get_terminal_width_height(STDIN_FILENO, &columns, &rows);
+ unsigned c, r;
+ int err = get_terminal_width_height(STDIN_FILENO, &c, &r);
+ columns = c; rows = r;
if (rows > MAX_SCR_ROWS)
rows = MAX_SCR_ROWS;
if (columns > MAX_SCR_COLS)
@@ -2084,7 +2086,7 @@ static uintptr_t text_hole_make(char *p, int size) // at "p", make a 'size' byte
p += bias;
#if ENABLE_FEATURE_VI_YANKMARK
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(mark); i++)
if (mark[i])
mark[i] += bias;
diff --git a/findutils/find.c b/findutils/find.c
index 70b193c..ce0b0ed 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -376,7 +376,7 @@ IF_FEATURE_FIND_PRUNE( ACTS(prune))
IF_FEATURE_FIND_DELETE( ACTS(delete))
IF_FEATURE_FIND_EXEC( ACTS(exec, char **exec_argv; unsigned *subst_count; int exec_argc;))
IF_FEATURE_FIND_GROUP( ACTS(group, gid_t gid;))
-IF_FEATURE_FIND_LINKS( ACTS(links, char links_char; int links_count;))
+IF_FEATURE_FIND_LINKS( ACTS(links, char links_char; unsigned links_count;))
struct globals {
IF_FEATURE_FIND_XDEV(dev_t *xdev_dev;)
@@ -550,7 +550,7 @@ ACTF(regex)
#if ENABLE_FEATURE_FIND_TYPE
ACTF(type)
{
- return ((statbuf->st_mode & S_IFMT) == ap->type_mask);
+ return ((statbuf->st_mode & S_IFMT) == (unsigned) ap->type_mask);
}
#endif
#if ENABLE_FEATURE_FIND_PERM
@@ -595,7 +595,7 @@ ACTF(mmin)
#if ENABLE_FEATURE_FIND_NEWER
ACTF(newer)
{
- return (ap->newer_mtime < statbuf->st_mtime);
+ return ((time_t) ap->newer_mtime < (time_t) statbuf->st_mtime);
}
#endif
#if ENABLE_FEATURE_FIND_INUM
diff --git a/findutils/grep.c b/findutils/grep.c
index f14d6e6..78be704 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -337,7 +337,7 @@ static int grep_file(FILE *file)
#endif
) {
llist_t *pattern_ptr = pattern_head;
- grep_list_data_t *gl = gl; /* for gcc */
+ static grep_list_data_t *gl;
linenum++;
found = 0;
@@ -650,7 +650,7 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
lines_before = 0;
lines_after = 0;
} else if (lines_before > 0) {
- if (lines_before > INT_MAX / sizeof(long long))
+ if ((unsigned) lines_before > (unsigned) (INT_MAX / sizeof(long long)))
lines_before = INT_MAX / sizeof(long long);
/* overflow in (lines_before * sizeof(x)) is prevented (above) */
before_buf = xzalloc(lines_before * sizeof(before_buf[0]));
diff --git a/include-full/autoconf.h b/include-full/autoconf.h
index 27a07da..ff5919a 100644
--- a/include-full/autoconf.h
+++ b/include-full/autoconf.h
@@ -1,8 +1,8 @@
/*
* Automatically generated C config: don't edit
- * Busybox version: 1.20.0-ics
+ * Busybox version: 1.20.0-cm9
*/
-#define AUTOCONF_TIMESTAMP "2012-04-23 18:24 +0200"
+#define AUTOCONF_TIMESTAMP "2012-05-06 01:47 +0200"
#define CONFIG_HAVE_DOT_CONFIG 1
#define ENABLE_HAVE_DOT_CONFIG 1
diff --git a/include-minimal/autoconf.h b/include-minimal/autoconf.h
index 5cec24d..473c9e7 100644
--- a/include-minimal/autoconf.h
+++ b/include-minimal/autoconf.h
@@ -1,8 +1,8 @@
/*
* Automatically generated C config: don't edit
- * Busybox version: 1.20.0-ics
+ * Busybox version: 1.20.0-cm9
*/
-#define AUTOCONF_TIMESTAMP "2012-04-23 18:03 +0200"
+#define AUTOCONF_TIMESTAMP "2012-05-06 01:46 +0200"
#define CONFIG_HAVE_DOT_CONFIG 1
#define ENABLE_HAVE_DOT_CONFIG 1
diff --git a/include/android.h b/include/android.h
index 024221e..8599416 100644
--- a/include/android.h
+++ b/include/android.h
@@ -34,9 +34,10 @@ int stime(time_t *) 25
int swapon(const char *, int) 87
int swapoff(const char *) 115
*/
-int stime (time_t *);
-int swapon (const char *, int);
-int swapoff (const char *);
+int stime(time_t *);
+int swapon(const char *, int);
+int swapoff(const char *);
+int getsid(pid_t);
/* local definition in libbb/xfuncs_printf.c */
int fdprintf(int fd, const char *format, ...);
diff --git a/include/libbb.h b/include/libbb.h
index 8b09f5a..a38ecf2 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1465,9 +1465,9 @@ typedef struct line_input_t {
int flags;
const char *path_lookup;
# if MAX_HISTORY
- int cnt_history;
- int cur_history;
- int max_history; /* must never be <= 0 */
+ unsigned cnt_history;
+ unsigned cur_history;
+ unsigned max_history; /* must never be <= 0 */
# if ENABLE_FEATURE_EDITING_SAVEHISTORY
/* meaning of this field depends on FEATURE_EDITING_SAVE_ON_EXIT:
* if !FEATURE_EDITING_SAVE_ON_EXIT: "how many lines are
diff --git a/libbb/fgets_str.c b/libbb/fgets_str.c
index 89210a3..de99e5d 100644
--- a/libbb/fgets_str.c
+++ b/libbb/fgets_str.c
@@ -15,8 +15,8 @@ static char *xmalloc_fgets_internal(FILE *file, const char *terminating_string,
char *linebuf = NULL;
const int term_length = strlen(terminating_string);
int end_string_offset;
- int linebufsz = 0;
- int idx = 0;
+ size_t linebufsz = 0;
+ size_t idx = 0;
int ch;
size_t maxsz = *maxsz_p;
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index db84167..1a43b17 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -125,7 +125,7 @@ struct lineedit_statics {
unsigned cmdedit_y; /* pseudoreal y (row) terminal position */
unsigned cmdedit_prmt_len; /* length of prompt (without colors etc) */
- unsigned cursor;
+ int cursor;
int command_len; /* must be signed */
/* signed maxsize: we want x in "if (x > S.maxsize)"
* to _not_ be promoted to unsigned */
@@ -217,7 +217,7 @@ static size_t load_string(const char *src)
return len;
} else {
unsigned i = 0;
- while (src[i] && i < S.maxsize - 1) {
+ while (src[i] && i < (unsigned) S.maxsize - 1) {
command_ps[i] = src[i];
i++;
}
@@ -441,7 +441,7 @@ static void put_prompt(void)
/* (optimized for slow terminals) */
static void input_backward(unsigned num)
{
- if (num > cursor)
+ if (num > (unsigned) cursor)
num = cursor;
if (num == 0)
return;
@@ -496,7 +496,7 @@ static void input_backward(unsigned num)
* A simpler thing to do is to redraw everything from the start
* up to new cursor position (which is already known):
*/
- unsigned sv_cursor;
+ int sv_cursor;
/* go to 1st column; go up to first line */
printf("\r" ESC"[%uA", cmdedit_y);
cmdedit_y = 0;
@@ -1072,7 +1072,7 @@ static NOINLINE void input_tab(smallint *lastWasTab)
char *match_buf;
size_t len_found;
/* Length of string used for matching */
- unsigned match_pfx_len = match_pfx_len;
+ unsigned match_pfx_len = 0;
int find_type;
# if ENABLE_UNICODE_SUPPORT
/* cursor pos in command converted to multibyte form */
@@ -1409,7 +1409,8 @@ void save_history(line_input_t *st)
fp = fopen(st->hist_file, "a");
if (fp) {
- int i, fd;
+ int fd;
+ unsigned i;
char *new_name;
line_input_t *st_temp;
@@ -1478,7 +1479,7 @@ static void save_history(char *str)
fd = open(new_name, O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd >= 0) {
FILE *fp;
- int i;
+ unsigned i;
fp = xfdopen_for_write(fd);
for (i = 0; i < st_temp->cnt_history; i++)
@@ -1499,7 +1500,7 @@ static void save_history(char *str)
static void remember_in_history(char *str)
{
- int i;
+ unsigned i;
if (!(state->flags & DO_HISTORY))
return;
@@ -1885,7 +1886,7 @@ static void cmdedit_setwidth(unsigned w, int redraw_flg)
cmdedit_termw = w;
if (redraw_flg) {
/* new y for current cursor */
- int new_y = (cursor + cmdedit_prmt_len) / w;
+ unsigned new_y = (cursor + cmdedit_prmt_len) / w;
/* redraw */
redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor);
fflush_all();
@@ -1936,7 +1937,7 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
S.sent_ESC_br6n = 0;
if (cursor == 0) { /* otherwise it may be bogus */
int col = ((ic >> 32) & 0x7fff) - 1;
- if (col > cmdedit_prmt_len) {
+ if (col > (int) cmdedit_prmt_len) {
cmdedit_x += (col - cmdedit_prmt_len);
while (cmdedit_x >= cmdedit_termw) {
cmdedit_x -= cmdedit_termw;
diff --git a/libbb/parse_config.c b/libbb/parse_config.c
index 1590d9a..e3840dc 100644
--- a/libbb/parse_config.c
+++ b/libbb/parse_config.c
@@ -122,7 +122,7 @@ static int get_line_with_continuation(parser_t *parser)
if (nlen <= 0)
break;
- if (parser->line_alloc < len + nlen + 1) {
+ if ((ssize_t)parser->line_alloc < len + nlen + 1) {
parser->line_alloc = len + nlen + 1;
line = parser->line = xrealloc(line, parser->line_alloc);
}
diff --git a/libbb/time.c b/libbb/time.c
index e2b9384..3778a2d 100644
--- a/libbb/time.c
+++ b/libbb/time.c
@@ -140,15 +140,15 @@ void FAST_FUNC parse_datestr(const char *date_str, struct tm *ptm)
&end) >= 5) {
/* Adjust month from 1-12 to 0-11 */
ptm->tm_mon -= 1;
- if ((int)cur_year >= 50) { /* >= 1950 */
+ if (cur_year >= 50) { /* >= 1950 */
/* Adjust year: */
/* 1. Put it in the current century */
ptm->tm_year += (cur_year / 100) * 100;
/* 2. If too far in the past, +100 years */
- if (ptm->tm_year < cur_year - 50)
+ if (ptm->tm_year < (int) cur_year - 50)
ptm->tm_year += 100;
/* 3. If too far in the future, -100 years */
- if (ptm->tm_year > cur_year + 50)
+ if (ptm->tm_year > (int) cur_year + 50)
ptm->tm_year -= 100;
}
} else
diff --git a/miscutils/crond.c b/miscutils/crond.c
index a0b73c7..4036986 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -922,7 +922,7 @@ int crond_main(int argc UNUSED_PARAM, char **argv)
*/
if (stat(G.crontab_dir_name, &sbuf) != 0)
sbuf.st_mtime = 0; /* force update (once) if dir was deleted */
- if (G.crontab_dir_mtime != sbuf.st_mtime) {
+ if ((time_t) G.crontab_dir_mtime != (time_t) sbuf.st_mtime) {
G.crontab_dir_mtime = sbuf.st_mtime;
rescan = 1;
}
diff --git a/miscutils/devmem.c b/miscutils/devmem.c
index 786a21b..ecd8738 100644
--- a/miscutils/devmem.c
+++ b/miscutils/devmem.c
@@ -19,7 +19,7 @@ int devmem_main(int argc UNUSED_PARAM, char **argv)
{
void *map_base, *virt_addr;
uint64_t read_result;
- uint64_t writeval = writeval; /* for compiler */
+ uint64_t writeval = 0;
off_t target;
unsigned page_size, mapped_size, offset_in_page;
int fd;
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index a2d3563..a657df5 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -296,7 +296,7 @@ static void fb_drawprogressbar(unsigned percent)
pos_x = left_x;
if (percent > 0) {
int y;
- unsigned i;
+ int i;
// actual progress bar
pos_x += (unsigned)(width * percent) / 100;
@@ -444,7 +444,7 @@ int fbsplash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int fbsplash_main(int argc UNUSED_PARAM, char **argv)
{
const char *fb_device, *cfg_filename, *fifo_filename;
- FILE *fp = fp; // for compiler
+ FILE *fp = NULL;
char *num_buf;
unsigned num;
bool bCursorOff;
diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c
index 1fefd95..f0d9595 100644
--- a/miscutils/flash_lock_unlock.c
+++ b/miscutils/flash_lock_unlock.c
@@ -62,7 +62,7 @@ int flash_lock_unlock_main(int argc UNUSED_PARAM, char **argv)
sectors = info.size / info.erasesize;
} else {
// isn't this useless?
- unsigned long num = info.size / info.erasesize;
+ long num = info.size / info.erasesize;
if (sectors > num) {
bb_error_msg_and_die("%ld are too many "
"sectors, device only has "
diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c
index 790f9c0..9805395 100644
--- a/miscutils/flashcp.c
+++ b/miscutils/flashcp.c
@@ -48,7 +48,7 @@ int flashcp_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int flashcp_main(int argc UNUSED_PARAM, char **argv)
{
int fd_f, fd_d; /* input file and mtd device file descriptors */
- int i;
+ unsigned i;
uoff_t erase_count;
unsigned opts;
struct mtd_info_user mtd;
@@ -134,7 +134,7 @@ int flashcp_main(int argc UNUSED_PARAM, char **argv)
int ret;
errno = 0;
ret = full_write(fd_d, buf, count);
- if (ret != count) {
+ if (ret != (int) count) {
bb_perror_msg_and_die("write error at 0x%"OFF_FMT"x on %s, "
"write returned %d",
done, devicename, ret);
diff --git a/miscutils/less.c b/miscutils/less.c
index f0187bf..5f44eb4 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -335,7 +335,7 @@ static void re_wrap(void)
dst_idx++;
if (new_line_pos < w) {
/* if we came here thru "goto next_new" */
- if (src_idx > max_fline)
+ if (src_idx > (int) max_fline)
break;
lineno = LINENO(s);
}
@@ -351,7 +351,7 @@ static void re_wrap(void)
new_cur_fline = dst_idx;
src_idx++;
/* no more lines? finish last new line (and exit the loop) */
- if (src_idx > max_fline)
+ if (src_idx > (int) max_fline)
goto next_new;
s = old_flines[src_idx];
if (lineno != LINENO(s)) {
@@ -1412,7 +1412,7 @@ static void add_mark(void)
static void goto_mark(void)
{
int letter;
- int i;
+ unsigned i;
print_statusline("Go to mark: ");
letter = less_getch(sizeof("Go to mark: ") - 1);
@@ -1420,11 +1420,11 @@ static void goto_mark(void)
if (isalpha(letter)) {
for (i = 0; i <= num_marks; i++)
- if (letter == mark_lines[i][0]) {
+ if ((unsigned) letter == mark_lines[i][0]) {
buffer_line(mark_lines[i][1]);
break;
}
- if (num_marks == 14 && letter != mark_lines[14][0])
+ if (num_marks == 14 && (unsigned) letter != mark_lines[14][0])
print_statusline("Mark not set");
} else
print_statusline("Invalid mark letter");
diff --git a/miscutils/nandwrite.c b/miscutils/nandwrite.c
index 2ba6e3f..5f8d033 100644
--- a/miscutils/nandwrite.c
+++ b/miscutils/nandwrite.c
@@ -199,7 +199,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
*/
break;
}
- if (cnt < meminfo_writesize) {
+ if (cnt < (ssize_t) meminfo_writesize) {
if (IS_NANDDUMP)
bb_error_msg_and_die("short read");
if (!(opts & OPT_p))
@@ -218,7 +218,7 @@ int nandwrite_main(int argc UNUSED_PARAM, char **argv)
}
mtdoffset += meminfo_writesize;
- if (cnt < meminfo_writesize)
+ if (cnt < (ssize_t) meminfo_writesize)
break;
}
diff --git a/miscutils/rx.c b/miscutils/rx.c
index af59732..304b56b 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -85,7 +85,7 @@ static int receive(/*int read_fd, */int file_fd)
int blockNo, blockNoOnesCompl;
int cksum_or_crc;
int expected;
- int i, j;
+ unsigned i, j;
blockBegin = read_byte(timeout);
if (blockBegin < 0)
@@ -109,7 +109,7 @@ static int receive(/*int read_fd, */int file_fd)
}
/* Write previously received block */
errno = 0;
- if (full_write(file_fd, blockBuf, blockLength) != blockLength) {
+ if ((unsigned) full_write(file_fd, blockBuf, blockLength) != blockLength) {
bb_perror_msg(bb_msg_write_error);
goto fatal;
}
@@ -139,7 +139,7 @@ static int receive(/*int read_fd, */int file_fd)
if (blockNoOnesCompl < 0)
goto timeout;
- if (blockNo != (255 - blockNoOnesCompl)) {
+ if (blockNo != (int) (255 - blockNoOnesCompl)) {
bb_error_msg("bad block ones compl");
goto error;
}
@@ -162,14 +162,14 @@ static int receive(/*int read_fd, */int file_fd)
goto timeout;
}
- if (blockNo == ((wantBlockNo - 1) & 0xff)) {
+ if (blockNo == (int) ((wantBlockNo - 1) & 0xff)) {
/* a repeat of the last block is ok, just ignore it. */
/* this also ignores the initial block 0 which is */
- /* meta data. */
+ /* meta data. nt)*/
blockLength = 0;
goto next;
}
- if (blockNo != (wantBlockNo & 0xff)) {
+ if (blockNo != (int) (wantBlockNo & 0xff)) {
bb_error_msg("unexpected block no, 0x%08x, expecting 0x%08x", blockNo, wantBlockNo);
goto error;
}
diff --git a/miscutils/strings.c b/miscutils/strings.c
index 9f50182..b040508 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -26,8 +26,8 @@
int strings_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int strings_main(int argc UNUSED_PARAM, char **argv)
{
- int n, c, status = EXIT_SUCCESS;
- unsigned count;
+ int c, status = EXIT_SUCCESS;
+ unsigned n, count;
off_t offset;
FILE *file;
char *string;
diff --git a/miscutils/taskset.c b/miscutils/taskset.c
index dcd4646..71ad825 100644
--- a/miscutils/taskset.c
+++ b/miscutils/taskset.c
@@ -90,7 +90,7 @@ int taskset_main(int argc UNUSED_PARAM, char **argv)
unsigned opt_p;
const char *current_new;
char *pid_str;
- char *aff = aff; /* for compiler */
+ char *aff = NULL;
/* NB: we mimic util-linux's taskset: -p does not take
* an argument, i.e., "-pN" is NOT valid, only "-p N"!
diff --git a/modutils/modinfo.c b/modutils/modinfo.c
index 9a021b3..008dfe6 100644
--- a/modutils/modinfo.c
+++ b/modutils/modinfo.c
@@ -88,7 +88,7 @@ static void modinfo(const char *path, const char *version,
free((char*)fullpath);
if (!the_module) {
// outputs system error msg
- bb_perror_msg("");
+ bb_perror_msg("\n");
return;
}
}
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c
index b3748e8..03d8e12 100644
--- a/networking/libiproute/ipaddress.c
+++ b/networking/libiproute/ipaddress.c
@@ -239,7 +239,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
if (!rta_tb[IFA_ADDRESS])
rta_tb[IFA_ADDRESS] = rta_tb[IFA_LOCAL];
- if (G_filter.ifindex && G_filter.ifindex != ifa->ifa_index)
+ if (G_filter.ifindex && G_filter.ifindex != (int) ifa->ifa_index)
return 0;
if ((G_filter.scope ^ ifa->ifa_scope) & G_filter.scopemask)
return 0;
@@ -267,7 +267,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
if (G_filter.flushb) {
struct nlmsghdr *fn;
- if (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len > G_filter.flushe) {
+ if (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len > (unsigned) G_filter.flushe) {
if (flush_update())
return -1;
}
@@ -379,8 +379,8 @@ static int print_selected_addrinfo(int ifindex, struct nlmsg_list *ainfo)
continue;
if (n->nlmsg_len < NLMSG_LENGTH(sizeof(ifa)))
return -1;
- if (ifa->ifa_index != ifindex
- || (G_filter.family && G_filter.family != ifa->ifa_family)
+ if ((int) ifa->ifa_index != ifindex
+ || (G_filter.family && G_filter.family != (family_t) ifa->ifa_family)
) {
continue;
}
@@ -529,8 +529,8 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush)
struct nlmsghdr *n = &a->h;
struct ifaddrmsg *ifa = NLMSG_DATA(n);
- if (ifa->ifa_index != ifi->ifi_index
- || (G_filter.family && G_filter.family != ifa->ifa_family)
+ if ((int) ifa->ifa_index != (int) ifi->ifi_index
+ || (G_filter.family && G_filter.family != (family_t) ifa->ifa_family)
) {
continue;
}
diff --git a/networking/libiproute/iplink.c b/networking/libiproute/iplink.c
index bad2017..8e9f1bd 100644
--- a/networking/libiproute/iplink.c
+++ b/networking/libiproute/iplink.c
@@ -279,7 +279,7 @@ static int ipaddr_list_link(char **argv)
#ifndef NLMSG_TAIL
#define NLMSG_TAIL(nmsg) \
- ((struct rtattr *) (((void *) (nmsg)) + NLMSG_ALIGN((nmsg)->nlmsg_len)))
+ ((struct rtattr *) ((size_t)((void *) (nmsg)) + (size_t) NLMSG_ALIGN((nmsg)->nlmsg_len)))
#endif
/* Return value becomes exitcode. It's okay to not return at all */
static int do_change(char **argv, const unsigned rtm)
@@ -339,7 +339,7 @@ static int do_change(char **argv, const unsigned rtm)
addattr_l(&req.n, sizeof(req), IFLA_LINKINFO, NULL, 0);
addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, type_str,
strlen(type_str));
- linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo;
+ linkinfo->rta_len = (size_t) NLMSG_TAIL(&req.n) - (size_t) linkinfo;
}
if (rtm != RTM_NEWLINK) {
if (!dev_str)
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c
index f8a67d9..03425fa 100644
--- a/networking/libiproute/iproute.c
+++ b/networking/libiproute/iproute.c
@@ -216,7 +216,7 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM,
return 0;
}
- if (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len > G_filter.flushe) {
+ if ((int) (NLMSG_ALIGN(G_filter.flushp) + n->nlmsg_len) > G_filter.flushe) {
if (flush_update())
bb_error_msg_and_die("flush");
}
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c
index d0fe306..37c8f43 100644
--- a/networking/libiproute/utils.c
+++ b/networking/libiproute/utils.c
@@ -146,7 +146,7 @@ static void get_prefix_1(inet_prefix *dst, char *arg, int family)
netmask_pfx.family = AF_UNSPEC;
plen = bb_strtou(slash + 1, NULL, 0);
- if ((errno || plen > dst->bitlen)
+ if ((errno || plen > (unsigned) dst->bitlen)
&& get_addr_1(&netmask_pfx, slash + 1, family) != 0
) {
goto bad;
@@ -162,7 +162,7 @@ static void get_prefix_1(inet_prefix *dst, char *arg, int family)
for (plen = 0; mask; mask <<= 1)
++plen;
- if (plen > dst->bitlen)
+ if (plen > (unsigned) dst->bitlen)
goto bad;
/* dst->flags |= PREFIXLEN_SPECIFIED; */
}
diff --git a/networking/nc.c b/networking/nc.c
index 1b32e3a..96807e9 100644
--- a/networking/nc.c
+++ b/networking/nc.c
@@ -105,7 +105,7 @@ int nc_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int nc_main(int argc, char **argv)
{
/* sfd sits _here_ only because of "repeat" option (-l -l). */
- int sfd = sfd; /* for gcc */
+ int sfd = 0;
int cfd = 0;
unsigned lport = 0;
IF_NOT_NC_SERVER(const) unsigned do_listen = 0;
diff --git a/networking/ntpd.c b/networking/ntpd.c
index 45f325b..df3daf0 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -984,12 +984,12 @@ select_and_cluster(void)
int size = 3 * G.peer_cnt;
/* for selection algorithm */
point_t point[size];
- unsigned num_points, num_candidates;
+ int num_points, num_candidates;
double low, high;
- unsigned num_falsetickers;
+ int num_falsetickers;
/* for cluster algorithm */
survivor_t survivor[size];
- unsigned num_survivors;
+ int num_survivors;
/* Selection */
@@ -1050,12 +1050,12 @@ select_and_cluster(void)
num_falsetickers = 0;
while (1) {
int c;
- unsigned num_midpoints = 0;
+ int num_midpoints = 0;
low = 1 << 9;
high = - (1 << 9);
c = 0;
- for (i = 0; i < num_points; i++) {
+ for (i = 0; i < (int) num_points; i++) {
/* We want to do:
* if (point[i].type == -1) c++;
* if (point[i].type == 1) c--;
@@ -1138,7 +1138,7 @@ select_and_cluster(void)
* jitter until a termination condition is met.
*/
while (1) {
- unsigned max_idx = max_idx;
+ static int max_idx;
double max_selection_jitter = max_selection_jitter;
double min_jitter = min_jitter;
diff --git a/networking/ping.c b/networking/ping.c
index d7b6fc6..f2f24e6 100644
--- a/networking/ping.c
+++ b/networking/ping.c
@@ -546,7 +546,7 @@ static void unpack_tail(int sz, uint32_t *tp,
uint16_t recv_seq, int ttl)
{
const char *dupmsg = " (DUP!)";
- unsigned triptime = triptime; /* for gcc */
+ unsigned triptime = 0;
++nreceived;
@@ -586,7 +586,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from)
int hlen;
/* discard if too short */
- if (sz < (datalen + ICMP_MINLEN))
+ if (sz < (int) (datalen + ICMP_MINLEN))
return;
/* check IP header */
@@ -601,7 +601,7 @@ static void unpack4(char *buf, int sz, struct sockaddr_in *from)
uint16_t recv_seq = ntohs(icmppkt->icmp_seq);
uint32_t *tp = NULL;
- if (sz >= ICMP_MINLEN + sizeof(uint32_t))
+ if (sz >= (int) (ICMP_MINLEN + sizeof(uint32_t)))
tp = (uint32_t *) icmppkt->icmp_data;
unpack_tail(sz, tp,
inet_ntoa(*(struct in_addr *) &from->sin_addr.s_addr),
diff --git a/networking/telnetd.c b/networking/telnetd.c
index 33020f1..06b8d4d 100644
--- a/networking/telnetd.c
+++ b/networking/telnetd.c
@@ -488,8 +488,8 @@ int telnetd_main(int argc UNUSED_PARAM, char **argv)
struct tsession *ts;
#if ENABLE_FEATURE_TELNETD_STANDALONE
#define IS_INETD (opt & OPT_INETD)
- int master_fd = master_fd; /* for compiler */
- int sec_linger = sec_linger;
+ int master_fd = 0;
+ int sec_linger = 0;
char *opt_bindaddr = NULL;
char *opt_portnbr;
#else
diff --git a/networking/tftp.c b/networking/tftp.c
index ce48a1e..9cafc08 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -380,7 +380,7 @@ static int tftp_protocol(
/* add filename and mode */
/* fill in packet if the filename fits into xbuf */
len = strlen(remote_file) + 1;
- if (2 + len + sizeof("octet") >= io_bufsize) {
+ if (2 + len + sizeof("octet") >= (uint32_t) io_bufsize) {
bb_error_msg("remote filename is too long");
goto ret;
}
@@ -799,7 +799,7 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv)
error_msg = "malformed packet";
opcode = ntohs(*(uint16_t*)block_buf);
- if (result < 4 || result >= sizeof(block_buf)
+ if (result < 4 || result >= (int) sizeof(block_buf)
|| block_buf[result-1] != '\0'
|| (IF_FEATURE_TFTP_PUT(opcode != TFTP_RRQ) /* not download */
IF_GETPUT(&&)
diff --git a/procps/kill.c b/procps/kill.c
index cd189bc..cb129ac 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -196,7 +196,7 @@ int kill_main(int argc, char **argv)
ret = 1;
goto resume;
}
- if (p->pid == omit)
+ if ((pid_t) p->pid == (pid_t) omit)
goto dont_kill;
}
kill(p->pid, signo);
diff --git a/procps/lsof.c b/procps/lsof.c
index 7e0ffa4..ee39ddb 100644
--- a/procps/lsof.c
+++ b/procps/lsof.c
@@ -54,7 +54,7 @@ int lsof_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
char *fdlink;
struct dirent *entry;
- if (getpid() == proc->pid)
+ if ((pid_t) getpid() == (pid_t) proc->pid)
continue;
baseofs = sprintf(name, "/proc/%u/fd/", proc->pid);
diff --git a/procps/mpstat.c b/procps/mpstat.c
index aa5a5c7..bef3909 100644
--- a/procps/mpstat.c
+++ b/procps/mpstat.c
@@ -85,7 +85,7 @@ struct stats_irq {
struct globals {
int interval;
int count;
- unsigned cpu_nr; /* Number of CPUs */
+ int cpu_nr; /* Number of CPUs */
unsigned irqcpu_nr; /* Number of interrupts per CPU */
unsigned softirqcpu_nr; /* Number of soft interrupts per CPU */
unsigned options;
@@ -167,7 +167,7 @@ static ALWAYS_INLINE data_t jiffies_diff(data_t old, data_t new)
return (diff == 0) ? 1 : diff;
}
-static int is_cpu_in_bitmap(unsigned cpu)
+static int is_cpu_in_bitmap(int cpu)
{
return G.cpu_bitmap[cpu >> 3] & (1 << (cpu & 7));
}
@@ -179,7 +179,8 @@ static void write_irqcpu_stats(struct stats_irqcpu *per_cpu_stats[],
const char *prev_str, const char *current_str)
{
int j;
- int offset, cpu;
+ int offset;
+ int cpu;
struct stats_irqcpu *p0, *q0;
/* Check if number of IRQs has changed */
@@ -462,7 +463,7 @@ static void get_cpu_statistics(struct stats_cpu *cpu, data_t *up, data_t *up0)
while (fgets(buf, sizeof(buf), fp)) {
data_t sum;
- unsigned cpu_number;
+ int cpu_number;
struct stats_cpu *cp;
if (!starts_with_cpu(buf))
@@ -549,8 +550,8 @@ static void get_irqs_from_interrupts(const char *fname,
struct stats_irqcpu *ic;
char *buf;
unsigned buflen;
- unsigned cpu;
- unsigned irq;
+ int cpu;
+ int irq;
int cpu_index[G.cpu_nr];
int iindex;
@@ -605,7 +606,7 @@ static void get_irqs_from_interrupts(const char *fname,
ic = &per_cpu_stats[current][irq];
len = cp - buf;
- if (len >= sizeof(ic->irq_name)) {
+ if (len >= (int) sizeof(ic->irq_name)) {
len = sizeof(ic->irq_name) - 1;
}
safe_strncpy(ic->irq_name, buf, len + 1);
@@ -672,7 +673,7 @@ static void alarm_handler(int sig UNUSED_PARAM)
static void main_loop(void)
{
unsigned current;
- unsigned cpus;
+ int cpus;
/* Read the stats */
if (G.cpu_nr > 1) {
@@ -816,7 +817,7 @@ static int get_irqcpu_nr(const char *f, int max_irqs)
FILE *fp;
char *line;
unsigned linelen;
- unsigned irq;
+ int irq;
fp = fopen_for_read(f);
if (!fp) /* No interrupts file */
@@ -939,7 +940,7 @@ int mpstat_main(int UNUSED_PARAM argc, char **argv)
memset(G.cpu_bitmap, 0xff, G.cpu_bitmap_len);
} else {
/* Get CPU number */
- unsigned n = xatoi_positive(t);
+ int n = xatoi_positive(t);
if (n >= G.cpu_nr)
bb_error_msg_and_die("not that many processors");
n++;
diff --git a/procps/pgrep.c b/procps/pgrep.c
index dc7ffff..044f553 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -150,9 +150,9 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
}
}
- if (ppid2match >= 0 && ppid2match != proc->ppid)
+ if (ppid2match >= 0 && (pid_t) ppid2match != (pid_t) proc->ppid)
continue;
- if (sid2match >= 0 && sid2match != proc->sid)
+ if (sid2match >= 0 && sid2match != (int) proc->sid)
continue;
/* NB: OPT_INVERT is always 0 or 1 */
diff --git a/procps/ps.c b/procps/ps.c
index 4727b21..3690305 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -634,7 +634,7 @@ int ps_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
OPT_l = (1 << ENABLE_SELINUX) * (1 << ENABLE_FEATURE_SHOW_THREADS) * ENABLE_FEATURE_PS_LONG,
};
#if ENABLE_FEATURE_PS_LONG
- time_t now = now;
+ time_t now = 0;
struct sysinfo info;
#endif
int opts = 0;
diff --git a/procps/pstree.c b/procps/pstree.c
index 8ba3079..934fb6e 100644
--- a/procps/pstree.c
+++ b/procps/pstree.c
@@ -87,7 +87,7 @@ struct globals {
*/
static void ensure_buffer_capacity(int bufindex)
{
- if (bufindex >= G.capacity) {
+ if (bufindex > 0 && (unsigned) bufindex >= G.capacity) {
G.capacity += 0x100;
G.width = xrealloc(G.width, G.capacity * sizeof(G.width[0]));
G.more = xrealloc(G.more, G.capacity * sizeof(G.more[0]));
diff --git a/scripts/Makefile.host b/scripts/Makefile.host
index 2e62850..484d446 100644
--- a/scripts/Makefile.host
+++ b/scripts/Makefile.host
@@ -89,8 +89,8 @@ __hostc_flags = -I$(obj) $(call flags,_hostc_flags)
__hostcxx_flags = -I$(obj) $(call flags,_hostcxx_flags)
endif
-hostc_flags = -Wp,-MD,$(depfile) $(__hostc_flags)
-hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags)
+hostc_flags = -Wp,-Wno-unused-result,-MD,$(depfile) $(__hostc_flags)
+hostcxx_flags = -Wp,-Wno-unused-result,-MD,$(depfile) $(__hostcxx_flags)
#####
# Compile programs on the host
diff --git a/shell/ash.c b/shell/ash.c
index 1e1a229..3a258b9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -2225,10 +2225,10 @@ setvar(const char *name, const char *val, int flags)
INT_OFF;
nameeq = ckmalloc(namelen + vallen + 2);
- p = memcpy(nameeq, name, namelen) + namelen;
+ p = (char*) ((uint32_t) memcpy(nameeq, name, namelen) + namelen);
if (val) {
*p++ = '=';
- p = memcpy(p, val, vallen) + vallen;
+ p = (char*) ((uint32_t) memcpy(p, val, vallen) + vallen);
}
*p = '\0';
setvareq(nameeq, flags | VNOSAVE);
@@ -6363,7 +6363,7 @@ subevalvar(char *p, char *varname, int strloc, int subtype,
#if ENABLE_ASH_BASH_COMPAT
case VSSUBSTR:
- loc = str = stackblock() + strloc;
+ loc = str = (char*) ((uint32_t) stackblock() + strloc);
/* Read POS in ${var:POS:LEN} */
pos = atoi(loc); /* number(loc) errors out on "1:4" */
len = str - startp - 1;
diff --git a/util-linux/mount.c b/util-linux/mount.c
index ca04de7..34543bb 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -898,7 +898,7 @@ static char *nfs_strerror(int status)
{
int i;
- for (i = 0; i < ARRAY_SIZE(nfs_err_stat); i++) {
+ for (i = 0; i < (int) ARRAY_SIZE(nfs_err_stat); i++) {
if (nfs_err_stat[i] == status)
return strerror(nfs_err_errnum[i]);
}