diff options
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 21 |
1 files changed, 12 insertions, 9 deletions
@@ -45,6 +45,7 @@ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5Tpkg.h" /* Datatypes */ +#include "H5VLprivate.h" /* Virtual Object Layer */ /* Check for header needed for SGI floating-point code */ #ifdef H5_HAVE_SYS_FPU_H @@ -292,8 +293,6 @@ static herr_t H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, static herr_t H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, H5T_conv_t func, hid_t dxpl_id, hbool_t api_call); static htri_t H5T_compiler_conv(H5T_t *src, H5T_t *dst); -static herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc); -static H5T_t *H5T_decode(const unsigned char *buf); static herr_t H5T_set_size(H5T_t *dt, size_t size); @@ -532,7 +531,8 @@ static const H5I_class_t H5I_DATATYPE_CLS[1] = {{ 0, /* Class flags */ 64, /* Minimum hash size for class */ 8, /* # of reserved IDs for class */ - (H5I_free_t)H5T_close /* Callback routine for closing objects of this class */ + (H5I_free_t)H5T_close, /* Callback routine for closing objects of this class */ + (H5I_free2_t)H5T_close_datatype /* Callback routine for closing auxilary objects of this class */ }}; @@ -1756,13 +1756,13 @@ H5Tclose(hid_t type_id) /* Check args */ if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") if(H5T_STATE_IMMUTABLE == dt->shared->state) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "immutable datatype") /* When the reference count reaches zero the resources are freed */ if(H5I_dec_app_ref(type_id) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "problem freeing id") done: FUNC_LEAVE_API(ret_value) @@ -2897,7 +2897,7 @@ done: * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) { size_t buf_size; /* Encoded size of datatype */ @@ -2954,7 +2954,7 @@ done: * *------------------------------------------------------------------------- */ -static H5T_t * +H5T_t * H5T_decode(const unsigned char *buf) { H5F_t *f = NULL; /* Fake file structure*/ @@ -2982,6 +2982,7 @@ H5T_decode(const unsigned char *buf) if(H5T_set_loc(ret_value, NULL, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") + ret_value->vol_obj = NULL; done: /* Release fake file structure */ if(f && H5F_fake_free(f) < 0) @@ -3103,6 +3104,7 @@ H5T__create(H5T_class_t type, size_t size) if(H5T_STRING != type || H5T_VARIABLE != size) dt->shared->size = size; + dt->vol_obj = NULL; /* Set return value */ ret_value = dt; @@ -3176,7 +3178,7 @@ H5T_copy(H5T_t *old_dt, H5T_copy_t method) /* Copy shared information (entry information is copied last) */ *(new_dt->shared) = *(old_dt->shared); - + new_dt->vol_obj = NULL; /* Check what sort of copy we are making */ switch (method) { case H5T_COPY_TRANSIENT: @@ -3487,6 +3489,7 @@ H5T__alloc(void) if(NULL == (dt->shared = H5FL_CALLOC(H5T_shared_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") dt->shared->version = H5O_DTYPE_VERSION_1; + dt->vol_obj = NULL; /* Assign return value */ ret_value = dt; |