Skip to content

Commit

Permalink
yet even more GetChars calls added.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Oct 7, 2023
1 parent c94c631 commit 7a5a285
Show file tree
Hide file tree
Showing 46 changed files with 190 additions and 190 deletions.
24 changes: 12 additions & 12 deletions src/common/audio/music/i_soundfont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ std::pair<FileReader, FString> FSoundFontReader::LookupFile(const char *name)
for(int i = mPaths.Size()-1; i>=0; i--)
{
FString fullname = mPaths[i] + name;
auto fr = OpenFile(fullname);
auto fr = OpenFile(fullname.GetChars());
if (fr.isOpen()) return std::make_pair(std::move(fr), fullname);
}
}
Expand All @@ -93,7 +93,7 @@ void FSoundFontReader::AddPath(const char *strp)
if (str.Back() != '/') str += '/'; // always let it end with a slash.
for (auto &s : mPaths)
{
if (pathcmp(s.GetChars(), str) == 0)
if (pathcmp(s.GetChars(), str.GetChars()) == 0)
{
// move string to the back.
mPaths.Delete(i);
Expand Down Expand Up @@ -122,13 +122,13 @@ FileReader FSoundFontReader::Open(const char *name, std::string& filename)
if (name == nullptr)
{
fr = OpenMainConfigFile();
filename = MainConfigFileName();
filename = MainConfigFileName().GetChars();
}
else
{
auto res = LookupFile(name);
fr = std::move(res.first);
filename = res.second;
filename = res.second.GetChars();
}
return fr;
}
Expand Down Expand Up @@ -244,7 +244,7 @@ FPatchSetReader::FPatchSetReader(const char *filename)
const char *paths[] = {
"C:/TIMIDITY",
"/TIMIDITY",
progdir
progdir.GetChars()
};
#endif
mAllowAbsolutePaths = true;
Expand All @@ -258,7 +258,7 @@ FPatchSetReader::FPatchSetReader(const char *filename)
for(auto c : paths)
{
FStringf fullname("%s/%s", c, filename);
if (fr.OpenFile(fullname))
if (fr.OpenFile(fullname.GetChars()))
{
mFullPathToConfig = fullname;
}
Expand All @@ -267,7 +267,7 @@ FPatchSetReader::FPatchSetReader(const char *filename)
if (mFullPathToConfig.Len() > 0)
{
FixPathSeperator(mFullPathToConfig);
mBasePath = ExtractFilePath(mFullPathToConfig);
mBasePath = ExtractFilePath(mFullPathToConfig.GetChars());
if (mBasePath.Len() > 0 && mBasePath.Back() != '/') mBasePath += '/';
}
}
Expand All @@ -276,7 +276,7 @@ FPatchSetReader::FPatchSetReader(const char *filename)
FileReader FPatchSetReader::OpenMainConfigFile()
{
FileReader fr;
fr.OpenFile(mFullPathToConfig);
fr.OpenFile(mFullPathToConfig.GetChars());
return fr;
}

Expand All @@ -286,7 +286,7 @@ FileReader FPatchSetReader::OpenFile(const char *name)
if (IsAbsPath(name)) path = name;
else path = mBasePath + name;
FileReader fr;
fr.OpenFile(path);
fr.OpenFile(path.GetChars());
return fr;
}

Expand All @@ -302,7 +302,7 @@ FLumpPatchSetReader::FLumpPatchSetReader(const char *filename)

mBasePath = filename;
FixPathSeperator(mBasePath);
mBasePath = ExtractFilePath(mBasePath);
mBasePath = ExtractFilePath(mBasePath.GetChars());
if (mBasePath.Len() > 0 && mBasePath.Back() != '/') mBasePath += '/';
}

