summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt44
-rw-r--r--src/H5ACprivate.h18
-rw-r--r--src/H5B2int.c33
-rw-r--r--src/H5B2pkg.h12
-rw-r--r--src/H5Dchunk.c43
-rw-r--r--src/H5ESpublic.h10
-rw-r--r--src/H5HF.c19
-rw-r--r--src/H5HFcache.c12
-rw-r--r--src/H5HFman.c10
-rw-r--r--src/H5HGprivate.h2
-rw-r--r--src/H5M.c4
-rw-r--r--src/H5Pfapl.c8
-rw-r--r--src/H5Pocpl.c4
-rw-r--r--src/H5Ppublic.h8
-rw-r--r--src/H5RS.c12
-rw-r--r--src/H5Rint.c16
-rw-r--r--src/H5Rpkg.h2
-rw-r--r--src/H5SL.c666
-rw-r--r--src/H5SLprivate.h4
-rw-r--r--src/H5T.c218
-rw-r--r--src/H5Tconv.c8
-rw-r--r--src/H5Tnative.c23
-rw-r--r--src/H5Tpkg.h6
-rw-r--r--src/H5Tpublic.h4
-rw-r--r--src/H5Tref.c24
-rw-r--r--src/H5VL.c33
-rw-r--r--src/H5VLpublic.h13
-rw-r--r--src/H5Zscaleoffset.c66
-rw-r--r--src/H5Ztrans.c64
-rw-r--r--src/H5detect.c2
-rw-r--r--src/H5private.h4
-rw-r--r--src/H5public.h6
-rw-r--r--src/H5trace.c2
-rw-r--r--src/libhdf5.settings.in51
-rw-r--r--src/uthash.h30
35 files changed, 591 insertions, 890 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 955a394..33d31fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1418,36 +1418,6 @@ endif ()
# Option to build documentation
#-----------------------------------------------------------------------------
if (DOXYGEN_FOUND)
- set (DOXYGEN_PACKAGE ${HDF5_PACKAGE_NAME})
- set (DOXYGEN_VERSION_STRING ${HDF5_PACKAGE_VERSION_STRING})
- set (DOXYGEN_INCLUDE_ALIASES_PATH ${HDF5_DOXYGEN_DIR})
- set (DOXYGEN_INCLUDE_ALIASES aliases)
- set (DOXYGEN_VERBATIM_VARS DOXYGEN_INCLUDE_ALIASES)
- set (DOXYGEN_PROJECT_LOGO ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png)
- set (DOXYGEN_PROJECT_BRIEF "C-API Reference")
- set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}")
- set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
- set (DOXYGEN_MACRO_EXPANSION YES)
- set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs)
- set (DOXYGEN_EXAMPLES_DIRECTORY "${HDF5_DOXYGEN_DIR}/examples ${HDF5_SRC_DIR} ${HDF5_SOURCE_DIR}/examples ${HDF5_TEST_SRC_DIR}")
- set (DOXYGEN_LAYOUT_FILE ${HDF5_DOXYGEN_DIR}/hdf5doxy_layout.xml)
- set (DOXYGEN_HTML_HEADER ${HDF5_DOXYGEN_DIR}/hdf5_header.html)
- set (DOXYGEN_HTML_FOOTER ${HDF5_DOXYGEN_DIR}/hdf5_footer.html)
- set (DOXYGEN_HTML_EXTRA_STYLESHEET ${HDF5_DOXYGEN_DIR}/hdf5doxy.css)
- set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js ${HDF5_DOXYGEN_DIR}/img/ftv2node.png ${HDF5_DOXYGEN_DIR}/img/ftv2pnode.png")
- set (DOXYGEN_SERVER_BASED_SEARCH NO)
- set (DOXYGEN_EXTERNAL_SEARCH NO)
- set (DOXYGEN_SEARCHENGINE_URL)
-
-# This configure and custom target work together
- # Replace variables inside @@ with the current values
- configure_file (${HDF5_DOXYGEN_DIR}/Doxyfile.in ${HDF5_BINARY_DIR}/Doxyfile @ONLY)
- add_custom_target (hdf5lib_doc ALL
- COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
- WORKING_DIRECTORY ${HDF5_SRC_DIR}
- COMMENT "Generating HDF5 library Source API documentation with Doxygen"
- VERBATIM )
# This cmake function requires that the non-default doxyfile settings are provided with set (DOXYGEN_xxx) commands
# In addition the doxyfile aliases @INCLUDE option is not supported and would need to be provided in a set (DOXYGEN_ALIASES) command.
# doxygen_add_docs (hdf5lib_doc
@@ -1457,11 +1427,15 @@ if (DOXYGEN_FOUND)
# WORKING_DIRECTORY ${HDF5_SRC_DIR}
# COMMENT "Generating HDF5 library Source Documentation"
# )
- install (
- DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs/html
- DESTINATION ${HDF5_INSTALL_DATA_DIR}
- COMPONENT Documents
- )
+
+# This custom target and doxygen/configure work together
+ # Replace variables inside @@ with the current values
+ add_custom_target (hdf5lib_doc ALL
+ COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_SRC_DIR}
+ COMMENT "Generating HDF5 library Source API documentation with Doxygen"
+ VERBATIM )
if (NOT TARGET doxygen)
add_custom_target (doxygen)
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index a4e6d60..f7bed0c 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -234,27 +234,27 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.3f, \
+ /* double min_clean_fraction = */ 0.3, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ (1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
+ /* double lower_hr_threshold = */ 0.9, \
+ /* double increment = */ 2.0, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.0f, \
- /* double flash_threshold = */ 0.25f, \
+ /* double flash_multiple = */ 1.0, \
+ /* double flash_threshold = */ 0.25, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
+ /* double upper_hr_threshold = */ 0.999, \
+ /* double decrement = */ 0.9, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
+ /* double empty_reserve = */ 0.1, \
/* size_t dirty_bytes_threshold = */ (256 * 1024), \
/* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
@@ -270,7 +270,7 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.01f, \
+ /* double min_clean_fraction = */ 0.01, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ ( 1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 610da6c..ab43a5a 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -52,9 +52,9 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth,
- const H5B2_node_ptr_t *node_ptrs, unsigned start_idx,
- unsigned end_idx, void *old_parent, void *new_parent);
+static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs,
+ unsigned start_idx, unsigned end_idx, void *old_parent,
+ void *new_parent);
/*********************/
/* Package Variables */
@@ -1617,7 +1617,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
H5B2_operator_t op, void *op_data)
{
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
@@ -1642,8 +1642,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
/* Lock the current B-tree node */
if (NULL ==
- (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
@@ -1739,8 +1738,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
- H5B2_remove_t op, void *op_data)
+H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, H5B2_remove_t op,
+ void *op_data)
{
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
void * node = NULL; /* Pointers to current node */
@@ -1759,8 +1758,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_n
/* Lock the current B-tree node */
if (NULL ==
- (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
@@ -1824,7 +1822,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
hsize_t *btree_size)
{
H5B2_internal_t *internal = NULL; /* Pointer to internal node */
@@ -1839,8 +1837,8 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_nod
HDassert(depth > 0);
/* Lock the current B-tree node */
- if (NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */
@@ -1910,7 +1908,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr, void *old_parent,
+H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr, void *old_parent,
void *new_parent)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
@@ -1941,9 +1939,8 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t
H5B2_internal_t *child_int;
/* Protect child */
- if (NULL == (child_int = H5B2__protect_internal(
- hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, (uint16_t)(depth - 1), FALSE,
- H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL == (child_int = H5B2__protect_internal(hdr, new_parent, node_ptr, (uint16_t)(depth - 1),
+ FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
child_class = H5AC_BT2_INT;
child = child_int;
@@ -2010,7 +2007,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptrs,
+H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs,
unsigned start_idx, unsigned end_idx, void *old_parent, void *new_parent)
{
unsigned u; /* Local index variable */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 8d620cc..66d04fa 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -321,7 +321,7 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID];
/* Generic routines */
H5_DLL herr_t H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
-H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr,
+H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr,
void *old_parent, void *new_parent);
H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
@@ -390,9 +390,9 @@ H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
void *op_data);
/* Routines for iterating over nodes/records */
-H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_operator_t op, void *op_data);
+H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
hsize_t *op_data);
/* Routines for locating records */
@@ -423,8 +423,8 @@ H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_no
void *op_data);
/* Routines for deleting nodes */
-H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_remove_t op, void *op_data);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 71a15b0..cd54c3a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -1403,6 +1403,19 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
} /* H5D__chunk_mem_xfree() */
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_mem_free
+ *
+ * Purpose: Wrapper with H5MM_free_t-compatible signature that just
+ * calls H5D__chunk_mem_xfree and discards the return value.
+ *-------------------------------------------------------------------------
+ */
+static void
+H5D__chunk_mem_free(void *chk, const void *_pline)
+{
+ (void)H5D__chunk_mem_xfree(chk, _pline);
+}
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
*
* Purpose: Reallocate space for a chunk in memory. This routine allocates
@@ -3193,11 +3206,14 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
herr_t
H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata)
{
- H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- unsigned idx = 0; /* Index of chunk in cache, if present */
- hbool_t found = FALSE; /* In cache? */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ unsigned idx = 0; /* Index of chunk in cache, if present */
+ hbool_t found = FALSE; /* In cache? */
+#ifdef H5_HAVE_PARALLEL
+ hbool_t reenable_coll_md_reads = FALSE;
+#endif
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3268,8 +3284,13 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
* highly unlikely that users would read the same chunks from all
* processes.
*/
- if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
- H5CX_set_coll_metadata_read(FALSE);
+ if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
+ hbool_t do_coll_md_reads = H5CX_get_coll_metadata_read();
+ if (do_coll_md_reads) {
+ H5CX_set_coll_metadata_read(FALSE);
+ reenable_coll_md_reads = TRUE;
+ }
+ }
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
@@ -3312,6 +3333,12 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
} /* end else */
done:
+#ifdef H5_HAVE_PARALLEL
+ /* Re-enable collective metadata reads if we disabled them */
+ if (reenable_coll_md_reads)
+ H5CX_set_coll_metadata_read(TRUE);
+#endif /* H5_HAVE_PARALLEL */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_lookup() */
@@ -4427,7 +4454,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const
/* (delay allocating fill buffer for VL datatypes until refilling) */
/* (casting away const OK - QAK) */
if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, (void *)pline,
- (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill,
+ (H5MM_free_t)H5D__chunk_mem_free, (void *)pline, &dset->shared->dcpl_cache.fill,
dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index 4cf71c5..c8696b3 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -51,13 +51,13 @@ typedef enum H5ES_status_t {
/* Information about operations in an event set */
typedef struct H5ES_op_info_t {
/* API call info */
- char *api_name; /* Name of HDF5 API routine called */
- char *api_args; /* "Argument string" for arguments to HDF5 API routine called */
+ const char *api_name; /* Name of HDF5 API routine called */
+ char * api_args; /* "Argument string" for arguments to HDF5 API routine called */
/* Application info */
- char * app_file_name; /* Name of source file where the HDF5 API routine was called */
- char * app_func_name; /* Name of function where the HDF5 API routine was called */
- unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */
+ const char *app_file_name; /* Name of source file where the HDF5 API routine was called */
+ const char *app_func_name; /* Name of function where the HDF5 API routine was called */
+ unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */
/* Operation info */
uint64_t op_ins_count; /* Counter of operation's insertion into event set */
diff --git a/src/H5HF.c b/src/H5HF.c
index 1f4cc26..6c6b101 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -117,8 +117,14 @@ H5HF__op_write(const void *obj, size_t obj_len, void *op_data)
{
FUNC_ENTER_PACKAGE_NOERR
- /* Perform "write", using memcpy() */
- H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
+ /* Perform "write", using memcpy()
+ *
+ * We cast away const here because no obj pointer that was originally
+ * const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ H5MM_memcpy((void *)obj, op_data, obj_len);
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF__op_write() */
@@ -350,10 +356,15 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/)
/* Check for 'huge' object */
if (size > hdr->max_man_size) {
- /* Store 'huge' object in heap */
- /* (Casting away const OK - QAK) */
+ /* Store 'huge' object in heap
+ *
+ * Although not ideal, we can quiet the const warning here becuase no
+ * obj pointer that was originally const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__huge_insert(hdr, size, (void *)obj, id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
/* Check for 'tiny' object */
else if (size <= hdr->tiny_max_len) {
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ea5e730..654fa36 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -1658,9 +1658,15 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
/* Update info about direct block */
udata->decompressed = TRUE;
len = nbytes;
- } /* end if */
- else
- read_buf = (void *)image; /* Casting away const OK - QAK */
+ }
+ else {
+ /* If the data are unfiltered, we just point to the image, which we
+ * never modify. Casting away const is okay here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ read_buf = (void *)image;
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ }
/* Decode checksum */
chk_size = (size_t)(H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) - H5HF_SIZEOF_CHKSUM);
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 427be00..a362d99 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -487,10 +487,16 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj)
HDassert(id);
HDassert(obj);
- /* Call the internal 'op' routine routine */
- /* (Casting away const OK - QAK) */
+ /* Call the internal 'op' routine routine
+ *
+ * In this case, the callback operation needs to modify the obj buffer that
+ * was passed in as const. We quiet the warning here because an obj pointer
+ * that was originally const should *never* arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index d8e6b46..5deae88 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -50,7 +50,7 @@ typedef struct H5HG_heap_t H5HG_heap_t;
/* Size of encoded global heap ID */
/* (size of file address + 32-bit integer) */
-#define H5HG_HEAP_ID_SIZE(F) ((size_t)H5F_SIZEOF_ADDR(F) + H5_SIZEOF_UINT32_T)
+#define H5HG_HEAP_ID_SIZE(F) ((size_t)H5F_SIZEOF_ADDR(F) + sizeof(uint32_t))
/* Main global heap routines */
H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/);
diff --git a/src/H5M.c b/src/H5M.c
index b890a5c..845c054 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -533,7 +533,7 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
/* Open the map */
if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map")
- map = map_args.create.map;
+ map = map_args.open.map;
/* Register an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0)
@@ -1360,6 +1360,7 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_SELF;
map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(map_id);
map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.key_mem_type_id = key_mem_type_id;
map_args.specific.args.iterate.op = op;
map_args.specific.args.iterate.op_data = op_data;
vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
@@ -1450,6 +1451,7 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_m
map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.name = map_name;
map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.key_mem_type_id = key_mem_type_id;
map_args.specific.args.iterate.op = op;
map_args.specific.args.iterate.op_data = op_data;
vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 0c2686a..ff9ff8a 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -74,7 +74,7 @@
#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t
/* Definition for preemption read chunks first */
#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
-#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75f
+#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75
#define H5F_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double
#define H5F_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double
/* Definition for threshold for alignment */
@@ -4947,8 +4947,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective)
/* (Dataset, group, attribute, and named datype access property lists
* are sub-classes of link access property lists -QAK)
*/
- if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
- TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
/* set property to either TRUE if > 0, or FALSE otherwise */
@@ -4999,8 +4998,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/)
/* (Dataset, group, attribute, and named datype access property lists
* are sub-classes of link access property lists -QAK)
*/
- if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
- TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
/* Get value */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index edb0cca..e442030 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -940,6 +940,8 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
@@ -1838,6 +1840,8 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index cba7e03..ed61646 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -6402,10 +6402,10 @@ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
* <td>byte 0</td>
* </tr>
* <tr>
- * <td>????????</td>
- * <td>????SPPP</td>
- * <td>PPPPPPPP</td>
- * <td>PPPP????</td>
+ * <td> ???????? </td>
+ * <td> ????SPPP </td>
+ * <td> PPPPPPPP </td>
+ * <td> PPPP???? </td>
* </tr>
* </table>
* Note: S - sign bit, P - significant bit, ? - padding bit; For
diff --git a/src/H5RS.c b/src/H5RS.c
index d9915f2..65cfd38 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -316,8 +316,16 @@ H5RS_wrap(const char *s)
if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed")
- /* Set the internal fields */
- ret_value->s = (char *)s;
+ /* Set the internal fields
+ *
+ * We ignore warnings about storing a const char pointer in the struct
+ * since we never modify or free the string when the wrapped struct
+ * field is set to TRUE.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ ret_value->s = (char *)s;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
+
ret_value->len = HDstrlen(s);
ret_value->end = ret_value->s + ret_value->len;
diff --git a/src/H5Rint.c b/src/H5Rint.c
index e1a5dcd..7ee4ecc 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -1150,7 +1150,7 @@ H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned
/* Encode token */
H5MM_memcpy(p, obj_token, token_size);
}
- *nalloc = token_size + H5_SIZEOF_UINT8_T;
+ *nalloc = token_size + sizeof(uint8_t);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_obj_token() */
@@ -1178,7 +1178,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj
HDassert(token_size);
/* Don't decode if buffer size isn't big enough */
- if (*nbytes < H5_SIZEOF_UINT8_T)
+ if (*nbytes < sizeof(uint8_t))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
/* Get token size */
@@ -1192,7 +1192,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj
/* Decode token */
H5MM_memcpy(obj_token, p, *token_size);
- *nbytes = (size_t)(*token_size + H5_SIZEOF_UINT8_T);
+ *nbytes = (size_t)(*token_size + sizeof(uint8_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1225,7 +1225,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
"Cannot determine amount of space needed for serializing selection")
/* Don't encode if buffer size isn't big enough or buffer is empty */
- if (buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
+ if (buf && *nalloc >= ((size_t)buf_size + 2 * sizeof(uint32_t))) {
int rank;
p = (uint8_t *)buf;
@@ -1241,7 +1241,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
if (H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection")
} /* end if */
- *nalloc = (size_t)buf_size + 2 * H5_SIZEOF_UINT32_T;
+ *nalloc = (size_t)buf_size + 2 * sizeof(uint32_t);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1272,16 +1272,16 @@ H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr)
HDassert(space_ptr);
/* Don't decode if buffer size isn't big enough */
- if (*nbytes < (2 * H5_SIZEOF_UINT32_T))
+ if (*nbytes < (2 * sizeof(uint32_t)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
/* Decode the selection size */
UINT32DECODE(p, buf_size);
- buf_size += H5_SIZEOF_UINT32_T;
+ buf_size += sizeof(uint32_t);
/* Decode the extent rank */
UINT32DECODE(p, rank);
- buf_size += H5_SIZEOF_UINT32_T;
+ buf_size += sizeof(uint32_t);
/* Don't decode if buffer size isn't big enough */
if (*nbytes < buf_size)
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index ee5fb71..09144f9 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -43,7 +43,7 @@
#define H5R_REF_ATTRNAME(x) ((x)->info.attr.name)
/* Header size */
-#define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T)
+#define H5R_ENCODE_HEADER_SIZE (2 * sizeof(uint8_t))
/****************************/
/* Package Private Typedefs */
diff --git a/src/H5SL.c b/src/H5SL.c
index ba9721c..b4fbf99 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -36,13 +36,6 @@
* skip list. The implementation in that document hurts
* performance, at least for integer keys. -NAF)
*
- * (Also, this implementation has a couple of home-grown
- * optimizations, including setting the "update" vector to the
- * actual 'forward' pointer to update, instead of the node
- * containing the forward pointer -QAK
- * -No longer uses update vector, as insertions/deletions are now
- * always at level 0. -NAF)
- *
* (Note: This implementation does not have the information for
* implementing the "Linear List Operations" (like insert/delete/
* search by position) in section 3.4 of "A Skip List Cookbook",
@@ -71,25 +64,14 @@
/* Define the code template for searches for the "OP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_SEARCH_FOUND(SLIST, X, I) \
{ \
- HDassert(!X->removed); \
- HGOTO_DONE(X->item); \
- } /* end block */
-
-/* Define the code template for deferred removals for the "OP" in the
- * H5SL_LOCATE macro */
-#define H5SL_LOCATE_SEARCH_DEFER_REMOVE_FOUND(SLIST, X, I) \
- { \
- HDassert(!X->removed); \
- X->removed = TRUE; \
HGOTO_DONE(X->item); \
- } /* end block */
+ }
/* Define the code template for finds for the "OP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_FIND_FOUND(SLIST, X, I) \
{ \
- HDassert(!X->removed); \
HGOTO_DONE(X); \
- } /* end block */
+ }
/* Define a code template for comparing scalar keys for the "CMP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_SCALAR_CMP(SLIST, TYPE, PNODE, PKEY, HASHVAL) (*(TYPE *)((PNODE)->key) < *(TYPE *)PKEY)
@@ -155,51 +137,19 @@
H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
X = X->forward[_i]; \
_count++; \
- } /* end while */ \
- } /* end for */ \
+ } \
+ } \
X = X->forward[0]; \
if (X != NULL && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, X, KEY, HASHVAL)) { \
/* What to do when a node is found */ \
H5_GLUE3(H5SL_LOCATE_, OP, _FOUND)(SLIST, X, _i) \
- } /* end if */ \
- }
-
-/* Macro used to find node for operation, if there may be "removed" nodes in the
- * list (whose keys cannot be read) */
-#define H5SL_LOCATE_SAFE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- { \
- int _i; /* Local index variable */ \
- H5SL_node_t *_low = X; \
- H5SL_node_t *_high = NULL; \
- \
- H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
- (KEY, HASHVAL) for (_i = (int)SLIST->curr_level; _i >= 0; _i--) \
- { \
- X = _low->forward[_i]; \
- while (X != _high) { \
- if (!X->removed) { \
- if (H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL)) \
- _low = X; \
- else \
- break; \
- } /* end if */ \
- X = X->forward[_i]; \
- } /* end while */ \
- _high = X; \
- if (X != NULL && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, X, KEY, HASHVAL)) { \
- /* What to do when a node is found */ \
- H5_GLUE3(H5SL_LOCATE_, OP, _FOUND)(SLIST, X, _i) break; \
- } /* end if */ \
- } /* end for */ \
+ } \
}
/* Macro used to find node for operation */
#define H5SL_LOCATE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
{ \
- if ((SLIST)->safe_iterating) \
- H5SL_LOCATE_SAFE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- else \
- H5SL_LOCATE_OPT(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
+ H5SL_LOCATE_OPT(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
}
/* Macro used to grow a node by 1. Does not update pointers. LVL is the current
@@ -225,13 +175,13 @@
if (NULL == (H5SL_fac_g = (H5FL_fac_head_t **)H5MM_realloc( \
(void *)H5SL_fac_g, H5SL_fac_nalloc_g * sizeof(H5FL_fac_head_t *)))) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \
- } /* end if */ \
+ } \
\
/* Create the new factory */ \
H5SL_fac_g[H5SL_fac_nused_g] = \
H5FL_fac_init((1u << H5SL_fac_nused_g) * sizeof(H5SL_node_t *)); \
H5SL_fac_nused_g++; \
- } /* end if */ \
+ } \
\
/* Allocate space for new forward pointers */ \
if (NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
@@ -239,7 +189,7 @@
H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc - 1], (void *)X->forward); \
X->forward = _tmp; \
- } /* end if */ \
+ } \
\
X->level++; \
}
@@ -260,7 +210,7 @@
H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc + 1], (void *)X->forward); \
X->forward = _tmp; \
- } /* end if */ \
+ } \
\
X->level--; \
}
@@ -284,7 +234,7 @@
else { \
HDassert(_lvl < (size_t)SLIST->curr_level); \
X->forward[_lvl + 1] = PREV->forward[_lvl + 1]; \
- } /* end else */ \
+ } \
PREV->forward[_lvl + 1] = X; \
}
@@ -322,7 +272,7 @@
if (!_drop) \
_drop = X; \
break; \
- } /* end if */ \
+ } \
\
/* Check if this node is the start of the next gap */ \
if (!_drop && !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) \
@@ -337,7 +287,7 @@
break; \
} \
X = X->forward[_i]; \
- } /* end for */ \
+ } \
HDassert(!_drop->forward[_i] || \
!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
\
@@ -350,7 +300,7 @@
/* Prepare to drop down */ \
X = _last = _drop; \
_next = _drop->forward[_i]; \
- } /* end for */ \
+ } \
\
if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't insert duplicate key") \
@@ -359,172 +309,167 @@
/* Macro used to remove node */
#define H5SL_REMOVE(CMP, SLIST, X, TYPE, KEY, HASHVAL) \
{ \
- /* Check for deferred removal */ \
- if (SLIST->safe_iterating) \
- H5SL_LOCATE(SEARCH_DEFER_REMOVE, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- else { \
- H5SL_node_t *_last = X; /* Lowest node in the current gap */ \
- H5SL_node_t *_llast = X; /* Lowest node in the previous gap */ \
- H5SL_node_t *_next = NULL; /* Highest node in the currect gap */ \
- H5SL_node_t *_drop = NULL; /* Low node of the gap to drop into */ \
- H5SL_node_t *_ldrop = NULL; /* Low node of gap before the one to drop into */ \
- H5SL_node_t *_head = SLIST->header; /* Head of the skip list */ \
- int _count; /* Number of nodes in the current gap */ \
- int _i = (int)SLIST->curr_level; \
+ H5SL_node_t *_last = X; /* Lowest node in the current gap */ \
+ H5SL_node_t *_llast = X; /* Lowest node in the previous gap */ \
+ H5SL_node_t *_next = NULL; /* Highest node in the currect gap */ \
+ H5SL_node_t *_drop = NULL; /* Low node of the gap to drop into */ \
+ H5SL_node_t *_ldrop = NULL; /* Low node of gap before the one to drop into */ \
+ H5SL_node_t *_head = SLIST->header; /* Head of the skip list */ \
+ int _count; /* Number of nodes in the current gap */ \
+ int _i = (int)SLIST->curr_level; \
\
- if (_i < 0) \
- HGOTO_DONE(NULL); \
+ if (_i < 0) \
+ HGOTO_DONE(NULL); \
\
- H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
- (KEY, HASHVAL) \
+ H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
+ (KEY, HASHVAL) \
\
- /* Find the gap to drop in to at the highest level */ \
- while (X && (!X->key || H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL))) \
- { \
- _llast = _last; \
- _last = X; \
- X = X->forward[_i]; \
- } \
- _next = X; \
+ /* Find the gap to drop in to at the highest level */ \
+ while (X && (!X->key || H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL))) \
+ { \
+ _llast = _last; \
+ _last = X; \
+ X = X->forward[_i]; \
+ } \
+ _next = X; \
\
- /* Main loop */ \
- for (_i--; _i >= 0; _i--) { \
- /* Search for the node to drop into, also count the number of */ \
- /* nodes of height _i in this gap and keep track of of the node */ \
- /* before the one to drop into (_ldrop will become _llast, */ \
- /* _drop will become _last). */ \
- X = _ldrop = _last; \
- _drop = NULL; \
- for (_count = 0;; _count++) { \
- /* Terminate if this is the last node in the gap */ \
- if (X->forward[_i] == _next) { \
- if (!_drop) \
- _drop = X; \
- break; \
- } /* end if */ \
+ /* Main loop */ \
+ for (_i--; _i >= 0; _i--) { \
+ /* Search for the node to drop into, also count the number of */ \
+ /* nodes of height _i in this gap and keep track of of the node */ \
+ /* before the one to drop into (_ldrop will become _llast, */ \
+ /* _drop will become _last). */ \
+ X = _ldrop = _last; \
+ _drop = NULL; \
+ for (_count = 0;; _count++) { \
+ /* Terminate if this is the last node in the gap */ \
+ if (X->forward[_i] == _next) { \
+ if (!_drop) \
+ _drop = X; \
+ break; \
+ } \
\
- /* If we have already found the node to drop into and there */ \
- /* is more than one node in this gap, we can stop searching */ \
- if (_drop) { \
- HDassert(_count >= 1); \
- _count = 2; \
- break; \
+ /* If we have already found the node to drop into and there */ \
+ /* is more than one node in this gap, we can stop searching */ \
+ if (_drop) { \
+ HDassert(_count >= 1); \
+ _count = 2; \
+ break; \
+ } \
+ else { /* !_drop */ \
+ /* Check if this node is the start of the next gap */ \
+ if (!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
+ _drop = X; \
+ /* Again check if we can stop searching */ \
+ if (_count) { \
+ _count = 2; \
+ break; \
+ } \
} \
- else { /* !_drop */ \
- /* Check if this node is the start of the next gap */ \
- if (!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
- _drop = X; \
- /* Again check if we can stop searching */ \
- if (_count) { \
- _count = 2; \
- break; \
- } /* end if */ \
- } /* end if */ \
- else \
- _ldrop = X; \
- } /* end else */ \
+ else \
+ _ldrop = X; \
+ } \
\
- /* No need to check the last node in the gap if there are */ \
- /* 3, as there cannot be a fourth */ \
- if (_count == 2) { \
- if (!_drop) \
- _drop = X->forward[_i]; \
- break; \
- } /* end if */ \
- X = X->forward[_i]; \
- } /* end for */ \
- HDassert(_count >= 1 && _count <= 3); \
- HDassert(!_drop->forward[_i] || \
- !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
+ /* No need to check the last node in the gap if there are */ \
+ /* 3, as there cannot be a fourth */ \
+ if (_count == 2) { \
+ if (!_drop) \
+ _drop = X->forward[_i]; \
+ break; \
+ } \
+ X = X->forward[_i]; \
+ } \
+ HDassert(_count >= 1 && _count <= 3); \
+ HDassert(!_drop->forward[_i] || \
+ !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
\
- /* Check if we need to adjust node heights */ \
- if (_count == 1) { \
- /* Check if we are in the first gap */ \
- if (_llast == _last) { \
- /* We are in the first gap, count the number of nodes */ \
- /* of height _i in the next gap. We need only check */ \
- /* onenode to see if we should promote the first node */ \
- /* in the next gap */ \
- _llast = _next->forward[_i + 1]; \
+ /* Check if we need to adjust node heights */ \
+ if (_count == 1) { \
+ /* Check if we are in the first gap */ \
+ if (_llast == _last) { \
+ /* We are in the first gap, count the number of nodes */ \
+ /* of height _i in the next gap. We need only check */ \
+ /* onenode to see if we should promote the first node */ \
+ /* in the next gap */ \
+ _llast = _next->forward[_i + 1]; \
\
- /* Demote the separator node */ \
- H5SL_DEMOTE(_next, _last) \
+ /* Demote the separator node */ \
+ H5SL_DEMOTE(_next, _last) \
\
- /* If there are 2 or more nodes, promote the first */ \
- if (_next->forward[_i]->forward[_i] != _llast) { \
- X = _next->forward[_i]; \
- H5SL_PROMOTE(SLIST, X, _last, NULL) \
- } \
- else if (!_head->forward[_i + 1]) { \
- /* shrink the header */ \
- HDassert(_i == SLIST->curr_level - 1); \
- HDassert((size_t)SLIST->curr_level == _head->level); \
+ /* If there are 2 or more nodes, promote the first */ \
+ if (_next->forward[_i]->forward[_i] != _llast) { \
+ X = _next->forward[_i]; \
+ H5SL_PROMOTE(SLIST, X, _last, NULL) \
+ } \
+ else if (!_head->forward[_i + 1]) { \
+ /* shrink the header */ \
+ HDassert(_i == SLIST->curr_level - 1); \
+ HDassert((size_t)SLIST->curr_level == _head->level); \
\
- H5SL_SHRINK(_head, (size_t)(_i + 1)) \
- SLIST->curr_level--; \
- } /* end else */ \
+ H5SL_SHRINK(_head, (size_t)(_i + 1)) \
+ SLIST->curr_level--; \
} \
- else { \
- /* We are not in the first gap, count the number of */ \
- /* nodes of height _i in the previous gap. Note we */ \
- /* "look ahead" in this loop so X has the value of the */ \
- /* last node in the previous gap. */ \
- X = _llast->forward[_i]; \
- for (_count = 1; _count < 3 && X->forward[_i] != _last; _count++) \
- X = X->forward[_i]; \
- HDassert(X->forward[_i] == _last); \
+ } \
+ else { \
+ /* We are not in the first gap, count the number of */ \
+ /* nodes of height _i in the previous gap. Note we */ \
+ /* "look ahead" in this loop so X has the value of the */ \
+ /* last node in the previous gap. */ \
+ X = _llast->forward[_i]; \
+ for (_count = 1; _count < 3 && X->forward[_i] != _last; _count++) \
+ X = X->forward[_i]; \
+ HDassert(X->forward[_i] == _last); \
\
- /* Demote the separator node */ \
- H5SL_DEMOTE(_last, _llast) \
+ /* Demote the separator node */ \
+ H5SL_DEMOTE(_last, _llast) \
\
- /* If there are 2 or more nodes, promote the last */ \
- if (_count >= 2) \
- H5SL_PROMOTE(SLIST, X, _llast, NULL) \
- else if (!_head->forward[_i + 1]) { \
- /* shrink the header */ \
- HDassert(_i == SLIST->curr_level - 1); \
- HDassert((size_t)SLIST->curr_level == _head->level); \
+ /* If there are 2 or more nodes, promote the last */ \
+ if (_count >= 2) \
+ H5SL_PROMOTE(SLIST, X, _llast, NULL) \
+ else if (!_head->forward[_i + 1]) { \
+ /* shrink the header */ \
+ HDassert(_i == SLIST->curr_level - 1); \
+ HDassert((size_t)SLIST->curr_level == _head->level); \
\
- H5SL_SHRINK(_head, (size_t)(_i + 1)) \
- SLIST->curr_level--; \
- } /* end else */ \
- } /* end else */ \
- } /* end if */ \
+ H5SL_SHRINK(_head, (size_t)(_i + 1)) \
+ SLIST->curr_level--; \
+ } \
+ } \
+ } \
\
- /* Prepare to drop down */ \
- _llast = _ldrop; \
- _last = _drop; \
- _next = _drop->forward[_i]; \
- } /* end for */ \
+ /* Prepare to drop down */ \
+ _llast = _ldrop; \
+ _last = _drop; \
+ _next = _drop->forward[_i]; \
+ } \
\
- /* Check if we've found the node */ \
- if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) { \
- void *tmp = _next->item; \
- X = _next; \
+ /* Check if we've found the node */ \
+ if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) { \
+ void *tmp = _next->item; \
+ X = _next; \
\
- /* If the node has a height > 0, swap it with its (lower) */ \
- /* neighbor */ \
- if (X->level) { \
- X = X->backward; \
- _next->key = X->key; \
- _next->item = X->item; \
- _next->hashval = X->hashval; \
- } /* end if */ \
- HDassert(!X->level); \
+ /* If the node has a height > 0, swap it with its (lower) */ \
+ /* neighbor */ \
+ if (X->level) { \
+ X = X->backward; \
+ _next->key = X->key; \
+ _next->item = X->item; \
+ _next->hashval = X->hashval; \
+ } \
+ HDassert(!X->level); \
\
- /* Remove the node */ \
- X->backward->forward[0] = X->forward[0]; \
- if (SLIST->last == X) \
- SLIST->last = X->backward; \
- else \
- X->forward[0]->backward = X->backward; \
- SLIST->nobjs--; \
- X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \
- X = H5FL_FREE(H5SL_node_t, X); \
+ /* Remove the node */ \
+ X->backward->forward[0] = X->forward[0]; \
+ if (SLIST->last == X) \
+ SLIST->last = X->backward; \
+ else \
+ X->forward[0]->backward = X->backward; \
+ SLIST->nobjs--; \
+ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \
+ X = H5FL_FREE(H5SL_node_t, X); \
\
- HGOTO_DONE(tmp); \
- } /* end if */ \
- } /* end else */ \
+ HGOTO_DONE(tmp); \
+ } \
}
/* Macro used to search for node */
@@ -542,7 +487,6 @@ struct H5SL_node_t {
size_t level; /* The level of this node */
size_t log_nalloc; /* log2(Number of slots allocated in forward) */
uint32_t hashval; /* Hash value for key (only for strings, currently) */
- hbool_t removed; /* Whether the node is "removed" (actual removal deferred) */
struct H5SL_node_t **forward; /* Array of forward pointers from this node */
struct H5SL_node_t * backward; /* Backward pointer from this node */
};
@@ -558,8 +502,6 @@ struct H5SL_t {
size_t nobjs; /* Number of active objects in skip list */
H5SL_node_t *header; /* Header for nodes in skip list */
H5SL_node_t *last; /* Pointer to last node in skip list */
- hbool_t safe_iterating; /* Whether a routine is "safely" iterating over the list and removals should be
- deferred */
};
/* Static functions */
@@ -651,11 +593,11 @@ H5SL_term_package(void)
for (i = 0; i < H5SL_fac_nused_g; i++) {
ret = H5FL_fac_term(H5SL_fac_g[i]);
HDassert(ret >= 0);
- } /* end if */
+ }
H5SL_fac_nused_g = 0;
n++;
- } /* end if */
+ }
/* Free the list of factories */
if (H5SL_fac_g) {
@@ -663,12 +605,12 @@ H5SL_term_package(void)
H5SL_fac_nalloc_g = 0;
n++;
- } /* end if */
+ }
/* Mark the interface as uninitialized */
if (0 == n)
H5_PKG_INIT_VAR = FALSE;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(n)
} /* H5SL_term_package() */
@@ -711,11 +653,10 @@ H5SL__new_node(void *item, const void *key, uint32_t hashval)
ret_value->item = item;
ret_value->level = 0;
ret_value->hashval = hashval;
- ret_value->removed = FALSE;
if (NULL == (ret_value->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) {
ret_value = H5FL_FREE(H5SL_node_t, ret_value);
HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed")
- } /* end if */
+ }
ret_value->log_nalloc = 0;
done:
@@ -805,7 +746,7 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in existing list, if we get here */
@@ -880,15 +821,22 @@ H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
while (node) {
next_node = node->forward[0];
- /* Call callback, if one is given */
+ /* Call callback, if one is given.
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (op)
- /* Casting away const OK -QAK */
(void)(op)(node->item, (void *)node->key, op_data);
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward);
node = H5FL_FREE(H5SL_node_t, node);
node = next_node;
- } /* end while */
+ }
/* Reset the header pointers */
slist->header->forward =
@@ -1001,9 +949,8 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp)
new_slist->cmp = cmp;
/* Set the dynamic internal fields */
- new_slist->curr_level = -1;
- new_slist->nobjs = 0;
- new_slist->safe_iterating = FALSE;
+ new_slist->curr_level = -1;
+ new_slist->nobjs = 0;
/* Allocate the header node */
if (NULL == (header = H5SL__new_node(NULL, NULL, (uint32_t)ULONG_MAX)))
@@ -1027,7 +974,7 @@ done:
if (ret_value == NULL) {
if (new_slist != NULL)
new_slist = H5FL_FREE(H5SL_t, new_slist);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SL_create() */
@@ -1058,9 +1005,6 @@ H5SL_count(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1099,9 +1043,6 @@ H5SL_insert(H5SL_t *slist, void *item, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1148,9 +1089,6 @@ H5SL_add(H5SL_t *slist, void *item, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1242,7 +1180,7 @@ H5SL_remove(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1281,9 +1219,6 @@ H5SL_remove_first(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Assign level */
H5_CHECK_OVERFLOW(slist->curr_level, int, size_t);
level = (size_t)slist->curr_level;
@@ -1345,12 +1280,12 @@ H5SL_remove_first(H5SL_t *slist)
H5SL_SHRINK(head, level)
slist->curr_level--;
- } /* end else */
+ }
}
else
break;
- } /* end for */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1436,7 +1371,7 @@ H5SL_search(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in list, if we get here */
ret_value = NULL;
@@ -1480,9 +1415,6 @@ H5SL_less(H5SL_t *slist, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1531,7 +1463,7 @@ H5SL_less(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* Check for a node with a key that is less than the given 'key' */
@@ -1541,13 +1473,13 @@ H5SL_less(H5SL_t *slist, const void *key)
ret_value = slist->last->item;
else
ret_value = NULL;
- } /* end if */
+ }
else {
if (x->backward != slist->header)
ret_value = x->backward->item;
else
ret_value = NULL;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1588,9 +1520,6 @@ H5SL_greater(H5SL_t *slist, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1639,7 +1568,7 @@ H5SL_greater(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* ('x' must be the next node with a key greater than the 'key', or NULL) */
@@ -1734,7 +1663,7 @@ H5SL_find(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in list, if we get here */
ret_value = NULL;
@@ -1826,7 +1755,7 @@ H5SL_below(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* Check for a node with a key that is less than the given 'key' */
@@ -1836,13 +1765,13 @@ H5SL_below(H5SL_t *slist, const void *key)
ret_value = slist->last;
else
ret_value = NULL;
- } /* end if */
+ }
else {
if (x->backward != slist->header)
ret_value = x->backward;
else
ret_value = NULL;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1931,7 +1860,7 @@ H5SL_above(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* ('x' must be the next node with a key greater than the 'key', or NULL) */
@@ -1971,9 +1900,6 @@ H5SL_first(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2007,9 +1933,6 @@ H5SL_next(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2043,9 +1966,6 @@ H5SL_prev(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2080,9 +2000,6 @@ H5SL_last(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2116,9 +2033,6 @@ H5SL_item(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2179,15 +2093,21 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data)
/* Protect against the node being deleted by the callback */
next = node->forward[0];
- /* Call the iterator callback */
- /* Casting away const OK -QAK */
- if (!node->removed)
- if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0)
- break;
+ /* Call the iterator callback
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0)
+ break;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Advance to next node */
node = next;
- } /* end while */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SL_iterate() */
@@ -2222,9 +2142,6 @@ H5SL_release(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2274,9 +2191,6 @@ H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2290,186 +2204,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5SL_try_free_safe
- PURPOSE
- Makes the supplied callback on all nodes in the skip list, freeing each
- node that the callback returns TRUE for.
- USAGE
- herr_t PURPOSE(slist,op,opdata)
- H5SL_t *slist; IN/OUT: Pointer to skip list to release nodes
- H5SL_try_free_op_t op; IN: Callback function to try to free item & key
- void *op_data; IN/OUT: Pointer to application data for callback
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Makes the supplied callback on all nodes in the skip list, freeing each
- node that the callback returns TRUE for. The iteration is performed in
- a safe manner, such that the callback can call H5SL_remove(),
- H5SL_search(), H5SL_find(), and H5SL_iterate() on nodes in this
- skiplist, except H5SL_remove() may not be call on *this* node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This function is written to be most efficient when most nodes are
- removed from the skiplist, as it rebuilds the nodes afterwards.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data)
-{
- H5SL_node_t *node, *next_node, *last_node; /* Pointers to skip list nodes */
- htri_t op_ret;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(slist);
- HDassert(op);
-
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
- /* Check internal consistency */
- /* (Pre-condition) */
-
- /* Mark skip list as safe iterating, so nodes aren't freed out from under
- * us */
- slist->safe_iterating = TRUE;
-
- /* Iterate over skip list nodes, making the callback for each and marking
- * them as removed if requested by the callback */
- node = slist->header->forward[0];
- while (node) {
- /* Check if the node was already removed */
- if (!node->removed) {
- /* Call callback */
- /* Casting away const OK -NAF */
- if ((op_ret = (op)(node->item, (void *)node->key, op_data)) < 0)
- HGOTO_ERROR(H5E_SLIST, H5E_CALLBACK, FAIL, "callback operation failed")
-
- /* Check if op indicated that the node should be removed */
- if (op_ret)
- /* Mark the node as removed */
- node->removed = TRUE;
- } /* end if */
-
- /* Advance node */
- node = node->forward[0];
- } /* end while */
-
- /* Reset safe_iterating */
- slist->safe_iterating = FALSE;
-
- /* Iterate over nodes, freeing ones marked as removed */
- node = slist->header->forward[0];
- last_node = slist->header;
- while (node) {
- /* Save next node */
- next_node = node->forward[0];
-
- /* Check if the node was marked as removed */
- if (node->removed) {
- /* Remove the node */
- node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward);
- node = H5FL_FREE(H5SL_node_t, node);
- slist->nobjs--;
- } /* end if */
- else {
- /* Update backwards and forwards[0] pointers, and set the level to
- * 0. Since the list is flattened we must rebuild the skiplist
- * afterwards. */
- /* Set level to 0. Note there is no need to preserve
- * node->forward[0] since it was cached above and will always be
- * updated later. */
- if (node->level > 0) {
- node->forward =
- (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], (void *)node->forward);
- if (NULL == (node->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0])))
- HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- node->log_nalloc = 0;
- node->level = 0;
- } /* end if */
-
- /* Update pointers */
- last_node->forward[0] = node;
- node->backward = last_node;
- last_node = node;
- } /* end else */
-
- /* Advance node */
- node = next_node;
- } /* end while */
-
- /* Final pointer update */
- last_node->forward[0] = NULL;
- slist->last = last_node;
-
- /* Demote skip list to level 0 */
- if (slist->curr_level > 0) {
- HDassert(slist->header->level == (size_t)slist->curr_level);
-
- node = slist->header->forward[0];
- slist->header->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc],
- (void *)slist->header->forward);
- if (NULL == (slist->header->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0])))
- HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- slist->header->forward[0] = node;
- slist->header->log_nalloc = 0;
- slist->header->level = 0;
- } /* end if */
-
- /* Check if there are any nodes left */
- if (slist->nobjs > 0) {
- int i;
-
- HDassert(slist->header->forward[0]);
-
- /* Set skiplist level to 0 */
- slist->curr_level = 0;
-
- /* Rebuild the forward arrays */
- for (i = 0; slist->curr_level >= i; i++) {
- HDassert(slist->curr_level == i);
-
- /* Promote every third node this level until we run out of nodes */
- node = last_node = slist->header;
- while (1) {
- /* Check second node in gap, if not present, no need to promote
- * further this level. */
- HDassert(node->forward[i]);
- node = node->forward[i]->forward[i];
- if (!node)
- break;
-
- /* Check third and fourth node in gap, if either is not present,
- * no need to promote further this level. */
- node = node->forward[i];
- if (!node || !node->forward[i])
- break;
-
- /* Promote the third node in the gap */
- H5SL_PROMOTE(slist, node, last_node, FAIL)
- last_node = node;
- } /* end while */
- } /* end for */
- } /* end if */
- else {
- HDassert(!slist->header->forward[0]);
- HDassert(slist->last == slist->header);
- HDassert(slist->nobjs == 0);
-
- /* Reset the skiplist level */
- slist->curr_level = -1;
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SL_try_free_safe() */
-
-/*--------------------------------------------------------------------------
- NAME
H5SL_destroy
PURPOSE
Close a skip list, deallocating it and freeing all its nodes.
diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h
index c9e1147..be6f7b6 100644
--- a/src/H5SLprivate.h
+++ b/src/H5SLprivate.h
@@ -60,9 +60,6 @@ typedef int (*H5SL_cmp_t)(const void *key1, const void *key2);
/* Typedef for iteration operations */
typedef herr_t (*H5SL_operator_t)(void *item, void *key, void *operator_data /*in,out*/);
-/* Typedef for H5SL_try_free_safe operation callback */
-typedef htri_t (*H5SL_try_free_op_t)(void *item, void *key, void *operator_data /*in,out*/);
-
/********************/
/* Private routines */
/********************/
@@ -86,7 +83,6 @@ H5_DLL void * H5SL_item(H5SL_node_t *slist_node);
H5_DLL herr_t H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL herr_t H5SL_release(H5SL_t *slist);
H5_DLL herr_t H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data);
-H5_DLL herr_t H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data);
H5_DLL herr_t H5SL_close(H5SL_t *slist);
H5_DLL herr_t H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL int H5SL_term_interface(void);
diff --git a/src/H5T.c b/src/H5T.c
index 19a3d39..461e6b9 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -423,31 +423,29 @@ hid_t H5T_C_S1_g = FAIL;
hid_t H5T_FORTRAN_S1_g = FAIL;
-hid_t H5T_NATIVE_SCHAR_g = FAIL;
-hid_t H5T_NATIVE_UCHAR_g = FAIL;
-hid_t H5T_NATIVE_SHORT_g = FAIL;
-hid_t H5T_NATIVE_USHORT_g = FAIL;
-hid_t H5T_NATIVE_INT_g = FAIL;
-hid_t H5T_NATIVE_UINT_g = FAIL;
-hid_t H5T_NATIVE_LONG_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
-hid_t H5T_NATIVE_LLONG_g = FAIL;
-hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_FLOAT_g = FAIL;
-hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+hid_t H5T_NATIVE_SCHAR_g = FAIL;
+hid_t H5T_NATIVE_UCHAR_g = FAIL;
+hid_t H5T_NATIVE_SHORT_g = FAIL;
+hid_t H5T_NATIVE_USHORT_g = FAIL;
+hid_t H5T_NATIVE_INT_g = FAIL;
+hid_t H5T_NATIVE_UINT_g = FAIL;
+hid_t H5T_NATIVE_LONG_g = FAIL;
+hid_t H5T_NATIVE_ULONG_g = FAIL;
+hid_t H5T_NATIVE_LLONG_g = FAIL;
+hid_t H5T_NATIVE_ULLONG_g = FAIL;
+hid_t H5T_NATIVE_FLOAT_g = FAIL;
+hid_t H5T_NATIVE_DOUBLE_g = FAIL;
hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
-#endif
-hid_t H5T_NATIVE_B8_g = FAIL;
-hid_t H5T_NATIVE_B16_g = FAIL;
-hid_t H5T_NATIVE_B32_g = FAIL;
-hid_t H5T_NATIVE_B64_g = FAIL;
-hid_t H5T_NATIVE_OPAQUE_g = FAIL;
-hid_t H5T_NATIVE_HADDR_g = FAIL;
-hid_t H5T_NATIVE_HSIZE_g = FAIL;
-hid_t H5T_NATIVE_HSSIZE_g = FAIL;
-hid_t H5T_NATIVE_HERR_g = FAIL;
-hid_t H5T_NATIVE_HBOOL_g = FAIL;
+hid_t H5T_NATIVE_B8_g = FAIL;
+hid_t H5T_NATIVE_B16_g = FAIL;
+hid_t H5T_NATIVE_B32_g = FAIL;
+hid_t H5T_NATIVE_B64_g = FAIL;
+hid_t H5T_NATIVE_OPAQUE_g = FAIL;
+hid_t H5T_NATIVE_HADDR_g = FAIL;
+hid_t H5T_NATIVE_HSIZE_g = FAIL;
+hid_t H5T_NATIVE_HSSIZE_g = FAIL;
+hid_t H5T_NATIVE_HERR_g = FAIL;
+hid_t H5T_NATIVE_HBOOL_g = FAIL;
hid_t H5T_NATIVE_INT8_g = FAIL;
hid_t H5T_NATIVE_UINT8_g = FAIL;
@@ -483,21 +481,19 @@ hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
* datatype or C structures, which are different from the alignments for memory
* address below this group of variables.
*/
-size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 0;
-#endif
size_t H5T_POINTER_COMP_ALIGN_g = 0;
size_t H5T_HVL_COMP_ALIGN_g = 0;
@@ -509,21 +505,19 @@ size_t H5T_REF_COMP_ALIGN_g = 0;
* Alignment constraints for native types. These are initialized at run time
* in H5Tinit.c
*/
-size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
-#endif
/*
* Alignment constraints for C9x types. These are initialized at run time in
@@ -760,42 +754,40 @@ DESCRIPTION
herr_t
H5T__init_package(void)
{
- H5T_t *native_schar = NULL; /* Datatype structure for native signed char */
- H5T_t *native_uchar = NULL; /* Datatype structure for native unsigned char */
- H5T_t *native_short = NULL; /* Datatype structure for native short */
- H5T_t *native_ushort = NULL; /* Datatype structure for native unsigned short */
- H5T_t *native_int = NULL; /* Datatype structure for native int */
- H5T_t *native_uint = NULL; /* Datatype structure for native unsigned int */
- H5T_t *native_long = NULL; /* Datatype structure for native long */
- H5T_t *native_ulong = NULL; /* Datatype structure for native unsigned long */
- H5T_t *native_llong = NULL; /* Datatype structure for native long long */
- H5T_t *native_ullong = NULL; /* Datatype structure for native unsigned long long */
- H5T_t *native_float = NULL; /* Datatype structure for native float */
- H5T_t *native_double = NULL; /* Datatype structure for native double */
-#if H5_SIZEOF_LONG_DOUBLE != 0
- H5T_t *native_ldouble = NULL; /* Datatype structure for native long double */
-#endif
- H5T_t * std_u8le = NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
- H5T_t * std_u8be = NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
- H5T_t * std_u16le = NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
- H5T_t * std_u16be = NULL; /* Datatype structure for unsigned 16-bit big-endian integer */
- H5T_t * std_u32le = NULL; /* Datatype structure for unsigned 32-bit little-endian integer */
- H5T_t * std_u32be = NULL; /* Datatype structure for unsigned 32-bit big-endian integer */
- H5T_t * std_u64le = NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
- H5T_t * std_u64be = NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
- H5T_t * dt = NULL;
- H5T_t * fixedpt = NULL; /* Datatype structure for native int */
- H5T_t * floatpt = NULL; /* Datatype structure for native float */
- H5T_t * string = NULL; /* Datatype structure for C string */
- H5T_t * bitfield = NULL; /* Datatype structure for bitfield */
- H5T_t * compound = NULL; /* Datatype structure for compound objects */
- H5T_t * enum_type = NULL; /* Datatype structure for enum objects */
- H5T_t * vlen = NULL; /* Datatype structure for vlen objects */
- H5T_t * array = NULL; /* Datatype structure for array objects */
- H5T_t * objref = NULL; /* Datatype structure for deprecated reference objects */
- H5T_t * regref = NULL; /* Datatype structure for deprecated region references */
- H5T_t * ref = NULL; /* Datatype structure for opaque references */
- hsize_t dim[1] = {1}; /* Dimension info for array datatype */
+ H5T_t * native_schar = NULL; /* Datatype structure for native signed char */
+ H5T_t * native_uchar = NULL; /* Datatype structure for native unsigned char */
+ H5T_t * native_short = NULL; /* Datatype structure for native short */
+ H5T_t * native_ushort = NULL; /* Datatype structure for native unsigned short */
+ H5T_t * native_int = NULL; /* Datatype structure for native int */
+ H5T_t * native_uint = NULL; /* Datatype structure for native unsigned int */
+ H5T_t * native_long = NULL; /* Datatype structure for native long */
+ H5T_t * native_ulong = NULL; /* Datatype structure for native unsigned long */
+ H5T_t * native_llong = NULL; /* Datatype structure for native long long */
+ H5T_t * native_ullong = NULL; /* Datatype structure for native unsigned long long */
+ H5T_t * native_float = NULL; /* Datatype structure for native float */
+ H5T_t * native_double = NULL; /* Datatype structure for native double */
+ H5T_t * native_ldouble = NULL; /* Datatype structure for native long double */
+ H5T_t * std_u8le = NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
+ H5T_t * std_u8be = NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
+ H5T_t * std_u16le = NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
+ H5T_t * std_u16be = NULL; /* Datatype structure for unsigned 16-bit big-endian integer */
+ H5T_t * std_u32le = NULL; /* Datatype structure for unsigned 32-bit little-endian integer */
+ H5T_t * std_u32be = NULL; /* Datatype structure for unsigned 32-bit big-endian integer */
+ H5T_t * std_u64le = NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
+ H5T_t * std_u64be = NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
+ H5T_t * dt = NULL;
+ H5T_t * fixedpt = NULL; /* Datatype structure for native int */
+ H5T_t * floatpt = NULL; /* Datatype structure for native float */
+ H5T_t * string = NULL; /* Datatype structure for C string */
+ H5T_t * bitfield = NULL; /* Datatype structure for bitfield */
+ H5T_t * compound = NULL; /* Datatype structure for compound objects */
+ H5T_t * enum_type = NULL; /* Datatype structure for enum objects */
+ H5T_t * vlen = NULL; /* Datatype structure for vlen objects */
+ H5T_t * array = NULL; /* Datatype structure for array objects */
+ H5T_t * objref = NULL; /* Datatype structure for deprecated reference objects */
+ H5T_t * regref = NULL; /* Datatype structure for deprecated region references */
+ H5T_t * ref = NULL; /* Datatype structure for opaque references */
+ hsize_t dim[1] = {1}; /* Dimension info for array datatype */
herr_t status;
hbool_t copied_dtype =
TRUE; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
@@ -843,10 +835,8 @@ H5T__init_package(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
-#if H5_SIZEOF_LONG_DOUBLE != 0
if (NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
-#endif
/*------------------------------------------------------------
* Derived native types
@@ -1116,7 +1106,6 @@ H5T__init_package(void)
H5T__register_int(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double);
status |=
H5T__register_int(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float);
-#if H5_SIZEOF_LONG_DOUBLE != 0
status |=
H5T__register_int(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble);
status |=
@@ -1125,7 +1114,6 @@ H5T__init_package(void)
H5T__register_int(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double);
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/* from long long */
status |=
@@ -1663,31 +1651,29 @@ H5T_top_term_package(void)
H5T_FORTRAN_S1_g = FAIL;
- H5T_NATIVE_SCHAR_g = FAIL;
- H5T_NATIVE_UCHAR_g = FAIL;
- H5T_NATIVE_SHORT_g = FAIL;
- H5T_NATIVE_USHORT_g = FAIL;
- H5T_NATIVE_INT_g = FAIL;
- H5T_NATIVE_UINT_g = FAIL;
- H5T_NATIVE_LONG_g = FAIL;
- H5T_NATIVE_ULONG_g = FAIL;
- H5T_NATIVE_LLONG_g = FAIL;
- H5T_NATIVE_ULLONG_g = FAIL;
- H5T_NATIVE_FLOAT_g = FAIL;
- H5T_NATIVE_DOUBLE_g = FAIL;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+ H5T_NATIVE_SCHAR_g = FAIL;
+ H5T_NATIVE_UCHAR_g = FAIL;
+ H5T_NATIVE_SHORT_g = FAIL;
+ H5T_NATIVE_USHORT_g = FAIL;
+ H5T_NATIVE_INT_g = FAIL;
+ H5T_NATIVE_UINT_g = FAIL;
+ H5T_NATIVE_LONG_g = FAIL;
+ H5T_NATIVE_ULONG_g = FAIL;
+ H5T_NATIVE_LLONG_g = FAIL;
+ H5T_NATIVE_ULLONG_g = FAIL;
+ H5T_NATIVE_FLOAT_g = FAIL;
+ H5T_NATIVE_DOUBLE_g = FAIL;
H5T_NATIVE_LDOUBLE_g = FAIL;
-#endif
- H5T_NATIVE_B8_g = FAIL;
- H5T_NATIVE_B16_g = FAIL;
- H5T_NATIVE_B32_g = FAIL;
- H5T_NATIVE_B64_g = FAIL;
- H5T_NATIVE_OPAQUE_g = FAIL;
- H5T_NATIVE_HADDR_g = FAIL;
- H5T_NATIVE_HSIZE_g = FAIL;
- H5T_NATIVE_HSSIZE_g = FAIL;
- H5T_NATIVE_HERR_g = FAIL;
- H5T_NATIVE_HBOOL_g = FAIL;
+ H5T_NATIVE_B8_g = FAIL;
+ H5T_NATIVE_B16_g = FAIL;
+ H5T_NATIVE_B32_g = FAIL;
+ H5T_NATIVE_B64_g = FAIL;
+ H5T_NATIVE_OPAQUE_g = FAIL;
+ H5T_NATIVE_HADDR_g = FAIL;
+ H5T_NATIVE_HSIZE_g = FAIL;
+ H5T_NATIVE_HSSIZE_g = FAIL;
+ H5T_NATIVE_HERR_g = FAIL;
+ H5T_NATIVE_HBOOL_g = FAIL;
H5T_NATIVE_INT8_g = FAIL;
H5T_NATIVE_UINT8_g = FAIL;
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 18cbcf1..c06c895 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -7009,14 +7009,12 @@ H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_double_float
@@ -7051,14 +7049,12 @@ H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_ldouble_float
@@ -7073,14 +7069,12 @@ H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_ldouble_double
@@ -7095,14 +7089,12 @@ H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_schar_float
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 2688b23..c9a2907 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -718,9 +718,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
enum match_type { /* The different kinds of floating point types we can match */
H5T_NATIVE_FLOAT_MATCH_FLOAT,
H5T_NATIVE_FLOAT_MATCH_DOUBLE,
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5T_NATIVE_FLOAT_MATCH_LDOUBLE,
-#endif
H5T_NATIVE_FLOAT_MATCH_UNKNOWN
} match = H5T_NATIVE_FLOAT_MATCH_UNKNOWN;
H5T_t *ret_value = NULL; /* Return value */
@@ -738,24 +736,16 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
native_size = sizeof(double);
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (size <= sizeof(long double)) {
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
}
-#endif
else { /* If not match, return the biggest datatype */
-#if H5_SIZEOF_LONG_DOUBLE != 0
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
-#else
- match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
-#endif
}
}
else {
-#if H5_SIZEOF_LONG_DOUBLE != 0
if (size > sizeof(double)) {
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
@@ -768,16 +758,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
}
-#else
- if (size > sizeof(float)) {
- match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- }
- else {
- match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
- }
-#endif
}
/* Set the appropriate native floating point information */
@@ -792,12 +772,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
align = H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
break;
-#if H5_SIZEOF_LONG_DOUBLE != 0
case H5T_NATIVE_FLOAT_MATCH_LDOUBLE:
tid = H5T_NATIVE_LDOUBLE;
align = H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
break;
-#endif
+
case H5T_NATIVE_FLOAT_MATCH_UNKNOWN:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match")
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 51ecaca..19593dd 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -401,9 +401,7 @@ H5_DLLVAR size_t H5T_NATIVE_LONG_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_LLONG_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
-#endif
H5_DLLVAR size_t H5T_POINTER_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_HVL_COMP_ALIGN_g;
@@ -429,9 +427,7 @@ H5_DLLVAR size_t H5T_NATIVE_LLONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_ULLONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_FLOAT_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_ALIGN_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_ALIGN_g;
-#endif
/* C9x alignment constraints */
H5_DLLVAR size_t H5T_NATIVE_INT8_ALIGN_g;
@@ -468,10 +464,8 @@ H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g;
H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR double H5T_NATIVE_LDOUBLE_POS_INF_g;
H5_DLLVAR double H5T_NATIVE_LDOUBLE_NEG_INF_g;
-#endif
/* Declare extern the free lists for H5T_t's and H5T_shared_t's */
H5FL_EXTERN(H5T_t);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index bb5b0ef..911efdf 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -803,13 +803,11 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
* C-style \Code{double}
*/
#define H5T_NATIVE_DOUBLE (H5OPEN H5T_NATIVE_DOUBLE_g)
-#if H5_SIZEOF_LONG_DOUBLE != 0
/**
* \ingroup PDTNAT
* C-style \Code{long double}
*/
#define H5T_NATIVE_LDOUBLE (H5OPEN H5T_NATIVE_LDOUBLE_g)
-#endif
/**
* \ingroup PDTNAT
* HDF5 8-bit bitfield based on native types
@@ -872,9 +870,7 @@ H5_DLLVAR hid_t H5T_NATIVE_LLONG_g;
H5_DLLVAR hid_t H5T_NATIVE_ULLONG_g;
H5_DLLVAR hid_t H5T_NATIVE_FLOAT_g;
H5_DLLVAR hid_t H5T_NATIVE_DOUBLE_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR hid_t H5T_NATIVE_LDOUBLE_g;
-#endif
H5_DLLVAR hid_t H5T_NATIVE_B8_g;
H5_DLLVAR hid_t H5T_NATIVE_B16_g;
H5_DLLVAR hid_t H5T_NATIVE_B32_g;
diff --git a/src/H5Tref.c b/src/H5Tref.c
index cac8cf6..511c531 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -309,8 +309,8 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get encode size")
/* Size on disk, memory size is different */
- dt->shared->size = MAX(H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE + cont_info.blob_id_size,
- ref_encode_size);
+ dt->shared->size =
+ MAX(sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE + cont_info.blob_id_size, ref_encode_size);
dt->shared->u.atomic.prec = 8 * dt->shared->size;
/* Set up the function pointers to access the information on
@@ -778,7 +778,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t
H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
/* Skip the size / header */
- p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T;
+ p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t);
/* Set up VOL callback arguments */
vol_cb_args.op_type = H5VL_BLOB_ISNULL;
@@ -819,7 +819,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
/* TODO Should get rid of bg stuff */
if (p_bg) {
/* Skip the size / header */
- p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ p_bg += (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
/* Set up VOL callback arguments */
vol_cb_args.op_type = H5VL_BLOB_DELETE;
@@ -929,8 +929,8 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_
blob_size -= H5R_ENCODE_HEADER_SIZE;
/* Skip the size */
- p += H5_SIZEOF_UINT32_T;
- HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T));
+ p += sizeof(uint32_t);
+ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t)));
/* Retrieve blob */
if (H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0)
@@ -974,9 +974,9 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
size_t p_buf_size_left = dst_size;
/* Skip the size / header */
- p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
- HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE));
- p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ p_bg += (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
+ HDassert(p_buf_size_left > (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE));
+ p_buf_size_left -= (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
/* Set up VOL callback arguments */
vol_cb_args.op_type = H5VL_BLOB_DELETE;
@@ -991,12 +991,12 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
src_size -= H5R_ENCODE_HEADER_SIZE;
- buf_size_left -= H5_SIZEOF_UINT32_T;
+ buf_size_left -= sizeof(uint32_t);
/* Set the size */
UINT32ENCODE(q, src_size);
- HDassert(buf_size_left > H5_SIZEOF_UINT32_T);
- buf_size_left -= H5_SIZEOF_UINT32_T;
+ HDassert(buf_size_left > sizeof(uint32_t));
+ buf_size_left -= sizeof(uint32_t);
/* Store blob */
if (H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0)
diff --git a/src/H5VL.c b/src/H5VL.c
index 2cece6d..8c3277c 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -655,6 +655,39 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5VLobject() */
+/*---------------------------------------------------------------------------
+ * Function: H5VLobject_is_native
+ *
+ * Purpose: Determines whether an object ID represents a native VOL
+ * connector object.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_is_native(hid_t obj_id, hbool_t *is_native)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", obj_id, is_native);
+
+ if (!is_native)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`is_native` argument is NULL")
+
+ /* Get the location object for the ID */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ if (H5VL_object_is_native(vol_obj, is_native) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if object is a native connector object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLobject_is_native() */
+
/*-------------------------------------------------------------------------
* Function: H5VLget_file_type
*
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index 78e39e3..543c3c8 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -356,6 +356,19 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
* \since 1.12.0
*/
H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags);
+/**
+ * \ingroup H5VL
+ * \brief Determines whether an object ID represents a native
+ * VOL connector object.
+ *
+ * \param[in] obj_id Object identifier
+ * \param[in] is_native Boolean determining whether object is a native
+ * VOL connector object
+ * \return \herr_t
+ *
+ * \since 1.13.0
+ */
+H5_DLL herr_t H5VLobject_is_native(hid_t obj_id, hbool_t *is_native);
#ifdef __cplusplus
}
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index a8a63bf..48a29cd 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
{ \
i = 0; \
- while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
+ while (i < d_nelmts && HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \
i++; \
if (i < d_nelmts) \
min = max = buf[i]; \
for (; i < d_nelmts; i++) { \
- if (HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
+ if (HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \
continue; /* ignore fill value */ \
if (buf[i] > max) \
max = buf[i]; \
@@ -425,22 +425,22 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \
{ \
if (sizeof(type) == sizeof(int)) { \
- if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
- pow_fun(2.0F, (type)(sizeof(int) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(int) * 8 - 1))) { \
*minbits = sizeof(int) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long)) { \
- if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
- pow_fun(2.0F, (type)(sizeof(long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(long) * 8 - 1))) { \
*minbits = sizeof(long) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long long)) { \
- if (round_fun(max * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)) > \
- pow_fun(2.0F, (type)(sizeof(long long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(long long) * 8 - 1))) { \
*minbits = sizeof(long long) * 8; \
goto done; \
} \
@@ -530,27 +530,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(int *)((void *)&buf[i]) = (int)(((unsigned int)1 << *minbits) - 1); \
else \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(long *)((void *)&buf[i]) = (long)(((unsigned long)1 << *minbits) - 1); \
else \
- *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)); \
+ *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0F, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(long long *)((void *)&buf[i]) = (long long)(((unsigned long long)1 << *minbits) - 1); \
else \
- *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)); \
+ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
@@ -561,16 +561,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
- *(long *)((void *)&buf[i]) = \
- lround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)); \
+ *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
- *(long long *)((void *)&buf[i]) = \
- llround_fun(buf[i] * pow_fun(10.0F, (type)D_val) - min * pow_fun(10.0F, (type)D_val)); \
+ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -606,8 +606,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \
H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)) + \
+ (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)) + \
1); \
*minbits = H5Z__scaleoffset_log2(span + 1); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -617,8 +617,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
else { /* fill value undefined */ \
H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0F, (type)D_val) - \
- min * pow_fun(10.0F, (type)D_val)) + \
+ (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)) + \
1); \
*minbits = H5Z__scaleoffset_log2(span); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -685,19 +685,19 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
buf[i] = \
(type)((*(int *)((void *)&buf[i]) == (int)(((unsigned int)1 << minbits) - 1)) \
? filval \
- : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ : (type)(*(int *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = \
(type)((*(long *)((void *)&buf[i]) == (long)(((unsigned long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ : (type)(*(long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = (type)( \
(*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ : (type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -707,13 +707,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0F, (type)D_val) + min); \
+ buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index ab7e9be..ea532cf 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -150,7 +150,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation") \
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
#if CHAR_MIN >= 0
#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
{ \
@@ -212,65 +211,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree);
H5Z_XFORM_DO_OP1((RESL), (RESR), long double, OP, (SIZE)) \
}
#endif /* CHAR_MIN >= 0 */
-#else
-#if CHAR_MIN >= 0
-#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
- { \
- if ((TYPE) == H5T_NATIVE_CHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SCHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), signed char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_USHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_INT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UINT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_FLOAT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_DOUBLE) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \
- }
-#else /* CHAR_MIN >= 0 */
-#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
- { \
- if ((TYPE) == H5T_NATIVE_CHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UCHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_USHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_INT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UINT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_FLOAT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_DOUBLE) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \
- }
-#endif /* CHAR_MIN >= 0 */
-#endif /*H5_SIZEOF_LONG_DOUBLE */
#define H5Z_XFORM_DO_OP3(OP) \
{ \
@@ -1056,10 +996,8 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size
H5Z_XFORM_DO_OP5(float, array_size)
else if (array_type == H5T_NATIVE_DOUBLE)
H5Z_XFORM_DO_OP5(double, array_size)
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (array_type == H5T_NATIVE_LDOUBLE)
H5Z_XFORM_DO_OP5(long double, array_size)
-#endif
} /* end if */
/* Otherwise, do the full data transform */
@@ -1267,11 +1205,9 @@ H5Z__xform_find_type(const H5T_t *type)
/* Check for DOUBLE type */
else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_DOUBLE)
-#if H5_SIZEOF_LONG_DOUBLE != 0
/* Check for LONGDOUBLE type */
else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
-#endif
else
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type")
diff --git a/src/H5detect.c b/src/H5detect.c
index e8cded7..022cb55 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -1412,7 +1412,7 @@ detect_C99_floats(void)
*/
DETECT_F(double, LDOUBLE, d_g[nd_g]);
nd_g++;
-#elif H5_SIZEOF_LONG_DOUBLE != 0
+#else
DETECT_F(long double, LDOUBLE, d_g[nd_g]);
nd_g++;
#endif
diff --git a/src/H5private.h b/src/H5private.h
index 7c76483..761ad17 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -259,10 +259,10 @@
#define H5_ATTR_NORETURN __attribute__((noreturn))
#define H5_ATTR_CONST __attribute__((const))
#define H5_ATTR_PURE __attribute__((pure))
-#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
+#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
-#define H5_ATTR_FALLTHROUGH /*void*/
+#define H5_ATTR_FALLTHROUGH /* FALLTHROUGH */
#endif
#else
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
diff --git a/src/H5public.h b/src/H5public.h
index 65709c6..163deed 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -83,15 +83,15 @@
/**
* For tweaks, bug-fixes, or development
*/
-#define H5_VERS_RELEASE 0
+#define H5_VERS_RELEASE 1
/**
* For pre-releases like \c snap0. Empty string for official releases.
*/
-#define H5_VERS_SUBRELEASE ""
+#define H5_VERS_SUBRELEASE "1"
/**
* Full version string
*/
-#define H5_VERS_INFO "HDF5 library version: 1.13.0"
+#define H5_VERS_INFO "HDF5 library version: 1.13.1-1"
#define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE)
diff --git a/src/H5trace.c b/src/H5trace.c
index 3a5d420..8daa17d 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1563,10 +1563,8 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5T_NATIVE_FLOAT");
else if (obj == H5T_NATIVE_DOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (obj == H5T_NATIVE_LDOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_LDOUBLE");
-#endif
else if (obj == H5T_IEEE_F32BE_g)
H5RS_acat(rs, "H5T_IEEE_F32BE");
else if (obj == H5T_IEEE_F32LE_g)
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 44c1540..7fe1a36 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -67,28 +67,29 @@ Languages:
Features:
---------
- Parallel HDF5: @PARALLEL@
-Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
- Large Parallel I/O: @LARGE_PARALLEL_IO@
- High-level library: @HDF5_HL@
- Build HDF5 Tests: @HDF5_TESTS@
- Build HDF5 Tools: @HDF5_TOOLS@
- Threadsafety: @THREADSAFE@
- Default API mapping: @DEFAULT_API_VERSION@
- With deprecated public symbols: @DEPRECATED_SYMBOLS@
- I/O filters (external): @EXTERNAL_FILTERS@
- MPE: @MPE@
- Map (H5M) API: @MAP_API@
- Direct VFD: @DIRECT_VFD@
- Mirror VFD: @MIRROR_VFD@
- (Read-Only) S3 VFD: @ROS3_VFD@
- (Read-Only) HDFS VFD: @HAVE_LIBHDFS@
- dmalloc: @HAVE_DMALLOC@
- Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
- API tracing: @TRACE_API@
- Using memory checker: @USINGMEMCHECKER@
- Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
- Function stack tracing: @CODESTACK@
- Use file locking: @DESIRED_FILE_LOCKING@
- Strict file format checks: @STRICT_FORMAT_CHECKS@
- Optimization instrumentation: @INSTRUMENT_LIBRARY@
+ Parallel HDF5: @PARALLEL@
+ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
+ Large Parallel I/O: @LARGE_PARALLEL_IO@
+ High-level library: @HDF5_HL@
+Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@
+ Build HDF5 Tests: @HDF5_TESTS@
+ Build HDF5 Tools: @HDF5_TOOLS@
+ Threadsafety: @THREADSAFE@
+ Default API mapping: @DEFAULT_API_VERSION@
+ With deprecated public symbols: @DEPRECATED_SYMBOLS@
+ I/O filters (external): @EXTERNAL_FILTERS@
+ MPE: @MPE@
+ Map (H5M) API: @MAP_API@
+ Direct VFD: @DIRECT_VFD@
+ Mirror VFD: @MIRROR_VFD@
+ (Read-Only) S3 VFD: @ROS3_VFD@
+ (Read-Only) HDFS VFD: @HAVE_LIBHDFS@
+ dmalloc: @HAVE_DMALLOC@
+ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
+ API tracing: @TRACE_API@
+ Using memory checker: @USINGMEMCHECKER@
+ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
+ Function stack tracing: @CODESTACK@
+ Use file locking: @DESIRED_FILE_LOCKING@
+ Strict file format checks: @STRICT_FORMAT_CHECKS@
+ Optimization instrumentation: @INSTRUMENT_LIBRARY@
diff --git a/src/uthash.h b/src/uthash.h
index 8bdca55..ea99839 100644
--- a/src/uthash.h
+++ b/src/uthash.h
@@ -714,25 +714,35 @@ typedef unsigned char uint8_t;
hashv += (unsigned)(keylen); \
switch (_hj_k) { \
case 11: \
- hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[10] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 10: \
- hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[9] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 9: \
- hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[8] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 8: \
- _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[7] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 7: \
- _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[6] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 6: \
- _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[5] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 5: \
- _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
+ _hj_j += _hj_key[4]; \
+ H5_ATTR_FALLTHROUGH \
case 4: \
- _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[3] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 3: \
- _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[2] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 2: \
- _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[1] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 1: \
_hj_i += _hj_key[0]; \
} \