summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/h5dump/h5dump.c4
-rw-r--r--tools/h5dump/testh5dump.sh.in3
-rw-r--r--tools/lib/h5tools_str.c12
-rw-r--r--tools/testfiles/tregref.ddl32
4 files changed, 42 insertions, 9 deletions
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index 1a61197..8386551 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -158,7 +158,7 @@ static h5tool_format_t dataformat = {
" "H5_PRINTF_HADDR_FMT, /*obj_format */
1, /*dset_hidefileno */
- "DATASET "H5_PRINTF_HADDR_FMT" ", /*dset_format */
+ "DATASET %s ", /*dset_format */
"%s", /*dset_blockformat_pre */
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
@@ -242,7 +242,7 @@ static h5tool_format_t xml_dataformat = {
" "H5_PRINTF_HADDR_FMT, /*obj_format */
1, /*dset_hidefileno */
- "DATASET "H5_PRINTF_HADDR_FMT" ", /*dset_format */
+ "DATASET %s ", /*dset_format */
"%s", /*dset_blockformat_pre */
"%s", /*dset_ptformat_pre */
"%s", /*dset_ptformat */
diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in
index 4c6414d..da1e1dd 100644
--- a/tools/h5dump/testh5dump.sh.in
+++ b/tools/h5dump/testh5dump.sh.in
@@ -338,6 +338,9 @@ TOOLTEST tbin4.ddl -d double -o out4.bin -b FILE tbinary.h5
rm -f $srcdir/../testfiles/out[1-4].bin
fi
+# test for dataset region references
+TOOLTEST tregref.ddl tdatareg.h5
+
if test $nerrors -eq 0 ; then
echo "All $DUMPER tests passed."
fi
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index a1cfc83..3fe629c 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -844,17 +844,15 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
if (h5tools_is_zero(vp, H5Tget_size(type))) {
h5tools_str_append(str, "NULL");
} else {
- haddr_t objno; /* Compact form of object's location */
+ char name[1024];
obj = H5Rdereference(container, H5R_DATASET_REGION, vp);
region = H5Rget_region(container, H5R_DATASET_REGION, vp);
H5Gget_objinfo(obj, ".", FALSE, &sb);
-
- objno = (haddr_t)sb.objno[0] | ((haddr_t)sb.objno[1] << (8 * sizeof(long)));
- if (info->dset_hidefileno)
- h5tools_str_append(str, info->dset_format, objno);
- else
- h5tools_str_append(str, info->dset_format, sb.fileno[0], objno);
+
+ /* get name of the dataset the region reference points to using H5Rget_name */
+ H5Rget_name(obj, H5R_DATASET_REGION, vp, (char*)name, 1024);
+ h5tools_str_append(str, info->dset_format, name);
h5tools_str_dump_region(str, region, info);
H5Sclose(region);
diff --git a/tools/testfiles/tregref.ddl b/tools/testfiles/tregref.ddl
new file mode 100644
index 0000000..32a1601
--- /dev/null
+++ b/tools/testfiles/tregref.ddl
@@ -0,0 +1,32 @@
+#############################
+Expected output for 'h5dump tdatareg.h5'
+#############################
+HDF5 "tdatareg.h5" {
+GROUP "/" {
+ DATASET "Dataset1" {
+ DATATYPE H5T_REFERENCE
+ DATASPACE SIMPLE { ( 4 ) / ( 4 ) }
+ DATA {
+ (0): DATASET /Dataset2 {(2,2)-(7,7)}, DATASET /Dataset2 {(6,9), (2,2),
+ (1): (8,4), (1,6), (2,8), (3,2), (0,4), (9,0), (7,1), (3,3)}, NULL,
+ (3): NULL
+ }
+ }
+ DATASET "Dataset2" {
+ DATATYPE H5T_STD_U8BE
+ DATASPACE SIMPLE { ( 10, 10 ) / ( 10, 10 ) }
+ DATA {
+ (0,0): 0, 3, 6, 9, 12, 15, 18, 21, 24, 27,
+ (1,0): 30, 33, 36, 39, 42, 45, 48, 51, 54, 57,
+ (2,0): 60, 63, 66, 69, 72, 75, 78, 81, 84, 87,
+ (3,0): 90, 93, 96, 99, 102, 105, 108, 111, 114, 117,
+ (4,0): 120, 123, 126, 129, 132, 135, 138, 141, 144, 147,
+ (5,0): 150, 153, 156, 159, 162, 165, 168, 171, 174, 177,
+ (6,0): 180, 183, 186, 189, 192, 195, 198, 201, 204, 207,
+ (7,0): 210, 213, 216, 219, 222, 225, 228, 231, 234, 237,
+ (8,0): 240, 243, 246, 249, 252, 255, 2, 5, 8, 11,
+ (9,0): 14, 17, 20, 23, 26, 29, 32, 35, 38, 41
+ }
+ }
+}
+}