diff options
-rw-r--r-- | src/H5.c | 3 | ||||
-rw-r--r-- | src/H5A.c | 52 | ||||
-rw-r--r-- | src/H5D.c | 76 | ||||
-rw-r--r-- | src/H5Dio.c | 11 | ||||
-rw-r--r-- | src/H5Doh.c | 3 | ||||
-rw-r--r-- | src/H5G.c | 7 | ||||
-rw-r--r-- | src/H5Tcommit.c | 20 |
7 files changed, 75 insertions, 97 deletions
@@ -294,9 +294,8 @@ H5_term_library(void) if(pending == 0) pending += DOWN(SL); /* Don't shut down the free list code until _everything_ else is down */ - if(pending == 0) { + if(pending == 0) pending += DOWN(FL); - } } } while(pending && ntries++ < 100); @@ -36,8 +36,8 @@ #include "H5Opkg.h" /* Object headers */ #include "H5Sprivate.h" /* Dataspace functions */ #include "H5SMprivate.h" /* Shared Object Header Messages */ -#include "H5VLprivate.h" /* VOL plugins */ #include "H5VLnative.h" /* VOL native plugin */ +#include "H5VLprivate.h" /* VOL plugins */ /****************/ /* Local Macros */ @@ -635,15 +635,14 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* write the data through the VOL */ if((ret_value = H5VL_attr_write(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) @@ -681,15 +680,14 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) H5TRACE3("e", "ii*x", attr_id, dtype_id, buf); /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* Read the data through the VOL */ if((ret_value = H5VL_attr_read(attr, vol_plugin, dtype_id, buf, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) @@ -726,12 +724,13 @@ H5Aget_space(hid_t attr_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", attr_id); + /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* get the dataspace through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_SPACE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -768,12 +767,13 @@ H5Aget_type(hid_t attr_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", attr_id); + /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* get the datatype through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_TYPE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -815,12 +815,13 @@ H5Aget_create_plist(hid_t attr_id) HDassert(H5P_LST_ATTRIBUTE_CREATE_ID_g != -1); + /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* get the acpl through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_ACPL, H5AC_dxpl_id, @@ -865,6 +866,8 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) H5TRACE3("Zs", "iz*s", attr_id, buf_size, buf); /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") if(!buf && buf_size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid buffer") @@ -874,9 +877,6 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf) /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") /* get the name through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_NAME, H5AC_dxpl_id, H5_EVENT_STACK_NULL, loc_params, buf_size, buf, &ret_value) < 0) @@ -995,12 +995,13 @@ H5Aget_storage_size(hid_t attr_id) FUNC_ENTER_API(0) H5TRACE1("h", "i", attr_id); + /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid attribute identifier") /* get the storage size through the VOL */ if(H5VL_attr_get(attr, vol_plugin, H5VL_ATTR_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -1035,12 +1036,13 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*x", attr_id, ainfo); + /* check arguments */ + if(NULL == (attr = (void *)H5I_object_verify(attr_id, H5I_ATTR))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an attribute") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(attr_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the attribute object */ - if(NULL == (attr = (void *)H5I_object(attr_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid attribute identifier") loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(attr_id); @@ -88,19 +88,6 @@ H5D__init_pub_interface(void) FUNC_ENTER_STATIC_NOERR FUNC_LEAVE_NOAPI(H5D_init()) -#if 0 - herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC - - /* Initialize the atom group for the dataset IDs */ - if(H5I_register_type(H5I_DATASET, (size_t)H5I_DATASETID_HASHSIZE, H5D_RESERVED_ATOMS, - NULL, (H5I_free2_t)H5D_close_dataset)<H5I_FILE) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize interface") - - ret_value = H5D_init(); -done: - FUNC_LEAVE_NOAPI(ret_value) -#endif } /* H5D__init_pub_interface() */ @@ -423,9 +410,9 @@ H5Dclose(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("e", "i", dset_id); - /* Check/fix arguments. */ + /* Check args */ if(H5I_DATASET != H5I_get_type(dset_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* * Decrement the counter on the dataset. It will be freed if the count @@ -438,12 +425,6 @@ H5Dclose(hid_t dset_id) if(H5I_dec_app_ref_always_close(dset_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't decrement count on dataset ID") -#if 0 - /* Close the dataset through the VOL */ - if((ret_value = H5VL_dataset_close(dset_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to close dataset") -#endif - done: FUNC_LEAVE_API(ret_value) } /* end H5Dclose() */ @@ -475,12 +456,12 @@ H5Dget_space(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the dataspace through the VOL */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE, H5AC_dxpl_id, @@ -516,12 +497,12 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*Ds", dset_id, allocation); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Read data space address through the VOL and return */ if((ret_value = H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_SPACE_STATUS, @@ -559,12 +540,12 @@ H5Dget_type(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the datatype through the VOL */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_TYPE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -601,12 +582,12 @@ H5Dget_create_plist(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -660,12 +641,12 @@ H5Dget_access_plist(hid_t dset_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DAPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset access properties") @@ -704,12 +685,12 @@ H5Dget_storage_size(hid_t dset_id) FUNC_ENTER_API(0) H5TRACE1("h", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get storage size through the VOL */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_STORAGE_SIZE, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -744,12 +725,12 @@ H5Dget_offset(hid_t dset_id) FUNC_ENTER_API(HADDR_UNDEF) H5TRACE1("a", "i", dset_id); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") /* get offset through the VOL */ if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_OFFSET, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) @@ -1042,15 +1023,16 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*h", dset_id, size); + /* Check args */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") + if(!size) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* set the extent through the VOL */ if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, H5AC_dxpl_id, H5_EVENT_STACK_NULL)) < 0) diff --git a/src/H5Dio.c b/src/H5Dio.c index 788c305..94517a7 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -128,6 +128,9 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, H5TRACE6("e", "iiiiix", dset_id, mem_type_id, mem_space_id, file_space_id, plist_id, buf); + /* check arguments */ + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") if(mem_space_id < 0 || file_space_id < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") @@ -141,9 +144,6 @@ H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Read the data through the VOL */ if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, @@ -202,6 +202,8 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* check arguments */ if(!dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(NULL == (dset = (void *)H5I_object_verify(dset_id, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Get the default dataset transfer property list if the user didn't provide one */ if(H5P_DEFAULT == dxpl_id) @@ -213,9 +215,6 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(dset_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (dset = (void *)H5I_object(dset_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier") /* Write the data through the VOL */ if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, diff --git a/src/H5Doh.c b/src/H5Doh.c index 2dab247..abf76d0 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -30,8 +30,7 @@ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5Opkg.h" /* Object headers */ -#include "H5VLnative.h" /* Native Plugin */ -#include "H5VLprivate.h" /* VOL */ + /****************/ /* Local Macros */ @@ -523,12 +523,13 @@ H5Gget_create_plist(hid_t grp_id) FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", grp_id); + /* Check args */ + if(NULL == (grp = (void *)H5I_object_verify(grp_id, H5I_GROUP))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") + /* get the plugin pointer */ if (NULL == (vol_plugin = (H5VL_t *)H5I_get_aux(grp_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "ID does not contain VOL information") - /* get the dataset object */ - if(NULL == (grp = (void *)H5I_object(grp_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid group identifier") if(H5VL_group_get(grp, vol_plugin, H5VL_GROUP_GET_GCPL, H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get group creation properties") diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 3986a5c..cab6223 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -134,10 +134,12 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, H5TRACE6("e", "i*siiii", loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id); /* Check arguments */ - if (H5Tcommitted(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_committed(type)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == lcpl_id) @@ -160,9 +162,6 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - loc_params.type = H5VL_OBJECT_BY_SELF; loc_params.obj_type = H5I_get_type(loc_id); @@ -307,8 +306,10 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) H5TRACE4("e", "iiii", loc_id, type_id, tcpl_id, tapl_id); /* check args */ - if (H5Tcommitted(type_id)) - HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + if(H5T_committed(type)) + HGOTO_ERROR(H5E_ARGS, H5E_CANTSET, FAIL, "datatype is already committed") /* Get correct property list */ if(H5P_DEFAULT == tcpl_id) @@ -339,11 +340,6 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) tcpl_id, tapl_id, H5AC_dxpl_id, H5_EVENT_STACK_NULL))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to commit datatype") - /* attach the vol object created using the commit call to the - library datatype structure */ - if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - /* set the committed type object to the VOL pluging pointer in the H5T_t struct */ type->vol_obj = dt; |