From f20a7939694a60c08eb59cc916abe62afcf5310a Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Mon, 21 Feb 2005 14:08:59 -0500 Subject: [svn-r10059] Purpose: new features Description: added a new function H5DS_is_attached, more tests Solution: Platforms tested: linux solaris Misc. update: --- hl/src/H5DS.c | 141 +++++++++--- hl/src/H5DS.h | 10 +- hl/test/test_ds.c | 673 +++++++++++++++++++++++++++++------------------------- 3 files changed, 461 insertions(+), 363 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 232109f..5ad4b0c 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -558,9 +558,11 @@ herr_t H5DSdetach_scale(hid_t did, hid_t tid; /* attribute type ID */ hid_t aid; /* attribute ID */ int rank; /* rank of dataset */ - ds_list_t *dsbuf; /* array of attribute data in the DS pointing to the dataset */ + ds_list_t *dsbuf=NULL; /* array of attribute data in the DS pointing to the dataset */ + ds_list_t *dsbufn=NULL; /* array of attribute data in the DS pointing to the dataset */ + hsize_t *dims=NULL; /* dimension of the "REFERENCE_LIST" array */ hobj_ref_t ref; /* reference to the DS */ - hvl_t *buf; /* VL buffer to store in the attribute */ + hvl_t *buf=NULL; /* VL buffer to store in the attribute */ unsigned i, j, jj; H5G_stat_t sb1, sb2, sb3, sb4; int found_dset=0, found_ds=0; @@ -686,6 +688,11 @@ herr_t H5DSdetach_scale(hid_t did, buf[idx].len--; found_ds = 1; + + /* close the dereferenced dataset and break */ + if (H5Dclose(dsid_j)<0) + goto out; + break; } /* close the dereferenced dataset */ @@ -733,7 +740,6 @@ herr_t H5DSdetach_scale(hid_t did, goto out; dsbuf = malloc((size_t)nelmts * sizeof(ds_list_t)); - if (dsbuf == NULL) goto out; @@ -758,34 +764,106 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset. we want to detach only for this DIM */ - if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) { - dsbuf[i].ref=0; - dsbuf[i].dim_idx=-1; + if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno && (int)idx==dsbuf[i].dim_idx) + { + for(jj=i; jj