From d03ae28886d062f7552334c204562a98bb7351e9 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 31 Oct 2013 08:28:06 -0500 Subject: [svn-r24381] Update VOL implementation for H5Tget_create_plist to have the VOL plugin create the ID if the datatype is committed. This makes it consistent with other get operations in the VOL that return an ID. Tested: Jam --- src/H5D.c | 3 ++- src/H5Tcommit.c | 33 ++++++++++++++------------------- src/H5VLnative.c | 18 ++++++++++++++---- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 02b6016..c502dfc 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -584,7 +584,8 @@ H5Dget_create_plist(hid_t dset_id) 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) + if(H5VL_dataset_get(dset, vol_plugin, H5VL_DATASET_GET_DCPL, H5AC_dxpl_id, + H5_EVENT_STACK_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get dataset creation properties") done: diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index a801737..f22d8b0 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -661,7 +661,6 @@ H5Tget_create_plist(hid_t dtype_id) { H5T_t *type; /* Datatype object for ID */ H5P_genplist_t *tcpl_plist; /* Existing datatype creation propertty list */ - hid_t new_tcpl_id = FAIL; /* New datatype creation property list */ herr_t status; /* Generic status value */ hid_t ret_value; /* Return value */ @@ -672,18 +671,22 @@ H5Tget_create_plist(hid_t dtype_id) if(NULL == (type = (H5T_t *)H5I_object_verify(dtype_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") - /* Copy the default datatype creation property list */ - if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_g))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default creation property list") - if((new_tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") - /* Check if the datatype is committed */ - if((status = H5Tcommitted(dtype_id)) < 0) + if((status = H5T_committed(type)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check whether datatype is committed") - /* Retrieve further information, if the datatype is committed */ - if(status > 0) { + /* If the datatype is not committed, just copy the default + creation property list and return that. */ + if(FALSE == status) { + /* Copy the default datatype creation property list */ + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default creation property list") + if((ret_value = H5P_copy_plist(tcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") + } + /* If the datatype is committed, let the VOL create the creation + property list ID. */ + else if(TRUE == status) { H5VL_t *vol_plugin; /* VOL plugin information */ /* get the plugin pointer */ @@ -696,19 +699,11 @@ H5Tget_create_plist(hid_t dtype_id) /* get the rest of the plist through the VOL */ if(H5VL_datatype_get(type, vol_plugin, H5VL_DATATYPE_GET_TCPL, - H5AC_dxpl_id, H5_EVENT_STACK_NULL, new_tcpl_id) < 0) + H5AC_dxpl_id, H5_EVENT_STACK_NULL, &ret_value) < 0) HGOTO_ERROR(H5E_INTERNAL, H5E_CANTGET, FAIL, "unable to get datatype") } /* end if */ - /* Set the return value */ - ret_value = new_tcpl_id; - done: - if(ret_value < 0) - if(new_tcpl_id > 0) - if(H5I_dec_app_ref(new_tcpl_id) < 0) - HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object") - FUNC_LEAVE_API(ret_value) } /* end H5Tget_create_plist() */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 9b669f3..0343f53 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -1268,17 +1268,27 @@ H5VL_native_datatype_get(void *obj, H5VL_datatype_get_t get_type, /* H5Tget_create_plist */ case H5VL_DATATYPE_GET_TCPL: { - H5P_genplist_t *new_plist; /* New datatype creation property list */ - hid_t tcpl_id = va_arg (arguments, hid_t); + hid_t *ret_id = va_arg (arguments, hid_t *); + H5P_genplist_t *tcpl_plist = NULL; /* New datatype creation property list */ + hid_t tcpl_id; + + /* Copy the default datatype creation property list */ + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(H5P_LST_DATATYPE_CREATE_g))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get default creation property list") + if((tcpl_id = H5P_copy_plist(tcpl_plist, TRUE)) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to copy the creation property list") + + tcpl_plist = NULL; /* Get property list object for new TCPL */ - if(NULL == (new_plist = (H5P_genplist_t *)H5I_object(tcpl_id))) + if(NULL == (tcpl_plist = (H5P_genplist_t *)H5I_object(tcpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list"); /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&dt->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&dt->oloc, H5AC_ind_dxpl_id, tcpl_plist) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info"); + *ret_id = tcpl_id; break; } default: -- cgit v0.12