mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 11:10:47 +00:00
Take over more correct G_AddGroup from game.c to astub.c.
The code in the editor was potentially doing a strcat on a strdup'd string. Also, rename AddGamePath to G_AddPath in astub.c and add CODEDUP markers because shared stuff like this ought to be factored out into a separate source file some time. git-svn-id: https://svn.eduke32.com/eduke32@2531 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
694acef9fe
commit
c4efd9b1fa
2 changed files with 23 additions and 14 deletions
|
@ -8380,10 +8380,11 @@ static void G_ShowParameterHelp(void)
|
||||||
wm_msgbox(tempbuf, "%s", s);
|
wm_msgbox(tempbuf, "%s", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddGamePath(const char *buffer)
|
|
||||||
|
// CODEDUP game.c
|
||||||
|
static void G_AddPath(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||||
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
|
||||||
s->str = Bstrdup(buffer);
|
s->str = Bstrdup(buffer);
|
||||||
|
|
||||||
if (CommandPaths)
|
if (CommandPaths)
|
||||||
|
@ -8393,16 +8394,23 @@ static void AddGamePath(const char *buffer)
|
||||||
t->next = s;
|
t->next = s;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandPaths = s;
|
CommandPaths = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CODEDUP game.c
|
||||||
static void G_AddGroup(const char *buffer)
|
static void G_AddGroup(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
char buf[BMAX_PATH];
|
||||||
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
|
||||||
s->str = Bstrdup(buffer);
|
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||||
if (Bstrchr(s->str,'.') == 0)
|
|
||||||
Bstrcat(s->str,".grp");
|
Bstrcpy(buf, buffer);
|
||||||
|
|
||||||
|
if (Bstrchr(buf,'.') == 0)
|
||||||
|
Bstrcat(buf,".grp");
|
||||||
|
|
||||||
|
s->str = Bstrdup(buf);
|
||||||
|
|
||||||
if (CommandGrps)
|
if (CommandGrps)
|
||||||
{
|
{
|
||||||
|
@ -8498,7 +8506,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
#endif
|
#endif
|
||||||
Bstrncpy(g_modDir, argv[i+1], sizeof(g_modDir));
|
Bstrncpy(g_modDir, argv[i+1], sizeof(g_modDir));
|
||||||
g_modDir[sizeof(g_modDir)-1] = 0;
|
g_modDir[sizeof(g_modDir)-1] = 0;
|
||||||
AddGamePath(argv[i+1]);
|
G_AddPath(argv[i+1]);
|
||||||
|
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
COPYARG(i+1);
|
COPYARG(i+1);
|
||||||
|
@ -8685,7 +8693,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
|
||||||
case 'J':
|
case 'J':
|
||||||
c++;
|
c++;
|
||||||
if (!*c) break;
|
if (!*c) break;
|
||||||
AddGamePath(c);
|
G_AddPath(c);
|
||||||
COPYARG(i);
|
COPYARG(i);
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
|
|
|
@ -8567,12 +8567,13 @@ static int32_t loaddefinitions_game(const char *fn, int32_t preload)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CODEDUP astub.c
|
||||||
static void G_AddGroup(const char *buffer)
|
static void G_AddGroup(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
|
||||||
char buf[BMAX_PATH];
|
char buf[BMAX_PATH];
|
||||||
|
|
||||||
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||||
|
|
||||||
Bstrcpy(buf, buffer);
|
Bstrcpy(buf, buffer);
|
||||||
|
|
||||||
|
@ -8591,10 +8592,10 @@ static void G_AddGroup(const char *buffer)
|
||||||
CommandGrps = s;
|
CommandGrps = s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CODEDUP astub.c
|
||||||
static void G_AddPath(const char *buffer)
|
static void G_AddPath(const char *buffer)
|
||||||
{
|
{
|
||||||
struct strllist *s;
|
struct strllist *s = Bcalloc(1,sizeof(struct strllist));
|
||||||
s = (struct strllist *)Bcalloc(1,sizeof(struct strllist));
|
|
||||||
s->str = Bstrdup(buffer);
|
s->str = Bstrdup(buffer);
|
||||||
|
|
||||||
if (CommandPaths)
|
if (CommandPaths)
|
||||||
|
|
Loading…
Reference in a new issue