ipc: Use u_winerror helper

This commit is contained in:
Jakob Bornecrantz 2022-11-17 15:16:48 +00:00
parent 6fc6968387
commit 8271d213f5

View file

@ -13,6 +13,9 @@
#include "xrt/xrt_config_os.h" #include "xrt/xrt_config_os.h"
#include "util/u_windows.h"
#include "util/u_logging.h"
#include "shared/ipc_utils.h" #include "shared/ipc_utils.h"
#include "shared/ipc_protocol.h" #include "shared/ipc_protocol.h"
@ -21,10 +24,9 @@
#include <stdint.h> #include <stdint.h>
#include <assert.h> #include <assert.h>
#include "util/u_logging.h"
#include <vector> #include <vector>
/* /*
* *
* Logging * Logging
@ -41,10 +43,7 @@ const char *
ipc_winerror(DWORD err) ipc_winerror(DWORD err)
{ {
static char s_buf[4096]; // N.B. Not thread-safe. If needed, use a thread var static char s_buf[4096]; // N.B. Not thread-safe. If needed, use a thread var
if (!FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, LANG_SYSTEM_DEFAULT, s_buf, sizeof(s_buf), NULL)) { return u_winerror(s_buf, sizeof(s_buf), err, false);
s_buf[0] = 0;
}
return s_buf;
} }
void void