diff options
-rw-r--r-- | src/ByteSwap.h | 19 | ||||
-rw-r--r-- | src/CryptState.cpp | 2 | ||||
-rw-r--r-- | src/Net.cpp | 1 | ||||
-rw-r--r-- | src/Net.h | 10 | ||||
-rw-r--r-- | src/mumble.pri | 2 |
5 files changed, 22 insertions, 12 deletions
diff --git a/src/ByteSwap.h b/src/ByteSwap.h new file mode 100644 index 000000000..f1e8b1a4c --- /dev/null +++ b/src/ByteSwap.h @@ -0,0 +1,19 @@ +// Copyright 2005-2017 The Mumble Developers. All rights reserved. +// Use of this source code is governed by a BSD-style license +// that can be found in the LICENSE file at the root of the +// Mumble source tree or at <https://www.mumble.info/LICENSE>. + +#ifndef MUMBLE_BYTESWAP_H_ +#define MUMBLE_BYTESWAP_H_ + +#if Q_BYTE_ORDER == Q_BIG_ENDIAN +#define SWAP64(x) (x) +#else +#if defined(__x86_64__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) +#define SWAP64(x) __builtin_bswap64(x) +#else +#define SWAP64(x) qbswap<quint64>(x) +#endif +#endif + +#endif diff --git a/src/CryptState.cpp b/src/CryptState.cpp index da26a8ae4..b8d718ef5 100644 --- a/src/CryptState.cpp +++ b/src/CryptState.cpp @@ -16,7 +16,7 @@ #include "CryptState.h" -#include "Net.h" +#include "ByteSwap.h" CryptState::CryptState() { for (int i=0;i<0x100;i++) diff --git a/src/Net.cpp b/src/Net.cpp index 34d854391..5d9298c0f 100644 --- a/src/Net.cpp +++ b/src/Net.cpp @@ -6,6 +6,7 @@ #include "murmur_pch.h" #include "Net.h" +#include "ByteSwap.h" HostAddress::HostAddress() { addr[0] = addr[1] = 0ULL; @@ -66,14 +66,4 @@ struct Ban { quint32 qHash(const Ban &); -#if Q_BYTE_ORDER == Q_BIG_ENDIAN -#define SWAP64(x) (x) -#else -#if defined(__x86_64__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) -#define SWAP64(x) __builtin_bswap64(x) -#else -#define SWAP64(x) qbswap<quint64>(x) -#endif -#endif - #endif diff --git a/src/mumble.pri b/src/mumble.pri index 0db081fbb..f87c72bb6 100644 --- a/src/mumble.pri +++ b/src/mumble.pri @@ -14,7 +14,7 @@ CONFIG += qt thread debug_and_release warn_on DEFINES *= MUMBLE_VERSION_STRING=$$VERSION INCLUDEPATH += $$PWD . ../mumble_proto VPATH += $$PWD -HEADERS *= ACL.h Channel.h CryptState.h Connection.h Group.h HTMLFilter.h User.h Net.h OSInfo.h Timer.h SSL.h Version.h SSLCipherInfo.h SSLCipherInfoTable.h licenses.h License.h LogEmitter.h CryptographicHash.h CryptographicRandom.h PasswordGenerator.h +HEADERS *= ACL.h Channel.h CryptState.h Connection.h Group.h HTMLFilter.h User.h Net.h OSInfo.h Timer.h SSL.h Version.h SSLCipherInfo.h SSLCipherInfoTable.h licenses.h License.h LogEmitter.h CryptographicHash.h CryptographicRandom.h PasswordGenerator.h ByteSwap.h SOURCES *= ACL.cpp Group.cpp Channel.cpp Connection.cpp HTMLFilter.cpp User.cpp Timer.cpp CryptState.cpp OSInfo.cpp Net.cpp SSL.cpp Version.cpp SSLCipherInfo.cpp License.cpp LogEmitter.cpp CryptographicHash.cpp CryptographicRandom.cpp PasswordGenerator.cpp LIBS *= -lmumble_proto |