summaryrefslogtreecommitdiffstats
path: root/src/H5Tnative.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Tnative.c')
-rw-r--r--src/H5Tnative.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index f83e9c3..0e7d395 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -332,7 +332,6 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
case H5T_ENUM: {
H5T_path_t *tpath; /* Type conversion info */
- hid_t super_type_id, nat_super_type_id;
/* Don't need to do anything special for alignment, offset since the ENUM type usually is integer.
*/
@@ -344,11 +343,6 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
H5T__get_native_type(super_type, direction, struct_align, offset, comp_size)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "base native type retrieval failed");
- if ((super_type_id = H5I_register(H5I_DATATYPE, super_type, false)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype");
- if ((nat_super_type_id = H5I_register(H5I_DATATYPE, nat_super_type, false)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot register datatype");
-
/* Allocate room for the enum values */
if (NULL == (tmp_memb_value = H5MM_calloc(H5T_get_size(super_type))))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot allocate memory");
@@ -375,7 +369,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value");
H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type));
- if (H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0,
+ if (H5T_convert(tpath, super_type, nat_super_type, (size_t)1, (size_t)0, (size_t)0,
memb_value, NULL) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value");
@@ -386,12 +380,10 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali
memb_value = H5MM_xfree(memb_value);
tmp_memb_value = H5MM_xfree(tmp_memb_value);
- /* Close base type */
- if (H5I_dec_app_ref(nat_super_type_id) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
- /* Close super type */
- if (H5I_dec_app_ref(super_type_id) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot close datatype");
+ if (H5T_close(nat_super_type) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "can't close datatype");
+ if (H5T_close(super_type) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, NULL, "can't close datatype");
ret_value = new_type;
} /* end case */