diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-07-08 21:18:18 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-07-08 21:18:18 (GMT) |
commit | 5f554bcced24f97371c34c36bb83eea921e2a85b (patch) | |
tree | 2ce1160aad30f3732f0e9d5504e5ac1fe0768dca /src/H5S.c | |
parent | 44d5c8823eb4370ff70bf7ed56c8eae7404d222c (diff) | |
download | hdf5-5f554bcced24f97371c34c36bb83eea921e2a85b.zip hdf5-5f554bcced24f97371c34c36bb83eea921e2a85b.tar.gz hdf5-5f554bcced24f97371c34c36bb83eea921e2a85b.tar.bz2 |
[svn-r473] Changes since 19980708
----------------------
./src/H5Fistore.c
./src/H5S.c
Fixed places where `herr_t' functions returned NULL for
failure: H5F_istore_get_addr() and printf(?!?) (probably
because a printf() was in the first column :-/ so I don't know
what function it really was that I fixed), and H5S_extent_copy().
./src/H5Fprivate.h
Added declarations for H5F_istore_get_addr() and
H5F_istore_allocate().
./src/H5S.c
./src/H5Sprivate.h
Split H5Sset_extent_simple() into H5S_set_extent_simple() and
replaced calls to the API function with calls to the internal
function.
Changed calls to H5Screate() to H5S_create() and H5Sclose() to
H5S_close().
./src/H5Shyper.c
./src/H5Spoint.c
Removed unused labels and variable.
./src/H5T.c
./src/H5Tconv.c
Changed calls to H5Tfind() to H5T_find().
./src/H5TB.c
Split function return type onto a separate line for five
functions and added API tracing calls.
Diffstat (limited to 'src/H5S.c')
-rw-r--r-- | src/H5S.c | 89 |
1 files changed, 68 insertions, 21 deletions
@@ -353,7 +353,7 @@ H5S_extent_copy(H5S_extent_t *dst, const H5S_extent_t *src) { int i; - FUNC_ENTER(H5S_extent_copy, NULL); + FUNC_ENTER(H5S_extent_copy, FAIL); /* Copy the regular fields */ *dst=*src; @@ -1029,11 +1029,11 @@ H5Sis_simple (hid_t sid) dimension in the array (the slowest) may be unlimited in size. --------------------------------------------------------------------------*/ herr_t -H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, const hsize_t *max) +H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, + const hsize_t *max) { H5S_t *space = NULL; /* dataspace to modify */ intn u; /* local counting variable */ - herr_t ret_value = SUCCEED; FUNC_ENTER(H5Sset_extent_simple, FAIL); H5TRACE4("e","iIs*h*h",sid,rank,dims,max); @@ -1050,24 +1050,64 @@ H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, const hsize_t *m } if (dims) { for (u=0; u<rank; u++) { - if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL) && dims[u]==0) { + if (((max!=NULL && max[u]!=H5S_UNLIMITED) || max==NULL) && + dims[u]==0) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid dimension size"); + "invalid dimension size"); } } } if (max!=NULL) { - if(dims==NULL) + if(dims==NULL) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, - "maximum dimension specified, but no current dimensions specified"); + "maximum dimension specified, but no current " + "dimensions specified"); + } for (u=0; u<rank; u++) { if (max[u]!=H5S_UNLIMITED && max[u]<dims[u]) { HRETURN_ERROR (H5E_ARGS, H5E_BADVALUE, FAIL, - "invalid maximum dimension size"); + "invalid maximum dimension size"); } } } + /* Do it */ + if (H5S_set_extent_simple(space, rank, dims, max)<0) { + HRETURN_ERROR(H5E_DATASPACE, H5E_CANTINIT, FAIL, + "unable to set simple extent"); + } + + FUNC_LEAVE(SUCCEED); +} + + +/*------------------------------------------------------------------------- + * Function: H5S_set_extent_simple + * + * Purpose: This is where the real work happens for + * H5Sset_extent_simple(). + * + * Return: Success: SUCCEED + * + * Failure: FAIL + * + * Programmer: Robb Matzke (copied from H5Sset_extent_simple) + * Wednesday, July 8, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +herr_t +H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, + const hsize_t *max) +{ + FUNC_ENTER(H5S_set_extent_simple, FAIL); + + /* Check args */ + assert(rank>=0); + assert(0==rank || dims); + /* shift out of the previous state to a "simple" dataspace */ switch (space->extent.type) { case H5S_SCALAR: @@ -1107,8 +1147,9 @@ H5Sset_extent_simple (hid_t sid, int rank, const hsize_t *dims, const hsize_t *m HDmemcpy(space->extent.u.simple.max, max, sizeof(hsize_t) * rank); } /* end if */ } - FUNC_LEAVE(ret_value); + FUNC_LEAVE(SUCCEED); } + /*------------------------------------------------------------------------- * Function: H5S_find @@ -1344,6 +1385,7 @@ hid_t H5Screate_simple (int rank, const hsize_t *dims, const hsize_t *maxdims) { hid_t ret_value = FAIL; + H5S_t *space = NULL; int i; FUNC_ENTER(H5Screate, FAIL); @@ -1367,18 +1409,23 @@ H5Screate_simple (int rank, const hsize_t *dims, const hsize_t *maxdims) } } - if((ret_value=H5Screate(H5S_SIMPLE))==FAIL) - HRETURN_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, - "can't create simple dataspace"); - - if(H5Sset_extent_simple(ret_value,rank,dims,maxdims)<0) { - H5Sclose(ret_value); - HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, - "can't set dimensions"); - } /* end if */ - -done: - if (ret_value < 0) { + /* Create the space and set the extent */ + if(NULL==(space=H5S_create(H5S_SIMPLE))) { + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTCREATE, FAIL, + "can't create simple dataspace"); + } + if(H5S_set_extent_simple(space,rank,dims,maxdims)<0) { + HGOTO_ERROR (H5E_DATASPACE, H5E_CANTINIT, FAIL, + "can't set dimensions"); } + + /* Atomize */ + if ((ret_value=H5I_register (H5_DATASPACE, space))<0) { + HGOTO_ERROR (H5E_ATOM, H5E_CANTREGISTER, FAIL, + "unable to register data space atom"); + } + + done: + if (ret_value<0 && space) H5S_close(space); FUNC_LEAVE(ret_value); } |