summaryrefslogtreecommitdiffstats
path: root/src/H5Tstrpad.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-08-31 01:48:01 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-08-31 01:48:01 (GMT)
commitf92d7f73df1846f4489fb6e2c2dd857b636b4deb (patch)
tree74d28cd355a39d0d9f8dc0c96484380b6b12628e /src/H5Tstrpad.c
parentbd3510bea3638d5f4281bf9a6bbfe4c4a8b3ca9a (diff)
downloadhdf5-f92d7f73df1846f4489fb6e2c2dd857b636b4deb.zip
hdf5-f92d7f73df1846f4489fb6e2c2dd857b636b4deb.tar.gz
hdf5-f92d7f73df1846f4489fb6e2c2dd857b636b4deb.tar.bz2
[svn-r7434] 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/H5Tstrpad.c')
-rw-r--r--src/H5Tstrpad.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/H5Tstrpad.c b/src/H5Tstrpad.c
index 27936e7..c9e23f4 100644
--- a/src/H5Tstrpad.c
+++ b/src/H5Tstrpad.c
@@ -62,7 +62,7 @@ H5T_init_strpad_interface(void)
* Fortran left-justifies and space-pads strings. This property
* defines the storage mechanism for the string.
*
- * Return: Success: The character set of an H5T_STRING type.
+ * Return: Success: The character set of a string type.
*
* Failure: H5T_STR_ERROR (Negative)
*
@@ -87,10 +87,9 @@ H5Tget_strpad(hid_t type_id)
/* Check args */
if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_STR_ERROR, "not a data type");
- /* Don't see any reason for this. Causes problem for variable-length
- * string. -SLU (& QAK) */
- /* if (dt->parent) dt = dt->parent;*/ /*defer to parent*/
- if (!(H5T_STRING == dt->type || (H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type)))
+ while (dt->parent && !H5T_IS_STRING(dt))
+ dt = dt->parent; /*defer to parent*/
+ if (!H5T_IS_STRING(dt))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5T_STR_ERROR, "operation not defined for data type class");
/* result */
@@ -151,10 +150,9 @@ H5Tset_strpad(hid_t type_id, H5T_str_t strpad)
HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only");
if (strpad < 0 || strpad >= H5T_NSTR)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "illegal string pad type");
- /* Don't see any reason for this. Causes problem for variable-length
- * string. -SLU (& QAK) */
- /* if (dt->parent) dt = dt->parent;*/ /*defer to parent*/
- if (!(H5T_STRING == dt->type || (H5T_VLEN == dt->type && H5T_VLEN_STRING == dt->u.vlen.type)))
+ while (dt->parent && !H5T_IS_STRING(dt))
+ dt = dt->parent; /*defer to parent*/
+ if (!H5T_IS_STRING(dt))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "operation not defined for data type class");
/* Commit */