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"
#if defined(POSIX)
#include "linux_fix.h"
#endif
// The name of this product
#ifdef DEMO
#define PRODUCT_NAME "Descent 3 Demo"

View File

@ -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;

View File

@ -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

View File

@ -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

View File

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

View File

@ -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"

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

View File

@ -54,6 +54,8 @@
#ifndef PSCLASS_H
#define PSCLASS_H
#include <cstdint>
// a universal list node to use with the list type
template <class T> struct tListNode {
T t;
@ -83,7 +85,7 @@ template <class T> 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<T> *get() const { return m_mark ? m_mark : NULL; };
tListNode<T> *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<T> *unlink() {
tListNode<T> *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;
};
};

View File

@ -22,18 +22,10 @@
#include <cstdlib>
#include <cstdint>
#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

View File

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

View File

@ -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)

View File

@ -91,26 +91,20 @@
*
* $NoKeywords: $
*/
#include "module.h"
#include "pstypes.h"
#include "pserror.h"
#include <cstdio>
#include "ddio.h"
#include "module.h"
#include "pserror.h"
#if defined(POSIX)
#include <dlfcn.h>
#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 <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
// Split a pathname into its component parts
static void dd_SplitPath(const char *srcPath, char *path, char *filename, char *ext) {

View File

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

View File

@ -111,11 +111,14 @@
#include <cstdlib>
#include <cstring>
#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

View File

@ -269,14 +269,9 @@
#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 "pserror.h"
#include "uires.h"
// Class identification