2
0
mirror of https://github.com/rehlds/revoice.git synced 2025-03-03 17:15:25 +03:00

Fix implicit pointer-to-function conversion warning

This commit is contained in:
the_hunter 2025-02-25 10:30:25 +02:00
parent 30cfd4dd41
commit 70a8c313b7

View File

@ -111,7 +111,7 @@ static IBaseInterface *CreateInterfaceLocal( const char *pName, int *pReturnCode
//static hlds_run wants to use this function //static hlds_run wants to use this function
void *Sys_GetProcAddress( const char *pModuleName, const char *pName ) void *Sys_GetProcAddress( const char *pModuleName, const char *pName )
{ {
return GetProcAddress( GetModuleHandle(pModuleName), pName ); return reinterpret_cast<void*>(GetProcAddress(GetModuleHandle(pModuleName), pName));
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -123,9 +123,9 @@ void *Sys_GetProcAddress( const char *pModuleName, const char *pName )
void *Sys_GetProcAddress( void *pModuleHandle, const char *pName ) void *Sys_GetProcAddress( void *pModuleHandle, const char *pName )
{ {
#if defined ( _WIN32 ) #if defined ( _WIN32 )
return GetProcAddress( (HINSTANCE)pModuleHandle, pName ); return reinterpret_cast<void*>(GetProcAddress((HINSTANCE)pModuleHandle, pName));
#else #else
return GetProcAddress( pModuleHandle, pName ); return GetProcAddress(pModuleHandle, pName);
#endif #endif
} }
@ -249,16 +249,5 @@ CreateInterfaceFn Sys_GetFactoryThis( void )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
CreateInterfaceFn Sys_GetFactory( const char *pModuleName ) CreateInterfaceFn Sys_GetFactory( const char *pModuleName )
{ {
#if defined ( _WIN32 ) return reinterpret_cast<CreateInterfaceFn>( Sys_GetProcAddress(pModuleName, CREATEINTERFACE_PROCNAME ));
return static_cast<CreateInterfaceFn>( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );
#else
// Linux gives this error:
//../public/interface.cpp: In function `IBaseInterface *(*Sys_GetFactory
//(const char *)) (const char *, int *)':
//../public/interface.cpp:186: invalid static_cast from type `void *' to
//type `IBaseInterface *(*) (const char *, int *)'
//
// so lets use the old style cast.
return (CreateInterfaceFn)( Sys_GetProcAddress( pModuleName, CREATEINTERFACE_PROCNAME ) );
#endif
} }