summaryrefslogtreecommitdiffstats
path: root/tools/h5dump
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2018-11-09 14:13:07 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2018-11-09 14:13:07 (GMT)
commit4da93e9d6f9ee0fc7462ee66645c5ad0fa9a9e35 (patch)
treead6d5f412a8f1af0a2121bb0fb7fa3073462c713 /tools/h5dump
parentf97de01d36cde2b66042ffac3debcfab72de0c1d (diff)
downloadhdf5-4da93e9d6f9ee0fc7462ee66645c5ad0fa9a9e35.zip
hdf5-4da93e9d6f9ee0fc7462ee66645c5ad0fa9a9e35.tar.gz
hdf5-4da93e9d6f9ee0fc7462ee66645c5ad0fa9a9e35.tar.bz2
TRILABS-81 coverity tools fixes
Diffstat (limited to 'tools/h5dump')
-rw-r--r--tools/h5dump/CMakeLists.txt55
-rw-r--r--tools/h5dump/CMakeTests.cmake4
-rw-r--r--tools/h5dump/h5dump.c22
-rw-r--r--tools/h5dump/h5dump_xml.c3
-rw-r--r--tools/h5dump/h5dumpgentest.c2
5 files changed, 44 insertions, 42 deletions
diff --git a/tools/h5dump/CMakeLists.txt b/tools/h5dump/CMakeLists.txt
index 569f453..a0ca17a 100644
--- a/tools/h5dump/CMakeLists.txt
+++ b/tools/h5dump/CMakeLists.txt
@@ -33,33 +33,34 @@ if (BUILD_SHARED_LIBS)
endif ()
if (BUILD_TESTING)
-
- #-----------------------------------------------------------------------------
- # If plugin library tests can be tested
- #-----------------------------------------------------------------------------
- set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump")
- set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}")
- set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME})
-
- add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c)
- target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
- TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED)
- target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET})
- H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
-
- # make plugins dir
- file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
- #-----------------------------------------------------------------------------
- # Copy plugin library to a plugins folder
- #-----------------------------------------------------------------------------
- add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different
- "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
- "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
- )
+ if (BUILD_SHARED_LIBS)
+ #-----------------------------------------------------------------------------
+ # If plugin library tests can be tested
+ #-----------------------------------------------------------------------------
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibdump")
+ set (HDF5_TOOL_PLUGIN_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_CORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_TARGET ${HDF5_TOOL_PLUGIN_LIB_CORENAME})
+
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_dump.c)
+ target_include_directories(${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED)
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} PRIVATE ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED "LIB")
+
+ # make plugins dir
+ file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins")
+ #-----------------------------------------------------------------------------
+ # Copy plugin library to a plugins folder
+ #-----------------------------------------------------------------------------
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_TARGET}>"
+ )
+ endif ()
# --------------------------------------------------------------------
# Add the h5dump test executable
diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake
index a9ff122..8a30962 100644
--- a/tools/h5dump/CMakeTests.cmake
+++ b/tools/h5dump/CMakeTests.cmake
@@ -1532,4 +1532,6 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
-ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5)
+if (BUILD_SHARED_LIBS)
+ ADD_H5_UD_TEST (h5dump_plugin_test 0 tudfilter --enable-error-stack tudfilter.h5)
+endif ()
diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c
index fa67548..9b81b8d 100644
--- a/tools/h5dump/h5dump.c
+++ b/tools/h5dump/h5dump.c
@@ -65,7 +65,7 @@ struct handler_t {
* parameters. The long-named ones can be partially spelled. When
* adding more, make sure that they don't clash with each other.
*/
-/* The following initialization makes use of C language cancatenating */
+/* The following initialization makes use of C language concatenating */
/* "xxx" "yyy" into "xxxyyy". */
static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RE*CM:O*N:";
static struct long_options l_opts[] = {
@@ -189,7 +189,7 @@ static struct long_options l_opts[] = {
{ NULL, 0, '\0' }
};
-
+
/*-------------------------------------------------------------------------
* Function: leave
*
@@ -212,7 +212,7 @@ leave(int ret)
HDexit(ret);
}
-
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -362,7 +362,7 @@ usage(const char *prog)
PRINTVALSTREAM(rawoutstream, "\n");
}
-
+
/*-------------------------------------------------------------------------
* Function: table_list_add
*
@@ -415,7 +415,7 @@ table_list_add(hid_t oid, unsigned long file_no)
return((ssize_t) idx);
} /* end table_list_add() */
-
+
/*-------------------------------------------------------------------------
* Function: table_list_visited
*
@@ -445,7 +445,7 @@ table_list_visited(unsigned long file_no)
return(-1);
} /* end table_list_visited() */
-
+
/*-------------------------------------------------------------------------
* Function: table_list_free
*
@@ -813,7 +813,7 @@ parse_mask_list(const char *h_list)
}
}
-
+
/*-------------------------------------------------------------------------
* Function: free_handler
*
@@ -861,7 +861,7 @@ free_handler(struct handler_t *hand, int len)
}
}
-
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -1295,7 +1295,7 @@ error:
return hand;
}
-
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1753,7 +1753,7 @@ h5_fileaccess(void)
return fapl;
}
-
+
/*-------------------------------------------------------------------------
* Function: init_prefix
*
@@ -1774,7 +1774,7 @@ init_prefix(char **prfx, size_t prfx_len)
error_msg("unable to allocate prefix buffer\n");
}
-
+
/*-------------------------------------------------------------------------
* Function: add_prefix
*
diff --git a/tools/h5dump/h5dump_xml.c b/tools/h5dump/h5dump_xml.c
index 6e72b56..15a059b 100644
--- a/tools/h5dump/h5dump_xml.c
+++ b/tools/h5dump/h5dump_xml.c
@@ -3438,8 +3438,7 @@ xml_dump_fill_value(hid_t dcpl, hid_t type)
h5tools_str_reset(&buffer);
h5tools_str_append(&buffer, "\"");
for (i = 0; i < sz; i++) {
- h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf);
- buf = (char *) buf + sizeof(unsigned int);
+ h5tools_str_append(&buffer, "%x ", *(unsigned int *) buf + (i * sizeof(unsigned int)));
}
h5tools_str_append(&buffer, "\"");
h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0);
diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c
index a2f4036..be6361e 100644
--- a/tools/h5dump/h5dumpgentest.c
+++ b/tools/h5dump/h5dumpgentest.c
@@ -9574,7 +9574,7 @@ static void gent_bitnopaquefields(void)
uint32_t c;
uint64_t d;
} s_t;
-
+
hid_t file, grp=-1, type=-1, space=-1, dset=-1;
size_t i;
hsize_t nelmts = F80_DIM32;