fix warnings

print.c:106:10: warning: variable ‘neg’ set but not used
tcpproxy.c:55:25: warning: cast to pointer from integer of different size
tcpproxy.c:64:7: warning: cast from pointer to integer of different size
testdelay.c:15:12: warning: cast from pointer to integer of different size
testdelay.c:16:32: warning: cast from pointer to integer of different size
testdelay.c:31:25: warning: cast to pointer from integer of different size
This commit is contained in:
David du Colombier 2012-08-01 01:00:00 +02:00
parent b75fdf3424
commit 0609977c6e
3 changed files with 6 additions and 8 deletions

View File

@ -103,7 +103,7 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
{ {
static char digits[] = "0123456789abcdef"; static char digits[] = "0123456789abcdef";
char buf[30], *p; char buf[30], *p;
int neg, zero; int zero;
uvlong luv; uvlong luv;
if(fl&FlagLongLong){ if(fl&FlagLongLong){
@ -126,10 +126,8 @@ vseprint(char *dst, char *edst, char *fmt, va_list arg)
} }
p = buf+sizeof buf; p = buf+sizeof buf;
neg = 0;
zero = 0; zero = 0;
if(!(fl&FlagUnsigned) && (vlong)luv < 0){ if(!(fl&FlagUnsigned) && (vlong)luv < 0){
neg = 1;
luv = -luv; luv = -luv;
} }
if(luv == 0) if(luv == 0)

View File

@ -52,7 +52,7 @@ taskmain(int argc, char **argv)
fdnoblock(fd); fdnoblock(fd);
while((cfd = netaccept(fd, remote, &rport)) >= 0){ while((cfd = netaccept(fd, remote, &rport)) >= 0){
fprintf(stderr, "connection from %s:%d\n", remote, rport); fprintf(stderr, "connection from %s:%d\n", remote, rport);
taskcreate(proxytask, (void*)cfd, STACK); taskcreate(proxytask, (void*)(uintptr_t)cfd, STACK);
} }
} }
@ -61,7 +61,7 @@ proxytask(void *v)
{ {
int fd, remotefd; int fd, remotefd;
fd = (int)v; fd = (int)(uintptr_t)v;
if((remotefd = netdial(TCP, server, port)) < 0){ if((remotefd = netdial(TCP, server, port)) < 0){
close(fd); close(fd);
return; return;

View File

@ -12,8 +12,8 @@ Channel *c;
void void
delaytask(void *v) delaytask(void *v)
{ {
taskdelay((int)v); taskdelay((int)(uintptr_t)v);
printf("awake after %d ms\n", (int)v); printf("awake after %d ms\n", (int)(uintptr_t)v);
chansendul(c, 0); chansendul(c, 0);
} }
@ -28,7 +28,7 @@ taskmain(int argc, char **argv)
for(i=1; i<argc; i++){ for(i=1; i<argc; i++){
n++; n++;
printf("x"); printf("x");
taskcreate(delaytask, (void*)atoi(argv[i]), STACK); taskcreate(delaytask, (void*)(uintptr_t)atoi(argv[i]), STACK);
} }
/* wait for n tasks to finish */ /* wait for n tasks to finish */