diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-05 21:25:40 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-10-05 21:25:40 (GMT) |
commit | defe2fb64fd30bbb03391426c56077f9620ccc3c (patch) | |
tree | 6e3ec93e4ef521f7ddab475664e0569186f3ee58 /src/H5A.c | |
parent | c9c54b60413e004032f52c058c97e5734f2574fe (diff) | |
download | hdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.zip hdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.tar.gz hdf5-defe2fb64fd30bbb03391426c56077f9620ccc3c.tar.bz2 |
[svn-r7543] Purpose:
Bug fixes and code cleanup
Description:
Lots of changes here:
- Fixed bug #691 - when shared datatypes are used in attributes they
are incorrectly copied into the attribute instead of referring
the the named datatype in the file. This required bumping the
version of the attribute message. The new version of the attribute
message is only written out when a shared datatype is used in
the attribute. [Also, this format change made the size of the
attribute smaller.]
- Added information to attribute debugging routine so that shared
datatypes are displayed correctly with the h5debug tool.
- Refactored the H5O* routines to extract code that was common to
several routines into subroutines to call.
- Added 'link' method for H5O message sub-classes, which increments
the link count on shared objects when a message is created which
shares them.
- Corrected [unreported] bug where the link count was not being
decremented on the shared object when a object header message
with a reference to that object was deleted from the file.
- Reduced size of shared message from 49 bytes (which was incorrect
anyway and should have been 48 bytes) to 10 bytes, which required
bumping the version of "shared" messages.
- Refactored some of the shared datatype routines to allow for easier
queries of "committedness" internally to the library and also
added routine to easily increment/decrement the reference count of
a shared datatype.
Platforms tested:
FreeBSD 4.9 (sleipnir)
h5committest
Diffstat (limited to 'src/H5A.c')
-rw-r--r-- | src/H5A.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -253,8 +253,22 @@ H5A_create(const H5G_entry_t *ent, const char *name, const H5T_t *type, if (H5G_ent_copy(&(attr->ent),ent,H5G_COPY_DEEP)<0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry"); - /* Compute the internal sizes */ - attr->dt_size=H5O_raw_size(H5O_DTYPE_ID,attr->ent.file,type); + /* Compute the size of pieces on disk */ + if(H5T_committed(attr->dt)) { + H5O_shared_t sh_mesg; + + /* Reset shared message information */ + HDmemset(&sh_mesg,0,sizeof(H5O_shared_t)); + + /* Get shared message information for datatype */ + if (H5O_get_share(H5O_DTYPE_ID,attr->ent.file, type, &sh_mesg/*out*/)<0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to copy entry") + + /* Compute shared message size for datatype */ + attr->dt_size=H5O_raw_size(H5O_SHARED_ID,attr->ent.file,&sh_mesg); + } /* end if */ + else + attr->dt_size=H5O_raw_size(H5O_DTYPE_ID,attr->ent.file,type); assert(attr->dt_size>0); attr->ds_size=H5O_raw_size(H5O_SDSPACE_ID,attr->ent.file,&(space->extent.u.simple)); assert(attr->ds_size>0); |