diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 19:17:09 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2004-10-05 19:17:09 (GMT) |
commit | ae6956a76362d619f41318c19792a4e0c7b9d529 (patch) | |
tree | a307ad8c663e7ffaa2b2050c3e15f0dbaf7c1571 /src/H5T.c | |
parent | 1f8687691d6620473440d745ea6cbe9e16b3d3c1 (diff) | |
download | hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.zip hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.tar.gz hdf5-ae6956a76362d619f41318c19792a4e0c7b9d529.tar.bz2 |
[svn-r9367] Purpose: feature change
Description: Prevent create datatype of size 0
Platforms tested: heping(simple change)
Diffstat (limited to 'src/H5T.c')
-rw-r--r-- | src/H5T.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1356,8 +1356,8 @@ H5Tcreate(H5T_class_t type, size_t size) FUNC_ENTER_API(H5Tcreate, FAIL); H5TRACE2("i","Ttz",type,size); - /* check args. We start to support size adjustment for compound type. */ - if (size == 0 && type != H5T_COMPOUND) + /* check args */ + if (size == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid size"); /* create the type */ @@ -1960,6 +1960,8 @@ H5Tset_size(hid_t type_id, size_t size) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not allowed after members are defined"); if (H5T_REFERENCE==dt->shared->type) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for this datatype"); + if (size==0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't adjust size to 0"); /* Do the work */ if (H5T_set_size(dt, size)<0) |