summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLadislav <Zezula>2014-01-04 17:05:29 +0100
committerLadislav <Zezula>2014-01-04 17:05:29 +0100
commit8bf322b6117a99136d978c192f845c45efe47efa (patch)
treee95baf4cba38d7caf849b56410cd8bfda922ccd0
parent6cd009bc7cb60b4000e2267c7d100a3f0d9a42a0 (diff)
+ Minor fix
-rw-r--r--src/SBaseFileTable.cpp8
-rw-r--r--test/Test.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/src/SBaseFileTable.cpp b/src/SBaseFileTable.cpp
index 54b66c4..417a44b 100644
--- a/src/SBaseFileTable.cpp
+++ b/src/SBaseFileTable.cpp
@@ -267,11 +267,7 @@ static ULONGLONG DetermineArchiveSize_V1_V2(
if(pHeader->dwBlockTablePos < pHeader->dwArchiveSize)
{
// If the block table end matches the archive size, we trust the archive size
- if(pHeader->dwBlockTablePos + (pHeader->dwBlockTableSize * sizeof(TMPQBlock)) == pHeader->dwArchiveSize)
- return pHeader->dwArchiveSize;
-
- // If both block table and archive size seem to be out of the file size
- if(pHeader->dwBlockTablePos > FileSize && pHeader->dwArchiveSize > FileSize)
+ if((pHeader->dwArchiveSize - pHeader->dwBlockTablePos) <= (pHeader->dwBlockTableSize * sizeof(TMPQBlock)))
return pHeader->dwArchiveSize;
// If the archive size in the header is less than real file size
@@ -435,7 +431,7 @@ int ConvertMpqHeaderToFormat4(
if(pHeader->HiBlockTablePos64 != 0)
{
// BlockTableSize64 may be less than TblSize * sizeof(TMPQBlock).
- // That means that the hi-block table is compressed.
+ // That means that the block table is compressed.
pHeader->BlockTableSize64 = pHeader->HiBlockTablePos64 - BlockTablePos64;
assert(pHeader->BlockTableSize64 <= (pHeader->dwBlockTableSize * sizeof(TMPQBlock)));
diff --git a/test/Test.cpp b/test/Test.cpp
index 4dce839..f3d4d5a 100644
--- a/test/Test.cpp
+++ b/test/Test.cpp
@@ -3552,6 +3552,10 @@ int main(int argc, char * argv[])
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive("part-file://MPQ_2010_v2_HashTableCompressed.MPQ.part");
+ // Open the multi-file archive with wrong prefix to see how StormLib deals with it
+ if(nError == ERROR_SUCCESS)
+ nError = TestOpenArchive("flat-file://streaming/model.MPQ.0");
+
// Open an archive that is merged with multiple files
if(nError == ERROR_SUCCESS)
nError = TestOpenArchive("blk4-file://streaming/model.MPQ.0");