Reduce linux_fix.h usage in project

This commit is contained in:
Azamat H. Hackimov 2024-08-11 14:40:36 +03:00
parent 16a6866885
commit 54f9d75e62
15 changed files with 28 additions and 56 deletions

View File

@ -133,6 +133,10 @@
#include "application.h" #include "application.h"
#if defined(POSIX)
#include "linux_fix.h"
#endif
// The name of this product // The name of this product
#ifdef DEMO #ifdef DEMO
#define PRODUCT_NAME "Descent 3 Demo" #define PRODUCT_NAME "Descent 3 Demo"

View File

@ -498,10 +498,6 @@
#include "object_external.h" #include "object_external.h"
#include "player_external.h" #include "player_external.h"
#if defined(POSIX)
#include "linux_fix.h"
#endif
#include "multi_external.h" //defines and structs are in here #include "multi_external.h" //defines and structs are in here
extern bool Multi_bail_ui_menu; extern bool Multi_bail_ui_menu;

View File

@ -187,10 +187,6 @@
#ifndef NEWUI_H #ifndef NEWUI_H
#define NEWUI_H #define NEWUI_H
#if defined(POSIX)
#include "linux_fix.h" //fix some of the stricmp's
#endif
#include "newui_core.h" #include "newui_core.h"
// flags for creating a newui window // flags for creating a newui window

View File

@ -73,8 +73,9 @@
#endif #endif
#include "ddio.h" #include "ddio.h"
#include "pserror.h" #include "linux_fix.h"
#include "mem.h" #include "mem.h"
#include "pserror.h"
#define _MAX_DIR 256 #define _MAX_DIR 256

View File

@ -52,9 +52,6 @@
#ifndef __LNXVIDEOMODE_H__ #ifndef __LNXVIDEOMODE_H__
#define __LNXVIDEOMODE_H__ #define __LNXVIDEOMODE_H__
#if defined(POSIX)
#include "linux_fix.h"
#endif
#include <SDL.h> #include <SDL.h>
#define MODE_OK 0 #define MODE_OK 0

View File

@ -26,10 +26,6 @@
#include "bitmap.h" #include "bitmap.h"
#include "manage_external.h" #include "manage_external.h"
#if defined(POSIX)
#include "linux_fix.h" //for strnicmp,etc.
#endif
#define LOCAL_TABLE "Table.loc" #define LOCAL_TABLE "Table.loc"
#define TEMP_LOCAL_TABLE "Tablr.loc" #define TEMP_LOCAL_TABLE "Tablr.loc"

View File

@ -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.h"
#include "SDL_thread.h" #include "SDL_thread.h"
#include "linux_fix.h"
#define SOCKET int #define SOCKET int
#define BOOL bool #define BOOL bool
#define SOCKADDR_IN sockaddr_in #define SOCKADDR_IN sockaddr_in

View File

@ -54,6 +54,8 @@
#ifndef PSCLASS_H #ifndef PSCLASS_H
#define PSCLASS_H #define PSCLASS_H
#include <cstdint>
// a universal list node to use with the list type // a universal list node to use with the list type
template <class T> struct tListNode { template <class T> struct tListNode {
T t; T t;
@ -83,7 +85,7 @@ template <class T> class tList {
public: public:
tList() { tList() {
m_link = m_mark = NULL; m_link = m_mark = nullptr;
m_length = 0; m_length = 0;
}; };
~tList() { tList::free(); }; ~tList() { tList::free(); };
@ -101,14 +103,14 @@ public:
}; };
// returns the node at the current link location in iteration. // returns the node at the current link location in iteration.
tListNode<T> *get() const { return m_mark ? m_mark : NULL; }; tListNode<T> *get() const { return m_mark ? m_mark : nullptr; };
// length // length
int length() const { return m_length; }; int length() const { return m_length; };
// frees list // frees list
void free() { void free() {
m_link = m_mark = NULL; m_link = m_mark = nullptr;
m_length = 0; m_length = 0;
}; };
@ -119,7 +121,7 @@ public:
m_mark->next = node; m_mark->next = node;
} else { } else {
m_link = node; m_link = node;
node->next = NULL; node->next = nullptr;
} }
m_mark = node; m_mark = node;
m_length++; m_length++;
@ -129,7 +131,7 @@ public:
tListNode<T> *unlink() { tListNode<T> *unlink() {
tListNode<T> *freenode, *node; tListNode<T> *freenode, *node;
if (!m_link) if (!m_link)
return NULL; return nullptr;
if (m_link == m_mark) { if (m_link == m_mark) {
freenode = m_mark; freenode = m_mark;
m_mark = m_link = m_link->next; m_mark = m_link = m_link->next;
@ -140,7 +142,7 @@ public:
freenode = m_mark; freenode = m_mark;
node->next = m_mark->next; node->next = m_mark->next;
} }
freenode->next = NULL; freenode->next = nullptr;
return freenode; return freenode;
}; };
}; };

