diff options
author | Nicolas Ojeda Bar <n.oje.bar@gmail.com> | 2017-10-04 16:23:29 +0200 |
---|---|---|
committer | Nicolas Ojeda Bar <n.oje.bar@gmail.com> | 2017-10-05 14:24:56 +0200 |
commit | d0f68c99552053470c42733f99ace76103e1aad5 (patch) | |
tree | a6a327b8a5814272cf3a407be21e58df483b90c1 | |
parent | 044244e9bbd3f69d3ccd003d127dcfe4878c8dd6 (diff) | |
download | ocaml-d0f68c99552053470c42733f99ace76103e1aad5.tar.gz |
Do not use %S
-rw-r--r-- | byterun/caml/config.h | 8 | ||||
-rw-r--r-- | byterun/dynlink.c | 6 | ||||
-rw-r--r-- | byterun/startup.c | 7 | ||||
-rw-r--r-- | byterun/sys.c | 5 | ||||
-rw-r--r-- | byterun/win32.c | 14 |
5 files changed, 23 insertions, 17 deletions
diff --git a/byterun/caml/config.h b/byterun/caml/config.h index 553d0f69e9..cee3e8bfa4 100644 --- a/byterun/caml/config.h +++ b/byterun/caml/config.h @@ -37,14 +37,6 @@ #define ARCH_SIZET_PRINTF_FORMAT "z" #endif -/* Types for Windows wide strings */ - -#ifdef _WIN32 -#define ARCH_CHARNATSTR_PRINTF_FORMAT "S" -#else -#define ARCH_CHARNATSTR_PRINTF_FORMAT "s" -#endif - /* Types for 32-bit integers, 64-bit integers, and native integers (as wide as a pointer type) */ diff --git a/byterun/dynlink.c b/byterun/dynlink.c index 245bf3e710..9c6dc9bc31 100644 --- a/byterun/dynlink.c +++ b/byterun/dynlink.c @@ -127,11 +127,13 @@ static char_os * parse_ld_conf(void) static void open_shared_lib(char_os * name) { char_os * realname; + char * u8; void * handle; realname = caml_search_dll_in_path(&caml_shared_libs_path, name); - caml_gc_message(0x100, "Loading shared library %" - ARCH_CHARNATSTR_PRINTF_FORMAT "\n", realname); + u8 = caml_stat_strdup_of_os(realname); + caml_gc_message(0x100, "Loading shared library %s\n", u8); + caml_stat_free(u8); caml_enter_blocking_section(); handle = caml_dlopen(realname, 1, 1); caml_leave_blocking_section(); diff --git a/byterun/startup.c b/byterun/startup.c index 27cfc83864..037f30d07f 100644 --- a/byterun/startup.c +++ b/byterun/startup.c @@ -94,11 +94,12 @@ int caml_attempt_open(char_os **name, struct exec_trailer *trail, char_os * truename; int fd; int err; - char buf [2]; + char buf [2], * u8; truename = caml_search_exe_in_path(*name); - caml_gc_message(0x100, "Opening bytecode executable %" - ARCH_CHARNATSTR_PRINTF_FORMAT "\n", truename); + u8 = caml_stat_strdup_of_os(truename); + caml_gc_message(0x100, "Opening bytecode executable %s\n", u8); + caml_stat_free(u8); fd = open_os(truename, O_RDONLY | O_BINARY); if (fd == -1) { caml_stat_free(truename); diff --git a/byterun/sys.c b/byterun/sys.c index fa3d5d0781..3f10677c06 100644 --- a/byterun/sys.c +++ b/byterun/sys.c @@ -634,6 +634,7 @@ static struct cplugin_context cplugin_context; void caml_load_plugin(char_os *plugin) { void* dll_handle = NULL; + char* u8; dll_handle = caml_dlopen(plugin, DLL_EXECUTABLE, DLL_NOT_GLOBAL); if( dll_handle != NULL ){ @@ -646,8 +647,10 @@ void caml_load_plugin(char_os *plugin) caml_dlclose(dll_handle); } } else { + u8 = caml_stat_strdup_of_os(plugin); fprintf(stderr, "Cannot load C plugin %s\nReason: %s\n", - caml_stat_strdup_of_os(plugin), caml_dlerror()); + u8, caml_dlerror()); + caml_stat_free(u8); } } diff --git a/byterun/win32.c b/byterun/win32.c index d53b3a1e48..9c300c3224 100644 --- a/byterun/win32.c +++ b/byterun/win32.c @@ -149,6 +149,7 @@ wchar_t * caml_decompose_path(struct ext_table * tbl, wchar_t * path) wchar_t * caml_search_in_path(struct ext_table * path, const wchar_t * name) { wchar_t * dir, * fullname; + char * u8; const wchar_t * p; int i; struct _stati64 st; @@ -161,19 +162,24 @@ wchar_t * caml_search_in_path(struct ext_table * path, const wchar_t * name) if (dir[0] == 0) continue; /* not sure what empty path components mean under Windows */ fullname = caml_stat_wcsconcat(3, dir, L"\\", name); - caml_gc_message(0x100, "Searching %" ARCH_CHARNATSTR_PRINTF_FORMAT "\n", fullname); + u8 = caml_stat_strdup_of_utf16(fullname); + caml_gc_message(0x100, "Searching %s\n", u8); + caml_stat_free(u8); if (_wstati64(fullname, &st) == 0 && S_ISREG(st.st_mode)) return fullname; caml_stat_free(fullname); } not_found: - caml_gc_message(0x100, "%" ARCH_CHARNATSTR_PRINTF_FORMAT " not found in search path\n", name); + u8 = caml_stat_strdup_of_utf16(name); + caml_gc_message(0x100, "%s not found in search path\n", u8); + caml_stat_free(u8); return caml_stat_wcsdup(name); } CAMLexport wchar_t * caml_search_exe_in_path(const wchar_t * name) { wchar_t * fullname, * filepart; + char * u8; size_t fullnamelen; DWORD retcode; @@ -188,7 +194,9 @@ CAMLexport wchar_t * caml_search_exe_in_path(const wchar_t * name) fullname, &filepart); if (retcode == 0) { - caml_gc_message(0x100, "%" ARCH_CHARNATSTR_PRINTF_FORMAT " not found in search path\n", name); + u8 = caml_stat_strdup_of_utf16(name); + caml_gc_message(0x100, "%s not found in search path\n", u8); + caml_stat_free(u8); caml_stat_free(fullname); return caml_stat_strdup_os(name); } |