summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-04-25 23:08:53 (GMT)
committerVailin Choi <vchoi@jam.ad.hdfgroup.org>2017-04-25 23:08:53 (GMT)
commitcb8e82a53d91067b16deba7ebc76307a336b0f02 (patch)
tree88fb7095226155a86b9e8c63c6c621b22b4fe8d5 /src/H5D.c
parent9c30b393163cfaf069aa166ce261034b3010394d (diff)
downloadhdf5-cb8e82a53d91067b16deba7ebc76307a336b0f02.zip
hdf5-cb8e82a53d91067b16deba7ebc76307a336b0f02.tar.gz
hdf5-cb8e82a53d91067b16deba7ebc76307a336b0f02.tar.bz2
Incorporate patch from GE Healthcare (HDFFV-9934)
This is the same patch that had already been integrated to 1.8 branch (pull request #387). Tested on moohan, ostrich, platypus, emu, osx1010test, quail, kituo, mayll.
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/H5D.c b/src/H5D.c
index 6f69ee4..a6de952 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1087,3 +1087,43 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Dget_chunk_index_type() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dget_chunk_storage_size
+ *
+ * Purpose: Returns the size of an allocated chunk.
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Matthew Strong (GE Healthcare)
+ * 20 October 2016
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes)
+{
+ H5D_t *dset = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "i*h*h", dset_id, offset, chunk_nbytes);
+
+ /* Check arguments */
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if( NULL == offset )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ if( NULL == chunk_nbytes )
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if(H5D__get_chunk_storage_size(dset, H5P_DATASET_XFER_DEFAULT, offset, chunk_nbytes) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
+
+done:
+ FUNC_LEAVE_API(ret_value);
+}