summaryrefslogtreecommitdiffstats
path: root/hl/src/H5LT.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2021-11-05 12:33:02 (GMT)
committerGitHub <noreply@github.com>2021-11-05 12:33:02 (GMT)
commit93ac9b0aeb9261165eb7d7fe685188515ba6c12f (patch)
tree427fcd00538881e9e4ef3c3db7284f3050900c08 /hl/src/H5LT.c
parent55ee1fd6558e469e84b4cfb74c8abedc2f231b55 (diff)
downloadhdf5-93ac9b0aeb9261165eb7d7fe685188515ba6c12f.zip
hdf5-93ac9b0aeb9261165eb7d7fe685188515ba6c12f.tar.gz
hdf5-93ac9b0aeb9261165eb7d7fe685188515ba6c12f.tar.bz2
New references for Dimension Scale APIs (#1139)
* Enable usage of new-style references with dimension scale APIs * Add API to check if an object ID represents a native connector object * Modified code to use new function H5DSwith_new_ref to determine if new references should be used with Dimension Scales. The new function return TRUE if non-native connector is used or if H5_DIMENSION_SCALES_WITH_NEW_REF varible is define at configure time (--enable-dimension-scales-with-new-ref). Tested on jelly. ToDo: generate testing file on BE system and enable the test; add flag to CMake; test netCDF-4 with the new references. * Adding new test files generated on BE system (hedgehog) created by 32 and 64-bit library. test_ds chokes on test_ds_le_new_ref.h5 on BE system; test passes for test_ds_be_new_ref-32bit.h5 for the 32-bit library and fails for the 64-bit library, and vice versa. I am checking the files for further investigation; but current implementation of the new references is not portable between LE and BE systems, and 32 and 64-bit systems. * Minor fixes for testing issues * Update test_ds.c Enabled broken test; tests pass now. * Update RELEASE.txt Documented new option to use new references with the HDF5 dimension scales APIs (H5DS*). * Update MANIFEST for new 32-bit new-style references test file for H5DS APIs * Update 'dimension scales w/ new-style refs' feature based on review Co-authored-by: Elena <epourmal@hdfgroup.org>
Diffstat (limited to 'hl/src/H5LT.c')
-rw-r--r--hl/src/H5LT.c62
1 files changed, 6 insertions, 56 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index 8f2b33f..58a1b16 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -1856,46 +1856,6 @@ H5LTset_attribute_double(hid_t loc_id, const char *obj_name, const char *attr_na
}
/*-------------------------------------------------------------------------
- * Function: find_attr
- *
- * Purpose: operator function used by H5LT_find_attribute
- *
- * Programmer: Pedro Vicente
- *
- * Date: June 21, 2001
- *
- * Comments:
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-find_attr(H5_ATTR_UNUSED hid_t loc_id, const char *name, H5_ATTR_UNUSED const H5A_info_t *ainfo,
- void *op_data)
-{
- int ret = H5_ITER_CONT;
-
- /* check the arguments */
- if (name == NULL)
- return H5_ITER_CONT;
-
- /* Shut compiler up */
- (void)loc_id;
- (void)ainfo;
-
- /* Define a positive value for return value if the attribute was found. This will
- * cause the iterator to immediately return that positive value,
- * indicating short-circuit success
- */
-
- if (HDstrncmp(name, (char *)op_data, MAX(HDstrlen((char *)op_data), HDstrlen(name))) == 0)
- ret = H5_ITER_STOP;
-
- return ret;
-}
-
-/*-------------------------------------------------------------------------
* Function: H5LTfind_attribute
*
* Purpose: Inquires if an attribute named attr_name exists attached to
@@ -1926,32 +1886,22 @@ H5LTfind_attribute(hid_t loc_id, const char *attr_name)
*
* Date: June 21, 2001
*
- * Comments:
- * The function uses H5Aiterate2 with the operator function find_attr
- *
* Return:
- * Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * Success: Positive if the attribute exists attached to the
+ * object loc_id. Zero if the attribute does not
+ * exist attached to the object loc_id.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library.
*
*-------------------------------------------------------------------------
*/
-/* H5Aiterate wants a non-const pointer but we have a const pointer in the API
- * call. It's safe to ignore this because we control the callback, don't
- * modify the op_data buffer (i.e.: attr_name) during the traversal, and the
- * library never modifies that buffer.
- */
-H5_GCC_CLANG_DIAG_OFF("cast-qual")
herr_t
H5LT_find_attribute(hid_t loc_id, const char *attr_name)
{
- return H5Aiterate2(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, find_attr, (void *)attr_name);
+ htri_t attr_exists = H5Aexists(loc_id, attr_name);
+ return (attr_exists < 0) ? (herr_t)-1 : (attr_exists) ? (herr_t)1 : (herr_t)0;
}
-H5_GCC_CLANG_DIAG_ON("cast-qual")
/*-------------------------------------------------------------------------
* Function: H5LTget_attribute_ndims