aboutsummaryrefslogtreecommitdiff
path: root/miscutils
diff options
context:
space:
mode:
authorGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-05-15 21:30:45 +0000
committerGravatar Denis Vlasenko <vda.linux@googlemail.com>2008-05-15 21:30:45 +0000
commit6b06cb80be64fcf207bee734cc678c25434ed1a4 (patch)
treeaebc37ae3a2658fba3f57003102fa0dfb1a10ac8 /miscutils
parent43d5d429fd7a80ca02eb8388f058fd9654cc118d (diff)
downloadbusybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.gz
busybox-6b06cb80be64fcf207bee734cc678c25434ed1a4.tar.bz2
more of -Wall fixes from Cristian Ionescu-Idbohrn.
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
Diffstat (limited to 'miscutils')
-rw-r--r--miscutils/crond.c2
-rw-r--r--miscutils/hdparm.c3
-rw-r--r--miscutils/less.c24
-rw-r--r--miscutils/makedevs.c24
4 files changed, 27 insertions, 26 deletions
diff --git a/miscutils/crond.c b/miscutils/crond.c
index 0b2d55822..6db4df422 100644
--- a/miscutils/crond.c
+++ b/miscutils/crond.c
@@ -423,7 +423,7 @@ static char *ParseField(char *user, char *ary, int modvalue, int off,
static void FixDayDow(CronLine *line)
{
- size_t i;
+ unsigned i;
int weekUsed = 0;
int daysUsed = 0;
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index ec5ede691..7afa9ff86 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -1486,7 +1486,8 @@ static const char xfermode_name[][5] ALIGN1 = {
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))
diff --git a/miscutils/less.c b/miscutils/less.c
index 065bf6f38..25b91c0fe 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -297,7 +297,7 @@ static void read_lines(void)
new_linepos += 7;
new_linepos &= (~7);
}
- if (new_linepos >= w)
+ if ((int)new_linepos >= w)
break;
linepos = new_linepos;
}
@@ -415,7 +415,7 @@ static void m_status_print(void)
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]);
@@ -444,7 +444,7 @@ static void status_print(void)
#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;
}
@@ -587,7 +587,7 @@ static void print_ascii(const char *str)
/* Print the buffer */
static void buffer_print(void)
{
- int i;
+ unsigned i;
move_cursor(0, 0);
for (i = 0; i <= max_displayed_line; i++)
@@ -600,7 +600,7 @@ static void buffer_print(void)
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];
}
@@ -662,7 +662,7 @@ static void open_file_and_read_lines(void)
/* 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++)
@@ -763,7 +763,7 @@ static int less_getch(int pos)
static char* less_gets(int sz)
{
char c;
- int i = 0;
+ unsigned i = 0;
char *result = xzalloc(1);
while (1) {
@@ -836,7 +836,7 @@ static void change_file(int direction)
static void remove_current_file(void)
{
- int i;
+ unsigned i;
if (num_files < 2)
return;
@@ -974,7 +974,7 @@ static void regex_process(void)
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++;
}
@@ -990,7 +990,7 @@ static void regex_process(void)
static void number_process(int first_digit)
{
- int i;
+ unsigned i;
int num;
char num_input[sizeof(int)*4]; /* more than enough */
char keypress;
@@ -1120,7 +1120,7 @@ static void save_input_to_file(void)
{
const char *msg = "";
char *current_line;
- int i;
+ unsigned i;
FILE *fp;
print_statusline("Log file: ");
@@ -1204,7 +1204,7 @@ static char opp_bracket(char bracket)
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");
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index 43e4b8c4d..3b45d70b4 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -99,12 +99,12 @@ int makedevs_main(int argc, char **argv)
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];
@@ -121,7 +121,7 @@ int makedevs_main(int argc, char **argv)
{
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;
}
@@ -140,7 +140,7 @@ int makedevs_main(int argc, char **argv)
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;
@@ -157,7 +157,7 @@ int makedevs_main(int argc, char **argv)
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;
@@ -180,7 +180,7 @@ int makedevs_main(int argc, char **argv)
}
if (count > 0) {
- int i;
+ unsigned i;
char *full_name_inc;
full_name_inc = xmalloc(strlen(full_name) + 4);
@@ -195,7 +195,7 @@ int makedevs_main(int argc, char **argv)
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;
}
@@ -211,7 +211,7 @@ int makedevs_main(int argc, char **argv)
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;
}