diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2006-12-18 21:25:05 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2006-12-18 21:25:05 (GMT) |
commit | 5865018c85449e4b03bb3f5d5e7d7948e110fe17 (patch) | |
tree | 6dd73ee04e34cbab435e1027e1a31cfc029f3659 | |
parent | 9769d008b0d610f3dd0bff5f3ef083d01c506c35 (diff) | |
download | hdf5-5865018c85449e4b03bb3f5d5e7d7948e110fe17.zip hdf5-5865018c85449e4b03bb3f5d5e7d7948e110fe17.tar.gz hdf5-5865018c85449e4b03bb3f5d5e7d7948e110fe17.tar.bz2 |
[svn-r13073] Description:
Verify H5Aget_num_attrs() works correctly for new object header format.
Tested on:
Linux/32 2.6 (chicago)
Linux/64 2.6 (chicago2)
-rw-r--r-- | src/H5A.c | 25 | ||||
-rw-r--r-- | src/H5Oattribute.c | 4 | ||||
-rw-r--r-- | test/tattr.c | 6 |
3 files changed, 17 insertions, 18 deletions
@@ -376,38 +376,34 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * datatype and dataspace messages themselves, or the size of the "shared" * messages if either or both of them are shared. */ - if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) == FALSE) - { + if((tri_ret = H5O_msg_is_shared(H5O_DTYPE_ID, attr->dt)) == FALSE) { /* Message wasn't shared after all. Use size of normal datatype * message. */ attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_DTYPE_ID, attr->dt); - } - else if(tri_ret > 0) - { + } /* end if */ + else if(tri_ret > 0) { /* Message is shared. Use size of shared message */ if(NULL == H5O_msg_get_share(H5O_DTYPE_ID, attr->dt, &sh_mesg)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message") attr->dt_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg); - } + } /* end else-if */ else HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't determine if dataspace is shared") /* Perform the same test for the dataspace message */ - if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) == FALSE) - { + if((tri_ret = H5O_msg_is_shared(H5O_SDSPACE_ID, attr->ds)) == FALSE) { /* Message wasn't shared after all. Use size of normal dataspace * message. */ attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SDSPACE_ID, attr->ds); - } - else if(tri_ret > 0) - { + } /* end if */ + else if(tri_ret > 0) { /* Message is shared. Use size of shared message */ if(NULL == H5O_msg_get_share(H5O_SDSPACE_ID, attr->ds, &sh_mesg)) HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't get size of shared message") attr->ds_size = H5O_msg_raw_size(attr->oloc.file, H5O_SHARED_ID, &sh_mesg); - } + } /* end else-if */ else HGOTO_ERROR(H5E_OHDR, H5E_BADMESG, FAIL, "couldn't determine if datatype is shared") @@ -531,6 +527,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Go do the real work for opening the attribute */ +/* XXX: Add support & tests for attributes in dense storage */ if((ret_value = H5A_open(&loc, idx, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to open attribute") @@ -920,9 +917,9 @@ H5A_read(const H5A_t *attr, const H5T_t *mem_type, void *buf, hid_t dxpl_id) /* Create buffer for data to store on disk */ if((snelmts = H5S_GET_EXTENT_NPOINTS(attr->ds)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "dataspace is invalid") - H5_ASSIGN_OVERFLOW(nelmts,snelmts,hssize_t,size_t); + H5_ASSIGN_OVERFLOW(nelmts, snelmts, hssize_t, size_t); - if(nelmts>0) { + if(nelmts > 0) { /* Get the memory and file datatype sizes */ src_type_size = H5T_get_size(attr->dt); dst_type_size = H5T_get_size(mem_type); diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 038bed1..4e1532c 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -268,7 +268,6 @@ HDfprintf(stderr, "%s: converting attributes to dense storage\n", FUNC); udata.dxpl_id = dxpl_id; /* Iterate over existing attributes, moving them to dense storage */ -/* XXX: Test this with shared attributes */ op.lib_op = H5O_attr_to_dense_cb; if(H5O_msg_iterate_real(loc->file, oh, H5O_MSG_ATTR, TRUE, op, &udata, dxpl_id, &oh_flags) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCONVERT, FAIL, "error converting attributes to dense storage") @@ -411,7 +410,6 @@ HDfprintf(stderr, "%s: oh->min_dense = %u\n", FUNC, oh->min_dense); #endif /* QAK */ /* Check for opening attribute with dense storage */ if(H5F_addr_defined(oh->attr_fheap_addr)) { -/* XXX: Need to support/test shared attributes in dense storage */ /* Open attribute in dense storage */ if(NULL == (ret_value = H5A_dense_open(loc->file, dxpl_id, oh, name))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, NULL, "can't open attribute") @@ -1086,7 +1084,6 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) size_t u; /* Local index */ /* Build the table of attributes for this object */ -/* XXX: Test this with shared attributes */ if(H5A_dense_build_table(loc->file, dxpl_id, oh, H5_INDEX_NAME, H5_ITER_NATIVE, &atable) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "error building attribute table") @@ -1155,7 +1152,6 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) /* Check for attributes stored densely */ if(oh->version > H5O_VERSION_1) -/* XXX: test this */ ret_value = (int)oh->nattrs; else { unsigned u; /* Local index variable */ diff --git a/test/tattr.c b/test/tattr.c index 964773e..3e7e73d 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -1927,6 +1927,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl) unsigned min_dense; /* Minimum # of attributes to store "densely" */ htri_t is_dense; /* Are attributes stored densely? */ unsigned u; /* Local index variable */ + int attr_count; /* # of attributes */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1973,6 +1974,11 @@ HDfprintf(stderr, "max_compact = %u, min_dense = %u\n", max_compact, min_dense); /* Close attribute */ ret = H5Aclose(attr); CHECK(ret, FAIL, "H5Aclose"); + + /* Check # of attributes */ + attr_count = H5Aget_num_attrs(dataset); + CHECK(attr_count, FAIL, "H5Aget_num_attrs"); + VERIFY(attr_count, (u + 1), "H5Aget_num_attrs"); } /* end for */ /* Check on dataset's attribute storage status */ |