summaryrefslogtreecommitdiffstats
path: root/perform/sio_standalone.h
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2013-07-01 14:23:04 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2013-07-01 14:23:04 (GMT)
commit53afd20aeb09fb2565811cc3dbf22890f0fcf900 (patch)
treef4d7a807515ed9c4f39fc7302824c55155cc9c0a /perform/sio_standalone.h
parenta157eb2f689d873a53e96cfc486db423658c7902 (diff)
downloadhdf5-53afd20aeb09fb2565811cc3dbf22890f0fcf900.zip
hdf5-53afd20aeb09fb2565811cc3dbf22890f0fcf900.tar.gz
hdf5-53afd20aeb09fb2565811cc3dbf22890f0fcf900.tar.bz2
[svn-r23854] HDFFV-8302: Add macros/code function to use coorect Windows (v)snprintf statement. Also fix use other uses of macros for windows.
Tested
Diffstat (limited to 'perform/sio_standalone.h')
-rw-r--r--perform/sio_standalone.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/perform/sio_standalone.h b/perform/sio_standalone.h
index 677a8ae..b407ecb 100644
--- a/perform/sio_standalone.h
+++ b/perform/sio_standalone.h
@@ -62,7 +62,15 @@
*/
#define HDabort() abort()
#define HDabs(X) abs(X)
+#ifdef H5_HAVE_WIN32_API
+#define HDaccess(F,M) _access(F, M)
+#define R_OK 4 /* Test for read permission. */
+#define W_OK 2 /* Test for write permission. */
+#define X_OK 1 /* Test for execute permission. */
+#define F_OK 0 /* Test for existence. */
+#else /* H5_HAVE_WIN32_API */
#define HDaccess(F,M) access(F, M)
+#endif /* H5_HAVE_WIN32_API */
#define HDacos(X) acos(X)
#ifdef H5_HAVE_ALARM
#define HDalarm(N) alarm(N)
@@ -214,7 +222,12 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...);
#define HDgetpwuid(U) getpwuid(U)
#define HDgetrusage(X,S) getrusage(X,S)
#define HDgets(S) gets(S)
+#ifdef H5_HAVE_VISUAL_STUDIO
+ H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz);
+#define HDgettimeofday(V,Z) Wgettimeofday(V,Z)
+#else /* H5_HAVE_VISUAL_STUDIO */
#define HDgettimeofday(S,P) gettimeofday(S,P)
+#endif /* H5_HAVE_VISUAL_STUDIO */
#define HDgetuid() getuid()
#define HDgmtime(T) gmtime(T)
#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/
@@ -355,7 +368,8 @@ int HDremove_all(const char * fname);
#define HDsinh(X) sinh(X)
#define HDsleep(N) sleep(N)
#ifdef H5_HAVE_WIN32_API
-#define HDsnprintf _snprintf /*varargs*/
+H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...);
+#define HDsnprintf c99_snprintf /*varargs*/
#else
#define HDsnprintf snprintf /*varargs*/
#endif
@@ -373,7 +387,11 @@ H5_DLL void HDsrand(unsigned int seed);
#endif
/* sscanf() variable arguments */
+#ifdef H5_HAVE_WIN32_API
+#define HDstrcasecmp(A,B) _stricmp(A,B)
+#else
#define HDstrcasecmp(X,Y) strcasecmp(X,Y)
+#endif
#define HDstrcat(X,Y) strcat(X,Y)
#define HDstrchr(S,C) strchr(S,C)
#define HDstrcmp(X,Y) strcmp(X,Y)
@@ -433,7 +451,8 @@ H5_DLL int64_t HDstrtoll (const char *s, const char **rest, int base);
#define HDvprintf(FMT,A) vprintf(FMT,A)
#define HDvsprintf(S,FMT,A) vsprintf(S,FMT,A)
#ifdef H5_HAVE_WIN32_API
-# define HDvsnprintf(S,N,FMT,A) _vsnprintf(S,N,FMT,A)
+H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap);
+#define HDvsnprintf c99_vsnprintf
#else
# define HDvsnprintf(S,N,FMT,A) vsnprintf(S,N,FMT,A)
#endif