mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Fix build on systems that already have ntohll/htonll
BIT-1234 #close
This commit is contained in:
parent
66ae2ac72c
commit
4a3434675f
3 changed files with 10 additions and 0 deletions
|
@ -165,6 +165,8 @@ set(brodeps
|
||||||
|
|
||||||
include(TestBigEndian)
|
include(TestBigEndian)
|
||||||
test_big_endian(WORDS_BIGENDIAN)
|
test_big_endian(WORDS_BIGENDIAN)
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
check_symbol_exists(htonll arpa/inet.h HAVE_BYTEORDER_64)
|
||||||
|
|
||||||
include(OSSpecific)
|
include(OSSpecific)
|
||||||
include(CheckTypes)
|
include(CheckTypes)
|
||||||
|
|
|
@ -129,6 +129,9 @@
|
||||||
/* whether words are stored with the most significant byte first */
|
/* whether words are stored with the most significant byte first */
|
||||||
#cmakedefine WORDS_BIGENDIAN
|
#cmakedefine WORDS_BIGENDIAN
|
||||||
|
|
||||||
|
/* whether htonll/ntohll is defined in <arpa/inet.h> */
|
||||||
|
#cmakedefine HAVE_BYTEORDER_64
|
||||||
|
|
||||||
/* ultrix can't hack const */
|
/* ultrix can't hack const */
|
||||||
#cmakedefine NEED_ULTRIX_CONST_HACK
|
#cmakedefine NEED_ULTRIX_CONST_HACK
|
||||||
#ifdef NEED_ULTRIX_CONST_HACK
|
#ifdef NEED_ULTRIX_CONST_HACK
|
||||||
|
|
|
@ -180,8 +180,11 @@ extern uint32 extract_uint32(const u_char* data);
|
||||||
|
|
||||||
inline double ntohd(double d) { return d; }
|
inline double ntohd(double d) { return d; }
|
||||||
inline double htond(double d) { return d; }
|
inline double htond(double d) { return d; }
|
||||||
|
|
||||||
|
#ifndef HAVE_BYTEORDER_64
|
||||||
inline uint64 ntohll(uint64 i) { return i; }
|
inline uint64 ntohll(uint64 i) { return i; }
|
||||||
inline uint64 htonll(uint64 i) { return i; }
|
inline uint64 htonll(uint64 i) { return i; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -207,6 +210,7 @@ inline double ntohd(double d)
|
||||||
|
|
||||||
inline double htond(double d) { return ntohd(d); }
|
inline double htond(double d) { return ntohd(d); }
|
||||||
|
|
||||||
|
#ifndef HAVE_BYTEORDER_64
|
||||||
inline uint64 ntohll(uint64 i)
|
inline uint64 ntohll(uint64 i)
|
||||||
{
|
{
|
||||||
u_char c;
|
u_char c;
|
||||||
|
@ -224,6 +228,7 @@ inline uint64 ntohll(uint64 i)
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint64 htonll(uint64 i) { return ntohll(i); }
|
inline uint64 htonll(uint64 i) { return ntohll(i); }
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue