* minimum 4 chars max 8 chars after 0x for hash in filename
This commit is contained in:
DubbleClick
2023-12-10 19:38:36 +01:00
committed by GitHub
parent f9d69fc91e
commit 1692a5526c
2 changed files with 6 additions and 6 deletions
+5 -5
View File
@@ -96,7 +96,7 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
//TODO: #6 - Implement regex search
auto name = entry.getName();
const static std::regex re(R"(0x[0-9a-f]{8})", std::regex::optimize | std::regex::icase);
const static std::regex re(R"(0x[0-9a-f]{4,8})", std::regex::optimize | std::regex::icase);
std::smatch match;
if (!std::regex_search(name, match, re)) {
continue;
@@ -106,11 +106,11 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
try {
crc_hash = std::stoul(match.str(), nullptr, 16);
}
catch (const std::invalid_argument& e) {
catch (const std::invalid_argument&) {
Warning("Failed to parse %s as a hash", name.c_str());
continue;
}
catch (const std::out_of_range& e) {
catch (const std::out_of_range&) {
Message("Out of range while parsing %s as a hash", name.c_str());
continue;
}
@@ -147,11 +147,11 @@ void ParseTexmodArchive(std::vector<std::string>& lines, libzippp::ZipArchive& a
try {
crc_hash = std::stoul(address_string, nullptr, 16);
}
catch (const std::invalid_argument& e) {
catch (const std::invalid_argument&) {
Warning("Failed to parse %s as a hash", address_string.c_str());
continue;
}
catch (const std::out_of_range& e) {
catch (const std::out_of_range&) {
Warning("Out of range while parsing %s as a hash", address_string.c_str());
continue;
}