diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-30 02:34:54 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-07-30 02:34:54 (GMT) |
commit | ccc0d85878139e0d00a9376af719ca0ee2bea585 (patch) | |
tree | 6c6edd2444b4312228460e6eb70066798da8b1d8 /src/H5Olayout.c | |
parent | e99906f5175e1516a9f28b3acbcffd962637ca89 (diff) | |
download | hdf5-ccc0d85878139e0d00a9376af719ca0ee2bea585.zip hdf5-ccc0d85878139e0d00a9376af719ca0ee2bea585.tar.gz hdf5-ccc0d85878139e0d00a9376af719ca0ee2bea585.tar.bz2 |
[svn-r17269] Description:
Refactor how serialized size of layout message is computed, slightly.
Tested on:
Mac OS X/32 10.5.7 (amazon) debug & production
FreeBSD/32 6.3 (duty) debug
Too minor to require h5committest
Diffstat (limited to 'src/H5Olayout.c')
-rw-r--r-- | src/H5Olayout.c | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 0f9370a..8c3e266 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -430,9 +430,9 @@ H5O_layout_size(const H5F_t *f, hbool_t UNUSED disable_shared, const void *_mesg HDassert(f); HDassert(mesg); - ret_value = H5O_layout_meta_size(f, mesg); - if(H5D_COMPACT == mesg->type) - ret_value += mesg->store.u.compact.size;/* data for compact dataset */ + /* Compute serialized size */ + /* (including possibly compact data) */ + ret_value = H5D_layout_meta_size(f, mesg, TRUE); FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_layout_size() */ @@ -740,66 +740,3 @@ H5O_layout_debug(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *_mesg, FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_layout_debug() */ - -/*------------------------------------------------------------------------- - * Function: H5O_layout_meta_size - * - * Purpose: Returns the size of the raw message in bytes except raw data - * part for compact dataset. This function doesn't take into - * account message alignment. - * - * Return: Success: Message data size in bytes(except raw data - * for compact dataset) - * Failure: 0 - * - * Programmer: Raymond Lu - * August 14, 2002 - * - *------------------------------------------------------------------------- - */ -size_t -H5O_layout_meta_size(const H5F_t *f, const void *_mesg) -{ - const H5O_layout_t *mesg = (const H5O_layout_t *) _mesg; - size_t ret_value; - - FUNC_ENTER_NOAPI_NOINIT(H5O_layout_meta_size) - - /* check args */ - HDassert(f); - HDassert(mesg); - - ret_value = 1 + /* Version number */ - 1; /* layout class type */ - - switch(mesg->type) { - case H5D_COMPACT: - /* Size of raw data */ - ret_value += 2; - break; - - case H5D_CONTIGUOUS: - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ - ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ - break; - - case H5D_CHUNKED: - /* Number of dimensions (1 byte) */ - HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - ret_value++; - - /* Dimension sizes */ - ret_value += mesg->u.chunk.ndims * 4; - - /* B-tree address */ - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ - break; - - default: - HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid layout class") - } /* end switch */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5O_layout_meta_size() */ - |