Commit is being made to allow additions of GPL3+ code previously un-addable. With these changes, contributions back to cuberite are possible with the backporting exemtion, as well as adding stuff in minetest with minetest code properly being read through and implimented to upgrade it to GPL3 from GPL2. project still has Apache2.0 license and credits to all its contributers, but now has the freedom of GPL3+ and all the code that can be implimented and shared with it.
110 lines
2.2 KiB
C++
110 lines
2.2 KiB
C++
|
|
/*
|
|
* Copyright 2011-2022 Cuberite Contributors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
// Globals.h
|
|
|
|
// This file is used for precompiled header generation in MSVC
|
|
|
|
|
|
|
|
|
|
// OS-dependent stuff:
|
|
#ifdef _WIN32
|
|
#define WIN32_LEAN_AND_MEAN
|
|
|
|
#define _WIN32_WINNT 0x501 // We want to target WinXP and higher
|
|
|
|
#include <Windows.h>
|
|
#include <winsock2.h>
|
|
#include <Ws2tcpip.h> // IPv6 stuff
|
|
|
|
// Windows SDK defines min and max macros, messing up with our std::min and std::max usage
|
|
#undef min
|
|
#undef max
|
|
|
|
// Windows SDK defines GetFreeSpace as a constant, probably a Win16 API remnant
|
|
#ifdef GetFreeSpace
|
|
#undef GetFreeSpace
|
|
#endif // GetFreeSpace
|
|
#else
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h> // for mkdir
|
|
#include <sys/time.h>
|
|
#include <sys/socket.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/inet.h>
|
|
#include <netdb.h>
|
|
#include <time.h>
|
|
#include <dirent.h>
|
|
#include <errno.h>
|
|
#include <iostream>
|
|
|
|
#include <cstdio>
|
|
#include <cstring>
|
|
#include <pthread.h>
|
|
#include <semaphore.h>
|
|
#include <errno.h>
|
|
#include <fcntl.h>
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
// CRT stuff:
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include <math.h>
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
|
|
|
|
// STL stuff:
|
|
#include <vector>
|
|
#include <list>
|
|
#include <deque>
|
|
#include <string>
|
|
#include <map>
|
|
#include <algorithm>
|
|
#include <memory>
|
|
#include <set>
|
|
#include <queue>
|
|
|
|
|
|
|
|
|
|
|
|
// Common headers (part 1, without macros):
|
|
#include "../../src/StringUtils.h"
|
|
|
|
|
|
|
|
|
|
|
|
// Common definitions:
|
|
|
|
/** Evaluates to the number of elements in an array (compile-time!) */
|
|
#define ARRAYCOUNT(X) (sizeof(X) / sizeof(*(X)))
|
|
|
|
/** Allows arithmetic expressions like "32 KiB" (but consider using parenthesis around it, "(32 KiB)") */
|
|
#define KiB * 1024
|
|
#define MiB * 1024 * 1024
|
|
|
|
#define ASSERT assert
|