mirror of
https://github.com/J-D-K/JKSV.git
synced 2026-09-09 02:55:23 -05:00
Fix string sanitation logic error.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user