mirror of
https://github.com/stenzek/duckstation.git
synced 2026-02-11 17:04:33 +00:00
StringUtil: Fix logical errors
This commit is contained in:
@@ -31,7 +31,7 @@ static std::string DecodeUTF16StringImpl(const void* bytes, size_t size);
|
||||
|
||||
bool StringUtil::WildcardMatch(const char* subject, const char* mask, bool case_sensitive /*= true*/)
|
||||
{
|
||||
if (case_sensitive)
|
||||
if (!case_sensitive)
|
||||
{
|
||||
const char* cp = nullptr;
|
||||
const char* mp = nullptr;
|
||||
@@ -417,7 +417,7 @@ std::string StringUtil::ReplaceAll(const std::string_view subject, const std::st
|
||||
|
||||
void StringUtil::ReplaceAll(std::string* subject, const std::string_view search, const std::string_view replacement)
|
||||
{
|
||||
if (!subject->empty())
|
||||
if (!subject->empty() && !search.empty())
|
||||
{
|
||||
std::string::size_type start_pos = 0;
|
||||
while ((start_pos = subject->find(search, start_pos)) != std::string::npos)
|
||||
|
||||
@@ -141,7 +141,7 @@ inline std::optional<T> FromCharsWithOptionalBase(std::string_view str, std::str
|
||||
else if (str.starts_with("0b"))
|
||||
{
|
||||
base = 2;
|
||||
str = str.substr(1);
|
||||
str = str.substr(2);
|
||||
}
|
||||
else if (str.starts_with("0") && str.length() > 1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user