diff options
author | Neil Fortner <nfortne2@hdfgroup.org> | 2015-02-10 19:58:09 (GMT) |
---|---|---|
committer | Neil Fortner <nfortne2@hdfgroup.org> | 2015-02-10 19:58:09 (GMT) |
commit | 14200fef675e0c1732d84ae7e06e81a812bd5e99 (patch) | |
tree | 6b89eff81087652d65dc62f55689861a268f88dc /src/H5Snone.c | |
parent | 055348122df2be0c6ec519f9c29e2dad96c19ece (diff) | |
download | hdf5-14200fef675e0c1732d84ae7e06e81a812bd5e99.zip hdf5-14200fef675e0c1732d84ae7e06e81a812bd5e99.tar.gz hdf5-14200fef675e0c1732d84ae7e06e81a812bd5e99.tar.bz2 |
[svn-r26153] INCOMPLETE, UNWORKING CODE
Commit progress through 2/10/15 at 1500 CST
Diffstat (limited to 'src/H5Snone.c')
-rw-r--r-- | src/H5Snone.c | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/H5Snone.c b/src/H5Snone.c index 3c5eccc..a6c870a 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -478,17 +478,17 @@ H5S_none_serial_size(const H5S_t UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_serialize(const H5S_t *space, uint8_t *buf) +H5S_none_serialize(const H5S_t *space, uint8_t **p) { FUNC_ENTER_NOAPI_NOINIT_NOERR HDassert(space); /* Store the preamble information */ - UINT32ENCODE(buf, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(buf, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(buf, (uint32_t)0); /* Store the un-used padding */ - UINT32ENCODE(buf, (uint32_t)0); /* Store the additional information length */ + UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_serialize() */ @@ -514,19 +514,41 @@ H5S_none_serialize(const H5S_t *space, uint8_t *buf) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_none_deserialize(H5S_t *space, const uint8_t UNUSED *buf) +H5S_none_deserialize(H5S_t **space, const uint8_t **p) { + H5S_t *tmp_space; herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT HDassert(space); + HDassert(p); + HDassert(*p); + + /* Allocate space if not provided */ + if(!*space) { + if(NULL == (tmp_space = H5S_create(H5S_SIMPLE))) + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTCREATE, FAIL, "can't create dataspace") + } /* end if */ + else + tmp_space = *space; + + /* Skip over the remainder of the header */ + *p += 12; /* Change to "none" selection */ - if(H5S_select_none(space) < 0) + if(H5S_select_none(tmp_space) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") + if(!*space) + *space = tmp_space; + done: + /* Free temporary space if not passed to caller (only happens on error) */ + if(!*space && tmp_space) + if(H5S_close(tmp_space) < 0) + HDONE_ERROR(H5E_DATASPACE, H5E_CANTFREE, FAIL, "can't close dataspace") + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_none_deserialize() */ |