summaryrefslogtreecommitdiffstats
path: root/src/H5D.c
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2002-12-02 19:47:57 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2002-12-02 19:47:57 (GMT)
commit437dd9be23c86f8228bcb8b7090189a911cc00ef (patch)
tree759809852985607289214f74b7f827fccad4e746 /src/H5D.c
parent4c546d9e6ee7bae685476df6cd4e627eaab5de12 (diff)
downloadhdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.zip
hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.gz
hdf5-437dd9be23c86f8228bcb8b7090189a911cc00ef.tar.bz2
[svn-r6145]
Purpose: New feature to H5Dget_offset Description: If user block is set, H5Dget_offset should be able to return the absolute offset from the beginning of file. Platforms tested: eirene, arabica
Diffstat (limited to 'src/H5D.c')
-rw-r--r--src/H5D.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/H5D.c b/src/H5D.c
index fcc3013..7485d7e 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -3736,6 +3736,8 @@ haddr_t
H5D_get_offset(H5D_t *dset)
{
haddr_t ret_value;
+ haddr_t base_addr;
+ H5F_t *f;
FUNC_ENTER_NOAPI(H5D_get_offset, HADDR_UNDEF);
@@ -3750,7 +3752,15 @@ H5D_get_offset(H5D_t *dset)
case H5D_CONTIGUOUS:
/* If dataspace hasn't been allocated or dataset is stored in
* an external file, the value will be HADDR_UNDEF. */
- ret_value = dset->layout.addr;
+ f = H5D_get_file(dset);
+ base_addr = H5F_get_base_addr(f);
+
+ /* If there's user block in file, returns the absolute dataset offset
+ * from the beginning of file. */
+ if(base_addr!=HADDR_UNDEF)
+ ret_value = dset->layout.addr + base_addr;
+ else
+ ret_value = dset->layout.addr;
break;
default: