Fixed cannot pass object of non-trivial type 'std::vector<char>' through variadic function; call will abort at runtime [-Wnon-pod-varargs]

This commit is contained in:
ergo720 2021-10-12 17:35:02 +02:00
parent 4f26ab927f
commit 23c72d825e
1 changed files with 2 additions and 2 deletions

View File

@ -328,11 +328,11 @@ PopupReturn PopupCustomEx(const void* hwnd, const CXBXR_MODULE cxbxr_module, con
va_list argp;
va_start(argp, message);
// allocate predicted buffer size then write to buffer afterward.
std::vector<char> Buffer(1+std::vsnprintf(nullptr, 0, message, argp));
std::string Buffer(1+std::vsnprintf(nullptr, 0, message, argp), '\0');
vsnprintf(Buffer.data(), Buffer.size(), message, argp);
va_end(argp);
EmuLogOutputEx(cxbxr_module, level, "Popup : %s", Buffer);
EmuLogOutputEx(cxbxr_module, level, "Popup : %s", Buffer.c_str());
// If user is using exclusive fullscreen, we need to refrain all popups.
if (g_disablePopupMessages) {