From 4693495cf0017a5dccf3d54082803ea9e2282ea2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 24 Aug 2009 14:11:09 +0000 Subject: [PATCH] * ntohl(), and htonl() should return an uint32_t, so better cast the return value we get from __swap_int32(). +alphabranch git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32652 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/posix/netinet/in.h | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index 1362259613..0e16b70f1f 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -26,22 +26,21 @@ typedef uint32_t in_addr_t; * and we are not allowed to import all the BeOS types here. */ #ifndef htonl -/* extern uint32_t __swap_int32(uint32_t); */ /* private */ extern unsigned long __swap_int32(unsigned long); /* private */ extern uint16_t __swap_int16(uint16_t); /* private */ - #if BYTE_ORDER == LITTLE_ENDIAN - #define htonl(x) __swap_int32(x) - #define ntohl(x) __swap_int32(x) - #define htons(x) __swap_int16(x) - #define ntohs(x) __swap_int16(x) - #elif BYTE_ORDER == BIG_ENDIAN - #define htonl(x) (x) - #define ntohl(x) (x) - #define htons(x) (x) - #define ntohs(x) (x) - #else - #error Unknown byte order. - #endif +# if BYTE_ORDER == LITTLE_ENDIAN +# define htonl(x) ((uint32_t)__swap_int32(x)) +# define ntohl(x) ((uint32_t)__swap_int32(x)) +# define htons(x) __swap_int16(x) +# define ntohs(x) __swap_int16(x) +# elif BYTE_ORDER == BIG_ENDIAN +# define htonl(x) (x) +# define ntohl(x) (x) +# define htons(x) (x) +# define ntohs(x) (x) +# else +# error Unknown byte order. +# endif #endif