added tabbing to some of the preprocessor code in i_tcp.c and mserv.c to make it easier to read them (and to allow me to understand what I need to do for the next commit)

This commit is contained in:
Monster Iestyn 2020-07-12 21:31:25 +01:00
parent 8a032256bf
commit 43e53368b5
2 changed files with 135 additions and 137 deletions

View file

@ -20,127 +20,127 @@
#endif #endif
#ifndef NO_IPV6 #ifndef NO_IPV6
#define HAVE_IPV6 #define HAVE_IPV6
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#define USE_WINSOCK #define USE_WINSOCK
#if defined (_WIN64) || defined (HAVE_IPV6) #if defined (_WIN64) || defined (HAVE_IPV6)
#define USE_WINSOCK2 #define USE_WINSOCK2
#else //_WIN64/HAVE_IPV6 #else //_WIN64/HAVE_IPV6
#define USE_WINSOCK1 #define USE_WINSOCK1
#endif #endif
#endif //WIN32 OS #endif //WIN32 OS
#ifdef USE_WINSOCK2 #ifdef USE_WINSOCK2
#include <ws2tcpip.h> #include <ws2tcpip.h>
#endif #endif
#include "doomdef.h" #include "doomdef.h"
#if defined (NOMD5) && !defined (NONET) #if defined (NOMD5) && !defined (NONET)
//#define NONET //#define NONET
#endif #endif
#ifdef NONET #ifdef NONET
#undef HAVE_MINIUPNPC #undef HAVE_MINIUPNPC
#else #else
#ifdef USE_WINSOCK1 #ifdef USE_WINSOCK1
#include <winsock.h> #include <winsock.h>
#elif !defined (SCOUW2) && !defined (SCOUW7) #elif !defined (SCOUW2) && !defined (SCOUW7)
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
#include <arpa/inet.h> #include <arpa/inet.h>
#endif //normal BSD API #endif //normal BSD API
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
#ifdef __APPLE_CC__ #ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_ #ifndef _BSD_SOCKLEN_T_
#define _BSD_SOCKLEN_T_ #define _BSD_SOCKLEN_T_
#endif //_BSD_SOCKLEN_T_ #endif //_BSD_SOCKLEN_T_
#endif //__APPLE_CC__ #endif //__APPLE_CC__
#include <sys/socket.h> #include <sys/socket.h>
#include <netinet/in.h> #include <netinet/in.h>
#endif //normal BSD API #endif //normal BSD API
#ifndef USE_WINSOCK #ifndef USE_WINSOCK
#include <netdb.h> #include <netdb.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif //normal BSD API #endif //normal BSD API
#include <errno.h> #include <errno.h>
#include <time.h> #include <time.h>
#if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON) #if (defined (__unix__) && !defined (MSDOS)) || defined(__APPLE__) || defined (UNIXCOMMON)
#include <sys/time.h> #include <sys/time.h>
#endif // UNIXCOMMON #endif // UNIXCOMMON
#endif // !NONET #endif // !defined (SCOUW2) && !defined (SCOUW7))
#ifdef USE_WINSOCK #ifdef USE_WINSOCK
// some undefined under win32 // some undefined under win32
#undef errno #undef errno
//#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right? //#define errno WSAGetLastError() //Alam_GBC: this is the correct way, right?
#define errno h_errno // some very strange things happen when not using h_error?!? #define errno h_errno // some very strange things happen when not using h_error?!?
#ifdef EWOULDBLOCK #ifdef EWOULDBLOCK
#undef EWOULDBLOCK #undef EWOULDBLOCK
#endif #endif
#define EWOULDBLOCK WSAEWOULDBLOCK #define EWOULDBLOCK WSAEWOULDBLOCK
#ifdef EMSGSIZE #ifdef EMSGSIZE
#undef EMSGSIZE #undef EMSGSIZE
#endif #endif
#define EMSGSIZE WSAEMSGSIZE #define EMSGSIZE WSAEMSGSIZE
#ifdef ECONNREFUSED #ifdef ECONNREFUSED
#undef ECONNREFUSED #undef ECONNREFUSED
#endif #endif
#define ECONNREFUSED WSAECONNREFUSED #define ECONNREFUSED WSAECONNREFUSED
#ifdef ETIMEDOUT #ifdef ETIMEDOUT
#undef ETIMEDOUT #undef ETIMEDOUT
#endif #endif
#define ETIMEDOUT WSAETIMEDOUT #define ETIMEDOUT WSAETIMEDOUT
#ifndef IOC_VENDOR #ifndef IOC_VENDOR
#define IOC_VENDOR 0x18000000 #define IOC_VENDOR 0x18000000
#endif #endif
#ifndef _WSAIOW #ifndef _WSAIOW
#define _WSAIOW(x,y) (IOC_IN|(x)|(y)) #define _WSAIOW(x,y) (IOC_IN|(x)|(y))
#endif #endif
#ifndef SIO_UDP_CONNRESET #ifndef SIO_UDP_CONNRESET
#define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12) #define SIO_UDP_CONNRESET _WSAIOW(IOC_VENDOR,12)
#endif #endif
#ifndef AI_ADDRCONFIG #ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x00000400 #define AI_ADDRCONFIG 0x00000400
#endif #endif
#ifndef STATUS_INVALID_PARAMETER #ifndef STATUS_INVALID_PARAMETER
#define STATUS_INVALID_PARAMETER 0xC000000D #define STATUS_INVALID_PARAMETER 0xC000000D
#endif #endif
#endif #endif // USE_WINSOCK
#ifdef __DJGPP__ #ifdef __DJGPP__
#ifdef WATTCP // Alam_GBC: Wattcp may need this #ifdef WATTCP // Alam_GBC: Wattcp may need this
#include <tcp.h> #include <tcp.h>
#define strerror strerror_s #define strerror strerror_s
#else // wattcp #else // wattcp
#include <lsck/lsck.h> #include <lsck/lsck.h>
#endif // libsocket #endif // libsocket
#endif // djgpp #endif // djgpp
typedef union typedef union
{ {
struct sockaddr any; struct sockaddr any;
struct sockaddr_in ip4; struct sockaddr_in ip4;
#ifdef HAVE_IPV6 #ifdef HAVE_IPV6
struct sockaddr_in6 ip6; struct sockaddr_in6 ip6;
#endif #endif
} mysockaddr_t; } mysockaddr_t;
#ifdef HAVE_MINIUPNPC #ifdef HAVE_MINIUPNPC
#ifdef STATIC_MINIUPNPC #ifdef STATIC_MINIUPNPC
#define STATICLIB #define STATICLIB
#endif #endif
#include "miniupnpc/miniwget.h" #include "miniupnpc/miniwget.h"
#include "miniupnpc/miniupnpc.h" #include "miniupnpc/miniupnpc.h"
#include "miniupnpc/upnpcommands.h" #include "miniupnpc/upnpcommands.h"
#undef STATICLIB #undef STATICLIB
static UINT8 UPNP_support = TRUE; static UINT8 UPNP_support = TRUE;
#endif #endif // HAVE_MINIUPNC
#endif // !NONET #endif // !NONET

