summaryrefslogtreecommitdiffstats
path: root/src/H5Tarray.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-31 01:50:47 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-31 01:50:47 (GMT)
commit04137b3a16b829589ab28edfc39ba3092a650521 (patch)
tree093b007cd8488655592e547d5630a7190d99c349 /src/H5Tarray.c
parent39106425cf1b2a98296350b287a8dbacb926886b (diff)
downloadhdf5-04137b3a16b829589ab28edfc39ba3092a650521.zip
hdf5-04137b3a16b829589ab28edfc39ba3092a650521.tar.gz
hdf5-04137b3a16b829589ab28edfc39ba3092a650521.tar.bz2
[svn-r7435] Purpose:
Bug Fix and code cleanup Description: Correct error in H5T_detect_class that was causing nested compound datatypes with to not detect the datatype class of fields correctly, which caused errors with fill-values, variable-length datatypes and chunks later on. Return the rank of the array datatype from H5Tget_array_dims(), like H5Sget_dims(). Lots of cleanups to datatype code, to make the handling of arrays, compound types, variable-length strings and sequences and enumerated types more consistent and robust. Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'src/H5Tarray.c')
-rw-r--r--src/H5Tarray.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/H5Tarray.c b/src/H5Tarray.c
index 5d1dc9b..e831499 100644
--- a/src/H5Tarray.c
+++ b/src/H5Tarray.c
@@ -181,10 +181,9 @@ H5T_array_create(H5T_t *base, int ndims, const hsize_t dim[/* ndims */],
ret_value->size = ret_value->parent->size * ret_value->u.array.nelem;
/*
- * Set the "force conversion" flag if a VL base datatype is used or
- * or if any components of the base datatype are VL types.
+ * Set the "force conversion" flag if the base datatype indicates
*/
- if(base->type==H5T_VLEN || base->force_conv==TRUE)
+ if(base->force_conv==TRUE)
ret_value->force_conv=TRUE;
done:
@@ -269,7 +268,7 @@ done:
*
* Purpose: Query the sizes of dimensions for an array datatype.
*
- * Return: Success: Non-negative
+ * Return: Success: Number of dimensions of the array type
* Failure: Negative
*
* Programmer: Quincey Koziol
@@ -279,11 +278,11 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+int
H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[])
{
H5T_t *dt = NULL; /* pointer to array data type */
- herr_t ret_value = SUCCEED; /* return value */
+ int ret_value; /* return value */
FUNC_ENTER_API(H5Tget_array_dims, FAIL);
H5TRACE3("e","i*h*Is",type_id,dims,perm);
@@ -295,7 +294,7 @@ H5Tget_array_dims(hid_t type_id, hsize_t dims[], int perm[])
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an array datatype");
/* Retrieve the sizes of the dimensions */
- if(H5T_get_array_dims(dt, dims, perm)<0)
+ if((ret_value=H5T_get_array_dims(dt, dims, perm))<0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to get dimension sizes");
done:
FUNC_LEAVE_API(ret_value);
@@ -308,7 +307,7 @@ done:
* Purpose: Private function for H5T_get_array_dims. Query the sizes
* of dimensions for an array datatype.
*
- * Return: Success: Non-negative
+ * Return: Success: Number of dimensions of the array type
* Failure: Negative
*
* Programmer: Raymond Lu
@@ -318,10 +317,10 @@ done:
*
*-------------------------------------------------------------------------
*/
-herr_t
+int
H5T_get_array_dims(H5T_t *dt, hsize_t dims[], int perm[])
{
- herr_t ret_value = SUCCEED; /* return value */
+ int ret_value; /* return value */
int i; /* Local index variable */
FUNC_ENTER_NOAPI(H5T_get_array_dims, FAIL);
@@ -339,6 +338,9 @@ H5T_get_array_dims(H5T_t *dt, hsize_t dims[], int perm[])
for(i=0; i<dt->u.array.ndims; i++)
perm[i]=dt->u.array.perm[i];
+ /* Pass along the array rank as the return value */
+ ret_value=dt->u.array.ndims;
+
done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5T_get_array_dims */