From d51c454c82435bf316423e53b6ebc72d6aa079c8 Mon Sep 17 00:00:00 2001 From: Robb Matzke Date: Wed, 28 Jan 1998 23:11:58 -0500 Subject: [svn-r194] Changes since 19980128 ---------------------- ./src/H5P.c Removed H5Pcreate() ./src/H5Psimp.c Copy int[] return value from H5P_get_hyperslab() to size_t[] argument to pass to other hyperslab functions. ./test/dsets.c Added a call to H5Eprint() to help track down Alberts O2k bug. --- src/H5P.c | 84 ++++++++++--------------------------------------------- src/H5Ppublic.h | 5 +--- src/H5Psimp.c | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- test/dsets.c | 4 +++ 4 files changed, 104 insertions(+), 76 deletions(-) diff --git a/src/H5P.c b/src/H5P.c index 5ecdbc6..08b4679 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -133,67 +133,6 @@ H5Pcreate_simple(int rank, size_t dims[]) FUNC_LEAVE(ret_value); } -#ifdef OLD_WAY -/*------------------------------------------------------------------------- - * Function: H5Pcreate - * - * Purpose: Creates a new data space object and opens it for access. - * - * Return: Success: The ID for the new data space object. - * - * Failure: FAIL - * - * Errors: - * - * Programmer: Robb Matzke - * Tuesday, December 9, 1997 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hid_t -H5Pcreate(H5P_class_t type) -{ - H5P_t *ds = NULL; - hid_t ret_value = FAIL; - - FUNC_ENTER(H5Pcreate, FAIL); - - ds = H5MM_xcalloc(1, sizeof(H5P_t)); - ds->type = type; - - switch (type) { - case H5P_SCALAR: - /*void */ - break; - - case H5P_SIMPLE: - ds->u.simple.rank = 0; - break; - - case H5P_COMPLEX: - HGOTO_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, FAIL, - "complex types are not supported yet"); - - default: - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, - "unknown data space type"); - } - - /* Register the new data space and get an ID for it */ - if ((ret_value = H5A_register(H5_DATASPACE, ds)) < 0) { - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, - "unable to register data space for ID"); - } - done: - if (ret_value < 0) { - H5MM_xfree(ds); - } - FUNC_LEAVE(ret_value); -} -#endif /* OLD_WAY */ - /*------------------------------------------------------------------------- * Function: H5Pclose * @@ -1026,11 +965,13 @@ H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *st if (H5_DATASPACE != H5A_group(sid) || (space = H5A_object(sid)) == NULL) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "not a data space"); if (start == NULL || count==NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid hyperslab selected"); + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, + "invalid hyperslab selected"); /* We can't modify other types of dataspaces currently, so error out */ if (space->type!=H5P_SIMPLE) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL,"unknown dataspace type"); + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, + "unknown dataspace type"); /* Set up stride values for later use */ tmp_stride= H5MM_xmalloc(space->u.simple.rank*sizeof(intn)); @@ -1039,13 +980,16 @@ H5Pset_hyperslab(hid_t sid, const intn *start, const intn *count, const intn *st } /* Range check arguments */ - for(u=0; uu.simple.rank; u++) - { - if(start[u]<0 || start[u]>=space->u.simple.size[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,"hyperslab bounds out of range"); - if(start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])<0 || start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])>=space->u.simple.size[u]) - HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL,"hyperslab bounds out of range"); - } /* end for */ + for (u=0; uu.simple.rank; u++) { + if (start[u]<0 || start[u]>=space->u.simple.size[u]) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "hyperslab bounds out of range"); + if (start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])<0 || + (start[u]+(SIGN(count[u])*(ABS(count[u])-1)*tmp_stride[u])>= + space->u.simple.size[u])) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADRANGE, FAIL, + "hyperslab bounds out of range"); + } /* end for */ /* Allocate space for the hyperslab information */ if (NULL==space->h.start) { diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 9d78784..f76e0e7 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -36,9 +36,6 @@ extern "C" { #endif /* Functions in H5P.c */ -#ifdef OLD_WAY -hid_t H5Pcreate (H5P_class_t type); -#endif /* OLD_WAY */ hid_t H5Pcreate_simple (int rank, size_t dims[]); herr_t H5Pclose (hid_t space_id); size_t H5Pget_npoints (hid_t space_id); @@ -49,7 +46,7 @@ herr_t H5Pset_space (hid_t space_id, int rank, const size_t *dims); herr_t H5Pset_hyperslab(hid_t sid, const int *start, const int *count, const int *stride); int H5Pget_hyperslab (hid_t sid, int offset[]/*out*/, - int size[]/*out*/, int stride[]/*out*/); + int size[]/*out*/, int stride[]/*out*/); #ifdef __cplusplus } diff --git a/src/H5Psimp.c b/src/H5Psimp.c index 89e576c..db51bb5 100644 --- a/src/H5Psimp.c +++ b/src/H5Psimp.c @@ -93,6 +93,11 @@ H5P_simp_fgath (H5F_t *f, const struct H5O_layout_t *layout, size_t hsize[H5O_LAYOUT_NDIMS]; /*size of hyperslab */ size_t zero[H5O_LAYOUT_NDIMS]; /*zero */ size_t sample[H5O_LAYOUT_NDIMS]; /*hyperslab sampling */ +#ifndef LATER + intn file_offset_signed[H5O_LAYOUT_NDIMS]; + intn hsize_signed[H5O_LAYOUT_NDIMS]; + intn sample_signed[H5O_LAYOUT_NDIMS]; +#endif intn space_ndims; /*dimensionality of space*/ intn i; /*counters */ @@ -120,12 +125,27 @@ H5P_simp_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=H5P_get_hyperslab (file_space, file_offset, hsize, - sample))<0) { +#ifdef LATER + if ((space_ndims=H5P_get_hyperslab (file_space, file_offset, + hsize, sample))<0) { + HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, + "unable to retrieve hyperslab parameters"); +#else + if ((space_ndims=H5P_get_hyperslab (file_space, file_offset_signed, + hsize_signed, sample_signed))<0) { HRETURN_ERROR (H5E_DATASPACE, H5E_CANTINIT, 0, "unable to retrieve hyperslab parameters"); } for (i=0; i=0); + file_offset[i] = file_offset_signed[i]; + assert (hsize_signed[i]>0); + hsize[i] = hsize_signed[i]; + assert (sample_signed[i]>0); + sample[i] = sample_signed[i]; + } +#endif + for (i=0; i=0); + mem_offset[i] = mem_offset_signed[i]; + assert (hsize_signed[i]>0); + hsize[i] = hsize_signed[i]; + assert (sample_signed[i]>0); + sample[i] = sample_signed[i]; + } +#endif for (i=0; i=0); + mem_offset[i] = mem_offset_signed[i]; + assert (hsize_signed[i]>0); + hsize[i] = hsize_signed[i]; + assert (sample_signed[i]>0); + sample[i] = sample_signed[i]; + } +#endif for (i=0; i=0); + file_offset[i] = file_offset_signed[i]; + assert (hsize_signed[i]>0); + hsize[i] = hsize_signed[i]; + assert (sample_signed[i]>0); + sample[i] = sample_signed[i]; + } +#endif for (i=0; i #include +#include + + #ifndef HAVE_FUNCTION #define __FUNCTION__ "" #endif @@ -304,6 +307,7 @@ test_tconv(hid_t file) /* Write the data to the dataset */ status = H5Dwrite(dataset, H5T_NATIVE_INT32, H5P_ALL, H5P_ALL, H5C_DEFAULT, out); + if (status<0) H5Eprint (H5E_thrdid_g, stdout); assert(status >= 0); /* Create a new type with the opposite byte order */ -- cgit v0.12