View file

@ -19,37 +19,35 @@
#include <time.h> #include <time.h>
#if (defined (NOMSERV)) && !defined (NONET) #if (defined (NOMSERV)) && !defined (NONET)
#define NONET #define NONET
#endif #endif
#ifndef NONET #ifndef NONET
#ifndef NO_IPV6
#define HAVE_IPV6
#endif
#ifdef _WIN32
#define RPC_NO_WINDOWS_H
#ifdef HAVE_IPV6
#include <ws2tcpip.h>
#else
#include <winsock.h> // socket(),...
#endif //!HAVE_IPV6
#else
#include <arpa/inet.h>
#ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_
#define _BSD_SOCKLEN_T_
#endif
#endif
#include <sys/socket.h> // socket(),...
#include <netinet/in.h> // sockaddr_in
#include <netdb.h> // getaddrinfo(),...
#include <sys/ioctl.h>
#ifndef NO_IPV6 #include <sys/time.h> // timeval,... (TIMEOUT)
#define HAVE_IPV6 #include <errno.h>
#endif #endif // _WIN32
#ifdef _WIN32
#define RPC_NO_WINDOWS_H
#ifdef HAVE_IPV6
#include <ws2tcpip.h>
#else
#include <winsock.h> // socket(),...
#endif //!HAVE_IPV6
#else
#include <arpa/inet.h>
#ifdef __APPLE_CC__
#ifndef _BSD_SOCKLEN_T_
#define _BSD_SOCKLEN_T_
#endif
#endif
#include <sys/socket.h> // socket(),...
#include <netinet/in.h> // sockaddr_in
#include <netdb.h> // getaddrinfo(),...
#include <sys/ioctl.h>
#include <sys/time.h> // timeval,... (TIMEOUT)
#include <errno.h>
#endif // _WIN32
#endif // !NONET #endif // !NONET
#include "doomstat.h" #include "doomstat.h"
@ -155,18 +153,18 @@ typedef struct
// win32 or djgpp // win32 or djgpp
#if defined (_WIN32) || defined (__DJGPP__) #if defined (_WIN32) || defined (__DJGPP__)
#define ioctl ioctlsocket #define ioctl ioctlsocket
#define close closesocket #define close closesocket
#ifdef WATTCP #ifdef WATTCP
#define strerror strerror_s #define strerror strerror_s
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
#undef errno #undef errno
#define errno h_errno // some very strange things happen when not using h_error #define errno h_errno // some very strange things happen when not using h_error
#endif #endif
#ifndef AI_ADDRCONFIG #ifndef AI_ADDRCONFIG
#define AI_ADDRCONFIG 0x00000400 #define AI_ADDRCONFIG 0x00000400
#endif #endif
#endif #endif
#ifndef NONET #ifndef NONET