diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:00 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-01-29 22:51:00 +0000 |
| commit | a41fdf331af344ecd3ec230a072857ea197e1890 (patch) | |
| tree | 70ffff0b7f48b35a70b8b04253abe9118ded6026 /coreutils/printf.c | |
| parent | e935602ff5d5a45be56585b8bad44194c3e837a3 (diff) | |
| download | busybox-w32-a41fdf331af344ecd3ec230a072857ea197e1890.tar.gz busybox-w32-a41fdf331af344ecd3ec230a072857ea197e1890.tar.bz2 busybox-w32-a41fdf331af344ecd3ec230a072857ea197e1890.zip | |
preparatory patch for -Wwrite-strings #1
Diffstat (limited to 'coreutils/printf.c')
| -rw-r--r-- | coreutils/printf.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c index 0e818354f..924499b29 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
| @@ -42,11 +42,11 @@ | |||
| 42 | 42 | ||
| 43 | static int print_formatted(char *format, int argc, char **argv); | 43 | static int print_formatted(char *format, int argc, char **argv); |
| 44 | static void print_direc(char *start, size_t length, | 44 | static void print_direc(char *start, size_t length, |
| 45 | int field_width, int precision, char *argument); | 45 | int field_width, int precision, const char *argument); |
| 46 | 46 | ||
| 47 | typedef void (*converter)(char *arg, void *result); | 47 | typedef void (*converter)(const char *arg, void *result); |
| 48 | 48 | ||
| 49 | static void multiconvert(char *arg, void *result, converter convert) | 49 | static void multiconvert(const char *arg, void *result, converter convert) |
| 50 | { | 50 | { |
| 51 | char s[16]; | 51 | char s[16]; |
| 52 | if (*arg == '"' || *arg == '\'') { | 52 | if (*arg == '"' || *arg == '\'') { |
| @@ -58,15 +58,15 @@ static void multiconvert(char *arg, void *result, converter convert) | |||
| 58 | fputs(arg, stderr); | 58 | fputs(arg, stderr); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | static void conv_strtoul(char *arg, void *result) | 61 | static void conv_strtoul(const char *arg, void *result) |
| 62 | { | 62 | { |
| 63 | *(unsigned long*)result = bb_strtoul(arg, NULL, 10); | 63 | *(unsigned long*)result = bb_strtoul(arg, NULL, 10); |
| 64 | } | 64 | } |
| 65 | static void conv_strtol(char *arg, void *result) | 65 | static void conv_strtol(const char *arg, void *result) |
| 66 | { | 66 | { |
| 67 | *(long*)result = bb_strtol(arg, NULL, 10); | 67 | *(long*)result = bb_strtol(arg, NULL, 10); |
| 68 | } | 68 | } |
| 69 | static void conv_strtod(char *arg, void *result) | 69 | static void conv_strtod(const char *arg, void *result) |
| 70 | { | 70 | { |
| 71 | char *end; | 71 | char *end; |
| 72 | /* Well, this one allows leading whitespace... so what */ | 72 | /* Well, this one allows leading whitespace... so what */ |
| @@ -75,21 +75,21 @@ static void conv_strtod(char *arg, void *result) | |||
| 75 | if (end[0]) errno = ERANGE; | 75 | if (end[0]) errno = ERANGE; |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | static unsigned long my_xstrtoul(char *arg) | 78 | static unsigned long my_xstrtoul(const char *arg) |
| 79 | { | 79 | { |
| 80 | unsigned long result; | 80 | unsigned long result; |
| 81 | multiconvert(arg, &result, conv_strtoul); | 81 | multiconvert(arg, &result, conv_strtoul); |
| 82 | return result; | 82 | return result; |
| 83 | } | 83 | } |
| 84 | 84 | ||
| 85 | static long my_xstrtol(char *arg) | 85 | static long my_xstrtol(const char *arg) |
| 86 | { | 86 | { |
| 87 | long result; | 87 | long result; |
| 88 | multiconvert(arg, &result, conv_strtol); | 88 | multiconvert(arg, &result, conv_strtol); |
| 89 | return result; | 89 | return result; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | static double my_xstrtod(char *arg) | 92 | static double my_xstrtod(const char *arg) |
| 93 | { | 93 | { |
| 94 | double result; | 94 | double result; |
| 95 | multiconvert(arg, &result, conv_strtod); | 95 | multiconvert(arg, &result, conv_strtod); |
| @@ -239,7 +239,7 @@ static int print_formatted(char *format, int argc, char **argv) | |||
| 239 | 239 | ||
| 240 | static void | 240 | static void |
| 241 | print_direc(char *start, size_t length, int field_width, int precision, | 241 | print_direc(char *start, size_t length, int field_width, int precision, |
| 242 | char *argument) | 242 | const char *argument) |
| 243 | { | 243 | { |
| 244 | char *p; /* Null-terminated copy of % directive. */ | 244 | char *p; /* Null-terminated copy of % directive. */ |
| 245 | 245 | ||
