0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 09:47:56 +08:00

Problem: test_security_curve build fails with Windows targeting 8 or newer due to duplicate definition of htonll

Solution: use custom implementation only on older Windows versions
This commit is contained in:
Simon Giesecke 2019-02-11 07:24:56 -05:00
parent 120edd9809
commit 21a389ca78

View File

@ -326,8 +326,8 @@ zmq::curve_client_tools_t make_curve_client_tools ()
valid_server_public_decoded); valid_server_public_decoded);
} }
#ifndef htonll // same as htonll, which is only available on few platforms (recent Windows, but not on Linux, e.g.(
uint64_t htonll (uint64_t value_) static uint64_t host_to_network (uint64_t value_)
{ {
// The answer is 42 // The answer is 42
static const int num = 42; static const int num = 42;
@ -343,7 +343,6 @@ uint64_t htonll (uint64_t value_)
return value_; return value_;
} }
} }
#endif
template <size_t N> void send_command (fd_t s_, char (&command_)[N]) template <size_t N> void send_command (fd_t s_, char (&command_)[N])
{ {
@ -353,7 +352,7 @@ template <size_t N> void send_command (fd_t s_, char (&command_)[N])
send_all (s_, &len, 1); send_all (s_, &len, 1);
} else { } else {
send (s_, "\x06"); send (s_, "\x06");
uint64_t len = htonll (N); uint64_t len = host_to_network (N);
send_all (s_, (char *) &len, 8); send_all (s_, (char *) &len, 8);
} }
send_all (s_, command_, N); send_all (s_, command_, N);