Some are fixing real bugs.
function old new delta
syslogd_main 938 958 +20
get_signum 136 143 +7
obj_load 777 782 +5
recv_from_to 210 214 +4
get_next_block 1795 1799 +4
display_topmem_process_list 1117 1121 +4
logread_main 484 487 +3
buffer_fill_and_print 73 76 +3
kill_main 687 689 +2
ll_remember_index 240 241 +1
do_stats 452 453 +1
if_readconf 166 165 -1
display_process_list 1192 1191 -1
run_applet_and_exit 507 505 -2
print_signames 33 31 -2
parse_one_line 1092 1090 -2
find_out_spec 57 55 -2
add_ksymoops_symbols 421 419 -2
ash_main 1407 1402 -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 11/8 up/down: 54/-17) Total: 37 bytes
ssize_t size;
size = full_read(archive_handle->src_fd, buf, count);
- if (size != 0 && size != count) {
+ if (size != 0 && size != (ssize_t)count) {
bb_error_msg_and_die("short read: %u of %u",
(unsigned)size, (unsigned)count);
}
/* If we need to get more data from the byte buffer, do so. (Loop getting
one byte at a time to enforce endianness and avoid unaligned access.) */
- while (bd->inbufBitCount < bits_wanted) {
+ while ((int)(bd->inbufBitCount) < bits_wanted) {
/* If we need to read more data from file into byte buffer, do so */
if (get_bits(bd, 1)) return RETVAL_OBSOLETE_INPUT;
origPtr = get_bits(bd, 24);
- if (origPtr > dbufSize) return RETVAL_DATA_ERROR;
+ if ((int)origPtr > dbufSize) return RETVAL_DATA_ERROR;
/* mapping table: if some byte values are never used (encoding things
like ascii text), the compression code removes the gaps to have fewer
j = get_bits(bd, hufGroup->maxLen);
*/
- while (bd->inbufBitCount < hufGroup->maxLen) {
+ while ((int)(bd->inbufBitCount) < hufGroup->maxLen) {
if (bd->inbufPos == bd->inbufCount) {
j = get_bits(bd, hufGroup->maxLen);
goto got_huff_bits;
it doesn't qualify as a run (hence writeRunCountdown=5). */
if (dbufCount) {
- if (origPtr >= dbufCount) return RETVAL_DATA_ERROR;
+ if ((int)origPtr >= dbufCount) return RETVAL_DATA_ERROR;
bd->writePos = dbuf[origPtr];
bd->writeCurrent = (unsigned char)(bd->writePos & 0xff);
bd->writePos >>= 8;
if (buffer_pos == header.dict_size) {
buffer_pos = 0;
global_pos += header.dict_size;
- if (full_write(dst_fd, buffer, header.dict_size) != header.dict_size)
+ if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
goto bad;
USE_DESKTOP(total_written += header.dict_size;)
}
if (buffer_pos == header.dict_size) {
buffer_pos = 0;
global_pos += header.dict_size;
- if (full_write(dst_fd, buffer, header.dict_size) != header.dict_size)
+ if (full_write(dst_fd, buffer, header.dict_size) != (ssize_t)header.dict_size)
goto bad;
USE_DESKTOP(total_written += header.dict_size;)
}
}
}
- if (full_write(dst_fd, buffer, buffer_pos) != buffer_pos) {
+ if (full_write(dst_fd, buffer, buffer_pos) != (ssize_t)buffer_pos) {
bad:
rc_free(rc);
return -1;
/* Two callsites, both in inflate_get_next_window */
static void calculate_gunzip_crc(STATE_PARAM_ONLY)
{
- int n;
+ unsigned n;
for (n = 0; n < gunzip_outbuf_count; n++) {
gunzip_crc = gunzip_crc_table[((int) gunzip_crc ^ (gunzip_window[n])) & 0xff] ^ (gunzip_crc >> 8);
}
while (1) {
int r = inflate_get_next_window(PASS_STATE_ONLY);
nwrote = full_write(out, gunzip_window, gunzip_outbuf_count);
- if (nwrote != gunzip_outbuf_count) {
+ if (nwrote != (ssize_t)gunzip_outbuf_count) {
bb_perror_msg("write");
n = -1;
goto ret;
{
int count = bytebuffer_size - bytebuffer_offset;
- if (count < n) {
+ if (count < (int)n) {
memmove(bytebuffer, &bytebuffer[bytebuffer_offset], count);
bytebuffer_offset = 0;
bytebuffer_size = full_read(gunzip_src_fd, &bytebuffer[count], bytebuffer_max - count);
#undef isdigit
#define isdigit(a) ((unsigned)((a) - '0') <= 9)
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
#if __GNUC_PREREQ(4,1)
int (*lf)(const char *, const char *);
char *fpc;
- int i;
+ unsigned i;
int rc;
lf = link;
{
bb_putchar(c);
}
- if (++cmdedit_x >= cmdedit_termw) {
+ if (++cmdedit_x >= (int)cmdedit_termw) {
/* terminal is scrolled down */
cmdedit_y++;
cmdedit_x = 0;
exe_n_cwd_tab_completion(matchBuf, find_type);
/* Sort, then remove any duplicates found */
if (matches) {
- int i, n = 0;
+ unsigned i;
+ int n = 0;
qsort_string_vector(matches, num_matches);
for (i = 0; i < num_matches - 1; ++i) {
if (matches[i] && matches[i+1]) { /* paranoia */
int get_signum(const char *name)
{
- int i;
+ unsigned i;
i = bb_strtou(name, NULL, 10);
if (!errno)
return i;
if (strncasecmp(name, "SIG", 3) == 0)
name += 3;
- for (i = 0; (size_t)i < ARRAY_SIZE(signals); i++)
+ for (i = 0; i < ARRAY_SIZE(signals); i++)
if (strcasecmp(name, signals[i]) == 0)
return i;
void print_signames(void)
{
- int signo;
+ unsigned signo;
- for (signo = 1; (size_t)signo < ARRAY_SIZE(signals); signo++) {
+ for (signo = 1; signo < ARRAY_SIZE(signals); signo++) {
const char *name = signals[signo];
if (name[0])
puts(name);
} u;
struct cmsghdr *cmsgptr;
struct msghdr msg;
- socklen_t recv_length;
+ ssize_t recv_length;
iov[0].iov_base = buf;
iov[0].iov_len = len;
default:
if (!isascii(ascval) || !isprint(ascval)) {
/* ignore garbage characters */
- } else if (bp - logname >= size_logname - 1) {
+ } else if ((int)(bp - logname) >= size_logname - 1) {
bb_error_msg_and_die("%s: input overrun", op->tty);
} else {
full_write(1, &c, 1); /* echo the character */
static void FixDayDow(CronLine *line)
{
- size_t i;
+ unsigned i;
int weekUsed = 0;
int daysUsed = 0;
static int translate_xfermode(const char *name)
{
- int val, i;
+ int val;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(xfermode_val); i++) {
if (!strncmp(name, xfermode_name[i], 5))
new_linepos += 7;
new_linepos &= (~7);
}
- if (new_linepos >= w)
+ if ((int)new_linepos >= w)
break;
linepos = new_linepos;
}
printf(" lines %i-%i/%i ",
cur_fline + 1, cur_fline + max_displayed_line + 1,
max_fline + 1);
- if (cur_fline >= max_fline - max_displayed_line) {
+ if (cur_fline >= (int)(max_fline - max_displayed_line)) {
printf("(END)"NORMAL);
if (num_files > 1 && current_file != num_files)
printf(HIGHLIGHT" - next: %s"NORMAL, files[current_file]);
#endif
clear_line();
- if (cur_fline && cur_fline < max_fline - max_displayed_line) {
+ if (cur_fline && cur_fline < (int)(max_fline - max_displayed_line)) {
bb_putchar(':');
return;
}
/* Print the buffer */
static void buffer_print(void)
{
- int i;
+ unsigned i;
move_cursor(0, 0);
for (i = 0; i <= max_displayed_line; i++)
static void buffer_fill_and_print(void)
{
- int i;
+ unsigned i;
for (i = 0; i <= max_displayed_line && cur_fline + i <= max_fline; i++) {
buffer[i] = flines[cur_fline + i];
}
/* Reinitialize everything for a new file - free the memory and start over */
static void reinitialize(void)
{
- int i;
+ unsigned i;
if (flines) {
for (i = 0; i <= max_fline; i++)
static char* less_gets(int sz)
{
char c;
- int i = 0;
+ unsigned i = 0;
char *result = xzalloc(1);
while (1) {
static void remove_current_file(void)
{
- int i;
+ unsigned i;
if (num_files < 2)
return;
match_pos = 0;
fill_match_lines(0);
while (match_pos < num_matches) {
- if (match_lines[match_pos] > cur_fline)
+ if ((int)match_lines[match_pos] > cur_fline)
break;
match_pos++;
}
static void number_process(int first_digit)
{
- int i;
+ unsigned i;
int num;
char num_input[sizeof(int)*4]; /* more than enough */
char keypress;
{
const char *msg = "";
char *current_line;
- int i;
+ unsigned i;
FILE *fp;
print_statusline("Log file: ");
static void match_right_bracket(char bracket)
{
- int i;
+ unsigned i;
if (strchr(flines[cur_fline], bracket) == NULL) {
print_statusline("No bracket in top line");
while ((line = xmalloc_fgetline(table)) != NULL) {
char type;
- unsigned int mode = 0755;
- unsigned int major = 0;
- unsigned int minor = 0;
- unsigned int count = 0;
- unsigned int increment = 0;
- unsigned int start = 0;
+ unsigned mode = 0755;
+ unsigned major = 0;
+ unsigned minor = 0;
+ unsigned count = 0;
+ unsigned increment = 0;
+ unsigned start = 0;
char name[41];
char user[41];
char group[41];
{
if (*line=='\0' || *line=='#' || isspace(*line))
continue;
- bb_error_msg("line %d invalid: '%s'", linenum, line);
+ bb_error_msg("invalid line %d: '%s'", linenum, line);
ret = EXIT_FAILURE;
continue;
}
ret = EXIT_FAILURE;
goto loop;
}
- if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ if (chmod(full_name, mode) < 0) {
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
ret = EXIT_FAILURE;
goto loop;
ret = EXIT_FAILURE;
goto loop;
}
- if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ if (chmod(full_name, mode) < 0) {
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
ret = EXIT_FAILURE;
goto loop;
}
if (count > 0) {
- int i;
+ unsigned i;
char *full_name_inc;
full_name_inc = xmalloc(strlen(full_name) + 4);
bb_perror_msg("line %d: chown failed for %s", linenum, full_name_inc);
ret = EXIT_FAILURE;
}
- if ((mode != -1) && (chmod(full_name_inc, mode) < 0)){
+ if (chmod(full_name_inc, mode) < 0) {
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name_inc);
ret = EXIT_FAILURE;
}
bb_perror_msg("line %d: chown failed for %s", linenum, full_name);
ret = EXIT_FAILURE;
}
- if ((mode != -1) && (chmod(full_name, mode) < 0)){
+ if (chmod(full_name, mode) < 0) {
bb_perror_msg("line %d: chmod failed for %s", linenum, full_name);
ret = EXIT_FAILURE;
}
int n_type = ELF_ST_TYPE(info);
int n_binding = ELF_ST_BIND(info);
- for (sym = f->symtab[hash]; sym; sym = sym->next)
+ for (sym = f->symtab[hash]; sym; sym = sym->next) {
if (f->symbol_cmp(sym->name, name) == 0) {
int o_secidx = sym->secidx;
int o_info = sym->info;
return sym;
}
}
+ }
/* Completely new symbol. */
sym = arch_new_symbol();
sym->next = f->symtab[hash];
f->symtab[hash] = sym;
sym->ksymidx = -1;
-
- if (ELF_ST_BIND(info) == STB_LOCAL && symidx != -1) {
+ if (ELF_ST_BIND(info) == STB_LOCAL && symidx != (unsigned long)(-1)) {
if (symidx >= f->local_symtab_size)
bb_error_msg("local symbol %s with index %ld exceeds local_symtab_size %ld",
name, (long) symidx, (long) f->local_symtab_size);
{
struct obj_file *f;
ElfW(Shdr) * section_headers;
- int shnum, i;
+ size_t shnum, i;
char *shstrtab;
/* Read the file header. */
while (ptr < endptr) {
value = strchr(ptr, '=');
if (value && strncmp(ptr, "license", value-ptr) == 0) {
- int i;
+ unsigned i;
if (license)
*license = value+1;
for (i = 0; i < ARRAY_SIZE(gpl_licenses); ++i) {
struct obj_symbol *sym;
char *name, *absolute_filename;
char str[STRVERSIONLEN];
- int i, l, lm_name, lfilename, use_ksymtab, version;
+ unsigned i;
+ int l, lm_name, lfilename, use_ksymtab, version;
struct stat statbuf;
/* WARNING: was using realpath, but replaced by readlink to stop using
m_size = obj_load_size(f);
m_addr = create_module(m_name, m_size);
- if (m_addr == -1) switch (errno) {
+ if (m_addr == (ElfW(Addr))(-1)) switch (errno) {
case EEXIST:
bb_error_msg_and_die("a module named %s already exists", m_name);
case ENOMEM:
if (ah->ar_pro != htons(ETH_P_IP)
|| (ah->ar_pln != 4)
|| (ah->ar_hln != me.sll_halen)
- || (len < sizeof(*ah) + 2 * (4 + ah->ar_hln)))
+ || (len < (int)(sizeof(*ah) + 2 * (4 + ah->ar_hln))))
return false;
memcpy(&src_ip, p + ah->ar_hln, 4);
#if ENABLE_FEATURE_HTTPD_ERROR_PAGES
if (flag == FIRST_PARSE && *p0 == 'E') {
- int i;
+ unsigned i;
/* error status code */
int status = atoi(++p0);
/* c already points at the character following ':' in parse loop */
struct ifreq ifr;
int res;
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(ifra); i++) {
strncpy_IFNAMSIZ(ifr.ifr_name, master_ifname);
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_up(struct interface_defn_t *ifd, execfn *exec)
{
- int i;
+ unsigned i;
#if ENABLE_FEATURE_IFUPDOWN_IP
/* ip doesn't up iface when it configures it (unlike ifconfig) */
if (!execute("ip link set %iface% up", ifd, exec))
#if ENABLE_FEATURE_IFUPDOWN_EXTERNAL_DHCP
static int dhcp_down(struct interface_defn_t *ifd, execfn *exec)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(ext_dhcp_clients); i++) {
if (exists_execable(ext_dhcp_clients[i].name))
return execute(ext_dhcp_clients[i].stopcmd, ifd, exec);
char *liface;
char *pch;
bool okay = 0;
- unsigned cmds_ret;
+ int cmds_ret;
iface = xstrdup(target_list->data);
target_list = target_list->link;
if (*p == '-') {
p++;
n = bb_strtou(p, &p, 10);
- if (n > INT_MAX || n < sep->se_rpcver_lo)
+ if (n > INT_MAX || (int)n < sep->se_rpcver_lo)
goto bad_ver_spec;
sep->se_rpcver_hi = n;
}
&& (sep->se_socktype == SOCK_STREAM
|| sep->se_socktype == SOCK_DGRAM)
) {
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(builtins); i++)
if (strncmp(builtins[i].bi_service7, sep->se_service, 7) == 0)
goto found_bi;
if (ioctl_or_warn(skfd, SIOCGIFCONF, &ifc) < 0) {
goto out;
}
- if (ifc.ifc_len == sizeof(struct ifreq) * numreqs) {
+ if (ifc.ifc_len == (int)(sizeof(struct ifreq) * numreqs)) {
/* assume it overflowed and try again */
numreqs += 10;
continue;
/* return 1 if address is all zeros */
static int hw_null_address(const struct hwtype *hw, void *ap)
{
- unsigned int i;
+ int i;
unsigned char *address = (unsigned char *) ap;
for (i = 0; i < hw->alen; i++)
p = strpbrk(cur, "\r\n");
if (p)
*p = '\0';
- if (!p && sz && buf->pos <= sizeof(buf->buf))
+ if (!p && sz && buf->pos <= (int)sizeof(buf->buf))
goto ok;
/* Terminate session. If we are in server mode, then
* fd is still in nonblocking mode - we never block here */
if (msg.msg_namelen != sizeof(nladdr)) {
bb_error_msg_and_die("sender address length == %d", msg.msg_namelen);
}
- for (h = (struct nlmsghdr*)buf; status >= sizeof(*h); ) {
+ for (h = (struct nlmsghdr*)buf; status >= (int)sizeof(*h); ) {
// int l_err;
int len = h->nlmsg_len;
int l = len - sizeof(*h);
if (h->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
- if (l < sizeof(struct nlmsgerr)) {
+ if (l < (int)sizeof(struct nlmsgerr)) {
bb_error_msg("ERROR truncated");
} else {
errno = - err->error;
{
int len = RTA_LENGTH(4);
struct rtattr *rta;
- if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen)
+ if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen)
return -1;
rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len));
rta->rta_type = type;
int len = RTA_LENGTH(alen);
struct rtattr *rta;
- if (NLMSG_ALIGN(n->nlmsg_len) + len > maxlen)
+ if ((int)(NLMSG_ALIGN(n->nlmsg_len) + len) > maxlen)
return -1;
rta = (struct rtattr*)(((char*)n) + NLMSG_ALIGN(n->nlmsg_len));
rta->rta_type = type;
if (tb[IFLA_ADDRESS]) {
int alen;
im->alen = alen = RTA_PAYLOAD(tb[IFLA_ADDRESS]);
- if (alen > sizeof(im->addr))
+ if (alen > (int)sizeof(im->addr))
alen = sizeof(im->addr);
memcpy(im->addr, RTA_DATA(tb[IFLA_ADDRESS]), alen);
} else {
const char *ll_proto_n2a(unsigned short id, char *buf, int len)
{
- int i;
-
+ unsigned i;
id = ntohs(id);
-
for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
if (llproto_names[i].id == id)
return llproto_names[i].name;
int ll_proto_a2n(unsigned short *id, char *buf)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(llproto_names); i++) {
if (strcasecmp(llproto_names[i].name, buf) == 0) {
*id = htons(llproto_names[i].id);
#endif /* FEATURE_IP_RARE_PROTOCOLS */
};
- int i;
+ unsigned i;
const char *aname = arphrd_name;
for (i = 0; i < ARRAY_SIZE(arphrd_type); i++) {
if (arphrd_type[i] == type)
bb_error_msg_and_die("%s failed", msg);
}
-static int inline smtp_check(const char *fmt, int code)
+static inline int smtp_check(const char *fmt, int code)
{
return smtp_checkp(fmt, NULL, code);
}
bb_error_msg_and_die("%s failed", msg);
}
-static void inline pop3_check(const char *fmt, const char *param)
+static inline void pop3_check(const char *fmt, const char *param)
{
pop3_checkr(fmt, param, NULL);
}
ifc.ifc_buf = (caddr_t)ibuf;
if (ioctl(fd, SIOCGIFCONF, (char *)&ifc) < 0
- || ifc.ifc_len < sizeof(struct ifreq)
+ || ifc.ifc_len < (int)sizeof(struct ifreq)
) {
if (errno == EINVAL)
bb_error_msg_and_die(
{
FILE *in;
char buffer[READ_CONFIG_BUF_SIZE], *token, *line;
- int i, lineno;
+ unsigned i, lineno;
for (i = 0; i < KWS_WITH_DEFAULTS; i++)
keywords[i].handler(keywords[i].def, keywords[i].var);
for (i = 0; i < ARRAY_SIZE(keywords); i++) {
if (!strcasecmp(token, keywords[i].keyword)) {
if (!keywords[i].handler(line, keywords[i].var)) {
- bb_error_msg("can't parse line %d in %s at '%s'",
+ bb_error_msg("can't parse line %u in %s at '%s'",
lineno, file, line);
/* reset back to the default value */
keywords[i].handler(keywords[i].def, keywords[i].var);
/**
* Return milliseconds of random delay, up to "secs" seconds.
*/
-static unsigned ALWAYS_INLINE random_delay_ms(unsigned secs)
+static ALWAYS_INLINE unsigned random_delay_ms(unsigned secs)
{
return rand() % (secs * 1000);
}
argc--;
do_it_now:
+ pid = getpid();
if (killall5) {
pid_t sid;
procps_status_t* p = NULL;
- /* Now stop all processes */
- kill(-1, SIGSTOP);
/* Find out our own session id */
- pid = getpid();
sid = getsid(pid);
+ /* Now stop all processes */
+ kill(-1, SIGSTOP);
/* Now kill all processes except our session */
while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) {
- if (p->sid != sid && p->pid != pid && p->pid != 1)
+ if (p->sid != (unsigned)sid && p->pid != (unsigned)pid && p->pid != 1)
kill(p->pid, signo);
}
/* And let them continue */
if (killall) {
/* Looks like they want to do a killall. Do that */
- pid = getpid();
while (arg) {
pid_t* pidList;
cmd = proc->comm;
/* NB: OPT_INVERT is always 0 or 1 */
if ((regexec(&re_buffer, cmd, 1, re_match, 0) == 0 /* match found */
- && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == strlen(cmd)))) ^ OPT_INVERT
+ && (!OPT_ANCHOR || (re_match[0].rm_so == 0 && re_match[0].rm_eo == (regoff_t)strlen(cmd)))) ^ OPT_INVERT
) {
matched_pid = proc->pid;
if (OPT_LAST) {
if (opt & OPT_OMIT) {
llist_t *omits_p = omits;
while (omits_p) {
- if (xatoul(omits_p->data) == *pl) {
+ if (xatoul(omits_p->data) == (unsigned long)(*pl)) {
goto omitting;
}
omits_p = omits_p->link;
static const ps_out_t* find_out_spec(const char *name)
{
- int i;
+ unsigned i;
for (i = 0; i < ARRAY_SIZE(out_spec); i++) {
if (!strcmp(name, out_spec[i].name))
return &out_spec[i];
the next. Used for finding deltas. */
typedef struct save_hist {
unsigned long ticks;
- unsigned pid;
+ pid_t pid;
} save_hist;
typedef int (*cmp_funcp)(top_status_t *P, top_status_t *Q);
fclose(fp);
/* output memory info */
- if (scr_width > sizeof(scrbuf))
+ if (scr_width > (int)sizeof(scrbuf))
scr_width = sizeof(scrbuf);
snprintf(scrbuf, scr_width,
"Mem: %luK used, %luK free, %luK shrd, %luK buff, %luK cached",
, SHOW_STAT(pcpu)
#endif
);
- if (col + 1 < scr_width)
+ if ((int)(col + 1) < scr_width)
read_cmdline(line_buf + col, scr_width - col - 1, s->pid, s->comm);
fputs(line_buf, stdout);
/* printf(" %d/%d %lld/%lld", s->pcpu, total_pcpu,
static void display_topmem_header(int scr_width)
{
char linebuf[128];
- int i;
+ unsigned i;
FILE *fp;
union {
struct {
ulltoa6_and_space(s->dirty_sh, &line_buf[6*6]);
ulltoa6_and_space(s->stack , &line_buf[7*6]);
line_buf[8*6] = '\0';
- if (scr_width > MIN_WIDTH) {
+ if (scr_width > (int)MIN_WIDTH) {
read_cmdline(&line_buf[8*6], scr_width - MIN_WIDTH, s->pid, s->comm);
}
printf("\n""%.*s", scr_width, line_buf);
#define vartab (G_var.vartab )
#define varinit (G_var.varinit )
#define INIT_G_var() do { \
- int i; \
+ unsigned i; \
(*(struct globals_var**)&ash_ptr_to_globals_var) = xzalloc(sizeof(G_var)); \
barrier(); \
for (i = 0; i < ARRAY_SIZE(varinit_data); i++) { \
if (!eq) /* stop at first non-assignment */
break;
eq++;
- if (name_len == (eq - str)
+ if (name_len == (unsigned)(eq - str)
&& strncmp(str, name, name_len) == 0) {
p = eq;
/* goto value; - WRONG! */
ash_msg("illegal option %co %s", val ? '-' : '+', name);
return 1;
}
- for (i = 0; i < NOPTS; i++)
+ for (i = 0; i < NOPTS; i++) {
if (val) {
out1fmt("%-16s%s\n", optnames(i), optlist[i] ? "on" : "off");
} else {
out1fmt("set %co %s\n", optlist[i] ? '-' : '+', optnames(i));
}
+ }
return 0;
}
static void
return 1;
optnext = optfirst + *param_optind - 1;
- if (*param_optind <= 1 || *optoff < 0 || strlen(optnext[-1]) < *optoff)
+ if (*param_optind <= 1 || *optoff < 0 || (int)strlen(optnext[-1]) < *optoff)
p = NULL;
else
p = optnext[-1] + *optoff;
return readtoken1(c, BASESYNTAX, (char *) NULL, 0);
}
- if (p - xxreadtoken_chars >= xxreadtoken_singles) {
+ if ((size_t)(p - xxreadtoken_chars) >= xxreadtoken_singles) {
if (pgetc() == *p) { /* double occurrence? */
p += xxreadtoken_doubles + 1;
} else {
static int
helpcmd(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
{
- int col, i;
+ unsigned col;
+ unsigned i;
out1fmt("\nBuilt-in commands:\n-------------------\n");
for (col = 0, i = 0; i < ARRAY_SIZE(builtintab); i++) {
while ((c = *p++) >= '0' && c <= '9') {
val = (val * 10) + (long)(c - '0');
+ // val is actually 'unsigned long int' and can't get < 0
if (val < (rlim_t) 0)
break;
}
int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int logread_main(int argc ATTRIBUTE_UNUSED, char **argv)
{
- int cur;
+ unsigned cur;
int log_semid; /* ipc semaphore id */
int log_shmid; /* ipc shared memory id */
smallint follow = getopt32(argv, "f");
timestamp_and_log_internal("syslogd started: BusyBox v" BB_VER);
for (;;) {
- size_t sz;
+ ssize_t sz;
#if ENABLE_FEATURE_SYSLOGD_DUP
last_buf = recvbuf;
create_sunlabel(void)
{
struct hd_geometry geometry;
- unsigned int ndiv;
- int i;
+ unsigned ndiv;
unsigned char c;
const struct sun_predefined_drives *p = NULL;
memset(MBRbuffer, 0, sizeof(MBRbuffer));
sunlabel->magic = SUN_SSWAP16(SUN_LABEL_MAGIC);
if (!floppy) {
+ unsigned i;
puts("Drive type\n"
" ? auto configure\n"
" 0 custom (with hardware detected defaults)");
static int generate_output(char **argv, int argc, const char *optstr, const struct option *longopts)
{
int exit_code = 0; /* We assume everything will be OK */
- unsigned opt;
+ int opt;
#if ENABLE_GETOPT_LONG
int longindex;
#endif
#else
getopt(argc, argv, optstr);
#endif
- if (opt == EOF)
+ if (opt == -1)
break;
if (opt == '?' || opt == ':' )
exit_code = 1;
printf(" %s", normalize(optarg));
else {
printf(" -%c", opt);
- charptr = strchr(optstr,opt);
+ charptr = strchr(optstr, opt);
if (charptr != NULL && *++charptr == ':')
printf(" %s",
normalize(optarg ? optarg : ""));
// Loop through options
for (;;) {
- size_t i;
+ unsigned i;
char *comma = strchr(options, ',');
const char *option_str = mount_option_str;
static const short offsets[] = { 0, 8, 64, 256 };
uint32_t magic;
- int i;
+ unsigned i;
struct ufs_super_block *ufs;
dbg("probing at offset 0x%llx", (unsigned long long) off);
int volume_id_probe_all(struct volume_id *id, uint64_t off, uint64_t size)
{
- size_t i;
+ unsigned i;
if (id == NULL)
return -EINVAL;