diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-12 04:36:23 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-09-12 04:36:23 (GMT) |
commit | f3e445cfcb4573ce87212cf7046a3f67f36d616f (patch) | |
tree | 3e75cee494b31453d15f66c02d10922b4c10eea1 /src/H5Odtype.c | |
parent | 75471825fde4e55fb23cda381563372bc91795e1 (diff) | |
download | hdf5-f3e445cfcb4573ce87212cf7046a3f67f36d616f.zip hdf5-f3e445cfcb4573ce87212cf7046a3f67f36d616f.tar.gz hdf5-f3e445cfcb4573ce87212cf7046a3f67f36d616f.tar.bz2 |
[svn-r7469] Purpose:
Code cleanup, etc.
Description:
Generalize Ray's datatype fixes to handle packing compound datatypes which
are the base type of an array or variable-length type, etc.
Also track "packedness" of a compound datatype from it's creation, instead
of only setting the 'packed' flag after the datatype was explicitly packed.
Updated docs to reflect that a compound datatype is allowed to grow (but
not shrink).
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'src/H5Odtype.c')
-rw-r--r-- | src/H5Odtype.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 849e0b9..934c113 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -187,6 +187,7 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) */ dt->u.compnd.nmembs = flags & 0xffff; assert(dt->u.compnd.nmembs > 0); + dt->u.compnd.packed = TRUE; /* Start off packed */ dt->u.compnd.nalloc = dt->u.compnd.nmembs; dt->u.compnd.memb = H5MM_calloc(dt->u.compnd.nalloc* sizeof(H5T_cmemb_t)); @@ -278,6 +279,29 @@ H5O_dtype_decode_helper(H5F_t *f, const uint8_t **pp, H5T_t *dt) /* Set the field datatype (finally :-) */ dt->u.compnd.memb[i].type=temp_type; + + /* Check if the datatype stayed packed */ + if(dt->u.compnd.packed) { + /* Check if the member type is packed */ + if(H5T_is_packed(temp_type)>0) { + if(i==0) { + /* If the is the first member, the datatype is not packed + * if the first member isn't at offset 0 + */ + if(dt->u.compnd.memb[i].offset>0) + dt->u.compnd.packed=FALSE; + } /* end if */ + else { + /* If the is not the first member, the datatype is not + * packed if the new member isn't adjoining the previous member + */ + if(dt->u.compnd.memb[i].offset!=(dt->u.compnd.memb[i-1].offset+dt->u.compnd.memb[i-1].size)) + dt->u.compnd.packed=FALSE; + } /* end else */ + } /* end if */ + else + dt->u.compnd.packed=FALSE; + } /* end if */ } break; |