summaryrefslogtreecommitdiffstats
path: root/src/H5Odbg.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-11-25 04:10:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-11-25 04:10:32 (GMT)
commit5c1fedcb9003ab614db83a15723bb0fc0389e3c7 (patch)
treeec8d663d5767b75a432d3d91c5cbb0a84db55530 /src/H5Odbg.c
parent2f694358c4c7ae4fa79057ae7d87f95859fbea73 (diff)
downloadhdf5-5c1fedcb9003ab614db83a15723bb0fc0389e3c7.zip
hdf5-5c1fedcb9003ab614db83a15723bb0fc0389e3c7.tar.gz
hdf5-5c1fedcb9003ab614db83a15723bb0fc0389e3c7.tar.bz2
[svn-r12973] Description:
Finish removing library's internal code that uses H5G_get_objinfo() and retarget it at either getting the link information or the object information, as appropriate. (Still need to add user-level tests for H5Oget_info(), but since several internal components of the library depend on the internal version, it appears to be working correctly). Tested on: FreeBSD/32 4.11 (sleipnir) Linux/322.4 (heping) Linux/64 2.4 (mir) AIX/32 5.? (copper) Mac OS X/32 10.4.8 (amazon)
Diffstat (limited to 'src/H5Odbg.c')
-rw-r--r--src/H5Odbg.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 72c6d93..46a7a62 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -93,12 +93,28 @@ H5O_assert(const H5O_t *oh)
{
H5O_mesg_t *curr_msg; /* Pointer to current message to examine */
H5O_mesg_t *tmp_msg; /* Pointer to temporary message to examine */
+ size_t meta_space; /* Size of header metadata */
+ size_t mesg_space; /* Size of message raw data */
+ size_t free_space; /* Size of free space in header */
+ size_t hdr_size; /* Size of header's chunks */
unsigned u, v; /* Local index variables */
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5O_assert)
+ /* Initialize the space tracking variables */
+ hdr_size = 0;
+ meta_space = H5O_SIZEOF_HDR_OH(oh) + (H5O_SIZEOF_CHKHDR_OH(oh) * (oh->nchunks - 1));
+ mesg_space = 0;
+ free_space = 0;
+
/* Loop over all chunks in object header */
for(u = 0; u < oh->nchunks; u++) {
+ /* Accumulate the size of the header on header */
+ hdr_size += oh->chunk[u].size;
+
+ /* If the chunk has a gap, add it to the free space */
+ free_space += oh->chunk[u].gap;
+
/* Check for valid raw data image */
HDassert(oh->chunk[u].image);
HDassert(oh->chunk[u].size > (size_t)H5O_SIZEOF_CHKHDR_OH(oh));
@@ -121,6 +137,16 @@ H5O_assert(const H5O_t *oh)
/* Loop over all messages in object header */
for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) {
+ /* Accumulate information, based on the type of message */
+ if(H5O_NULL_ID == curr_msg->type->id)
+ free_space += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ else if(H5O_CONT_ID == curr_msg->type->id)
+ meta_space += H5O_SIZEOF_MSGHDR_OH(oh) + curr_msg->raw_size;
+ else {
+ meta_space += H5O_SIZEOF_MSGHDR_OH(oh);
+ mesg_space += curr_msg->raw_size;
+ } /* end else */
+
/* Make certain that the message is in a valid chunk */
HDassert(curr_msg->chunkno < oh->nchunks);
@@ -143,6 +169,9 @@ H5O_assert(const H5O_t *oh)
} /* end for */
} /* end for */
+ /* Sanity check that all the bytes are accounted for */
+ HDassert(hdr_size == (free_space + meta_space + mesg_space + oh->skipped_mesg_size));
+
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5O_assert() */
#endif /* H5O_DEBUG */