svn commit: trunk/busybox: libbb networking

vapier at busybox.net vapier at busybox.net
Sun Feb 19 22:59:12 UTC 2006


Author: vapier
Date: 2006-02-19 14:59:12 -0800 (Sun, 19 Feb 2006)
New Revision: 14134

Log:
rfelker writes in Bug 740: s/u_char/unsigned char/


Modified:
   trunk/busybox/libbb/dump.c
   trunk/busybox/networking/traceroute.c


Changeset:
Modified: trunk/busybox/libbb/dump.c
===================================================================
--- trunk/busybox/libbb/dump.c	2006-02-19 22:47:51 UTC (rev 14133)
+++ trunk/busybox/libbb/dump.c	2006-02-19 22:59:12 UTC (rev 14134)
@@ -352,18 +352,18 @@
 	/* NOTREACHED */
 }
 
-static u_char *get(void)
+static unsigned char *get(void)
 {
 	static int ateof = 1;
-	static u_char *curp=NULL, *savp; /*DBU:[dave at cray.com]initialize curp */
+	static unsigned char *curp=NULL, *savp; /*DBU:[dave at cray.com]initialize curp */
 	register int n;
 	int need, nread;
-	u_char *tmpp;
+	unsigned char *tmpp;
 
 	if (!curp) {
 		address = (off_t)0; /*DBU:[dave at cray.com] initialize,initialize..*/
-		curp = (u_char *) xmalloc(bb_dump_blocksize);
-		savp = (u_char *) xmalloc(bb_dump_blocksize);
+		curp = (unsigned char *) xmalloc(bb_dump_blocksize);
+		savp = (unsigned char *) xmalloc(bb_dump_blocksize);
 	} else {
 		tmpp = curp;
 		curp = savp;
@@ -378,19 +378,19 @@
 		 */
 		if (!bb_dump_length || (ateof && !next((char **) NULL))) {
 			if (need == bb_dump_blocksize) {
-				return ((u_char *) NULL);
+				return ((unsigned char *) NULL);
 			}
 			if (bb_dump_vflag != ALL && !bcmp(curp, savp, nread)) {
 				if (bb_dump_vflag != DUP) {
 					printf("*\n");
 				}
-				return ((u_char *) NULL);
+				return ((unsigned char *) NULL);
 			}
 			memset((char *) curp + nread, 0, need);
 			eaddress = address + nread;
 			return (curp);
 		}
-		n = fread((char *) curp + nread, sizeof(u_char),
+		n = fread((char *) curp + nread, sizeof(unsigned char),
 				  bb_dump_length == -1 ? need : MIN(bb_dump_length, need), stdin);
 		if (!n) {
 			if (ferror(stdin)) {
@@ -451,7 +451,7 @@
 	"\0";
 
 
-static void conv_c(PR * pr, u_char * p)
+static void conv_c(PR * pr, unsigned char * p)
 {
 	const char *str = conv_str;
 	char buf[10];
@@ -476,7 +476,7 @@
 	}
 }
 
-static void conv_u(PR * pr, u_char * p)
+static void conv_u(PR * pr, unsigned char * p)
 {
 	static const char list[] =
 		"nul\0soh\0stx\0etx\0eot\0enq\0ack\0bel\0"
@@ -507,10 +507,10 @@
 	register FU *fu;
 	register PR *pr;
 	register int cnt;
-	register u_char *bp;
+	register unsigned char *bp;
 
 	off_t saveaddress;
-	u_char savech = 0, *savebp;
+	unsigned char savech = 0, *savebp;
 
 	while ((bp = get()) != NULL) {
 		for (fs = bb_dump_fshead, savebp = bp, saveaddress = address; fs;

Modified: trunk/busybox/networking/traceroute.c
===================================================================
--- trunk/busybox/networking/traceroute.c	2006-02-19 22:47:51 UTC (rev 14133)
+++ trunk/busybox/networking/traceroute.c	2006-02-19 22:59:12 UTC (rev 14134)
@@ -243,8 +243,8 @@
  * Overlay for ip header used by other protocols (tcp, udp).
  */
 struct ipovly {
-	u_char  ih_x1[9];               /* (unused) */
-	u_char  ih_pr;                  /* protocol */
+	unsigned char  ih_x1[9];               /* (unused) */
+	unsigned char  ih_pr;                  /* protocol */
 	short   ih_len;                 /* protocol length */
 	struct  in_addr ih_src;         /* source internet address */
 	struct  in_addr ih_dst;         /* destination internet address */
@@ -279,8 +279,8 @@
 
 /* Data section of the probe packet */
 struct outdata {
-	u_char seq;             /* sequence number of this packet */
-	u_char ttl;             /* ttl packet left with */
+	unsigned char seq;             /* sequence number of this packet */
+	unsigned char ttl;             /* ttl packet left with */
 	struct timeval tv ATTRIBUTE_PACKED; /* time packet left */
 };
 
@@ -293,7 +293,7 @@
 static const char route[] = "/proc/net/route";
 
 /* last inbound (icmp) packet */
-static u_char  packet[512] ATTRIBUTE_ALIGNED(32);
+static unsigned char  packet[512] ATTRIBUTE_ALIGNED(32);
 
 static struct ip *outip;               /* last output (udp) packet */
 static struct udphdr *outudp;          /* last output (udp) packet */
@@ -596,7 +596,7 @@
 
 	/* mop up an odd byte, if necessary */
 	if (nleft == 1)
-		sum += *(u_char *)w;
+		sum += *(unsigned char *)w;
 
 	/*
 	 * add back carry outs from top 16 bits to low 16 bits
@@ -689,7 +689,7 @@
 		if (packlen & 1) {
 			if ((i % 8) == 0)
 				printf("\n\t");
-			printf(" %02x", *(u_char *)sp);
+			printf(" %02x", *(unsigned char *)sp);
 		}
 		printf("]\n");
 	}
@@ -728,7 +728,7 @@
  * Convert an ICMP "type" field to a printable string.
  */
 static inline const char *
-pr_type(u_char t)
+pr_type(unsigned char t)
 {
 	static const char * const ttab[] = {
 	"Echo Reply",   "ICMP 1",       "ICMP 2",       "Dest Unreachable",
@@ -746,10 +746,10 @@
 #endif
 
 static int
-packet_ok(u_char *buf, int cc, struct sockaddr_in *from, int seq)
+packet_ok(unsigned char *buf, int cc, struct sockaddr_in *from, int seq)
 {
 	struct icmp *icp;
-	u_char type, code;
+	unsigned char type, code;
 	int hlen;
 	struct ip *ip;
 
@@ -790,7 +790,7 @@
 			    icp->icmp_seq == htons(seq))
 				return -2;
 
-			hicmp = (struct icmp *)((u_char *)hip + hlen);
+			hicmp = (struct icmp *)((unsigned char *)hip + hlen);
 			/* XXX 8 is a magic number */
 			if (hlen + 8 <= cc &&
 			    hip->ip_p == IPPROTO_ICMP &&
@@ -800,7 +800,7 @@
 		} else
 #endif
 		      {
-			up = (struct udphdr *)((u_char *)hip + hlen);
+			up = (struct udphdr *)((unsigned char *)hip + hlen);
 			/* XXX 8 is a magic number */
 			if (hlen + 12 <= cc &&
 			    hip->ip_p == IPPROTO_UDP &&
@@ -850,7 +850,7 @@
 }
 
 static inline void
-print(u_char *buf, int cc, struct sockaddr_in *from)
+print(unsigned char *buf, int cc, struct sockaddr_in *from)
 {
 	struct ip *ip;
 	int hlen;
@@ -928,7 +928,7 @@
 {
 	int code, n;
 	char *cp;
-	u_char *outp;
+	unsigned char *outp;
 	u_int32_t *ap;
 	struct sockaddr_in *from = (struct sockaddr_in *)&wherefrom;
 	struct sockaddr_in *to = (struct sockaddr_in *)&whereto;
@@ -1112,7 +1112,7 @@
 #ifdef CONFIG_FEATURE_TRACEROUTE_SOURCE_ROUTE
 #if defined(IP_OPTIONS)
 	if (lsrr > 0) {
-		u_char optlist[MAX_IPOPTLEN];
+		unsigned char optlist[MAX_IPOPTLEN];
 
 		cp = "ip";
 		if ((pe = getprotobyname(cp)) == NULL)
@@ -1179,10 +1179,10 @@
 		outip->ip_tos = tos;
 	outip->ip_len = htons(packlen);
 	outip->ip_off = htons(off);
-	outp = (u_char *)(outip + 1);
+	outp = (unsigned char *)(outip + 1);
 	outip->ip_dst = to->sin_addr;
 
-	outip->ip_hl = (outp - (u_char *)outip) >> 2;
+	outip->ip_hl = (outp - (unsigned char *)outip) >> 2;
 	ident = (getpid() & 0xffff) | 0x8000;
 #ifdef CONFIG_FEATURE_TRACEROUTE_USE_ICMP
 	if (useicmp) {




More information about the busybox-cvs mailing list