Fix duplicate parsing of dir contents
This commit is contained in:
parent
10ad8b7d72
commit
a9d6c82b69
10
src/RDat.cpp
10
src/RDat.cpp
@ -151,7 +151,7 @@ RDI_RESULT RDat::ProcessFilesTree() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
RDI_RESULT RDat::ProcessDirectoryContents( DirectoryEntry* pCurDir, MEMFILE pDesc, const unsigned int count, MEMFILE pSectionStart ) {
|
RDI_RESULT RDat::ProcessDirectoryContents( DirectoryEntry* pCurDir, MEMFILE pDesc, const unsigned int count, MEMFILE pSectionStart ) {
|
||||||
unsigned int i;
|
unsigned int i, newDRECnt;
|
||||||
DAT_FILE_FLAGS curEntryFlags = {0};
|
DAT_FILE_FLAGS curEntryFlags = {0};
|
||||||
|
|
||||||
FileEntry* newFile = nullptr;
|
FileEntry* newFile = nullptr;
|
||||||
@ -176,10 +176,10 @@ RDI_RESULT RDat::ProcessDirectoryContents( DirectoryEntry* pCurDir, MEMFILE pDes
|
|||||||
newDir = new DirectoryEntry(tmpStr, curEntryFlags);
|
newDir = new DirectoryEntry(tmpStr, curEntryFlags);
|
||||||
pCurDir->AddEntry(newDir);
|
pCurDir->AddEntry(newDir);
|
||||||
|
|
||||||
ProcessDirectoryContents(newDir,
|
// Keep entries count in new directory to jump over after processing it.
|
||||||
pDesc + (i + 1) * sizeof(T_FILE_HEADER),
|
newDRECnt = (((T_FILE_HEADER*)(pDesc + i * sizeof(T_FILE_HEADER)))->dir_entries_size - sizeof(T_FILE_HEADER)) / sizeof(T_FILE_HEADER);
|
||||||
(((T_FILE_HEADER*)(pDesc + i * sizeof(T_FILE_HEADER)))->dir_entries_size - sizeof(T_FILE_HEADER)) / sizeof(T_FILE_HEADER),
|
ProcessDirectoryContents(newDir, pDesc + (i + 1) * sizeof(T_FILE_HEADER), newDRECnt, pSectionStart);
|
||||||
pSectionStart);
|
if (newDRECnt <= count) i += newDRECnt;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user