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

@@ -592,13 +592,12 @@ FSTATIC FLMBOOL ViewOpenFileDirect(
/***************************************************************************
Desc: This routine opens the database file which is to be viewed.
*****************************************************************************/
FSTATIC FLMBOOL ViewOpenFile(
void
)
FSTATIC FLMBOOL ViewOpenFile( void)
{
RCODE rc;
FLMBOOL bOk = FALSE;
FLMBOOL bIgnore;
RCODE rc;
FLMBOOL bOk = FALSE;
FLMBOOL bIgnore;
F_SuperFileClient * pSFileClient = NULL;
Get_File_Name:
@@ -625,7 +624,25 @@ Get_File_Name:
gv_pSFileHdl->Release();
gv_pSFileHdl = NULL;
}
if( pSFileClient)
{
pSFileClient->Release();
pSFileClient = NULL;
}
if( (pSFileClient = f_new F_SuperFileClient) == NULL)
{
rc = RC_SET( FERR_MEM);
goto Exit;
}
if( RC_BAD( pSFileClient->setup(
gv_szViewFileName, gv_szDataDir, gv_ViewHdrInfo.FileHdr.uiVersionNum)))
{
goto Exit;
}
if ((gv_pSFileHdl = f_new F_SuperFileHdl) == NULL)
{
rc = RC_SET( FERR_MEM);
@@ -633,12 +650,13 @@ Get_File_Name:
goto Exit;
}
if (RC_BAD( rc = gv_pSFileHdl->setup( gv_szViewFileName, gv_szDataDir,
gv_ViewHdrInfo.FileHdr.uiVersionNum)))
if (RC_BAD( rc = gv_pSFileHdl->setup( pSFileClient)))
{
ViewShowRCError( "setting up super file handle", rc);
goto Exit;
}
gv_pSFileHdl->setBlockSize( gv_ViewHdrInfo.FileHdr.uiBlockSize);
if( RC_BAD( rc = ViewReadAndVerifyHdrInfo()))
{
@@ -680,10 +698,14 @@ Other_Error:
'Y') == 'Y')
{
if (!ViewOpenFileDirect())
{
goto Exit;
}
}
else
{
goto Exit;
}
}
}
else
@@ -695,12 +717,13 @@ Other_Error:
ViewShowRCError( "calling fdbInit", rc);
goto Exit;
}
if (!ViewOpenFileDirect())
{
goto Exit;
}
}
/* Fix the header if requested to */
bOk = TRUE;
Exit:
@@ -715,6 +738,12 @@ Exit:
gv_bViewFileOpened = FALSE;
}
if( pSFileClient)
{
pSFileClient->Release();
}
return( bOk);
}