summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2007-03-10 18:35:25 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2007-03-10 18:35:25 (GMT)
commitbb356fd6d19a796bfab4642bed8fdc75b036638a (patch)
tree8381da471541fe181854407be1461059d5447b42
parenta42a1b15ef2cfd47cc696acf0487c35e07ecdcd3 (diff)
downloadhdf5-bb356fd6d19a796bfab4642bed8fdc75b036638a.zip
hdf5-bb356fd6d19a796bfab4642bed8fdc75b036638a.tar.gz
hdf5-bb356fd6d19a796bfab4642bed8fdc75b036638a.tar.bz2
[svn-r13489] Description:
Make certain to use the later version of the object header format if creation order is tracked on attributes. Tested on: FreeBSD/32 6.2 (duty)
-rw-r--r--src/H5O.c28
-rw-r--r--test/tattr.c30
2 files changed, 34 insertions, 24 deletions
diff --git a/src/H5O.c b/src/H5O.c
index cd961cd..9ac1dd1 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -633,9 +633,11 @@ herr_t
H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
H5O_loc_t *loc/*out*/)
{
+ H5P_genplist_t *oc_plist; /* Object creation property list */
H5O_t *oh = NULL; /* Object header created */
haddr_t oh_addr; /* Address of initial object header */
size_t oh_size; /* Size of initial object header */
+ uint8_t oh_flags; /* Object header's initial status flags */
hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
herr_t ret_value = SUCCEED; /* return value */
@@ -649,31 +651,32 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
/* Make certain we allocate at least a reasonable size for the object header */
size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
+ /* Get the property list */
+ if(NULL == (oc_plist = H5I_object(ocpl_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get any object header status flags set by properties */
+ if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+
/* Allocate the object header and zero out header fields */
if(NULL == (oh = H5FL_CALLOC(H5O_t)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
/* Initialize file-specific information for object header */
store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
- if(H5F_USE_LATEST_FORMAT(f) || store_msg_crt_idx)
+ if(H5F_USE_LATEST_FORMAT(f) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED))
oh->version = H5O_VERSION_LATEST;
else
oh->version = H5O_VERSION_1;
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
+ /* Set initial status flags */
+ oh->flags = oh_flags;
+
/* Initialize version-specific fields */
if(oh->version > H5O_VERSION_1) {
- H5P_genplist_t *oc_plist; /* Object creation property list */
-
- /* Get the property list */
- if(NULL == (oc_plist = H5I_object(ocpl_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get any object header status flags set by properties */
- if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh->flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
-
/* Initialize all time fields with current time, if we are storing them */
if(oh->flags & H5O_HDR_STORE_TIMES)
oh->atime = oh->mtime = oh->ctime = oh->btime = H5_now();
@@ -697,9 +700,6 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
oh->flags |= H5O_HDR_ATTR_STORE_PHASE_CHANGE;
} /* end if */
else {
- /* Flags */
- oh->flags = H5O_CRT_OHDR_FLAGS_DEF;
-
/* Reset unused time fields */
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
} /* end else */
diff --git a/test/tattr.c b/test/tattr.c
index cf8f5d4..897b713 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -4339,8 +4339,10 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
- CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ if(new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ } /* end if */
/* Create datasets */
dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
@@ -4577,8 +4579,10 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
- CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ if(new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ } /* end if */
/* Create datasets */
dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
@@ -5382,8 +5386,10 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
- CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ if(new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ } /* end if */
/* Create datasets */
dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
@@ -5706,8 +5712,10 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
- CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ if(new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ } /* end if */
/* Create datasets */
dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);
@@ -5988,8 +5996,10 @@ test_attr_open(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Set attribute creation order tracking & indexing for object */
- ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
- CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ if(new_format == TRUE) {
+ ret = H5Pset_attr_creation_order(dcpl, (H5P_CRT_ORDER_TRACKED | (use_index ? H5P_CRT_ORDER_INDEXED : (unsigned)0)));
+ CHECK(ret, FAIL, "H5Pset_attr_creation_order");
+ } /* end if */
/* Create datasets */
dset1 = H5Dcreate(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, dcpl);