From f3fedbfdbad774f3813ef9ad8d0f321edfde2072 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 3 Oct 2021 03:35:49 +0300 Subject: [PATCH] engine: add safe ParseFile to menu extended API --- engine/client/cl_gameui.c | 3 ++- engine/menu_int.h | 6 ++++++ public/crtlib.h | 7 ++----- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/engine/client/cl_gameui.c b/engine/client/cl_gameui.c index ad1ca07f..382a5e21 100644 --- a/engine/client/cl_gameui.c +++ b/engine/client/cl_gameui.c @@ -1232,7 +1232,8 @@ static ui_extendedfuncs_t gExtendedfuncs = Con_UtfMoveLeft, Con_UtfMoveRight, pfnGetRenderers, - Sys_DoubleTime + Sys_DoubleTime, + _COM_ParseFileSafe }; void UI_UnloadProgs( void ) diff --git a/engine/menu_int.h b/engine/menu_int.h index ccace287..85353c28 100644 --- a/engine/menu_int.h +++ b/engine/menu_int.h @@ -31,6 +31,10 @@ typedef int HIMAGE; // handle to a graphic #define PIC_KEEP_SOURCE (1<<1) // some images keep source #define PIC_NOFLIP_TGA (1<<2) // Steam background completely ignore tga attribute 0x20 +// flags for COM_ParseFileSafe +#define PFILE_IGNOREBRACKET (1<<0) +#define PFILE_HANDLECOLON (1<<1) + typedef struct ui_globalvars_s { float time; // unclamped host.realtime @@ -206,6 +210,8 @@ typedef struct ui_extendedfuncs_s { int (*pfnGetRenderers)( unsigned int num, char *shortName, size_t size1, char *readableName, size_t size2 ); double (*pfnDoubleTime)( void ); + + char *(*pfnParseFile)( char *data, char *buf, const int size, unsigned int flags, int *len ); } ui_extendedfuncs_t; // deprecated export from old engine diff --git a/public/crtlib.h b/public/crtlib.h index 2e676f53..d83e1a3b 100644 --- a/public/crtlib.h +++ b/public/crtlib.h @@ -38,11 +38,8 @@ enum TIME_FILENAME, }; -enum -{ - PFILE_IGNOREBRACKET = BIT( 0 ), - PFILE_HANDLECOLON = BIT( 1 ) -}; +#define PFILE_IGNOREBRACKET BIT( 0 ) +#define PFILE_HANDLECOLON BIT( 1 ) // // crtlib.c