summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_dataset.c
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2024-03-10 07:47:31 (GMT)
committerGitHub <noreply@github.com>2024-03-10 07:47:31 (GMT)
commitef401a5f5edf2fc689334a485a6c2ec3f53ecb85 (patch)
tree4807deea31bdb83a5f3903f9dc3fddd48a1e0785 /src/H5VLnative_dataset.c
parent28aaeb967ce66477441dc1f92fc45dddb51255c2 (diff)
downloadhdf5-ef401a5f5edf2fc689334a485a6c2ec3f53ecb85.zip
hdf5-ef401a5f5edf2fc689334a485a6c2ec3f53ecb85.tar.gz
hdf5-ef401a5f5edf2fc689334a485a6c2ec3f53ecb85.tar.bz2
Refactor datatype conversion code to use pointers rather than IDs (#4104)
The datatype conversion code previously used IDs for the source and destination datatypes rather than pointers to the internal structures for those datatypes. This was mostly due to the need for an ID for these datatypes that can be passed to an application-registered datatype conversion function or datatype conversion exception function. However, using IDs internally caused a lot of unnecessary ID lookups and hurt performance of datatype conversions in general. This was especially problematic for compound datatype conversions, where the ID lookups were occuring on every member of every compound element of a dataset. The code has now been refactored to use pointers internally and only create IDs for datatypes when necessary. Fixed a test issue in dt_arith where a library datatype conversion function was being cast to an application conversion function. Since the two have different prototypes, this started failing after the parameters for a library conversion function changed from hid_t to H5T_t * and an extra parameter was added. This appears to have worked coincidentally in the past since the only different between a library conversion function and application conversion function was an extra DXPL parameter at the end of an application conversion function Fixed an issue where memory wasn't being freed in the h5fc_chk_idx test program. Even though the program exits quickly after allocating the memory, it still causes failures when testing with -fsanitize=address
Diffstat (limited to 'src/H5VLnative_dataset.c')
-rw-r--r--src/H5VLnative_dataset.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index a58eb51..a4f7cae 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -119,7 +119,8 @@ H5VL__native_dataset_io_setup(size_t count, void *obj[], hid_t mem_type_id[], hi
"different files detected in multi dataset I/O request");
/* Set up memory type */
- dinfo[i].mem_type_id = mem_type_id[i];
+ if (NULL == (dinfo[i].mem_type = (H5T_t *)H5I_object_verify(mem_type_id[i], H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "invalid datatype");
/* Set up file dataspace */
if (H5S_ALL == file_space_id[i])