Expand Down Expand Up @@ -523,8 +523,8 @@ FSoundFontReader *FSoundFontManager::OpenSoundFont(const char *name, int allowed
auto sfi = FindSoundFont(name, allowed);
if (sfi != nullptr)
{
if (sfi->type == SF_SF2) return new FSF2Reader(sfi->mFilename);
else return new FZipPatReader(sfi->mFilename);
if (sfi->type == SF_SF2) return new FSF2Reader(sfi->mFilename.GetChars());
else return new FZipPatReader(sfi->mFilename.GetChars());
}
return nullptr;

Expand Down
14 changes: 7 additions & 7 deletions src/common/audio/music/music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,15 +463,15 @@ static void SaveGains()
{
auto path = M_GetAppDataPath(true);
path << "/replaygain.ini";
FConfigFile gains(path);
FConfigFile gains(path.GetChars());
TMap<FString, float>::Iterator it(gainMap);
TMap<FString, float>::Pair* pair;

if (gains.SetSection("Gains", true))
{
while (it.NextPair(pair))
{
gains.SetValueForKey(pair->Key, std::to_string(pair->Value).c_str());
gains.SetValueForKey(pair->Key.GetChars(), std::to_string(pair->Value).c_str());
}
}
gains.WriteConfigFile();
Expand All @@ -484,7 +484,7 @@ static void ReadGains()
done = true;
auto path = M_GetAppDataPath(true);
path << "/replaygain.ini";
FConfigFile gains(path);
FConfigFile gains(path.GetChars());
if (gains.SetSection("Gains"))
{
const char* key;
Expand Down Expand Up @@ -669,7 +669,7 @@ bool S_ChangeMusic(const char* musicname, int order, bool looping, bool force)

if (!mus_playing.name.IsEmpty() &&
mus_playing.handle != nullptr &&
stricmp(mus_playing.name, musicname) == 0 &&
mus_playing.name.CompareNoCase(musicname) == 0 &&
ZMusic_IsLooping(mus_playing.handle) == zmusic_bool(looping))
{
if (order != mus_playing.baseorder)
Expand Down Expand Up @@ -768,7 +768,7 @@ void S_RestartMusic ()
{
FString song = mus_playing.LastSong;
mus_playing.LastSong = "";
S_ChangeMusic (song, mus_playing.baseorder, mus_playing.loop, true);
S_ChangeMusic (song.GetChars(), mus_playing.baseorder, mus_playing.loop, true);
}
else
{
Expand All @@ -791,7 +791,7 @@ void S_MIDIDeviceChanged(int newdev)
// Reload the song to change the device
auto mi = mus_playing;
S_StopMusic(true);
S_ChangeMusic(mi.name, mi.baseorder, mi.loop);
S_ChangeMusic(mi.name.GetChars(), mi.baseorder, mi.loop);
}
}

Expand All @@ -807,7 +807,7 @@ int S_GetMusic (const char **name)

if (mus_playing.name.IsNotEmpty())
{
*name = mus_playing.name;
*name = mus_playing.name.GetChars();
order = mus_playing.baseorder;
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/common/audio/sound/oalsound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ CVAR (String, snd_alresampler, "Default", CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
#define OPENALLIB1 "libopenal.1.dylib"
#define OPENALLIB2 "OpenAL.framework/OpenAL"
#else // !__APPLE__
#define OPENALLIB1 NicePath("$PROGDIR/" OPENALLIB)
#define OPENALLIB1 NicePath("$PROGDIR/" OPENALLIB).GetChars()
#define OPENALLIB2 OPENALLIB
#endif

Expand Down
6 changes: 3 additions & 3 deletions src/common/cutscenes/movieplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ MoviePlayer* OpenMovie(const char* filename, TArray<int>& ans, const int* framet
{
auto fn = StripExtension(filename);
DefaultExtension(fn, ".ivf");
fr = fileSystem.OpenFileReader(fn);
fr = fileSystem.OpenFileReader(fn.GetChars());
}

if (!fr.isOpen()) fr = fileSystem.OpenFileReader(filename);
Expand Down Expand Up @@ -905,7 +905,7 @@ MoviePlayer* OpenMovie(const char* filename, TArray<int>& ans, const int* framet
// VPX files have no sound track, so look for a same-named sound file with a known extension as the soundtrack to be played.
static const char* knownSoundExts[] = { "OGG", "FLAC", "MP3", "OPUS", "WAV" };
FString name = StripExtension(filename);
anm->soundtrack = fileSystem.FindFileWithExtensions(name, knownSoundExts, countof(knownSoundExts));
anm->soundtrack = fileSystem.FindFileWithExtensions(name.GetChars(), knownSoundExts, countof(knownSoundExts));
return anm;
}
// add more formats here.
Expand Down Expand Up @@ -936,7 +936,7 @@ DEFINE_ACTION_FUNCTION(_MoviePlayer, Create)
if (firstframetime == -1) firstframetime = frametime;
if (lastframetime == -1) lastframetime = frametime;
int frametimes[] = { firstframetime, frametime, lastframetime };
auto movie = OpenMovie(filename, *sndinf, frametime == -1? nullptr : frametimes, flags, error);
auto movie = OpenMovie(filename.GetChars(), *sndinf, frametime == -1? nullptr : frametimes, flags, error);
if (!movie)
{
Printf(TEXTCOLOR_YELLOW "%s", error.GetChars());
Expand Down
4 changes: 2 additions & 2 deletions src/common/cutscenes/screenjob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ void AddGenericVideo(DObject* runner, const FString& fn, int soundid, int fps)
int CutsceneDef::GetSound()
{
FSoundID id = INVALID_SOUND;
if (soundName.IsNotEmpty()) id = soundEngine->FindSound(soundName);
if (soundName.IsNotEmpty()) id = soundEngine->FindSound(soundName.GetChars());
if (id == INVALID_SOUND) id = soundEngine->FindSoundByResID(soundID);
return id.index();
}
Expand All @@ -163,7 +163,7 @@ void CutsceneDef::Create(DObject* runner)
{
if (function.IsNotEmpty())
{
CallCreateFunction(function, runner);
CallCreateFunction(function.GetChars(), runner);
}
else if (video.IsNotEmpty())
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/engine/m_joy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static bool M_SetJoystickConfigSection(IJoystickConfig *joy, bool create, FConfi
FString id = "Joy:";
id += joy->GetIdentifier();
if (!GameConfig) return false;
return GameConfig->SetSection(id, create);
return GameConfig->SetSection(id.GetChars(), create);
}

//==========================================================================
Expand Down
6 changes: 3 additions & 3 deletions src/common/engine/serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, FTextureID &value, FTe
}
else
{
name = pic->GetName();
name = pic->GetName().GetChars();
}
arc.WriteKey(key);
arc.w->StartArray();
Expand Down Expand Up @@ -1507,8 +1507,8 @@ FString DictionaryToString(const Dictionary &dict)

while (i.NextPair(pair))
{
writer.Key(pair->Key);
writer.String(pair->Value);
writer.Key(pair->Key.GetChars());
writer.String(pair->Value.GetChars());
}

writer.EndObject();
Expand Down
2 changes: 1 addition & 1 deletion src/common/engine/stats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ void FStat::PrintStat (F2DDrawer *drawer)
// Count number of linefeeds but ignore terminating ones.
if (stattext[i] == '\n') y -= fontheight;
}
DrawText(drawer, NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext,
DrawText(drawer, NewConsoleFont, CR_GREEN, 5 / textScale, y, stattext.GetChars(),
DTA_VirtualWidth, twod->GetWidth() / textScale,
DTA_VirtualHeight, twod->GetHeight() / textScale,
DTA_KeepRatio, true, TAG_DONE);
Expand Down
4 changes: 2 additions & 2 deletions src/common/engine/stringtable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ bool FStringTable::ParseLanguageCSV(int lumpnum, const char* buffer, size_t size
auto filter = filterstr.Split(" ", FString::TOK_SKIPEMPTY);
for (auto& entry : filter)
{
if (sysCallbacks.CheckGame(entry))
if (sysCallbacks.CheckGame(entry.GetChars()))
{
ok = true;
break;
Expand Down Expand Up @@ -639,7 +639,7 @@ bool FStringTable::MatchDefaultString(const char *name, const char *content) con

// Check a secondary key, in case the text comparison cannot be done due to needed orthographic fixes (see Harmony's exit text)
FStringf checkkey("%s_CHECK", name);
auto cc = GetLanguageString(checkkey, FStringTable::default_table);
auto cc = GetLanguageString(checkkey.GetChars(), FStringTable::default_table);
if (cc) c = cc;

return (c && !strnicmp(c, content, strcspn(content, "\n\r\t")));
Expand Down
2 changes: 1 addition & 1 deletion src/common/menu/joystickmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void UpdateJoystickMenu(IJoystickConfig *selected)

for (int ii = 0; ii < (int)Joysticks.Size(); ++ii)
{
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[ii]->GetName(), Joysticks[ii]);
it = CreateOptionMenuItemJoyConfigMenu(Joysticks[ii]->GetName().GetChars(), Joysticks[ii]);
GC::WriteBarrier(opt, it);
opt->mItems.Push(it);
if (ii == itemnum) opt->mSelectedItem = opt->mItems.Size();
Expand Down
2 changes: 1 addition & 1 deletion src/common/menu/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ bool DMenuItemBase::GetString(int i, char *s, int len)
FString retstr;
VMReturn ret[2]; ret[0].IntAt(&retval); ret[1].StringAt(&retstr);
VMCall(func, params, countof(params), ret, 2);
strncpy(s, retstr, len);
strncpy(s, retstr.GetChars(), len);
return !!retval;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/common/menu/menudef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,7 +1628,7 @@ static void InitMusicMenus()
{
FString display = entry.mName;
display.ReplaceChars("_", ' ');
auto it = CreateOptionMenuItemCommand(display, FStringf("%s \"%s\"", std::get<2>(p), entry.mName.GetChars()), true);
auto it = CreateOptionMenuItemCommand(display.GetChars(), FStringf("%s \"%s\"", std::get<2>(p), entry.mName.GetChars()), true);
static_cast<DOptionMenuDescriptor*>(*menu)->mItems.Push(it);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/common/menu/messagebox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,6 @@ DEFINE_ACTION_FUNCTION(DMenu, StartMessage)
PARAM_STRING(msg);
PARAM_INT(mode);
PARAM_NAME(action);
M_StartMessage(msg, mode, action);
M_StartMessage(msg.GetChars(), mode, action);
return 0;
}
12 changes: 6 additions & 6 deletions src/common/menu/savegamemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void FSavegameManagerBase::DoSave(int Selected, const char *savegamestring)
break;
}
}
PerformSaveGame(filename, savegamestring);
PerformSaveGame(filename.GetChars(), savegamestring);
}
M_ClearMenus();
}
Expand All @@ -262,7 +262,7 @@ DEFINE_ACTION_FUNCTION(FSavegameManager, DoSave)
PARAM_SELF_STRUCT_PROLOGUE(FSavegameManagerBase);
PARAM_INT(sel);
PARAM_STRING(name);
self->DoSave(sel, name);
self->DoSave(sel, name.GetChars());
return 0;
}

Expand Down Expand Up @@ -559,7 +559,7 @@ FString G_GetSavegamesFolder()
}
else
{
name = **save_dir ? save_dir : M_GetSavegamesPath();
name = **save_dir ? FString(save_dir) : M_GetSavegamesPath();
usefilter = true;
}

Expand All @@ -574,8 +574,8 @@ FString G_GetSavegamesFolder()
if (usefilter && SavegameFolder.IsNotEmpty())
name << SavegameFolder << '/';

name = NicePath(name);
CreatePath(name);
name = NicePath(name.GetChars());
CreatePath(name.GetChars());
return name;
}

Expand All @@ -589,7 +589,7 @@ FString G_BuildSaveName(const char* prefix)
{
FString name = G_GetSavegamesFolder() + prefix;
DefaultExtension(name, "." SAVEGAME_EXT); // only add an extension if the prefix doesn't have one already.
name = NicePath(name);
name = NicePath(name.GetChars());
name.Substitute("\\", "/");
return name;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/models/models_ue1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ bool FUE1Model::Load( const char *filename, int lumpnum, const char *buffer, int
if ( (size_t)realfilename.IndexOf("_d.3d") == realfilename.Len()-5 )
{
realfilename.Substitute("_d.3d","_a.3d");
lumpnum2 = fileSystem.CheckNumForFullName(realfilename);
lumpnum2 = fileSystem.CheckNumForFullName(realfilename.GetChars());
mDataLump = lumpnum;
mAnivLump = lumpnum2;
}
else
{
realfilename.Substitute("_a.3d","_d.3d");
lumpnum2 = fileSystem.CheckNumForFullName(realfilename);
lumpnum2 = fileSystem.CheckNumForFullName(realfilename.GetChars());
mAnivLump = lumpnum;
mDataLump = lumpnum2;
}
Expand Down
4 changes: 2 additions & 2 deletions src/common/scripting/interface/stringformat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,13 +408,13 @@ DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, ByteAt, StringByteAt)

static void StringFilter(FString *self, FString *result)
{
*result = strbin1(*self);
*result = strbin1(self->GetChars());
}

DEFINE_ACTION_FUNCTION_NATIVE(FStringStruct, Filter, StringFilter)
{
PARAM_SELF_STRUCT_PROLOGUE(FString);
ACTION_RETURN_STRING(strbin1(*self));
ACTION_RETURN_STRING(strbin1(self->GetChars()));
}

static int StringIndexOf(FString *self, const FString &substr, int startIndex)
Expand Down
2 changes: 1 addition & 1 deletion src/common/scripting/jit/jit_move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static int CastS2I(FString *b) { return (int)b->ToLong(); }
static double CastS2F(FString *b) { return b->ToDouble(); }
static int CastS2N(FString *b) { return b->Len() == 0 ? NAME_None : FName(*b).GetIndex(); }
static void CastN2S(FString *a, int b) { FName name = FName(ENamedName(b)); *a = name.IsValidName() ? name.GetChars() : ""; }
static int CastS2Co(FString *b) { return V_GetColor(*b); }
static int CastS2Co(FString *b) { return V_GetColor(b->GetChars()); }
static void CastCo2S(FString *a, int b) { PalEntry c(b); a->Format("%02x %02x %02x", c.r, c.g, c.b); }
static int CastS2So(FString *b) { return S_FindSound(*b).index(); }
static void CastSo2S(FString* a, int b) { *a = soundEngine->GetSoundName(FSoundID::fromInt(b)); }
Expand Down
Loading

0 comments on commit 7a5a285

Please sign in to comment.