diff options
-rw-r--r-- | src/H5D.c | 8 | ||||
-rw-r--r-- | src/H5S.c | 39 | ||||
-rw-r--r-- | src/H5Sall.c | 14 | ||||
-rw-r--r-- | src/H5Spoint.c | 14 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 | ||||
-rw-r--r-- | src/H5Spublic.h | 2 | ||||
-rw-r--r-- | src/H5public.h | 2 | ||||
-rw-r--r-- | tools/h5ls.c | 4 |
8 files changed, 52 insertions, 33 deletions
@@ -810,7 +810,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space, /* Total raw data size */ new_dset->layout.type = new_dset->create_parms->layout; - new_dset->layout.ndims = H5S_get_ndims(space) + 1; + new_dset->layout.ndims = H5S_extent_ndims(space) + 1; assert((unsigned)(new_dset->layout.ndims) <= NELMTS(new_dset->layout.dim)); new_dset->layout.dim[new_dset->layout.ndims-1] = H5T_get_size(type); @@ -821,7 +821,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space, * Also, only the slowest varying dimension of a simple data space * can be extendible. */ - if ((ndims=H5S_get_dims(space, new_dset->layout.dim, max_dim)) < 0) { + if ((ndims=H5S_extent_dims(space, new_dset->layout.dim, max_dim)) < 0) { HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize contiguous storage"); } @@ -859,7 +859,7 @@ H5D_create(H5G_t *loc, const char *name, const H5T_t *type, const H5S_t *space, * Chunked storage allows any type of data space extension, so we * don't even bother checking. */ - if (new_dset->create_parms->chunk_ndims != H5S_get_ndims(space)) { + if (new_dset->create_parms->chunk_ndims != H5S_extent_ndims(space)) { HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "dimensionality of chunks doesn't match the data space"); } @@ -2026,7 +2026,7 @@ printf("Enter %s:\n", FUNC); "unable to read data space info from dataset header"); } /* get current dims of dataset */ - if ((space_ndims=H5S_get_dims(space, space_dim, NULL)) <= 0 || + if ((space_ndims=H5S_extent_dims(space, space_dim, NULL)) <= 0 || space_ndims+1 != layout->ndims){ HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate chunk storage"); @@ -591,7 +591,7 @@ H5S_get_npoints_max(const H5S_t *ds) /*------------------------------------------------------------------------- - * Function: H5Sget_ndims + * Function: H5Sextent_ndims * * Purpose: Determines the dimensionality of a data space. * @@ -607,25 +607,25 @@ H5S_get_npoints_max(const H5S_t *ds) *------------------------------------------------------------------------- */ int -H5Sget_ndims (hid_t space_id) +H5Sextent_ndims (hid_t space_id) { H5S_t *ds = NULL; intn ret_value = 0; - FUNC_ENTER(H5Sget_ndims, FAIL); + FUNC_ENTER(H5Sextent_ndims, FAIL); H5TRACE1("Is","i",space_id); /* Check args */ if (H5_DATASPACE != H5I_group(space_id) || NULL == (ds = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - ret_value = H5S_get_ndims(ds); + ret_value = H5S_extent_ndims(ds); FUNC_LEAVE(ret_value); } /*------------------------------------------------------------------------- - * Function: H5S_get_ndims + * Function: H5S_extent_ndims * * Purpose: Returns the number of dimensions in a data space. * @@ -642,11 +642,11 @@ H5Sget_ndims (hid_t space_id) *------------------------------------------------------------------------- */ intn -H5S_get_ndims(const H5S_t *ds) +H5S_extent_ndims(const H5S_t *ds) { intn ret_value = FAIL; - FUNC_ENTER(H5S_get_ndims, FAIL); + FUNC_ENTER(H5S_extent_ndims, FAIL); /* check args */ assert(ds); @@ -674,13 +674,13 @@ H5S_get_ndims(const H5S_t *ds) } /*------------------------------------------------------------------------- - * Function: H5Sget_dims + * Function: H5Sextent_dims * * Purpose: Returns the size and maximum sizes in each dimension of * a data space DS through the DIMS and MAXDIMS arguments. * * Return: Success: Number of dimensions, the same value as - * returned by H5Sget_ndims(). + * returned by H5Sextent_ndims(). * * Failure: FAIL * @@ -696,25 +696,25 @@ H5S_get_ndims(const H5S_t *ds) *------------------------------------------------------------------------- */ int -H5Sget_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/) +H5Sextent_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/) { H5S_t *ds = NULL; intn ret_value = 0; - FUNC_ENTER(H5Sget_dims, FAIL); + FUNC_ENTER(H5Sextent_dims, FAIL); H5TRACE3("Is","ixx",space_id,dims,maxdims); /* Check args */ if (H5_DATASPACE != H5I_group(space_id) || NULL == (ds = H5I_object(space_id))) { HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space"); } - ret_value = H5S_get_dims(ds, dims, maxdims); + ret_value = H5S_extent_dims(ds, dims, maxdims); FUNC_LEAVE(ret_value); } /*------------------------------------------------------------------------- - * Function: H5S_get_dims + * Function: H5S_extent_dims * * Purpose: Returns the size in each dimension of a data space. This * function may not be meaningful for all types of data spaces. @@ -731,12 +731,12 @@ H5Sget_dims (hid_t space_id, hsize_t dims[]/*out*/, hsize_t maxdims[]/*out*/) *------------------------------------------------------------------------- */ intn -H5S_get_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) +H5S_extent_dims(const H5S_t *ds, hsize_t dims[], hsize_t max_dims[]) { intn ret_value = FAIL; intn i; - FUNC_ENTER(H5S_get_dims, FAIL); + FUNC_ENTER(H5S_extent_dims, FAIL); /* check args */ assert(ds); @@ -1048,6 +1048,15 @@ H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, if (rank<0) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid rank"); } +#ifdef OLD_WAY + if (dims) { + for (u=0; u<rank; u++) { + if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL) && dims[u]==0) { + HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, "invalid dimension size"); + } + } + } +#endif /* OLD_WAY */ if (max!=NULL) { if(dims==NULL) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, diff --git a/src/H5Sall.c b/src/H5Sall.c index 4a3dcce..8af7a18 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -85,7 +85,7 @@ H5S_all_favail (const H5S_t *space, const H5S_sel_iter_t *sel_iter, size_t max) * be split up. We choose the largest possible strip mine size which is * not larger than the desired size. */ - m_ndims = H5S_get_dims (space, size, NULL); + m_ndims = H5S_extent_dims (space, size, NULL); for (i=m_ndims-1, acc=1; i>0; --i) acc *= size[i]; nelmts = (max/acc) * acc; @@ -153,7 +153,7 @@ H5S_all_fgath (H5F_t *f, const struct H5O_layout_t *layout, * currently pass sample information into H5F_arr_read() much less * H5F_istore_read(). */ - if ((space_ndims=H5S_get_dims (file_space, hsize, NULL))<0) { + if ((space_ndims=H5S_extent_dims (file_space, hsize, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, "unable to retrieve hyperslab parameters"); } @@ -236,7 +236,7 @@ H5S_all_fscat (H5F_t *f, const struct H5O_layout_t *layout, /* * Get information to determine what elements are being selected. */ - if ((space_ndims=H5S_get_dims (file_space, hsize, NULL))<0) { + if ((space_ndims=H5S_extent_dims (file_space, hsize, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve hyperslab parameters"); } @@ -318,13 +318,13 @@ H5S_all_mgath (const void *_buf, size_t elmt_size, /* * Retrieve information to determine what elements are being selected. */ - if ((space_ndims=H5S_get_dims (mem_space, hsize, NULL))<0) { + if ((space_ndims=H5S_extent_dims (mem_space, hsize, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, "unable to retrieve hyperslab parameters"); } HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims); - if (H5S_get_dims (mem_space, mem_size, NULL)<0) { + if (H5S_extent_dims (mem_space, mem_size, NULL)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, "unable to retrieve data space dimensions"); } @@ -406,13 +406,13 @@ H5S_all_mscat (const void *_tconv_buf, size_t elmt_size, /* * Retrieve information to determine what elements are being selected. */ - if ((space_ndims=H5S_get_dims (mem_space, hsize, NULL))<0) { + if ((space_ndims=H5S_extent_dims (mem_space, hsize, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve hyperslab parameters"); } HDmemset(mem_offset,0,sizeof(hssize_t)*space_ndims); - if (H5S_get_dims (mem_space, mem_size, NULL)<0) { + if (H5S_extent_dims (mem_space, mem_size, NULL)<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions"); } diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 3864293..304ee00 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -359,7 +359,7 @@ H5S_point_mgath (const void *_buf, size_t elmt_size, assert (nelmts>0); assert (tconv_buf); - if ((space_ndims=H5S_get_dims (mem_space, mem_size, NULL))<0) { + if ((space_ndims=H5S_extent_dims (mem_space, mem_size, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, "unable to retrieve data space dimensions"); } @@ -434,7 +434,7 @@ H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, * only handle hyperslabs with unit sample because there's currently no * way to pass sample information to H5V_hyper_copy(). */ - if ((space_ndims=H5S_get_dims (mem_space, mem_size, NULL))<0) { + if ((space_ndims=H5S_extent_dims (mem_space, mem_size, NULL))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, "unable to retrieve data space dimensions"); } @@ -482,11 +482,21 @@ H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, herr_t H5S_point_release (H5S_t *space) { + H5S_pnt_node_t *curr, *next; /* Point selection nodes */ FUNC_ENTER (H5S_point_release, FAIL); /* Check args */ assert (space); + /* Delete all the nodes from the list */ + curr=space->select.sel_info.pnt_lst->head; + while(curr!=NULL) { + next=curr->next; + H5MM_xfree(curr->pnt); + H5MM_xfree(curr); + curr=next; + } /* end while */ + FUNC_LEAVE (SUCCEED); } /* H5S_point_release() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index c31d746..f4e9843 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -206,7 +206,7 @@ herr_t H5S_close_simple (H5S_simple_t *simple); herr_t H5S_close (H5S_t *ds); hsize_t H5S_extent_npoints (const H5S_t *ds); hsize_t H5S_get_npoints_max(const H5S_t *ds); -intn H5S_get_ndims (const H5S_t *ds); +intn H5S_extent_ndims (const H5S_t *ds); intn H5S_get_dims (const H5S_t *ds, hsize_t dims[]/*out*/, hsize_t max_dims[]/*out*/); herr_t H5S_modify (H5G_entry_t *ent, const H5S_t *space); diff --git a/src/H5Spublic.h b/src/H5Spublic.h index d3d75b6..1c48dbc 100644 --- a/src/H5Spublic.h +++ b/src/H5Spublic.h @@ -49,7 +49,7 @@ herr_t H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, const hsi hid_t H5Scopy (hid_t space_id); herr_t H5Sclose (hid_t space_id); hsize_t H5Sextent_npoints (hid_t space_id); -int H5Sget_ndims (hid_t space_id); +int H5Sextent_ndims (hid_t space_id); int H5Sget_dims (hid_t space_id, hsize_t dims[], hsize_t maxdims[]); hbool_t H5Sis_simple (hid_t space_id); herr_t H5Sset_space (hid_t space_id, int rank, const hsize_t *dims); diff --git a/src/H5public.h b/src/H5public.h index 67b5b45..e336c90 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -27,7 +27,7 @@ /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface changes */ #define H5_VERS_MINOR 0 /* For minor interface changes */ -#define H5_VERS_RELEASE 11 /* For interface tweaks & bug-fixes */ +#define H5_VERS_RELEASE 14 /* For interface tweaks & bug-fixes */ #define H5_VERS_PATCH 0 /* For small groups of bug fixes */ #define H5check() H5vers_check(H5_VERS_MAJOR,H5_VERS_MINOR,\ diff --git a/tools/h5ls.c b/tools/h5ls.c index 4b0ea75..3e8a378 100644 --- a/tools/h5ls.c +++ b/tools/h5ls.c @@ -55,7 +55,7 @@ list_attr (hid_t obj, const char *attr_name, void __unused__ *op_data) if ((attr = H5Aopen_name (obj, attr_name))) { hid_t space = H5Aget_space (attr); hsize_t size[64]; - int ndims = H5Sget_dims (space, size, NULL); + int ndims = H5Sextent_dims (space, size, NULL); H5Sclose (space); printf (" {"); for (i=0; i<ndims; i++) { @@ -114,7 +114,7 @@ list (hid_t group, const char *name, void __unused__ *op_data) hsize_t size[64]; hsize_t maxsize[64]; hid_t space = H5Dget_space (obj); - int ndims = H5Sget_dims(space, size, maxsize); + int ndims = H5Sextent_dims(space, size, maxsize); printf ("Dataset {"); for (i=0; i<ndims; i++) { HDfprintf (stdout, "%s%Hu", i?", ":"", size[i]); |