diff options
-rw-r--r-- | src/H5Distore.c | 5 | ||||
-rw-r--r-- | src/H5Fistore.c | 5 | ||||
-rw-r--r-- | src/H5Fprivate.h | 10 | ||||
-rw-r--r-- | src/H5S.c | 89 | ||||
-rw-r--r-- | src/H5Shyper.c | 1 | ||||
-rw-r--r-- | src/H5Spoint.c | 3 | ||||
-rw-r--r-- | src/H5Sprivate.h | 2 | ||||
-rw-r--r-- | src/H5T.c | 12 | ||||
-rw-r--r-- | src/H5TB.c | 19 | ||||
-rw-r--r-- | src/H5Tconv.c | 7 |
10 files changed, 113 insertions, 40 deletions
diff --git a/src/H5Distore.c b/src/H5Distore.c index a97e542..5e54464 100644 --- a/src/H5Distore.c +++ b/src/H5Distore.c @@ -1758,9 +1758,8 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, { intn i; herr_t status; /*func return status */ - herr_t ret_value=FAIL; /*return value */ - FUNC_ENTER (H5F_istore_get_addr, NULL); + FUNC_ENTER (H5F_istore_get_addr, FAIL); assert(f); assert(layout && (layout->ndims > 0)); @@ -1840,7 +1839,7 @@ printf("Enter %s:\n", FUNC); /* get current dims of dataset */ if ((space_ndims=H5S_get_dims(space, space_dim, NULL)) <= 0 || space_ndims+1 != layout->ndims){ - HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, + HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate chunk storage"); } /* copy the element size over */ diff --git a/src/H5Fistore.c b/src/H5Fistore.c index a97e542..5e54464 100644 --- a/src/H5Fistore.c +++ b/src/H5Fistore.c @@ -1758,9 +1758,8 @@ H5F_istore_get_addr (H5F_t *f, const H5O_layout_t *layout, { intn i; herr_t status; /*func return status */ - herr_t ret_value=FAIL; /*return value */ - FUNC_ENTER (H5F_istore_get_addr, NULL); + FUNC_ENTER (H5F_istore_get_addr, FAIL); assert(f); assert(layout && (layout->ndims > 0)); @@ -1840,7 +1839,7 @@ printf("Enter %s:\n", FUNC); /* get current dims of dataset */ if ((space_ndims=H5S_get_dims(space, space_dim, NULL)) <= 0 || space_ndims+1 != layout->ndims){ - HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, + HRETURN_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate chunk storage"); } /* copy the element size over */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index dcf5e69..0245bd9 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -494,6 +494,9 @@ typedef struct H5F_t { struct H5O_layout_t; /*forward decl for prototype arguments */ struct H5O_efl_t; /*forward decl for prototype arguments */ struct H5O_compress_t; /*forward decl for prototype arguments */ +struct H5F_istore_ud1_t; /*forward decl for prototype arguments */ +struct H5S_t; /*forward decl for prototype arguments */ +struct H5D_t; /*forward decl for prototype arguments */ /* library variables */ extern const H5F_create_t H5F_create_dflt; @@ -540,6 +543,13 @@ herr_t H5F_istore_write(H5F_t *f, const struct H5O_layout_t *layout, const struct H5O_compress_t *comp, const hssize_t offset[], const hsize_t size[], const void *buf); +herr_t H5F_istore_get_addr (H5F_t *f, const struct H5O_layout_t *layout, + const hssize_t offset[], + struct H5F_istore_ud1_t *udata/*out*/); +herr_t H5F_istore_allocate (struct H5D_t *dataset, H5F_t *f, + const struct H5O_layout_t *layout, + const struct H5S_t *space, + const struct H5O_compress_t *comp); /* Functions that operate on contiguous storage wrt boot block */ herr_t H5F_block_read(H5F_t *f, const haddr_t *addr, hsize_t size, @@ -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); } diff --git a/src/H5Shyper.c b/src/H5Shyper.c index e777e6f..757b21c 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -1372,7 +1372,6 @@ printf("%s: check 1.0\n",FUNC); printf("%s: check 2.0\n",FUNC); #endif /* QAK */ -done: FUNC_LEAVE (SUCCEED); } /* H5S_hyper_release() */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 58e5a60..1472489 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -415,14 +415,11 @@ H5S_point_mscat (const void *_tconv_buf, size_t elmt_size, herr_t H5S_point_release (H5S_t *space) { - intn i; /* Counters */ - FUNC_ENTER (H5S_point_release, FAIL); /* Check args */ assert (space); -done: FUNC_LEAVE (SUCCEED); } /* H5S_point_release() */ diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index 2d5a7b3..8aaee07 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -224,6 +224,8 @@ herr_t H5S_select_release (H5S_t *space); herr_t H5S_sel_iter_release (const H5S_t *space,H5S_sel_iter_t *sel_iter); hsize_t H5S_select_npoints (const H5S_t *space); intn H5S_extend (H5S_t *space, const hsize_t *size); +herr_t H5S_set_extent_simple (H5S_t *space, int rank, const hsize_t *dims, + const hsize_t *max); /* Conversion functions for simple data spaces */ size_t H5S_simp_init (const struct H5O_layout_t *layout, @@ -3284,6 +3284,7 @@ H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, H5T_cdata_t *cdata = NULL; /*conversion data */ H5T_conv_t tconv_func = NULL; /*conversion function */ herr_t status; /*func return status */ + H5T_t *src=NULL, *dst=NULL; /*unatomized types */ #ifdef H5T_DEBUG H5_timer_t timer; /*conversion timer */ #endif @@ -3291,7 +3292,16 @@ H5Tconvert (hid_t src_id, hid_t dst_id, size_t nelmts, void *buf, FUNC_ENTER (H5Tconvert, FAIL); H5TRACE5("e","iizxx",src_id,dst_id,nelmts,buf,background); - if (NULL==(tconv_func=H5Tfind (src_id, dst_id, &cdata))) { + /* Check args */ + if (H5_DATATYPE!=H5I_group(src_id) || + NULL==(src=H5I_object(src_id)) || + H5_DATATYPE!=H5I_group(dst_id) || + NULL==(dst=H5I_object(dst_id))) { + HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type"); + } + + /* Find the conversion function */ + if (NULL==(tconv_func=H5T_find (src, dst, H5T_BKG_NO, &cdata))) { HRETURN_ERROR (H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to convert between src and dst data types"); } @@ -168,13 +168,15 @@ herr_t H5TB_close(H5TB_t *tb) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -hid_t H5TBget_buf(hsize_t size, hbool_t resize) +hid_t +H5TBget_buf (hsize_t size, hbool_t resize) { hid_t ret_value = FAIL; H5TB_t *curr=H5TB_list_head, /* pointer to current temp. buffer */ *new; /* pointer to a newly created temp. buffer */ FUNC_ENTER (H5TBget_buf, FAIL); + H5TRACE2("i","hb",size,resize); while(curr!=NULL) { if(!curr->inuse && size<curr->size) @@ -291,7 +293,8 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -void *H5TBbuf_ptr(hid_t tbid) +void * +H5TBbuf_ptr(hid_t tbid) { void *ret_value = NULL; H5TB_t *tbuf; /* Pointer to temporary buffer */ @@ -331,7 +334,8 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5TBresize_ptr(hid_t tbid, hsize_t size) +herr_t +H5TBresize_ptr (hid_t tbid, hsize_t size) { herr_t ret_value = FAIL; H5TB_t *tbuf, /* Pointer to temporary buffer */ @@ -339,6 +343,7 @@ herr_t H5TBresize_ptr(hid_t tbid, hsize_t size) void * old_ptr; /* Pointer to the previous buffer */ FUNC_ENTER (H5TBresize_ptr, FAIL); + H5TRACE2("e","ih",tbid,size); if (H5_TEMPBUF != H5I_group(tbid) || NULL == (tbuf = H5I_object(tbid))) { @@ -420,12 +425,14 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5TBgarbage_coll(void) +herr_t +H5TBgarbage_coll (void) { herr_t ret_value = FAIL; H5TB_t *curr,*next; /* Current temp. buffer node */ FUNC_ENTER (H5TBgarbage_coll, FAIL); + H5TRACE0("e",""); /* Step through the list, remove each unused node, repair the list and free the node */ curr=H5TB_list_head; @@ -479,12 +486,14 @@ done: EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -herr_t H5TBrelease_buf(hid_t tbid) +herr_t +H5TBrelease_buf (hid_t tbid) { herr_t ret_value = FAIL; H5TB_t *tbuf; /* Pointer to temporary buffer */ FUNC_ENTER (H5TBresize_ptr, FAIL); + H5TRACE1("e","i",tbid); if (H5_TEMPBUF != H5I_group(tbid) || NULL == (tbuf = H5I_object(tbid))) { diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 966e910..c940474 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -328,9 +328,10 @@ H5T_conv_struct_init (H5T_t *src, H5T_t *dst, H5T_cdata_t *cdata) for (i=0; i<src->u.compnd.nmembs; i++) { if (priv->src2dst[i]>=0) { - H5T_conv_t tconv_func = H5Tfind (priv->src_memb_id[src2dst[i]], - priv->dst_memb_id[src2dst[i]], - priv->memb_cdata+src2dst[i]); + H5T_conv_t tconv_func; + tconv_func = H5T_find(src->u.compnd.memb[i].type, + dst->u.compnd.memb[src2dst[i]].type, + H5T_BKG_NO, priv->memb_cdata+src2dst[i]); if (!tconv_func) { H5MM_xfree (priv->src2dst); H5MM_xfree (priv->src_memb_id); |