small fixes

This commit is contained in:
Diavolo 2023-04-24 19:08:00 +02:00
parent a5075e150e
commit 19b1c114e6
2 changed files with 11 additions and 9 deletions

View File

@ -82,7 +82,7 @@ namespace workshop
utils::string::copy(item.description, doc["Description"].GetString());
utils::string::copy(item.folderName, doc["FolderName"].GetString());
utils::string::copy(item.publisherId, doc["PublisherID"].GetString());
item.publisherIdInteger = std::stoul(item.publisherId);
item.publisherIdInteger = std::strtoul(item.publisherId, nullptr, 10);
}
void load_usermap_content_stub(void* usermaps_count, int type)
@ -94,7 +94,7 @@ namespace workshop
auto& usermap_data = game::usermapsPool[i];
// foldername == title -> non-steam workshop usercontent
if (std::strcmp(usermap_data.folderName, usermap_data.title))
if (std::strcmp(usermap_data.folderName, usermap_data.title) != 0)
{
continue;
}
@ -111,7 +111,7 @@ namespace workshop
{
auto& mod_data = game::modsPool[i];
if (std::strcmp(mod_data.folderName, mod_data.title))
if (std::strcmp(mod_data.folderName, mod_data.title) != 0)
{
continue;
}

View File

@ -68,11 +68,13 @@ namespace utils::string
bool is_numeric(const std::string& text)
{
if (text.size() <= 0 || !std::isdigit(text[0])) return false;
return std::ranges::all_of(text.begin(), text.end(), [](const char input)
auto it = text.begin();
while (it != text.end() && std::isdigit(static_cast<unsigned char>(*it)))
{
return std::isdigit(input) != 0;
});
++it;
}
return !text.empty() && it == text.end();
}
std::string dump_hex(const std::string& data, const std::string& separator)
@ -154,9 +156,9 @@ namespace utils::string
if (*in != '$' && *in != '{' && *in != '}')
{
*out++ = *in;
i++;
++i;
}
in++;
++in;
}
*out = '\0';