fix type-punned pointer warnings from gcc

R=rsc
http://codereview.appspot.com/396042
This commit is contained in:
Russ Cox 2010-03-10 14:50:33 -08:00
parent 2fe14f1315
commit 0c9c620f39
11 changed files with 57 additions and 29 deletions

View file

@ -146,7 +146,7 @@ ptracerw(int type, int xtype, int isr, int pid, ulong addr, void *v, uint n)
if(n-i >= 4)
*(u32int*)((char*)v+i) = u;
else{
*(u32int*)buf = u;
memmove(buf, &u, 4);
memmove((char*)v+i, buf, n-i);
}
}else{
@ -157,9 +157,9 @@ ptracerw(int type, int xtype, int isr, int pid, ulong addr, void *v, uint n)
u = ptrace(xtype, pid, addr+i, 0);
if(errno)
return -1;
*(u32int*)buf = u;
memmove(buf, &u, 4);
memmove(buf, (char*)v+i, n-i);
u = *(u32int*)buf;
memmove(&u, buf, 4);
}
if(ptrace(type, pid, addr+i, u) < 0)
goto ptraceerr;