Fix strict alias warnings.

This commit is contained in:
John Birrell 2007-11-23 23:56:03 +00:00
parent 5f3a6945d4
commit 962e1ce30f
2 changed files with 12 additions and 5 deletions

View File

@ -1,3 +1,4 @@
/* $FreeBSD$ */
/* ppc-dis.c -- Disassemble PowerPC instructions
Copyright 1994, 1995, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
@ -45,6 +46,7 @@ static int
powerpc_dialect (struct disassemble_info *info)
{
int dialect = PPC_OPCODE_PPC | PPC_OPCODE_ALTIVEC;
void *pd = &info->private_data;
if (BFD_DEFAULT_TARGET_SIZE == 64)
dialect |= PPC_OPCODE_64;
@ -91,7 +93,7 @@ powerpc_dialect (struct disassemble_info *info)
dialect |= PPC_OPCODE_64;
}
((struct dis_private *) &info->private_data)->dialect = dialect;
((struct dis_private *) pd)->dialect = dialect;
return dialect;
}
@ -100,7 +102,8 @@ powerpc_dialect (struct disassemble_info *info)
int
print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
{
int dialect = ((struct dis_private *) &info->private_data)->dialect;
void *pd = &info->private_data;
int dialect = ((struct dis_private *) pd)->dialect;
return print_insn_powerpc (memaddr, info, 1, dialect);
}
@ -109,7 +112,8 @@ print_insn_big_powerpc (bfd_vma memaddr, struct disassemble_info *info)
int
print_insn_little_powerpc (bfd_vma memaddr, struct disassemble_info *info)
{
int dialect = ((struct dis_private *) &info->private_data)->dialect;
void *pd = &info->private_data;
int dialect = ((struct dis_private *) pd)->dialect;
return print_insn_powerpc (memaddr, info, 0, dialect);
}

View File

@ -110,6 +110,7 @@ TcpChecksum(struct ip *pip)
struct tcphdr *tc;
int nhdr, ntcp, nbytes;
int sum, oddbyte;
void *v;
nhdr = pip->ip_hl << 2;
ntcp = ntohs(pip->ip_len) - nhdr;
@ -131,10 +132,12 @@ TcpChecksum(struct ip *pip)
sum += oddbyte;
}
/* "Pseudo-header" data */
ptr = (u_short *) & (pip->ip_dst);
v = &pip->ip_dst;
ptr = v;
sum += *ptr++;
sum += *ptr;
ptr = (u_short *) & (pip->ip_src);
v = &pip->ip_src;
ptr = v;
sum += *ptr++;
sum += *ptr;
sum += htons((u_short) ntcp);