View File

@ -22,18 +22,10 @@
#include <cstdlib> #include <cstdlib>
#include <cstdint> #include <cstdint>
#if defined(POSIX)
#include "linux_fix.h"
#endif
// The maximum length for a file name, including extension. It *does not* include the // 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. // terminating NULL, so a buffer to hold a filename needs to be PSFILENAME_LEN+1 bytes long.
#define PSFILENAME_LEN 35 #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__) #if !defined(__APPLE__)
#define HOST_BIGENDIAN @HOST_BIGENDIAN @ #define HOST_BIGENDIAN @HOST_BIGENDIAN @
#else #else

View File

@ -19,6 +19,7 @@
#ifndef __LINUX_FIX_H_ #ifndef __LINUX_FIX_H_
#define __LINUX_FIX_H_ #define __LINUX_FIX_H_
#include <cstring>
#include <sys/stat.h> #include <sys/stat.h>
#define LOKI_VERSION "" #define LOKI_VERSION ""

View File

@ -19,10 +19,6 @@
#ifndef LNXAPP_H #ifndef LNXAPP_H
#define LNXAPP_H #define LNXAPP_H
#if defined(POSIX)
#include "linux_fix.h"
#endif
// if no-display/input specifier is given, it will use defaults // if no-display/input specifier is given, it will use defaults
#define APPFLAG_USESERVICE 0x00000100 // console (run no output/input) #define APPFLAG_USESERVICE 0x00000100 // console (run no output/input)
#define APPFLAG_USESVGA 0x00000200 // console (use svgalib for input/output. NOTE: not used in code) #define APPFLAG_USESVGA 0x00000200 // console (use svgalib for input/output. NOTE: not used in code)

View File

@ -91,26 +91,20 @@
* *
* $NoKeywords: $ * $NoKeywords: $
*/ */
#include "module.h"
#include "pstypes.h" #include <cstdio>
#include "pserror.h"
#include "ddio.h" #include "ddio.h"
#include "module.h"
#include "pserror.h"
#if defined(POSIX) #if defined(POSIX)
#include <dlfcn.h> #include <dlfcn.h>
#include "linux_fix.h"
static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char *filename, char *new_filename); static bool mod_FindRealFileNameCaseInsenstive(const char *directory, const char *filename, char *new_filename);
#endif #endif
#include "module.h"
#include "pstypes.h"
#include "pserror.h"
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#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 #if defined(WIN32) // INSTEAD OF MAKING MODULE HAVE DEPENDENCIES, PUT THE 2 DDIO FUNCTIONS I NEED HERE
// Split a pathname into its component parts // Split a pathname into its component parts
static void dd_SplitPath(const char *srcPath, char *path, char *filename, char *ext) { static void dd_SplitPath(const char *srcPath, char *path, char *filename, char *ext) {

View File

@ -26,6 +26,7 @@
#if defined(POSIX) #if defined(POSIX)
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#include "linux_fix.h"
#endif #endif
#include "chat_api.h" #include "chat_api.h"

View File

@ -111,11 +111,14 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include "pstypes.h"
#include "networking.h" #include "networking.h"
#include "mt_net.h" #include "mt_net.h"
#include "byteswap.h" #include "byteswap.h"
#if defined(POSIX)
#include "linux_fix.h"
#endif
#define LOGIN_LEN 33 #define LOGIN_LEN 33
#define REAL_NAME_LEN 66 #define REAL_NAME_LEN 66
#define PASSWORD_LEN 17 #define PASSWORD_LEN 17

View File

@ -269,14 +269,9 @@
#include <cstdint> #include <cstdint>
#if defined(POSIX)
#include "linux_fix.h" //for stricmp's through code
#endif
#include "uires.h"
#include "pserror.h"
#include "grdefs.h" #include "grdefs.h"
#include "pserror.h"
#include "uires.h"
// Class identification // Class identification