[VFS] Fix GetHashEntry for level 2 entries...

This commit is contained in:
emoose 2020-01-11 09:59:51 +00:00 committed by illusion
parent c552a853e0
commit 5ec81298f2
2 changed files with 3 additions and 8 deletions

View File

@ -683,12 +683,9 @@ StfsContainerDevice::BlockHash StfsContainerDevice::GetHashEntry(
const uint8_t* map_ptr, uint32_t block_index, uint32_t level, const uint8_t* map_ptr, uint32_t block_index, uint32_t level,
uint32_t table_offset) { uint32_t table_offset) {
uint32_t record = block_index; uint32_t record = block_index;
if (level == 1) { for (uint32_t i = 0; i < level; i++) {
record = record / 0xAA; record = record / 0xAA;
} }
if (level == 2) {
record = record / 0x70E4;
}
record = record % 0xAA; record = record % 0xAA;
size_t hash_offset = BlockToHashBlockOffset(block_index, level); size_t hash_offset = BlockToHashBlockOffset(block_index, level);

View File

@ -227,10 +227,8 @@ class StfsContainerDevice : public Device {
size_t BlockToHashBlockOffset(uint64_t block, uint32_t hash_level = 0); size_t BlockToHashBlockOffset(uint64_t block, uint32_t hash_level = 0);
StfsContainerDevice::BlockHash GetHashEntry(const uint8_t* map_ptr, BlockHash GetHashEntry(const uint8_t* map_ptr, uint32_t block_index,
uint32_t block_index, uint32_t level, uint32_t table_offset);
uint32_t level,
uint32_t table_offset);
BlockHash GetBlockHash(const uint8_t* map_ptr, uint32_t block_index); BlockHash GetBlockHash(const uint8_t* map_ptr, uint32_t block_index);