summaryrefslogtreecommitdiffstats
path: root/src/H5win32defs.h
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2011-09-12 14:02:44 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2011-09-12 14:02:44 (GMT)
commit9115bab9e36d72bb395820e38b6bee4c99dcd78c (patch)
tree2fa4450bca7e33a1466fa2be8afb59a9370b8b64 /src/H5win32defs.h
parentee039a03b9fca394251bd1b543df3aa819b13d51 (diff)
downloadhdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.zip
hdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.tar.gz
hdf5-9115bab9e36d72bb395820e38b6bee4c99dcd78c.tar.bz2
[svn-r21376] JIRA-HDFFV-2748: Relplace WIN32 macros in source. New H5_HAVE_WIN32_API and H5_HAVE_VISUAL_STUDIO defines only need to be set on windows. Autotools configure is not affected.
Trunk passed for a week and cmake branch has been in place > 3 weeks. Tested: local linux
Diffstat (limited to 'src/H5win32defs.h')
-rw-r--r--src/H5win32defs.h55
1 files changed, 29 insertions, 26 deletions
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index a428899..5daef23 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -23,7 +23,7 @@
*
*/
-#ifdef _WIN32
+#ifdef H5_HAVE_WIN32_API
typedef struct _stati64 h5_stat_t;
typedef __int64 h5_stat_size_t;
@@ -33,41 +33,21 @@ typedef __int64 h5_stat_size_t;
#define HDdup(F) _dup(F)
#define HDfdopen(N,S) _fdopen(N,S)
#define HDfileno(F) _fileno(F)
-#if _MSC_VER > 1310 /* Newer than VS.NET 2003 */
#define HDftruncate(F,L) _chsize_s(F,L)
-#else
-#define HDftruncate(F,L) chsize(F,L)
-#endif
#define HDfstat(F,B) _fstati64(F,B)
#define HDisatty(F) _isatty(F)
-#define HDlstat(S,B) _lstati64(S,B)
-#define HDstat(S,B) _stati64(S,B)
#define HDgetcwd(S,Z) _getcwd(S,Z)
#define HDgetdcwd(D,S,Z) _getdcwd(D,S,Z)
-
-struct timezone {
- int tz_minuteswest;
- int tz_dsttime;
-};
-
-#ifdef __cplusplus
- extern "C" {
-#endif /* __cplusplus */
-H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
-#ifdef __cplusplus
- }
-#endif /* __cplusplus */
-#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
-
#define HDgetdrive() _getdrive()
#define HDlseek(F,O,W) _lseeki64(F,O,W)
-#define HDoff_t __int64
-#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+#define HDlstat(S,B) _lstati64(S,B)
#define HDmkdir(S,M) _mkdir(S)
+#define HDoff_t __int64
#define HDopen(S,F,M) _open(S,F|_O_BINARY,M)
#define HDread(F,M,Z) _read(F,M,Z)
#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)
#define HDstrcasecmp(A,B) _stricmp(A,B)
#define HDstrtoull(S,R,N) _strtoui64(S,R,N)
#define HDstrdup(S) _strdup(S)
@@ -77,11 +57,34 @@ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
#define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
#define HDwrite(F,M,Z) _write(F,M,Z)
+#ifdef H5_HAVE_VISUAL_STUDIO
+/*
+ * The (void*) cast just avoids a compiler warning in H5_HAVE_VISUAL_STUDIO
+ */
+#define HDmemset(X,C,Z) memset((void*)(X),C,Z)
+
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+
+#ifdef __cplusplus
+ extern "C" {
+#endif /* __cplusplus */
+ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+ H5_DLL char* Wgetlogin();
+#ifdef __cplusplus
+ }
+#endif /* __cplusplus */
+#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+#define HDgetlogin() Wgetlogin()
+
+#endif /* H5_HAVE_VISUAL_STUDIO */
+
/* Non-POSIX functions */
/* Don't use actual pthread_self on Windows because the return
* type cannot be cast as a ulong like other systems. */
#define HDpthread_self_ulong() ((unsigned long)GetCurrentThreadId())
-
-#endif /* _WIN32 */
+#endif /* H5_HAVE_WIN32_API */