Fix COM_LibraryError newline handling

1. Do not append a trailing newline to the result of COM_GetLibraryError.
2. Fix call sites.
This commit is contained in:
Gleb Mazovetskiy 2021-01-07 13:55:35 +00:00 committed by Alibek Omarov
parent a234888d44
commit 6d614e028a
3 changed files with 4 additions and 3 deletions

View File

@ -1046,7 +1046,7 @@ int GAME_EXPORT pfnCheckGameDll( void )
COM_FreeLibrary( hInst ); // don't increase linker's reference counter
return true;
}
Con_Reportf( S_WARN "Could not load server library:\n%s", COM_GetLibraryError() );
Con_Reportf( S_WARN "Could not load server library: %s\n", COM_GetLibraryError() );
return false;
}

View File

@ -285,7 +285,7 @@ void VGui_Startup( const char *clientlib, int width, int height )
if( !s_pVGuiSupport )
{
if( FS_FileExists( vguiloader, false ) )
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s", COM_GetLibraryError() );
Con_Reportf( S_ERROR "Failed to load vgui_support library: %s\n", COM_GetLibraryError() );
else
Con_Reportf( "vgui_support: not found\n" );
}

View File

@ -32,8 +32,9 @@ void COM_ResetLibraryError( void )
void COM_PushLibraryError( const char *error )
{
if( s_szLastError[0] )
Q_strncat( s_szLastError, "\n", sizeof( s_szLastError ) );
Q_strncat( s_szLastError, error, sizeof( s_szLastError ) );
Q_strncat( s_szLastError, "\n", sizeof( s_szLastError ) );
}
void *COM_FunctionFromName_SR( void *hInstance, const char *pName )