Skip to content

Commit

Permalink
added a third batch of GetChars call to FStrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
coelckers committed Oct 7, 2023
1 parent 89535b8 commit c94c631
Show file tree
Hide file tree
Showing 31 changed files with 216 additions and 217 deletions.
6 changes: 3 additions & 3 deletions src/common/audio/music/i_music.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,8 @@ static ZMusic_MidiSource GetMIDISource(const char *fn)
FString src = fn;
if (src.Compare("*") == 0) src = mus_playing.name;

auto lump = fileSystem.CheckNumForName(src, ns_music);
if (lump < 0) lump = fileSystem.CheckNumForFullName(src);
auto lump = fileSystem.CheckNumForName(src.GetChars(), ns_music);
if (lump < 0) lump = fileSystem.CheckNumForFullName(src.GetChars());
if (lump < 0)
{
Printf("Cannot find MIDI lump %s.\n", src.GetChars());
Expand Down Expand Up @@ -391,7 +391,7 @@ UNSAFE_CCMD (writewave)
Printf("MIDI dump of %s failed: %s\n",argv[1], ZMusic_GetLastError());
}

S_ChangeMusic(savedsong.name, savedsong.baseorder, savedsong.loop, true);
S_ChangeMusic(savedsong.name.GetChars(), savedsong.baseorder, savedsong.loop, true);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/common/audio/sound/i_sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ class NullSoundRenderer : public SoundRenderer

