OpenTTD Source: src/safeguards.h Source File

OpenTTD Source 12.0-beta1

safeguards.h
Go to the documentation of this file.
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
7
19 #ifndef SAFEGUARDS_H
20 #define SAFEGUARDS_H
21
22 /* Use MallocT instead. */
23 #define malloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
24
25 /* Use MallocT instead. */
26 #define calloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
27
28 /* Use ReallocT instead. */
29 #define realloc SAFEGUARD_DO_NOT_USE_THIS_METHOD
30
31 /* Use stredup instead. */
32 #define strdup SAFEGUARD_DO_NOT_USE_THIS_METHOD
33 #define strndup SAFEGUARD_DO_NOT_USE_THIS_METHOD
34
35 /* Use strecpy instead. */
36 #define strcpy SAFEGUARD_DO_NOT_USE_THIS_METHOD
37 #define strncpy SAFEGUARD_DO_NOT_USE_THIS_METHOD
38
39 /* Use strecat instead. */
40 #define strcat SAFEGUARD_DO_NOT_USE_THIS_METHOD
41 #define strncat SAFEGUARD_DO_NOT_USE_THIS_METHOD
42
43 /* Use seprintf instead. */
44 #define sprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
45 #define snprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
46
47 /* Use vseprintf instead. */
48 #define vsprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
49 #define vsnprintf SAFEGUARD_DO_NOT_USE_THIS_METHOD
50
51 /* Use fgets instead. */
52 #define gets SAFEGUARD_DO_NOT_USE_THIS_METHOD
53
54 /* No clear replacement. */
55 #define strtok SAFEGUARD_DO_NOT_USE_THIS_METHOD
56
57 /* Use our own templated implementation instead of a macro or function with only one type. */
58 #ifdef min
59 #undef min
60 #endif
61
62 /* Use our own templated implementation instead of a macro or function with only one type. */
63 #ifdef max
64 #undef max
65 #endif
66
67 /* Use our own templated implementation instead of a macro or function with only one type. */
68 #ifdef abs
69 #undef abs
70 #endif
71
72 #if defined(NETWORK_CORE_OS_ABSTRACTION_H) && defined(_WIN32)
73 /* Use NetworkError::GetLast() instead of errno, or do not (indirectly) include network/core/os_abstraction.h.
74 * Winsock does not set errno, but one should rather call WSAGetLastError. NetworkError::GetLast abstracts that away. */
75 #ifdef errno
76 #undef errno
77 #endif
78 #define errno SAFEGUARD_DO_NOT_USE_THIS_METHOD
79
80 /* Use NetworkError::AsString() instead of strerror, or do not (indirectly) include network/core/os_abstraction.h.
81 * Winsock errors are not handled by strerror, but one should rather call FormatMessage. NetworkError::AsString abstracts that away. */
82 #define strerror SAFEGUARD_DO_NOT_USE_THIS_METHOD
83 #endif /* defined(NETWORK_CORE_OS_ABSTRACTION_H) && defined(_WIN32) */
84
85 #endif /* SAFEGUARDS_H */