| 37 | //###==##====#=====--==~--~=~- --- -- - - - - |
| 38 | |
| 39 | static std::uint64_t FileNameToHash(StringView fileName) |
| 40 | { |
| 41 | SmallVector<char, 512> normalizedFileName(DefaultInit, fileName.size()); |
| 42 | bool lastWasSlash = false; |
| 43 | std::size_t i = 0; |
| 44 | |
| 45 | for (char c : fileName) { |
| 46 | // Normalize slashes |
| 47 | if (c == '\\') { |
| 48 | c = '/'; |
| 49 | } |
| 50 | |
| 51 | // Skip consecutive slashes |
| 52 | if (c == '/') { |
| 53 | if (lastWasSlash) continue; |
| 54 | lastWasSlash = true; |
| 55 | } else { |
| 56 | lastWasSlash = false; |
| 57 | } |
| 58 | |
| 59 | // Uppercase to lowercase, copied from StringUtils::lowercaseInPlace() |
| 60 | c += (std::uint8_t(c - 'A') < 26) << 5; |
| 61 | normalizedFileName[i++] = c; |
| 62 | } |
| 63 | |
| 64 | return xxHash3(normalizedFileName.data(), i); |
| 65 | } |
| 66 | |
| 67 | static std::int64_t FindRelocatedFooter(std::unique_ptr<Death::IO::Stream>& s) |
| 68 | { |