svn commit: trunk/busybox: console-tools coreutils editors

andersen at busybox.net andersen at busybox.net
Mon Jan 30 19:48:25 UTC 2006


Author: andersen
Date: 2006-01-30 11:48:23 -0800 (Mon, 30 Jan 2006)
New Revision: 13725

Log:
clean up yet more annoying signed/unsigned mismatches and fixup
yet more incorrect types


Modified:
   trunk/busybox/console-tools/loadfont.c
   trunk/busybox/coreutils/expr.c
   trunk/busybox/coreutils/install.c
   trunk/busybox/coreutils/ls.c
   trunk/busybox/coreutils/od.c
   trunk/busybox/coreutils/tr.c
   trunk/busybox/coreutils/uudecode.c
   trunk/busybox/coreutils/uuencode.c
   trunk/busybox/editors/patch.c


Changeset:
Modified: trunk/busybox/console-tools/loadfont.c
===================================================================
--- trunk/busybox/console-tools/loadfont.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/console-tools/loadfont.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -52,7 +52,7 @@
 	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];
 	int i;
@@ -138,7 +138,7 @@
 static void loadnewfont(int fd)
 {
 	int unit;
-	char inbuf[32768];			/* primitive */
+	unsigned char inbuf[32768];			/* primitive */
 	unsigned int inputlth, offset;
 
 	/*

Modified: trunk/busybox/coreutils/expr.c
===================================================================
--- trunk/busybox/coreutils/expr.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/expr.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -57,10 +57,12 @@
 #if ENABLE_EXPR_MATH_SUPPORT_64
 typedef int64_t arith_t;
 #define PF_REZ      "ll"
+#define PF_REZ_TYPE (long long)
 #define STRTOL(s, e, b) strtoll(s, e, b)
 #else
 typedef long arith_t;
 #define PF_REZ      "l"
+#define PF_REZ_TYPE (long)
 #define STRTOL(s, e, b) strtol(s, e, b)
 #endif
 
@@ -102,7 +104,7 @@
 		bb_error_msg_and_die ("syntax error");
 
 	if (v->type == integer)
-		printf ("%" PF_REZ "d\n", v->u.i);
+		printf ("%" PF_REZ "d\n", PF_REZ_TYPE v->u.i);
 	else
 		puts (v->u.s);
 
@@ -159,7 +161,7 @@
 static void tostring (VALUE *v)
 {
 	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;
 	}
 }

Modified: trunk/busybox/coreutils/install.c
===================================================================
--- trunk/busybox/coreutils/install.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/install.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -115,7 +115,7 @@
 					? 0 : S_ISDIR(statbuf.st_mode);
 	}
 	for (i = optind; i < argc - 1; i++) {
-		unsigned char *dest;
+		char *dest;
 
 		dest = argv[argc - 1];
 		if (isdir) dest = concat_path_file(argv[argc - 1], basename(argv[i]));

Modified: trunk/busybox/coreutils/ls.c
===================================================================
--- trunk/busybox/coreutils/ls.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/ls.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -679,7 +679,7 @@
 			break;
 		case LIST_BLOCKS:
 #if _FILE_OFFSET_BITS == 64
-			column += printf("%4lld ", dn->dstat.st_blocks >> 1);
+			column += printf("%4lld ", (long long)dn->dstat.st_blocks >> 1);
 #else
 			column += printf("%4ld ", dn->dstat.st_blocks >> 1);
 #endif

Modified: trunk/busybox/coreutils/od.c
===================================================================
--- trunk/busybox/coreutils/od.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/od.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -155,9 +155,9 @@
 	"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,
 	4, 6, 6, 7, 8,
 	9, 0xa, 0xb, 0xa, 0xa,
@@ -168,14 +168,14 @@
 {
 	int ch;
 	int first = 1;
-	signed char *p;
+	char *p;
 	bb_dump_vflag = FIRST;
 	bb_dump_length = -1;
 
 	while ((ch = getopt(argc, argv, od_opts)) > 0) {
 		if (ch == 'v') {
 			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) {
 				first = 0;
 				bb_dump_add("\"%07.7_Ao\n\"");
@@ -183,7 +183,7 @@
 			} else {
 				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 */
 			bb_show_usage();
 		}

