diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2017-10-08 17:23:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-08 17:23:01 +0200 |
commit | 6aae29d92dc7cabfbe8ae55f08fc7fc93af84b8b (patch) | |
tree | 70455d8fa1fd182a281f61a5bb1d8bc89860e9b1 | |
parent | a3aa013181a2ae9f27c4fa494c1b923c8c2ad03b (diff) | |
parent | f9290fc864a8a06fd972d586e389cb4b880d77af (diff) | |
download | ocaml-6aae29d92dc7cabfbe8ae55f08fc7fc93af84b8b.tar.gz |
Merge pull request #1398 from nojb/do_not_use_%S
One more Windows Unicode PR: do not use %S
-rw-r--r-- | Changes | 8 | ||||
-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 |
6 files changed, 27 insertions, 21 deletions
@@ -418,10 +418,10 @@ Release branch for 4.06: ### Runtime system: -* MPR#3771, GPR#153, GPR#1200, GPR#1357, GPR#1362, GPR#1363: Unicode support for - the Windows runtime. - (ygrek, Clement Franchini, Nicolas Ojeda Bar, review by Alain Frisch, David - Allsopp, Damien Doligez) +* MPR#3771, GPR#153, GPR#1200, GPR#1357, GPR#1362, GPR#1363, GPR#1398: Unicode + support for the Windows runtime. + (ygrek, Nicolas Ojeda Bar, review by Alain Frisch, David Allsopp, Damien + Doligez) - GPR#1070, GPR#1295: enable gcc typechecking for caml_alloc_sprintf, caml_gc_message. Make caml_gc_message a variadic function. Fix many 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); } |