diff options
author | tholo <> | 1996-12-12 03:19:56 +0000 |
---|---|---|
committer | tholo <> | 1996-12-12 03:19:56 +0000 |
commit | 585c056622af4adfe762a48f81c1ff7060880fea (patch) | |
tree | 1fdb36027c2ae4ebec12af5b53668ea1eb9a307b | |
parent | c2657861c3ce64d590898cd417d3275cd0af5879 (diff) | |
download | openbsd-585c056622af4adfe762a48f81c1ff7060880fea.tar.gz openbsd-585c056622af4adfe762a48f81c1ff7060880fea.tar.bz2 openbsd-585c056622af4adfe762a48f81c1ff7060880fea.zip |
Update {hton,ntoh}[ls] argument and return types to match changes in
<machine/endian.h>
-rw-r--r-- | src/lib/libc/net/htonl.c | 12 | ||||
-rw-r--r-- | src/lib/libc/net/htons.c | 8 | ||||
-rw-r--r-- | src/lib/libc/net/ntohl.c | 12 | ||||
-rw-r--r-- | src/lib/libc/net/ntohs.c | 8 |
4 files changed, 18 insertions, 22 deletions
diff --git a/src/lib/libc/net/htonl.c b/src/lib/libc/net/htonl.c index 2373c170e7..73b7432731 100644 --- a/src/lib/libc/net/htonl.c +++ b/src/lib/libc/net/htonl.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #if defined(LIBC_SCCS) && !defined(lint) | 6 | #if defined(LIBC_SCCS) && !defined(lint) |
7 | static char *rcsid = "$OpenBSD: htonl.c,v 1.3 1996/08/19 08:29:04 tholo Exp $"; | 7 | static char *rcsid = "$OpenBSD: htonl.c,v 1.4 1996/12/12 03:19:55 tholo Exp $"; |
8 | #endif /* LIBC_SCCS and not lint */ | 8 | #endif /* LIBC_SCCS and not lint */ |
9 | 9 | ||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
@@ -12,16 +12,14 @@ static char *rcsid = "$OpenBSD: htonl.c,v 1.3 1996/08/19 08:29:04 tholo Exp $"; | |||
12 | 12 | ||
13 | #undef htonl | 13 | #undef htonl |
14 | 14 | ||
15 | unsigned long | 15 | u_int32_t |
16 | htonl(x) | 16 | htonl(x) |
17 | unsigned long x; | 17 | u_int32_t x; |
18 | { | 18 | { |
19 | u_int32_t y = x; | ||
20 | |||
21 | #if BYTE_ORDER == LITTLE_ENDIAN | 19 | #if BYTE_ORDER == LITTLE_ENDIAN |
22 | u_char *s = (u_char *)&y; | 20 | u_char *s = (u_char *)&x; |
23 | return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); | 21 | return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); |
24 | #else | 22 | #else |
25 | return y; | 23 | return x; |
26 | #endif | 24 | #endif |
27 | } | 25 | } |
diff --git a/src/lib/libc/net/htons.c b/src/lib/libc/net/htons.c index f0554f2166..e647d8c91e 100644 --- a/src/lib/libc/net/htons.c +++ b/src/lib/libc/net/htons.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #if defined(LIBC_SCCS) && !defined(lint) | 6 | #if defined(LIBC_SCCS) && !defined(lint) |
7 | static char *rcsid = "$OpenBSD: htons.c,v 1.4 1996/08/19 08:29:05 tholo Exp $"; | 7 | static char *rcsid = "$OpenBSD: htons.c,v 1.5 1996/12/12 03:19:55 tholo Exp $"; |
8 | #endif /* LIBC_SCCS and not lint */ | 8 | #endif /* LIBC_SCCS and not lint */ |
9 | 9 | ||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
@@ -12,12 +12,12 @@ static char *rcsid = "$OpenBSD: htons.c,v 1.4 1996/08/19 08:29:05 tholo Exp $"; | |||
12 | 12 | ||
13 | #undef htons | 13 | #undef htons |
14 | 14 | ||
15 | unsigned short | 15 | u_int16_t |
16 | #if __STDC__ | 16 | #if __STDC__ |
17 | htons(unsigned short x) | 17 | htons(u_int16_t x) |
18 | #else | 18 | #else |
19 | htons(x) | 19 | htons(x) |
20 | unsigned short x; | 20 | u_int16_t x; |
21 | #endif | 21 | #endif |
22 | { | 22 | { |
23 | #if BYTE_ORDER == LITTLE_ENDIAN | 23 | #if BYTE_ORDER == LITTLE_ENDIAN |
diff --git a/src/lib/libc/net/ntohl.c b/src/lib/libc/net/ntohl.c index 0947a071ae..7d3e227e60 100644 --- a/src/lib/libc/net/ntohl.c +++ b/src/lib/libc/net/ntohl.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #if defined(LIBC_SCCS) && !defined(lint) | 6 | #if defined(LIBC_SCCS) && !defined(lint) |
7 | static char *rcsid = "$OpenBSD: ntohl.c,v 1.3 1996/08/19 08:29:33 tholo Exp $"; | 7 | static char *rcsid = "$OpenBSD: ntohl.c,v 1.4 1996/12/12 03:19:56 tholo Exp $"; |
8 | #endif /* LIBC_SCCS and not lint */ | 8 | #endif /* LIBC_SCCS and not lint */ |
9 | 9 | ||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
@@ -12,16 +12,14 @@ static char *rcsid = "$OpenBSD: ntohl.c,v 1.3 1996/08/19 08:29:33 tholo Exp $"; | |||
12 | 12 | ||
13 | #undef ntohl | 13 | #undef ntohl |
14 | 14 | ||
15 | unsigned long | 15 | u_int32_t |
16 | ntohl(x) | 16 | ntohl(x) |
17 | unsigned long x; | 17 | u_int32_t x; |
18 | { | 18 | { |
19 | u_int32_t y = x; | ||
20 | |||
21 | #if BYTE_ORDER == LITTLE_ENDIAN | 19 | #if BYTE_ORDER == LITTLE_ENDIAN |
22 | u_char *s = (u_char *)&y; | 20 | u_char *s = (u_char *)&x; |
23 | return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); | 21 | return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); |
24 | #else | 22 | #else |
25 | return y; | 23 | return x; |
26 | #endif | 24 | #endif |
27 | } | 25 | } |
diff --git a/src/lib/libc/net/ntohs.c b/src/lib/libc/net/ntohs.c index f717039803..129729aa32 100644 --- a/src/lib/libc/net/ntohs.c +++ b/src/lib/libc/net/ntohs.c | |||
@@ -4,7 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | #if defined(LIBC_SCCS) && !defined(lint) | 6 | #if defined(LIBC_SCCS) && !defined(lint) |
7 | static char *rcsid = "$OpenBSD: ntohs.c,v 1.4 1996/08/19 08:29:35 tholo Exp $"; | 7 | static char *rcsid = "$OpenBSD: ntohs.c,v 1.5 1996/12/12 03:19:56 tholo Exp $"; |
8 | #endif /* LIBC_SCCS and not lint */ | 8 | #endif /* LIBC_SCCS and not lint */ |
9 | 9 | ||
10 | #include <sys/types.h> | 10 | #include <sys/types.h> |
@@ -12,12 +12,12 @@ static char *rcsid = "$OpenBSD: ntohs.c,v 1.4 1996/08/19 08:29:35 tholo Exp $"; | |||
12 | 12 | ||
13 | #undef ntohs | 13 | #undef ntohs |
14 | 14 | ||
15 | unsigned short | 15 | u_int16_t |
16 | #if __STDC__ | 16 | #if __STDC__ |
17 | ntohs(unsigned short x) | 17 | ntohs(u_int16_t x) |
18 | #else | 18 | #else |
19 | ntohs(x) | 19 | ntohs(x) |
20 | unsigned short x; | 20 | u_int16_t x; |
21 | #endif | 21 | #endif |
22 | { | 22 | { |
23 | #if BYTE_ORDER == LITTLE_ENDIAN | 23 | #if BYTE_ORDER == LITTLE_ENDIAN |