preparatory patch for -Wwrite-strings #1
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
int bb_cat(char **argv)
|
||||
{
|
||||
static char *const argv_dash[] = { "-", NULL };
|
||||
static const char *const argv_dash[] = { "-", NULL };
|
||||
FILE *f;
|
||||
int retval = EXIT_SUCCESS;
|
||||
|
||||
|
@@ -41,7 +41,7 @@ static void xputenv(char *s)
|
||||
static void maybe_set_utc(int opt)
|
||||
{
|
||||
if (opt & DATE_OPT_UTC)
|
||||
xputenv("TZ=UTC0");
|
||||
xputenv((char*)"TZ=UTC0");
|
||||
}
|
||||
|
||||
int date_main(int argc, char **argv)
|
||||
@@ -218,7 +218,7 @@ format_utc:
|
||||
i = 22;
|
||||
goto format_utc;
|
||||
} else /* default case */
|
||||
date_fmt = "%a %b %e %H:%M:%S %Z %Y";
|
||||
date_fmt = (char*)"%a %b %e %H:%M:%S %Z %Y";
|
||||
}
|
||||
|
||||
if (*date_fmt == '\0') {
|
||||
@@ -228,7 +228,7 @@ format_utc:
|
||||
/* Handle special conversions */
|
||||
|
||||
if (strncmp(date_fmt, "%f", 2) == 0) {
|
||||
date_fmt = "%Y.%m.%d-%H:%M:%S";
|
||||
date_fmt = (char*)"%Y.%m.%d-%H:%M:%S";
|
||||
}
|
||||
|
||||
/* Generate output string */
|
||||
|
@@ -222,7 +222,7 @@ int du_main(int argc, char **argv)
|
||||
/* go through remaining args (if any) */
|
||||
argv += optind;
|
||||
if (optind >= argc) {
|
||||
*--argv = ".";
|
||||
*--argv = (char*)".";
|
||||
if (slink_depth == 1) {
|
||||
slink_depth = 0;
|
||||
}
|
||||
|
@@ -67,8 +67,8 @@ static char **args;
|
||||
static VALUE *docolon(VALUE * sv, VALUE * pv);
|
||||
static VALUE *eval(void);
|
||||
static VALUE *int_value(arith_t i);
|
||||
static VALUE *str_value(char *s);
|
||||
static int nextarg(char *str);
|
||||
static VALUE *str_value(const char *s);
|
||||
static int nextarg(const char *str);
|
||||
static int null(VALUE * v);
|
||||
static int toarith(VALUE * v);
|
||||
static void freev(VALUE * v);
|
||||
@@ -110,7 +110,7 @@ static VALUE *int_value(arith_t i)
|
||||
|
||||
/* Return a VALUE for S. */
|
||||
|
||||
static VALUE *str_value(char *s)
|
||||
static VALUE *str_value(const char *s)
|
||||
{
|
||||
VALUE *v;
|
||||
|
||||
@@ -172,7 +172,7 @@ static int toarith(VALUE * v)
|
||||
/* Return nonzero if the next token matches STR exactly.
|
||||
STR must not be NULL. */
|
||||
|
||||
static int nextarg(char *str)
|
||||
static int nextarg(const char *str)
|
||||
{
|
||||
if (*args == NULL)
|
||||
return 0;
|
||||
|
@@ -66,7 +66,7 @@ int fold_main(int argc, char **argv)
|
||||
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
*--argv = "-";
|
||||
*--argv = (char*)"-";
|
||||
}
|
||||
|
||||
do {
|
||||
|
@@ -92,7 +92,7 @@ int head_main(int argc, char **argv)
|
||||
|
||||
argv += optind;
|
||||
if (!*argv) {
|
||||
*--argv = "-";
|
||||
*--argv = (char*)"-";
|
||||
}
|
||||
|
||||
fmt = header_fmt_str + 1;
|
||||
|
@@ -26,7 +26,7 @@ int ln_main(int argc, char **argv)
|
||||
char *last;
|
||||
char *src_name;
|
||||
char *src;
|
||||
char *suffix = "~";
|
||||
char *suffix = (char*)"~";
|
||||
struct stat statbuf;
|
||||
int (*link_func)(const char *, const char *);
|
||||
|
||||
|
@@ -102,7 +102,7 @@ int md5_sha1_sum_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (argc == optind) {
|
||||
argv[argc++] = "-";
|
||||
argv[argc++] = (char*)"-";
|
||||
}
|
||||
|
||||
if (ENABLE_FEATURE_MD5_SHA1_SUM_CHECK && (flags & FLAG_CHECK)) {
|
||||
|
@@ -42,11 +42,11 @@
|
||||
|
||||
static int print_formatted(char *format, int argc, char **argv);
|
||||
static void print_direc(char *start, size_t length,
|
||||
int field_width, int precision, char *argument);
|
||||
int field_width, int precision, const char *argument);
|
||||
|
||||
typedef void (*converter)(char *arg, void *result);
|
||||
typedef void (*converter)(const char *arg, void *result);
|
||||
|
||||
static void multiconvert(char *arg, void *result, converter convert)
|
||||
static void multiconvert(const char *arg, void *result, converter convert)
|
||||
{
|
||||
char s[16];
|
||||
if (*arg == '"' || *arg == '\'') {
|
||||
@@ -58,15 +58,15 @@ static void multiconvert(char *arg, void *result, converter convert)
|
||||
fputs(arg, stderr);
|
||||
}
|
||||
|
||||
static void conv_strtoul(char *arg, void *result)
|
||||
static void conv_strtoul(const char *arg, void *result)
|
||||
{
|
||||
*(unsigned long*)result = bb_strtoul(arg, NULL, 10);
|
||||
}
|
||||
static void conv_strtol(char *arg, void *result)
|
||||
static void conv_strtol(const char *arg, void *result)
|
||||
{
|
||||
*(long*)result = bb_strtol(arg, NULL, 10);
|
||||
}
|
||||
static void conv_strtod(char *arg, void *result)
|
||||
static void conv_strtod(const char *arg, void *result)
|
||||
{
|
||||
char *end;
|
||||
/* Well, this one allows leading whitespace... so what */
|
||||
@@ -75,21 +75,21 @@ static void conv_strtod(char *arg, void *result)
|
||||
if (end[0]) errno = ERANGE;
|
||||
}
|
||||
|
||||
static unsigned long my_xstrtoul(char *arg)
|
||||
static unsigned long my_xstrtoul(const char *arg)
|
||||
{
|
||||
unsigned long result;
|
||||
multiconvert(arg, &result, conv_strtoul);
|
||||
return result;
|
||||
}
|
||||
|
||||
static long my_xstrtol(char *arg)
|
||||
static long my_xstrtol(const char *arg)
|
||||
{
|
||||
long result;
|
||||
multiconvert(arg, &result, conv_strtol);
|
||||
return result;
|
||||
}
|
||||
|
||||
static double my_xstrtod(char *arg)
|
||||
static double my_xstrtod(const char *arg)
|
||||
{
|
||||
double result;
|
||||
multiconvert(arg, &result, conv_strtod);
|
||||
@@ -239,7 +239,7 @@ static int print_formatted(char *format, int argc, char **argv)
|
||||
|
||||
static void
|
||||
print_direc(char *start, size_t length, int field_width, int precision,
|
||||
char *argument)
|
||||
const char *argument)
|
||||
{
|
||||
char *p; /* Null-terminated copy of % directive. */
|
||||
|
||||
|
@@ -91,7 +91,7 @@ int tail_main(int argc, char **argv)
|
||||
if (argc >= 2 && (argv[1][0] == '+' || argv[1][0] == '-')
|
||||
&& isdigit(argv[1][1])
|
||||
) {
|
||||
argv[0] = "-n";
|
||||
argv[0] = (char*)"-n";
|
||||
argv--;
|
||||
argc++;
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ int yes_main(int argc, char **argv)
|
||||
const char *fmt;
|
||||
char **first_arg;
|
||||
|
||||
*argv = "y";
|
||||
*argv = (char*)"y";
|
||||
if (argc != 1) {
|
||||
++argv;
|
||||
}
|
||||
|
Reference in New Issue
Block a user