* 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
This commit is contained in:
Axel Dörfler 2009-08-24 14:11:09 +00:00
parent d616e43574
commit 4693495cf0

View File

@ -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