diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2019-03-15 07:41:39 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2019-03-15 07:41:39 (GMT) |
commit | 750b5c293076b6a446088fa3020e4e0787d489d7 (patch) | |
tree | 80f392f7152d137a64aa28c0de84554beb066740 /src/H5win32defs.h | |
parent | 0ea7aa89ff872f810285b12ddde5d55165534afa (diff) | |
download | hdf5-750b5c293076b6a446088fa3020e4e0787d489d7.zip hdf5-750b5c293076b6a446088fa3020e4e0787d489d7.tar.gz hdf5-750b5c293076b6a446088fa3020e4e0787d489d7.tar.bz2 |
Adds _wopen support on Windows so that files with UTF-8 names
can be opened.
Fixes: HDFFV-2714, HDFFV-3914, HDFFV-3895, HDFFV-8237, HDFFV-10413, HDFFV-10691
Diffstat (limited to 'src/H5win32defs.h')
-rw-r--r-- | src/H5win32defs.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 140afc3..2ae2575 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -34,6 +34,7 @@ typedef __int64 h5_stat_size_t; #define HDaccess(F,M) _access(F,M) #define HDchdir(S) _chdir(S) #define HDclose(F) _close(F) +#define HDcreat(S,M) Wopen_utf8(S,O_CREAT|O_TRUNC|O_RDWR,M) #define HDdup(F) _dup(F) #define HDfdopen(N,S) _fdopen(N,S) #define HDfileno(F) _fileno(F) @@ -47,15 +48,13 @@ typedef __int64 h5_stat_size_t; #define HDmkdir(S,M) _mkdir(S) #define HDnanosleep(N, O) Wnanosleep(N, O) #define HDoff_t __int64 -/* _O_BINARY must be set in Windows to avoid CR-LF <-> LF EOL - * transformations when performing I/O. Note that this will - * produce Unix-style text files, though. - * - * Also note that the variadic macro is using a VC++ extension + +/* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. */ -#define HDopen(S,F,...) _open(S, F | _O_BINARY, __VA_ARGS__) +#define HDopen(S,F,...) Wopen_utf8(S,F,__VA_ARGS__) #define HDread(F,M,Z) _read(F,M,Z) +#define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,(Z>1?Z:2)) #define HDsleep(S) Sleep(S*1000) @@ -128,6 +127,9 @@ extern "C" { H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); H5_DLL int Wnanosleep(const struct timespec *req, struct timespec *rem); H5_DLL herr_t H5_expand_windows_env_vars(char **env_var); + H5_DLL const wchar_t *H5_get_utf16_str(const char *s); + H5_DLL int Wopen_utf8(const char *path, int oflag, ...); + H5_DLL int Wremove_utf8(const char *path); /* Round functions only needed for VS2012 and earlier. * They are always built to ensure they don't go stale and |