-
Notifications
You must be signed in to change notification settings - Fork 213
Fix build for macOS where endian.h is not available #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -60,6 +60,10 @@ typedef uint32_t in_addr_t; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <endian.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#elif defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <libkern/OSByteOrder.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#define be64toh(x) OSSwapBigToHostInt64(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#define htobe64(x) OSSwapHostToBigInt64(x) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+65
to
+66
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So remove this:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <errno.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#include <limits.h> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -160,11 +164,11 @@ uint32_t NetworkToHost(uint32_t value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint64_t NetworkToHost(uint64_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return be64toh(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#error "No be64toh for NetworkToHost, please report this." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
-163
to
+171
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then switch this, and the following cases, to something more like ola/common/network/NetworkUtils.cpp Lines 684 to 712 in e8c755c
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int16_t NetworkToHost(int16_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -176,11 +180,11 @@ int32_t NetworkToHost(int32_t value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int64_t NetworkToHost(int64_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return be64toh(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#error "No be64toh for NetworkToHost, please report this." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint16_t HostToNetwork(uint16_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -200,19 +204,19 @@ int32_t HostToNetwork(int32_t value) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint64_t HostToNetwork(uint64_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return htobe64(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#error "No htobe64 for HostToNetwork, please report this." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
int64_t HostToNetwork(int64_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#ifdef HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#if defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return htobe64(value); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#error "No htobe64 for HostToNetwork, please report this." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // HAVE_ENDIAN_H | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
#endif // defined(HAVE_ENDIAN_H) || defined(__APPLE__) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
uint16_t HostToLittleEndian(uint16_t value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switch this to including OSByteOrder.h if its present.