summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-06-18 20:51:49 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-06-18 20:51:49 (GMT)
commitb6fca58d925dd2e8287b746b3deb81f71fc6e75f (patch)
tree02d72cfaf5279504645e51fa030cebb1180185e4 /src
parentd0d6ef4a90180a6f471660d42e9dfdcb287f9927 (diff)
downloadhdf5-b6fca58d925dd2e8287b746b3deb81f71fc6e75f.zip
hdf5-b6fca58d925dd2e8287b746b3deb81f71fc6e75f.tar.gz
hdf5-b6fca58d925dd2e8287b746b3deb81f71fc6e75f.tar.bz2
[svn-r7058] Purpose:
Bug fix and refactored code Description: Return the file space we have allocated already when a dataset creation fails. Also track the change to the H5Fget_obj_<foo> APIs Platforms tested: FreeBSD 4.8 (sleipnir) h5committest
Diffstat (limited to 'src')
-rw-r--r--src/H5D.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 5c1b1f5..46622ff 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1838,8 +1838,12 @@ done:
H5S_close(new_dset->space);
if (new_dset->type)
H5T_close(new_dset->type);
- if (H5F_addr_defined(new_dset->ent.header))
- H5O_close(&(new_dset->ent));
+ if (H5F_addr_defined(new_dset->ent.header)) {
+ if(H5O_close(&(new_dset->ent))<0)
+ HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, NULL, "unable to release object header");
+ if(H5O_delete(file, dxpl_id,new_dset->ent.header)<0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTDELETE, NULL, "unable to delete object header");
+ } /* end if */
if(new_dset->dcpl_id!=0)
H5I_dec_ref(new_dset->dcpl_id);
new_dset->ent.file = NULL;
@@ -3341,11 +3345,11 @@ done:
herr_t
H5D_flush(H5F_t *f, hid_t dxpl_id)
{
- unsigned num_dsets; /* Number of datasets in file */
- hid_t *id_list=NULL; /* list of dataset IDs */
- H5D_t *dataset=NULL; /* Dataset pointer */
- herr_t ret_value = SUCCEED; /* Return value */
- unsigned j; /* Index variable */
+ int num_dsets; /* Number of datasets in file */
+ hid_t *id_list=NULL; /* list of dataset IDs */
+ H5D_t *dataset=NULL; /* Dataset pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
+ int j; /* Index variable */
FUNC_ENTER_NOAPI(H5D_flush, FAIL);
@@ -3353,21 +3357,20 @@ H5D_flush(H5F_t *f, hid_t dxpl_id)
assert(f);
/* Update layout message for compact dataset */
- if(H5F_get_obj_count(f, H5F_OBJ_DATASET, &num_dsets)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset number");
- if(num_dsets>0) {
- if(NULL==(id_list=H5MM_malloc(num_dsets*sizeof(hid_t))))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate memory for ID list");
- if(H5F_get_obj_ids(f, H5F_OBJ_DATASET, id_list)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset ID list");
- for(j=0; j<num_dsets; j++) {
- if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object");
- if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty)
- if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), dxpl_id)<0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message");
- dataset->layout.dirty = FALSE;
- }
+ if((num_dsets=H5F_get_obj_count(f, H5F_OBJ_DATASET))<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset count");
+
+ if(NULL==(id_list=H5MM_malloc(num_dsets*sizeof(hid_t))))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate memory for ID list");
+ if(H5F_get_obj_ids(f, H5F_OBJ_DATASET, -1, id_list)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset ID list");
+ for(j=0; j<num_dsets; j++) {
+ if(NULL==(dataset=H5I_object_verify(id_list[j], H5I_DATASET)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to get dataset object");
+ if(dataset->layout.type==H5D_COMPACT && dataset->layout.dirty)
+ if(H5O_modify(&(dataset->ent), H5O_LAYOUT_ID, 0, 0, 1, &(dataset->layout), dxpl_id)<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update layout message");
+ dataset->layout.dirty = FALSE;
}
done: