summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/lt_vers.am22
-rw-r--r--release_docs/RELEASE.txt1
-rw-r--r--src/H5Defl.c4
-rw-r--r--src/H5FDfamily.c8
-rw-r--r--src/H5MM.c4
-rw-r--r--src/H5VM.c12
-rw-r--r--src/H5private.h292
-rw-r--r--src/H5system.c162
-rw-r--r--src/H5win32defs.h80
-rw-r--r--src/libhdf5.settings.in1
-rw-r--r--test/h5test.h6
-rw-r--r--test/testframe.c22
-rw-r--r--test/testhdf5.h4
-rw-r--r--testpar/t_bigio.c4
-rw-r--r--testpar/t_filters_parallel.c4
-rw-r--r--testpar/t_mpi.c4
16 files changed, 206 insertions, 424 deletions
diff --git a/config/lt_vers.am b/config/lt_vers.am
index 1ba0b20..337a829 100644
--- a/config/lt_vers.am
+++ b/config/lt_vers.am
@@ -15,9 +15,9 @@
## See libtool versioning documentation online.
## After making changes, run bin/reconfigure to update other configure related
## files like Makefile.in.
-LT_VERS_INTERFACE = 107
-LT_VERS_REVISION = 0
-LT_VERS_AGE = 4
+LT_VERS_INTERFACE = 106
+LT_VERS_REVISION = 2
+LT_VERS_AGE = 3
## If the API changes *at all*, increment LT_VERS_INTERFACE and
## reset LT_VERS_REVISION to 0.
@@ -40,29 +40,29 @@ LT_VERS_AGE = 4
## Version numbers for wrapper shared library files.
LT_CXX_VERS_INTERFACE = 107
LT_CXX_VERS_REVISION = 1
-LT_CXX_VERS_AGE = 5
+LT_CXX_VERS_AGE = 4
LT_F_VERS_INTERFACE = 103
LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 2
+LT_F_VERS_AGE = 1
LT_HL_VERS_INTERFACE = 101
LT_HL_VERS_REVISION = 6
-LT_HL_VERS_AGE = 2
+LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
LT_HL_CXX_VERS_REVISION = 7
-LT_HL_CXX_VERS_AGE = 2
+LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
LT_HL_F_VERS_REVISION = 8
-LT_HL_F_VERS_AGE = 1
+LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 107
+LT_JAVA_VERS_INTERFACE = 106
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 0
+LT_JAVA_VERS_AGE = 6
LT_TOOLS_VERS_INTERFACE = 102
LT_TOOLS_VERS_REVISION = 2
-LT_TOOLS_VERS_AGE = 1
+LT_TOOLS_VERS_AGE = 0
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 2cd8d35..a8b38b1 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -543,7 +543,6 @@ Platforms Tested
Known Problems
==============
-
Setting a variable-length dataset fill value will leak the memory allocated
for the p field of the hvl_t struct. A fix is in progress for this.
HDFFV-10840
diff --git a/src/H5Defl.c b/src/H5Defl.c
index ae850a7..67416ff 100644
--- a/src/H5Defl.c
+++ b/src/H5Defl.c
@@ -254,7 +254,7 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size
/* Check args */
HDassert(efl && efl->nused > 0);
HDassert(H5F_addr_defined(addr));
- HDassert(size < SIZET_MAX);
+ HDassert(size < SIZE_MAX);
HDassert(buf || 0 == size);
/* Find the first efl member from which to read */
@@ -342,7 +342,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz
/* Check args */
HDassert(efl && efl->nused > 0);
HDassert(H5F_addr_defined(addr));
- HDassert(size < SIZET_MAX);
+ HDassert(size < SIZE_MAX);
HDassert(buf || 0 == size);
/* Find the first efl member in which to write */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 71c8383..d36d828 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -1116,8 +1116,8 @@ H5FD__family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
* is 4 bytes, to prevent overflow when user application is trying to
* write files bigger than 4GB. */
tempreq = file->memb_size - sub;
- if (tempreq > SIZET_MAX)
- tempreq = SIZET_MAX;
+ if (tempreq > SIZE_MAX)
+ tempreq = SIZE_MAX;
req = MIN(size, (size_t)tempreq);
HDassert(u < file->nmembs);
@@ -1181,8 +1181,8 @@ H5FD__family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
* is 4 bytes, to prevent overflow when user application is trying to
* write files bigger than 4GB. */
tempreq = file->memb_size - sub;
- if (tempreq > SIZET_MAX)
- tempreq = SIZET_MAX;
+ if (tempreq > SIZE_MAX)
+ tempreq = SIZE_MAX;
req = MIN(size, (size_t)tempreq);
HDassert(u < file->nmembs);
diff --git a/src/H5MM.c b/src/H5MM.c
index 69029b4..ad55132 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -151,7 +151,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block)
HDassert(block->u.info.size > 0);
HDassert(block->u.info.in_use);
/* Check for head & tail guards, if not head of linked list */
- if (block->u.info.size != SIZET_MAX) {
+ if (block->u.info.size != SIZE_MAX) {
HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE));
HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->u.info.size, H5MM_block_tail_guard_s,
H5MM_TAIL_GUARD_SIZE));
@@ -266,7 +266,7 @@ H5MM_malloc(size_t size)
H5MM_memcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE);
H5MM_block_head_s.next = &H5MM_block_head_s;
H5MM_block_head_s.prev = &H5MM_block_head_s;
- H5MM_block_head_s.u.info.size = SIZET_MAX;
+ H5MM_block_head_s.u.info.size = SIZE_MAX;
H5MM_block_head_s.u.info.in_use = TRUE;
H5MM_init_s = TRUE;
diff --git a/src/H5VM.c b/src/H5VM.c
index f7431d0..a9458e3 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -609,7 +609,7 @@ H5VM_stride_fill(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(elmt_size < SIZET_MAX);
+ HDassert(elmt_size < SIZE_MAX);
H5VM_vector_cpy(n, idx, size);
nelmts = H5VM_vector_reduce_product(n, size);
@@ -667,7 +667,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, const hsize
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(elmt_size < SIZET_MAX);
+ HDassert(elmt_size < SIZE_MAX);
if (n) {
H5VM_vector_cpy(n, idx, size);
@@ -733,7 +733,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, const hss
FUNC_ENTER_NOAPI_NOINIT_NOERR
- HDassert(elmt_size < SIZET_MAX);
+ HDassert(elmt_size < SIZE_MAX);
if (n) {
H5VM_vector_cpy(n, idx, size);
@@ -802,7 +802,7 @@ H5VM__stride_copy2(hsize_t nelmts, hsize_t elmt_size,
FUNC_ENTER_STATIC_NOERR
- HDassert(elmt_size < SIZET_MAX);
+ HDassert(elmt_size < SIZE_MAX);
HDassert(dst_n > 0);
HDassert(src_n > 0);
@@ -866,8 +866,8 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count)
HDassert(dst);
HDassert(src);
- HDassert(size < SIZET_MAX && size > 0);
- HDassert(count < SIZET_MAX && count > 0);
+ HDassert(size < SIZE_MAX && size > 0);
+ HDassert(count < SIZE_MAX && count > 0);
H5MM_memcpy(dst, src, size); /* copy first item */
diff --git a/src/H5private.h b/src/H5private.h
index fcb6c2e..42a605e 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -36,6 +36,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <time.h>
/* POSIX headers */
#ifdef H5_HAVE_SYS_TIME_H
@@ -43,7 +44,6 @@
#endif
#ifdef H5_HAVE_UNISTD_H
#include <unistd.h>
-#include <sys/types.h>
#endif
#ifdef H5_HAVE_PWD_H
#include <pwd.h>
@@ -67,25 +67,6 @@
#endif
/*
- * If a program may include both `time.h' and `sys/time.h' then
- * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac).
- * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not
- * protected against multiple inclusion, so programs should not explicitly
- * include both files. This macro is useful in programs that use, for example,
- * `struct timeval' or `struct timezone' as well as `struct tm'. It is best
- * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked
- * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac.
- */
-#if defined(H5_TIME_WITH_SYS_TIME)
-#include <sys/time.h>
-#include <time.h>
-#elif defined(H5_HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-
-/*
* Longjumps are used to detect alignment constraints
*/
#ifdef H5_HAVE_SETJMP_H
@@ -126,8 +107,8 @@
#include <dirent.h>
#endif
-/* Define the default VFD for this platform.
- * Since the removal of the Windows VFD, this is sec2 for all platforms.
+/* Define the default VFD for this platform. Since the removal of the
+ * Windows VFD, this is sec2 for all platforms.
*/
#define H5_DEFAULT_VFD H5FD_SEC2
@@ -401,91 +382,16 @@
#endif
/*
- * Numeric data types. Some of these might be defined in Posix.1g, otherwise
- * we define them with the closest available type which is at least as large
- * as the number of bits indicated in the type name. The `int8' types *must*
- * be exactly one byte wide because we use it for pointer calculations to
- * void* memory.
- */
-#if H5_SIZEOF_INT8_T == 0
-typedef signed char int8_t;
-#undef H5_SIZEOF_INT8_T
-#define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR
-#elif H5_SIZEOF_INT8_T == 1
-#else
-#error "the int8_t type must be 1 byte wide"
-#endif
-
-#if H5_SIZEOF_UINT8_T == 0
-typedef unsigned char uint8_t;
-#undef H5_SIZEOF_UINT8_T
-#define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR
-#elif H5_SIZEOF_UINT8_T == 1
-#else
-#error "the uint8_t type must be 1 byte wide"
-#endif
-
-#if H5_SIZEOF_INT16_T >= 2
-#elif H5_SIZEOF_SHORT >= 2
-typedef short int16_t;
-#undef H5_SIZEOF_INT16_T
-#define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 2
-typedef int int16_t;
-#undef H5_SIZEOF_INT16_T
-#define H5_SIZEOF_INT16_T H5_SIZEOF_INT
-#else
-#error "nothing appropriate for int16_t"
-#endif
-
-#if H5_SIZEOF_UINT16_T >= 2
-#elif H5_SIZEOF_SHORT >= 2
-typedef unsigned short uint16_t;
-#undef H5_SIZEOF_UINT16_T
-#define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 2
-typedef unsigned uint16_t;
-#undef H5_SIZEOF_UINT16_T
-#define H5_SIZEOF_UINT16_T H5_SIZEOF_INT
-#else
-#error "nothing appropriate for uint16_t"
-#endif
-
-#if H5_SIZEOF_INT32_T >= 4
-#elif H5_SIZEOF_SHORT >= 4
-typedef short int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT
-#elif H5_SIZEOF_INT >= 4
-typedef int int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_INT
-#elif H5_SIZEOF_LONG >= 4
-typedef long int32_t;
-#undef H5_SIZEOF_INT32_T
-#define H5_SIZEOF_INT32_T H5_SIZEOF_LONG
-#else
-#error "nothing appropriate for int32_t"
-#endif
-
-/*
- * Maximum and minimum values. These should be defined in <limits.h> for the
- * most part.
+ * The max value for ssize_t.
+ *
+ * Only needed where ssize_t isn't a thing (e.g., Windows)
*/
-#ifndef LLONG_MAX
-#define LLONG_MAX ((long long)(((unsigned long long)1 << (8 * sizeof(long long) - 1)) - 1))
-#define LLONG_MIN ((long long)(-LLONG_MAX) - 1)
-#endif
-#ifndef ULLONG_MAX
-#define ULLONG_MAX ((unsigned long long)((long long)(-1)))
-#endif
-#ifndef SIZET_MAX
-#define SIZET_MAX ((size_t)(ssize_t)(-1))
-#define SSIZET_MAX ((ssize_t)(((size_t)1 << (8 * sizeof(ssize_t) - 1)) - 1))
+#ifndef SSIZE_MAX
+#define SSIZE_MAX ((ssize_t)(((size_t)1 << (8 * sizeof(ssize_t) - 1)) - 1))
#endif
/*
- * Maximum & minimum values for our typedefs.
+ * Maximum & minimum values for HDF5 typedefs.
*/
#define HSIZET_MAX ((hsize_t)ULLONG_MAX)
#define HSSIZET_MAX ((hssize_t)LLONG_MAX)
@@ -525,7 +431,7 @@ typedef long int32_t;
#else
#define h5_posix_io_t size_t
#define h5_posix_io_ret_t ssize_t
-#define H5_POSIX_MAX_IO_BYTES SSIZET_MAX
+#define H5_POSIX_MAX_IO_BYTES SSIZE_MAX
#endif
/* POSIX I/O mode used as the third parameter to open/_open
@@ -634,14 +540,29 @@ typedef struct {
haddr_t addr; /* The unique address of the object's header in that file */
} H5_obj_t;
-/*
- * Redefine all the POSIX functions. We should never see a POSIX
- * function (or any other non-HDF5 function) in the source!
+#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
+
+/* Put all Windows-specific definitions in H5win32defs.h so we
+ * can (mostly) assume a POSIX platform. Not all of the POSIX calls
+ * will have a Windows equivalent so some #ifdef protection is still
+ * necessary (e.g., fork()).
*/
+#include "H5win32defs.h"
-/* Put all platform-specific definitions in the following file */
-/* so that the following definitions are platform free. */
-#include "H5win32defs.h" /* For Windows-specific definitions */
+/* Platform-independent definitions for struct stat and off_t */
+#ifndef H5_HAVE_WIN32_API
+/* These definitions differ in Windows and are defined in
+ * H5win32defs for that platform.
+ */
+typedef struct stat h5_stat_t;
+typedef off_t h5_stat_size_t;
+#define HDoff_t off_t
+#endif
+
+/* Redefine all the POSIX and C functions. We should never see an
+ * undecorated POSIX or C function (or any other non-HDF5 function)
+ * in the source.
+ */
#ifndef HDabort
#define HDabort() abort()
@@ -659,11 +580,7 @@ typedef struct {
#define HDacos(X) acos(X)
#endif
#ifndef HDalarm
-#ifdef H5_HAVE_ALARM
#define HDalarm(N) alarm(N)
-#else
-#define HDalarm(N) (0)
-#endif
#endif
#ifndef HDasctime
#define HDasctime(T) asctime(T)
@@ -768,11 +685,7 @@ typedef struct {
#define HDcuserid(S) cuserid(S)
#endif
#ifndef HDdifftime
-#ifdef H5_HAVE_DIFFTIME
#define HDdifftime(X, Y) difftime(X, Y)
-#else
-#define HDdifftime(X, Y) ((double)(X) - (double)(Y))
-#endif
#endif
#ifndef HDdiv
#define HDdiv(X, Y) div(X, Y)
@@ -783,9 +696,6 @@ typedef struct {
#ifndef HDdup2
#define HDdup2(F, I) dup2(F, I)
#endif
-/* execl() variable arguments */
-/* execle() variable arguments */
-/* execlp() variable arguments */
#ifndef HDexecv
#define HDexecv(S, AV) execv(S, AV)
#endif
@@ -819,11 +729,9 @@ typedef struct {
#ifndef HDfclose
#define HDfclose(F) fclose(F)
#endif
-#ifdef H5_HAVE_FCNTL
#ifndef HDfcntl
#define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__)
#endif
-#endif
#ifndef HDfdopen
#define HDfdopen(N, S) fdopen(N, S)
#endif
@@ -910,20 +818,11 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDfrexp
#define HDfrexp(X, N) frexp(X, N)
#endif
-/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */
#ifndef HDfrexpf
-#ifdef H5_HAVE_FREXPF
#define HDfrexpf(X, N) frexpf(X, N)
-#else
-#define HDfrexpf(X, N) frexp(X, N)
-#endif
#endif
#ifndef HDfrexpl
-#ifdef H5_HAVE_FREXPL
#define HDfrexpl(X, N) frexpl(X, N)
-#else
-#define HDfrexpl(X, N) frexp(X, N)
-#endif
#endif
#ifndef HDfscanf
#define HDfscanf fscanf
@@ -937,24 +836,6 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation);
#ifndef HDfstat
#define HDfstat(F, B) fstat(F, B)
#endif
-#ifndef HDlstat
-#define HDlstat(S, B) lstat(S, B)
-#endif
-#ifndef HDstat
-#define HDstat(S, B) stat(S, B)
-#endif
-
-#ifndef H5_HAVE_WIN32_API
-/* These definitions differ in Windows and are defined in
- * H5win32defs for that platform.
- */
-typedef struct stat h5_stat_t;
-typedef off_t h5_stat_size_t;
-#define HDoff_t off_t
-#endif /* H5_HAVE_WIN32_API */
-
-#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T
-
#ifndef HDftell
#define HDftell(F) ftell(F)
#endif
@@ -1147,6 +1028,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDlseek
#define HDlseek(F, O, W) lseek(F, O, W)
#endif
+#ifndef HDlstat
+#define HDlstat(S, B) lstat(S, B)
+#endif
#ifndef HDmalloc
#define HDmalloc(Z) malloc(Z)
#endif
@@ -1322,7 +1206,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDrmdir
#define HDrmdir(S) rmdir(S)
#endif
-/* scanf() variable arguments */
+#ifndef HDscanf
+#define HDscanf scanf /*varargs*/
+#endif
#ifndef HDselect
#define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T)
#endif
@@ -1417,7 +1303,10 @@ typedef off_t h5_stat_size_t;
#define HDsqrt(X) sqrt(X)
#endif
#ifndef HDsscanf
-#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__)
+#define HDsscanf sscanf /*varargs*/
+#endif
+#ifndef HDstat
+#define HDstat(S, B) stat(S, B)
#endif
#ifndef HDstrcat
#define HDstrcat(X, Y) strcat(X, Y)
@@ -1486,11 +1375,7 @@ typedef off_t h5_stat_size_t;
#define HDstrtol(S, R, N) strtol(S, R, N)
#endif
#ifndef HDstrtoll
-#ifdef H5_HAVE_STRTOLL
#define HDstrtoll(S, R, N) strtoll(S, R, N)
-#else
-H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
-#endif
#endif
#ifndef HDstrtoul
#define HDstrtoul(S, R, N) strtoul(S, R, N)
@@ -1504,11 +1389,9 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#ifndef HDstrxfrm
#define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z)
#endif
-#ifdef H5_HAVE_SYMLINK
#ifndef HDsymlink
#define HDsymlink(F1, F2) symlink(F1, F2)
#endif
-#endif
#ifndef HDsysconf
#define HDsysconf(N) sysconf(N)
#endif
@@ -1589,7 +1472,7 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base);
#ifdef H5_HAVE_VASPRINTF
#define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A)
#else
-H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
+H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap);
#endif
#endif
@@ -1847,51 +1730,52 @@ extern char H5libhdf5_settings[]; /* embedded library information */
#define H5TRACE0(R, T) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T)
+ CALLTIME = H5_trace(NULL, __func__, T)
#define H5TRACE1(R, T, A0) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0)
#define H5TRACE2(R, T, A0, A1) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1)
#define H5TRACE3(R, T, A0, A1, A2) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2)
#define H5TRACE4(R, T, A0, A1, A2, A3) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3)
#define H5TRACE5(R, T, A0, A1, A2, A3, A4) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4)
#define H5TRACE6(R, T, A0, A1, A2, A3, A4, A5) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5)
#define H5TRACE7(R, T, A0, A1, A2, A3, A4, A5, A6) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6)
#define H5TRACE8(R, T, A0, A1, A2, A3, A4, A5, A6, A7) \
- RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7)
+ RTYPE = R; \
+ CALLTIME = \
+ H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7)
#define H5TRACE9(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8)
#define H5TRACE10(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9)
#define H5TRACE11(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9, #A10, A10)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9, #A10, A10)
#define H5TRACE12(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \
RTYPE = R; \
- CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \
- A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11)
+ CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \
+ #A7, A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11)
#define H5TRACE_RETURN(V) \
if (RTYPE) { \
- H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \
+ H5_trace(&CALLTIME, __func__, RTYPE, NULL, V); \
RTYPE = NULL; \
}
#else
@@ -2038,7 +1922,7 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */
/* Include required function stack header */
#include "H5CSprivate.h"
-#define H5_PUSH_FUNC H5CS_push(FUNC);
+#define H5_PUSH_FUNC H5CS_push(__func__);
#define H5_POP_FUNC H5CS_pop();
#else /* H5_HAVE_CODESTACK */
#define H5_PUSH_FUNC /* void */
@@ -2123,7 +2007,7 @@ H5_DLL herr_t H5CX_pop(void);
#define FUNC_ENTER_API_COMMON \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE;
#define FUNC_ENTER_API_INIT(err) \
@@ -2132,7 +2016,7 @@ H5_DLL herr_t H5CX_pop(void);
H5_INIT_GLOBAL = TRUE; \
if (H5_init_library() < 0) \
HGOTO_ERROR(H5E_FUNC, H5E_CANTINIT, err, "library initialization failed") \
- } /* end if */ \
+ } \
\
/* Initialize the package, if appropriate */ \
H5_PACKAGE_INIT(H5_MY_PKG_INIT, err)
@@ -2204,7 +2088,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
{ \
FUNC_ENTER_API_VARS \
- FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE; \
BEGIN_MPE_LOG \
{
@@ -2221,7 +2105,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
{ \
{ \
- FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_API(__func__)); \
FUNC_ENTER_API_THREADSAFE; \
FUNC_ENTER_API_INIT(err); \
{
@@ -2237,14 +2121,14 @@ H5_DLL herr_t H5CX_pop(void);
/* Use this macro for all "normal" non-API functions */
#define FUNC_ENTER_NOAPI(err) \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
FUNC_ENTER_NOAPI_INIT(err) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for all non-API functions, which propagate errors, but don't issue them */
#define FUNC_ENTER_NOAPI_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
FUNC_ENTER_NOAPI_INIT(-) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2258,7 +2142,7 @@ H5_DLL herr_t H5CX_pop(void);
*/
#define FUNC_ENTER_NOAPI_NOINIT \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2273,7 +2157,7 @@ H5_DLL herr_t H5CX_pop(void);
*/
#define FUNC_ENTER_NOAPI_NOINIT_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2285,7 +2169,7 @@ H5_DLL herr_t H5CX_pop(void);
*/
#define FUNC_ENTER_NOAPI_NOFS \
{ \
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
\
/* Initialize the package, if appropriate */ \
H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \
@@ -2302,7 +2186,7 @@ H5_DLL herr_t H5CX_pop(void);
*/
#define FUNC_ENTER_NOAPI_NOERR_NOFS \
{ \
- FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use the following two macros as replacements for the FUNC_ENTER_NOAPI
@@ -2312,7 +2196,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5AC_tag(tag, &prev_tag); \
FUNC_ENTER_NOAPI_INIT(err) \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2321,7 +2205,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \
+ FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2329,14 +2213,14 @@ H5_DLL herr_t H5CX_pop(void);
/* Use this macro for all "normal" package-level functions */
#define FUNC_ENTER_PACKAGE \
{ \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for package-level functions which propgate errors, but don't issue them */
#define FUNC_ENTER_PACKAGE_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2346,7 +2230,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2354,14 +2238,14 @@ H5_DLL herr_t H5CX_pop(void);
/* Use this macro for all "normal" staticly-scoped functions */
#define FUNC_ENTER_STATIC \
{ \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */
#define FUNC_ENTER_STATIC_NOERR \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2369,7 +2253,7 @@ H5_DLL herr_t H5CX_pop(void);
/* And that shouldn't push their name on the function stack */
#define FUNC_ENTER_STATIC_NOERR_NOFS \
{ \
- FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
/* Use the following macro as replacement for the FUNC_ENTER_STATIC
@@ -2378,7 +2262,7 @@ H5_DLL herr_t H5CX_pop(void);
{ \
haddr_t prev_tag = HADDR_UNDEF; \
\
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
+ FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \
H5AC_tag(tag, &prev_tag); \
H5_PUSH_FUNC \
if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
@@ -2529,6 +2413,18 @@ H5_PKG_DECLARE_FUNC(H5_MY_PKG_INIT, H5_MY_PKG)
#define HDcompile_assert(e) do { typedef struct { unsigned int b: (e); } x; } while(0)
*/
+/* Private typedefs */
+
+/* Union for const/non-const pointer for use by functions that manipulate
+ * pointers but do not write to their targets or return pointers to const
+ * specified locations. Also used for I/O functions that work for read and
+ * write - these functions are expected to never write to these locations in the
+ * write case. This helps us avoid compiler warnings. */
+typedef union {
+ void *vp;
+ const void *cvp;
+} H5_flexible_const_ptr_t;
+
/* Private functions, not part of the publicly documented API */
H5_DLL herr_t H5_init_library(void);
H5_DLL void H5_term_library(void);
diff --git a/src/H5system.c b/src/H5system.c
index 8048f50..08a039b 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -96,131 +96,6 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap)
#endif /* H5_HAVE_VASPRINTF */
/*-------------------------------------------------------------------------
- * Function: HDstrtoll
- *
- * Purpose: Converts the string S to an int64_t value according to the
- * given BASE, which must be between 2 and 36 inclusive, or be
- * the special value zero.
- *
- * The string must begin with an arbitrary amount of white space
- * (as determined by isspace(3c)) followed by a single optional
- * `+' or `-' sign. If BASE is zero or 16 the string may then
- * include a `0x' or `0X' prefix, and the number will be read in
- * base 16; otherwise a zero BASE is taken as 10 (decimal)
- * unless the next character is a `0', in which case it is taken
- * as 8 (octal).
- *
- * The remainder of the string is converted to an int64_t in the
- * obvious manner, stopping at the first character which is not
- * a valid digit in the given base. (In bases above 10, the
- * letter `A' in either upper or lower case represetns 10, `B'
- * represents 11, and so forth, with `Z' representing 35.)
- *
- * If REST is not null, the address of the first invalid
- * character in S is stored in *REST. If there were no digits
- * at all, the original value of S is stored in *REST. Thus, if
- * *S is not `\0' but **REST is `\0' on return the entire string
- * was valid.
- *
- * Return: Success: The result.
- *
- * Failure: If the input string does not contain any
- * digits then zero is returned and REST points
- * to the original value of S. If an overflow
- * or underflow occurs then the maximum or
- * minimum possible value is returned and the
- * global `errno' is set to ERANGE. If BASE is
- * incorrect then zero is returned.
- *
- * Programmer: Robb Matzke
- * Thursday, April 9, 1998
- *
- *-------------------------------------------------------------------------
- */
-#ifndef HDstrtoll
-int64_t
-HDstrtoll(const char *s, const char **rest, int base)
-{
- int64_t sign = 1, acc = 0;
- hbool_t overflow = FALSE;
-
- errno = 0;
- if (!s || (base && (base < 2 || base > 36))) {
- if (rest)
- *rest = s;
- return 0;
- }
-
- /* Skip white space */
- while (HDisspace(*s))
- s++;
-
- /* Optional minus or plus sign */
- if ('+' == *s) {
- s++;
- }
- else if ('-' == *s) {
- sign = -1;
- s++;
- }
-
- /* Zero base prefix */
- if (0 == base && '0' == *s && ('x' == s[1] || 'X' == s[1])) {
- base = 16;
- s += 2;
- }
- else if (0 == base && '0' == *s) {
- base = 8;
- s++;
- }
- else if (0 == base) {
- base = 10;
- }
-
- /* Digits */
- while ((base <= 10 && *s >= '0' && *s < '0' + base) ||
- (base > 10 && ((*s >= '0' && *s <= '9') || (*s >= 'a' && *s < 'a' + base - 10) ||
- (*s >= 'A' && *s < 'A' + base - 10)))) {
- if (!overflow) {
- int64_t digit = 0;
-
- if (*s >= '0' && *s <= '9')
- digit = *s - '0';
- else if (*s >= 'a' && *s <= 'z')
- digit = (*s - 'a') + 10;
- else
- digit = (*s - 'A') + 10;
-
- if (acc * base + digit < acc) {
- overflow = TRUE;
- }
- else {
- acc = acc * base + digit;
- }
- }
- s++;
- }
-
- /* Overflow */
- if (overflow) {
- if (sign > 0) {
- acc = ((uint64_t)1 << (8 * sizeof(int64_t) - 1)) - 1;
- }
- else {
- acc = (int64_t)((uint64_t)1 << (8 * sizeof(int64_t) - 1));
- }
- errno = ERANGE;
- }
-
- /* Return values */
- acc *= sign;
- if (rest)
- *rest = s;
- return acc;
-} /* end HDstrtoll() */
-#endif
-
-/*-------------------------------------------------------------------------
* Function: HDrand/HDsrand
*
* Purpose: Wrapper function for rand. If rand_r exists on this system,
@@ -459,6 +334,9 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
* Interestingly, getenv *is* available in the Windows
* POSIX layer, just not setenv.
*
+ * Note: Passing an empty string ("") for the value will remove
+ * the variable from the environment (like unsetenv(3))
+ *
* Return: Success: 0
* Failure: non-zero error code
*
@@ -470,14 +348,14 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz)
int
Wsetenv(const char *name, const char *value, int overwrite)
{
- size_t bufsize;
- errno_t err;
-
/* If we're not overwriting, check if the environment variable exists.
* If it does (i.e.: the required buffer size to store the variable's
* value is non-zero), then return an error code.
*/
if (!overwrite) {
+ size_t bufsize;
+ errno_t err;
+
err = getenv_s(&bufsize, NULL, 0, name);
if (err || bufsize)
return (int)err;
@@ -967,7 +845,7 @@ H5_nanosleep(uint64_t nanosec)
#else
- const uint64_t nanosec_per_sec = 1000 * 1000 * 1000;
+ const uint64_t nanosec_per_sec = 1000 * 1000L * 1000;
struct timespec sleeptime; /* Struct to hold time to sleep */
/* Set up time to sleep
@@ -1063,8 +941,8 @@ const char *H5_optarg; /* Flag argument (or value) */
int
H5_get_option(int argc, const char *const *argv, const char *opts, const struct h5_long_options *l_opts)
{
- static int sp = 1; /* character index in current token */
- int optopt = '?'; /* option character passed back to user */
+ static int sp = 1; /* character index in current token */
+ int optchar = '?'; /* option character passed back to user */
if (sp == 1) {
/* check for more flag-like tokens */
@@ -1095,7 +973,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
for (i = 0; l_opts && l_opts[i].name; i++) {
if (HDstrcmp(arg, l_opts[i].name) == 0) {
/* we've found a matching long command line flag */
- optopt = l_opts[i].shortval;
+ optchar = l_opts[i].shortval;
if (l_opts[i].has_arg != no_arg) {
if (H5_optarg == NULL) {
@@ -1108,7 +986,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
if (H5_opterr)
HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
}
}
@@ -1117,7 +995,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
if (H5_opterr)
HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
}
break;
@@ -1129,7 +1007,7 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
if (H5_opterr)
HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
H5_optind++;
@@ -1138,14 +1016,14 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
HDfree(arg);
}
else {
- register char *cp; /* pointer into current token */
+ char *cp; /* pointer into current token */
/* short command line option */
- optopt = argv[H5_optind][sp];
+ optchar = argv[H5_optind][sp];
- if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) {
+ if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) {
if (H5_opterr)
- HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt);
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar);
/* if no chars left in this token, move to next token */
if (argv[H5_optind][++sp] == '\0') {
@@ -1163,9 +1041,9 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
}
else if (++H5_optind >= argc) {
if (H5_opterr)
- HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt);
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar);
- optopt = '?';
+ optchar = '?';
}
else {
/* flag value is next token */
@@ -1203,5 +1081,5 @@ H5_get_option(int argc, const char *const *argv, const char *opts, const struct
}
/* return the current flag character found */
- return optopt;
+ return optchar;
}
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 46afc99..659adf1 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -26,26 +26,44 @@
*/
#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;
-#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
+
+struct timezone {
+ int tz_minuteswest;
+ int tz_dsttime;
+};
+
+#endif /* 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
+#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
/* Note that the variadic HDopen macro is using a VC++ extension
* where the comma is dropped if nothing is passed to the ellipsis.
@@ -59,6 +77,7 @@ typedef __int64 h5_stat_size_t;
#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)
@@ -69,19 +88,10 @@ typedef __int64 h5_stat_size_t;
#define HDunlink(S) _unlink(S)
#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,16 +108,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 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 */
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index bcf307b..9cb668c 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -52,6 +52,7 @@ Languages:
@BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Shared Fortran Library: @H5_FORTRAN_SHARED@
@BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: @enable_static@
+@BUILD_FORTRAN_CONDITIONAL_TRUE@ Module Directory: @fmoddir@
C++: @HDF_CXX@
@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CXX_VERSION@
diff --git a/test/h5test.h b/test/h5test.h
index 099d3c0..e472885 100644
--- a/test/h5test.h
+++ b/test/h5test.h
@@ -161,12 +161,8 @@ H5TEST_DLLVAR MPI_Info h5_io_info_g; /* MPI INFO object for IO */
goto error; \
}
-/*
- * Alarm definitions to wait up (terminate) a test that runs too long.
- */
+/* Number of seconds to wait before killing a test (requires alarm(2)) */
#define H5_ALARM_SEC 1200 /* default is 20 minutes */
-#define ALARM_ON TestAlarmOn()
-#define ALARM_OFF HDalarm(0)
/* Flags for h5_fileaccess_flags() */
#define H5_FILEACCESS_VFD 0x01
diff --git a/test/testframe.c b/test/testframe.c
index bc7ba0d..9bcccd1 100644
--- a/test/testframe.c
+++ b/test/testframe.c
@@ -319,9 +319,9 @@ PerformTests(void)
MESSAGE(5, ("===============================================\n"));
Test[Loop].NumErrors = num_errs;
Test_parameters = Test[Loop].Parameters;
- ALARM_ON;
+ TestAlarmOn();
Test[Loop].Call();
- ALARM_OFF;
+ TestAlarmOff();
Test[Loop].NumErrors = num_errs - Test[Loop].NumErrors;
MESSAGE(5, ("===============================================\n"));
MESSAGE(5, ("There were %d errors detected.\n\n", (int)Test[Loop].NumErrors));
@@ -632,12 +632,15 @@ SetTest(const char *testname, int action)
}
}
-/*
- * Enable alarm on test execution, configurable by environment variable
+/* Enable a test timer that will kill long-running tests, the time is configurable
+ * via an environment variable.
+ *
+ * Only useful on POSIX systems where alarm(2) is present.
*/
void
TestAlarmOn(void)
{
+#ifdef H5_HAVE_ALARM
char *env_val = HDgetenv("HDF5_ALARM_SECONDS"); /* Alarm environment */
unsigned long alarm_sec = H5_ALARM_SEC; /* Number of seconds before alarm goes off */
@@ -647,4 +650,15 @@ TestAlarmOn(void)
/* Set the number of seconds before alarm goes off */
HDalarm((unsigned)alarm_sec);
+#endif
+}
+
+/* Disable the test timer */
+void
+TestAlarmOff(void)
+{
+#ifdef H5_HAVE_ALARM
+ /* Set the number of seconds to zero */
+ HDalarm(0);
+#endif
}
diff --git a/test/testhdf5.h b/test/testhdf5.h
index 67b38e0..8abe890 100644
--- a/test/testhdf5.h
+++ b/test/testhdf5.h
@@ -55,7 +55,7 @@
{ \
if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
- __FILE__, (ret)); \
+ __FILE__, ((const void *)ret)); \
} \
if (!(ret)) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is NULL line %4d in %s\n", (where), (int)__LINE__, \
@@ -69,7 +69,7 @@
{ \
if (VERBOSE_HI) { \
print_func(" Call to routine: %15s at line %4d in %s returned %p\n", (where), (int)__LINE__, \
- __FILE__, (ret)); \
+ __FILE__, ((const void *)ret)); \
} \
if (ret) { \
TestErrPrintf("*** UNEXPECTED RETURN from %s is not NULL line %4d in %s\n", (where), \
diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c
index 146d815..d122f73 100644
--- a/testpar/t_bigio.c
+++ b/testpar/t_bigio.c
@@ -1849,7 +1849,7 @@ main(int argc, char **argv)
HDprintf("Failed to turn off atexit processing. Continue.\n");
/* set alarm. */
- ALARM_ON;
+ TestAlarmOn();
ExpressMode = do_express_test(mpi_rank_g);
@@ -1872,7 +1872,7 @@ main(int argc, char **argv)
}
/* turn off alarm */
- ALARM_OFF;
+ TestAlarmOff();
if (mpi_rank_g == 0)
HDremove(FILENAME[0]);
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index 3bd52a4..568fb48 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -8799,7 +8799,7 @@ main(int argc, char **argv)
if (VERBOSE_MED)
h5_show_hostname();
- ALARM_ON;
+ TestAlarmOn();
num_filters = ARRAY_SIZE(filterIDs);
@@ -8967,7 +8967,7 @@ exit:
if (MAINPROCESS)
HDprintf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors, nerrors > 1 ? "S" : "");
- ALARM_OFF;
+ TestAlarmOff();
h5_clean_files(FILENAME, fapl_id);
fapl_id = H5I_INVALID_HID;
diff --git a/testpar/t_mpi.c b/testpar/t_mpi.c
index 072e230..8853863 100644
--- a/testpar/t_mpi.c
+++ b/testpar/t_mpi.c
@@ -1095,7 +1095,7 @@ main(int argc, char **argv)
H5Pset_fapl_mpio(fapl, MPI_COMM_WORLD, MPI_INFO_NULL);
/* set alarm. */
- ALARM_ON;
+ TestAlarmOn();
/*=======================================
* MPIO 1 write Many read test
@@ -1204,7 +1204,7 @@ finish:
}
/* turn off alarm */
- ALARM_OFF;
+ TestAlarmOff();
h5_clean_files(FILENAME, fapl);
H5close();