fix a typo: take and cast a pointer to the argument, rather than trying
to cast the argument to a pointer.
This commit is contained in:
parent
c603ec4609
commit
98a0fb0a16
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: htonl.c,v 1.7 1996/10/13 04:08:35 christos Exp $ */
|
||||
/* $NetBSD: htonl.c,v 1.8 1996/10/17 01:39:40 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
|
@ -6,7 +6,7 @@
|
|||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
static char *rcsid = "$NetBSD: htonl.c,v 1.7 1996/10/13 04:08:35 christos Exp $";
|
||||
static char *rcsid = "$NetBSD: htonl.c,v 1.8 1996/10/17 01:39:40 cgd Exp $";
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -18,7 +18,7 @@ htonl(x)
|
|||
in_addr_t x;
|
||||
{
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
u_char *s = (u_char *)x;
|
||||
u_char *s = (u_char *)&x;
|
||||
return (in_addr_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
|
||||
#else
|
||||
return x;
|
||||
|
|
Loading…
Reference in New Issue