clean up yet more annoying signed/unsigned mismatches and fixup

yet more incorrect types
This commit is contained in:
Eric Andersen 2006-01-30 19:48:23 +00:00
parent 2cdd4d56ff
commit 5e678873f9
9 changed files with 28 additions and 26 deletions

View File

@ -52,7 +52,7 @@ extern int loadfont_main(int argc, char **argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
static void do_loadfont(int fd, char *inbuf, int unit, int fontsize) static void do_loadfont(int fd, unsigned char *inbuf, int unit, int fontsize)
{ {
char buf[16384]; char buf[16384];
int i; int i;
@ -138,7 +138,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
static void loadnewfont(int fd) static void loadnewfont(int fd)
{ {
int unit; int unit;
char inbuf[32768]; /* primitive */ unsigned char inbuf[32768]; /* primitive */
unsigned int inputlth, offset; unsigned int inputlth, offset;
/* /*

View File

@ -57,10 +57,12 @@ typedef enum valtype TYPE;
#if ENABLE_EXPR_MATH_SUPPORT_64 #if ENABLE_EXPR_MATH_SUPPORT_64
typedef int64_t arith_t; typedef int64_t arith_t;
#define PF_REZ "ll" #define PF_REZ "ll"
#define PF_REZ_TYPE (long long)
#define STRTOL(s, e, b) strtoll(s, e, b) #define STRTOL(s, e, b) strtoll(s, e, b)
#else #else
typedef long arith_t; typedef long arith_t;
#define PF_REZ "l" #define PF_REZ "l"
#define PF_REZ_TYPE (long)
#define STRTOL(s, e, b) strtol(s, e, b) #define STRTOL(s, e, b) strtol(s, e, b)
#endif #endif
@ -102,7 +104,7 @@ int expr_main (int argc, char **argv)
bb_error_msg_and_die ("syntax error"); bb_error_msg_and_die ("syntax error");
if (v->type == integer) if (v->type == integer)
printf ("%" PF_REZ "d\n", v->u.i); printf ("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
else else
puts (v->u.s); puts (v->u.s);
@ -159,7 +161,7 @@ static int null (VALUE *v)
static void tostring (VALUE *v) static void tostring (VALUE *v)
{ {
if (v->type == integer) { if (v->type == integer) {
v->u.s = bb_xasprintf ("%" PF_REZ "d", v->u.i); v->u.s = bb_xasprintf ("%" PF_REZ "d", PF_REZ_TYPE v->u.i);
v->type = string; v->type = string;
} }
} }

View File

@ -115,7 +115,7 @@ extern int install_main(int argc, char **argv)
? 0 : S_ISDIR(statbuf.st_mode); ? 0 : S_ISDIR(statbuf.st_mode);
} }
for (i = optind; i < argc - 1; i++) { for (i = optind; i < argc - 1; i++) {
unsigned char *dest; char *dest;
dest = argv[argc - 1]; dest = argv[argc - 1];
if (isdir) dest = concat_path_file(argv[argc - 1], basename(argv[i])); if (isdir) dest = concat_path_file(argv[argc - 1], basename(argv[i]));

View File

@ -679,7 +679,7 @@ static int list_single(struct dnode *dn)
break; break;
case LIST_BLOCKS: case LIST_BLOCKS:
#if _FILE_OFFSET_BITS == 64 #if _FILE_OFFSET_BITS == 64
column += printf("%4lld ", dn->dstat.st_blocks >> 1); column += printf("%4lld ", (long long)dn->dstat.st_blocks >> 1);
#else #else
column += printf("%4ld ", dn->dstat.st_blocks >> 1); column += printf("%4ld ", dn->dstat.st_blocks >> 1);
#endif #endif

View File

@ -155,9 +155,9 @@ static const char * const add_strings[] = {
"4/4 \" %011o \" \"\\n\"", /* O */ "4/4 \" %011o \" \"\\n\"", /* O */
}; };
static const signed char od_opts[] = "aBbcDdeFfHhIiLlOoXxv"; static const char od_opts[] = "aBbcDdeFfHhIiLlOoXxv";
static const signed char od_o2si[] = { static const char od_o2si[] = {
0, 1, 2, 3, 5, 0, 1, 2, 3, 5,
4, 6, 6, 7, 8, 4, 6, 6, 7, 8,
9, 0xa, 0xb, 0xa, 0xa, 9, 0xa, 0xb, 0xa, 0xa,
@ -168,14 +168,14 @@ int od_main(int argc, char **argv)
{ {
int ch; int ch;
int first = 1; int first = 1;
signed char *p; char *p;
bb_dump_vflag = FIRST; bb_dump_vflag = FIRST;
bb_dump_length = -1; bb_dump_length = -1;
while ((ch = getopt(argc, argv, od_opts)) > 0) { while ((ch = getopt(argc, argv, od_opts)) > 0) {
if (ch == 'v') { if (ch == 'v') {
bb_dump_vflag = ALL; bb_dump_vflag = ALL;
} else if (((p = strchr(od_opts, ch)) != NULL) && (*p >= 0)) { } else if (((p = strchr(od_opts, ch)) != NULL) && (*p != '\0')) {
if (first) { if (first) {
first = 0; first = 0;
bb_dump_add("\"%07.7_Ao\n\""); bb_dump_add("\"%07.7_Ao\n\"");
@ -183,7 +183,7 @@ int od_main(int argc, char **argv)
} else { } else {
bb_dump_add("\" \""); bb_dump_add("\" \"");
} }
bb_dump_add(add_strings[od_o2si[(int)(p-od_opts)]]); bb_dump_add(add_strings[(int)od_o2si[(p-od_opts)]]);
} else { /* P, p, s, w, or other unhandled */ } else { /* P, p, s, w, or other unhandled */
bb_show_usage(); bb_show_usage();
} }

View File

@ -40,7 +40,7 @@ static short in_index, out_index;
/* these last are pointers to static buffers declared in tr_main */ /* these last are pointers to static buffers declared in tr_main */
static unsigned char *poutput; static unsigned char *poutput;
static unsigned char *pvector; static unsigned char *pvector;
static char *pinvec, *poutvec; static unsigned char *pinvec, *poutvec;
#define input bb_common_bufsiz1 #define input bb_common_bufsiz1
@ -141,9 +141,9 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
for (i = 'A'; i <= 'Z'; i++) for (i = 'A'; i <= 'Z'; i++)
*buffer++ = i; *buffer++ = i;
else if (strncmp(arg, "space", 5) == 0) else if (strncmp(arg, "space", 5) == 0)
strcat(buffer, " \f\n\r\t\v"); strcat((char*)buffer, " \f\n\r\t\v");
else if (strncmp(arg, "blank", 5) == 0) else if (strncmp(arg, "blank", 5) == 0)
strcat(buffer, " \t"); strcat((char*)buffer, " \t");
/* gcc gives a warning if braces aren't used here */ /* gcc gives a warning if braces aren't used here */
else if (strncmp(arg, "punct", 5) == 0) { else if (strncmp(arg, "punct", 5) == 0) {
for (i = 0; i <= ASCII; i++) for (i = 0; i <= ASCII; i++)
@ -156,7 +156,7 @@ static unsigned int expand(const char *arg, register unsigned char *buffer)
*buffer++ = i; *buffer++ = i;
} }
else { else {
strcat(buffer, "[:"); strcat((char*)buffer, "[:");
arg++; arg++;
continue; continue;
} }
@ -214,10 +214,10 @@ extern int tr_main(int argc, char **argv)
RESERVE_CONFIG_BUFFER(outvec, ASCII+1); RESERVE_CONFIG_BUFFER(outvec, ASCII+1);
/* ... but make them available globally */ /* ... but make them available globally */
poutput = output; poutput = (unsigned char*)output;
pvector = vector; pvector = (unsigned char*)vector;
pinvec = invec; pinvec = (unsigned char*)invec;
poutvec = outvec; poutvec = (unsigned char*)outvec;
if (argc > 1 && argv[idx][0] == '-') { if (argc > 1 && argv[idx][0] == '-') {
for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) { for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
@ -243,14 +243,14 @@ extern int tr_main(int argc, char **argv)
} }
if (argv[idx] != NULL) { if (argv[idx] != NULL) {
input_length = expand(argv[idx++], input); input_length = expand(argv[idx++], (unsigned char*)input);
if (com_fl) if (com_fl)
input_length = complement(input, input_length); input_length = complement((unsigned char*)input, input_length);
if (argv[idx] != NULL) { if (argv[idx] != NULL) {
if (*argv[idx] == '\0') if (*argv[idx] == '\0')
bb_error_msg_and_die("STRING2 cannot be empty"); bb_error_msg_and_die("STRING2 cannot be empty");
output_length = expand(argv[idx], output); output_length = expand(argv[idx], (unsigned char*)output);
map(input, input_length, output, output_length); map((unsigned char*)input, input_length, (unsigned char*)output, output_length);
} }
for (i = 0; i < input_length; i++) for (i = 0; i < input_length; i++)
invec[(unsigned char)input[i]] = TRUE; invec[(unsigned char)input[i]] = TRUE;

View File

@ -93,7 +93,7 @@ static int read_base64(FILE *src_stream, FILE *dst_stream)
while (count < 4) { while (count < 4) {
char *table_ptr; char *table_ptr;
char ch; int ch;
/* Get next _valid_ character */ /* Get next _valid_ character */
do { do {

View File

@ -130,7 +130,7 @@ int uuencode_main(int argc, char **argv)
memset(&src_buf[size], 0, src_buf_size - size); memset(&src_buf[size], 0, src_buf_size - size);
} }
/* Encode the buffer we just read in */ /* Encode the buffer we just read in */
uuencode(src_buf, dst_buf, size, tbl); uuencode((unsigned char*)src_buf, dst_buf, size, tbl);
putchar('\n'); putchar('\n');
if (tbl == tbl_std) { if (tbl == tbl_std) {

View File

@ -52,7 +52,7 @@ static int copy_lines(FILE *src_stream, FILE *dest_stream, const unsigned int li
* returns malloc'ed filename * returns malloc'ed filename
*/ */
static unsigned char *extract_filename(char *line, unsigned short patch_level) static char *extract_filename(char *line, unsigned short patch_level)
{ {
char *filename_start_ptr = line + 4; char *filename_start_ptr = line + 4;
int i; int i;