mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- avoid arithmetics with literal null pointers in ParseCommandLine.
Also avoid using longs.
This commit is contained in:
parent
c1cb7783a6
commit
72d7a70732
1 changed files with 8 additions and 6 deletions
|
@ -74,7 +74,7 @@ CVAR(String, screenshot_type, "png", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
|||
CVAR(String, screenshot_dir, "", CVAR_ARCHIVE|CVAR_GLOBALCONFIG);
|
||||
EXTERN_CVAR(Bool, longsavemessages);
|
||||
|
||||
static long ParseCommandLine (const char *args, int *argc, char **argv);
|
||||
static size_t ParseCommandLine (const char *args, int *argc, char **argv);
|
||||
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
|
@ -101,7 +101,7 @@ void M_FindResponseFile (void)
|
|||
TArray<uint8_t> file;
|
||||
int argc = 0;
|
||||
int size;
|
||||
long argsize = 0;
|
||||
size_t argsize = 0;
|
||||
int index;
|
||||
|
||||
// Any more response files after the limit will be removed from the
|
||||
|
@ -179,17 +179,19 @@ void M_FindResponseFile (void)
|
|||
// This is just like the version in c_dispatch.cpp, except it does not
|
||||
// do cvar expansion.
|
||||
|
||||
static long ParseCommandLine (const char *args, int *argc, char **argv)
|
||||
static size_t ParseCommandLine (const char *args, int *argc, char **argv)
|
||||
{
|
||||
int count;
|
||||
char* buffstart;
|
||||
char *buffplace;
|
||||
|
||||
count = 0;
|
||||
buffplace = NULL;
|
||||
buffstart = NULL;
|
||||
if (argv != NULL)
|
||||
{
|
||||
buffplace = argv[0];
|
||||
buffstart = argv[0];
|
||||
}
|
||||
buffplace = buffstart;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
@ -257,7 +259,7 @@ static long ParseCommandLine (const char *args, int *argc, char **argv)
|
|||
{
|
||||
*argc = count;
|
||||
}
|
||||
return (long)(buffplace - (char *)0);
|
||||
return (buffplace - buffstart);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue