Skip to content

Commit

Permalink
engine: add safe ParseFile to client MobilityAPI
Browse files Browse the repository at this point in the history
  • Loading branch information
a1batross committed Oct 8, 2021
1 parent c368410 commit 621399c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion engine/client/cl_mobile.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ static mobile_engfuncs_t gpMobileEngfuncs =
pfnDrawScaledCharacter,
Sys_Warn,
pfnGetNativeObject,
ID_SetCustomClientID
ID_SetCustomClientID,
_COM_ParseFileSafe
};

qboolean Mobile_Init( void )
Expand Down
7 changes: 7 additions & 0 deletions engine/mobility_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ extern "C" {
#define TOUCH_FL_STROKE (1U << 8)
#define TOUCH_FL_PRECISION (1U << 9)

// flags for COM_ParseFileSafe
#define PFILE_IGNOREBRACKET (1<<0)
#define PFILE_HANDLECOLON (1<<1)

typedef struct mobile_engfuncs_s
{
// indicates version of API. Should be equal to MOBILITY_API_VERSION
Expand Down Expand Up @@ -77,6 +81,9 @@ typedef struct mobile_engfuncs_s
void *(*pfnGetNativeObject)( const char *obj );

void (*pfnSetCustomClientID)( const char *id );

// COM_ParseFile but with buffer size limit, len reports written size or -1 on overflow
char* (*pfnParseFile)( char *data, char *buf, const int size, unsigned int flags, int *len );
// To be continued...
} mobile_engfuncs_t;

Expand Down

0 comments on commit 621399c

Please sign in to comment.