summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Ojeda Bar <n.oje.bar@gmail.com>2017-09-25 11:18:50 +0200
committerNicolas Ojeda Bar <n.oje.bar@gmail.com>2017-09-25 13:54:20 +0200
commita750eb426a06933fd9fb72e49eba5394652731a0 (patch)
tree475717936ae9422d0f3ac2fad47cc9c7cfa81d70
parenta220588b04be8d6de13cce74efc5cc3f683ff646 (diff)
downloadocaml-a750eb426a06933fd9fb72e49eba5394652731a0.tar.gz
Avoid '%S' when printing wide strings
-rw-r--r--ocamltest/run_win32.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ocamltest/run_win32.c b/ocamltest/run_win32.c
index 33e937f5d5..b60e5daccd 100644
--- a/ocamltest/run_win32.c
+++ b/ocamltest/run_win32.c
@@ -26,6 +26,8 @@
#include <stdarg.h>
#include <sys/types.h>
+#include "caml/osdeps.h"
+
#include "run.h"
#include "run_common.h"
@@ -36,14 +38,17 @@ static void report_error(
{
WCHAR error_message[1024];
DWORD error = GetLastError();
+ char *error_message_c;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error, 0,
error_message, sizeof(error_message)/sizeof(WCHAR), NULL);
+ error_message_c = caml_stat_strdup_of_utf16(error_message);
if ( is_defined(argument) )
error_with_location(file, line,
- settings, "%s %s: %S", message, argument, error_message);
+ settings, "%s %s: %s", message, argument, error_message_c);
else
error_with_location(file, line,
- settings, "%s: %S", message, error_message);
+ settings, "%s: %s", message, error_message_c);
+ caml_stat_free(error_message_c);
}
static WCHAR *find_program(const WCHAR *program_name)