Moved the super-file handle into FTK and fixed various memory leaks in the FLAIM/XFLAIM unit tests.

git-svn-id: https://svn.code.sf.net/p/flaim/code/trunk@575 0109f412-320b-0410-ab79-c3e0c5ffbbe6
This commit is contained in:
ahodgkinson
2006-06-15 17:05:55 +00:00
parent 9f7ca8edd3
commit 2fabd31c06
30 changed files with 1343 additions and 1866 deletions

View File

@@ -99,22 +99,23 @@ Exit:
Desc: This routine creates a FLAIM file.
****************************************************************************/
RCODE flmCreateNewFile(
const char * pszFilePath,
const char * pszDataDir,
const char * pszRflDir,
const char * pszDictFileName,
const char * pszDictBuf,
CREATE_OPTS * pCreateOpts,
FLMUINT uiTransID,
FDB * * ppDb,
REBUILD_STATE * pRebuildState)
const char * pszFilePath,
const char * pszDataDir,
const char * pszRflDir,
const char * pszDictFileName,
const char * pszDictBuf,
CREATE_OPTS * pCreateOpts,
FLMUINT uiTransID,
FDB * * ppDb,
REBUILD_STATE * pRebuildState)
{
RCODE rc = FERR_OK;
FDB * pDb = NULL;
FFILE * pFile;
FLMBOOL bFileCreated = FALSE;
FLMBOOL bNewFile = FALSE;
FLMBOOL bMutexLocked = FALSE;
RCODE rc = FERR_OK;
FDB * pDb = NULL;
FFILE * pFile;
FLMBOOL bFileCreated = FALSE;
FLMBOOL bNewFile = FALSE;
FLMBOOL bMutexLocked = FALSE;
F_SuperFileClient * pSFileClient = NULL;
if( ppDb)
{
@@ -257,6 +258,7 @@ RCODE flmCreateNewFile(
// Allocate the super file object
flmAssert( !pDb->pSFileHdl);
flmAssert( pFile->FileHdr.uiVersionNum);
if( (pDb->pSFileHdl = f_new F_SuperFileHdl) == NULL)
{
@@ -264,13 +266,24 @@ RCODE flmCreateNewFile(
goto Exit;
}
flmAssert( pFile->FileHdr.uiVersionNum);
if( (pSFileClient = f_new F_SuperFileClient) == NULL)
{
rc = RC_SET( FERR_MEM);
goto Exit;
}
if( RC_BAD( rc = pDb->pSFileHdl->setup(
if( RC_BAD( rc = pSFileClient->setup(
pFile->pszDbPath, pFile->pszDataDir, pFile->FileHdr.uiVersionNum)))
{
goto Exit;
}
if( RC_BAD( rc = pDb->pSFileHdl->setup( pSFileClient)))
{
goto Exit;
}
pDb->pSFileHdl->setBlockSize( pFile->FileHdr.uiBlockSize);
// Create the .db file.
@@ -336,6 +349,11 @@ Exit:
{
*ppDb = pDb;
}
if( pSFileClient)
{
pSFileClient->Release();
}
return( rc);
}