diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-31 01:48:01 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-08-31 01:48:01 (GMT) |
commit | f92d7f73df1846f4489fb6e2c2dd857b636b4deb (patch) | |
tree | 74d28cd355a39d0d9f8dc0c96484380b6b12628e /src/H5Odtype.c | |
parent | bd3510bea3638d5f4281bf9a6bbfe4c4a8b3ca9a (diff) | |
download | hdf5-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/H5Odtype.c')
-rw-r--r-- | src/H5Odtype.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 1e70ff9..d6de6f6 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -273,10 +273,6 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) if(temp_type->force_conv==TRUE) dt->force_conv=TRUE; - /* Set the "has array" flag if array datatype fields exist in this type */ - if(temp_type->type==H5T_ARRAY) - dt->u.compnd.has_array=TRUE; - /* Member size */ dt->u.compnd.memb[i].size = temp_type->size; @@ -435,6 +431,7 @@ done: static herr_t H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) { + htri_t has_array=FALSE; /* Whether a compound datatype has an array inside it */ unsigned flags = 0; char *hdr = (char *)*pp; int i, j; @@ -624,6 +621,10 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) break; case H5T_COMPOUND: + /* Check for an array datatype somewhere within the compound type */ + if((has_array=H5T_detect_class(dt,H5T_ARRAY))<0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't detect array class"); + /* * Compound data types... */ @@ -644,7 +645,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) * member information, for better backward compatibility * Write out all zeros for the array information, though... */ - if(!dt->u.compnd.has_array) { + if(!has_array) { /* Dimensionality */ *(*pp)++ = 0; @@ -768,7 +769,7 @@ H5O_dtype_encode_helper(uint8_t **pp, const H5T_t *dt) } /* Encode the type's class, version and bit field */ - *hdr++ = ((unsigned)(dt->type) & 0x0f) | (((dt->type==H5T_COMPOUND && dt->u.compnd.has_array) ? H5O_DTYPE_VERSION_UPDATED : H5O_DTYPE_VERSION_COMPAT )<<4); + *hdr++ = ((unsigned)(dt->type) & 0x0f) | (((dt->type==H5T_COMPOUND && has_array) ? H5O_DTYPE_VERSION_UPDATED : H5O_DTYPE_VERSION_COMPAT )<<4); *hdr++ = (flags >> 0) & 0xff; *hdr++ = (flags >> 8) & 0xff; *hdr++ = (flags >> 16) & 0xff; |