summaryrefslogtreecommitdiffstats
path: root/tools/h5ls
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2017-08-23 13:58:06 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2017-08-23 13:58:06 (GMT)
commit2bd8e1053b89e0348364f951a58449f16aa72da7 (patch)
treeaa787d2139ada836f7064c43b581a81c5dc8d193 /tools/h5ls
parente4299d463efa0736bc51513b15827e58046cc061 (diff)
downloadhdf5-2bd8e1053b89e0348364f951a58449f16aa72da7.zip
hdf5-2bd8e1053b89e0348364f951a58449f16aa72da7.tar.gz
hdf5-2bd8e1053b89e0348364f951a58449f16aa72da7.tar.bz2
HDFFV-10188 merge fix and tests from develop
Diffstat (limited to 'tools/h5ls')
-rw-r--r--tools/h5ls/CMakeTests.cmake7
-rw-r--r--tools/h5ls/h5ls.c62
-rw-r--r--tools/h5ls/testh5ls.sh.in5
3 files changed, 44 insertions, 30 deletions
diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake
index 343949a..378781c 100644
--- a/tools/h5ls/CMakeTests.cmake
+++ b/tools/h5ls/CMakeTests.cmake
@@ -33,6 +33,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/textlinktar.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.h5
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrpnullspace.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tloop.h5
${HDF5_TOOLS_SRC_DIR}/testfiles/tnestedcomp.h5
@@ -88,6 +89,7 @@
${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-2.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tgroup-3.ls
+ ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrpnullspace.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/thlink-1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tloop-1.ls
${HDF5_TOOLS_SRC_DIR}/testfiles/tmultifile.ls
@@ -239,6 +241,8 @@
textlinksrc-7-old.out.err
tgrp_comments.out
tgrp_comments.out.err
+ tgrpnullspace.out
+ tgrpnullspace.out.err
tsoftlinks-1.out
tsoftlinks-1.out.err
tsoftlinks-2.out
@@ -413,6 +417,9 @@
# test for empty data
ADD_H5_TEST (tempty 0 -w80 -d tempty.h5)
+ # test for displaying dataset and attribute of null space
+ ADD_H5_TEST (tgrpnullspace 0 -w80 -v tgrpnullspace.h5)
+
# test for all dataset types written to attributes
# enable -S for avoiding printing NATIVE types
ADD_H5_TEST (tattr2 0 -w80 -v -S tattr2.h5)
diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c
index 7daf7e3..a58b96b 100644
--- a/tools/h5ls/h5ls.c
+++ b/tools/h5ls/h5ls.c
@@ -1616,38 +1616,40 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
info = &outputformat;
- if(hexdump_g)
- p_type = H5Tcopy(type);
- else
- p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
-
- if(p_type >= 0) {
- /* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
-
- /* Check if we have VL data in the dataset's datatype */
- if (h5tools_detect_vlen(p_type) == TRUE)
- vl_data = TRUE;
-
- temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
- HDassert(temp_need == (hsize_t)((size_t)temp_need));
- need = (size_t)temp_need;
- buf = HDmalloc(need);
- HDassert(buf);
- if(H5Aread(attr, p_type, buf) >= 0) {
- ctx.need_prefix = TRUE;
- ctx.indent_level = 2;
- ctx.cur_column = (size_t)curr_pos;
- h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
- }
+ if(space_type != H5S_NULL && space_type != H5S_NO_CLASS) {
+ if(hexdump_g)
+ p_type = H5Tcopy(type);
+ else
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+
+ if(p_type >= 0) {
+ /* VL data special information */
+ unsigned int vl_data = 0; /* contains VL datatypes */
+
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5tools_detect_vlen(p_type) == TRUE)
+ vl_data = TRUE;
+
+ temp_need= nelmts * MAX(H5Tget_size(type), H5Tget_size(p_type));
+ HDassert(temp_need == (hsize_t)((size_t)temp_need));
+ need = (size_t)temp_need;
+ buf = HDmalloc(need);
+ HDassert(buf);
+ if(H5Aread(attr, p_type, buf) >= 0) {
+ ctx.need_prefix = TRUE;
+ ctx.indent_level = 2;
+ ctx.cur_column = (size_t)curr_pos;
+ h5tools_dump_mem(rawoutstream, info, &ctx, attr, p_type, space, buf);
+ }
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data)
+ H5Dvlen_reclaim(p_type, space, H5P_DEFAULT, buf);
- HDfree(buf);
- H5Tclose(p_type);
- } /* end if */
+ HDfree(buf);
+ H5Tclose(p_type);
+ } /* end if */
+ }
H5Sclose(space);
H5Tclose(type);
diff --git a/tools/h5ls/testh5ls.sh.in b/tools/h5ls/testh5ls.sh.in
index 4b57acc..42913c1 100644
--- a/tools/h5ls/testh5ls.sh.in
+++ b/tools/h5ls/testh5ls.sh.in
@@ -80,6 +80,7 @@ $SRC_H5LS_TESTFILES/textlinksrc.h5
$SRC_H5LS_TESTFILES/textlinktar.h5
$SRC_H5LS_TESTFILES/tgroup.h5
$SRC_H5LS_TESTFILES/tgrp_comments.h5
+$SRC_H5LS_TESTFILES/tgrpnullspace.h5
$SRC_H5LS_TESTFILES/thlink.h5
$SRC_H5LS_TESTFILES/tloop.h5
$SRC_H5LS_TESTFILES/tnestedcomp.h5
@@ -134,6 +135,7 @@ $SRC_H5LS_TESTFILES/tgroup.ls
$SRC_H5LS_TESTFILES/tgroup-1.ls
$SRC_H5LS_TESTFILES/tgroup-2.ls
$SRC_H5LS_TESTFILES/tgroup-3.ls
+$SRC_H5LS_TESTFILES/tgrpnullspace.ls
$SRC_H5LS_TESTFILES/thlink-1.ls
$SRC_H5LS_TESTFILES/tloop-1.ls
$SRC_H5LS_TESTFILES/tmultifile.ls
@@ -390,6 +392,9 @@ TOOLTEST tarray1.ls 0 -w80 -r -d tarray1.h5
# test for empty data
TOOLTEST tempty.ls 0 -w80 -d tempty.h5
+# test for displaying dataset and attribute of null space
+TOOLTEST tgrpnullspace.ls 0 -w80 -v tgrpnullspace.h5
+
# test for all dataset types written to attributes
# enable -S for avoiding printing NATIVE types
TOOLTEST tattr2.ls 0 -w80 -v -S tattr2.h5