Browse Source

Fix COM_LibraryError newline handling

1. Do not append a trailing newline to the result of COM_GetLibraryError.
2. Fix call sites.
pull/2/head
Gleb Mazovetskiy 4 years ago committed by Alibek Omarov
parent
commit
6d614e028a
  1. 2
      engine/client/cl_gameui.c
  2. 2
      engine/client/vgui/vgui_draw.c
  3. 3
      engine/common/lib_common.c

2
engine/client/cl_gameui.c

@ -1046,7 +1046,7 @@ int GAME_EXPORT pfnCheckGameDll( void ) @@ -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;
}

2
engine/client/vgui/vgui_draw.c

@ -285,7 +285,7 @@ void VGui_Startup( const char *clientlib, int width, int height ) @@ -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" );
}

3
engine/common/lib_common.c

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

Loading…
Cancel
Save