Permalink
Browse files

fix most sign and variable initialization warnings

and minor sync with ics branch (fbsplash/adjtimex/ntpd)

Change-Id: I56e08db791152a9c95fc0d16bc75b702e403274b
  • Loading branch information...
1 parent 9794688 commit d4b20a23d963c8f7e801c895f741c1907ed316af @tpruvot tpruvot committed May 5, 2012
Showing with 175 additions and 162 deletions.
  1. +6 −7 Android.mk
  2. +1 −0 android/regex/cs_config.h
  3. +24 −22 android/regex/regex.c
  4. +1 −1 applets/usage_pod.c
  5. +1 −1 archival/libarchive/bz/blocksort.c
  6. +1 −1 archival/libarchive/data_extract_all.c
  7. +2 −2 archival/libarchive/decompress_bunzip2.c
  8. +2 −2 archival/libarchive/decompress_gunzip.c
  9. +1 −1 archival/unzip.c
  10. +1 −1 coreutils/cal.c
  11. +2 −2 coreutils/expr.c
  12. +1 −1 coreutils/ls.c
  13. +2 −2 coreutils/seq.c
  14. +2 −2 coreutils/tail.c
  15. +8 −8 editors/awk.c
  16. +1 −1 editors/diff.c
  17. +5 −3 editors/vi.c
  18. +3 −3 findutils/find.c
  19. +2 −2 findutils/grep.c
  20. +1 −1 include-full/autoconf.h
  21. +1 −1 include-minimal/autoconf.h
  22. +4 −3 include/android.h
  23. +3 −3 include/libbb.h
  24. +2 −2 libbb/fgets_str.c
  25. +11 −10 libbb/lineedit.c
  26. +1 −1 libbb/parse_config.c
  27. +3 −3 libbb/time.c
  28. +1 −0 miscutils/adjtimex.c
  29. +1 −1 miscutils/crond.c
  30. +1 −1 miscutils/devmem.c
  31. +5 −5 miscutils/fbsplash.c
  32. +2 −2 miscutils/fbsplash.cfg
  33. +1 −1 miscutils/flash_lock_unlock.c
  34. +2 −2 miscutils/flashcp.c
  35. +5 −5 miscutils/less.c
  36. +2 −2 miscutils/nandwrite.c
  37. +6 −6 miscutils/rx.c
  38. +2 −2 miscutils/strings.c
  39. +5 −1 miscutils/taskset.c
  40. +1 −1 modutils/modinfo.c
  41. +6 −6 networking/libiproute/ipaddress.c
  42. +2 −2 networking/libiproute/iplink.c
  43. +1 −1 networking/libiproute/iproute.c
  44. +2 −2 networking/libiproute/utils.c
  45. +1 −1 networking/nc.c
  46. +7 −6 networking/ntpd.c
  47. +3 −3 networking/ping.c
  48. +2 −2 networking/telnetd.c
  49. +2 −2 networking/tftp.c
  50. +1 −1 procps/kill.c
  51. +1 −1 procps/lsof.c
  52. +11 −10 procps/mpstat.c
  53. +2 −2 procps/pgrep.c
  54. +1 −1 procps/ps.c
  55. +1 −1 procps/pstree.c
  56. +2 −2 scripts/Makefile.host
  57. +3 −3 shell/ash.c
  58. +1 −1 util-linux/mount.c
View
@@ -9,6 +9,7 @@ BIONIC_ICS := false
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)
@@ -25,12 +26,13 @@ include $(CLEAR_VARS)
# Each profile require a compressed usage/config, outside the source tree for git history
# We keep the uncompressed headers in local include-<profile> to track config changes.
+# TODO: generate includes in out/
-BB_INCLUDES_OUT := $(TARGET_OUT_INTERMEDIATES)/include
-$(BB_INCLUDES_OUT):
- mkdir -p $(ANDROID_BUILD_TOP)/$(BB_INCLUDES_OUT)
+# BB_INCLUDES_OUT := $(TARGET_OUT_INTERMEDIATES)/include
+# $(BB_INCLUDES_OUT):
+# mkdir -p $(ANDROID_BUILD_TOP)/$(BB_INCLUDES_OUT)
-# Execute make clean, make prepare and copy profiles required for normal & static busybox (recovery)
+# Execute make clean, make prepare and copy profiles required for normal & static lib (recovery)
KERNEL_MODULES_DIR ?= /system/lib/modules
BUSYBOX_CONFIG := minimal full
@@ -43,8 +45,6 @@ $(BUSYBOX_CONFIG):
@#cp $(BB_PATH)/.config $(BB_PATH)/.config-$@
@mkdir -p $(BB_PATH)/include-$@
cp $(BB_PATH)/include/*.h $(BB_PATH)/include-$@/
- @mkdir -p $(BB_INCLUDES_OUT)/busybox-$@
- @cp $(BB_PATH)/include/*.h $(BB_INCLUDES_OUT)/busybox-$@/
@rm $(BB_PATH)/include/usage_compressed.h
@rm $(BB_PATH)/include/autoconf.h
@rm -f $(BB_PATH)/.config-old
@@ -86,7 +86,6 @@ ifeq ($(TARGET_ARCH),mips)
endif
BUSYBOX_C_INCLUDES = \
- $(BB_INCLUDES_OUT)/busybox-$(BUSYBOX_CONFIG) \
$(BB_PATH)/include-$(BUSYBOX_CONFIG) \
$(BB_PATH)/include $(BB_PATH)/libbb \
bionic/libc/private \
@@ -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 ? */
View
@@ -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 */
View
@@ -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");
@@ -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;*/
@@ -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)
) {
@@ -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;
}
@@ -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 */
View
@@ -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");
View
@@ -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) {
View
@@ -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 */
View
@@ -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 +
View
@@ -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++;
View
@@ -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;
View
@@ -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)) {
Oops, something went wrong.

0 comments on commit d4b20a2

Please sign in to comment.