diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/H5FDlog.c | 7 | ||||
-rw-r--r-- | src/H5FDmpio.c | 12 | ||||
-rw-r--r-- | src/H5Gdeprec.c | 10 | ||||
-rw-r--r-- | src/H5Pfapl.c | 11 | ||||
-rw-r--r-- | src/H5detect.c | 15 | ||||
-rw-r--r-- | src/H5private.h | 28 | ||||
-rw-r--r-- | src/H5public.h | 25 |
7 files changed, 36 insertions, 72 deletions
diff --git a/src/H5FDlog.c b/src/H5FDlog.c index aa2d6db..38ea346 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -326,12 +326,15 @@ H5Pset_fapl_log(hid_t fapl_id, const char *logfile, unsigned long long flags, si FUNC_ENTER_API(FAIL) H5TRACE4("e", "i*sULz", fapl_id, logfile, flags, buf_size); + /* Do this first, so that we don't try to free a wild pointer if + * H5P_object_verify() fails. + */ + HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); + /* Check arguments */ if (NULL == (plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - HDmemset(&fa, 0, sizeof(H5FD_log_fapl_t)); - /* Duplicate the log file string * A little wasteful, since this string will just be copied later, but * passing it in as a pointer sets off a chain of impossible-to-resolve diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 501ec6f..2dd7fd3 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1470,6 +1470,12 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS if (bytes_read < 0 || bytes_read > io_size) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed") +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_r_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off, + bytes_read); +#endif + /* * This gives us zeroes beyond end of physical MPI file. */ @@ -1659,6 +1665,12 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha if (bytes_written != io_size) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed") +#ifdef H5FDmpio_DEBUG + if (H5FD_mpio_debug_w_flag) + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank, + (long)mpi_off, bytes_written); +#endif + /* Each process will keep track of its perceived EOF value locally, and * ultimately we will reduce this value to the maximum amongst all * processes, but until then keep the actual eof at HADDR_UNDEF just in diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index 2916198..75e47d4 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -143,10 +143,10 @@ H5G_map_obj_type(H5O_type_t obj_type) * specified NAME. The group is opened for write access * and it's object ID is returned. * - * The optional SIZE_HINT specifies how much file space to - * reserve to store the names that will appear in this - * group. If a non-positive value is supplied for the SIZE_HINT - * then a default size is chosen. + * The SIZE_HINT parameter specifies how much file space to reserve + * to store the names that will appear in this group. This number + * must be less than or equal to UINT32_MAX. If zero is supplied + * for the SIZE_HINT then a default size is chosen. * * Note: Deprecated in favor of H5Gcreate2 * @@ -177,6 +177,8 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if (!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given") + if (size_hint > UINT32_MAX) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "size_hint cannot be larger than UINT32_MAX") /* Check if we need to create a non-standard GCPL */ if (size_hint > 0) { diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index fe5a81e..d7408e3 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -4254,7 +4254,7 @@ herr_t H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, hbool_t start_on_access) { H5P_genplist_t *plist; /* Property list pointer */ - char * tmp_location; /* Working location pointer */ + char * new_location; /* Working location pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -4270,19 +4270,14 @@ H5Pset_mdc_log_options(hid_t plist_id, hbool_t is_enabled, const char *location, if (NULL == (plist = H5P_object_verify(plist_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plist_id is not a file access property list") - /* Get the current location string and free it */ - if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get current log location") - H5MM_xfree(tmp_location); - /* Make a copy of the passed-in location */ - if (NULL == (tmp_location = H5MM_xstrdup(location))) + if (NULL == (new_location = H5MM_xstrdup(location))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "can't copy passed-in log location") /* Set values */ if (H5P_set(plist, H5F_ACS_USE_MDC_LOGGING_NAME, &is_enabled) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set is_enabled flag") - if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &tmp_location) < 0) + if (H5P_set(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &new_location) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set log location") if (H5P_set(plist, H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME, &start_on_access) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set start_on_access flag") diff --git a/src/H5detect.c b/src/H5detect.c index 52950bb..35da85e 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -1655,21 +1655,6 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; -#if defined(H5_HAVE_SETSYSINFO) && defined(SSI_NVPAIRS) -#if defined(UAC_NOPRINT) && defined(UAC_SIGBUS) - /* - * Make sure unaligned access generates SIGBUS and doesn't print warning - * messages so that we can detect alignment constraints on the DEC Alpha. - */ - int nvpairs[2]; - nvpairs[0] = SSIN_UACPROC; - nvpairs[1] = UAC_NOPRINT | UAC_SIGBUS; - if (setsysinfo(SSI_NVPAIRS, nvpairs, 1, 0, 0) < 0) { - fprintf(stderr, "H5detect: unable to turn off UAC handling: %s\n", HDstrerror(errno)); - } -#endif -#endif - #if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { diff --git a/src/H5private.h b/src/H5private.h index 162fae4..b31ec78 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -41,10 +41,6 @@ #endif /* H5_HAVE_WIN32_API */ #endif /* H5_HAVE_THREADSAFE */ -/* - * Include ANSI-C header files. - */ -#ifdef H5_STDC_HEADERS #include <assert.h> #include <ctype.h> #include <errno.h> @@ -56,7 +52,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#endif /* * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1 @@ -71,14 +66,7 @@ #include <pwd.h> #endif -/* - * C9x integer types - */ -#ifndef __cplusplus -#ifdef H5_HAVE_STDINT_H #include <stdint.h> -#endif -#endif /* * The `struct stat' data type for stat() and fstat(). This is a Posix file @@ -139,21 +127,6 @@ #endif /* - * System information. These are needed on the DEC Alpha to turn off fixing - * of unaligned accesses by the operating system during detection of - * alignment constraints in H5detect.c:main(). - */ -#ifdef H5_HAVE_SYS_SYSINFO_H -#include <sys/sysinfo.h> -#endif -#ifdef H5_HAVE_SYS_PROC_H -#include <sys/proc.h> -#endif -#ifdef H5_HAVE_IO_H -#include <io.h> -#endif - -/* * Dynamic library handling. These are needed for dynamically loading I/O * filters and VFDs. */ @@ -184,6 +157,7 @@ #include <windows.h> #include <direct.h> /* For _getcwd() */ +#include <io.h> /* POSIX I/O */ #endif /*H5_HAVE_WIN32_API*/ diff --git a/src/H5public.h b/src/H5public.h index 470f8b8..8d22e9d 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -34,13 +34,14 @@ #ifdef H5_HAVE_FEATURES_H #include <features.h> /* For setting POSIX, BSD, etc. compatibility */ #endif + #ifdef H5_HAVE_SYS_TYPES_H #include <sys/types.h> #endif -#ifdef H5_STDC_HEADERS + #include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ #include <stdarg.h> /* For variadic functions */ -#endif + #ifndef __cplusplus #ifdef H5_HAVE_STDINT_H #include <stdint.h> /* For C9x types */ @@ -50,9 +51,13 @@ #include <stdint.h> /* For C9x types (when included from C++) */ #endif #endif -#ifdef H5_HAVE_INTTYPES_H -#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */ + +#ifdef __cplusplus +#define __STDC_FORMAT_MACROS #endif + +#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */ + #ifdef H5_HAVE_STDDEF_H #include <stddef.h> #endif @@ -217,19 +222,7 @@ typedef int herr_t; * } * \endcode */ -#ifdef H5_HAVE_STDBOOL_H #include <stdbool.h> -#else /* H5_HAVE_STDBOOL_H */ -#ifndef __cplusplus -#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0) -#define bool _Bool -#else -#define bool unsigned int -#endif -#define true 1 -#define false 0 -#endif /* __cplusplus */ -#endif /* H5_HAVE_STDBOOL_H */ typedef bool hbool_t; typedef int htri_t; |