From 249ce6bca135503fd3f831df018aa16d11f43590 Mon Sep 17 00:00:00 2001 From: Andrey Akhmichin <15944199+nekonomicon@users.noreply.github.com> Date: Sun, 18 Dec 2022 22:11:42 +0500 Subject: [PATCH] engine: platform: win32: replace va function calls. --- engine/platform/win32/lib_win.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/engine/platform/win32/lib_win.c b/engine/platform/win32/lib_win.c index 21ee1fab..b3a74b79 100644 --- a/engine/platform/win32/lib_win.c +++ b/engine/platform/win32/lib_win.c @@ -354,6 +354,7 @@ static void ListMissingModules( dll_user_t *hInst ) PIMAGE_NT_HEADERS peHeader; PIMAGE_IMPORT_DESCRIPTOR importDesc; byte *data; + char buf[MAX_VA_STRING]; if ( !hInst ) return; @@ -374,7 +375,10 @@ static void ListMissingModules( dll_user_t *hInst ) hMod = LoadLibraryEx( importName, NULL, LOAD_LIBRARY_AS_DATAFILE ); if ( !hMod ) - COM_PushLibraryError( va( "%s not found!", importName ) ); + { + Q_snprintf( buf, sizeof( buf ), "%s not found!", importName ); + COM_PushLibraryError( buf ); + } else FreeLibrary( hMod ); } @@ -436,19 +440,22 @@ smart dll loader - can loading dlls from pack or wad files void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean directpath ) { dll_user_t *hInst; + char buf[MAX_VA_STRING]; COM_ResetLibraryError(); hInst = FS_FindLibrary( dllname, directpath ); if( !hInst ) { - COM_PushLibraryError( va( "Failed to find library %s", dllname ) ); + Q_snprintf( buf, sizeof( buf ), "Failed to find library %s", dllname ); + COM_PushLibraryError( buf ); return NULL; } if( hInst->encrypted ) { - COM_PushLibraryError( va( "Library %s is encrypted, cannot load", hInst->shortPath ) ); + Q_snprintf( buf, sizeof( buf ), "Library %s is encrypted, cannot load", hInst->shortPath ); + COM_PushLibraryError( buf ); COM_FreeLibrary( hInst ); return NULL; } @@ -480,7 +487,8 @@ void *COM_LoadLibrary( const char *dllname, int build_ordinals_table, qboolean d { if( !LibraryLoadSymbols( hInst )) { - COM_PushLibraryError( va( "Failed to load library %s", dllname ) ); + Q_snprintf( buf, sizeof( buf ), "Failed to load library %s", dllname ); + COM_PushLibraryError( buf ); COM_FreeLibrary( hInst ); return NULL; }