add GetChars() accessors to many FString uses where const char* is wanted.
By no means complete, it's just a start to get rid of that automatic type conversion operator.
This commit is contained in:
parent
a3eb1ec1fd
commit
1717ff47b2
28 changed files with 92 additions and 97 deletions
|
|
@ -528,7 +528,7 @@ void CreatePath(const char *fn)
|
|||
{
|
||||
FString name(fn);
|
||||
name += '/';
|
||||
DoCreatePath(name);
|
||||
DoCreatePath(name.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -805,13 +805,13 @@ FString ExpandEnvVars(const char *searchpathstring)
|
|||
if (length != 0)
|
||||
{
|
||||
FString varname = FString(dollar + 1, length);
|
||||
if (stricmp(varname, "progdir") == 0)
|
||||
if (varname.Compare("progdir") == 0)
|
||||
{
|
||||
out += progdir;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *varvalue = getenv(varname);
|
||||
char *varvalue = getenv(varname.GetChars());
|
||||
if ( (varvalue != NULL) && (strlen(varvalue) != 0) )
|
||||
{
|
||||
out += varvalue;
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ FConfigFile::FConfigFile (const FConfigFile &other)
|
|||
Sections = CurrentSection = NULL;
|
||||
LastSectionPtr = &Sections;
|
||||
CurrentEntry = NULL;
|
||||
ChangePathName (other.PathName);
|
||||
ChangePathName (other.PathName.GetChars());
|
||||
*this = other;
|
||||
OkayToWrite = other.OkayToWrite;
|
||||
FileExisted = other.FileExisted;
|
||||
|
|
@ -134,7 +134,7 @@ FConfigFile &FConfigFile::operator = (const FConfigFile &other)
|
|||
while (fromsection != NULL)
|
||||
{
|
||||
fromentry = fromsection->RootEntry;
|
||||
tosection = NewConfigSection (fromsection->SectionName);
|
||||
tosection = NewConfigSection (fromsection->SectionName.GetChars());
|
||||
while (fromentry != NULL)
|
||||
{
|
||||
NewConfigEntry (tosection, fromentry->Key, fromentry->Value);
|
||||
|
|
@ -602,7 +602,7 @@ void FConfigFile::LoadConfigFile ()
|
|||
bool succ;
|
||||
|
||||
FileExisted = false;
|
||||
if (!file.OpenFile (PathName))
|
||||
if (!file.OpenFile (PathName.GetChars()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -739,7 +739,7 @@ FConfigFile::FConfigEntry *FConfigFile::ReadMultiLineValue(FileReader *file, FCo
|
|||
// Append this line to the value.
|
||||
value << readbuf;
|
||||
}
|
||||
return NewConfigEntry(section, key, value);
|
||||
return NewConfigEntry(section, key, value.GetChars());
|
||||
}
|
||||
|
||||
//====================================================================
|
||||
|
|
@ -787,7 +787,7 @@ bool FConfigFile::WriteConfigFile () const
|
|||
return true;
|
||||
}
|
||||
|
||||
FileWriter *file = FileWriter::Open (PathName);
|
||||
FileWriter *file = FileWriter::Open (PathName.GetChars());
|
||||
FConfigSection *section;
|
||||
FConfigEntry *entry;
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ void D_AddWildFile(std::vector<std::string>& wadfiles, const char* value, const
|
|||
auto path = ExtractFilePath(value);
|
||||
auto name = ExtractFileBase(value, true);
|
||||
if (path.IsEmpty()) path = ".";
|
||||
if (FileSys::ScanDirectory(list, path, name, true))
|
||||
if (FileSys::ScanDirectory(list, path.GetChars(), name.GetChars(), true))
|
||||
{
|
||||
for(auto& entry : list)
|
||||
{
|
||||
|
|
@ -178,7 +178,7 @@ void D_AddConfigFiles(std::vector<std::string>& wadfiles, const char* section, c
|
|||
{
|
||||
// D_AddWildFile resets config's position, so remember it
|
||||
config->GetPosition(pos);
|
||||
D_AddWildFile(wadfiles, ExpandEnvVars(value), extension, config);
|
||||
D_AddWildFile(wadfiles, ExpandEnvVars(value).GetChars(), extension, config);
|
||||
// Reset config's position to get next wad
|
||||
config->SetPosition(pos);
|
||||
}
|
||||
|
|
@ -230,7 +230,7 @@ const char* BaseFileSearch(const char* file, const char* ext, bool lookfirstinpr
|
|||
if (lookfirstinprogdir)
|
||||
{
|
||||
BFSwad.Format("%s%s%s", progdir.GetChars(), progdir.Back() == '/' ? "" : "/", file);
|
||||
if (DirEntryExists(BFSwad))
|
||||
if (DirEntryExists(BFSwad.GetChars()))
|
||||
{
|
||||
return BFSwad.GetChars();
|
||||
}
|
||||
|
|
@ -257,7 +257,7 @@ const char* BaseFileSearch(const char* file, const char* ext, bool lookfirstinpr
|
|||
if (dir.IsNotEmpty())
|
||||
{
|
||||
BFSwad.Format("%s%s%s", dir.GetChars(), dir.Back() == '/' ? "" : "/", file);
|
||||
if (DirEntryExists(BFSwad))
|
||||
if (DirEntryExists(BFSwad.GetChars()))
|
||||
{
|
||||
return BFSwad.GetChars();
|
||||
}
|
||||
|
|
@ -271,7 +271,7 @@ const char* BaseFileSearch(const char* file, const char* ext, bool lookfirstinpr
|
|||
{
|
||||
FString tmp = file;
|
||||
DefaultExtension(tmp, ext);
|
||||
return BaseFileSearch(tmp, nullptr, lookfirstinprogdir, config);
|
||||
return BaseFileSearch(tmp.GetChars(), nullptr, lookfirstinprogdir, config);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue