summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5HF.c14
-rw-r--r--src/H5HFman.c38
-rw-r--r--src/H5HFpkg.h2
3 files changed, 44 insertions, 10 deletions
diff --git a/src/H5HF.c b/src/H5HF.c
index a9750c9..64e8af2 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -439,14 +439,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
/* Check type of object in heap */
if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
- /* Skip over the flag byte */
- id++;
-
- /* Skip over object offset */
- id += fh->hdr->heap_off_size;
-
- /* Retrieve the entry length */
- UINT64DECODE_VAR(id, *obj_len_p, fh->hdr->heap_len_size);
+ if(H5HF_man_get_obj_len(fh->hdr, id, obj_len_p) < 0)
+ HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'managed' object's length")
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
if(H5HF_huge_get_obj_len(fh->hdr, dxpl_id, id, obj_len_p) < 0)
@@ -457,8 +451,8 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
-HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
-HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
+ HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
+ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 62f5580..58e3318 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -218,6 +218,44 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5HF_man_get_obj_len
+ *
+ * Purpose: Get the size of a managed heap object
+ *
+ * Return: SUCCEED (Can't fail)
+ *
+ * Programmer: Dana Robinson (derobins@hdfgroup.org)
+ * August 2012
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
+{
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /*
+ * Check arguments.
+ */
+ HDassert(hdr);
+ HDassert(id);
+ HDassert(obj_len_p);
+
+ /* Skip over the flag byte */
+ id++;
+
+ /* Skip over object offset */
+ id += hdr->heap_off_size;
+
+ /* Retrieve the entry length */
+ UINT64DECODE_VAR(id, *obj_len_p, hdr->heap_len_size);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5HF_man_get_obj_len() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5HF_man_op_real
*
* Purpose: Internal routine to perform an operation on a managed heap
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index 498c45e..e0deca7 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -662,6 +662,8 @@ H5_DLL herr_t H5HF_man_dblock_dest(H5HF_direct_t *dblock);
/* Managed object routines */
H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
const void *obj, void *id);
+H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
+ size_t *obj_len_p);
H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,