summaryrefslogtreecommitdiffstats
path: root/hl/src/H5DS.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-10-04 22:19:07 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-10-04 22:19:07 (GMT)
commit1de51c7bc148b9cb5104936dfd23096a222d0cb8 (patch)
treeb23ea23404fd02a41f4539ebbc8311a1c43fecbe /hl/src/H5DS.c
parent041de441c5d7468812be8af1346b30db6ea94e3a (diff)
downloadhdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.zip
hdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.tar.gz
hdf5-1de51c7bc148b9cb5104936dfd23096a222d0cb8.tar.bz2
[svn-r14187] Description:
Put H5Acreate() under API versioning, with all internal usage shifted to H5Acreate2(). Add regression tests for H5Acreate1(). Tested on: FreeBSD/32 6.2 (duty) in debug mode FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Mac OS X/32 10.4.10 (amazon) in debug mode
Diffstat (limited to 'hl/src/H5DS.c')
-rw-r--r--hl/src/H5DS.c80
1 files changed, 38 insertions, 42 deletions
diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c
index 6d1c41e..1d823a0 100644
--- a/hl/src/H5DS.c
+++ b/hl/src/H5DS.c
@@ -235,31 +235,30 @@ herr_t H5DSattach_scale(hid_t did,
/* create one entry array */
dims = (hsize_t*) malloc (1 * sizeof (hsize_t));
- if (dims == NULL)
+ if(dims == NULL)
return FAIL;
dims[0] = rank;
/* space for the attribute */
- if ((sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
return FAIL;
/* create the type for the attribute "DIMENSION_LIST" */
- if ((tid = H5Tvlen_create(H5T_STD_REF_OBJ)) < 0)
+ if((tid = H5Tvlen_create(H5T_STD_REF_OBJ)) < 0)
goto out;
/* create the attribute */
- if ((aid = H5Acreate(did,DIMENSION_LIST,tid,sid,H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(did, ".", DIMENSION_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* allocate and initialize the VL */
buf = (hvl_t*)malloc((size_t)rank * sizeof(hvl_t));
- if (buf == NULL)
+ if(buf == NULL)
goto out;
- for(i=0; i<rank; i++)
- {
+ for(i = 0; i < rank; i++) {
buf[i].len = 0;
buf[i].p = NULL;
}
@@ -410,32 +409,32 @@ herr_t H5DSattach_scale(hid_t did,
goto out;
/* create the compound datatype for the attribute "REFERENCE_LIST" */
- if ((tid = H5Tcreate(H5T_COMPOUND,sizeof(ds_list_t))) < 0)
+ if((tid = H5Tcreate(H5T_COMPOUND, sizeof(ds_list_t))) < 0)
goto out;
/* insert reference field */
- if (H5Tinsert(tid,"dataset",HOFFSET(ds_list_t,ref),H5T_STD_REF_OBJ) < 0)
+ if(H5Tinsert(tid, "dataset", HOFFSET(ds_list_t,ref), H5T_STD_REF_OBJ) < 0)
goto out;
/* insert dimension idx of the dataset field */
- if (H5Tinsert(tid,"dimension",HOFFSET(ds_list_t,dim_idx),H5T_NATIVE_INT) < 0)
+ if(H5Tinsert(tid, "dimension", HOFFSET(ds_list_t, dim_idx), H5T_NATIVE_INT) < 0)
goto out;
/* create the attribute */
- if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* store the IDX information */
dsl.dim_idx = idx;
/* write the attribute with the reference */
- if (H5Awrite(aid,tid,&dsl) < 0)
+ if(H5Awrite(aid, tid, &dsl) < 0)
goto out;
/* close */
- if (H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
- if (H5Tclose(tid) < 0)
+ if(H5Tclose(tid) < 0)
goto out;
if(H5Aclose(aid) < 0)
goto out;
@@ -494,31 +493,31 @@ herr_t H5DSattach_scale(hid_t did,
dsbuf[nelmts-1] = dsl;
/* create a new data space for the new references array */
- dims = (hsize_t*) malloc ( (size_t)nelmts * sizeof (hsize_t));
- if (dims == NULL)
+ 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)
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
- if (dims)
+ if(dims)
free(dims);
/* create the attribute again with the changes of space */
- if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write the attribute with the new references */
- if (H5Awrite(aid,tid,dsbuf) < 0)
+ if(H5Awrite(aid, tid, dsbuf) < 0)
goto out;
/* close */
- if (H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
- if (H5Tclose(tid) < 0)
+ if(H5Tclose(tid) < 0)
goto out;
- if (H5Aclose(aid) < 0)
+ if(H5Aclose(aid) < 0)
goto out;
if (dsbuf)
@@ -840,41 +839,38 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* don't do anything for an empty array */
- if (nelmts)
+ if(nelmts)
{
/* create a new data space for the new references array */
- dims = (hsize_t*) malloc ( (size_t)nelmts * sizeof (hsize_t));
- if (dims == NULL)
+ dims = (hsize_t*)malloc((size_t)nelmts * sizeof (hsize_t));
+ if(dims == NULL)
goto out;
dims[0] = nelmts;
dsbufn = malloc((size_t)nelmts * sizeof(ds_list_t));
- if (dsbufn == NULL)
+ if(dsbufn == NULL)
goto out;
/* store the new information */
- for(i=0; i<nelmts; i++)
- {
+ for(i = 0; i < nelmts; i++)
dsbufn[i] = dsbuf[i];
- }
- if ((sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* create the attribute again with the changes of space */
- if ((aid = H5Acreate(dsid,REFERENCE_LIST,tid,sid,H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(dsid, ".", REFERENCE_LIST, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* write the new attribute with the new references */
- if (H5Awrite(aid,tid,dsbufn) < 0)
+ if(H5Awrite(aid, tid, dsbufn) < 0)
goto out;
/* close space and attribute */
- if (H5Sclose(sid) < 0)
+ if(H5Sclose(sid) < 0)
goto out;
- if (H5Aclose(aid) < 0)
+ if(H5Aclose(aid) < 0)
goto out;
-
} /* nelmts */
/* close type */
@@ -1445,26 +1441,26 @@ herr_t H5DSset_label(hid_t did,
dims[0] = rank;
/* space for the attribute */
- if ((sid = H5Screate_simple(1,dims,NULL)) < 0)
+ if((sid = H5Screate_simple(1, dims, NULL)) < 0)
goto out;
/* create the datatype */
- if ((tid = H5Tcopy(H5T_C_S1)) < 0)
+ if((tid = H5Tcopy(H5T_C_S1)) < 0)
goto out;
- if (H5Tset_size(tid,H5T_VARIABLE) < 0)
+ if(H5Tset_size(tid, H5T_VARIABLE) < 0)
goto out;
/* create the attribute */
- if ((aid = H5Acreate(did,DIMENSION_LABELS,tid,sid,H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(did, ".", DIMENSION_LABELS, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
/* allocate and initialize */
buf = (const char **)malloc((size_t)rank * sizeof(char *));
- if (buf == NULL)
+ if(buf == NULL)
goto out;
- for(i=0; i<(unsigned int)rank; i++)
+ for(i = 0; i < (unsigned int)rank; i++)
buf[i] = NULL;
/* store the label information in the required index */