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 | |
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>
-rw-r--r-- | config/cmake/ConfigureChecks.cmake | 2 | ||||
-rw-r--r-- | config/cmake/H5pubconf.h.in | 3 | ||||
-rw-r--r-- | configure.ac | 25 | ||||
-rw-r--r-- | hl/test/test_ds.c | 6 | ||||
-rw-r--r-- | hl/test/test_image.c | 24 | ||||
-rw-r--r-- | java/src/jni/h5util.c | 26 | ||||
-rw-r--r-- | src/H5private.h | 823 | ||||
-rw-r--r-- | src/H5win32defs.h | 77 | ||||
-rw-r--r-- | test/h5test.h | 6 | ||||
-rw-r--r-- | test/testframe.c | 22 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 162 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 6 | ||||
-rw-r--r-- | tools/test/h5jam/getub.c | 2 | ||||
-rw-r--r-- | tools/test/perform/pio_standalone.h | 35 | ||||
-rw-r--r-- | tools/test/perform/sio_standalone.h | 35 |
15 files changed, 618 insertions, 636 deletions
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 87b2006..7baf77b 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -117,8 +117,6 @@ endif () # END of WINDOWS Hard code Values # ---------------------------------------------------------------------- -CHECK_FUNCTION_EXISTS (difftime ${HDF_PREFIX}_HAVE_DIFFTIME) - # Find the library containing clock_gettime() if (MINGW OR NOT WINDOWS) CHECK_FUNCTION_EXISTS (clock_gettime CLOCK_GETTIME_IN_LIBC) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index be366a8..051272b 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -114,9 +114,6 @@ /* Define if Darwin or Mac OS X */ #cmakedefine H5_HAVE_DARWIN @H5_HAVE_DARWIN@ -/* Define to 1 if you have the `difftime' function. */ -#cmakedefine H5_HAVE_DIFFTIME @H5_HAVE_DIFFTIME@ - /* Define if the direct I/O virtual file driver (VFD) should be compiled */ #cmakedefine H5_HAVE_DIRECT @H5_HAVE_DIRECT@ diff --git a/configure.ac b/configure.ac index dbeb968..3dd7328 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,11 +1225,9 @@ AC_CHECK_LIB([dl], [dlopen]) ## ## Unix -AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h]) -AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h]) -AC_CHECK_HEADERS([features.h]) -AC_CHECK_HEADERS([dirent.h]) -AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) +AC_CHECK_HEADERS([dirent.h features.h unistd.h]) +AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/resource.h]) +AC_CHECK_HEADERS([sys/stat.h sys/time.h sys/types.h]) ## Darwin AC_SUBST([H5_IS_DARWIN]) @@ -1242,20 +1240,17 @@ case $host_os in esac ## Windows +## The winsock header is needed for gethostname +AC_CHECK_HEADERS([winsock2.h]) case "`uname`" in - CYGWIN*) - AC_CHECK_HEADERS([sys/timeb.h]) - UNAME_CYGWIN="yes" - ;; MINGW*) - AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) AC_HAVE_LIBRARY([ws2_32]) ;; - *) - AC_CHECK_HEADERS([winsock2.h sys/timeb.h]) - ;; esac +# Mirror VFD networking +AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h sys/socket.h]) + ## ---------------------------------------------------------------------- ## Some platforms require that all symbols are resolved when a library ## is linked. We can use the -no-undefined flag to tell libtool that @@ -2007,12 +2002,12 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ## NOTE: clock_gettime may require linking to the rt or posix4 library ## so we'll search for it before calling AC_CHECK_FUNCS. AC_SEARCH_LIBS([clock_gettime], [rt posix4]) -AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork]) +AC_CHECK_FUNCS([alarm asprintf clock_gettime fcntl flock fork]) AC_CHECK_FUNCS([gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) AC_CHECK_FUNCS([siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([srandom strdup symlink]) -AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) +AC_CHECK_FUNCS([tmpfile vasprintf waitpid]) ## ---------------------------------------------------------------------- ## Check compiler characteristics diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 786aba8..8c6ef91 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -4964,12 +4964,12 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf) } for (i = 0, nelms = 1; i < ndims; i++) { - if (fscanf(f, "%s %u", str, &j) && HDferror(f)) { + if (HDfscanf(f, "%s %u", str, &j) && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; } /* end if */ - if (fscanf(f, "%d", &n) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; @@ -4987,7 +4987,7 @@ read_data(const char *fname, int ndims, hsize_t *dims, float **buf) } for (j = 0; j < nelms; j++) { - if (fscanf(f, "%f", &val) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f", &val) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s\n", data_file); HDfclose(f); return -1; diff --git a/hl/test/test_image.c b/hl/test/test_image.c index dc1be96..81340c1 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -580,11 +580,11 @@ test_generate(void) ! */ - if (fscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d %d %d", &imax, &jmax, &kmax) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f %f %f", &valex, &xmin, &xmax) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -615,7 +615,7 @@ test_generate(void) goto out; for (i = 0; i < n_elements; i++) { - if (fscanf(f, "%f ", &value) < 0 && HDferror(f)) { + if (HDfscanf(f, "%f ", &value) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -779,32 +779,32 @@ read_data(const char *fname, /*IN*/ goto out; } - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &color_planes) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &h) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &h) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%s", str) < 0 && HDferror(f)) { + if (HDfscanf(f, "%s", str) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ - if (fscanf(f, "%d", &w) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &w) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -838,7 +838,7 @@ read_data(const char *fname, /*IN*/ /* Read data elements */ for (i = 0; i < n_elements; i++) { - if (fscanf(f, "%d", &n) < 0 && HDferror(f)) { + if (HDfscanf(f, "%d", &n) < 0 && HDferror(f)) { HDprintf("fscanf error in file %s.\n", data_file); goto out; } /* end if */ @@ -936,7 +936,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size) return -1; } - if (sscanf(buffer, "%u", &nentries) != 1) { + if (HDsscanf(buffer, "%u", &nentries) != 1) { HDfclose(file); return -1; } @@ -950,7 +950,7 @@ read_palette(const char *fname, rgb_t *palette, size_t palette_size) /* read the palette entries */ for (u = 0; u < nentries; u++) { /* extract the red, green and blue color components. */ - if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) { + if (HDfscanf(file, "%u %u %u", &red, &green, &blue) != 3) { HDfclose(file); return -1; } diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 6281481..8021438 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -225,7 +225,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(float): { float tmp_float = 0.0f; - sscanf(token, "%f", &tmp_float); + HDsscanf(token, "%f", &tmp_float); HDmemcpy(cptr, &tmp_float, sizeof(float)); break; } @@ -233,7 +233,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(double): { double tmp_double = 0.0; - sscanf(token, "%lf", &tmp_double); + HDsscanf(token, "%lf", &tmp_double); HDmemcpy(cptr, &tmp_double, sizeof(double)); break; } @@ -241,7 +241,7 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ case sizeof(long double): { long double tmp_ldouble = 0.0; - sscanf(token, "%Lg", &tmp_ldouble); + HDsscanf(token, "%Lg", &tmp_ldouble); HDmemcpy(cptr, &tmp_ldouble, sizeof(long double)); break; } @@ -289,11 +289,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ signed char tmp_char = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%hhu", &tmp_uchar); + HDsscanf(token, "%hhu", &tmp_uchar); HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char)); } else { - sscanf(token, "%hhd", &tmp_char); + HDsscanf(token, "%hhd", &tmp_char); HDmemcpy(cptr, &tmp_char, sizeof(char)); } @@ -305,11 +305,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ short tmp_short = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%hu", &tmp_ushort); + HDsscanf(token, "%hu", &tmp_ushort); HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short)); } else { - sscanf(token, "%hd", &tmp_short); + HDsscanf(token, "%hd", &tmp_short); HDmemcpy(&tmp_short, cptr, sizeof(short)); } @@ -321,11 +321,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ int tmp_int = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%u", &tmp_uint); + HDsscanf(token, "%u", &tmp_uint); HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int)); } else { - sscanf(token, "%d", &tmp_int); + HDsscanf(token, "%d", &tmp_int); HDmemcpy(cptr, &tmp_int, sizeof(int)); } @@ -338,11 +338,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long tmp_long = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, "%lu", &tmp_ulong); + HDsscanf(token, "%lu", &tmp_ulong); HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long)); } else { - sscanf(token, "%ld", &tmp_long); + HDsscanf(token, "%ld", &tmp_long); HDmemcpy(cptr, &tmp_long, sizeof(long)); } @@ -355,11 +355,11 @@ h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_ long long tmp_llong = 0; if (H5T_SGN_NONE == nsign) { - sscanf(token, fmt_ullong, &tmp_ullong); + HDsscanf(token, fmt_ullong, &tmp_ullong); HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long)); } else { - sscanf(token, fmt_llong, &tmp_llong); + HDsscanf(token, fmt_llong, &tmp_llong); HDmemcpy(cptr, &tmp_llong, sizeof(long long)); } diff --git a/src/H5private.h b/src/H5private.h index 13570db..4bd0685 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -590,227 +590,231 @@ 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() -#endif /* HDabort */ +#endif #ifndef HDabs #define HDabs(X) abs(X) -#endif /* HDabs */ +#endif #ifndef HDaccept -#define HDaccept(A, B, C) accept((A), (B), (C)) /* mirror VFD */ -#endif /* HDaccept */ +#define HDaccept(A, B, C) accept((A), (B), (C)) +#endif #ifndef HDaccess #define HDaccess(F, M) access(F, M) -#endif /* HDaccess */ +#endif #ifndef HDacos #define HDacos(X) acos(X) -#endif /* HDacos */ +#endif #ifndef HDalarm -#ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) -#else /* H5_HAVE_ALARM */ -#define HDalarm(N) (0) -#endif /* H5_HAVE_ALARM */ -#endif /* HDalarm */ +#endif #ifndef HDasctime #define HDasctime(T) asctime(T) -#endif /* HDasctime */ +#endif #ifndef HDasin #define HDasin(X) asin(X) -#endif /* HDasin */ +#endif #ifndef HDasprintf #define HDasprintf asprintf /*varargs*/ -#endif /* HDasprintf */ +#endif #ifndef HDassert #define HDassert(X) assert(X) -#endif /* HDassert */ +#endif #ifndef HDatan #define HDatan(X) atan(X) -#endif /* HDatan */ +#endif #ifndef HDatan2 #define HDatan2(X, Y) atan2(X, Y) -#endif /* HDatan2 */ +#endif #ifndef HDatexit #define HDatexit(F) atexit(F) -#endif /* HDatexit */ +#endif #ifndef HDatof #define HDatof(S) atof(S) -#endif /* HDatof */ +#endif #ifndef HDatoi #define HDatoi(S) atoi(S) -#endif /* HDatoi */ +#endif #ifndef HDatol #define HDatol(S) atol(S) -#endif /* HDatol */ +#endif #ifndef HDatoll #define HDatoll(S) atoll(S) -#endif /* HDatol */ +#endif #ifndef HDbind -#define HDbind(A, B, C) bind((A), (B), (C)) /* mirror VFD */ -#endif /* HDbind */ +#define HDbind(A, B, C) bind((A), (B), (C)) +#endif #ifndef HDbsearch #define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F) -#endif /* HDbsearch */ +#endif #ifndef HDcalloc #define HDcalloc(N, Z) calloc(N, Z) -#endif /* HDcalloc */ +#endif #ifndef HDceil #define HDceil(X) ceil(X) -#endif /* HDceil */ +#endif #ifndef HDcfgetispeed #define HDcfgetispeed(T) cfgetispeed(T) -#endif /* HDcfgetispeed */ +#endif #ifndef HDcfgetospeed #define HDcfgetospeed(T) cfgetospeed(T) -#endif /* HDcfgetospeed */ +#endif #ifndef HDcfsetispeed #define HDcfsetispeed(T, S) cfsetispeed(T, S) -#endif /* HDcfsetispeed */ +#endif #ifndef HDcfsetospeed #define HDcfsetospeed(T, S) cfsetospeed(T, S) -#endif /* HDcfsetospeed */ +#endif #ifndef HDchdir #define HDchdir(S) chdir(S) -#endif /* HDchdir */ +#endif #ifndef HDchmod #define HDchmod(S, M) chmod(S, M) -#endif /* HDchmod */ +#endif #ifndef HDchown #define HDchown(S, O, G) chown(S, O, G) -#endif /* HDchown */ +#endif #ifndef HDclearerr #define HDclearerr(F) clearerr(F) -#endif /* HDclearerr */ +#endif #ifndef HDclock #define HDclock() clock() -#endif /* HDclock */ +#endif #ifndef HDclock_gettime #define HDclock_gettime(CID, TS) clock_gettime(CID, TS) -#endif /* HDclock_gettime */ +#endif #ifndef HDclose #define HDclose(F) close(F) -#endif /* HDclose */ +#endif #ifndef HDclosedir #define HDclosedir(D) closedir(D) -#endif /* HDclosedir */ +#endif #ifndef HDconnect -#define HDconnect(A, B, C) connect((A), (B), (C)) /* mirror VFD */ -#endif /* HDconnect */ +#define HDconnect(A, B, C) connect((A), (B), (C)) +#endif #ifndef HDcos #define HDcos(X) cos(X) -#endif /* HDcos */ +#endif #ifndef HDcosh #define HDcosh(X) cosh(X) -#endif /* HDcosh */ +#endif #ifndef HDcreat #define HDcreat(S, M) creat(S, M) -#endif /* HDcreat */ +#endif #ifndef HDctermid #define HDctermid(S) ctermid(S) -#endif /* HDctermid */ +#endif #ifndef HDctime #define HDctime(T) ctime(T) -#endif /* HDctime */ +#endif #ifndef HDcuserid #define HDcuserid(S) cuserid(S) -#endif /* HDcuserid */ +#endif #ifndef HDdifftime -#ifdef H5_HAVE_DIFFTIME #define HDdifftime(X, Y) difftime(X, Y) -#else /* H5_HAVE_DIFFTIME */ -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif /* H5_HAVE_DIFFTIME */ -#endif /* HDdifftime */ +#endif #ifndef HDdiv #define HDdiv(X, Y) div(X, Y) -#endif /* HDdiv */ +#endif #ifndef HDdup #define HDdup(F) dup(F) -#endif /* HDdup */ +#endif #ifndef HDdup2 #define HDdup2(F, I) dup2(F, I) -#endif /* HDdup2 */ -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ +#endif #ifndef HDexecv #define HDexecv(S, AV) execv(S, AV) -#endif /* HDexecv */ +#endif #ifndef HDexecve #define HDexecve(S, AV, E) execve(S, AV, E) -#endif /* HDexecve */ +#endif #ifndef HDexecvp #define HDexecvp(S, AV) execvp(S, AV) -#endif /* HDexecvp */ +#endif #ifndef HDexit #define HDexit(N) exit(N) -#endif /* HDexit */ +#endif #ifndef HD_exit #define HD_exit(N) _exit(N) -#endif /* HD_exit */ +#endif #ifndef HDexp #define HDexp(X) exp(X) -#endif /* HDexp */ +#endif #ifndef HDexp2 #define HDexp2(X) exp2(X) -#endif /* HDexp2 */ +#endif #ifndef HDfabs #define HDfabs(X) fabs(X) -#endif /* HDfabs */ +#endif #ifndef HDfabsf #define HDfabsf(X) fabsf(X) -#endif /* HDfabsf */ +#endif #ifndef HDfabsl #define HDfabsl(X) fabsl(X) -#endif /* HDfabsl */ +#endif #ifndef HDfclose #define HDfclose(F) fclose(F) -#endif /* HDfclose */ -#ifdef H5_HAVE_FCNTL +#endif #ifndef HDfcntl #define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__) -#endif /* HDfcntl */ -#endif /* H5_HAVE_FCNTL */ +#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) -#endif /* HDfdopen */ +#endif #ifndef HDfeof #define HDfeof(F) feof(F) -#endif /* HDfeof */ +#endif #ifndef HDferror #define HDferror(F) ferror(F) -#endif /* HDferror */ +#endif #ifndef HDfflush #define HDfflush(F) fflush(F) -#endif /* HDfflush */ +#endif #ifndef HDfgetc #define HDfgetc(F) fgetc(F) -#endif /* HDfgetc */ +#endif #ifndef HDfgetpos #define HDfgetpos(F, P) fgetpos(F, P) -#endif /* HDfgetpos */ +#endif #ifndef HDfgets #define HDfgets(S, N, F) fgets(S, N, F) -#endif /* HDfgets */ +#endif #ifndef HDfileno #define HDfileno(F) fileno(F) -#endif /* HDfileno */ +#endif + /* Since flock is so prevalent, always build these functions * when possible to avoid them becoming dead code. */ #ifdef H5_HAVE_FCNTL H5_DLL int Pflock(int fd, int operation); -#endif /* H5_HAVE_FCNTL */ +#endif H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); + #ifndef HDflock /* NOTE: flock(2) is not present on all POSIX systems. * If it is not present, we try a flock() equivalent based on @@ -824,801 +828,800 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #define HDflock(F, L) Pflock(F, L) #else #define HDflock(F, L) Nflock(F, L) -#endif /* H5_HAVE_FLOCK */ +#endif + #endif /* HDflock */ + #ifndef HDfloor #define HDfloor(X) floor(X) -#endif /* HDfloor */ +#endif #ifndef HDfmod #define HDfmod(X, Y) fmod(X, Y) -#endif /* HDfmod */ +#endif #ifndef HDfopen #define HDfopen(S, M) fopen(S, M) -#endif /* HDfopen */ +#endif #ifndef HDfork #define HDfork() fork() -#endif /* HDfork */ +#endif #ifndef HDfprintf #define HDfprintf fprintf #endif #ifndef HDfpathconf #define HDfpathconf(F, N) fpathconf(F, N) -#endif /* HDfpathconf */ +#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) -#endif /* HDfputc */ +#endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) -#endif /* HDfputs */ +#endif #ifndef HDfread #define HDfread(M, Z, N, F) fread(M, Z, N, F) -#endif /* HDfread */ +#endif #ifndef HDfree #define HDfree(M) free(M) -#endif /* HDfree */ +#endif #ifndef HDfreopen #define HDfreopen(S, M, F) freopen(S, M, F) -#endif /* HDfreopen */ +#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) -#endif /* HDfrexp */ +#endif #ifndef HDfrexpf #define HDfrexpf(X, N) frexpf(X, N) -#endif /* HDfrexpf */ +#endif #ifndef HDfrexpl #define HDfrexpl(X, N) frexpl(X, N) -#endif /* HDfrexpl */ -/* fscanf() variable arguments */ +#endif +#ifndef HDfscanf +#define HDfscanf fscanf +#endif #ifndef HDfseek #define HDfseek(F, O, W) fseeko(F, O, W) -#endif /* HDfseek */ +#endif #ifndef HDfsetpos #define HDfsetpos(F, P) fsetpos(F, P) -#endif /* HDfsetpos */ +#endif #ifndef HDfstat #define HDfstat(F, B) fstat(F, B) -#endif /* HDfstat */ -#ifndef HDlstat -#define HDlstat(S, B) lstat(S, B) -#endif /* HDlstat */ -#ifndef HDstat -#define HDstat(S, B) stat(S, B) -#endif /* HDstat */ - -#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 - +#endif #ifndef HDftell #define HDftell(F) ftell(F) -#endif /* HDftell */ +#endif #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) -#endif /* HDftruncate */ +#endif #ifndef HDfwrite #define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F) -#endif /* HDfwrite */ +#endif #ifndef HDgetc #define HDgetc(F) getc(F) -#endif /* HDgetc */ +#endif #ifndef HDgetchar #define HDgetchar() getchar() -#endif /* HDgetchar */ +#endif #ifndef HDgetcwd #define HDgetcwd(S, Z) getcwd(S, Z) -#endif /* HDgetcwd */ +#endif #ifndef HDgetdcwd #define HDgetdcwd(D, S, Z) getcwd(S, Z) -#endif /* HDgetdcwd */ +#endif + +/* Windows only - set to zero on other systems */ #ifndef HDgetdrive #define HDgetdrive() 0 -#endif /* HDgetdrive */ +#endif + #ifndef HDgetegid #define HDgetegid() getegid() -#endif /* HDgetegid() */ +#endif #ifndef HDgetenv #define HDgetenv(S) getenv(S) -#endif /* HDgetenv */ +#endif #ifndef HDgeteuid #define HDgeteuid() geteuid() -#endif /* HDgeteuid */ +#endif #ifndef HDgetgid #define HDgetgid() getgid() -#endif /* HDgetgid */ +#endif #ifndef HDgetgrgid #define HDgetgrgid(G) getgrgid(G) -#endif /* HDgetgrgid */ +#endif #ifndef HDgetgrnam #define HDgetgrnam(S) getgrnam(S) -#endif /* HDgetgrnam */ +#endif #ifndef HDgetgroups #define HDgetgroups(Z, G) getgroups(Z, G) -#endif /* HDgetgroups */ +#endif #ifndef HDgethostbyaddr -#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) /* mirror VFD */ -#endif /* HDgethostbyaddr */ +#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) +#endif #ifndef HDgethostname #define HDgethostname(N, L) gethostname(N, L) -#endif /* HDgethostname */ +#endif #ifndef HDgetlogin #define HDgetlogin() getlogin() -#endif /* HDgetlogin */ +#endif #ifndef HDgetpgrp #define HDgetpgrp() getpgrp() -#endif /* HDgetpgrp */ +#endif #ifndef HDgetpid #define HDgetpid() getpid() -#endif /* HDgetpid */ +#endif #ifndef HDgetppid #define HDgetppid() getppid() -#endif /* HDgetppid */ +#endif #ifndef HDgetpwnam #define HDgetpwnam(S) getpwnam(S) -#endif /* HDgetpwnam */ +#endif #ifndef HDgetpwuid #define HDgetpwuid(U) getpwuid(U) -#endif /* HDgetpwuid */ +#endif #ifndef HDgetrusage #define HDgetrusage(X, S) getrusage(X, S) -#endif /* HDgetrusage */ +#endif /* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */ #ifdef HDgets #undef HDgets -#endif /* HDgets */ +#endif #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) -#endif /* HDgettimeofday */ +#endif #ifndef HDgetuid #define HDgetuid() getuid() -#endif /* HDgetuid */ +#endif #ifndef HDgmtime #define HDgmtime(T) gmtime(T) -#endif /* HDgmtime */ +#endif #ifndef HDhtonl -#define HDhtonl(X) htonl((X)) /* mirror VFD */ -#endif /* HDhtonl */ +#define HDhtonl(X) htonl((X)) +#endif #ifndef HDhtons -#define HDhtons(X) htons((X)) /* mirror VFD */ -#endif /* HDhtons */ +#define HDhtons(X) htons((X)) +#endif #ifndef HDinet_addr -#define HDinet_addr(C) inet_addr((C)) /* mirror VFD */ -#endif /* HDinet_addr */ +#define HDinet_addr(C) inet_addr((C)) +#endif #ifndef HDinet_ntoa -#define HDinet_ntoa(C) inet_ntoa((C)) /* mirror VFD */ -#endif /* HDinet_ntoa */ +#define HDinet_ntoa(C) inet_ntoa((C)) +#endif #ifndef HDisalnum -#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalnum */ +#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisalpha -#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalpha */ +#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisatty #define HDisatty(F) isatty(F) -#endif /* HDisatty */ +#endif #ifndef HDiscntrl -#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ -#endif /* HDiscntrl */ +#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */ +#endif #ifndef HDisdigit -#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisdigit */ +#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisgraph -#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ -#endif /* HDisgraph */ +#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/ +#endif #ifndef HDislower -#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ -#endif /* HDislower */ +#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisnan #define HDisnan(X) isnan(X) -#endif /* HDisnan */ +#endif #ifndef HDisprint -#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ -#endif /* HDisprint */ +#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDispunct -#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ -#endif /* HDispunct */ +#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisspace -#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ -#endif /* HDisspace */ +#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisupper -#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ -#endif /* HDisupper */ +#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisxdigit -#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisxdigit */ +#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDkill #define HDkill(P, S) kill(P, S) -#endif /* HDkill */ +#endif #ifndef HDlabs #define HDlabs(X) labs(X) -#endif /* HDlabs */ +#endif #ifndef HDldexp #define HDldexp(X, N) ldexp(X, N) -#endif /* HDldexp */ +#endif #ifndef HDldiv #define HDldiv(X, Y) ldiv(X, Y) -#endif /* HDldiv */ +#endif #ifndef HDlink #define HDlink(OLD, NEW) link(OLD, NEW) -#endif /* HDlink */ +#endif #ifndef HDlisten -#define HDlisten(A, B) listen((A), (B)) /* mirror VFD */ -#endif /* HDlisten */ +#define HDlisten(A, B) listen((A), (B)) +#endif #ifndef HDllround #define HDllround(V) llround(V) -#endif /* HDround */ +#endif #ifndef HDllroundf #define HDllroundf(V) llroundf(V) -#endif /* HDllroundf */ +#endif #ifndef HDllroundl #define HDllroundl(V) llroundl(V) -#endif /* HDllroundl */ +#endif #ifndef HDlocaleconv #define HDlocaleconv() localeconv() -#endif /* HDlocaleconv */ +#endif #ifndef HDlocaltime #define HDlocaltime(T) localtime(T) -#endif /* HDlocaltime */ +#endif #ifndef HDlog #define HDlog(X) log(X) -#endif /* HDlog */ +#endif #ifndef HDlog10 #define HDlog10(X) log10(X) -#endif /* HDlog10 */ +#endif #ifndef HDlongjmp #define HDlongjmp(J, N) longjmp(J, N) -#endif /* HDlongjmp */ +#endif #ifndef HDlround #define HDlround(V) lround(V) -#endif /* HDround */ +#endif #ifndef HDlroundf #define HDlroundf(V) lroundf(V) -#endif /* HDlroundf */ +#endif #ifndef HDlroundl #define HDlroundl(V) lroundl(V) -#endif /* HDroundl */ +#endif #ifndef HDlseek #define HDlseek(F, O, W) lseek(F, O, W) -#endif /* HDlseek */ +#endif +#ifndef HDlstat +#define HDlstat(S, B) lstat(S, B) +#endif #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -#endif /* HDmalloc */ +#endif #ifndef HDposix_memalign #define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z) -#endif /* HDposix_memalign */ +#endif #ifndef HDmblen #define HDmblen(S, N) mblen(S, N) -#endif /* HDmblen */ +#endif #ifndef HDmbstowcs #define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z) -#endif /* HDmbstowcs */ +#endif #ifndef HDmbtowc #define HDmbtowc(P, S, Z) mbtowc(P, S, Z) -#endif /* HDmbtowc */ +#endif #ifndef HDmemchr #define HDmemchr(S, C, Z) memchr(S, C, Z) -#endif /* HDmemchr */ +#endif #ifndef HDmemcmp #define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) -#endif /* HDmemcmp */ +#endif #ifndef HDmemcpy #define HDmemcpy(X, Y, Z) memcpy(X, Y, Z) -#endif /* HDmemcpy */ +#endif #ifndef HDmemmove #define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z) -#endif /* HDmemmove */ +#endif #ifndef HDmemset #define HDmemset(X, C, Z) memset(X, C, Z) -#endif /* HDmemset */ +#endif #ifndef HDmkdir #define HDmkdir(S, M) mkdir(S, M) -#endif /* HDmkdir */ +#endif #ifndef HDmkfifo #define HDmkfifo(S, M) mkfifo(S, M) -#endif /* HDmkfifo */ +#endif #ifndef HDmktime #define HDmktime(T) mktime(T) -#endif /* HDmktime */ +#endif #ifndef HDmodf #define HDmodf(X, Y) modf(X, Y) -#endif /* HDmodf */ +#endif #ifndef HDnanosleep #define HDnanosleep(N, O) nanosleep(N, O) -#endif /* HDnanosleep */ +#endif #ifndef HDntohl -#define HDntohl(A) ntohl((A)) /* mirror VFD */ -#endif /* HDntohl */ +#define HDntohl(A) ntohl((A)) +#endif #ifndef HDntohs -#define HDntohs(A) ntohs((A)) /* mirror VFD */ -#endif /* HDntohs */ +#define HDntohs(A) ntohs((A)) +#endif #ifndef HDopen #define HDopen(F, ...) open(F, __VA_ARGS__) -#endif /* HDopen */ +#endif #ifndef HDopendir #define HDopendir(S) opendir(S) -#endif /* HDopendir */ +#endif #ifndef HDpathconf #define HDpathconf(S, N) pathconf(S, N) -#endif /* HDpathconf */ +#endif #ifndef HDpause #define HDpause() pause() -#endif /* HDpause */ +#endif #ifndef HDperror #define HDperror(S) perror(S) -#endif /* HDperror */ +#endif #ifndef HDpipe #define HDpipe(F) pipe(F) -#endif /* HDpipe */ +#endif #ifndef HDpow #define HDpow(X, Y) pow(X, Y) -#endif /* HDpow */ +#endif #ifndef HDpowf #define HDpowf(X, Y) powf(X, Y) -#endif /* HDpowf */ +#endif #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) -#endif /* HDpread */ +#endif #ifndef HDprintf -#define HDprintf printf -#endif /* HDprintf */ +#define HDprintf printf /*varargs*/ +#endif #ifndef HDpthread_attr_destroy #define HDpthread_attr_destroy(A) pthread_attr_destroy(A) -#endif /* HDpthread_attr_destroy */ +#endif #ifndef HDpthread_attr_init #define HDpthread_attr_init(A) pthread_attr_init(A) -#endif /* HDpthread_attr_init */ +#endif #ifndef HDpthread_attr_setscope #define HDpthread_attr_setscope(A, S) pthread_attr_setscope(A, S) -#endif /* HDpthread_attr_setscope */ +#endif #ifndef HDpthread_cond_init #define HDpthread_cond_init(C, A) pthread_cond_init(C, A) -#endif /* HDpthread_cond_init */ +#endif #ifndef HDpthread_cond_signal #define HDpthread_cond_signal(C) pthread_cond_signal(C) -#endif /* HDpthread_cond_signal */ +#endif #ifndef HDpthread_cond_wait #define HDpthread_cond_wait(C, M) pthread_cond_wait(C, M) -#endif /* HDpthread_cond_wait */ +#endif #ifndef HDpthread_create #define HDpthread_create(R, A, F, U) pthread_create(R, A, F, U) -#endif /* HDpthread_create */ +#endif #ifndef HDpthread_equal #define HDpthread_equal(T1, T2) pthread_equal(T1, T2) -#endif /* HDpthread_equal */ +#endif #ifndef HDpthread_getspecific #define HDpthread_getspecific(K) pthread_getspecific(K) -#endif /* HDpthread_getspecific */ +#endif #ifndef HDpthread_join #define HDpthread_join(T, V) pthread_join(T, V) -#endif /* HDpthread_join */ +#endif #ifndef HDpthread_key_create #define HDpthread_key_create(K, D) pthread_key_create(K, D) -#endif /* HDpthread_key_create */ +#endif #ifndef HDpthread_mutex_init #define HDpthread_mutex_init(M, A) pthread_mutex_init(M, A) -#endif /* HDpthread_mutex_init */ +#endif #ifndef HDpthread_mutex_lock #define HDpthread_mutex_lock(M) pthread_mutex_lock(M) -#endif /* HDpthread_mutex_lock */ +#endif #ifndef HDpthread_mutex_unlock #define HDpthread_mutex_unlock(M) pthread_mutex_unlock(M) -#endif /* HDpthread_mutex_unlock */ +#endif #ifndef HDpthread_self #define HDpthread_self() pthread_self() -#endif /* HDpthread_self */ +#endif #ifndef HDpthread_setcancelstate #define HDpthread_setcancelstate(N, O) pthread_setcancelstate(N, O) -#endif /* HDpthread_setcancelstate */ +#endif #ifndef HDpthread_setspecific #define HDpthread_setspecific(K, V) pthread_setspecific(K, V) -#endif /* HDpthread_setspecific */ +#endif #ifndef HDputc #define HDputc(C, F) putc(C, F) -#endif /* HDputc*/ +#endif #ifndef HDputchar #define HDputchar(C) putchar(C) -#endif /* HDputchar */ +#endif #ifndef HDputs #define HDputs(S) puts(S) -#endif /* HDputs */ +#endif #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) -#endif /* HDpwrite */ +#endif #ifndef HDqsort #define HDqsort(M, N, Z, F) qsort(M, N, Z, F) -#endif /* HDqsort*/ +#endif #ifndef HDraise #define HDraise(N) raise(N) -#endif /* HDraise */ +#endif +/* clang-format off */ #ifdef H5_HAVE_RAND_R -#ifndef HDrandom -#define HDrandom() HDrand() -#endif /* HDrandom */ -H5_DLL int HDrand(void); -#ifndef HDsrandom -#define HDsrandom(S) HDsrand(S) -#endif /* HDsrandom */ -H5_DLL void HDsrand(unsigned int seed); +# ifndef HDrandom +# define HDrandom() HDrand() +# endif + H5_DLL int HDrand(void); +# ifndef HDsrandom +# define HDsrandom(S) HDsrand(S) +# endif + H5_DLL void HDsrand(unsigned int seed); #elif defined(H5_HAVE_RANDOM) -#ifndef HDrand -#define HDrand() random() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() random() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srandom(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srandom(S) -#endif /* HDsrandom */ -#else /* H5_HAVE_RANDOM */ -#ifndef HDrand -#define HDrand() rand() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() rand() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srand(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srand(S) -#endif /* HDsrandom */ -#endif /* H5_HAVE_RANDOM */ +# ifndef HDrand +# define HDrand() random() +# endif +# ifndef HDrandom +# define HDrandom() random() +# endif +# ifndef HDsrand +# define HDsrand(S) srandom(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srandom(S) +# endif +#else +# ifndef HDrand +# define HDrand() rand() +# endif +# ifndef HDrandom +# define HDrandom() rand() +# endif +# ifndef HDsrand +# define HDsrand(S) srand(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srand(S) +# endif +#endif +/* clang-format on */ #ifndef HDread #define HDread(F, M, Z) read(F, M, Z) -#endif /* HDread */ +#endif #ifndef HDreaddir #define HDreaddir(D) readdir(D) -#endif /* HDreaddir */ +#endif #ifndef HDrealloc #define HDrealloc(M, Z) realloc(M, Z) -#endif /* HDrealloc */ +#endif #ifndef HDrealpath #define HDrealpath(F1, F2) realpath(F1, F2) -#endif /* HDrealloc */ +#endif #ifndef HDremove #define HDremove(S) remove(S) -#endif /* HDremove */ +#endif #ifndef HDrename #define HDrename(OLD, NEW) rename(OLD, NEW) -#endif /* HDrename */ +#endif #ifndef HDrewind #define HDrewind(F) rewind(F) -#endif /* HDrewind */ +#endif #ifndef HDrewinddir #define HDrewinddir(D) rewinddir(D) -#endif /* HDrewinddir */ +#endif #ifndef HDround #define HDround(V) round(V) -#endif /* HDround */ +#endif #ifndef HDroundf #define HDroundf(V) roundf(V) -#endif /* HDroundf */ +#endif #ifndef HDroundl #define HDroundl(V) roundl(V) -#endif /* HDroundl */ +#endif #ifndef HDrmdir #define HDrmdir(S) rmdir(S) -#endif /* HDrmdir */ -/* scanf() variable arguments */ +#endif +#ifndef HDscanf +#define HDscanf scanf /*varargs*/ +#endif #ifndef HDselect #define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T) -#endif /* HDsetbuf */ +#endif #ifndef HDsetbuf #define HDsetbuf(F, S) setbuf(F, S) -#endif /* HDsetbuf */ +#endif #ifndef HDsetenv #define HDsetenv(N, V, O) setenv(N, V, O) -#endif /* HDsetenv */ +#endif #ifndef HDsetgid #define HDsetgid(G) setgid(G) -#endif /* HDsetgid */ +#endif #ifndef HDsetjmp #define HDsetjmp(J) setjmp(J) -#endif /* HDsetjmp */ +#endif #ifndef HDsetlocale #define HDsetlocale(N, S) setlocale(N, S) -#endif /* HDsetlocale */ +#endif #ifndef HDsetpgid #define HDsetpgid(P, PG) setpgid(P, PG) -#endif /* HDsetpgid */ +#endif #ifndef HDsetsid #define HDsetsid() setsid() -#endif /* HDsetsid */ +#endif #ifndef HDsetsockopt -#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) /* mirror VFD */ -#endif /* HDsetsockopt */ +#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) +#endif #ifndef HDsetuid #define HDsetuid(U) setuid(U) -#endif /* HDsetuid */ +#endif #ifndef HDsetvbuf #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z) -#endif /* HDsetvbuf */ +#endif #ifndef HDshutdown -#define HDshutdown(A, B) shutdown((A), (B)) /* mirror VFD */ -#endif /* HDshutdown */ +#define HDshutdown(A, B) shutdown((A), (B)) +#endif #ifndef HDsigaction #define HDsigaction(S, A, O) sigaction((S), (A), (O)) -#endif /* HDsigaction */ +#endif #ifndef HDsigaddset #define HDsigaddset(S, N) sigaddset(S, N) -#endif /* HDsigaddset */ +#endif #ifndef HDsigdelset #define HDsigdelset(S, N) sigdelset(S, N) -#endif /* HDsigdelset */ +#endif #ifndef HDsigemptyset #define HDsigemptyset(S) sigemptyset(S) -#endif /* HDsigemptyset */ +#endif #ifndef HDsigfillset #define HDsigfillset(S) sigfillset(S) -#endif /* HDsigfillset */ +#endif #ifndef HDsigismember #define HDsigismember(S, N) sigismember(S, N) -#endif /* HDsigismember */ +#endif #ifndef HDsiglongjmp #define HDsiglongjmp(J, N) siglongjmp(J, N) -#endif /* HDsiglongjmp */ +#endif #ifndef HDsignal #define HDsignal(N, F) signal(N, F) -#endif /* HDsignal */ +#endif #ifndef HDsigpending #define HDsigpending(S) sigpending(S) -#endif /* HDsigpending */ +#endif #ifndef HDsigprocmask #define HDsigprocmask(H, S, O) sigprocmask(H, S, O) -#endif /* HDsigprocmask */ +#endif #ifndef HDsigsetjmp #define HDsigsetjmp(J, N) sigsetjmp(J, N) -#endif /* HDsigsetjmp */ +#endif #ifndef HDsigsuspend #define HDsigsuspend(S) sigsuspend(S) -#endif /* HDsigsuspend */ +#endif #ifndef HDsin #define HDsin(X) sin(X) -#endif /* HDsin */ +#endif #ifndef HDsinh #define HDsinh(X) sinh(X) -#endif /* HDsinh */ +#endif #ifndef HDsleep #define HDsleep(N) sleep(N) -#endif /* HDsleep */ +#endif #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ -#endif /* HDsnprintf */ +#endif #ifndef HDsocket -#define HDsocket(A, B, C) socket((A), (B), (C)) /* mirror VFD */ -#endif /* HDsocket */ +#define HDsocket(A, B, C) socket((A), (B), (C)) +#endif #ifndef HDsprintf #define HDsprintf sprintf /*varargs*/ -#endif /* HDsprintf */ +#endif #ifndef HDsqrt #define HDsqrt(X) sqrt(X) -#endif /* HDsqrt */ +#endif #ifndef HDsscanf -#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__) -#endif /* HDsscanf */ +#define HDsscanf sscanf /*varargs*/ +#endif +#ifndef HDstat +#define HDstat(S, B) stat(S, B) +#endif #ifndef HDstrcat #define HDstrcat(X, Y) strcat(X, Y) -#endif /* HDstrcat */ +#endif #ifndef HDstrchr #define HDstrchr(S, C) strchr(S, C) -#endif /* HDstrchr */ +#endif #ifndef HDstrcmp #define HDstrcmp(X, Y) strcmp(X, Y) -#endif /* HDstrcmp */ +#endif #ifndef HDstrcasecmp #define HDstrcasecmp(X, Y) strcasecmp(X, Y) -#endif /* HDstrcasecmp */ +#endif #ifndef HDstrcoll #define HDstrcoll(X, Y) strcoll(X, Y) -#endif /* HDstrcoll */ +#endif #ifndef HDstrcpy #define HDstrcpy(X, Y) strcpy(X, Y) -#endif /* HDstrcpy */ +#endif #ifndef HDstrcspn #define HDstrcspn(X, Y) strcspn(X, Y) -#endif /* HDstrcspn */ +#endif #ifndef HDstrdup #define HDstrdup(S) strdup(S) -#endif /* HDstrdup */ +#endif #ifndef HDstrerror #define HDstrerror(N) strerror(N) -#endif /* HDstrerror */ +#endif #ifndef HDstrftime #define HDstrftime(S, Z, F, T) strftime(S, Z, F, T) -#endif /* HDstrftime */ +#endif #ifndef HDstrlen #define HDstrlen(S) strlen(S) -#endif /* HDstrlen */ +#endif #ifndef HDstrncat #define HDstrncat(X, Y, Z) strncat(X, Y, Z) -#endif /* HDstrncat */ +#endif #ifndef HDstrncmp #define HDstrncmp(X, Y, Z) strncmp(X, Y, Z) -#endif /* HDstrncmp */ +#endif #ifndef HDstrncpy #define HDstrncpy(X, Y, Z) strncpy(X, Y, Z) -#endif /* HDstrncpy */ +#endif #ifndef HDstrpbrk #define HDstrpbrk(X, Y) strpbrk(X, Y) -#endif /* HDstrpbrk */ +#endif #ifndef HDstrrchr #define HDstrrchr(S, C) strrchr(S, C) -#endif /* HDstrrchr */ +#endif #ifndef HDstrspn #define HDstrspn(X, Y) strspn(X, Y) -#endif /* HDstrspn */ +#endif #ifndef HDstrstr #define HDstrstr(X, Y) strstr(X, Y) -#endif /* HDstrstr */ +#endif #ifndef HDstrtod #define HDstrtod(S, R) strtod(S, R) -#endif /* HDstrtod */ +#endif #ifndef HDstrtok #define HDstrtok(X, Y) strtok(X, Y) -#endif /* HDstrtok */ +#endif #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) -#endif /* HDstrtok */ +#endif #ifndef HDstrtol #define HDstrtol(S, R, N) strtol(S, R, N) -#endif /* HDstrtol */ +#endif #ifndef HDstrtoll #define HDstrtoll(S, R, N) strtoll(S, R, N) -#endif /* HDstrtoll */ +#endif #ifndef HDstrtoul #define HDstrtoul(S, R, N) strtoul(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoull #define HDstrtoull(S, R, N) strtoull(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoumax #define HDstrtoumax(S, R, N) strtoumax(S, R, N) -#endif /* HDstrtoumax */ +#endif #ifndef HDstrxfrm #define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) -#endif /* HDstrxfrm */ -#ifdef H5_HAVE_SYMLINK +#endif #ifndef HDsymlink #define HDsymlink(F1, F2) symlink(F1, F2) -#endif /* HDsymlink */ -#endif /* H5_HAVE_SYMLINK */ +#endif #ifndef HDsysconf #define HDsysconf(N) sysconf(N) -#endif /* HDsysconf */ +#endif #ifndef HDsystem #define HDsystem(S) system(S) -#endif /* HDsystem */ +#endif #ifndef HDtan #define HDtan(X) tan(X) -#endif /* HDtan */ +#endif #ifndef HDtanh #define HDtanh(X) tanh(X) -#endif /* HDtanh */ +#endif #ifndef HDtcdrain #define HDtcdrain(F) tcdrain(F) -#endif /* HDtcdrain */ +#endif #ifndef HDtcflow #define HDtcflow(F, A) tcflow(F, A) -#endif /* HDtcflow */ +#endif #ifndef HDtcflush #define HDtcflush(F, N) tcflush(F, N) -#endif /* HDtcflush */ +#endif #ifndef HDtcgetattr #define HDtcgetattr(F, T) tcgetattr(F, T) -#endif /* HDtcgetattr */ +#endif #ifndef HDtcgetpgrp #define HDtcgetpgrp(F) tcgetpgrp(F) -#endif /* HDtcgetpgrp */ +#endif #ifndef HDtcsendbreak #define HDtcsendbreak(F, N) tcsendbreak(F, N) -#endif /* HDtcsendbreak */ +#endif #ifndef HDtcsetattr #define HDtcsetattr(F, O, T) tcsetattr(F, O, T) -#endif /* HDtcsetattr */ +#endif #ifndef HDtcsetpgrp #define HDtcsetpgrp(F, N) tcsetpgrp(F, N) -#endif /* HDtcsetpgrp */ +#endif #ifndef HDtime #define HDtime(T) time(T) -#endif /* HDtime */ +#endif #ifndef HDtimes #define HDtimes(T) times(T) -#endif /* HDtimes*/ +#endif #ifndef HDtmpfile #define HDtmpfile() tmpfile() -#endif /* HDtmpfile */ +#endif #ifndef HDtmpnam #define HDtmpnam(S) tmpnam(S) -#endif /* HDtmpnam */ +#endif #ifndef HDtolower #define HDtolower(C) tolower(C) -#endif /* HDtolower */ +#endif #ifndef HDtoupper #define HDtoupper(C) toupper(C) -#endif /* HDtoupper */ +#endif #ifndef HDttyname #define HDttyname(F) ttyname(F) -#endif /* HDttyname */ +#endif #ifndef HDtzset #define HDtzset() tzset() -#endif /* HDtzset */ +#endif #ifndef HDumask #define HDumask(N) umask(N) -#endif /* HDumask */ +#endif #ifndef HDuname #define HDuname(S) uname(S) -#endif /* HDuname */ +#endif #ifndef HDungetc #define HDungetc(C, F) ungetc(C, F) -#endif /* HDungetc */ +#endif #ifndef HDunlink #define HDunlink(S) unlink(S) -#endif /* HDunlink */ +#endif #ifndef HDunsetenv #define HDunsetenv(S) unsetenv(S) -#endif /* HDsetenv */ +#endif #ifndef HDutime #define HDutime(S, T) utime(S, T) -#endif /* HDutime */ +#endif + #ifndef HDvasprintf #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); -#endif /* H5_HAVE_VASPRINTF */ -#endif /* HDvasprintf */ +#endif +#endif + #ifndef HDva_arg #define HDva_arg(A, T) va_arg(A, T) -#endif /* HDva_arg */ +#endif #ifndef HDva_copy #define HDva_copy(D, S) va_copy(D, S) -#endif /* HDva_copy */ +#endif #ifndef HDva_end #define HDva_end(A) va_end(A) -#endif /* HDva_end */ +#endif #ifndef HDva_start #define HDva_start(A, P) va_start(A, P) -#endif /* HDva_start */ +#endif #ifndef HDvfprintf #define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#endif /* HDvfprintf */ +#endif #ifndef HDvprintf #define HDvprintf(FMT, A) vprintf(FMT, A) -#endif /* HDvprintf */ +#endif #ifndef HDvsprintf #define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#endif /* HDvsprintf */ +#endif #ifndef HDvsnprintf #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif /* HDvsnprintf */ +#endif #ifndef HDwait #define HDwait(W) wait(W) -#endif /* HDwait */ +#endif #ifndef HDwaitpid #define HDwaitpid(P, W, O) waitpid(P, W, O) -#endif /* HDwaitpid */ +#endif #ifndef HDwcstombs #define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#endif /* HDwcstombs */ +#endif #ifndef HDwctomb #define HDwctomb(S, C) wctomb(S, C) -#endif /* HDwctomb */ +#endif #ifndef HDwrite #define HDwrite(F, M, Z) write(F, M, Z) -#endif /* HDwrite */ +#endif /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ 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 */ diff --git a/test/h5test.h b/test/h5test.h index 16fb33c..db1a887 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -162,12 +162,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 f805997..d3f0211 100644 --- a/test/testframe.c +++ b/test/testframe.c @@ -320,9 +320,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)); @@ -620,12 +620,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 */ @@ -635,4 +638,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/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 2a65591..04e1c35 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -489,7 +489,7 @@ readIntegerData(FILE *strm, struct Input *in) case 0: /* TEXTIN */ in08 = (H5DT_INT8 *)in->data; for (i = 0; i < len; i++, in08++) { - if (fscanf(strm, "%hd", &temp16) != 1) { + if (HDfscanf(strm, "%hd", &temp16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -521,7 +521,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in16++) { - if (fscanf(strm, "%hd", in16) != 1) { + if (HDfscanf(strm, "%hd", in16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -558,7 +558,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in32++) { - if (fscanf(strm, "%d", in32) != 1) { + if (HDfscanf(strm, "%d", in32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -595,7 +595,7 @@ readIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 0: /* TEXTIN */ for (i = 0; i < len; i++, in64++) { - if (fscanf(strm, "%s", buffer) < 1) { + if (HDfscanf(strm, "%s", buffer) < 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -664,7 +664,7 @@ readUIntegerData(FILE *strm, struct Input *in) case 6: /* TEXTUIN */ in08 = (H5DT_UINT8 *)in->data; for (i = 0; i < len; i++, in08++) { - if (fscanf(strm, "%hu", &temp16) != 1) { + if (HDfscanf(strm, "%hu", &temp16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -693,7 +693,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in16++) { - if (fscanf(strm, "%hu", in16) != 1) { + if (HDfscanf(strm, "%hu", in16) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -729,7 +729,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in32++) { - if (fscanf(strm, "%u", in32) != 1) { + if (HDfscanf(strm, "%u", in32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -766,7 +766,7 @@ readUIntegerData(FILE *strm, struct Input *in) switch (in->inputClass) { case 6: /* TEXTUIN */ for (i = 0; i < len; i++, in64++) { - if (fscanf(strm, "%s", buffer) < 1) { + if (HDfscanf(strm, "%s", buffer) < 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -832,7 +832,7 @@ readFloatData(FILE *strm, struct Input *in) switch (in->inputClass) { case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp32++) { - if (fscanf(strm, "%f", fp32) != 1) { + if (HDfscanf(strm, "%f", fp32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -845,7 +845,7 @@ readFloatData(FILE *strm, struct Input *in) case 2: /*TEXTFPE */ for (i = 0; i < len; i++, fp32++) { - if (fscanf(strm, "%f", fp32) != 1) { + if (HDfscanf(strm, "%f", fp32) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -884,7 +884,7 @@ readFloatData(FILE *strm, struct Input *in) switch (in->inputClass) { case 1: /* TEXTFP */ for (i = 0; i < len; i++, fp64++) { - if (fscanf(strm, "%lf", fp64) != 1) { + if (HDfscanf(strm, "%lf", fp64) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -897,7 +897,7 @@ readFloatData(FILE *strm, struct Input *in) case 2: /*TEXTFPE */ for (i = 0; i < len; i++, fp64++) { - if (fscanf(strm, "%lf", fp64) != 1) { + if (HDfscanf(strm, "%lf", fp64) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -1469,16 +1469,16 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); if ((scanret == 1) && !HDstrcmp("HDF5", key)) { #ifdef H5DEBUGIMPORT int pndx; HDprintf("\nh5dump file\n"); #endif in->h5dumpInput = 1; - scanret = fscanf(strm, "%254s", temp); /* filename */ - scanret = fscanf(strm, "%254s", temp); /* start bracket */ - scanret = fscanf(strm, "%254s", key); /* DATASET */ + scanret = HDfscanf(strm, "%254s", temp); /* filename */ + scanret = HDfscanf(strm, "%254s", temp); /* start bracket */ + scanret = HDfscanf(strm, "%254s", key); /* DATASET */ while (scanret == 1) { if (!HDstrcmp("DATASET", key)) { /* PATH */ #ifdef H5DEBUGIMPORT @@ -1488,7 +1488,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1500,7 +1500,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } in->configOptionVector[PATH] = 1; - scanret = fscanf(strm, "%254s", temp); /* start bracket */ + scanret = HDfscanf(strm, "%254s", temp); /* start bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASET %s found\n", temp); #endif @@ -1514,7 +1514,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1550,20 +1550,20 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATATYPE STRING %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* string properties */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* string properties */ (void)HDfprintf(stderr, "%s", err18); goto error; } while (get_next_prop) { if (!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1582,8 +1582,8 @@ processConfigurationFile(char *infile, struct Input *in) #endif } } - else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */ - if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ + else if (!HDstrcmp("STRPAD", temp)) { /* STRPAD */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* STRPAD type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1591,8 +1591,8 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING STRPAD %s found\n", temp); #endif } - else if (!HDstrcmp("CSET", key)) { /* CSET */ - if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */ + else if (!HDstrcmp("CSET", key)) { /* CSET */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CSET type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1600,8 +1600,8 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CSET %s found\n", temp); #endif } - else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */ - if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ + else if (!HDstrcmp("CTYPE", temp)) { /* CTYPE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CTYPE type */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1609,7 +1609,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp); #endif } /* if(!HDstrcmp("CSET", key)) */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1628,7 +1628,7 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1644,14 +1644,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1662,7 +1662,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1672,7 +1672,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1716,7 +1716,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1728,7 +1728,7 @@ processConfigurationFile(char *infile, struct Input *in) (hsize_t *)HDmalloc((size_t)in->rank * sizeof(hsize_t))) == NULL) { goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1742,7 +1742,7 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE process max dim values\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1762,7 +1762,7 @@ processConfigurationFile(char *infile, struct Input *in) char *more = temp; in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10); } - if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1793,7 +1793,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err16c, infile); goto error; } - scanret = fscanf(strm, "%254s", temp); /* end bracket */ + scanret = HDfscanf(strm, "%254s", temp); /* end bracket */ #ifdef H5DEBUGIMPORT HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp); #endif @@ -1808,14 +1808,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* CHUNKED */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1827,7 +1827,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, "Unable to allocate dynamic memory.\n"); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1838,7 +1838,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -1848,7 +1848,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1880,7 +1880,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5b, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* SIZE */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1888,7 +1888,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump STORAGE_LAYOUT CHUNKED %s found\n", temp); #endif if (!HDstrcmp("SIZE", temp)) { /* SIZE */ - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1897,7 +1897,7 @@ processConfigurationFile(char *infile, struct Input *in) #endif } while (HDstrcmp("}", temp) != 0) { - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1912,14 +1912,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err6b, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -1930,28 +1930,28 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION found\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* DEFLATE */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* bgin bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* LEVEL */ (void)HDfprintf(stderr, "%s", err18); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp); #endif - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -1959,7 +1959,7 @@ processConfigurationFile(char *infile, struct Input *in) HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival); #endif in->compressionParam = ival; - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1981,7 +1981,7 @@ processConfigurationFile(char *infile, struct Input *in) #endif in->configOptionVector[COMPRESS] = 0; } - if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* end bracket */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -1995,14 +1995,14 @@ processConfigurationFile(char *infile, struct Input *in) #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET key\n"); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start bracket */ (void)HDfprintf(stderr, err20, infile); goto error; } #ifdef H5DEBUGIMPORT HDprintf("h5dump SUBSET %s found\n", temp); #endif - if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */ (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2012,7 +2012,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_prop) { if (!HDstrcmp("COUNT", temp)) { /* COUNT */ int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2023,7 +2023,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -2033,7 +2033,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2068,7 +2068,7 @@ processConfigurationFile(char *infile, struct Input *in) } /* if(!HDstrcmp("COUNT", temp)) COUNT */ if (!HDstrcmp("BLOCK", temp)) { /* BLOCK */ int icount = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* start paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* start paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2079,7 +2079,7 @@ processConfigurationFile(char *infile, struct Input *in) int get_next_dim = 1; int i = 0; - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */ (void)HDfprintf(stderr, err16c, infile); goto error; } @@ -2089,7 +2089,7 @@ processConfigurationFile(char *infile, struct Input *in) while (get_next_dim) { char *more = temp; temp_dims[icount] = HDstrtoull(more, &more, 10); - if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ + if (HDfscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */ (void)HDfprintf(stderr, err6b, infile); goto error; } @@ -2122,7 +2122,7 @@ processConfigurationFile(char *infile, struct Input *in) in->configOptionVector[DIM] = 1; } /* if(!HDstrcmp("(", key)) start paren */ } /* if(!HDstrcmp("BLOCK", temp)) BLOCK */ - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2141,7 +2141,7 @@ processConfigurationFile(char *infile, struct Input *in) scanret = 0; break; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); } #ifdef H5DEBUGIMPORT HDprintf("h5dump path"); @@ -2182,7 +2182,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err3a, infile); goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2199,7 +2199,7 @@ processConfigurationFile(char *infile, struct Input *in) goto error; } - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err18); goto error; } @@ -2226,7 +2226,7 @@ processConfigurationFile(char *infile, struct Input *in) (void)HDfprintf(stderr, err5a, infile); goto error; } - if (fscanf(strm, "%254d", (&ival)) != 1) { + if (HDfscanf(strm, "%254d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err19); goto error; } @@ -2423,7 +2423,7 @@ processConfigurationFile(char *infile, struct Input *in) default: break; } - scanret = fscanf(strm, "%254s", key); + scanret = HDfscanf(strm, "%254s", key); } /* @@ -2602,7 +2602,7 @@ getOutputClass(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output class.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -2637,7 +2637,7 @@ getOutputSize(struct Input *in, FILE *strm) const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for output size.\n"; - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3502,7 +3502,7 @@ getInputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for input byte-order.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3524,7 +3524,7 @@ getRank(struct Input *in, FILE *strm) const char *err1 = "Unable to get integer value.\n"; const char *err2 = "Invalid value for rank.\n"; - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3553,7 +3553,7 @@ getDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%llu", (&ullval)) == 1) + while (HDfscanf(strm, "%llu", (&ullval)) == 1) in->sizeOfDimension[i++] = ullval; if (in->rank != i) { @@ -3579,7 +3579,7 @@ getChunkedDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%llu", (&ullval)) == 1) + while (HDfscanf(strm, "%llu", (&ullval)) == 1) in->sizeOfChunk[i++] = ullval; if (in->rank != i) { @@ -3612,7 +3612,7 @@ getMaximumDimensionSizes(struct Input *in, FILE *strm) return (-1); } - while (fscanf(strm, "%lld", (&llval)) == 1) { + while (HDfscanf(strm, "%lld", (&llval)) == 1) { if (llval == -1) in->maxsizeOfDimension[i++] = H5S_UNLIMITED; else @@ -3642,7 +3642,7 @@ getOutputArchitecture(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output architecture.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3675,7 +3675,7 @@ getOutputByteOrder(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for output byte-order.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3708,7 +3708,7 @@ getCompressionType(struct Input *in, FILE *strm) const char *err1 = "Unable to get 'string' value.\n"; const char *err2 = "Invalid value for compression.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3750,7 +3750,7 @@ getCompressionParameter(struct Input *in, FILE *strm) switch (in->compressionType) { case 0: /* GZIP */ - if (fscanf(strm, "%d", (&ival)) != 1) { + if (HDfscanf(strm, "%d", (&ival)) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } @@ -3774,7 +3774,7 @@ getExternalFilename(struct Input *in, FILE *strm) char temp[255]; const char *err1 = "Unable to get 'string' value.\n"; - if (fscanf(strm, "%254s", temp) != 1) { + if (HDfscanf(strm, "%254s", temp) != 1) { (void)HDfprintf(stderr, "%s", err1); return (-1); } diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index 1f1b821..474a56f 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -363,7 +363,7 @@ read_info(const char *filename, pack_opt_t *options) /* cycle until end of file reached */ while (1) { - if (EOF == fscanf(fp, "%9s", stype)) + if (EOF == HDfscanf(fp, "%9s", stype)) break; /* Info indicator must be for layout or filter */ @@ -378,7 +378,7 @@ read_info(const char *filename, pack_opt_t *options) i = 0; c = '0'; while (c != ' ') { - if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; @@ -390,7 +390,7 @@ read_info(const char *filename, pack_opt_t *options) c = '0'; /* go until end */ while (c != ' ') { - if (fscanf(fp, "%c", &c) < 0 && HDferror(fp)) { + if (HDfscanf(fp, "%c", &c) < 0 && HDferror(fp)) { error_msg("fscanf error\n"); h5tools_setstatus(EXIT_FAILURE); ret_value = EXIT_FAILURE; diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c index a9b4437..4925708 100644 --- a/tools/test/h5jam/getub.c +++ b/tools/test/h5jam/getub.c @@ -109,7 +109,7 @@ main(int argc, const char *argv[]) filename = HDstrdup(argv[opt_ind]); size = 0; - if (EOF == (res = sscanf(nbytes, "%u", &size))) { + if (EOF == (res = HDsscanf(nbytes, "%u", &size))) { /* fail */ error_msg("missing file name\n"); usage(h5tools_getprogname()); diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h index 2d89d30..276fa0f 100644 --- a/tools/test/perform/pio_standalone.h +++ b/tools/test/perform/pio_standalone.h @@ -90,27 +90,20 @@ #define HDctermid(S) ctermid(S) #define HDctime(T) ctime(T) #define HDcuserid(S) cuserid(S) -#ifdef H5_HAVE_DIFFTIME -#define HDdifftime(X, Y) difftime(X, Y) -#else -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif -#define HDdiv(X, Y) div(X, Y) -#define HDdup(F) dup(F) -#define HDdup2(F, I) dup2(F, I) -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ -#define HDexecv(S, AV) execv(S, AV) -#define HDexecve(S, AV, E) execve(S, AV, E) -#define HDexecvp(S, AV) execvp(S, AV) -#define HDexit(N) exit(N) -#define HD_exit(N) _exit(N) -#define HDexp(X) exp(X) -#define HDfabs(X) fabs(X) -#define HDfabsf(X) fabsf(X) -#define HDfabsl(X) fabsl(X) -#define HDfclose(F) fclose(F) +#define HDdifftime(X, Y) difftime(X, Y) +#define HDdiv(X, Y) div(X, Y) +#define HDdup(F) dup(F) +#define HDdup2(F, I) dup2(F, I) +#define HDexecv(S, AV) execv(S, AV) +#define HDexecve(S, AV, E) execve(S, AV, E) +#define HDexecvp(S, AV) execvp(S, AV) +#define HDexit(N) exit(N) +#define HD_exit(N) _exit(N) +#define HDexp(X) exp(X) +#define HDfabs(X) fabs(X) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h index 9bdac29..ea1a2a1 100644 --- a/tools/test/perform/sio_standalone.h +++ b/tools/test/perform/sio_standalone.h @@ -105,27 +105,20 @@ #define HDctermid(S) ctermid(S) #define HDctime(T) ctime(T) #define HDcuserid(S) cuserid(S) -#ifdef H5_HAVE_DIFFTIME -#define HDdifftime(X, Y) difftime(X, Y) -#else -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif -#define HDdiv(X, Y) div(X, Y) -#define HDdup(F) dup(F) -#define HDdup2(F, I) dup2(F, I) -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ -#define HDexecv(S, AV) execv(S, AV) -#define HDexecve(S, AV, E) execve(S, AV, E) -#define HDexecvp(S, AV) execvp(S, AV) -#define HDexit(N) exit(N) -#define HD_exit(N) _exit(N) -#define HDexp(X) exp(X) -#define HDfabs(X) fabs(X) -#define HDfabsf(X) fabsf(X) -#define HDfabsl(X) fabsl(X) -#define HDfclose(F) fclose(F) +#define HDdifftime(X, Y) difftime(X, Y) +#define HDdiv(X, Y) div(X, Y) +#define HDdup(F) dup(F) +#define HDdup2(F, I) dup2(F, I) +#define HDexecv(S, AV) execv(S, AV) +#define HDexecve(S, AV, E) execve(S, AV, E) +#define HDexecvp(S, AV) execvp(S, AV) +#define HDexit(N) exit(N) +#define HD_exit(N) _exit(N) +#define HDexp(X) exp(X) +#define HDfabs(X) fabs(X) +#define HDfabsf(X) fabsf(X) +#define HDfabsl(X) fabsl(X) +#define HDfclose(F) fclose(F) /* fcntl() variable arguments */ #define HDfdopen(N, S) fdopen(N, S) #define HDfeof(F) feof(F) |