Fix string sanitation logic error.

This commit is contained in:
J-D-K 2025-09-13 22:20:44 -04:00
parent 320569e98f
commit 073d8a5169
3 changed files with 8 additions and 4 deletions

View File

@ -39,7 +39,7 @@ INCLUDES := include ./Libraries/FsLib/Switch/FsLib/include ./Libraries/SDLLib/SD
EXEFS_SRC := exefs_src
APP_TITLE := JKSV
APP_AUTHOR := JK
APP_VERSION := 09.08.2025
APP_VERSION := 09.13.2025
ROMFS := romfs
ICON := icon.jpg

View File

@ -32,7 +32,7 @@ namespace
/// @brief Build month.
constexpr uint8_t BUILD_MON = 9;
/// @brief Build day.
constexpr uint8_t BUILD_DAY = 8;
constexpr uint8_t BUILD_DAY = 13;
/// @brief Year.
constexpr uint16_t BUILD_YEAR = 2025;

View File

@ -71,7 +71,11 @@ bool stringutil::sanitize_string_for_path(const char *stringIn, char *stringOut,
const bool isForbidden = std::find(FORBIDDEN_PATH_CHARACTERS.begin(), FORBIDDEN_PATH_CHARACTERS.end(), codepoint) !=
FORBIDDEN_PATH_CHARACTERS.end();
if (isForbidden) { stringOut[outOffset++] = 0x20; }
if (isForbidden)
{
i += count;
continue;
}
else
{
std::memcpy(&stringOut[outOffset], &stringIn[i], static_cast<size_t>(count));
@ -82,7 +86,7 @@ bool stringutil::sanitize_string_for_path(const char *stringIn, char *stringOut,
}
const int outLength = std::char_traits<char>::length(stringOut) - 1;
for (int i = outLength; i-- > 0 && (stringOut[i] == ' ' || stringOut[i] == '.');) { stringOut[i] = '\0'; }
for (int i = outLength; i > 0 && (stringOut[i] == ' ' || stringOut[i] == '.'); i--) { stringOut[i] = '\0'; }
return true;
}