summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-10-05 18:36:03 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-10-05 18:36:03 (GMT)
commitd595bab80e5932009c0ff626ddc75f1346fcef1e (patch)
treede9204ddd68494fe85e86ce36a5c576381c82bb5 /src
parent7ba45c05b3e9345bc8d77a5d205bb41086b78f1e (diff)
downloadhdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.zip
hdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.tar.gz
hdf5-d595bab80e5932009c0ff626ddc75f1346fcef1e.tar.bz2
[svn-r9366]
Purpose: feature change Description: Prevent creating datatype of size 0. Platforms tested: fuss(simple change)
Diffstat (limited to 'src')
-rw-r--r--src/H5T.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/H5T.c b/src/H5T.c
index d901b98..9662983 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -1453,8 +1453,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 */
@@ -2024,6 +2024,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)