diff --git a/src/d_iwad.cpp b/src/d_iwad.cpp index ebce048bc5..f10d48fb7d 100644 --- a/src/d_iwad.cpp +++ b/src/d_iwad.cpp @@ -405,7 +405,7 @@ void FIWadManager::CollectSearchPaths() for (auto &str : mSearchPaths) { FixPathSeperator(str); - if (str[str.Len() - 1] == '/') str.Truncate(str.Len() - 1); + if (str.Back() == '/') str.Truncate(str.Len() - 1); } } diff --git a/src/d_main.cpp b/src/d_main.cpp index 90dbb99b4c..06a7720664 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -1720,7 +1720,7 @@ const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinp } 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)) { return wad; @@ -1747,7 +1747,7 @@ const char *BaseFileSearch (const char *file, const char *ext, bool lookfirstinp dir = NicePath(value); 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)) { return wad; diff --git a/src/pathexpander.cpp b/src/pathexpander.cpp index 2ed0f3ec32..70f9fccc30 100644 --- a/src/pathexpander.cpp +++ b/src/pathexpander.cpp @@ -48,7 +48,7 @@ static FString BuildPath(const FString &base, const char *name) if (base.IsNotEmpty()) { current = base; - if (current[current.Len() - 1] != '/') current += '/'; + if (current.Back() != '/') current += '/'; } current += name; return current; diff --git a/src/sc_man.cpp b/src/sc_man.cpp index 590cba58c7..6482fbc103 100644 --- a/src/sc_man.cpp +++ b/src/sc_man.cpp @@ -321,11 +321,11 @@ void FScanner::PrepareScript () { // The scanner requires the file to end with a '\n', so add one if // 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 // 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.UnlockBuffer(); diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 5f4898b369..08fd1a910c 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -1051,7 +1051,7 @@ FString FStringFormat(VM_ARGS) if (in_fmt) { 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; }