diff --git a/Descent3/descent.h b/Descent3/descent.h index 3450cf9d..6b446f19 100644 --- a/Descent3/descent.h +++ b/Descent3/descent.h @@ -133,6 +133,10 @@ #include "application.h" +#if defined(POSIX) +#include "linux_fix.h" +#endif + // The name of this product #ifdef DEMO #define PRODUCT_NAME "Descent 3 Demo" diff --git a/Descent3/multi.h b/Descent3/multi.h index 7b38294a..191c7d9c 100644 --- a/Descent3/multi.h +++ b/Descent3/multi.h @@ -498,10 +498,6 @@ #include "object_external.h" #include "player_external.h" -#if defined(POSIX) -#include "linux_fix.h" -#endif - #include "multi_external.h" //defines and structs are in here extern bool Multi_bail_ui_menu; diff --git a/Descent3/newui.h b/Descent3/newui.h index b15a1e17..973721b5 100644 --- a/Descent3/newui.h +++ b/Descent3/newui.h @@ -187,10 +187,6 @@ #ifndef NEWUI_H #define NEWUI_H -#if defined(POSIX) -#include "linux_fix.h" //fix some of the stricmp's -#endif - #include "newui_core.h" // flags for creating a newui window diff --git a/ddio/lnxfile.cpp b/ddio/lnxfile.cpp index 2ede152c..08d34b51 100644 --- a/ddio/lnxfile.cpp +++ b/ddio/lnxfile.cpp @@ -73,8 +73,9 @@ #endif #include "ddio.h" -#include "pserror.h" +#include "linux_fix.h" #include "mem.h" +#include "pserror.h" #define _MAX_DIR 256 diff --git a/lib/lnxscreenmode.h b/lib/lnxscreenmode.h index 9fac9f3c..ce916350 100644 --- a/lib/lnxscreenmode.h +++ b/lib/lnxscreenmode.h @@ -52,9 +52,6 @@ #ifndef __LNXVIDEOMODE_H__ #define __LNXVIDEOMODE_H__ -#if defined(POSIX) -#include "linux_fix.h" -#endif #include #define MODE_OK 0 diff --git a/lib/manage.h b/lib/manage.h index abc99d8e..6bb4beda 100644 --- a/lib/manage.h +++ b/lib/manage.h @@ -26,10 +26,6 @@ #include "bitmap.h" #include "manage_external.h" -#if defined(POSIX) -#include "linux_fix.h" //for strnicmp,etc. -#endif - #define LOCAL_TABLE "Table.loc" #define TEMP_LOCAL_TABLE "Tablr.loc" diff --git a/lib/networking.h b/lib/networking.h index 3d0188cb..bf56a57b 100644 --- a/lib/networking.h +++ b/lib/networking.h @@ -212,8 +212,6 @@ static inline void INADDR_GET_SUN_SUNB(struct in_addr *st, uint8_t *s_b1, uint8_ #include "SDL.h" #include "SDL_thread.h" -#include "linux_fix.h" - #define SOCKET int #define BOOL bool #define SOCKADDR_IN sockaddr_in diff --git a/lib/psclass.h b/lib/psclass.h index 10aa0073..a472775a 100644 --- a/lib/psclass.h +++ b/lib/psclass.h @@ -54,6 +54,8 @@ #ifndef PSCLASS_H #define PSCLASS_H +#include + // a universal list node to use with the list type template struct tListNode { T t; @@ -83,7 +85,7 @@ template class tList { public: tList() { - m_link = m_mark = NULL; + m_link = m_mark = nullptr; m_length = 0; }; ~tList() { tList::free(); }; @@ -101,14 +103,14 @@ public: }; // returns the node at the current link location in iteration. - tListNode *get() const { return m_mark ? m_mark : NULL; }; + tListNode *get() const { return m_mark ? m_mark : nullptr; }; // length int length() const { return m_length; }; // frees list void free() { - m_link = m_mark = NULL; + m_link = m_mark = nullptr; m_length = 0; }; @@ -119,7 +121,7 @@ public: m_mark->next = node; } else { m_link = node; - node->next = NULL; + node->next = nullptr; } m_mark = node; m_length++; @@ -129,7 +131,7 @@ public: tListNode *unlink() { tListNode *freenode, *node; if (!m_link) - return NULL; + return nullptr; if (m_link == m_mark) { freenode = m_mark; m_mark = m_link = m_link->next; @@ -140,7 +142,7 @@ public: freenode = m_mark; node->next = m_mark->next; } - freenode->next = NULL; + freenode->next = nullptr; return freenode; }; }; diff --git a/lib/pstypes.h b/lib/pstypes.h index ba7efb76..33a16aa1 100644 --- a/lib/pstypes.h +++ b/lib/pstypes.h @@ -22,18 +22,10 @@ #include #include -#if defined(POSIX) -#include "linux_fix.h" -#endif - // The maximum length for a file name, including extension. It *does not* include the // terminating NULL, so a buffer to hold a filename needs to be PSFILENAME_LEN+1 bytes long. #define PSFILENAME_LEN 35 -// The maximum length of a path (or path+filename). The seems (from looking at the code) to -// include the terminating NULL. lengthened to 512 to prevent problems with some long pathnames. -#define PSPATHNAME_LEN _MAX_PATH - #if !defined(__APPLE__) #define HOST_BIGENDIAN @HOST_BIGENDIAN @ #else diff --git a/linux/linux_fix.h b/linux/linux_fix.h index 63d387c3..cb98046d 100644 --- a/linux/linux_fix.h +++ b/linux/linux_fix.h @@ -19,6 +19,7 @@ #ifndef __LINUX_FIX_H_ #define __LINUX_FIX_H_ +#include #include #define LOKI_VERSION "" diff --git a/linux/lnxapp.h b/linux/lnxapp.h index b22a6f8e..4fd713df 100644 --- a/linux/lnxapp.h +++ b/linux/lnxapp.h @@ -19,10 +19,6 @@ #ifndef LNXAPP_H #define LNXAPP_H -#if defined(POSIX) -#include "linux_fix.h" -#endif - // if no-display/input specifier is given, it will use defaults #define APPFLAG_USESERVICE 0x00000100 // console (run no output/input) #define APPFLAG_USESVGA 0x00000200 // console (use svgalib for input/output. NOTE: not used in code) diff --git a/module/module.cpp b/module/module.cpp index 5ab33247..93002c66 100644 --- a/module/module.cpp +++ b/module/module.cpp @@ -91,26 +91,20 @@ * * $NoKeywords: $ */ -#include "module.h" -#include "pstypes.h" -#include "pserror.h" + +#include + #include "ddio.h" +#include "module.h" +#include "pserror.h" #if defined(POSIX) #include +#include "linux_fix.h" static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char *filename, char *new_filename); #endif -#include "module.h" -#include "pstypes.h" -#include "pserror.h" -#include -#include -#include -#if defined(POSIX) -#include "linux_fix.h" -#endif #if defined(WIN32) // INSTEAD OF MAKING MODULE HAVE DEPENDENCIES, PUT THE 2 DDIO FUNCTIONS I NEED HERE // Split a pathname into its component parts static void dd_SplitPath(const char *srcPath, char *path, char *filename, char *ext) { diff --git a/netcon/mtclient/chat_api.cpp b/netcon/mtclient/chat_api.cpp index 6026db51..2da78170 100644 --- a/netcon/mtclient/chat_api.cpp +++ b/netcon/mtclient/chat_api.cpp @@ -26,6 +26,7 @@ #if defined(POSIX) #include #include +#include "linux_fix.h" #endif #include "chat_api.h" diff --git a/netcon/mtclient/mtpilottracker.cpp b/netcon/mtclient/mtpilottracker.cpp index 2cb57a69..c355dc0f 100644 --- a/netcon/mtclient/mtpilottracker.cpp +++ b/netcon/mtclient/mtpilottracker.cpp @@ -111,11 +111,14 @@ #include #include -#include "pstypes.h" #include "networking.h" #include "mt_net.h" #include "byteswap.h" +#if defined(POSIX) +#include "linux_fix.h" +#endif + #define LOGIN_LEN 33 #define REAL_NAME_LEN 66 #define PASSWORD_LEN 17 diff --git a/ui/ui.h b/ui/ui.h index ecd6bea6..ffab4600 100644 --- a/ui/ui.h +++ b/ui/ui.h @@ -269,14 +269,9 @@ #include -#if defined(POSIX) -#include "linux_fix.h" //for stricmp's through code -#endif - -#include "uires.h" - -#include "pserror.h" #include "grdefs.h" +#include "pserror.h" +#include "uires.h" // Class identification