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/H5Dlayout.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/H5Dlayout.c')
-rw-r--r-- | src/H5Dlayout.c | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 4966cb5..1c74a66 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -114,6 +114,69 @@ done: /*------------------------------------------------------------------------- + * Function: H5D_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 + * Failure: 0 + * + * Programmer: Raymond Lu + * August 14, 2002 + * + *------------------------------------------------------------------------- + */ +size_t +H5D_layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data) +{ + size_t ret_value; + + FUNC_ENTER_NOAPI_NOINIT(H5D_layout_meta_size) + + /* check args */ + HDassert(f); + HDassert(layout); + + ret_value = 1 + /* Version number */ + 1; /* layout class type */ + + switch(layout->type) { + case H5D_COMPACT: + /* Size of raw data */ + ret_value += 2; + if(include_compact_data) + ret_value += layout->store.u.compact.size;/* data for compact dataset */ + 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(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + ret_value++; + + /* Dimension sizes */ + ret_value += layout->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 H5D_layout_meta_size() */ + + +/*------------------------------------------------------------------------- * Function: H5D_layout_oh_create * * Purpose: Create layout/pline/efl information for dataset |