Common/FileSystem: Fix a couple of warnings from #2716

This commit is contained in:
Connor McLaughlin 2021-11-10 13:18:30 +10:00
parent e6741dad9b
commit fca4a2ec28
1 changed files with 3 additions and 3 deletions

View File

@ -451,7 +451,7 @@ void CanonicalizePath(char* Destination, u32 cbDestination, const char* Path, bo
{ {
char prevCh = (i > 0) ? Path[i - 1] : '\0'; char prevCh = (i > 0) ? Path[i - 1] : '\0';
char currentCh = Path[i]; char currentCh = Path[i];
char nextCh = (i < pathLength) ? Path[i + 1] : '\0'; char nextCh = (i < (pathLength - 1)) ? Path[i + 1] : '\0';
if (currentCh == '.') if (currentCh == '.')
{ {
@ -557,8 +557,8 @@ void CanonicalizePath(std::string& path, bool OSPath /*= true*/)
static inline bool FileSystemCharacterIsSane(char c, bool StripSlashes) static inline bool FileSystemCharacterIsSane(char c, bool StripSlashes)
{ {
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != ' ' && c != ' ' && if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z') && !(c >= '0' && c <= '9') && c != ' ' && c != '_' &&
c != '_' && c != '-' && c != '.') c != '-' && c != '.')
{ {
if (!StripSlashes && (c == '/' || c == '\\')) if (!StripSlashes && (c == '/' || c == '\\'))
return true; return true;