mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
Use FString::Back() when possible
Changed usages of str[str.Len() - 1] to str.Back()
This commit is contained in:
parent
d526ddf7ae
commit
cb982ec313
5 changed files with 7 additions and 7 deletions
|
@ -405,7 +405,7 @@ void FIWadManager::CollectSearchPaths()
|
||||||
for (auto &str : mSearchPaths)
|
for (auto &str : mSearchPaths)
|
||||||
{
|
{
|
||||||
FixPathSeperator(str);
|
FixPathSeperator(str);
|
||||||
if (str[str.Len() - 1] == '/') str.Truncate(str.Len() - 1);
|
if (str.Back() == '/') str.Truncate(str.Len() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1720,7 +1720,7 @@ const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinp
|
||||||
}
|
}
|
||||||
if (lookfirstinprogdir)
|
if (lookfirstinprogdir)
|
||||||
{
|
{
|
||||||
mysnprintf (wad, countof(wad), "%s%s%s", progdir.GetChars(), progdir[progdir.Len() - 1] != '/' ? "/" : "", file);
|
mysnprintf (wad, countof(wad), "%s%s%s", progdir.GetChars(), progdir.Back() == '/' ? "" : "/", file);
|
||||||
if (DirEntryExists (wad))
|
if (DirEntryExists (wad))
|
||||||
{
|
{
|
||||||
return wad;
|
return wad;
|
||||||
|
@ -1747,7 +1747,7 @@ const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinp
|
||||||
dir = NicePath(value);
|
dir = NicePath(value);
|
||||||
if (dir.IsNotEmpty())
|
if (dir.IsNotEmpty())
|
||||||
{
|
{
|
||||||
mysnprintf (wad, countof(wad), "%s%s%s", dir.GetChars(), dir[dir.Len() - 1] != '/' ? "/" : "", file);
|
mysnprintf (wad, countof(wad), "%s%s%s", dir.GetChars(), dir.Back() == '/' ? "" : "/", file);
|
||||||
if (DirEntryExists (wad))
|
if (DirEntryExists (wad))
|
||||||
{
|
{
|
||||||
return wad;
|
return wad;
|
||||||
|
|
|
@ -48,7 +48,7 @@ static FString BuildPath(const FString &base, const char *name)
|
||||||
if (base.IsNotEmpty())
|
if (base.IsNotEmpty())
|
||||||
{
|
{
|
||||||
current = base;
|
current = base;
|
||||||
if (current[current.Len() - 1] != '/') current += '/';
|
if (current.Back() != '/') current += '/';
|
||||||
}
|
}
|
||||||
current += name;
|
current += name;
|
||||||
return current;
|
return current;
|
||||||
|
|
|
@ -321,11 +321,11 @@ void FScanner::PrepareScript ()
|
||||||
{
|
{
|
||||||
// The scanner requires the file to end with a '\n', so add one if
|
// The scanner requires the file to end with a '\n', so add one if
|
||||||
// it doesn't already.
|
// it doesn't already.
|
||||||
if (ScriptBuffer.Len() == 0 || ScriptBuffer[ScriptBuffer.Len() - 1] != '\n')
|
if (ScriptBuffer.Len() == 0 || ScriptBuffer.Back() != '\n')
|
||||||
{
|
{
|
||||||
// If the last character in the buffer is a null character, change
|
// If the last character in the buffer is a null character, change
|
||||||
// it to a newline. Otherwise, append a newline to the end.
|
// it to a newline. Otherwise, append a newline to the end.
|
||||||
if (ScriptBuffer.Len() > 0 && ScriptBuffer[ScriptBuffer.Len() - 1] == '\0')
|
if (ScriptBuffer.Len() > 0 && ScriptBuffer.Back() == '\0')
|
||||||
{
|
{
|
||||||
ScriptBuffer.LockBuffer()[ScriptBuffer.Len() - 1] = '\n';
|
ScriptBuffer.LockBuffer()[ScriptBuffer.Len() - 1] = '\n';
|
||||||
ScriptBuffer.UnlockBuffer();
|
ScriptBuffer.UnlockBuffer();
|
||||||
|
|
|
@ -1051,7 +1051,7 @@ FString FStringFormat(VM_ARGS)
|
||||||
if (in_fmt)
|
if (in_fmt)
|
||||||
{
|
{
|
||||||
if ((c >= '0' && c <= '9') ||
|
if ((c >= '0' && c <= '9') ||
|
||||||
c == '-' || c == '+' || (c == ' ' && fmt_current[fmt_current.Len() - 1] != ' ') || c == '#' || c == '.')
|
c == '-' || c == '+' || (c == ' ' && fmt_current.Back() != ' ') || c == '#' || c == '.')
|
||||||
{
|
{
|
||||||
fmt_current += c;
|
fmt_current += c;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue