From b0b4bc02dd4746dd49b727e833b0d5564cf8305e Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Fri, 18 Feb 2005 10:42:55 -0500 Subject: [svn-r10042] Purpose: bug fix Description: a scale was deleted twice in one case Solution: check for the dimension , delete only for it Platforms tested: linux solaris Misc. update: --- hl/src/H5DS.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index b40f342..ba410ec 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -429,10 +429,18 @@ herr_t H5DSattach_scale(hid_t did, /* store the IDX information (index of the dataset that has the DS) */ dsl.dim_idx = idx; dsbuf[nelmts-1] = dsl; - + /* create a new data space for the new references array */ - if ((sid = H5Screate_simple(1,&nelmts,NULL))<0) + dims = (hsize_t*) malloc ( (size_t)nelmts * sizeof (hsize_t)); + if (dims == NULL) goto out; + dims[0] = nelmts; + + if ((sid = H5Screate_simple(1,dims,NULL))<0) + goto out; + + if (dims) + free(dims); /* create the attribute again with the changes of space */ if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT))<0) @@ -712,8 +720,8 @@ herr_t H5DSdetach_scale(hid_t did, if (H5Gget_objinfo(dsid_j,".",TRUE,&sb4)<0) goto out; - /* same object, reset */ - if (sb3.fileno==sb4.fileno && sb3.objno==sb4.objno) { + /* 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; found_dset=1; -- cgit v0.12