might have 0X instead of 0x (#36)

This commit is contained in:
Marc
2026-01-09 13:53:52 +01:00
committed by GitHub
parent 4fa1d8e2c5
commit ab1a3a19e1
2 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -14,7 +14,7 @@ export struct TexEntry {
namespace {
HashType GetCrcFromFilename(const std::string& filename) {
const static std::regex re(R"(0x[0-9a-fA-F]{4,16})", std::regex::optimize);
const static std::regex re(R"(0[xX][0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match;
if (!std::regex_search(filename, match, re)) {
return 0;
+5 -2
View File
@@ -14,7 +14,7 @@ namespace {
bool use_64_bit_crc = false;
HashType GetCrcFromFilename(const std::string& filename) {
const static std::regex re(R"(0x[0-9a-fA-F]{4,16})", std::regex::optimize);
const static std::regex re(R"(0[xX][0-9a-fA-F]{4,16})", std::regex::optimize);
std::smatch match;
if (!std::regex_search(filename, match, re)) {
return 0;
@@ -124,9 +124,12 @@ void ParseSimpleArchive(const libzippp::ZipArchive& archive, std::vector<TexEntr
for (const auto& entry : archive.getEntries()) {
if (!entry.isFile())
continue;
const auto entry_name = entry.getName();
const auto crc_hash = GetCrcFromFilename(entry.getName());
if (!crc_hash)
if (!crc_hash) {
Warning("Entry with name %s could not be parsed", entry_name.c_str());
continue;
}
const auto data_ptr = static_cast<BYTE*>(entry.readAsBinary());
const auto size = entry.getSize();
std::vector vec(data_ptr, data_ptr + size);