diff options
author | Davide Beatrici <davidebeatrici@gmail.com> | 2019-09-12 23:01:11 +0300 |
---|---|---|
committer | Davide Beatrici <davidebeatrici@gmail.com> | 2019-09-12 23:01:11 +0300 |
commit | 58d27c68a9d131e111ca488b42469bdae68e06e2 (patch) | |
tree | 19c301292bbfa91bb86a8de5d4caed961dfbd1ab | |
parent | 5a07244a449592a143a628fde9b84846ee82e0ff (diff) |
Move stuff defined in PCH headers into a dedicated header
The new header is not included in the PCH header(s) because it only defines a few macros and includes a single header.
-rw-r--r-- | src/Utils.h | 32 | ||||
-rw-r--r-- | src/mumble/mumble_pch.hpp | 10 | ||||
-rw-r--r-- | src/mumble/murmur_pch.h | 9 | ||||
-rw-r--r-- | src/murmur/murmur_pch.h | 9 |
4 files changed, 32 insertions, 28 deletions
diff --git a/src/Utils.h b/src/Utils.h new file mode 100644 index 000000000..a1a66e2f6 --- /dev/null +++ b/src/Utils.h @@ -0,0 +1,32 @@ +// Copyright 2005-2019 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>. + +// This header file defines common utility macros and values that are generally valid or used across multiple areas giving them generic scope (rather than localized or functionality-specific scope). + +#ifndef MUMBLE_UTILS_H_ +#define MUMBLE_UTILS_H_ + +#include "QAtomicIntCompat.h" +#include "Qt4Compat.h" + +#include <QtCore/QtGlobal> + +#define iroundf(x) ( static_cast<int>(x) ) + +#ifdef Q_OS_WIN +# define STACKVAR(type, varname, count) type *varname=reinterpret_cast<type *>(_alloca(sizeof(type) * (count))) +#else +# ifdef WId + typedef WId HWND; +# endif +# define __cdecl +# define INVALID_SOCKET -1 +# define SOCKET_ERROR -1 +# define STACKVAR(type, varname, count) type varname[count] +# define CopyMemory(dst,ptr,len) memcpy(dst,ptr,len) +# define ZeroMemory(ptr,len) memset(ptr, 0, len) +#endif + +#endif // MUMBLE_UTILS_H_ diff --git a/src/mumble/mumble_pch.hpp b/src/mumble/mumble_pch.hpp index 594350cd3..e41c539be 100644 --- a/src/mumble/mumble_pch.hpp +++ b/src/mumble/mumble_pch.hpp @@ -100,16 +100,8 @@ #include <psapi.h> #include <math.h> #include <mmreg.h> - -#define STACKVAR(type, varname, count) type *varname=reinterpret_cast<type *>(_alloca(sizeof(type) * (count))) - #else // ifndef Q_OS_WIN #include <math.h> -#define STACKVAR(type, varname, count) type varname[count] -#define CopyMemory(dst,ptr,len) memcpy(dst,ptr,len) -#define ZeroMemory(ptr,len) memset(ptr, 0, len) -#define __cdecl -typedef WId HWND; #include <sys/socket.h> #include <sys/types.h> #include <arpa/inet.h> @@ -121,8 +113,6 @@ typedef WId HWND; #include <mmintrin.h> #endif -#define iroundf(x) ( static_cast<int>(x) ) - #ifdef USE_BONJOUR #include <dns_sd.h> #endif diff --git a/src/mumble/murmur_pch.h b/src/mumble/murmur_pch.h deleted file mode 100644 index 5487f56bb..000000000 --- a/src/mumble/murmur_pch.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2005-2019 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_MUMBLE_MURMUR_PCH_H_ -#define MUMBLE_MUMBLE_MURMUR_PCH_H_ - -#endif diff --git a/src/murmur/murmur_pch.h b/src/murmur/murmur_pch.h index ce83046cf..9a8edfae6 100644 --- a/src/murmur/murmur_pch.h +++ b/src/murmur/murmur_pch.h @@ -80,8 +80,6 @@ extern "C" { #include <errno.h> #include <signal.h> #include <poll.h> -#define INVALID_SOCKET -1 -#define SOCKET_ERROR -1 #ifdef Q_OS_DARWIN #include <poll.h> #endif @@ -89,13 +87,6 @@ extern "C" { #include <math.h> -#if defined (Q_OS_WIN) -#define snprintf ::_snprintf -#define STACKVAR(type, varname, count) type *varname=reinterpret_cast<type *>(_alloca(sizeof(type) * (count))) -#else -#define STACKVAR(type, varname, count) type varname[count] -#endif - #include <boost/function.hpp> #include <boost/bind.hpp> #include <boost/shared_ptr.hpp> |