diff options
author | Ladislav Zezula <zezula@volny.cz> | 2021-05-17 15:24:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-17 15:24:11 +0200 |
commit | 18e92b75928995dbd93be9a5774a62aa19042614 (patch) | |
tree | 75f88398ff1014d6e5cef83524dac00332e680f2 /src/SFileListFile.cpp | |
parent | a3332c7c9bc36f13aace6543ebc719f833882dfc (diff) | |
parent | 26b2f0e8b6e711aa05b67bf2466a715a063b2517 (diff) |
Merge pull request #225 from ladislav-zezula/AlignmentAware
Alignment aware
Diffstat (limited to 'src/SFileListFile.cpp')
-rw-r--r-- | src/SFileListFile.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/SFileListFile.cpp b/src/SFileListFile.cpp index e2b8166..a1e16b0 100644 --- a/src/SFileListFile.cpp +++ b/src/SFileListFile.cpp @@ -90,6 +90,7 @@ static TListFileCache * CreateListFileCache( DWORD dwFlags)
{
TListFileCache * pCache = NULL;
+ size_t cchWildCardAligned = 0;
size_t cchWildCard = 0;
DWORD dwBytesRead = 0;
@@ -99,10 +100,13 @@ static TListFileCache * CreateListFileCache( // Append buffer for name mask, if any
if(szWildCard != NULL)
+ {
cchWildCard = strlen(szWildCard) + 1;
+ cchWildCardAligned = (cchWildCard + 3) & 0xFFFFFFFC;
+ }
// Allocate cache for one file block
- pCache = (TListFileCache *)STORM_ALLOC(BYTE, sizeof(TListFileCache) + cchWildCard + dwFileSize + 1);
+ pCache = (TListFileCache *)STORM_ALLOC(BYTE, sizeof(TListFileCache) + cchWildCardAligned + dwFileSize + 1);
if(pCache != NULL)
{
// Clear the entire structure
@@ -117,7 +121,7 @@ static TListFileCache * CreateListFileCache( }
// Fill-in the rest of the cache pointers
- pCache->pBegin = (LPBYTE)(pCache + 1) + cchWildCard;
+ pCache->pBegin = (LPBYTE)(pCache + 1) + cchWildCardAligned;
// Load the entire listfile to the cache
PfnLoadFile(pHandle, pCache->pBegin, dwFileSize, &dwBytesRead);
|