Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Building in Xcode 6 with iOS8 SDK #381

Closed
unphased opened this issue Oct 12, 2014 · 1 comment
Closed

Building in Xcode 6 with iOS8 SDK #381

unphased opened this issue Oct 12, 2014 · 1 comment

Comments

@unphased
Copy link

Let's look at the first error I'm seeing.

ios8sdk_error_websocketpp

I don't have the old iOS 7 SDK headers handy to do a sanity check, but as you see here, htonll is apparently a macro that results in the breakage of this function definition.

screenshot 2014-10-12 14 36 42

I went ahead and renamed the functions like this:

diff --git a/modelviewer/include/websocketpp/common/network.hpp b/modelviewer/include/websocketpp/common/network.hpp
index 9ba8b53..1b7407c 100644
--- a/modelviewer/include/websocketpp/common/network.hpp
+++ b/modelviewer/include/websocketpp/common/network.hpp
@@ -50,7 +50,7 @@ inline bool is_little_endian() {
 #define TYP_SMLE 1
 #define TYP_BIGE 2

-inline uint64_t htonll(uint64_t src) {
+inline uint64_t _htonll(uint64_t src) {
     static int typ = TYP_INIT;
     unsigned char c;
     union {
@@ -71,8 +71,8 @@ inline uint64_t htonll(uint64_t src) {
     return x.ull;
 }

-inline uint64_t ntohll(uint64_t src) {
-    return htonll(src);
+inline uint64_t _ntohll(uint64_t src) {
+    return _htonll(src);
 }

 } // net
diff --git a/modelviewer/include/websocketpp/frame.hpp b/modelviewer/include/websocketpp/frame.hpp
index 32b50a6..f557e21 100644
--- a/modelviewer/include/websocketpp/frame.hpp
+++ b/modelviewer/include/websocketpp/frame.hpp
@@ -266,7 +266,7 @@ private:
         }

         uint64_converter temp64;
-        temp64.i = lib::net::htonll(payload_size);
+        temp64.i = lib::net::_htonll(payload_size);
         std::copy(temp64.c+payload_offset,temp64.c+8,bytes);

         return 8-payload_offset;
@@ -583,7 +583,7 @@ inline uint16_t get_extended_size(const extended_header &e) {
 inline uint64_t get_jumbo_size(const extended_header &e) {
     uint64_converter temp64;
     std::copy(e.bytes,e.bytes+8,temp64.c);
-    return lib::net::ntohll(temp64.i);
+    return lib::net::_ntohll(temp64.i);
 }

 /// Extract the full payload size field from a WebSocket header

This makes everything work again. However it seems like we should really just use the provided macro implementations so perhaps the right fix is to do a preprocessor check if the macro htonll is already defined?

@zaphoyd zaphoyd added this to the 0.4.0 milestone Oct 14, 2014
@zaphoyd zaphoyd self-assigned this Oct 14, 2014
@zaphoyd
Copy link
Owner

zaphoyd commented Oct 14, 2014

this has been fixed on the development branch

jim-wong pushed a commit to yoinc/websocketpp that referenced this issue Oct 21, 2014
…aphoyd#358

This avoids conflicts with OS level macros

Conflicts:
	changelog.md
	test/utility/frame.cpp
@zaphoyd zaphoyd closed this as completed in 2e7a902 Nov 4, 2014
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants