Browse Source

filesystem: tests: interface: various fixes

* correctly check success variable value in CreateInterface
* get rid of C language quirks because this file is C++
* check that globals were filled
pull/2/head
Alibek Omarov 2 years ago
parent
commit
c157b7def3
  1. 14
      filesystem/tests/interface.cpp

14
filesystem/tests/interface.cpp

@ -22,7 +22,7 @@ pfnCreateInterface_t g_pfnCreateInterface; @@ -22,7 +22,7 @@ pfnCreateInterface_t g_pfnCreateInterface;
fs_api_t g_fs;
fs_globals_t *g_nullglobals;
static qboolean LoadFilesystem( void )
static bool LoadFilesystem()
{
int temp = -1;
@ -31,28 +31,34 @@ static qboolean LoadFilesystem( void ) @@ -31,28 +31,34 @@ static qboolean LoadFilesystem( void )
return false;
// check our C-style interface existence
g_pfnGetFSAPI = (FSAPI)GetProcAddress( g_hModule, GET_FS_API );
g_pfnGetFSAPI = reinterpret_cast<FSAPI>( GetProcAddress( g_hModule, GET_FS_API ));
if( !g_pfnGetFSAPI )
return false;
g_nullglobals = NULL;
if( !g_pfnGetFSAPI( FS_API_VERSION, &g_fs, &g_nullglobals, NULL ))
return false;
if( !g_nullglobals )
return false;
// check Valve-style interface existence
g_pfnCreateInterface = (pfnCreateInterface_t)GetProcAddress( g_hModule, "CreateInterface" );
g_pfnCreateInterface = reinterpret_cast<pfnCreateInterface_t>( GetProcAddress( g_hModule, "CreateInterface" ));
if( !g_pfnCreateInterface )
return false;
if( !g_pfnCreateInterface( "VFileSystem009", &temp ) || temp != 0 )
return false;
temp = -1;
if( !g_pfnCreateInterface( FS_API_CREATEINTERFACE_TAG, &temp ) || temp != 0 )
return false;
return true;
}
int main( void )
int main()
{
if( !LoadFilesystem() )
return EXIT_FAILURE;

Loading…
Cancel
Save