aboutsummaryrefslogtreecommitdiff
path: root/dep/CascLib/src/CascMndxRoot.cpp
diff options
context:
space:
mode:
authorDuarte Duarte <dnpd.dd@gmail.com>2015-02-22 05:38:27 +0000
committerDuarte Duarte <dnpd.dd@gmail.com>2015-02-22 05:38:27 +0000
commitabfeb890943638f8704dd776592a2acbd7425782 (patch)
tree85a38ff45ba73f43d297e9869230f773d19a5c02 /dep/CascLib/src/CascMndxRoot.cpp
parentea9eccae8596d440c372b0d9709d4def4b46e648 (diff)
Dep/CascLib: Update to https://github.com/ladislav-zezula/CascLib/commit/4235e5f2033e2de709c83034503d49e532d03630
Diffstat (limited to 'dep/CascLib/src/CascMndxRoot.cpp')
-rw-r--r--dep/CascLib/src/CascMndxRoot.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/dep/CascLib/src/CascMndxRoot.cpp b/dep/CascLib/src/CascMndxRoot.cpp
index db29fba1662..328afee8ba5 100644
--- a/dep/CascLib/src/CascMndxRoot.cpp
+++ b/dep/CascLib/src/CascMndxRoot.cpp
@@ -2872,6 +2872,14 @@ PCASC_PACKAGE FindMndxPackage(TCascStorage * hs, const char * szFileName)
assert(hs->pPackages != NULL);
pPackage = hs->pPackages->Packages;
+ //FILE * fp = fopen("E:\\packages.txt", "wt");
+ //for(size_t i = 0; i < hs->pPackages->NameEntries; i++, pPackage++)
+ //{
+ // if(pPackage->szFileName != NULL)
+ // fprintf(fp, "%s\n", pPackage->szFileName);
+ //}
+ //fclose(fp);
+
// Find the longest matching name
for(size_t i = 0; i < hs->pPackages->NameEntries; i++, pPackage++)
{
@@ -2895,7 +2903,8 @@ static bool FillFindData(TCascSearch * pSearch, PCASC_FIND_DATA pFindData, TMndx
PCASC_ROOT_ENTRY_MNDX pRootEntry = NULL;
TCascStorage * hs = pSearch->hs;
PCASC_PACKAGE pPackage;
- char * szStrippedName;
+ char * szStrippedPtr;
+ char szStrippedName[MAX_PATH+1];
int nError;
// Sanity check
@@ -2912,10 +2921,14 @@ static bool FillFindData(TCascSearch * pSearch, PCASC_FIND_DATA pFindData, TMndx
if(pPackage != NULL)
{
// Cut the package name off the full path
- szStrippedName = pFindData->szFileName + pPackage->nLength;
- while(szStrippedName[0] == '/')
- szStrippedName++;
+ szStrippedPtr = pFindData->szFileName + pPackage->nLength;
+ while(szStrippedPtr[0] == '/')
+ szStrippedPtr++;
+
+ // We need to convert the stripped name to lowercase, replacing backslashes with slashes
+ NormalizeFileName_LowerSlash(szStrippedName, szStrippedPtr, MAX_PATH);
+ // Search the package
nError = SearchMndxInfo(hs->pMndxInfo, szStrippedName, (DWORD)(pPackage - hs->pPackages->Packages), &pRootEntry);
if(nError == ERROR_SUCCESS)
{
@@ -3471,7 +3484,7 @@ void TestMndxRootFile(PCASC_MNDX_INFO pMndxInfo)
while((nLength = ListFile_GetNext(pvListFile, "*", szFileName, MAX_PATH)) != 0)
{
// Normalize the file name: ToLower + BackSlashToSlash
- NormalizeFileName_LowerSlash(szFileName);
+ NormalizeFileName_LowerSlash(szFileName, szFileName, MAX_PATH);
// Check the file with all three MAR files
TestMarFile(pMndxInfo->pMarFile1, szFileName, nLength);