summaryrefslogtreecommitdiffstats
path: root/src/H5Odtype.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-10-27 22:23:49 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-10-27 22:23:49 (GMT)
commit376a788840fe6db1f253a371e3bcde527b4bfd3f (patch)
tree5aff621b28ab1ff02f41b1ea83325b11d287d13f /src/H5Odtype.c
parent597739142f65d71f1ccf9eeeda6568b147e506b5 (diff)
downloadhdf5-376a788840fe6db1f253a371e3bcde527b4bfd3f.zip
hdf5-376a788840fe6db1f253a371e3bcde527b4bfd3f.tar.gz
hdf5-376a788840fe6db1f253a371e3bcde527b4bfd3f.tar.bz2
[svn-r17760] Purpose: Fix problem with H5TB API
Description: The H5TB API makes some improper assumptions about the order of compound datatype members. Namely, it assumes that members remain in the order in which they were inserted. Unfortunately, this assumption is inherent in the design of the interface. The library has been patched so that this assumption holds in situations relevant to H5TB. Tested: jam, linew, amani (h5committest)
Diffstat (limited to 'src/H5Odtype.c')
-rw-r--r--src/H5Odtype.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/src/H5Odtype.c b/src/H5Odtype.c
index a9812690..fc71d65 100644
--- a/src/H5Odtype.c
+++ b/src/H5Odtype.c
@@ -269,9 +269,9 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
*/
dt->shared->u.compnd.nmembs = flags & 0xffff;
HDassert(dt->shared->u.compnd.nmembs > 0);
- dt->shared->u.compnd.packed = TRUE; /* Start off packed */
dt->shared->u.compnd.nalloc = dt->shared->u.compnd.nmembs;
dt->shared->u.compnd.memb = (H5T_cmemb_t *)H5MM_calloc(dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t));
+ dt->shared->u.compnd.memb_size = 0;
if(NULL == dt->shared->u.compnd.memb)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
for(i = 0; i < dt->shared->u.compnd.nmembs; i++) {
@@ -385,6 +385,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Member size */
dt->shared->u.compnd.memb[i].size = temp_type->shared->size;
+ dt->shared->u.compnd.memb_size += temp_type->shared->size;
/* Set the field datatype (finally :-) */
dt->shared->u.compnd.memb[i].type = temp_type;
@@ -400,31 +401,11 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p
/* Update the maximum member position covered */
max_memb_pos = MAX(max_memb_pos, (dt->shared->u.compnd.memb[i].offset + dt->shared->u.compnd.memb[i].size));
-
- /* Check if the datatype stayed packed */
- if(dt->shared->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->shared->u.compnd.memb[i].offset > 0)
- dt->shared->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->shared->u.compnd.memb[i].offset != (dt->shared->u.compnd.memb[i - 1].offset + dt->shared->u.compnd.memb[i - 1].size))
- dt->shared->u.compnd.packed = FALSE;
- } /* end else */
- } /* end if */
- else
- dt->shared->u.compnd.packed = FALSE;
- } /* end if */
} /* end for */
+ /* Check if the compound type is packed */
+ H5T_update_packed(dt);
+
/* Upgrade the compound if requested */
if(version < upgrade_to) {
version = upgrade_to;