summaryrefslogtreecommitdiffstats
path: root/src/H5Ocache.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-10-23 10:15:52 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-10-23 10:15:52 (GMT)
commit1202e83013bdbce9592d0bd70f41e84c83f6c2d5 (patch)
treec7926ea2ecc426f8cc1f31960d0c31c02bfd08dc /src/H5Ocache.c
parent8ee7c55feaf099695eb3b25cc9eda3ee5885a7bc (diff)
downloadhdf5-1202e83013bdbce9592d0bd70f41e84c83f6c2d5.zip
hdf5-1202e83013bdbce9592d0bd70f41e84c83f6c2d5.tar.gz
hdf5-1202e83013bdbce9592d0bd70f41e84c83f6c2d5.tar.bz2
[svn-r12801] Description:
Fix several errors in the "latest version" of the object header format changes and enable the new version when requested now. Clean up several confusing or duplicated sections of code. Tested on: Linux/32 2.4 (heping) Linux/64 2.4 (mir) FreeBSD/32 4.11 (sleipnir)
Diffstat (limited to 'src/H5Ocache.c')
-rw-r--r--src/H5Ocache.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 1ac9550..b2e64ab 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -357,7 +357,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Check for magic # on chunks > 0 in later versions of the format */
if(chunkno > 0 && oh->version > H5O_VERSION_1) {
/* Magic number */
- if(!HDmemcmp(p, H5O_CHK_MAGIC, (size_t)H5O_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5O_CHK_MAGIC, (size_t)H5O_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "wrong object header chunk signature")
p += H5O_SIZEOF_MAGIC;
} /* end if */
@@ -493,15 +493,18 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
if((oh->nmesgs + skipped_msgs + merged_null_msgs) != nmesgs)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "corrupt object header - too few messages")
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
/* Set return value */
ret_value = oh;
done:
/* Release the [possibly partially initialized] object header on errors */
- if(!ret_value && oh) {
+ if(!ret_value && oh)
if(H5O_dest(f,oh) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "unable to destroy object header data")
- } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_load() */
@@ -543,6 +546,10 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_t *
uint8_t *p; /* Pointer to object header prefix buffer */
unsigned u; /* Local index variable */
+#ifdef H5O_DEBUG
+H5O_assert(oh);
+#endif /* H5O_DEBUG */
+
/* Point to raw data 'image' for first chunk, which has room for the prefix */
p = oh->chunk[0].image;
@@ -552,7 +559,7 @@ H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_t *
* modified */
if(oh->version > H5O_VERSION_1) {
/* Verify magic number */
- HDassert(!HDmemcmp(oh->chunk[0].image, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC));
+ HDassert(!HDmemcmp(p, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC));
p += H5O_SIZEOF_MAGIC;
/* Version */