[svn-r2694] Purpose:

Bug fix
Description:
    H5Sget_simple_extent_npoints return type is hsize_t and the error value is
    0, but it is possible to have 0 points in a dataset with an unlimited
    dimension, but no data written yet.
Solution:
    Changed H5Sget_simple_extent_npoints return type to hssize_t and the error
    value to -1
Platforms tested:
    FreeBSD 4.1.1 (hawkwind)
This commit is contained in:
Quincey Koziol 2000-10-18 11:43:40 -05:00
parent 07d218b717
commit 29c5ab73e4
3 changed files with 13 additions and 13 deletions

View File

@ -741,7 +741,7 @@ H5S_copy(const H5S_t *src)
*
* Return: Success: Number of data points in the dataset extent.
*
* Failure: 0
* Failure: negative
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
@ -751,13 +751,13 @@ H5S_copy(const H5S_t *src)
*
*-------------------------------------------------------------------------
*/
hsize_t
hssize_t
H5S_get_simple_extent_npoints(const H5S_t *ds)
{
hsize_t ret_value = 0;
hssize_t ret_value = -1;
intn i;
FUNC_ENTER(H5S_get_simple_extent_npoints, 0);
FUNC_ENTER(H5S_get_simple_extent_npoints, -1);
/* check args */
assert(ds);
@ -774,12 +774,12 @@ H5S_get_simple_extent_npoints(const H5S_t *ds)
break;
case H5S_COMPLEX:
HRETURN_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0,
HRETURN_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, -1,
"complex data spaces are not supported yet");
default:
assert("unknown data space class" && 0);
HRETURN_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, 0,
HRETURN_ERROR(H5E_DATASPACE, H5E_UNSUPPORTED, -1,
"internal error (unknown data space class)");
}
@ -794,7 +794,7 @@ H5S_get_simple_extent_npoints(const H5S_t *ds)
*
* Return: Success: Number of data points in the dataset.
*
* Failure: 0
* Failure: negative
*
* Programmer: Robb Matzke
* Tuesday, December 9, 1997
@ -804,18 +804,18 @@ H5S_get_simple_extent_npoints(const H5S_t *ds)
*
*-------------------------------------------------------------------------
*/
hsize_t
hssize_t
H5Sget_simple_extent_npoints(hid_t space_id)
{
H5S_t *ds = NULL;
hsize_t ret_value = 0;
hssize_t ret_value = -1;
FUNC_ENTER(H5Sget_simple_extent_npoints, 0);
FUNC_ENTER(H5Sget_simple_extent_npoints, -1);
H5TRACE1("h","i",space_id);
/* Check args */
if (H5I_DATASPACE != H5I_get_type(space_id) || NULL == (ds = H5I_object(space_id))) {
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a data space");
HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "not a data space");
}
ret_value = H5S_get_simple_extent_npoints(ds);

View File

@ -200,7 +200,7 @@ __DLL__ H5S_t *H5S_copy(const H5S_t *src);
__DLL__ herr_t H5S_close(H5S_t *ds);
__DLL__ H5S_conv_t *H5S_find(const H5S_t *mem_space, const H5S_t *file_space);
__DLL__ H5S_class_t H5S_get_simple_extent_type(const H5S_t *ds);
__DLL__ hsize_t H5S_get_simple_extent_npoints(const H5S_t *ds);
__DLL__ hssize_t H5S_get_simple_extent_npoints(const H5S_t *ds);
__DLL__ hsize_t H5S_get_npoints_max(const H5S_t *ds);
__DLL__ intn H5S_get_simple_extent_ndims(const H5S_t *ds);
__DLL__ intn H5S_get_simple_extent_dims(const H5S_t *ds, hsize_t dims[]/*out*/,

View File

@ -60,7 +60,7 @@ __DLL__ herr_t H5Sset_extent_simple(hid_t space_id, int rank,
const hsize_t max[]);
__DLL__ hid_t H5Scopy(hid_t space_id);
__DLL__ herr_t H5Sclose(hid_t space_id);
__DLL__ hsize_t H5Sget_simple_extent_npoints(hid_t space_id);
__DLL__ hssize_t H5Sget_simple_extent_npoints(hid_t space_id);
__DLL__ int H5Sget_simple_extent_ndims(hid_t space_id);
__DLL__ int H5Sget_simple_extent_dims(hid_t space_id, hsize_t dims[],
hsize_t maxdims[]);