summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/cmake/ConversionTests.c2
-rw-r--r--config/cmake_ext_mod/HDFLibMacros.cmake12
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--java/src/hdf/hdf5lib/H5.java4
-rw-r--r--java/test/TestH5.java4
-rw-r--r--release_docs/RELEASE.txt5
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/CMakeTests.cmake36
-rw-r--r--tools/lib/h5diff.c8
-rw-r--r--tools/lib/h5tools.c32
-rw-r--r--tools/lib/h5tools_dump.c88
-rw-r--r--tools/lib/h5tools_str.c58
-rw-r--r--tools/src/h5dump/h5dump_xml.c3
-rw-r--r--tools/src/h5import/h5import.c135
-rw-r--r--tools/src/h5import/h5import.h4
-rw-r--r--tools/src/h5repack/h5repack_copy.c6
-rw-r--r--tools/src/h5repack/h5repack_main.c2
-rw-r--r--tools/src/misc/h5clear.c39
-rw-r--r--tools/test/h5dump/CMakeLists.txt48
-rw-r--r--tools/test/h5dump/CMakeTests.cmake4
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c357
-rw-r--r--tools/test/h5jam/getub.c2
-rw-r--r--tools/test/h5ls/CMakeLists.txt44
-rw-r--r--tools/test/h5ls/CMakeTests.cmake4
-rw-r--r--tools/test/h5repack/CMakeLists.txt76
-rw-r--r--tools/test/h5repack/CMakeTests.cmake2
-rw-r--r--tools/test/h5repack/h5repacktst.c20
-rw-r--r--tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl14
-rw-r--r--tools/test/h5stat/h5stat_gentest.c312
-rw-r--r--tools/test/perform/zip_perf.c6
31 files changed, 669 insertions, 666 deletions
diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c
index 321d879..c2748b2 100644
--- a/config/cmake/ConversionTests.c
+++ b/config/cmake/ConversionTests.c
@@ -9,7 +9,7 @@
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-+
+
#if defined(__has_attribute)
#if __has_attribute(no_sanitize)
#define HDF_NO_UBSAN __attribute__((no_sanitize("undefined")))
diff --git a/config/cmake_ext_mod/HDFLibMacros.cmake b/config/cmake_ext_mod/HDFLibMacros.cmake
index 8a37af3..2eda66c 100644
--- a/config/cmake_ext_mod/HDFLibMacros.cmake
+++ b/config/cmake_ext_mod/HDFLibMacros.cmake
@@ -75,14 +75,14 @@ macro (EXTERNAL_JPEG_LIBRARY compress_type jpeg_pic)
# Create imported target jpeg-static
add_library(jpeg-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (jpeg-static "jpeg" STATIC "")
- add_dependencies (JPEG jpeg-static)
+ add_dependencies (jpeg-static JPEG)
set (JPEG_STATIC_LIBRARY "jpeg-static")
set (JPEG_LIBRARIES ${JPEG_STATIC_LIBRARY})
if (BUILD_SHARED_LIBS)
# Create imported target jpeg-shared
add_library(jpeg-shared SHARED IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (jpeg-shared "jpeg" SHARED "")
- add_dependencies (JPEG jpeg-shared)
+ add_dependencies (jpeg-shared JPEG)
set (JPEG_SHARED_LIBRARY "jpeg-shared")
set (JPEG_LIBRARIES ${JPEG_LIBRARIES} ${JPEG_SHARED_LIBRARY})
endif ()
@@ -171,14 +171,14 @@ macro (EXTERNAL_SZIP_LIBRARY compress_type encoding)
# Create imported target szip-static
add_library(szip-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (szip-static "szip" STATIC "")
- add_dependencies (SZIP szip-static)
+ add_dependencies (szip-static SZIP)
set (SZIP_STATIC_LIBRARY "szip-static")
set (SZIP_LIBRARIES ${SZIP_STATIC_LIBRARY})
if (BUILD_SHARED_LIBS)
# Create imported target szip-shared
add_library(szip-shared SHARED IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (szip-shared "szip" SHARED "")
- add_dependencies (SZIP szip-shared)
+ add_dependencies (szip-shared SZIP)
set (SZIP_SHARED_LIBRARY "szip-shared")
set (SZIP_LIBRARIES ${SZIP_LIBRARIES} ${SZIP_SHARED_LIBRARY})
endif ()
@@ -269,14 +269,14 @@ macro (EXTERNAL_ZLIB_LIBRARY compress_type)
# Create imported target zlib-static
add_library(zlib-static STATIC IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (zlib-static ${ZLIB_LIB_NAME} STATIC "")
- add_dependencies (ZLIB zlib-static)
+ add_dependencies (zlib-static ZLIB)
set (ZLIB_STATIC_LIBRARY "zlib-static")
set (ZLIB_LIBRARIES ${ZLIB_STATIC_LIBRARY})
if (BUILD_SHARED_LIBS)
# Create imported target zlib-shared
add_library(zlib-shared SHARED IMPORTED)
HDF_IMPORT_SET_LIB_OPTIONS (zlib-shared ${ZLIB_LIB_NAME} SHARED "")
- add_dependencies (ZLIB zlib-shared)
+ add_dependencies (zlib-shared ZLIB)
set (ZLIB_SHARED_LIBRARY "zlib-shared")
set (ZLIB_LIBRARIES ${ZLIB_LIBRARIES} ${ZLIB_SHARED_LIBRARY})
endif ()
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 453db12..6668c22 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -261,7 +261,7 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
* chain puts its associated output code on the output queue.
*/
while (CurCode > DataMask) {
- if (OutCount > 1024) {
+ if (OutCount >= 1024) {
/*return error message*/
}
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index be7cae4..f9f9b65 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -214,7 +214,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.11.3 <BR>
+ * @version HDF5 1.11.4 <BR>
* <b>See also: <a href ="./hdf.hdf5lib.HDFArray.html"> hdf.hdf5lib.HDFArray</a> </b><BR>
* <a href ="./hdf.hdf5lib.HDF5Constants.html"> hdf.hdf5lib.HDF5Constants</a><BR>
* <a href ="./hdf.hdf5lib.HDF5CDataTypes.html"> hdf.hdf5lib.HDF5CDataTypes</a><BR>
@@ -237,7 +237,7 @@ public class H5 implements java.io.Serializable {
*
* Make sure to update the versions number when a different library is used.
*/
- public final static int LIB_VERSION[] = { 1, 11, 3 };
+ public final static int LIB_VERSION[] = { 1, 11, 4 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 738c9f1..54603ca 100644
--- a/java/test/TestH5.java
+++ b/java/test/TestH5.java
@@ -162,7 +162,7 @@ public class TestH5 {
*/
@Test
public void testH5get_libversion() {
- int libversion[] = { 1, 11, 3 };
+ int libversion[] = { 1, 11, 4 };
try {
H5.H5get_libversion(libversion);
@@ -184,7 +184,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 11, relnum = 3;
+ int majnum = 1, minnum = 11, relnum = 4;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index eed04d2..dcc9892 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -639,10 +639,9 @@ Supported Platforms
Windows 7 Visual Studio 2015 w/ Intel Fortran 16 (cmake)
- Windows 7 x64 Visual Studio 2012 w/ Intel Fortran 15 (cmake)
- Visual Studio 2013 w/ Intel Fortran 15 (cmake)
+ Windows 7 x64 Visual Studio 2013
Visual Studio 2015 w/ Intel Fortran 16 (cmake)
- Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake)
+ Visual Studio 2015 w/ Intel C, Fortran 2018 (cmake)
Visual Studio 2015 w/ MSMPI 8 (cmake)
Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 987ae1b..0fa17a5 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1035,6 +1035,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
#-----------------------------------------------------------------------------
set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
+add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${gen_SRCS})
add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@@ -1057,12 +1058,14 @@ target_link_libraries (${HDF5_LIB_TARGET}
set_global_variable (HDF5_LIBRARIES_TO_EXPORT ${HDF5_LIB_TARGET})
H5_SET_LIB_OPTIONS (${HDF5_LIB_TARGET} ${HDF5_LIB_NAME} STATIC 0)
set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries)
+add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET})
set (install_targets ${HDF5_LIB_TARGET})
if (BUILD_SHARED_LIBS)
set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c)
+ add_custom_target (gen_${HDF5_LIBSH_TARGET} ALL DEPENDS ${shared_gen_SRCS})
add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${shared_gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS})
target_include_directories(${HDF5_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
@@ -1087,6 +1090,7 @@ if (BUILD_SHARED_LIBS)
set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}")
H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED "LIB")
set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries)
+ add_dependencies (${HDF5_LIBSH_TARGET} gen_${HDF5_LIBSH_TARGET})
set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET})
endif ()
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 959bac8..ed6bacc 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -62,6 +62,7 @@ endif ()
#################################################################################
# If filter plugin tests can be tested
#################################################################################
+if (BUILD_SHARED_LIBS)
# make plugins dir
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir1")
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/filter_plugin_dir2")
@@ -159,6 +160,7 @@ endif ()
"${CMAKE_BINARY_DIR}/vol/$<TARGET_FILE_NAME:${HDF5_VOL_PLUGIN_LIB_TARGET}>"
)
endforeach ()
+endif ()
#################################################################################
# Test program sources
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index bc759ce..3ad9de7 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -1030,29 +1030,31 @@ endif ()
##############################################################################
### F I L T E R P L U G I N T E S T S
##############################################################################
-if (WIN32)
- set (CMAKE_SEP "\;")
- set (BIN_REL_PATH "../../")
-else ()
- set (CMAKE_SEP ":")
- set (BIN_REL_PATH "../")
-endif ()
+if (BUILD_SHARED_LIBS)
+ if (WIN32)
+ set (CMAKE_SEP "\;")
+ set (BIN_REL_PATH "../../")
+ else ()
+ set (CMAKE_SEP ":")
+ set (BIN_REL_PATH "../")
+ endif ()
-add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>)
-set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES
- ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
-)
+ add_test (NAME H5PLUGIN-filter_plugin COMMAND $<TARGET_FILE:filter_plugin>)
+ set_tests_properties (H5PLUGIN-filter_plugin PROPERTIES
+ ENVIRONMENT "HDF5_PLUGIN_PATH=${CMAKE_BINARY_DIR}/filter_plugin_dir1${CMAKE_SEP}${CMAKE_BINARY_DIR}/filter_plugin_dir2;srcdir=${HDF5_TEST_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
+ )
##############################################################################
# HDFFV-9655 relative plugin test disabled
#
-#add_test (NAME H5PLUGIN-pluginRelative COMMAND $<TARGET_FILE:plugin>)
-#set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES
-# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}"
-# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
-#)
+# add_test (NAME H5PLUGIN-pluginRelative COMMAND $<TARGET_FILE:plugin>)
+# set_tests_properties (H5PLUGIN-pluginRelative PROPERTIES
+# ENVIRONMENT "HDF5_PLUGIN_PATH=@/${BIN_REL_PATH}testdir1${CMAKE_SEP}@/${BIN_REL_PATH}testdir2;srcdir=${HDF5_TEST_BINARY_DIR}"
+# WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}
+# )
##############################################################################
+endif ()
if (TEST_SHELL_SCRIPTS)
include (ShellTests.cmake)
diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c
index 28b1f00..594bf51 100644
--- a/tools/lib/h5diff.c
+++ b/tools/lib/h5diff.c
@@ -274,12 +274,15 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
int cmp;
trav_table_t *table = NULL;
size_t idx;
+ int ret_value = 0;
h5difftrace("build_match_list start\n");
/* init */
trav_table_init(&table);
- if (table == NULL)
- H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create tarverse table");
+ if (table == NULL) {
+ H5TOOLS_INFO(H5E_tools_min_id_g, "Cannot create traverse table");
+ HGOTO_DONE(-1);
+ }
/*
* This is necessary for the case that given objects are group and
* have different names (ex: obj1 is /grp1 and obj2 is /grp5).
@@ -367,6 +370,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
free_exclude_path_list (opts);
+done:
*table_out = table;
h5difftrace("build_match_list finish\n");
}
diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c
index 470df63..d93f7b0 100644
--- a/tools/lib/h5tools.c
+++ b/tools/lib/h5tools.c
@@ -1241,10 +1241,10 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
H5T_class_t type_class;
if((size = H5Tget_size(tid)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed")
if((type_class = H5Tget_class(tid)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed")
switch (type_class) {
case H5T_INTEGER:
@@ -1264,7 +1264,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
bytes_wrote = HDfwrite(mem, 1, bytes_in, stream);
if(bytes_wrote != bytes_in || (0 == bytes_wrote && HDferror(stream)))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
block_index -= (hsize_t)bytes_wrote;
mem = mem + bytes_wrote;
@@ -1287,7 +1287,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (s != NULL)
size = HDstrlen(s);
else
- H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "NULL string")
}
else {
s = (char *) mem;
@@ -1295,7 +1295,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
if (1 != HDfwrite(&tempuchar, sizeof(unsigned char), 1, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
} /* i */
} /* for (block_index = 0; block_index < block_nelmts; block_index++) */
}
@@ -1306,7 +1306,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
unsigned nmembs;
if((snmembs = H5Tget_nmembers(tid)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers of compound failed")
nmembs = (unsigned)snmembs;
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1322,7 +1322,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
if (render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output of compound member failed")
}
H5Tclose(memb);
@@ -1350,7 +1350,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
}
else {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "calculate the number of array elements failed")
}
for (block_index = 0; block_index < block_nelmts; block_index++) {
@@ -1358,7 +1358,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, mem, nelmts) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed")
}
}
H5Tclose(memb);
@@ -1380,7 +1380,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
/* dump the array element */
if (render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
H5Tclose(memb);
- H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "render_bin_output failed")
}
}
H5Tclose(memb);
@@ -1426,7 +1426,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
for (block_index = 0; block_index < block_nelmts; block_index++) {
mem = ((unsigned char*)_mem) + block_index * size;
if (size != HDfwrite(mem, sizeof(char), size, stream))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "fwrite failed")
} /* end for */
break;
@@ -1434,7 +1434,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
case H5T_NCLASSES:
default:
/* Badness */
- H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "bad type class")
break;
} /* end switch */
@@ -1562,12 +1562,12 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hid_t type_id = -1;
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed")
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
alloc_size = nblocks * ndims * 2 * sizeof(ptdata[0]);
@@ -1683,12 +1683,12 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
hid_t type_id = -1;
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed")
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FALSE, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
if((dtype = H5Dget_type(region_id)) < 0)
diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c
index 69cecb0..a8b7e30 100644
--- a/tools/lib/h5tools_dump.c
+++ b/tools/lib/h5tools_dump.c
@@ -618,12 +618,12 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
HDassert(buffer);
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_hyper_nblocks failed")
nblocks = (hsize_t)snblocks;
/* Print block information */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
/* Render the region { element begin */
@@ -944,12 +944,12 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
HDassert(buffer);
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_select_elem_npoints failed")
npoints = (hsize_t)snpoints;
/* Allocate space for the dimension array */
if((sndims = H5Sget_simple_extent_ndims(region_space)) < 0)
- H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(dimension_break, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ndims = (unsigned)sndims;
/* Render the region { element begin */
@@ -1156,7 +1156,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
unsigned int vl_data = 0; /* contains VL datatypes */
if ((size_t) ctx->ndims > NELMTS(sm_size))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ndims and sm_size comparision failed")
if (ctx->ndims > 0)
init_acc_pos(ctx, total_size);
@@ -1184,10 +1184,10 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* calculate the potential number of elements we're going to print */
if(H5Sselect_hyperslab(f_space, H5S_SELECT_SET, temp_start, temp_stride, temp_count, temp_block) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed")
if((ssm_nelmts = H5Sget_select_npoints(f_space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_npoints failed")
sm_nelmts = (hsize_t)ssm_nelmts;
if (sm_nelmts > 0) {
@@ -1196,7 +1196,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
* a hyperslab whose size is manageable.
*/
if((sm_nbytes = p_type_nbytes = H5Tget_size(p_type)) == 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size failed")
if (ctx->ndims > 0)
for (i = ctx->ndims; i > 0; --i) {
@@ -1210,17 +1210,17 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
HDassert(sm_nbytes == (hsize_t) ((size_t) sm_nbytes)); /*check for overflow*/
if(NULL == (sm_buf = (unsigned char *)HDmalloc((size_t) sm_nelmts * p_type_nbytes)))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for strip-mine")
if((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Screate_simple failed")
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &sm_nelmts, NULL) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sselect_hyperslab failed")
/* read the data */
if(H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed")
/* print the data */
flags = START_OF_DATA;
@@ -1234,7 +1234,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
/* print array indices. get the lower bound of the hyperslab and calulate
the element position at the start of hyperslab */
if(H5Sget_select_bounds(f_space, low, high) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_select_bounds failed")
elmtno = 0;
for (i = 0; i < (size_t) ctx->ndims - 1; i++) {
@@ -1259,13 +1259,13 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
if(H5Sclose(sm_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
if(sm_buf)
HDfree(sm_buf);
sm_buf = NULL;
}
else
- H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print");
+ H5E_THROW(SUCCEED, H5E_tools_min_id_g, "nothing to print")
ctx->continuation++;
@@ -1462,10 +1462,10 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
hsize_t total_size[H5S_MAX_RANK];/* total size of dataset*/
if((f_space = H5Dget_space(dset)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed")
if((sndims = H5Sget_simple_extent_ndims(f_space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
/* assume entire data space to be printed */
@@ -1474,7 +1474,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
ctx->p_min_idx[i] = 0;
if(H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed")
ctx->size_last_dim = total_size[ctx->ndims - 1];
/* Set the compound datatype field list for display */
@@ -1484,7 +1484,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
return ret_value;
}
@@ -1540,15 +1540,15 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
f_space = H5Dget_space(dset);
if (f_space == FAIL)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_space failed")
sndims = H5Sget_simple_extent_ndims(f_space);
if(sndims < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
if ((size_t)ctx->ndims > NELMTS(sm_size))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(sm_size) failed")
/* Assume entire data space to be printed */
if (ctx->ndims > 0)
@@ -1629,7 +1629,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
/* Read the data */
if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0) {
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dread failed")
}
/* Print the data */
@@ -1667,9 +1667,9 @@ CATCH
done:
if(sm_space >= 0 && H5Sclose(sm_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
if(f_space >= 0 && H5Sclose(f_space) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sclose failed")
return ret_value;
}
@@ -1696,11 +1696,11 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
sndims = H5Sget_simple_extent_ndims(space);
if(sndims < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Dget_simple_extent_ndims failed")
ctx->ndims = (unsigned)sndims;
if ((size_t) ctx->ndims > NELMTS(ctx->p_min_idx))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "ctx->ndims > NELMTS(ctx->p_min_idx) failed")
/* Assume entire data space to be printed */
for (i = 0; i < ctx->ndims; i++)
@@ -1900,7 +1900,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
const char *order_s = NULL; /* byte order string */
if((type_class = H5Tget_class(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_class failed")
if (object_search && H5Tcommitted(type) > 0) {
H5O_info_t oinfo;
obj_t *obj = NULL; /* Found object */
@@ -2280,7 +2280,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
char *ttag;
if(NULL == (ttag = H5Tget_tag(type)))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_tag failed")
ctx->need_prefix = TRUE;
@@ -2300,7 +2300,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_COMPOUND:
if((snmembers = H5Tget_nmembers(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed")
nmembers = (unsigned)snmembers;
h5tools_str_append(buffer, "H5T_COMPOUND %s", h5tools_dump_header_format->structblockbegin);
@@ -2344,7 +2344,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_ENUM:
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
h5tools_str_append(buffer, "H5T_ENUM %s", h5tools_dump_header_format->enumblockbegin);
h5tools_render_element(stream, info, ctx, buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0);
@@ -2374,14 +2374,14 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
case H5T_VLEN:
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
h5tools_str_append(buffer, "H5T_VLEN %s ", h5tools_dump_header_format->vlenblockbegin);
h5tools_print_datatype(stream, buffer, info, ctx, super, TRUE);
if(H5Tclose(super) < 0)
- HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed");
+ HERROR(H5E_tools_g, H5E_tools_min_id_g, "H5Tclose failed")
h5tools_str_append(buffer, "%s", h5tools_dump_header_format->vlenblockend);
@@ -2456,10 +2456,10 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
int i;
if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_dims failed")
if((space_type = H5Sget_simple_extent_type(space)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Sget_simple_extent_type failed")
switch(space_type) {
case H5S_SCALAR:
@@ -2544,15 +2544,15 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
ncols = info->line_ncols;
if((snmembs = H5Tget_nmembers(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_nmembers failed")
nmembs = (unsigned)snmembs;
HDassert(nmembs > 0);
if((super = H5Tget_super(type)) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_super failed")
if((type_size = H5Tget_size(type)) <= 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_size(type) failed")
/*
* Determine what datatype to use for the native values. To simplify
@@ -2565,7 +2565,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
dst_size = sizeof(long long);
if((sign_type = H5Tget_sign(type))<0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_sign failed")
if(H5T_SGN_NONE == sign_type)
native = H5T_NATIVE_ULLONG;
else
@@ -2576,20 +2576,20 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
/* Get the names and raw values of all members */
if(NULL == (name = (char **)HDcalloc((size_t)nmembs, sizeof(char *))))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member name")
if(NULL == (value = (unsigned char *)HDcalloc((size_t)nmembs, MAX(type_size, dst_size))))
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not allocate buffer for member value")
for (i = 0; i < nmembs; i++) {
name[i] = H5Tget_member_name(type, i);
if(H5Tget_member_value(type, i, value + i * type_size) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tget_member_value failed")
}
/* Convert values to native datatype */
if (native > 0)
if(H5Tconvert(super, native, (size_t)nmembs, value, NULL, H5P_DEFAULT) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "H5Tconvert failed")
/*
* Sort members by increasing value
@@ -2646,7 +2646,7 @@ CATCH
HDfree(value);
if(super >= 0 && H5Tclose(super) < 0)
- H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class");
+ H5E_THROW(FAIL, H5E_tools_min_id_g, "Could not close datatype's super class")
if(0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index 3d595ca..3e8f1fe 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -1045,43 +1045,47 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
}
else {
- unsigned nmembs;
- unsigned j;
+ int retvalue;
- nmembs = (unsigned)H5Tget_nmembers(type);
- h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
+ retvalue = H5Tget_nmembers(type);
+ if (retvalue >= 0) {
+ unsigned j;
+ unsigned nmembs = (unsigned)retvalue;
- ctx->indent_level++;
+ h5tools_str_append(str, "%s", OPT(info->cmpd_pre, "{"));
- for(j = 0; j < nmembs; j++) {
- if(j)
- h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
- else
- h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ ctx->indent_level++;
- if(info->arr_linebreak)
- h5tools_str_indent(str, info, ctx);
+ for(j = 0; j < nmembs; j++) {
+ if(j)
+ h5tools_str_append(str, "%s", OPT(info->cmpd_sep, ", "OPTIONAL_LINE_BREAK));
+ else
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- /* The name */
- name = H5Tget_member_name(type, j);
- h5tools_str_append(str, OPT(info->cmpd_name, ""), name);
- H5free_memory(name);
+ if(info->arr_linebreak)
+ h5tools_str_indent(str, info, ctx);
- /* The value */
- offset = H5Tget_member_offset(type, j);
- memb = H5Tget_member_type(type, j);
+ /* The name */
+ name = H5Tget_member_name(type, j);
+ h5tools_str_append(str, OPT(info->cmpd_name, ""), name);
+ H5free_memory(name);
- h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx);
+ /* The value */
+ offset = H5Tget_member_offset(type, j);
+ memb = H5Tget_member_type(type, j);
- H5Tclose(memb);
- }
- ctx->indent_level--;
+ h5tools_str_sprint(str, info, container, memb, cp_vp + offset, ctx);
- if(info->arr_linebreak) {
- h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
- h5tools_str_indent(str, info, ctx);
+ H5Tclose(memb);
+ }
+ ctx->indent_level--;
+
+ if(info->arr_linebreak) {
+ h5tools_str_append(str, "%s", OPT(info->cmpd_end, ""));
+ h5tools_str_indent(str, info, ctx);
+ }
+ h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
}
- h5tools_str_append(str, "%s", OPT(info->cmpd_suf, "}"));
}
break;
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index e399d8f..ec76511 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/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/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 3b64a0e..16c0d8c 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -88,6 +88,7 @@ int main(int argc, char *argv[])
const char *err7 = "Invalid type of data - %s.\n";
const char *err8 = "Invalid size of data - %s.\n";
const char *err9 = "Cannot specify more than 30 input files in one call to h5import.\n";
+ const char *err10 = "Length of output file name limited to 255 chars.\n";
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
@@ -98,6 +99,9 @@ int main(int argc, char *argv[])
(void) HDsetvbuf(stderr, (char *) NULL, _IOLBF, 0);
(void) HDsetvbuf(stdout, (char *) NULL, _IOLBF, 0);
+ /* Initialize the file structure to 0 */
+ HDmemset(&opt, 0, sizeof(struct Options));
+
if (argv[1] && (HDstrcmp("-V", argv[1]) == 0)) {
print_version(PROGRAMNAME);
HDexit(EXIT_SUCCESS);
@@ -112,9 +116,6 @@ int main(int argc, char *argv[])
goto err;
}
- /* Initialize the file structure to 0 */
- HDmemset(&opt, 0, sizeof(struct Options));
-
/*
* parse the command line
*/
@@ -155,6 +156,10 @@ int main(int argc, char *argv[])
break;
case 5: /* get outfile found */
+ if (HDstrlen(argv[i]) > MAX_PATH_NAME_LENGTH) {
+ (void) HDfprintf(stderr, err10, argv[i]);
+ goto err;
+ }
(void) HDstrcpy(opt.outfile, argv[i]);
outfile_named = TRUE;
break;
@@ -1366,9 +1371,9 @@ static int allocateFloatStorage(struct Input *in)
static int processConfigurationFile(char *infile, struct Input *in)
{
FILE *strm = NULL;
- char key[255];
+ char key[MAX_PATH_NAME_LENGTH];
int kindex;
- char temp[255];
+ char temp[MAX_PATH_NAME_LENGTH];
int ival;
int scanret;
int retval = -1;
@@ -1446,16 +1451,16 @@ static int processConfigurationFile(char *infile, struct Input *in)
goto error;
}
- scanret = fscanf(strm, "%s", key);
+ scanret = fscanf(strm, "%254s", key);
if((scanret == 1) && !HDstrcmp("HDF5", key)) {
#ifdef H5DEBUGIMPORT
int pndx;
HDprintf("\nh5dump file\n");
#endif
in->h5dumpInput = 1;
- scanret = fscanf(strm, "%s", temp); /* filename */
- scanret = fscanf(strm, "%s", temp); /* start bracket */
- scanret = fscanf(strm, "%s", key); /* DATASET */
+ scanret = fscanf(strm, "%254s", temp); /* filename */
+ scanret = fscanf(strm, "%254s", temp); /* start bracket */
+ scanret = fscanf(strm, "%254s", key); /* DATASET */
while (scanret == 1) {
if(!HDstrcmp("DATASET", key)) { /* PATH */
#ifdef H5DEBUGIMPORT
@@ -1465,7 +1470,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err3a, infile);
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1477,7 +1482,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
goto error;
}
in->configOptionVector[PATH] = 1;
- scanret = fscanf(strm, "%s", temp); /* start bracket */
+ scanret = fscanf(strm, "%254s", temp); /* start bracket */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASET %s found\n", temp);
#endif
@@ -1491,7 +1496,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1528,20 +1533,20 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING found\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATATYPE STRING %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* string properties */
+ if (fscanf(strm, "%254s", temp) != 1) { /* string properties */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
while (get_next_prop) {
if(!HDstrcmp("STRSIZE", temp)) { /* STRSIZE */
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err19);
goto error;
}
@@ -1561,7 +1566,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
}
else if(!HDstrcmp("STRPAD", temp)) { /* STRPAD */
- if (fscanf(strm, "%s", temp) != 1) { /* STRPAD type */
+ if (fscanf(strm, "%254s", temp) != 1) { /* STRPAD type */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1570,7 +1575,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
}
else if(!HDstrcmp("CSET", key)) { /* CSET */
- if (fscanf(strm, "%s", temp) != 1) { /* CSET type */
+ if (fscanf(strm, "%254s", temp) != 1) { /* CSET type */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1580,7 +1585,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else if(!HDstrcmp("CTYPE", temp)) { /* CTYPE */
- if (fscanf(strm, "%s", temp) != 1) { /* CTYPE type */
+ if (fscanf(strm, "%254s", temp) != 1) { /* CTYPE type */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1588,7 +1593,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("h5dump DATATYPE STRING CTYPE %s found\n", temp);
#endif
} /* if(!HDstrcmp("CSET", key)) */
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1607,7 +1612,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE key\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1623,14 +1628,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE found\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1641,7 +1646,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
int get_next_dim = 1;
int i = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -1651,7 +1656,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (get_next_dim) {
char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1694,7 +1699,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err5b, infile);
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1705,7 +1710,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
if ((in->maxsizeOfDimension = (hsize_t *) HDmalloc ((size_t) in->rank * sizeof(hsize_t))) == NULL) {
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1719,7 +1724,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE process max dim values\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* max dim with optional comma */
+ if (fscanf(strm, "%254s", temp) != 1) { /* max dim with optional comma */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -1738,7 +1743,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
char *more = temp;
in->maxsizeOfDimension[i] = HDstrtoull(more, &more, 10);
}
- if (fscanf(strm, "%s", temp) != 1) { /* max dim or end paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* max dim or end paren */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -1750,7 +1755,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else { /* comma */
i++;
- if (i > MAX_NUM_DIMENSION) {
+ if (i >= MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
@@ -1769,7 +1774,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
- scanret = fscanf(strm, "%s", temp); /* end bracket */
+ scanret = fscanf(strm, "%254s", temp); /* end bracket */
#ifdef H5DEBUGIMPORT
HDprintf("h5dump DATASPACE SIMPLE %s found\n", temp);
#endif
@@ -1784,14 +1789,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT key\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump STORAGE_LAYOUT %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* CHUNKED */
+ if (fscanf(strm, "%254s", temp) != 1) { /* CHUNKED */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1803,7 +1808,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, "Unable to allocate dynamic memory.\n");
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1814,7 +1819,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
int get_next_dim = 1;
int icount = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -1824,7 +1829,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (get_next_dim) {
char *more = temp;
in->sizeOfChunk[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1856,7 +1861,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err5b, infile);
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) { /* SIZE */
+ if (fscanf(strm, "%254s", temp) != 1) { /* SIZE */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1873,7 +1878,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
}
while (HDstrcmp("}", temp)) {
- if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1888,14 +1893,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS key\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1906,21 +1911,21 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION found\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* DEFLATE */
+ if (fscanf(strm, "%254s", temp) != 1) { /* DEFLATE */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* bgin bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* bgin bracket */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump FILTERS COMPRESSION %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* LEVEL */
+ if (fscanf(strm, "%254s", temp) != 1) { /* LEVEL */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1935,7 +1940,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
HDprintf("h5dump FILTERS COMPRESSION LEVEL %d found\n", ival);
#endif
in->compressionParam = ival;
- if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1957,7 +1962,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
#endif
in->configOptionVector[COMPRESS] = 0;
}
- if (fscanf(strm, "%s", temp) != 1) { /* end bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* end bracket */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1971,14 +1976,14 @@ static int processConfigurationFile(char *infile, struct Input *in)
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET key\n");
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* start bracket */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start bracket */
(void) HDfprintf(stderr, err20, infile);
goto error;
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump SUBSET %s found\n", temp);
#endif
- if (fscanf(strm, "%s", temp) != 1) { /* SUBSET keyword */
+ if (fscanf(strm, "%254s", temp) != 1) { /* SUBSET keyword */
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -1988,7 +1993,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (get_next_prop) {
if(!HDstrcmp("COUNT", temp)) { /* COUNT */
int icount = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -1999,7 +2004,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
int get_next_dim = 1;
int i = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -2009,7 +2014,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (get_next_dim) {
char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -2023,7 +2028,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
}
else { /* Dimension */
icount++;
- if (icount > MAX_NUM_DIMENSION) {
+ if (icount >= MAX_NUM_DIMENSION) {
(void) HDfprintf(stderr, "Invalid value for rank.\n");
goto error;
}
@@ -2044,7 +2049,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
} /* if(!HDstrcmp("COUNT", temp)) COUNT */
if(!HDstrcmp("BLOCK", temp)) { /* BLOCK */
int icount = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* start paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* start paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -2055,7 +2060,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
int get_next_dim = 1;
int i = 0;
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension with optional comma */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension with optional comma */
(void) HDfprintf(stderr, err16c, infile);
goto error;
}
@@ -2065,7 +2070,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
while (get_next_dim) {
char *more = temp;
temp_dims[icount] = HDstrtoull(more, &more, 10);
- if (fscanf(strm, "%s", temp) != 1) { /* Dimension or end paren */
+ if (fscanf(strm, "%254s", temp) != 1) { /* Dimension or end paren */
(void) HDfprintf(stderr, err6b, infile);
goto error;
}
@@ -2098,7 +2103,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
in->configOptionVector[DIM] = 1;
} /* if(!HDstrcmp("(", key)) start paren */
} /* if(!HDstrcmp("BLOCK", temp)) BLOCK */
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -2117,7 +2122,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
scanret = 0;
break;
}
- scanret = fscanf(strm, "%s", key);
+ scanret = fscanf(strm, "%254s", key);
}
#ifdef H5DEBUGIMPORT
HDprintf("h5dump path");
@@ -2158,7 +2163,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err3a, infile);
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -2175,7 +2180,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
goto error;
}
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err18);
goto error;
}
@@ -2203,7 +2208,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
(void) HDfprintf(stderr, err5a, infile);
goto error;
}
- if (fscanf(strm, "%d", (&ival)) != 1) {
+ if (fscanf(strm, "%254d", (&ival)) != 1) {
(void) HDfprintf(stderr, "%s", err19);
goto error;
}
@@ -2400,7 +2405,7 @@ static int processConfigurationFile(char *infile, struct Input *in)
default:
break;
}
- scanret = fscanf(strm, "%s", key);
+ scanret = fscanf(strm, "%254s", key);
}
/*
@@ -2571,7 +2576,7 @@ static int getOutputClass(struct Input *in, FILE *strm)
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output class.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3464,7 +3469,7 @@ static int getInputByteOrder(struct Input *in, FILE *strm)
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for input byte-order.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3595,7 +3600,7 @@ static int getOutputArchitecture(struct Input *in, FILE *strm)
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output architecture.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3627,7 +3632,7 @@ static int getOutputByteOrder(struct Input *in, FILE *strm)
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for output byte-order.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3658,7 +3663,7 @@ static int getCompressionType(struct Input *in, FILE *strm)
const char *err1 = "Unable to get 'string' value.\n";
const char *err2 = "Invalid value for compression.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
@@ -3722,7 +3727,7 @@ static int getExternalFilename(struct Input *in, FILE *strm)
char temp[255];
const char *err1 = "Unable to get 'string' value.\n";
- if (fscanf(strm, "%s", temp) != 1) {
+ if (fscanf(strm, "%254s", temp) != 1) {
(void) HDfprintf(stderr, "%s", err1);
return (-1);
}
diff --git a/tools/src/h5import/h5import.h b/tools/src/h5import/h5import.h
index c55717d..00c41f6 100644
--- a/tools/src/h5import/h5import.h
+++ b/tools/src/h5import/h5import.h
@@ -102,8 +102,8 @@ struct Input
struct infilesformat
{
- char datafile[255];
- char configfile[255];
+ char datafile[MAX_PATH_NAME_LENGTH];
+ char configfile[MAX_PATH_NAME_LENGTH];
struct Input in;
int config; /* Configfile present? No - 0. Yes - 1 */
};
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index b279cf9..0567269 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -1422,9 +1422,9 @@ copy_user_block(const char *infile, const char *outfile, hsize_t size)
} /* end while */
done:
- if (infid > 0)
+ if (infid >= 0)
HDclose(infid);
- if (outfid > 0)
+ if (outfid >= 0)
HDclose(outfid);
return ret_value;
@@ -1497,7 +1497,7 @@ print_user_block(const char *filename, hid_t fid)
}
done:
- if (fh > 0)
+ if (fh >= 0)
HDclose(fh);
return;
diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c
index 8f0178f..dec25f9 100644
--- a/tools/src/h5repack/h5repack_main.c
+++ b/tools/src/h5repack/h5repack_main.c
@@ -707,6 +707,8 @@ int main(int argc, const char **argv)
void *edata;
void *tools_edata;
+ HDmemset(&options, 0, sizeof(pack_opt_t));
+
h5tools_setprogname(PROGRAMNAME);
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/src/misc/h5clear.c b/tools/src/misc/h5clear.c
index 5724e1b..ae57031 100644
--- a/tools/src/misc/h5clear.c
+++ b/tools/src/misc/h5clear.c
@@ -82,7 +82,7 @@ static struct long_options l_opts[] = {
};
-
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -119,7 +119,7 @@ static void usage(const char *prog)
HDfprintf(stdout, " Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.\n");
} /* usage() */
-
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -170,9 +170,12 @@ parse_command_line(int argc, const char **argv)
case 'i':
increment_eoa_eof = TRUE;
- if(opt_arg != NULL && (increment = HDatoi(opt_arg)) < 0) {
- usage(h5tools_getprogname());
- goto done;
+ if(opt_arg != NULL) {
+ if (HDatoi(opt_arg) < 0) {
+ usage(h5tools_getprogname());
+ goto done;
+ }
+ increment = HDatoi(opt_arg);
}
break;
@@ -217,7 +220,7 @@ leave(int ret)
} /* leave() */
-
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -231,14 +234,14 @@ leave(int ret)
* so the file is opened with write access.
* The --filesize option just prints the EOA and EOF, so the file
* is opened with read access.
- *
+ *
* The -s option will activate the private property:
- * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME
+ * --H5F_ACS_CLEAR_STATUS_FLAGS_NAME
* The --increment option will active these two private properties:
- * --H5F_ACS_NULL_FSM_ADDR_NAME
- * --H5F_ACS_SKIP_EOF_CHECK_NAME
+ * --H5F_ACS_NULL_FSM_ADDR_NAME
+ * --H5F_ACS_SKIP_EOF_CHECK_NAME
* The --filesize will activate the private property:
- * --H5F_ACS_SKIP_EOF_CHECK_NAME
+ * --H5F_ACS_SKIP_EOF_CHECK_NAME
*
* Return: Success: 0
* Failure: 1
@@ -280,7 +283,7 @@ main (int argc, const char *argv[])
}
/* Cannot combine the --filesize option with other options */
- if(print_filesize &&
+ if(print_filesize &&
(clear_status_flags || remove_cache_image || increment_eoa_eof)) {
error_msg("Cannot combine --filesize with other options\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -298,7 +301,7 @@ main (int argc, const char *argv[])
}
/* -s option */
- if(clear_status_flags) {
+ if(clear_status_flags) {
/* Set to clear the status_flags in the file's superblock */
/* Activate this private property */
if(H5Pset(fapl, H5F_ACS_CLEAR_STATUS_FLAGS_NAME, &clear_status_flags) < 0) {
@@ -309,7 +312,7 @@ main (int argc, const char *argv[])
}
/* --increment option */
- if(increment_eoa_eof) {
+ if(increment_eoa_eof) {
/* Activate this private property */
if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &increment_eoa_eof) < 0) {
error_msg("H5Pset\n");
@@ -325,7 +328,7 @@ main (int argc, const char *argv[])
}
/* --filesize option; open the file read-only */
- if(print_filesize) {
+ if(print_filesize) {
/* Activate this private property */
if(H5Pset(fapl, H5F_ACS_SKIP_EOF_CHECK_NAME, &print_filesize) < 0) {
error_msg("H5Pset\n");
@@ -333,7 +336,7 @@ main (int argc, const char *argv[])
goto done;
}
flags = H5F_ACC_RDONLY;
- }
+ }
/* Open the file */
if((fid = h5tools_fopen(fname, flags, fapl, NULL, NULL, (size_t)0)) < 0) {
@@ -367,7 +370,7 @@ main (int argc, const char *argv[])
}
/* -m option */
- if(remove_cache_image) {
+ if(remove_cache_image) {
if(H5Fget_mdc_image_info(fid, &image_addr, &image_len) < 0) {
error_msg("H5Fget_mdc_image_info\n");
h5tools_setstatus(EXIT_FAILURE);
@@ -375,7 +378,7 @@ main (int argc, const char *argv[])
}
if(image_addr == HADDR_UNDEF && image_len == 0)
warn_msg("No cache image in the file\n");
- }
+ }
h5tools_setstatus(EXIT_SUCCESS);
diff --git a/tools/test/h5dump/CMakeLists.txt b/tools/test/h5dump/CMakeLists.txt
index 4c409e8..51938ae 100644
--- a/tools/test/h5dump/CMakeLists.txt
+++ b/tools/test/h5dump/CMakeLists.txt
@@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5DUMP C)
#-----------------------------------------------------------------------------
# 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)
+ 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/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake
index eedb432..b02dc35 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -1549,4 +1549,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/test/h5format_convert/h5fc_gentest.c b/tools/test/h5format_convert/h5fc_gentest.c
index 8c873be..b482dee 100644
--- a/tools/test/h5format_convert/h5fc_gentest.c
+++ b/tools/test/h5format_convert/h5fc_gentest.c
@@ -14,7 +14,7 @@
/*
* Generate the binary hdf5 files for the h5format_convert tests.
* Usage: just execute the program without any arguments will
- * generate all the binary hdf5 files
+ * generate all the binary hdf5 files
*
* If you regenerate the test files (e.g., changing some code,
* trying it on a new platform, ...), you need to verify the correctness
@@ -24,71 +24,71 @@
#include "hdf5.h"
#include "H5private.h"
-#define NON_V3_FILE "h5fc_non_v3.h5"
-#define EDGE_V3_FILE "h5fc_edge_v3.h5"
-#define ERR_LEVEL_FILE "h5fc_err_level.h5"
+#define NON_V3_FILE "h5fc_non_v3.h5"
+#define EDGE_V3_FILE "h5fc_edge_v3.h5"
+#define ERR_LEVEL_FILE "h5fc_err_level.h5"
const char *FILENAME[] = {
- "h5fc_ext1_i.h5", /* 0 */
- "h5fc_ext1_s.h5", /* 1 */
- "h5fc_ext1_f.h5", /* 2 */
- "h5fc_ext2_is.h5", /* 3 */
- "h5fc_ext2_if.h5", /* 4 */
- "h5fc_ext2_sf.h5", /* 5 */
- "h5fc_ext3_isf.h5", /* 6 */
- "h5fc_ext_none.h5", /* 7 */
+ "h5fc_ext1_i.h5", /* 0 */
+ "h5fc_ext1_s.h5", /* 1 */
+ "h5fc_ext1_f.h5", /* 2 */
+ "h5fc_ext2_is.h5", /* 3 */
+ "h5fc_ext2_if.h5", /* 4 */
+ "h5fc_ext2_sf.h5", /* 5 */
+ "h5fc_ext3_isf.h5", /* 6 */
+ "h5fc_ext_none.h5", /* 7 */
NULL
};
-#define GROUP "GROUP"
+#define GROUP "GROUP"
-#define DSET_COMPACT "DSET_COMPACT"
-#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
+#define DSET_COMPACT "DSET_COMPACT"
+#define DSET_CONTIGUOUS "DSET_CONTIGUOUS"
-#define DSET_EA "DSET_EA"
-#define DSET_NDATA_EA "DSET_NDATA_EA"
-#define DSET_BT2 "DSET_BT2"
-#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
-#define DSET_FA "DSET_FA"
-#define DSET_NDATA_FA "DSET_NDATA_FA"
-#define DSET_NONE "DSET_NONE"
-#define DSET_NDATA_NONE "DSET_NDATA_NONE"
+#define DSET_EA "DSET_EA"
+#define DSET_NDATA_EA "DSET_NDATA_EA"
+#define DSET_BT2 "DSET_BT2"
+#define DSET_NDATA_BT2 "DSET_NDATA_BT2"
+#define DSET_FA "DSET_FA"
+#define DSET_NDATA_FA "DSET_NDATA_FA"
+#define DSET_NONE "DSET_NONE"
+#define DSET_NDATA_NONE "DSET_NDATA_NONE"
-#define DSET_EDGE "DSET_EDGE"
-#define DSET_ERR "DSET_ERR"
+#define DSET_EDGE "DSET_EDGE"
+#define DSET_ERR "DSET_ERR"
#define ISTORE_IK 64
-#define ISTORE_ERR 1
+#define ISTORE_ERR 1
#define NUM 500
/*
- * Function: gen_non()
+ * Function: gen_non()
*
* Create a file with SWMR write+non-latest-format--this will result in v3 superbock+latest version support:
- * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
- * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
+ * 1) 1 chunked dataset with extensible array chunk indexing type (without data)
+ * 2) 1 chunked dataset with version 2 B-tree chunk indexing type (with data)
* Re-open the file with write+non-latest-format and create:
- * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
- * 4) 1 chunked dataset with extensible array indexing type (with data)
- * 5) 1 compact and 1 contiguous datasets
+ * 3) 1 chunked dataset with version 2 B-tree chunk indexing type (without data)
+ * 4) 1 chunked dataset with extensible array indexing type (with data)
+ * 5) 1 compact and 1 contiguous datasets
*/
static void
gen_non(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
+ hid_t fid = -1; /* file id */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
goto error;
@@ -115,7 +115,7 @@ gen_non(const char *fname)
if(H5Pset_chunk(dcpl, 2, c_dims) < 0)
goto error;
- /*
+ /*
* Create a chunked dataset with extensible array chunk indexing type (without data)
*/
@@ -135,7 +135,7 @@ gen_non(const char *fname)
if(H5Dclose(did1) < 0)
goto error;
- /*
+ /*
* Create a chunked dataset with version 2 B-tree chunk indexing type (with data)
*/
@@ -226,7 +226,7 @@ gen_non(const char *fname)
if(H5Dclose(did2) < 0)
goto error;
- /*
+ /*
* Create a compact dataset in the group
*/
@@ -251,7 +251,7 @@ gen_non(const char *fname)
if(H5Sclose(sid) < 0)
goto error;
- /*
+ /*
* Create a contiguous dataset with (2d with data) in the file
*/
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
@@ -278,9 +278,9 @@ gen_non(const char *fname)
goto error;
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
if(H5Pclose(fcpl) < 0)
- goto error;
+ goto error;
if(H5Fclose(fid) < 0)
goto error;
@@ -298,24 +298,24 @@ error:
} /* gen_non() */
/*
- * Function: gen_edge()
+ * Function: gen_edge()
*
* Create a file with write+latest-format--this will result in v3 superblock+latest version support:
- * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
- * (i.e. the dataset does not filter partial edge chunks)
+ * A dataset: chunked, filtered, H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS enabled
+ * (i.e. the dataset does not filter partial edge chunks)
*/
static void
gen_edge(const char *fname)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1; /* dataset id */
- hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
- hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
- float buf[12][6]; /* Buffer for writing data */
- int i, j; /* local index variable */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1; /* dataset id */
+ hsize_t dims2[2] = {12, 6}; /* Dataset dimensions */
+ hsize_t c_dims[2] = {5, 5}; /* Chunk dimensions */
+ float buf[12][6]; /* Buffer for writing data */
+ int i, j; /* local index variable */
/* Create a new format file */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -377,37 +377,37 @@ error:
/*
- * Function: gen_err_level()
+ * Function: gen_err_level()
*
* Generate a file to test the situtation described in HDFFV-9434:
- * Exceed the limit of v1-btree level
+ * Exceed the limit of v1-btree level
*
- * Create a file with H5Pset_istore_k(fcpl, 1).
- * Create a chunked dataset with extensible array chunk index and
- * appends many chunks to the dataset.
+ * Create a file with H5Pset_istore_k(fcpl, 1).
+ * Create a chunked dataset with extensible array chunk index and
+ * appends many chunks to the dataset.
*
- * When h5format_convert tries to convert the dataset with
- * extensive array index in the file to v1-btree chunk index,
- * it will insert the dataset chunks to the v1-btree chunk index.
- * The tree will split quickly due to the 'K' value of 1 and the
- * tree level will eventually hit the maximum: 2^8(256).
+ * When h5format_convert tries to convert the dataset with
+ * extensive array index in the file to v1-btree chunk index,
+ * it will insert the dataset chunks to the v1-btree chunk index.
+ * The tree will split quickly due to the 'K' value of 1 and the
+ * tree level will eventually hit the maximum: 2^8(256).
*/
static void
gen_err_level(const char *fname)
{
- hid_t fid = -1; /* file ID */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t sid = -1; /* dataspace id */
- hid_t dcpl = -1; /* dataset creation property list */
- hid_t did = -1; /* dataset ID */
- hid_t fsid = -1; /* file dataspace ID */
- hid_t msid = -1; /* memory dataspace ID */
- unsigned char *buf = NULL; /* buffer for data */
- hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
- hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
- hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
- int n = 0; /* local index variable */
+ hid_t fid = -1; /* file ID */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t sid = -1; /* dataspace id */
+ hid_t dcpl = -1; /* dataset creation property list */
+ hid_t did = -1; /* dataset ID */
+ hid_t fsid = -1; /* file dataspace ID */
+ hid_t msid = -1; /* memory dataspace ID */
+ unsigned char *buf = NULL; /* buffer for data */
+ hsize_t dims[2] = {0, 1}; /* dataset dimension sizes */
+ hsize_t max_dims[2] = {1, H5S_UNLIMITED}; /* dataset maximum dimension sizes */
+ hsize_t chunk_dims[2] = {1, 1}; /* chunk dimension sizes */
+ int n = 0; /* local index variable */
/* Create a new format file */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
@@ -440,6 +440,8 @@ gen_err_level(const char *fname)
goto error;
/* Closing */
+ if(H5Pclose(fcpl) < 0)
+ goto error;
if(H5Pclose(dcpl) < 0)
goto error;
if(H5Sclose(sid) < 0)
@@ -459,50 +461,51 @@ gen_err_level(const char *fname)
/* Loop through appending 1 element at a time */
for(n = 0; n < NUM; n++) {
- hsize_t start[2] = {0, 0};
- hsize_t count[2] = {1, 1};
- hsize_t extent[2] = {0, 0};
-
- start[0] = 0;
- start[1] = (hsize_t)n;
- extent[0] = 1;
- extent[1] = (hsize_t)(n + 1);
-
- /* Set current dimension sizes for the dataset */
- if(H5Dset_extent(did, extent) < 0)
- goto error;
-
- /* Set up memory dataspace */
- if((msid = H5Screate_simple(2, count, NULL)) < 0)
- goto error;
-
- /* Get file dataspace */
- if((fsid = H5Dget_space(did)) < 0)
- goto error;
-
- if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
- goto error;
-
- /* Write to the dataset */
- if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
- goto error;
-
- if(H5Sclose(fsid) < 0)
- goto error;
- if(H5Sclose(msid) < 0)
- goto error;
+ hsize_t start[2] = {0, 0};
+ hsize_t count[2] = {1, 1};
+ hsize_t extent[2] = {0, 0};
+
+ start[0] = 0;
+ start[1] = (hsize_t)n;
+ extent[0] = 1;
+ extent[1] = (hsize_t)(n + 1);
+
+ /* Set current dimension sizes for the dataset */
+ if(H5Dset_extent(did, extent) < 0)
+ goto error;
+
+ /* Set up memory dataspace */
+ if((msid = H5Screate_simple(2, count, NULL)) < 0)
+ goto error;
+
+ /* Get file dataspace */
+ if((fsid = H5Dget_space(did)) < 0)
+ goto error;
+
+ if((H5Sselect_hyperslab(fsid, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
+ goto error;
+
+ /* Write to the dataset */
+ if(H5Dwrite(did, H5T_NATIVE_UCHAR, msid, fsid, H5P_DEFAULT, buf) < 0)
+ goto error;
+
+ if(H5Sclose(fsid) < 0)
+ goto error;
+ if(H5Sclose(msid) < 0)
+ goto error;
}
/* Closing */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
if(H5Fclose(fid) < 0)
- goto error;
+ goto error;
if(H5Pclose(fapl) < 0)
- goto error;
- if(buf) free(buf);
+ goto error;
error:
+ if(buf)
+ free(buf);
H5E_BEGIN_TRY {
H5Pclose(dcpl);
H5Sclose(sid);
@@ -517,33 +520,33 @@ error:
} /* gen_err_level() */
/*
- * Function: gen_ext()
+ * Function: gen_ext()
*
* Create a file with/without latest format with:
- * 1) 1 contiguous dataset (without data)
- * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data)
- * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
- * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data)
- * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data)
+ * 1) 1 contiguous dataset (without data)
+ * 2) 2 chunked datasets with extensible array chunk indexing type (with/without data)
+ * 3) 2 chunked datasets with version 2 B-tree chunk indexing type (with/without data)
+ * 4) 2 chunked datasets with fixed array chunk indexing type (with/without data)
+ * 5) 2 chunked datasets with implicit array chunk indexing type (with/without data)
* It will create the file with/without messages in the superblock extension depending
* on the parameter "what".
*/
static void
gen_ext(const char *fname, unsigned new_format, unsigned what)
{
- hid_t fid = -1; /* file id */
- hid_t fapl = -1; /* file access property list */
- hid_t fcpl = -1; /* file creation property list */
- hid_t gid = -1; /* group id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did1 = -1, did2 = -1; /* dataset id */
- hsize_t dims1[1] = {10}; /* dataset dimension */
- hsize_t dims2[2] = {4, 6}; /* dataset dimension */
- hsize_t max_dims[2]; /* maximum dataset dimension */
- hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
- int i; /* local index variable */
- int buf[24]; /* data buffer */
+ hid_t fid = -1; /* file id */
+ hid_t fapl = -1; /* file access property list */
+ hid_t fcpl = -1; /* file creation property list */
+ hid_t gid = -1; /* group id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did1 = -1, did2 = -1; /* dataset id */
+ hsize_t dims1[1] = {10}; /* dataset dimension */
+ hsize_t dims2[2] = {4, 6}; /* dataset dimension */
+ hsize_t max_dims[2]; /* maximum dataset dimension */
+ hsize_t c_dims[2] = {2, 3}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[24]; /* data buffer */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
goto error;
@@ -559,34 +562,34 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
/* Generate messages that might be placed in superblock extension */
switch(what) {
- case 0:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- break;
- case 1:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 2:
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
- break;
- case 3:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- break;
- case 4:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
- break;
- case 5:
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_page_size(fcpl, (hsize_t)512);
- break;
- case 6:
- H5Pset_istore_k(fcpl, ISTORE_IK);
- H5Pset_shared_mesg_nindexes(fcpl, 4);
- H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
- break;
- default:
- break;
+ case 0:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ break;
+ case 1:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 2:
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_PAGE, FALSE, (hsize_t)1);
+ break;
+ case 3:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ break;
+ case 4:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, (hsize_t)1);
+ break;
+ case 5:
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_page_size(fcpl, (hsize_t)512);
+ break;
+ case 6:
+ H5Pset_istore_k(fcpl, ISTORE_IK);
+ H5Pset_shared_mesg_nindexes(fcpl, 4);
+ H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_NONE, FALSE, (hsize_t)1);
+ break;
+ default:
+ break;
}
/* Create the file */
@@ -604,8 +607,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create a contiguous dataset
+ /*
+ * Create a contiguous dataset
*/
/* Create dataspace */
@@ -622,8 +625,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
if(H5Dclose(did1) < 0)
goto error;
- /*
- * Create 2 chunked datasets with extensible array chunk indexing type
+ /*
+ * Create 2 chunked datasets with extensible array chunk indexing type
* (one with data; one without data)
*/
@@ -657,8 +660,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create 2 chunked datasets with version 2 B-tree chunk indexing type
+ /*
+ * Create 2 chunked datasets with version 2 B-tree chunk indexing type
* (one with data; one without data)
*/
@@ -689,7 +692,7 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
/*
- * Create 2 chunked datasets with fixed array chunk indexing type
+ * Create 2 chunked datasets with fixed array chunk indexing type
* (one with data; one without data)
*/
@@ -719,8 +722,8 @@ gen_ext(const char *fname, unsigned new_format, unsigned what)
goto error;
- /*
- * Create 2 chunked datasets with implicit chunk indexing type
+ /*
+ * Create 2 chunked datasets with implicit chunk indexing type
* (one with data; one without data)
*/
diff --git a/tools/test/h5jam/getub.c b/tools/test/h5jam/getub.c
index 7cfde36..26a427d 100644
--- a/tools/test/h5jam/getub.c
+++ b/tools/test/h5jam/getub.c
@@ -148,7 +148,7 @@ main(int argc, const char *argv[])
error:
if(buf)
HDfree(buf);
- if(fd > -1)
+ if(fd >= 0)
HDclose(fd);
return EXIT_FAILURE;
} /* end main() */
diff --git a/tools/test/h5ls/CMakeLists.txt b/tools/test/h5ls/CMakeLists.txt
index 5b8cbe0..dc5804c 100644
--- a/tools/test/h5ls/CMakeLists.txt
+++ b/tools/test/h5ls/CMakeLists.txt
@@ -4,29 +4,31 @@ project (HDF5_TOOLS_TEST_H5LS C)
#-----------------------------------------------------------------------------
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
-set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls")
-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})
+if (BUILD_SHARED_LIBS)
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibls")
+ 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_ls.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")
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_ls.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}>"
-)
+ # 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 ()
include (CMakeTests.cmake)
diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake
index d03a344..488b271 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -470,4 +470,6 @@
##############################################################################
### P L U G I N T E S T S
##############################################################################
-ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5)
+if (BUILD_SHARED_LIBS)
+ ADD_H5_UD_TEST (h5ls_plugin_test 0 tudfilter -w80 -d tudfilter.h5)
+endif ()
diff --git a/tools/test/h5repack/CMakeLists.txt b/tools/test/h5repack/CMakeLists.txt
index 2a168e9..890d5d2 100644
--- a/tools/test/h5repack/CMakeLists.txt
+++ b/tools/test/h5repack/CMakeLists.txt
@@ -32,45 +32,47 @@ set_target_properties (h5repacktest PROPERTIES FOLDER tools)
#-----------------------------------------------------------------------------
# If plugin library tests can be tested
#-----------------------------------------------------------------------------
-set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd")
-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})
-set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers")
-set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}")
-set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME})
+if (BUILD_SHARED_LIBS)
+ set (HDF5_TOOL_PLUGIN_LIB_CORENAME "dynlibadd")
+ 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})
+ set (HDF5_TOOL_PLUGIN_LIB_VCORENAME "dynlibvers")
+ set (HDF5_TOOL_PLUGIN_LIB_VNAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOL_PLUGIN_LIB_VCORENAME}")
+ set (HDF5_TOOL_PLUGIN_LIB_VTARGET ${HDF5_TOOL_PLUGIN_LIB_VCORENAME})
-add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.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")
+ add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.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")
-add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
-target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
-TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED)
-target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET})
-H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} SHARED "LIB")
+ add_library (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED dynlib_vrpk.c)
+ target_include_directories(${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
+ TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_VTARGET} SHARED)
+ target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_VTARGET} PRIVATE ${HDF5_TEST_LIB_TARGET})
+ H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_VTARGET} ${HDF5_TOOL_PLUGIN_LIB_VNAME} 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}>"
-)
-add_custom_command (
- TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET}
- POST_BUILD
- COMMAND ${CMAKE_COMMAND}
- ARGS -E copy_if_different
- "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
- "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
-)
+ # 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}>"
+ )
+ add_custom_command (
+ TARGET ${HDF5_TOOL_PLUGIN_LIB_VTARGET}
+ POST_BUILD
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different
+ "$<TARGET_FILE:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
+ "${CMAKE_BINARY_DIR}/plugins/$<TARGET_FILE_NAME:${HDF5_TOOL_PLUGIN_LIB_VTARGET}>"
+ )
+endif ()
include (CMakeTests.cmake)
diff --git a/tools/test/h5repack/CMakeTests.cmake b/tools/test/h5repack/CMakeTests.cmake
index a063e19..3ee5e27 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -1450,11 +1450,13 @@ ADD_H5_VERIFY_INVALIDBOUNDS (latest_latest_invalid bounds_latest_latest.h5 0 1)
##############################################################################
### P L U G I N T E S T S
##############################################################################
+if (BUILD_SHARED_LIBS)
ADD_H5_UD_TEST (plugin_version_test 0 h5repack_layout.h5 -v -f UD=260,0,4,9,${H5_VERS_MAJOR},${H5_VERS_MINOR},${H5_VERS_RELEASE})
ADD_H5_UD_TEST (plugin_test 0 h5repack_layout.h5 -v -f UD=257,0,1,9)
ADD_H5_UD_TEST (plugin_none 0 h5repack_layout.UD.h5 -v -f NONE)
# check for no parameters
ADD_H5_UD_TEST (plugin_zero 0 h5repack_layout.h5 -v -f UD=250,0,0)
+endif ()
if (HDF5_TEST_VFD)
# Run test with different Virtual File Driver
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index f6166da..0ae570b 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -3728,7 +3728,7 @@ out:
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -3797,7 +3797,7 @@ out:
H5Pclose(fcpl);
H5Fclose(fid);
} H5E_END_TRY;
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -3838,7 +3838,7 @@ make_userblock_file(void)
out:
- if(fd > 0)
+ if(fd >= 0)
HDclose(fd);
return -1;
@@ -4134,13 +4134,19 @@ int write_dset_in(hid_t loc_id,
}
/* create a type larger than TEST_BUFSIZE */
- if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0)
+ if ((tid = H5Tarray_create2(H5T_NATIVE_DOUBLE, 1, tdims)) < 0) {
+ HDfree(dbuf);
goto out;
+ }
size = H5Tget_size(tid);
- if ((sid = H5Screate_simple(1, sdims, NULL)) < 0)
+ if ((sid = H5Screate_simple(1, sdims, NULL)) < 0) {
+ HDfree(dbuf);
goto out;
- if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ }
+ if ((did = H5Dcreate2(loc_id, "arrayd", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) {
+ HDfree(dbuf);
goto out;
+ }
#if defined(WRITE_ARRAY)
H5Dwrite(did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, dbuf);
#endif
@@ -4149,7 +4155,7 @@ int write_dset_in(hid_t loc_id,
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
- HDfree( dbuf );
+ HDfree(dbuf);
}
/*-------------------------------------------------------------------------
diff --git a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
index 8f48c37..1d2914b 100644
--- a/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
+++ b/tools/test/h5repack/testfiles/h5repack_layout.h5-plugin_version_test.ddl
@@ -11,7 +11,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 11 3 }
+ PARAMS { 9 1 11 4 }
}
}
FILLVALUE {
diff --git a/tools/test/h5stat/h5stat_gentest.c b/tools/test/h5stat/h5stat_gentest.c
index 2daf24b..ae11032 100644
--- a/tools/test/h5stat/h5stat_gentest.c
+++ b/tools/test/h5stat/h5stat_gentest.c
@@ -14,7 +14,7 @@
/*
* Generate the binary hdf5 files for the h5stat tests.
* Usage: just execute the program without any arguments will
- * generate all the binary hdf5 files
+ * generate all the binary hdf5 files
*
* If you regenerate the test files (e.g., changing some code,
* trying it on a new platform, ...), you need to verify the correctness
@@ -24,25 +24,25 @@
#include "H5private.h"
/* For gen_newgrat_file() */
-#define NEWGRAT_FILE "h5stat_newgrat.h5"
-#define DATASET_NAME "DATASET_NAME"
-#define GROUP_NAME "GROUP"
-#define ATTR_NAME "ATTR"
-#define NUM_GRPS 35000
-#define NUM_ATTRS 100
+#define NEWGRAT_FILE "h5stat_newgrat.h5"
+#define DATASET_NAME "DATASET_NAME"
+#define GROUP_NAME "GROUP"
+#define ATTR_NAME "ATTR"
+#define NUM_GRPS 35000
+#define NUM_ATTRS 100
/* Declarations for gen_idx_file() */
-#define IDX_FILE "h5stat_idx.h5"
-#define DSET "dset"
-#define DSET_FILTER "dset_filter"
+#define IDX_FILE "h5stat_idx.h5"
+#define DSET "dset"
+#define DSET_FILTER "dset_filter"
/* For gen_threshold_file() */
-#define THRESHOLD_FILE "h5stat_threshold.h5"
-#define THRES_ATTR_NAME "attr"
-#define THRES_ATTR_GRP_NAME "grp_attr"
-#define THRES_DSET_NAME "dset"
-#define THRES_NUM 10
-#define THRES_NUM_25 25
+#define THRESHOLD_FILE "h5stat_threshold.h5"
+#define THRES_ATTR_NAME "attr"
+#define THRES_ATTR_GRP_NAME "grp_attr"
+#define THRES_DSET_NAME "dset"
+#define THRES_NUM 10
+#define THRES_NUM_25 25
/* For gen_err_refcount() */
#define ERR_REFCOUNT_FILE "h5stat_err_refcount.h5"
@@ -51,7 +51,7 @@
* Generate HDF5 file with latest format with
* NUM_GRPS groups and NUM_ATTRS attributes for the dataset
*/
-static void
+static void
gen_newgrat_file(const char *fname)
{
hid_t fcpl = -1; /* File creation property */
@@ -62,79 +62,66 @@ gen_newgrat_file(const char *fname)
hid_t sid = -1; /* Dataspace id */
hid_t attr_id = -1; /* Attribute id */
hid_t did = -1; /* Dataset id */
- char name[30]; /* Group name */
- char attrname[30]; /* Attribute name */
- int i; /* Local index variable */
+ char name[30]; /* Group name */
+ char attrname[30]; /* Attribute name */
+ int i; /* Local index variable */
/* Get a copy file access property list */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ goto error;
/* Set to use latest library format */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ goto error;
/* Get a copy of file creation property list */
if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0)
- goto error;
+ goto error;
/* Set file space handling strategy */
if(H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, 1, (hsize_t)1) < 0)
- goto error;
+ goto error;
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, fcpl, fapl)) < 0)
- goto error;
+ goto error;
/* Create NUM_GRPS groups in the root group */
for(i = 1; i <= NUM_GRPS; i++) {
sprintf(name, "%s%d", GROUP_NAME,i);
if((gid = H5Gcreate2(fid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
} /* end for */
/* Create a datatype to commit and use */
if((tid = H5Tcopy(H5T_NATIVE_INT)) < 0)
- goto error;
+ goto error;
/* Create dataspace for dataset */
if((sid = H5Screate(H5S_SCALAR)) < 0)
- goto error;
+ goto error;
/* Create dataset */
if((did = H5Dcreate2(fid, DATASET_NAME, tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create NUM_ATTRS for the dataset */
for(i = 1; i <= NUM_ATTRS; i++) {
sprintf(attrname, "%s%d", ATTR_NAME,i);
if((attr_id = H5Acreate2(did, attrname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
} /* end for */
/* Close dataset, dataspace, datatype, file */
- if(H5Pclose(fapl) < 0)
- goto error;
- if(H5Pclose(fcpl) < 0)
- goto error;
- if(H5Dclose(did) < 0)
- goto error;
- if(H5Sclose(sid) < 0)
- goto error;
- if(H5Tclose(tid) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
- H5Pclose(fapl);
- H5Pclose(fcpl);
- H5Aclose(attr_id);
+ H5Pclose(fapl);
+ H5Pclose(fcpl);
+ H5Aclose(attr_id);
H5Dclose(did);
H5Tclose(tid);
H5Sclose(sid);
@@ -145,192 +132,175 @@ error:
/*
* Generate an HDF5 file with groups, datasets, attributes for testing the options:
- * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
- * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
- * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
+ * -l N (--links=N): Set the threshold for # of links when printing information for small groups.
+ * -m N (--dims=N): Set the threshold for the # of dimension sizes when printing information for small datasets.
+ * -a N (--numattrs=N): Set the threshold for the # of attributes when printing information for small # of attributes.
*/
static void
gen_threshold_file(const char *fname)
{
- hid_t fid; /* File ID */
- hid_t sid0, sid1, sid2, sid3, sid4; /* Dataspace IDs */
- hid_t did; /* Dataset ID */
- hid_t attr_id; /* Attribute ID */
- hid_t gid; /* Group ID */
- hsize_t two_dims[] = {2, 5}; /* Dimension array */
- hsize_t one_dims[] = {6}; /* Dimension array */
- hsize_t zero_dims[] = {0}; /* Dimension array */
- char name[30]; /* Name */
- unsigned i; /* Local index variable */
+ hid_t fid = -1; /* File ID */
+ hid_t sid0 = -1; /* Dataspace IDs */
+ hid_t sid1 = -1; /* Dataspace IDs */
+ hid_t sid2 = -1; /* Dataspace IDs */
+ hid_t sid3 = -1; /* Dataspace IDs */
+ hid_t sid4 = -1; /* Dataspace IDs */
+ hid_t did = -1; /* Dataset ID */
+ hid_t attr_id = -1; /* Attribute ID */
+ hid_t gid = -1; /* Group ID */
+ hsize_t two_dims[] = {2, 5}; /* Dimension array */
+ hsize_t one_dims[] = {6}; /* Dimension array */
+ hsize_t zero_dims[] = {0}; /* Dimension array */
+ char name[30]; /* Name */
+ unsigned i; /* Local index variable */
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 1-D dataspace with zero dimension size */
if((sid0 = H5Screate_simple(1, zero_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create 1-D dataspace with non-zero dimension size*/
if((sid1 = H5Screate_simple(1, one_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create 2-D dataspace */
if((sid2 = H5Screate_simple(2, two_dims, NULL)) < 0)
- goto error;
+ goto error;
/* Create scalar dataspace */
if((sid3 = H5Screate(H5S_SCALAR)) < 0)
- goto error;
+ goto error;
/* Create null dataspace */
if((sid4 = H5Screate(H5S_NULL)) < 0)
- goto error;
+ goto error;
/* Create an attribute for the root group */
if((attr_id = H5Acreate2(fid, "attr", H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Create 1-D dataset with zero dimension size for the root group */
if((did = H5Dcreate2(fid, "zero_dset", H5T_NATIVE_UCHAR, sid0, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 11 attributes for the dataset */
for(i = 1; i <= (THRES_NUM+1); i++) {
sprintf(name, "%s%d", THRES_ATTR_NAME,i);
if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create dataset with scalar dataspace for the root group */
if((did = H5Dcreate2(fid, "scalar_dset", H5T_NATIVE_UCHAR, sid3, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create dataset with null dataspace for the root group */
if((did = H5Dcreate2(fid, "null_dset", H5T_NATIVE_UCHAR, sid4, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create 2-D dataset for the root group */
if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_UCHAR, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 10 attributes for the 2-D dataset */
for(i = 1; i <= THRES_NUM; i++) {
sprintf(name, "%s%d", THRES_ATTR_NAME,i);
if((attr_id = H5Acreate2(did, name, H5T_NATIVE_INT, sid1, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
/* Create first group */
if((gid = H5Gcreate2(fid, "group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create an attribute for the group */
if((attr_id = H5Acreate2(gid, "ATTR", H5T_NATIVE_INT, sid3, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Close attribute */
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
/* Create 10 1-D datasets with non-zero dimension size for the group */
for(i = 1; i <= THRES_NUM; i++) {
- /* set up dataset name */
+ /* set up dataset name */
sprintf(name, "%s%d", THRES_DSET_NAME,i);
- /* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Close the dataset */
+ /* Close the dataset */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
}
/* Close the group */
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
/* Create second group */
if((gid = H5Gcreate2(fid, "group2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 25 attributes for the group */
for(i = 1; i <= THRES_NUM_25; i++) {
- /* Set up attribute name */
+ /* Set up attribute name */
sprintf(name, "%s%d", THRES_ATTR_GRP_NAME,i);
- /* Create the attribute */
+ /* Create the attribute */
if((attr_id = H5Acreate2(gid, name, H5T_NATIVE_INT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
- /* Close the attribute */
+ /* Close the attribute */
if(H5Aclose(attr_id) < 0)
- goto error;
+ goto error;
}
/* Close the group */
if(H5Gclose(gid) < 0)
- goto error;
+ goto error;
/* Create third group */
if((gid = H5Gcreate2(fid, "group3", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
/* Create 9 1-D datasets with non-zero dimension size for the group */
for(i = 1; i < THRES_NUM; i++) {
- /* set up dataset name */
+ /* set up dataset name */
sprintf(name, "%s%d", THRES_DSET_NAME,i);
- /* Create the dataset */
- if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
+ /* Create the dataset */
+ if((did = H5Dcreate2(gid, name, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
- /* Close the dataset */
+ /* Close the dataset */
if(H5Dclose(did) < 0)
- goto error;
+ goto error;
}
- /* Close the group */
- if(H5Gclose(gid) < 0)
- goto error;
-
-
- /* Close dataspaces */
- if(H5Sclose(sid0) < 0)
- goto error;
- if(H5Sclose(sid1) < 0)
- goto error;
- if(H5Sclose(sid2) < 0)
- goto error;
- if(H5Sclose(sid3) < 0)
- goto error;
- if(H5Sclose(sid4) < 0)
- goto error;
-
- /* Close file */
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
H5Gclose(gid);
- H5Aclose(attr_id);
+ H5Aclose(attr_id);
H5Dclose(did);
H5Sclose(sid0);
H5Sclose(sid1);
@@ -346,84 +316,73 @@ error:
* Function: gen_idx_file
*
* Purpose: Create a file with datasets that use Fixed Array indexing:
- * one dataset: fixed dimension, chunked layout, w/o filters
- * one dataset: fixed dimension, chunked layout, w/ filters
+ * one dataset: fixed dimension, chunked layout, w/o filters
+ * one dataset: fixed dimension, chunked layout, w/ filters
*
*/
-static void
+static void
gen_idx_file(const char *fname)
{
- hid_t fapl = -1; /* file access property id */
- hid_t fid = -1; /* file id */
- hid_t sid = -1; /* space id */
- hid_t dcpl = -1; /* dataset creation property id */
- hid_t did = -1, did2 = -1; /* dataset id */
- hsize_t dims[1] = {10}; /* dataset dimension */
- hsize_t c_dims[1] = {2}; /* chunk dimension */
- int i; /* local index variable */
- int buf[10]; /* data buffer */
+ hid_t fapl = -1; /* file access property id */
+ hid_t fid = -1; /* file id */
+ hid_t sid = -1; /* space id */
+ hid_t dcpl = -1; /* dataset creation property id */
+ hid_t did = -1, did2 = -1; /* dataset id */
+ hsize_t dims[1] = {10}; /* dataset dimension */
+ hsize_t c_dims[1] = {2}; /* chunk dimension */
+ int i; /* local index variable */
+ int buf[10]; /* data buffer */
/* Get a copy of the file access property */
if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0)
- goto error;
+ goto error;
/* Set the "use the latest format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- goto error;
+ goto error;
/* Create file */
if((fid = H5Fcreate(fname, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
- goto error;
+ goto error;
/* Create data */
for(i = 0; i < 10; i++)
- buf[i] = i;
+ buf[i] = i;
/* Set chunk */
if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
- goto error;
+ goto error;
if(H5Pset_chunk(dcpl, 1, c_dims) < 0)
- goto error;
+ goto error;
/* Create a 1D dataset */
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
- goto error;
+ goto error;
if((did = H5Dcreate2(fid, DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
-
+ goto error;
+
/* Write to the dataset */
if(H5Dwrite(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
#if defined (H5_HAVE_FILTER_DEFLATE)
/* set deflate data */
if(H5Pset_deflate(dcpl, 9) < 0)
- goto error;
+ goto error;
/* Create and write the dataset */
if((did2 = H5Dcreate2(fid, DSET_FILTER, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
- goto error;
+ goto error;
if(H5Dwrite(did2, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0)
- goto error;
+ goto error;
/* Close the dataset */
if(H5Dclose(did2) < 0)
- goto error;
+ goto error;
#endif
/* closing: dataspace, dataset, file */
- if(H5Pclose(fapl) < 0)
- goto error;
- if(H5Pclose(dcpl) < 0)
- goto error;
- if(H5Sclose(sid) < 0)
- goto error;
- if(H5Dclose(did) < 0)
- goto error;
- if(H5Fclose(fid) < 0)
- goto error;
-
error:
H5E_BEGIN_TRY {
H5Pclose(fapl);
@@ -451,7 +410,7 @@ error:
* H5O_refcount_decode in the jira issue.
*
*/
-static void
+static void
gen_err_refcount(const char *fname)
{
hid_t fid = -1; /* File identifier */
@@ -525,16 +484,13 @@ gen_err_refcount(const char *fname)
/* Offset of the message ID to modify is as follows: */
/* 4520: the offset of the object header containing the attribute message
with the committed datatype */
- /* 24: the offset in the object header containing the version of the
+ /* 24: the offset in the object header containing the version of the
attribute message */
- if((fd = HDopen(fname, O_RDWR, 0633)) < 0)
- goto error;
- if(HDlseek(fd, 4520+24, SEEK_SET) < 0)
- goto error;
- if(HDwrite(fd, &val, 2) < 0)
- goto error;
- if(HDclose(fd) < 0)
- goto error;
+ if((fd = HDopen(fname, O_RDWR, 0633)) >= 0) {
+ HDlseek(fd, 4520+24, SEEK_SET);
+ HDwrite(fd, &val, 2);
+ HDclose(fd);
+ }
error:
H5E_BEGIN_TRY {
@@ -548,8 +504,8 @@ error:
} H5E_END_TRY;
} /* gen_err_refcount() */
-/*
- * The following two test files are generated with older versions
+/*
+ * The following two test files are generated with older versions
* of the library for HDFFV-10333. They are used for testing in
* testh5stat.sh.in.
*
@@ -559,7 +515,7 @@ error:
* Then a "0" is written to the "dimension" field in the layout
* message to trigger the error.
* This is to verify HDFFV-10333 that h5stat will exit gracefully
- * when encountered error similar to H5O__layout_decode in the
+ * when encountered error similar to H5O__layout_decode in the
* jira issue.
*
* (2) h5stat_err_old_fill.h5
@@ -568,7 +524,7 @@ error:
* Then an illegal size is written to the "size" fild in the
* fill value message to trigger the error.
* This is to verify HDFFV-10333 that h5stat will exit gracefully
- * when encountered error similar to H5O_fill_old_decode in the
+ * when encountered error similar to H5O_fill_old_decode in the
* jira issue.
*/
diff --git a/tools/test/perform/zip_perf.c b/tools/test/perform/zip_perf.c
index 0636d3b..e301bb3 100644
--- a/tools/test/perform/zip_perf.c
+++ b/tools/test/perform/zip_perf.c
@@ -419,7 +419,9 @@ fill_with_random_data(Bytef *src, uLongf src_len)
buf += rc;
len -= (size_t)rc;
}
- } else {
+ HDclose(fd);
+ }
+ else {
HDfprintf(stdout, "Using random() for random data\n");
for (u = 0; u < src_len; ++u)
@@ -557,7 +559,7 @@ main(int argc, char **argv)
int opt;
prog = argv[0];
-
+
/* Initialize h5tools lib */
h5tools_init();