Modified: trunk/busybox/coreutils/tr.c
===================================================================
--- trunk/busybox/coreutils/tr.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/tr.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -40,7 +40,7 @@
 /* these last are pointers to static buffers declared in tr_main */
 static unsigned char *poutput;
 static unsigned char *pvector;
-static char *pinvec, *poutvec;
+static unsigned char *pinvec, *poutvec;
 
 #define input bb_common_bufsiz1
 
@@ -141,9 +141,9 @@
 					for (i = 'A'; i <= 'Z'; i++)
 						*buffer++ = i;
 				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)
-					strcat(buffer, " \t");
+					strcat((char*)buffer, " \t");
 				/* gcc gives a warning if braces aren't used here */
 				else if (strncmp(arg, "punct", 5) == 0) {
 					for (i = 0; i <= ASCII; i++)
@@ -156,7 +156,7 @@
 							*buffer++ = i;
 				}
 				else {
-					strcat(buffer, "[:");
+					strcat((char*)buffer, "[:");
 					arg++;
 					continue;
 				}
@@ -214,10 +214,10 @@
 	RESERVE_CONFIG_BUFFER(outvec, ASCII+1);
 
 	/* ... but make them available globally */
-	poutput = output;
-	pvector = vector;
-	pinvec  = invec;
-	poutvec = outvec;
+	poutput = (unsigned char*)output;
+	pvector = (unsigned char*)vector;
+	pinvec  = (unsigned char*)invec;
+	poutvec = (unsigned char*)outvec;
 
 	if (argc > 1 && argv[idx][0] == '-') {
 		for (ptr = (unsigned char *) &argv[idx][1]; *ptr; ptr++) {
@@ -243,14 +243,14 @@
 	}
 
 	if (argv[idx] != NULL) {
-		input_length = expand(argv[idx++], input);
+		input_length = expand(argv[idx++], (unsigned char*)input);
 		if (com_fl)
-			input_length = complement(input, input_length);
+			input_length = complement((unsigned char*)input, input_length);
 		if (argv[idx] != NULL) {
 			if (*argv[idx] == '\0')
 				bb_error_msg_and_die("STRING2 cannot be empty");
-			output_length = expand(argv[idx], output);
-			map(input, input_length, output, output_length);
+			output_length = expand(argv[idx], (unsigned char*)output);
+			map((unsigned char*)input, input_length, (unsigned char*)output, output_length);
 		}
 		for (i = 0; i < input_length; i++)
 			invec[(unsigned char)input[i]] = TRUE;

Modified: trunk/busybox/coreutils/uudecode.c
===================================================================
--- trunk/busybox/coreutils/uudecode.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/uudecode.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -93,7 +93,7 @@
 
 		while (count < 4) {
 			char *table_ptr;
-			char ch;
+			int ch;
 
 			/* Get next _valid_ character */
 			do {

Modified: trunk/busybox/coreutils/uuencode.c
===================================================================
--- trunk/busybox/coreutils/uuencode.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/coreutils/uuencode.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -130,7 +130,7 @@
 			memset(&src_buf[size], 0, src_buf_size - size);
 		}
 		/* 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');
 		if (tbl == tbl_std) {

Modified: trunk/busybox/editors/patch.c
===================================================================
--- trunk/busybox/editors/patch.c	2006-01-30 18:33:12 UTC (rev 13724)
+++ trunk/busybox/editors/patch.c	2006-01-30 19:48:23 UTC (rev 13725)
@@ -52,7 +52,7 @@
  * 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;
 	int i;




More information about the busybox-cvs mailing list