Salome HOME
spns #32755 : TopIIVolMesh: move back to master branch
[tools/sat_salome.git] / products / patches / hdf5-1.10.3.win_unicode.patch
1 diff -Naur hdf5-1.10.3_SRC_orig/src/H5FDwindows.c hdf5-1.10.3_SRC_modif/src/H5FDwindows.c
2 --- hdf5-1.10.3_SRC_orig/src/H5FDwindows.c      2018-08-10 00:36:32.000000000 +0300
3 +++ hdf5-1.10.3_SRC_modif/src/H5FDwindows.c     2019-02-11 14:07:25.081398900 +0300
4 @@ -24,6 +24,18 @@
5  
6  #ifdef H5_HAVE_WINDOWS
7  
8 +int _win_open(const char *name, int oflag,...)
9 +{
10 +    int fd = -1;
11 +    int size_needed = MultiByteToWideChar(CP_UTF8, 0, name, strlen(name), NULL, 0);
12 +    wchar_t* wname = (wchar_t*)malloc( sizeof(wchar_t)*(size_needed + 1) );
13 +    MultiByteToWideChar( CP_UTF8, 0, name, strlen(name), wname, size_needed );
14 +    wname[size_needed] = '\0';
15 +    fd=_wopen(wname, oflag);
16 +    free(wname);
17 +    return fd;
18 +}
19 +
20  \f
21  /*-------------------------------------------------------------------------
22   * Function:    H5Pset_fapl_windows
23 diff -Naur hdf5-1.10.3_SRC_orig/src/H5win32defs.h hdf5-1.10.3_SRC_modif/src/H5win32defs.h
24 --- hdf5-1.10.3_SRC_orig/src/H5win32defs.h      2018-08-10 00:36:32.000000000 +0300
25 +++ hdf5-1.10.3_SRC_modif/src/H5win32defs.h     2019-02-11 14:08:05.105749000 +0300
26 @@ -54,7 +54,9 @@
27   * Also note that the variadic macro is using a VC++ extension
28   * where the comma is dropped if nothing is passed to the ellipsis.
29   */
30 -#define HDopen(S,F,...)       _open(S, F | _O_BINARY, __VA_ARGS__)
31 +//#define HDopen(S,F,...)       _open(S, F | _O_BINARY, __VA_ARGS__)
32 +H5_DLL int _win_open(const char *name, int oflag,...);
33 +#define HDopen(S,F,...)       _win_open(S, F | _O_BINARY, __VA_ARGS__)
34  #define HDread(F,M,Z)       _read(F,M,Z)
35  #define HDrmdir(S)          _rmdir(S)
36  #define HDsetvbuf(F,S,M,Z)  setvbuf(F,S,M,(Z>1?Z:2))