Skip to content

Commit ea42245

Browse files
author
Martin Veith
committed
Fix conflicting ntohll macro on OS X
Change-Id: Iaebafdb228996dace3272998d6dbb365891e3d79
1 parent 8cecba6 commit ea42245

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

Capu/include/capu/util/SocketInputStream.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace capu
2828

2929
inline
3030
uint64_t
31-
ntohll(uint64_t & value)
31+
_ntohll(uint64_t & value)
3232
{
3333
int_t checkNumber = 42;
3434
if(*(char_t*)&checkNumber == 42)
@@ -201,7 +201,7 @@ namespace capu
201201
IInputStream& SocketInputStream::operator>>(uint64_t& value)
202202
{
203203
read(reinterpret_cast<char_t*>(&value), sizeof(uint64_t));
204-
value = ntohll(value);
204+
value = _ntohll(value);
205205
return *this;
206206
}
207207

Capu/include/capu/util/SocketOutputStream.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
namespace capu
2727
{
28-
uint64_t htonll(const uint64_t value);
28+
uint64_t _htonll(const uint64_t value);
2929

3030
/* The SocketOutputStream writes data to a given socket*/
3131
template<uint16_t SNDBUFSIZE = 1450>
@@ -213,7 +213,7 @@ namespace capu
213213
IOutputStream&
214214
SocketOutputStream<SNDBUFSIZE>::operator<<( const int64_t value)
215215
{
216-
const int64_t networkOrder = htonll(value);
216+
const int64_t networkOrder = _htonll(value);
217217
return write(&networkOrder, sizeof(int64_t));
218218
}
219219

@@ -381,7 +381,7 @@ namespace capu
381381

382382
inline
383383
uint64_t
384-
htonll(const uint64_t value)
384+
_htonll(const uint64_t value)
385385
{
386386
int64_t checkNumber = 42;
387387
if(*(char_t*)&checkNumber == 42)

Capu_Test/src/util/TcpSocketInputStreamTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace capu
6363
typedef uint64_t VALUE_TYPE;
6464
static void Send(TcpSocket& socket, const uint64_t& data)
6565
{
66-
uint64_t tmp = htonll(data);
66+
uint64_t tmp = _htonll(data);
6767
SendToSocket(socket, reinterpret_cast<char_t*>(&tmp), sizeof(uint64_t));
6868
}
6969
};
@@ -73,7 +73,7 @@ namespace capu
7373
typedef int64_t VALUE_TYPE;
7474
static void Send(TcpSocket& socket, const int64_t& data)
7575
{
76-
uint64_t tmp = htonll(static_cast<int64_t>(data));
76+
uint64_t tmp = _htonll(static_cast<int64_t>(data));
7777
SendToSocket(socket, reinterpret_cast<char_t*>(&tmp), sizeof(int64_t));
7878
}
7979
};

Capu_Test/src/util/TcpSocketOutputStreamTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ namespace capu
8686
{
8787
uint64_t tmp;
8888
receiveFromSocket(reinterpret_cast<char_t*>(&tmp), sizeof(uint64_t));
89-
value = ntohll(tmp);
89+
value = _ntohll(tmp);
9090
return *this;
9191
}
9292

Capu_Test/src/util/UdpSocketInputStreamTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace capu
5858
typedef int64_t VALUE_TYPE;
5959
static void Send(const capu::uint16_t port, UdpSocket& socket, const int64_t& data)
6060
{
61-
int64_t tmp = htonll(data);
61+
int64_t tmp = _htonll(data);
6262
SendToSocket(port, socket, reinterpret_cast<char_t*>(&tmp), sizeof(int64_t));
6363
}
6464
};
@@ -68,7 +68,7 @@ namespace capu
6868
typedef uint64_t VALUE_TYPE;
6969
static void Send(const capu::uint16_t port, UdpSocket& socket, const uint64_t& data)
7070
{
71-
int64_t tmp = htonll(data);
71+
int64_t tmp = _htonll(data);
7272
SendToSocket(port, socket, reinterpret_cast<char_t*>(&tmp), sizeof(uint64_t));
7373
}
7474
};

Capu_Test/src/util/UdpSocketOutputStreamTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace capu
8181
{
8282
uint64_t tmp;
8383
receiveFromSocket(reinterpret_cast<char_t*>(&tmp), sizeof(uint64_t));
84-
value = ntohll(tmp);
84+
value = _ntohll(tmp);
8585
return *this;
8686
}
8787

0 commit comments

Comments
 (0)