From e37cb782caa14005a717804024abc6a94574f4e9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 5 Nov 2019 00:39:00 +0100 Subject: [PATCH] - fixed dependency problems with OSD definitions being used in another header. --- source/build/include/osd.h | 24 ++++++++++++------------ source/common/console/c_commandline.h | 4 +++- source/common/console/c_dispatch.cpp | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/source/build/include/osd.h b/source/build/include/osd.h index e0ca4a6be..074507d14 100644 --- a/source/build/include/osd.h +++ b/source/build/include/osd.h @@ -6,16 +6,17 @@ #define osd_h_ #include -#include "vfs.h" +#include "compat.h" #include "mutex.h" -typedef struct { - int32_t numparms; - const char *name; - const char **parms; - const char *raw; -} osdfuncparm_t; +struct osdfuncparm_t +{ + int32_t numparms; + const char* name; + const char** parms; + const char* raw; +}; using osdcmdptr_t = osdfuncparm_t const * const; @@ -156,7 +157,7 @@ typedef struct typedef struct { - buildvfs_FILE fp; + FILE *fp; int32_t cutoff; int32_t errors; int32_t lines; @@ -187,7 +188,7 @@ typedef struct extern osdmain_t *osd; -extern buildvfs_FILE osdlog; +extern FILE * osdlog; extern const char* osdlogfn; enum osdflags_t @@ -279,12 +280,11 @@ int OSD_RegisterFunction(const char *pszName, const char *pszDesc, int (*func)(o int osdcmd_cvar_set(osdcmdptr_t parm); void OSD_RegisterCvar(osdcvardata_t * cvar, int (*func)(osdcmdptr_t)); -void OSD_WriteAliases(buildvfs_FILE fp); static inline void OSD_SetHistory(int idx, const char *src) { - osd->history.buf[idx] = (char *)Xmalloc(OSDEDITLENGTH); - Bstrncpyz(osd->history.buf[idx], src, OSDEDITLENGTH); + osd->history.buf[idx] = (char *)malloc(OSDEDITLENGTH); + strncpy(osd->history.buf[idx], src, OSDEDITLENGTH); } extern int osdcmd_restartvid(osdcmdptr_t parm); diff --git a/source/common/console/c_commandline.h b/source/common/console/c_commandline.h index 9a267dada..54d3ad0a6 100644 --- a/source/common/console/c_commandline.h +++ b/source/common/console/c_commandline.h @@ -32,12 +32,14 @@ ** */ - class FConfigFile; +struct osdfuncparm_t; + // Class that can parse command lines class FCommandLine { + friend int OSD_RegisterFunction(const char* pszName, const char* pszDesc, int (*func)(osdfuncparm_t const* const)); public: FCommandLine (const char *commandline, bool no_escapes = false); ~FCommandLine (); diff --git a/source/common/console/c_dispatch.cpp b/source/common/console/c_dispatch.cpp index ce0f934e9..4fae6f8de 100644 --- a/source/common/console/c_dispatch.cpp +++ b/source/common/console/c_dispatch.cpp @@ -1036,7 +1036,7 @@ static TArray dynccmds; // This needs to be explicitly deleted int OSD_RegisterFunction(const char* pszName, const char* pszDesc, int (*func)(osdcmdptr_t)) { FString nname = pszName; - auto callback = [nname, pszDesc, func](FCommandLine& args, int key) + auto callback = [nname, pszDesc, func](FCommandLine& args, void *, int key) { if (args.argc() > 0) args.operator[](0); osdfuncparm_t param = { args.argc(), nname.GetChars(), (const char**)args._argv + 1, args.cmd };