diff options
author | Eric Andersen <andersen@codepoet.org> | 2006-01-30 19:48:23 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2006-01-30 19:48:23 +0000 |
commit | 5e678873f9ff7c95d43b278feee547ce989b3b20 (patch) | |
tree | 6b0bab1e0d6df7f659352acc7dc844663c11634c | |
parent | 2cdd4d56ffc3b467d5ffa76e3c4cd009dc311097 (diff) | |
download | busybox-w32-5e678873f9ff7c95d43b278feee547ce989b3b20.tar.gz busybox-w32-5e678873f9ff7c95d43b278feee547ce989b3b20.tar.bz2 busybox-w32-5e678873f9ff7c95d43b278feee547ce989b3b20.zip |
clean up yet more annoying signed/unsigned mismatches and fixup
yet more incorrect types
-rw-r--r-- | console-tools/loadfont.c | 4 | ||||
-rw-r--r-- | coreutils/expr.c | 6 | ||||
-rw-r--r-- | coreutils/install.c | 2 | ||||
-rw-r--r-- | coreutils/ls.c | 2 | ||||
-rw-r--r-- | coreutils/od.c | 10 | ||||
-rw-r--r-- | coreutils/tr.c | 24 | ||||
-rw-r--r-- | coreutils/uudecode.c | 2 | ||||
-rw-r--r-- | coreutils/uuencode.c | 2 | ||||
-rw-r--r-- | editors/patch.c | 2 |
9 files changed, 28 insertions, 26 deletions
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 4580dc4e0..d9bbb2072 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c | |||
@@ -52,7 +52,7 @@ extern int loadfont_main(int argc, char **argv) | |||
52 | return EXIT_SUCCESS; | 52 | return EXIT_SUCCESS; |
53 | } | 53 | } |
54 | 54 | ||
55 | static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) | 55 | static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize) |
56 | { | 56 | { |
57 | char buf[16384]; | 57 | char buf[16384]; |
58 | int i; | 58 | int i; |
@@ -138,7 +138,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize) | |||
138 | static void loadnewfont(int fd) | 138 | static void loadnewfont(int fd) |
139 | { | 139 | { |
140 | int unit; | 140 | int unit; |
141 | char inbuf[32768]; /* primitive */ | 141 | unsigned char inbuf[32768]; /* primitive */ |
142 | unsigned int inputlth, offset; | 142 | unsigned int inputlth, offset; |
143 | 143 | ||
144 | /* | 144 | /* |
diff --git a/coreutils/expr.c b/coreutils/expr.c index e0eb4ec8c..b23de8e9f 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -57,10 +57,12 @@ typedef enum valtype TYPE; | |||
57 | #if ENABLE_EXPR_MATH_SUPPORT_64 | 57 | #if ENABLE_EXPR_MATH_SUPPORT_64 |
58 | typedef int64_t arith_t; | 58 | typedef int64_t arith_t; |
59 | #define PF_REZ "ll" | 59 | #define PF_REZ "ll" |
60 | #define PF_REZ_TYPE (long long) | ||
60 | #define STRTOL(s, e, b) strtoll(s, e, b) | 61 | #define STRTOL(s, e, b) strtoll(s, e, b) |
61 | #else | 62 | #else |
62 | typedef long arith_t; | 63 | typedef long arith_t; |
63 | #define PF_REZ "l" | 64 | #define PF_REZ "l" |
65 | #define PF_REZ_TYPE (long) | ||
64 | #define STRTOL(s, e, b) strtol(s, e, b) | 66 | #define STRTOL(s, e, b) strtol(s, e, b) |
65 | #endif | 67 | #endif |
66 | 68 | ||
@@ -102,7 +104,7 @@ int expr_main (int argc, char **argv) | |||
102 | bb_error_msg_and_die ("syntax error"); | 104 | bb_error_msg_and_die ("syntax error"); |
103 | 105 | ||
104 | if (v->type == integer) | 106 | if (v->type == integer) |
105 | printf ("%" PF_REZ "d\n", v->u.i); | 107 | printf ("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i); |
106 | else | 108 | else |
107 | puts (v->u.s); | 109 | puts (v->u.s); |
108 | 110 | ||
@@ -159,7 +161,7 @@ static int null (VALUE *v) | |||
159 | static void tostring (VALUE *v) | 161 | static void tostring (VALUE *v) |
160 | { | 162 | { |
161 | if (v->type == integer) { | 163 | if (v->type == integer) { |
162 | v->u.s = bb_xasprintf ("%" PF_REZ "d", v->u.i); | 164 | v->u.s = bb_xasprintf ("%" PF_REZ "d", PF_REZ_TYPE v->u.i); |
163 | v->type = string; | 165 | v->type = string; |
164 | } | 166 | } |
165 | } | 167 | } |
diff --git a/coreutils/install.c b/coreutils/install.c index c3d4f8c82..e58cac931 100644 --- a/coreutils/install.c +++ b/coreutils/install.c | |||
@@ -115,7 +115,7 @@ extern int install_main(int argc, char **argv) | |||
115 | ? 0 : S_ISDIR(statbuf.st_mode); | 115 | ? 0 : S_ISDIR(statbuf.st_mode); |
116 | } | 116 | } |
117 | for (i = optind; i < argc - 1; i++) { | 117 | for (i = optind; i < argc - 1; i++) { |
118 | unsigned char *dest; | 118 | char *dest; |
119 | 119 | ||
120 | dest = argv[argc - 1]; | 120 | dest = argv[argc - 1]; |
121 | if (isdir) dest = concat_path_file(argv[argc - 1], basename(argv[i])); | 121 | if (isdir) dest = concat_path_file(argv[argc - 1], basename(argv[i])); |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 46ab865dd..489c29ad1 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -679,7 +679,7 @@ static int list_single(struct dnode *dn) | |||
679 | break; | 679 | break; |
680 | case LIST_BLOCKS: | 680 | case LIST_BLOCKS: |
681 | #if _FILE_OFFSET_BITS == 64 | 681 | #if _FILE_OFFSET_BITS == 64 |
682 | column += printf("%4lld ", dn->dstat.st_blocks >> 1); | 682 | column += printf("%4lld ", (long long)dn->dstat.st_blocks >> 1); |
683 | #else | 683 | #else |
684 | column += printf("%4ld ", dn->dstat.st_blocks >> 1); | 684 | column += printf("%4ld ", dn->dstat.st_blocks >> 1); |
685 | #endif | 685 | #endif |
diff --git a/coreutils/od.c b/coreutils/od.c index 6a138e838..b70cb85e2 100644 --- a/coreutils/od.c +++ b/coreutils/od.c | |||
@@ -155,9 +155,9 @@ static const char * const add_strings[] = { | |||
155 | "4/4 \" %011o \" \"\\n\"", /* O */ | 155 | "4/4 \" %011o \" \"\\n\"", /* O */ |
156 | }; | 156 | }; |
157 | 157 | ||
158 | static const signed char od_opts[] = "aBbcDdeFfHhIiLlOoXxv"; | 158 | static const char od_opts[] = "aBbcDdeFfHhIiLlOoXxv"; |
159 | 159 | ||
160 | static const signed char od_o2si[] = { | 160 | static const char od_o2si[] = { |
161 | 0, 1, 2, 3, 5, | 161 | 0, 1, 2, 3, 5, |
162 | 4, 6, 6, 7, 8, | 162 | 4, 6, 6, 7, 8, |
163 | 9, 0xa, 0xb, 0xa, 0xa, | 163 | 9, 0xa, 0xb, 0xa, 0xa, |
@@ -168,14 +168,14 @@ int od_main(int argc, char **argv) | |||
168 | { | 168 | { |
169 | int ch; | 169 | int ch; |
170 | int first = 1; | 170 | int first = 1; |
171 | signed char *p; | 171 | char *p; |
172 | bb_dump_vflag = FIRST; | 172 | bb_dump_vflag = FIRST; |
173 | bb_dump_length = -1; | 173 | bb_dump_length = -1; |
174 | 174 | ||
175 | while ((ch = getopt(argc, argv, od_opts)) > 0) { | 175 | while ((ch = getopt(argc, argv, od_opts)) > 0) { |
176 | if (ch == 'v') { | 176 | if (ch == 'v') { |
177 | bb_dump_vflag = ALL; | 177 | bb_dump_vflag = ALL; |
178 | } else if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) { | 178 | } else if (((p = strchr(od_opts, ch)) != NULL) && (*p != '\0')) { |
179 | if (first) { | 179 | if (first) { |
180 | first = 0; | 180 | first = 0; |
181 | bb_dump_add("\"%07.7_Ao\n\""); | 181 | bb_dump_add("\"%07.7_Ao\n\""); |
@@ -183,7 +183,7 @@ int od_main(int argc, char **argv) | |||
183 | } else { | 183 | } else { |
184 | bb_dump_add("\" \""); | 184 | bb_dump_add("\" \""); |
185 | } | 185 | } |
186 | bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]); | 186 | bb_dump_add(add_strings[(int)od_o2si[(p-od_opts)]]); |
187 | } else { /* P, p, s, w, or other unhandled */ | 187 | } else { /* P, p, s, w, or other unhandled */ |
188 | bb_show_usage(); | 188 | bb_show_usage(); |
189 | } | 189 | } |
diff --git a/coreutils/tr.c b/coreutils/tr.c index e9eca4c60..d6c5e346e 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -40,7 +40,7 @@ static short in_index, out_index; | |||
40 | /* these last are pointers to static buffers declared in tr_main */ | 40 | /* these last are pointers to static buffers declared in tr_main */ |
41 | static unsigned char *poutput; | 41 | static unsigned char *poutput; |
42 | static unsigned char *pvector; | 42 | static unsigned char *pvector; |
43 | static char *pinvec, *poutvec; | 43 | static unsigned char *pinvec, *poutvec; |
44 | 44 | ||
45 | #define input bb_common_bufsiz1 | 45 | #define input bb_common_bufsiz1 |
46 | 46 | ||
@@ -141,9 +141,9 @@ static unsigned int expand(const char *arg, register unsigned char *buffer) | |||
141 | for (i = 'A'; i <= 'Z'; i++) | 141 | for (i = 'A'; i <= 'Z'; i++) |
142 | *buffer++ = i; | 142 | *buffer++ = i; |
143 | else if (strncmp(arg, "space", 5) == 0) | 143 | else if (strncmp(arg, "space", 5) == 0) |
144 | strcat(buffer, " \f\n\r\t\v"); | 144 | strcat((char*)buffer, " \f\n\r\t\v"); |
145 | else if (strncmp(arg, "blank", 5) == 0) | 145 | else if (strncmp(arg, "blank", 5) == 0) |
146 | strcat(buffer, " \t"); | 146 | strcat((char*)buffer, " \t"); |
147 | /* gcc gives a warning if braces aren't used here */ | 147 | /* gcc gives a warning if braces aren't used here */ |
148 | else if (strncmp(arg, "punct", 5) == 0) { | 148 | else if (strncmp(arg, "punct", 5) == 0) { |
149 | for (i = 0; i <= ASCII; i++) | 149 | for (i = 0; i <= ASCII; i++) |
@@ -156,7 +156,7 @@ static unsigned int expand(const char *arg, register unsigned char *buffer) | |||
156 | *buffer++ = i; | 156 | *buffer++ = i; |
157 | } | 157 | } |
158 | else { | 158 | else { |
159 | strcat(buffer, "[:"); | 159 | strcat((char*)buffer, "[:"); |
160 | arg++; | 160 | arg++; |
161 | continue; | 161 | continue; |
162 | } | 162 | } |
@@ -214,10 +214,10 @@ extern int tr_main(int argc, char **argv) | |||
214 | RESERVE_CONFIG_BUFFER(outvec, ASCII+1); | 214 | RESERVE_CONFIG_BUFFER(outvec, ASCII+1); |
215 | 215 | ||
216 | /* ... but make them available globally */ | 216 | /* ... but make them available globally */ |
217 | poutput = output; | 217 | poutput = (unsigned char*)output; |
218 | pvector = vector; | 218 | pvector = (unsigned char*)vector; |
219 | pinvec = invec; | 219 | pinvec = (unsigned char*)invec; |
220 | poutvec = outvec; | 220 | poutvec = (unsigned char*)outvec; |
221 | 221 | ||
222 | if (argc > 1 && argv[idx][0] == '-') { | 222 | if (argc > 1 && argv[idx][0] == '-') { |
223 | for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) { | 223 | for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) { |
@@ -243,14 +243,14 @@ extern int tr_main(int argc, char **argv) | |||
243 | } | 243 | } |
244 | 244 | ||
245 | if (argv[idx] != NULL) { | 245 | if (argv[idx] != NULL) { |
246 | input_length = expand(argv[idx++], input); | 246 | input_length = expand(argv[idx++], (unsigned char*)input); |
247 | if (com_fl) | 247 | if (com_fl) |
248 | input_length = complement(input, input_length); | 248 | input_length = complement((unsigned char*)input, input_length); |
249 | if (argv[idx] != NULL) { | 249 | if (argv[idx] != NULL) { |
250 | if (*argv[idx] == '\0') | 250 | if (*argv[idx] == '\0') |
251 | bb_error_msg_and_die("STRING2 cannot be empty"); | 251 | bb_error_msg_and_die("STRING2 cannot be empty"); |
252 | output_length = expand(argv[idx], output); | 252 | output_length = expand(argv[idx], (unsigned char*)output); |
253 | map(input, input_length, output, output_length); | 253 | map((unsigned char*)input, input_length, (unsigned char*)output, output_length); |
254 | } | 254 | } |
255 | for (i = 0; i < input_length; i++) | 255 | for (i = 0; i < input_length; i++) |
256 | invec[(unsigned char)input[i]] = TRUE; | 256 | invec[(unsigned char)input[i]] = TRUE; |
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c index da6490a81..60bf7d8c1 100644 --- a/coreutils/uudecode.c +++ b/coreutils/uudecode.c | |||
@@ -93,7 +93,7 @@ static int read_base64(FILE *src_stream, FILE *dst_stream) | |||
93 | 93 | ||
94 | while (count < 4) { | 94 | while (count < 4) { |
95 | char *table_ptr; | 95 | char *table_ptr; |
96 | char ch; | 96 | int ch; |
97 | 97 | ||
98 | /* Get next _valid_ character */ | 98 | /* Get next _valid_ character */ |
99 | do { | 99 | do { |
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c index 2660f4a19..ee07b084f 100644 --- a/coreutils/uuencode.c +++ b/coreutils/uuencode.c | |||
@@ -130,7 +130,7 @@ int uuencode_main(int argc, char **argv) | |||
130 | memset(&src_buf[size], 0, src_buf_size - size); | 130 | memset(&src_buf[size], 0, src_buf_size - size); |
131 | } | 131 | } |
132 | /* Encode the buffer we just read in */ | 132 | /* Encode the buffer we just read in */ |
133 | uuencode(src_buf, dst_buf, size, tbl); | 133 | uuencode((unsigned char*)src_buf, dst_buf, size, tbl); |
134 | 134 | ||
135 | putchar('\n'); | 135 | putchar('\n'); |
136 | if (tbl == tbl_std) { | 136 | if (tbl == tbl_std) { |
diff --git a/editors/patch.c b/editors/patch.c index bcd3c6830..d406a62bb 100644 --- a/editors/patch.c +++ b/editors/patch.c | |||
@@ -52,7 +52,7 @@ static int copy_lines(FILE *src_stream, FILE *dest_stream, const unsigned int li | |||
52 | * returns malloc'ed filename | 52 | * returns malloc'ed filename |
53 | */ | 53 | */ |
54 | 54 | ||
55 | static unsigned char *extract_filename(char *line, unsigned short patch_level) | 55 | static char *extract_filename(char *line, unsigned short patch_level) |
56 | { | 56 | { |
57 | char *filename_start_ptr = line + 4; | 57 | char *filename_start_ptr = line + 4; |
58 | int i; | 58 | int i; |