diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-24 20:04:38 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2019-06-24 20:04:38 (GMT) |
commit | 7485981bcabfeb09ced49b840bf828c00816157a (patch) | |
tree | 94812430157a39049efec811cc147d2c9a8d83a7 /src | |
parent | 61b2dddc25483f43be5869d3436ee20e9864e05a (diff) | |
parent | 35fd0ec8ceffe96cee352187154da15c967fb990 (diff) | |
download | hdf5-7485981bcabfeb09ced49b840bf828c00816157a.zip hdf5-7485981bcabfeb09ced49b840bf828c00816157a.tar.gz hdf5-7485981bcabfeb09ced49b840bf828c00816157a.tar.bz2 |
Merge pull request #8 in ~VCHOI/my_third_fork from develop to bugfix/new_shutdown_fsm
* commit '35fd0ec8ceffe96cee352187154da15c967fb990':
Updated H5Tcopy() to get the dataset's datatype through the VOL when that is passed in as the object ID.
Fix fortran test and test library linking
Update GCC 6 & 7 flags for CMake builds
Move -Wnormalized down into GCC 6.x flags
Put the memcpy overlap check back into H5MM.
Fixed the heap overflow in t_filters_parallel
Fixed some low-hanging fruit from -fsanitize in t_filters_parallel.
Add lib dir for testing plugins
Add support for GCC 7.x warnings, update warnhist script to account for them, clean up warnings.
Add H5_HLDLL prefix for windows link
HDFFV-10805 cleanup examples and test code
Fix minor typo in H5S_select_iter_release
Add missing fortran mods
HDFFV-10805 Fix test of library libinfo
Cleanup possible CMake target conflicts
Correct CMake issues
Diffstat (limited to 'src')
-rw-r--r-- | src/H5Clog_trace.c | 2 | ||||
-rw-r--r-- | src/H5D.c | 2 | ||||
-rw-r--r-- | src/H5Dint.c | 25 | ||||
-rw-r--r-- | src/H5Dmpio.c | 5 | ||||
-rw-r--r-- | src/H5Dprivate.h | 1 | ||||
-rw-r--r-- | src/H5Fint.c | 2 | ||||
-rw-r--r-- | src/H5Fprivate.h | 16 | ||||
-rw-r--r-- | src/H5Fsuper.c | 11 | ||||
-rw-r--r-- | src/H5Gloc.c | 5 | ||||
-rw-r--r-- | src/H5Gname.c | 1 | ||||
-rw-r--r-- | src/H5Gtest.c | 1 | ||||
-rw-r--r-- | src/H5I.c | 2 | ||||
-rw-r--r-- | src/H5MM.c | 8 | ||||
-rw-r--r-- | src/H5O.c | 1 | ||||
-rw-r--r-- | src/H5Oflush.c | 1 | ||||
-rw-r--r-- | src/H5Oint.c | 1 | ||||
-rw-r--r-- | src/H5Opkg.h | 4 | ||||
-rw-r--r-- | src/H5Pint.c | 4 | ||||
-rw-r--r-- | src/H5SM.c | 1 | ||||
-rw-r--r-- | src/H5Shyper.c | 8 | ||||
-rw-r--r-- | src/H5Sselect.c | 2 | ||||
-rw-r--r-- | src/H5T.c | 53 | ||||
-rw-r--r-- | src/H5Tnative.c | 12 | ||||
-rw-r--r-- | src/H5VLint.c | 1 | ||||
-rw-r--r-- | src/H5Zshuffle.c | 14 | ||||
-rw-r--r-- | src/H5checksum.c | 11 | ||||
-rw-r--r-- | src/H5private.h | 3 | ||||
-rw-r--r-- | src/H5trace.c | 2 |
28 files changed, 123 insertions, 76 deletions
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 7c1305c..713f333 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -41,7 +41,7 @@ /****************/ /* Max log message size */ -#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048 +#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096 /******************/ @@ -437,7 +437,7 @@ H5Dget_type(hid_t dset_id) if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier") - /* get the datatype */ + /* Get the datatype */ if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype") diff --git a/src/H5Dint.c b/src/H5Dint.c index 220f026..cd120d0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1095,7 +1095,6 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ size_t file_prefix_len; /* length of expanded prefix */ - H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2202,30 +2201,6 @@ H5D_nameof(const H5D_t *dataset) /*------------------------------------------------------------------------- - * Function: H5D_typeof - * - * Purpose: Returns a pointer to the dataset's datatype. The datatype - * is not copied. - * - * Return: Success: Ptr to the dataset's datatype, uncopied. - * Failure: NULL - *------------------------------------------------------------------------- - */ -H5T_t * -H5D_typeof(const H5D_t *dset) -{ - /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(dset); - HDassert(dset->shared); - HDassert(dset->shared->type); - - FUNC_LEAVE_NOAPI(dset->shared->type) -} /* end H5D_typeof() */ - - -/*------------------------------------------------------------------------- * Function: H5D__alloc_storage * * Purpose: Allocate storage for the raw data of a dataset. diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index ee8bde2..467b1b7 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -2806,8 +2806,9 @@ H5D__chunk_redistribute_shared_chunks(const H5D_io_info_t *io_info, const H5D_ty /* Sort the new list in order of previous owner so that each original owner of a chunk * entry gets that entry back, with the possibly newly-modified "new_owner" field */ - HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries, - sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner); + if(shared_chunks_info_array_num_entries > 1) + HDqsort(shared_chunks_info_array, shared_chunks_info_array_num_entries, + sizeof(H5D_filtered_collective_io_info_t), H5D__cmp_filtered_collective_io_info_entry_owner); send_displacements[0] = 0; for (i = 1; i < (size_t) mpi_size; i++) diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 6fb7889..bc44d2a 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -166,7 +166,6 @@ H5_DLL herr_t H5D_mult_refresh_close(hid_t dset_id); H5_DLL herr_t H5D_mult_refresh_reopen(H5D_t *dataset); H5_DLL H5O_loc_t *H5D_oloc(H5D_t *dataset); H5_DLL H5G_name_t *H5D_nameof(const H5D_t *dataset); -H5_DLL H5T_t *H5D_typeof(const H5D_t *dset); H5_DLL herr_t H5D_flush_all(const H5F_t *f); H5_DLL hid_t H5D_get_create_plist(const H5D_t *dset); H5_DLL hid_t H5D_get_access_plist(const H5D_t *dset); diff --git a/src/H5Fint.c b/src/H5Fint.c index edd0e8e..4021e41 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -509,6 +509,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") @@ -3610,6 +3611,7 @@ H5F__get_file(void *obj, H5I_type_t type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 43644ac..a8ac158 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -160,16 +160,16 @@ typedef struct H5F_t H5F_t; (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ - (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ - ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & 0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ + ((*(p) & 0x80) ? ~0xffffffffULL : 0x0ULL))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index cc68889..fb68c73 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -513,15 +513,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #endif /* H5_HAVE_PARALLEL */ /* Check if superblock address is different from base address and adjust - * base address and "end of address" address if so. + * base address and "end of file" address if so. */ if(!H5F_addr_eq(super_addr, sblock->base_addr)) { - /* Check if the superblock moved earlier in the file */ - if(H5F_addr_lt(super_addr, sblock->base_addr)) - udata.stored_eof -= (sblock->base_addr - super_addr); - else - /* The superblock moved later in the file */ - udata.stored_eof += (super_addr - sblock->base_addr); + /* If the superblock moved in the file, adjust the EOF */ + /* (Handles moving earlier & later) */ + udata.stored_eof -= (sblock->base_addr - super_addr); /* Adjust base address for offsets of the HDF5 data in the file */ sblock->base_addr = super_addr; diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 5724031..e47d3be 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -226,7 +226,10 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") case H5I_VOL: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) connector") + + case H5I_SPACE_SEL_ITER: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a dataspace selection iterator") case H5I_UNINIT: case H5I_BADID: diff --git a/src/H5Gname.c b/src/H5Gname.c index fa0a925..16c1ca7 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -828,6 +828,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") diff --git a/src/H5Gtest.c b/src/H5Gtest.c index af6acb3..0b431b1 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -616,6 +616,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") @@ -2171,7 +2171,6 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) { H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) @@ -2384,6 +2383,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ @@ -589,13 +589,11 @@ H5MM_memcpy(void *dest, const void *src, size_t n) HDassert(dest); HDassert(src); -#if 0 - /* Commented out while we investigate overlapping buffers in the - * parallel filter code (HDFFV-10735). - */ + + /* Check for buffer overlap */ HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n); -#endif + /* Copy */ ret = HDmemcpy(dest, src, n); FUNC_LEAVE_NOAPI(ret) @@ -1102,6 +1102,7 @@ H5Oclose(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oflush.c b/src/H5Oflush.c index da9d1d0..f5ede4a 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -491,6 +491,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oint.c b/src/H5Oint.c index 60aae45..45a8046 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -1848,6 +1848,7 @@ H5O_get_loc(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type") diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 668f4f0..4afa452 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -134,9 +134,9 @@ ) : 0)) \ ) #define H5O_SIZEOF_MSGHDR_OH(O) \ - H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) + (unsigned)H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) #define H5O_SIZEOF_MSGHDR_F(F, C) \ - H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) + (unsigned)H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) /* * Size of chunk "header" for each chunk diff --git a/src/H5Pint.c b/src/H5Pint.c index 04411a5..0670adc 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -3133,7 +3133,7 @@ H5P__class_get(const H5P_genclass_t *pclass, const char *name, void *value) HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Copy the property value */ - HDmemcpy(value, prop->value, prop->size); + H5MM_memcpy(value, prop->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -3189,7 +3189,7 @@ H5P__class_set(const H5P_genclass_t *pclass, const char *name, const void *value HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Copy the property value */ - HDmemcpy(prop->value, value, prop->size); + H5MM_memcpy(prop->value, value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -274,6 +274,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag) case H5O_FILL_ID: type_id = H5O_FILL_NEW_ID; /* Fall through... */ + H5_ATTR_FALLTHROUGH case H5O_SDSPACE_ID: case H5O_DTYPE_ID: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4c8e458..2acc135 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2142,18 +2142,25 @@ loc += fast_dim_buf_off; do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -10013,6 +10020,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], if(op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */ break; /* Else fall through to error */ + H5_ATTR_FALLTHROUGH case H5S_SEL_ERROR: case H5S_SEL_N: diff --git a/src/H5Sselect.c b/src/H5Sselect.c index c40ff69..c383fed 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -1395,7 +1395,7 @@ done: PURPOSE Release a selection iterator's resources. USAGE - hssize_t H5S_select_iter_release(sel_iter) + herr_t H5S_select_iter_release(sel_iter) H5S_sel_iter_t *sel_iter; IN: Selection iterator to query RETURNS The number of elements in selection on success, 0 on failure @@ -1697,33 +1697,42 @@ done: *------------------------------------------------------------------------- */ hid_t -H5Tcopy(hid_t type_id) +H5Tcopy(hid_t obj_id) { - H5T_t *dt = NULL; /* Pointer to the datatype to copy */ - H5T_t *new_dt = NULL; - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + H5T_t *dt = NULL; /* Pointer to the datatype to copy */ + H5T_t *new_dt = NULL; /* Pointer to the new datatype */ + hid_t dset_tid = H5I_INVALID_HID; /* Datatype ID from dataset */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) - H5TRACE1("i", "i", type_id); + H5TRACE1("i", "i", obj_id); - switch(H5I_get_type(type_id)) { + switch(H5I_get_type(obj_id)) { case H5I_DATATYPE: - /* The argument is a datatype handle */ - if(NULL == (dt = (H5T_t *)H5I_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype") + if(NULL == (dt = (H5T_t *)H5I_object(obj_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a datatype ID") break; case H5I_DATASET: - { - H5D_t *dset; /* Dataset for datatype */ + { + H5VL_object_t *vol_obj = NULL; /* Dataset structure */ + + /* Check args */ + if(NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID") + + /* Get the datatype from the dataset + * NOTE: This will have to be closed after we're done with it. + */ + if(H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &dset_tid) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype from the dataset") + + /* Unwrap the type ID */ + if(NULL == (dt = (H5T_t *)H5I_object(dset_tid))) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5I_INVALID_HID, "received invalid datatype from the dataset") - /* The argument is a dataset handle */ - if(NULL == (dset = (H5D_t *)H5VL_object(type_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset") - if(NULL == (dt = H5D_typeof(dset))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, H5I_INVALID_HID, "unable to get the dataset datatype") - } break; + } case H5I_UNINIT: case H5I_BADID: @@ -1738,6 +1747,7 @@ H5Tcopy(hid_t type_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") @@ -1747,11 +1757,18 @@ H5Tcopy(hid_t type_id) if(NULL == (new_dt = H5T_copy(dt, H5T_COPY_TRANSIENT))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5I_INVALID_HID, "unable to copy") - /* Atomize result */ + /* Get an ID for the copied datatype */ if((ret_value = H5I_register(H5I_DATATYPE, new_dt, TRUE)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register datatype atom") done: + + /* If we got a type ID from a passed-in dataset, we need to close that */ + if(dset_tid != H5I_INVALID_HID) + if(H5I_dec_app_ref(dset_tid) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_BADATOM, FAIL, "problem freeing temporary dataset type ID") + + /* Close the new datatype on errors */ if(H5I_INVALID_HID == ret_value) if(new_dt && H5T_close_real(new_dt) < 0) HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, H5I_INVALID_HID, "unable to release datatype info") diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 3554f75..f40d81b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -551,6 +551,9 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) { match = H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); @@ -570,6 +573,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, match = H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) { match = H5T_NATIVE_INT_MATCH_LLONG; @@ -694,6 +698,9 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali HDassert(size>0); if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(size<=sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -717,6 +724,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali native_size = sizeof(double); #endif } +#pragma GCC diagnostic pop } else { #if H5_SIZEOF_LONG_DOUBLE !=0 if(size>sizeof(double)) { @@ -810,6 +818,9 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) { tid = H5T_NATIVE_B8; native_size = 1; @@ -831,6 +842,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, native_size = 8; align = H5T_NATIVE_UINT64_ALIGN_g; } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) { tid = H5T_NATIVE_B64; diff --git a/src/H5VLint.c b/src/H5VLint.c index 1b735f5..884b2f6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1437,6 +1437,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index e70ef33..b1d0722 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -185,18 +185,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -243,18 +250,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); diff --git a/src/H5checksum.c b/src/H5checksum.c index 64d527e..4e98976 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -407,16 +407,27 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) switch(length) /* all the case statements fall through */ { case 12: c+=((uint32_t)k[11])<<24; + H5_ATTR_FALLTHROUGH case 11: c+=((uint32_t)k[10])<<16; + H5_ATTR_FALLTHROUGH case 10: c+=((uint32_t)k[9])<<8; + H5_ATTR_FALLTHROUGH case 9 : c+=k[8]; + H5_ATTR_FALLTHROUGH case 8 : b+=((uint32_t)k[7])<<24; + H5_ATTR_FALLTHROUGH case 7 : b+=((uint32_t)k[6])<<16; + H5_ATTR_FALLTHROUGH case 6 : b+=((uint32_t)k[5])<<8; + H5_ATTR_FALLTHROUGH case 5 : b+=k[4]; + H5_ATTR_FALLTHROUGH case 4 : a+=((uint32_t)k[3])<<24; + H5_ATTR_FALLTHROUGH case 3 : a+=((uint32_t)k[2])<<16; + H5_ATTR_FALLTHROUGH case 2 : a+=((uint32_t)k[1])<<8; + H5_ATTR_FALLTHROUGH case 1 : a+=k[0]; break; case 0 : goto done; diff --git a/src/H5private.h b/src/H5private.h index dad2d94..86cd615 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -309,6 +309,7 @@ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) @@ -316,12 +317,14 @@ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) +# define H5_ATTR_FALLTHROUGH __attribute__((fallthrough)); #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5trace.c b/src/H5trace.c index 9c858fc..c5d14f5 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -173,7 +173,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(current_depth < last_call_depth) { /* We are at the beginning of a line */ if(H5_debug_g.ttimes) { - char tmp[128]; + char tmp[320]; HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime); HDfprintf(out, " %*s ", (int)HDstrlen(tmp), ""); |