void I_InitSound ()
{
FModule_SetProgDir(progdir);
FModule_SetProgDir(progdir.GetChars());
/* Get command line options: */
nosound = !!Args->CheckParm ("-nosound");
nosfx = !!Args->CheckParm ("-nosfx");
Expand Down
4 changes: 2 additions & 2 deletions src/common/engine/i_net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,12 @@ void BuildAddress (sockaddr_in *address, const char *name)

if (!isnamed)
{
address->sin_addr.s_addr = inet_addr (target);
address->sin_addr.s_addr = inet_addr (target.GetChars());
Printf ("Node number %d, address %s\n", doomcom.numnodes, target.GetChars());
}
else
{
hostentry = gethostbyname (target);
hostentry = gethostbyname (target.GetChars());
if (!hostentry)
I_FatalError ("gethostbyname: couldn't find %s\n%s", target.GetChars(), neterror());
address->sin_addr.s_addr = *(int *)hostentry->h_addr_list[0];
Expand Down
1 change: 1 addition & 0 deletions src/common/engine/stringtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class FStringTable
bool MatchDefaultString(const char *name, const char *content) const;
const char *GetString(const char *name, uint32_t *langtable, int gender = -1) const;
const char *operator() (const char *name) const; // Never returns NULL
const char* operator() (const FString& name) const { return operator()(name.GetChars()); }
const char *operator[] (const char *name) const
{
return GetString(name, nullptr);
Expand Down
4 changes: 2 additions & 2 deletions src/common/rendering/gl/gl_renderbuffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,8 @@ FShaderProgram *GLPPRenderState::GetGLShader(PPShader *shader)
prolog = UniformBlockDecl::Create("Uniforms", shader->Uniforms, POSTPROCESS_BINDINGPOINT);
prolog += shader->Defines;

glshader->Compile(FShaderProgram::Vertex, shader->VertexShader, "", shader->Version);
glshader->Compile(FShaderProgram::Fragment, shader->FragmentShader, prolog, shader->Version);
glshader->Compile(FShaderProgram::Vertex, shader->VertexShader.GetChars(), "", shader->Version);
glshader->Compile(FShaderProgram::Fragment, shader->FragmentShader.GetChars(), prolog.GetChars(), shader->Version);
glshader->Link(shader->FragmentShader.GetChars());
if (!shader->Uniforms.empty())
glshader->SetUniformBufferLocation(POSTPROCESS_BINDINGPOINT, "Uniforms");
Expand Down
10 changes: 5 additions & 5 deletions src/common/rendering/gl/gl_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static FString CalcProgramBinaryChecksum(const FString &vertex, const FString &f
static FString CreateProgramCacheName(bool create)
{
FString path = M_GetCachePath(create);
if (create) CreatePath(path);
if (create) CreatePath(path.GetChars());
path << "/shadercache.zdsc";
return path;
}
Expand All @@ -125,7 +125,7 @@ static void LoadShaders()
{
FString path = CreateProgramCacheName(false);
FileReader fr;
if (!fr.OpenFile(path))
if (!fr.OpenFile(path.GetChars()))
I_Error("Could not open shader file");

char magic[4];
Expand Down Expand Up @@ -166,7 +166,7 @@ static void LoadShaders()
static void SaveShaders()
{
FString path = CreateProgramCacheName(true);
std::unique_ptr<FileWriter> fw(FileWriter::Open(path));
std::unique_ptr<FileWriter> fw(FileWriter::Open(path.GetChars()));
if (fw)
{
uint32_t count = (uint32_t)ShaderCache.size();
Expand Down Expand Up @@ -837,9 +837,9 @@ bool FShaderCollection::CompileNextShader()
}
else if (mCompileState == 2)
{
FString name = ExtractFileBase(usershaders[i].shader);
FString name = ExtractFileBase(usershaders[i].shader.GetChars());
FString defines = defaultshaders[usershaders[i].shaderType].Defines + usershaders[i].defines;
FShader *shc = Compile(name, usershaders[i].shader, defaultshaders[usershaders[i].shaderType].lightfunc, defines, true, mPassType);
FShader *shc = Compile(name.GetChars(), usershaders[i].shader.GetChars(), defaultshaders[usershaders[i].shaderType].lightfunc, defines.GetChars(), true, mPassType);
mMaterialShaders.Push(shc);
mCompileIndex++;
if (mCompileIndex >= (int)usershaders.Size())
Expand Down
10 changes: 5 additions & 5 deletions src/common/rendering/gl/gl_shaderprogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void FShaderProgram::CompileShader(ShaderType type)

const auto &handle = mShaders[type];

FGLDebug::LabelObject(GL_SHADER, handle, mShaderNames[type]);
FGLDebug::LabelObject(GL_SHADER, handle, mShaderNames[type].GetChars());

const FString &patchedCode = mShaderSources[type];
int lengths[1] = { (int)patchedCode.Len() };
Expand Down Expand Up @@ -186,7 +186,7 @@ void FShaderProgram::Link(const char *name)
glUseProgram(mProgram);
for (auto &uni : samplerstobind)
{
auto index = glGetUniformLocation(mProgram, uni.first);
auto index = glGetUniformLocation(mProgram, uni.first.GetChars());
if (index >= 0)
{
glUniform1i(index, uni.second);
Expand Down Expand Up @@ -300,8 +300,8 @@ void FPresentShaderBase::Init(const char * vtx_shader_name, const char * program
FString prolog = Uniforms.CreateDeclaration("Uniforms", PresentUniforms::Desc());

mShader.reset(new FShaderProgram());
mShader->Compile(FShaderProgram::Vertex, "shaders/pp/screenquad.vp", prolog, 330);
mShader->Compile(FShaderProgram::Fragment, vtx_shader_name, prolog, 330);
mShader->Compile(FShaderProgram::Vertex, "shaders/pp/screenquad.vp", prolog.GetChars(), 330);
mShader->Compile(FShaderProgram::Fragment, vtx_shader_name, prolog.GetChars(), 330);
mShader->Link(program_name);
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
Uniforms.Init();
Expand Down Expand Up @@ -355,7 +355,7 @@ void FShadowMapShader::Bind()

mShader.reset(new FShaderProgram());
mShader->Compile(FShaderProgram::Vertex, "shaders/pp/screenquad.vp", "", 430);
mShader->Compile(FShaderProgram::Fragment, "shaders/pp/shadowmap.fp", prolog, 430);
mShader->Compile(FShaderProgram::Fragment, "shaders/pp/shadowmap.fp", prolog.GetChars(), 430);
mShader->Link("shaders/glsl/shadowmap");
mShader->SetUniformBufferLocation(Uniforms.BindingPoint(), "Uniforms");
Uniforms.Init();
Expand Down
2 changes: 1 addition & 1 deletion src/common/rendering/hwrenderer/data/hw_shaderpatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ FString RemoveSamplerBindings(FString code, TArray<std::pair<FString, int>> &sam
FString type = NextGlslToken(chars, len, pos);
FString identifier = NextGlslToken(chars, len, pos);

isSamplerUniformName = uniform.Compare("uniform") == 0 && isShaderType(type);
isSamplerUniformName = uniform.Compare("uniform") == 0 && isShaderType(type.GetChars());
if (isSamplerUniformName)
{
samplerstobind.Push(std::make_pair(identifier, val));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CCMD (shaderenable)
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{
PostProcessShader &shader = PostProcessShaders[i];
if (strcmp(shader.Name, shaderName) == 0)
if (shader.Name.Compare(shaderName) == 0)
{
if (value != -1)
shader.Enabled = value;
Expand Down Expand Up @@ -70,7 +70,7 @@ CCMD (shaderuniform)
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{
PostProcessShader &shader = PostProcessShaders[i];
if (strcmp(shader.Name, shaderName) == 0)
if (shader.Name.Compare(shaderName) == 0)
{
if (argv.argc() > 3)
{
Expand Down Expand Up @@ -116,7 +116,7 @@ CCMD(listuniforms)
for (unsigned int i = 0; i < PostProcessShaders.Size(); i++)
{
PostProcessShader &shader = PostProcessShaders[i];
if (strcmp(shader.Name, shaderName) == 0)
if (shader.Name.Compare(shaderName) == 0)
{
Printf("Shader '%s' uniforms:\n", shaderName);

Expand Down
4 changes: 2 additions & 2 deletions src/common/scripting/core/imports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ void InitImports()
{
assert(afunc->VMPointer != NULL);
*(afunc->VMPointer) = new VMNativeFunction(afunc->Function, afunc->FuncName);
(*(afunc->VMPointer))->QualifiedName = ClassDataAllocator.Strdup(FStringf("%s.%s", afunc->ClassName + 1, afunc->FuncName));
(*(afunc->VMPointer))->PrintableName = ClassDataAllocator.Strdup(FStringf("%s.%s [Native]", afunc->ClassName+1, afunc->FuncName));
(*(afunc->VMPointer))->QualifiedName = ClassDataAllocator.Strdup(FStringf("%s.%s", afunc->ClassName + 1, afunc->FuncName).GetChars());
(*(afunc->VMPointer))->PrintableName = ClassDataAllocator.Strdup(FStringf("%s.%s [Native]", afunc->ClassName+1, afunc->FuncName).GetChars());
(*(afunc->VMPointer))->DirectNativeCall = afunc->DirectNative;
AFTable.Push(*afunc);
});
Expand Down
2 changes: 1 addition & 1 deletion src/common/startscreen/endoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ int RunEndoom()
return 0;
}

int endoom_lump = fileSystem.CheckNumForFullName (endoomName, true);
int endoom_lump = fileSystem.CheckNumForFullName (endoomName.GetChars(), true);

if (endoom_lump < 0 || fileSystem.FileLength (endoom_lump) != 4000)
{
Expand Down
4 changes: 2 additions & 2 deletions src/common/textures/gametexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ void FGameTexture::AddAutoMaterials()
if (this->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
{
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
auto lump = fileSystem.CheckNumForFullName(lookup, false, FileSys::ns_global, true);
auto lump = fileSystem.CheckNumForFullName(lookup.GetChars(), false, FileSys::ns_global, true);
if (lump != -1)
{
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
Expand All @@ -199,7 +199,7 @@ void FGameTexture::AddAutoMaterials()
if (!this->Layers || this->Layers.get()->*(layer.pointer) == nullptr) // only if no explicit assignment had been done.
{
FStringf lookup("%s%s%s", layer.path, fullname ? "" : "auto/", searchname.GetChars());
auto lump = fileSystem.CheckNumForFullName(lookup, false, FileSys::ns_global, true);
auto lump = fileSystem.CheckNumForFullName(lookup.GetChars(), false, FileSys::ns_global, true);
if (lump != -1)
{
auto bmtex = TexMan.FindGameTexture(fileSystem.GetFileFullName(lump), ETextureType::Any, FTextureManager::TEXMAN_TryAny);
Expand Down
2 changes: 1 addition & 1 deletion src/common/thirdparty/libsmackerdec/src/FileStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ bool FileStream::Open(const char *fileName)
{
FString fixedname = fileName;
FixPathSeperator(fixedname);
file = fileSystem.OpenFileReader(fixedname);
file = fileSystem.OpenFileReader(fixedname.GetChars());
if (!file.isOpen())
{
// log error
Expand Down
2 changes: 1 addition & 1 deletion src/common/utility/engineerrors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void I_DebugPrintf(const char *fmt,...)

va_end(args);

auto wstr = WideString(s);
auto wstr = WideString(s.GetChars());
OutputDebugStringW(wstr.c_str());
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/console/c_notifybuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@ void FNotifyBuffer::Draw()

int scale = active_con_scaletext(twod, generic_ui);
if (!center)
DrawText(twod, font, color, 0, line, notify.Text,
DrawText(twod, font, color, 0, line, notify.Text.GetChars(),
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true,
DTA_Alpha, alpha, TAG_DONE);
else
DrawText(twod, font, color, (twod->GetWidth() -
font->StringWidth (notify.Text) * scale) / 2 / scale,
line, notify.Text,
line, notify.Text.GetChars(),
DTA_VirtualWidth, twod->GetWidth() / scale,
DTA_VirtualHeight, twod->GetHeight() / scale,
DTA_KeepRatio, true,
Expand Down
18 changes: 9 additions & 9 deletions src/d_netinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ int D_PlayerClassToInt (const char *classname)
{
auto type = PlayerClasses[i].Type;

if (type->GetDisplayName().IsNotEmpty() && stricmp(type->GetDisplayName(), classname) == 0)
if (type->GetDisplayName().IsNotEmpty() && type->GetDisplayName().CompareNoCase(classname) == 0)
{
return i;
}
Expand Down Expand Up @@ -786,7 +786,7 @@ FString D_GetUserInfoStrings(int pnum, bool compact)
break;

case NAME_Skin:
result.AppendFormat("\\%s", D_EscapeUserInfo(Skins[info->GetSkin()].Name).GetChars());
result.AppendFormat("\\%s", D_EscapeUserInfo(Skins[info->GetSkin()].Name.GetChars()).GetChars());
break;

default:
Expand Down Expand Up @@ -870,15 +870,15 @@ void D_ReadUserInfoStrings (int pnum, uint8_t **stream, bool update)
switch (keyname.GetIndex())
{
case NAME_Gender:
info->GenderChanged(value);
info->GenderChanged(value.GetChars());
break;

case NAME_PlayerClass:
info->PlayerClassChanged(value);
info->PlayerClassChanged(value.GetChars());
break;

case NAME_Skin:
info->SkinChanged(value, players[pnum].CurrentPlayerClass);
info->SkinChanged(value.GetChars(), players[pnum].CurrentPlayerClass);
if (players[pnum].mo != NULL)
{
if (players[pnum].cls != NULL &&
Expand All @@ -895,11 +895,11 @@ void D_ReadUserInfoStrings (int pnum, uint8_t **stream, bool update)
break;

case NAME_Team:
UpdateTeam(pnum, atoi(value), update);
UpdateTeam(pnum, atoi(value.GetChars()), update);
break;

case NAME_Color:
info->ColorChanged(value);
info->ColorChanged(value.GetChars());
break;

default:
Expand Down Expand Up @@ -956,7 +956,7 @@ void WriteUserInfo(FSerializer &arc, userinfo_t &info)
switch (pair->Key.GetIndex())
{
case NAME_Skin:
string = Skins[info.GetSkin()].Name;
string = Skins[info.GetSkin()].Name.GetChars();
break;

case NAME_PlayerClass:
Expand All @@ -969,7 +969,7 @@ void WriteUserInfo(FSerializer &arc, userinfo_t &info)
string = val.String;
break;
}
arc.StringPtr(name, string);
arc.StringPtr(name.GetChars(), string);
}
arc.EndObject();
}
Expand Down
2 changes: 1 addition & 1 deletion src/events.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ bool EventManager::SendNetworkEvent(FString name, int arg1, int arg2, int arg3,
return false;

Net_WriteByte(DEM_NETEVENT);
Net_WriteString(name);
Net_WriteString(name.GetChars());
Net_WriteByte(3);
Net_WriteLong(arg1);
Net_WriteLong(arg2);
Expand Down
2 changes: 1 addition & 1 deletion src/g_dumpinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ CCMD(listmaps)
for (unsigned i = 0; i < wadlevelinfos.Size(); i++)
{
level_info_t *info = &wadlevelinfos[i];
MapData *map = P_OpenMapData(info->MapName, true);
MapData *map = P_OpenMapData(info->MapName.GetChars(), true);

if (map != NULL)
{
Expand Down
Loading

0 comments on commit c94c631

Please sign in to comment.