diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2021-06-29 04:59:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-29 04:59:25 (GMT) |
commit | 4ff544f9977da3bd54eac03cc124961eea7c4daf (patch) | |
tree | d23a3d50fbeb2c1eca882db4d48726173f25097c /src/H5win32defs.h | |
parent | 734d317da9c759799c92ff47e05e3be7e3e969a9 (diff) | |
download | hdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.zip hdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.tar.gz hdf5-4ff544f9977da3bd54eac03cc124961eea7c4daf.tar.bz2 |
Cleans up POSIX/C bits in H5private.h (#804)
* Cleans up POSIX/C bits in H5private.h
* Assume difftime exists (C89)
* Reorg AC_CHECK_HEADERS so headers are in alphabetical order
* Split off networking-related AC_CHECK_HEADERS
* Remove unused UNAME_CYGWIN from configure.ac
* Remove checks for unused sys/timeb.h
* Tidying pass over H5private.h HD prefix macros
* Tidy H5win32defs.h
* Add HD prefix to various scanf calls
* Committing clang-format changes
* Fixes to the alarm(2) code used in the tests to make Windows happy
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5win32defs.h')
-rw-r--r-- | src/H5win32defs.h | 77 |
1 files changed, 35 insertions, 42 deletions
diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 26bca67..030b65b 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -29,23 +29,35 @@ typedef struct _stati64 h5_stat_t; 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) -#define HDfstat(F, B) _fstati64(F, B) -#define HDisatty(F) _isatty(F) +#ifdef H5_HAVE_VISUAL_STUDIO -#define HDgetcwd(S, Z) _getcwd(S, Z) -#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) -#define HDgetdrive() _getdrive() -#define HDlseek(F, O, W) _lseeki64(F, O, W) -#define HDlstat(S, B) _lstati64(S, B) -#define HDmkdir(S, M) _mkdir(S) -#define HDoff_t __int64 +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#endif /* H5_HAVE_VISUAL_STUDIO */ + +#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) +#define HDflock(F, L) Wflock(F, L) +#define HDfstat(F, B) _fstati64(F, B) +#define HDgetcwd(S, Z) _getcwd(S, Z) +#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) +#define HDgetdrive() _getdrive() +#define HDgetlogin() Wgetlogin() +#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) +#define HDisatty(F) _isatty(F) +#define HDlseek(F, O, W) _lseeki64(F, O, W) +#define HDlstat(S, B) _lstati64(S, B) +#define HDmemset(X, C, Z) memset((void *)(X), C, Z) /* Cast avoids MSVC warning */ +#define HDmkdir(S, M) _mkdir(S) +#define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. @@ -55,9 +67,11 @@ typedef __int64 h5_stat_size_t; #else #define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__) #endif + #define HDread(F, M, Z) _read(F, M, Z) #define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) +#define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2)) #define HDsleep(S) Sleep(S * 1000) #define HDstat(S, B) _stati64(S, B) @@ -66,21 +80,13 @@ typedef __int64 h5_stat_size_t; #define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z) #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) +#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) #define HDwrite(F, M, Z) _write(F, M, Z) -#ifdef H5_HAVE_VISUAL_STUDIO - -/* - * The (void*) cast just avoids a compiler warning in MSVC - */ -#define HDmemset(X, C, Z) memset((void *)(X), C, Z) - -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -#endif /* H5_HAVE_VISUAL_STUDIO */ +#ifndef H5_HAVE_MINGW +#define HDftruncate(F, L) _chsize_s(F, L) +#define HDfseek(F, O, W) _fseeki64(F, O, W) +#endif /* H5_HAVE_MINGW */ #ifdef __cplusplus extern "C" { @@ -98,17 +104,4 @@ H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); } #endif /* __cplusplus */ -#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) -#define HDsetenv(N, V, O) Wsetenv(N, V, O) -#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) -#define HDflock(F, L) Wflock(F, L) -#define HDgetlogin() Wgetlogin() - -/* Non-POSIX functions */ - -#ifndef H5_HAVE_MINGW -#define HDftruncate(F, L) _chsize_s(F, L) -#define HDfseek(F, O, W) _fseeki64(F, O, W) -#endif /* H5_HAVE_MINGW */ - #endif /* H5_HAVE_WIN32_API */ |