From ce05f32a3d33fad5401b6d1d291676771fc300dd Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 28 Nov 2006 23:44:28 -0500 Subject: [svn-r12995] Description: Make the memory size of the max. compact & min. dense attribute storage variables align with the property list size, instead of the size on disk, to better handle big-endian machines. Tested on: FreeBSD/32 4.11 (sleipnir) Linux/32 2.4 (heping) Linux/64 2.4 (mir) AIX/32 5.? (copper) --- src/H5O.c | 8 ++------ src/H5Opkg.h | 4 ++-- test/th5o.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/H5O.c b/src/H5O.c index bcb7e42..913708d 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -4014,13 +4014,9 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl /* Set property values, if they were used for the object */ if(oh->version > H5O_VERSION_1) { - unsigned max_compact = oh->max_compact; /* Alias for setting the max. compact value */ - unsigned min_dense = oh->min_dense; /* Alias for setting the min. dense value */ - - /* Set the property list values with aliases, so the sizes are correct */ - if(H5P_set(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &max_compact) < 0) + if(H5P_set(oc_plist, H5O_CRT_ATTR_MAX_COMPACT_NAME, &oh->max_compact) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set max. # of compact attributes in property list") - if(H5P_set(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &min_dense) < 0) + if(H5P_set(oc_plist, H5O_CRT_ATTR_MIN_DENSE_NAME, &oh->min_dense) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set min. # of dense attributes in property list") } /* end if */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index e8b72e9..b1c4498 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -209,8 +209,8 @@ struct H5O_t { time_t btime; /*birth time */ /* Attribute information (stored, for versions > 1) */ - uint16_t max_compact; /* Maximum # of compact attributes */ - uint16_t min_dense; /* Minimum # of "dense" attributes */ + unsigned max_compact; /* Maximum # of compact attributes */ + unsigned min_dense; /* Minimum # of "dense" attributes */ hsize_t nattrs; /* Number of attributes in the group */ haddr_t attr_fheap_addr; /* Address of fractal heap for storing "dense" attributes */ haddr_t name_bt2_addr; /* Address of v2 B-tree for indexing names of attributes */ diff --git a/test/th5o.c b/test/th5o.c index ad12e30..8d89966 100644 --- a/test/th5o.c +++ b/test/th5o.c @@ -654,6 +654,36 @@ test_h5o_plist(void) ret = H5Sclose(dspace); CHECK(ret, FAIL, "H5Sclose"); + /* Close current creation property lists */ + ret = H5Pclose(gcpl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(dcpl); + CHECK(ret, FAIL, "H5Pclose"); + ret = H5Pclose(tcpl); + CHECK(ret, FAIL, "H5Pclose"); + + /* Retrieve each object's creation property list */ + gcpl = H5Gget_create_plist(grp); + CHECK(gcpl, FAIL, "H5Gget_create_plist"); + tcpl = H5Tget_create_plist(dtype); + CHECK(dcpl, FAIL, "H5Tget_create_plist"); + dcpl = H5Dget_create_plist(dset); + CHECK(dcpl, FAIL, "H5Dget_create_plist"); + + /* Retrieve attribute phase change values on each creation property list and verify */ + ret = H5Pget_attr_phase_change(gcpl, &max_compact, &min_dense); + CHECK(ret, FAIL, "H5Pget_attr_phase_change"); + VERIFY(max_compact, (def_max_compact + 1), "H5Pget_attr_phase_change"); + VERIFY(min_dense, (def_min_dense - 1), "H5Pget_attr_phase_change"); + ret = H5Pget_attr_phase_change(dcpl, &max_compact, &min_dense); + CHECK(ret, FAIL, "H5Pget_attr_phase_change"); + VERIFY(max_compact, (def_max_compact + 1), "H5Pget_attr_phase_change"); + VERIFY(min_dense, (def_min_dense - 1), "H5Pget_attr_phase_change"); + ret = H5Pget_attr_phase_change(tcpl, &max_compact, &min_dense); + CHECK(ret, FAIL, "H5Pget_attr_phase_change"); + VERIFY(max_compact, (def_max_compact + 1), "H5Pget_attr_phase_change"); + VERIFY(min_dense, (def_min_dense - 1), "H5Pget_attr_phase_change"); + /* Close current objects */ ret = H5Pclose(gcpl); CHECK(ret, FAIL, "H5Pclose"); -- cgit v0.12