diff options
Diffstat (limited to 'src/H5win32defs.h')
-rw-r--r-- | src/H5win32defs.h | 80 |
1 files changed, 41 insertions, 39 deletions
diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 659adf1..46afc99 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -26,44 +26,26 @@ */ #ifdef H5_HAVE_WIN32_API -/* __int64 is the correct type for the st_size field of the _stati64 struct. - * MSDN isn't very clear about this. - */ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; -#ifdef H5_HAVE_VISUAL_STUDIO - -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 HDfstat(F, B) _fstati64(F, B) +#define HDisatty(F) _isatty(F) -#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 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 HDmkdir(S, M) _mkdir(S) - -/* off_t exists on Windows, but is always a 32-bit long, even on 64-bit Windows, - * so we define HDoff_t to be __int64, which is the type of the st_size field - * of the _stati64 struct. - */ -#define HDoff_t __int64 +#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 /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. @@ -77,7 +59,6 @@ struct timezone { #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) @@ -88,10 +69,19 @@ struct timezone { #define HDunlink(S) _unlink(S) #define HDwrite(F, M, Z) _write(F, M, Z) -#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 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 */ #ifdef __cplusplus extern "C" { @@ -108,4 +98,16 @@ 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 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 */ |