diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 1999-07-17 23:59:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 1999-07-17 23:59:54 (GMT) |
commit | 9b50a916c5b0f71cee33cdd040e074bd6f0d3c83 (patch) | |
tree | 44eb45f596b5d5391f2503690a576fc121d385f3 /src/H5Tvlen.c | |
parent | e6fc1366cb7b7b89deedac35d39981318574bbb5 (diff) | |
download | hdf5-9b50a916c5b0f71cee33cdd040e074bd6f0d3c83.zip hdf5-9b50a916c5b0f71cee33cdd040e074bd6f0d3c83.tar.gz hdf5-9b50a916c5b0f71cee33cdd040e074bd6f0d3c83.tar.bz2 |
[svn-r1506] Bug fixes to get VL datatype fields in compound datatypes working. Also, some
memory leaks plugged in other routines.
Diffstat (limited to 'src/H5Tvlen.c')
-rw-r--r-- | src/H5Tvlen.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index c9d0e35..ce4b342 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -506,7 +506,7 @@ H5T_vlen_mark(H5T_t *dt, H5F_t *f, H5T_vlen_type_t loc) size_t old_size; /* Preview size of a field */ /* Sort the fields based on offsets */ - qsort(dt->u.compnd.memb, dt->u.compnd.nmembs, sizeof(H5T_cmemb_t), H5T_cmp_field_off); + H5T_sort_value(dt,NULL); for (i=0; i<dt->u.compnd.nmembs; i++) { /* Apply the accumulated size change to the offset of the field */ @@ -521,9 +521,14 @@ H5T_vlen_mark(H5T_t *dt, H5F_t *f, H5T_vlen_type_t loc) if(H5T_vlen_mark(dt->u.compnd.memb[i].type,f,loc)<0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); - /* If the field changed size, add that change to the accumulated size change */ - if(old_size != dt->u.compnd.memb[i].type->size) + /* Check if the field changed size */ + if(old_size != dt->u.compnd.memb[i].type->size) { + /* Adjust the size of the member */ + dt->u.compnd.memb[i].size = (dt->u.compnd.memb[i].size*dt->u.compnd.memb[i].type->size)/old_size; + + /* Add that change to the accumulated size change */ accum_change += (dt->u.compnd.memb[i].type->size - (int)old_size); + } /* end if */ } /* end if */ } /* end for */ |