summaryrefslogtreecommitdiffstats
path: root/src/H5Sall.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5Sall.c')
-rw-r--r--src/H5Sall.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/H5Sall.c b/src/H5Sall.c
index 24caad2..a9e72fb 100644
--- a/src/H5Sall.c
+++ b/src/H5Sall.c
@@ -510,17 +510,19 @@ H5S_all_serial_size (const H5S_t UNUSED *space)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_all_serialize (const H5S_t *space, uint8_t *buf)
+H5S_all_serialize (const H5S_t *space, uint8_t **p)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
HDassert(space);
+ HDassert(p);
+ HDassert(*p);
/* 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_all_serialize() */
@@ -546,19 +548,42 @@ H5S_all_serialize (const H5S_t *space, uint8_t *buf)
REVISION LOG
--------------------------------------------------------------------------*/
static herr_t
-H5S_all_deserialize(H5S_t *space, const uint8_t UNUSED *buf)
+H5S_all_deserialize(H5S_t **space, const uint8_t **p)
{
- herr_t ret_value; /* return value */
+ H5S_t *tmp_space;
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_NOAPI(FAIL)
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 "all" selection */
- if((ret_value = H5S_select_all(space, TRUE)) < 0)
+ if(H5S_select_all(tmp_space, TRUE) < 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_all_deserialize() */