summaryrefslogtreecommitdiffstats
path: root/tools/src/h5ls
diff options
context:
space:
mode:
Diffstat (limited to 'tools/src/h5ls')
-rw-r--r--tools/src/h5ls/CMakeLists.txt20
-rw-r--r--tools/src/h5ls/Makefile.am10
-rw-r--r--tools/src/h5ls/h5ls.c75
3 files changed, 49 insertions, 56 deletions
diff --git a/tools/src/h5ls/CMakeLists.txt b/tools/src/h5ls/CMakeLists.txt
index 2e23634..af3a552 100644
--- a/tools/src/h5ls/CMakeLists.txt
+++ b/tools/src/h5ls/CMakeLists.txt
@@ -1,16 +1,11 @@
-cmake_minimum_required (VERSION 3.2.2)
-PROJECT (HDF5_TOOLS_SRC_H5LS)
-
-#-----------------------------------------------------------------------------
-# Setup include Directories
-#-----------------------------------------------------------------------------
-INCLUDE_DIRECTORIES (${HDF5_TOOLS_DIR}/lib)
+cmake_minimum_required (VERSION 3.10)
+project (HDF5_TOOLS_SRC_H5LS C)
#-----------------------------------------------------------------------------
# Add the h5ls executable
#-----------------------------------------------------------------------------
add_executable (h5ls ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
-TARGET_NAMING (h5ls STATIC)
+set_property(TARGET h5ls APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
TARGET_C_PROPERTIES (h5ls STATIC " " " ")
target_link_libraries (h5ls ${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET})
set_target_properties (h5ls PROPERTIES FOLDER tools)
@@ -20,7 +15,7 @@ set (H5_DEP_EXECUTABLES h5ls)
if (BUILD_SHARED_LIBS)
add_executable (h5ls-shared ${HDF5_TOOLS_SRC_H5LS_SOURCE_DIR}/h5ls.c)
- TARGET_NAMING (h5ls-shared SHARED)
+ set_property(TARGET h5ls-shared APPEND PROPERTY INCLUDE_DIRECTORIES "${HDF5_TOOLS_DIR}/lib;${HDF5_SRC_DIR};${HDF5_BINARY_DIR}")
TARGET_C_PROPERTIES (h5ls-shared SHARED " " " ")
target_link_libraries (h5ls-shared ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET})
set_target_properties (h5ls-shared PROPERTIES FOLDER tools)
@@ -39,10 +34,9 @@ endif ()
# Rules for Installation of tools using make Install target
#-----------------------------------------------------------------------------
if (HDF5_EXPORTED_TARGETS)
- if (BUILD_SHARED_LIBS)
- INSTALL_PROGRAM_PDB (h5ls-shared ${HDF5_INSTALL_BIN_DIR} toolsapplications)
- endif ()
- INSTALL_PROGRAM_PDB (h5ls ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+ foreach (exec ${H5_DEP_EXECUTABLES})
+ INSTALL_PROGRAM_PDB (${exec} ${HDF5_INSTALL_BIN_DIR} toolsapplications)
+ endforeach ()
install (
TARGETS
diff --git a/tools/src/h5ls/Makefile.am b/tools/src/h5ls/Makefile.am
index dfa8bb6..07279c1 100644
--- a/tools/src/h5ls/Makefile.am
+++ b/tools/src/h5ls/Makefile.am
@@ -5,12 +5,10 @@
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
-# the files COPYING and Copyright.html. COPYING can be found at the root
-# of the source code distribution tree; Copyright.html can be found at the
-# root level of an installed copy of the electronic HDF5 document set and
-# is linked from the top-level documents page. It can also be found at
-# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
-# access to either file, you may request a copy from help@hdfgroup.org.
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
##
## Makefile.am
## Run automake to generate a Makefile.in from this file.
diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c
index 88bab20..a07d308 100644
--- a/tools/src/h5ls/h5ls.c
+++ b/tools/src/h5ls/h5ls.c
@@ -5,12 +5,10 @@
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
- * the files COPYING and Copyright.html. COPYING can be found at the root *
- * of the source code distribution tree; Copyright.html can be found at the *
- * root level of an installed copy of the electronic HDF5 document set and *
- * is linked from the top-level documents page. It can also be found at *
- * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
- * access to either file, you may request a copy from help@hdfgroup.org. *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -1619,38 +1617,39 @@ 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 = h5tools_get_native_type(type);
-
- 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));
+ need = (size_t)temp_need;
+ if((buf = HDmalloc(need)) != NULL) {
+ 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);
@@ -1875,7 +1874,7 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name)
case H5D_LAYOUT_ERROR:
case H5D_NLAYOUTS:
default:
- HDassert(0);
+ h5tools_str_append(&buffer, "layout information not available");
break;
}
/* Print total raw storage size */
@@ -2710,6 +2709,7 @@ main(int argc, const char *argv[])
case 'h': /* --help */
usage();
leave(EXIT_SUCCESS);
+ break;
case 'a': /* --address */
address_g = TRUE;
@@ -2760,6 +2760,7 @@ main(int argc, const char *argv[])
case 'V': /* --version */
print_version(h5tools_getprogname());
leave(EXIT_SUCCESS);
+ break;
case 'x': /* --hexdump */
hexdump_g = TRUE;