aboutsummaryrefslogtreecommitdiff
path: root/dep/StormLib/src/SFileFindFile.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2012-02-21 22:39:53 +0100
committerShauren <shauren.trinity@gmail.com>2012-02-21 22:39:53 +0100
commitf0ca875a216eaab3d213feae8ba75c07795c9304 (patch)
tree3193621f00b327e88d92e4c02f6540cc4dd42f01 /dep/StormLib/src/SFileFindFile.cpp
parent45201fd49f434dd2f9960bd25a1e30b97a3092a6 (diff)
Tools/Extractors: Changed search method, it will no longer miss some dbc files
Diffstat (limited to 'dep/StormLib/src/SFileFindFile.cpp')
-rw-r--r--dep/StormLib/src/SFileFindFile.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/dep/StormLib/src/SFileFindFile.cpp b/dep/StormLib/src/SFileFindFile.cpp
index aa065d23a84..542637b3668 100644
--- a/dep/StormLib/src/SFileFindFile.cpp
+++ b/dep/StormLib/src/SFileFindFile.cpp
@@ -31,7 +31,7 @@ struct TMPQSearch
DWORD dwSearchTableItems; // Number of items in the search table
DWORD dwNextIndex; // Next file index to be checked
DWORD dwFlagMask; // For checking flag mask
- char szSearchMask[1]; // Search mask (variable length)
+ char * szSearchMask; // Search mask (variable length)
};
//-----------------------------------------------------------------------------
@@ -69,7 +69,7 @@ bool CheckWildCard(const char * szString, const char * szWildCard)
szString++;
}
- // If there is '*', means zero or more chars. We have to
+ // If there is '*', means zero or more chars. We have to
// find the sequence after '*'
if(*szWildCard == '*')
{
@@ -337,6 +337,8 @@ static void FreeMPQSearch(TMPQSearch *& hs)
{
if(hs->pSearchTable != NULL)
STORM_FREE(hs->pSearchTable);
+ if(hs->szSearchMask != NULL)
+ free(hs->szSearchMask); // allocated with strdup
STORM_FREE(hs);
hs = NULL;
}
@@ -376,7 +378,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DA
if(nError == ERROR_SUCCESS)
{
memset(hs, 0, sizeof(TMPQSearch));
- strcpy(hs->szSearchMask, szMask);
+ hs->szSearchMask = strdup(szMask);
hs->dwFlagMask = MPQ_FILE_EXISTS;
hs->ha = ha;
@@ -406,7 +408,7 @@ HANDLE WINAPI SFileFindFirstFile(HANDLE hMpq, const char * szMask, SFILE_FIND_DA
FreeMPQSearch(hs);
SetLastError(nError);
}
-
+
// Return the result value
return (HANDLE)hs;
}