made FCommandLine::operator[] return a const char * and fixed two places where this triggered a compile error.

This commit is contained in:
Christoph Oelckers 2024-10-19 13:22:30 +02:00 committed by Rachael Alexanderson
parent b5fdd6deff
commit 769274656e
No known key found for this signature in database
GPG key ID: 26A8ACCE97115EE0
4 changed files with 5 additions and 6 deletions

View file

@ -193,7 +193,7 @@ int FCommandLine::argc ()
return _argc; return _argc;
} }
char *FCommandLine::operator[] (int i) const char *FCommandLine::operator[] (int i)
{ {
if (_argv == NULL) if (_argv == NULL)
{ {

View file

@ -44,7 +44,7 @@ public:
FCommandLine (const char *commandline, bool no_escapes = false); FCommandLine (const char *commandline, bool no_escapes = false);
~FCommandLine (); ~FCommandLine ();
int argc (); int argc ();
char *operator[] (int i); const char *operator[] (int i);
const char *args () { return cmd; } const char *args () { return cmd; }
void Shift(); void Shift();

View file

@ -248,7 +248,7 @@ CCMD (vid_scaletoheight)
} }
} }
inline bool atob(char* I) inline bool atob(const char* I)
{ {
if (stricmp (I, "true") == 0 || stricmp (I, "1") == 0) if (stricmp (I, "true") == 0 || stricmp (I, "1") == 0)
return true; return true;

View file

@ -100,12 +100,11 @@ CCMD (addkeysection)
} }
// Limit the ini name to 32 chars // Limit the ini name to 32 chars
if (strlen (argv[2]) > 32) FString name(argv[2], 32);
argv[2][32] = 0;
for (unsigned i = 0; i < KeySections.Size(); i++) for (unsigned i = 0; i < KeySections.Size(); i++)
{ {
if (KeySections[i].mTitle.CompareNoCase(argv[2]) == 0) if (KeySections[i].mTitle.CompareNoCase(name) == 0)
{ {
CurrentKeySection = i; CurrentKeySection = i;
return; return;