diff options
Diffstat (limited to 'tools/misc')
-rw-r--r-- | tools/misc/CMakeLists.txt | 31 | ||||
-rw-r--r-- | tools/misc/CMakeTests.cmake | 45 | ||||
-rw-r--r-- | tools/misc/Makefile.am | 10 | ||||
-rw-r--r-- | tools/misc/Makefile.in | 13 | ||||
-rw-r--r-- | tools/misc/h5cc.in | 10 | ||||
-rw-r--r-- | tools/misc/h5debug.c | 34 | ||||
-rw-r--r-- | tools/misc/h5mkgrp.c | 19 | ||||
-rw-r--r-- | tools/misc/h5redeploy.in | 10 | ||||
-rw-r--r-- | tools/misc/h5repart.c | 99 | ||||
-rw-r--r-- | tools/misc/h5repart_gentest.c | 13 | ||||
-rw-r--r-- | tools/misc/repart_test.c | 10 | ||||
-rw-r--r-- | tools/misc/talign.c | 64 | ||||
-rw-r--r-- | tools/misc/testh5mkgrp.sh.in | 44 | ||||
-rw-r--r-- | tools/misc/testh5repart.sh.in | 16 |
14 files changed, 195 insertions, 223 deletions
diff --git a/tools/misc/CMakeLists.txt b/tools/misc/CMakeLists.txt index 12d5a52..da1af42 100644 --- a/tools/misc/CMakeLists.txt +++ b/tools/misc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 3.1.0) +cmake_minimum_required (VERSION 3.2.2) PROJECT (HDF5_TOOLS_MISC) #----------------------------------------------------------------------------- @@ -42,7 +42,7 @@ set (H5_DEP_EXECUTABLES #----------------------------------------------------------------------------- #if (NOT WIN32) # configure_file (${HDF5_TOOLS_MISC_SOURCE_DIR}/h5cc.in ${HDF5_BINARY_DIR}/h5cc @ONLY) -#endif (NOT WIN32) +#endif () if (BUILD_TESTING) # -------------------------------------------------------------------- @@ -55,7 +55,7 @@ if (BUILD_TESTING) target_link_libraries (h5repart_gentest ${HDF5_LIB_TARGET} ${HDF5_TOOLS_LIB_TARGET}) set_target_properties (h5repart_gentest PROPERTIES FOLDER generator/tools) #add_test (NAME h5repart_gentest COMMAND $<TARGET_FILE:h5repart_gentest>) - endif (HDF5_BUILD_GENERATORS) + endif () add_executable (h5repart_test ${HDF5_TOOLS_MISC_SOURCE_DIR}/repart_test.c) TARGET_NAMING (h5repart_test STATIC) @@ -64,7 +64,7 @@ if (BUILD_TESTING) set_target_properties (h5repart_test PROPERTIES FOLDER tools) include (CMakeTests.cmake) -endif (BUILD_TESTING) +endif () ############################################################################## ############################################################################## @@ -75,15 +75,16 @@ endif (BUILD_TESTING) #----------------------------------------------------------------------------- # Rules for Installation of tools using make Install target #----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) + INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5debug ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5repart ${HDF5_INSTALL_BIN_DIR} toolsapplications) -#INSTALL_PROGRAM_PDB (h5mkgrp ${HDF5_INSTALL_BIN_DIR} toolsapplications) - -install ( - TARGETS - h5debug h5repart h5mkgrp - EXPORT - ${HDF5_EXPORTED_TARGETS} - RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications -) + install ( + TARGETS + h5debug h5repart h5mkgrp + EXPORT + ${HDF5_EXPORTED_TARGETS} + RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications + ) +endif () diff --git a/tools/misc/CMakeTests.cmake b/tools/misc/CMakeTests.cmake index 6822be5..afc760b 100644 --- a/tools/misc/CMakeTests.cmake +++ b/tools/misc/CMakeTests.cmake @@ -1,3 +1,14 @@ +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + ############################################################################## ############################################################################## @@ -31,7 +42,7 @@ foreach (h5_file ${HDF5_REFERENCE_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5repart_files") - endforeach (h5_file ${HDF5_REFERENCE_TEST_FILES}) + endforeach () add_custom_target(h5repart_files ALL COMMENT "Copying files needed by h5repart tests" DEPENDS ${h5repart_files_list}) set (HDF5_MKGRP_TEST_FILES @@ -56,7 +67,7 @@ foreach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) HDFTEST_COPY_FILE("${HDF5_TOOLS_SRC_DIR}/testfiles/${h5_mkgrp_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_mkgrp_file}" "h5mkgrp_files") - endforeach (h5_mkgrp_file ${HDF5_MKGRP_TEST_FILES}) + endforeach () HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/h5mkgrp_help.txt" "${PROJECT_BINARY_DIR}/testfiles/h5mkgrp_help.txt" "h5mkgrp_files") add_custom_target(h5mkgrp_files ALL COMMENT "Copying files needed by h5mkgrp tests" DEPENDS ${h5mkgrp_files_list}) @@ -69,18 +80,16 @@ ############################################################################## ############################################################################## - MACRO (ADD_H5_TEST resultfile resultcode resultoption) + macro (ADD_H5_TEST resultfile resultcode resultoption) if (NOT HDF5_ENABLE_USING_MEMCHECKER) add_test ( NAME H5MKGRP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5MKGRP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") - endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif () add_test ( NAME H5MKGRP-${resultfile} @@ -90,8 +99,8 @@ if (HDF5_ENABLE_USING_MEMCHECKER) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") - else (HDF5_ENABLE_USING_MEMCHECKER) + endif () + else () set_tests_properties (H5MKGRP-${resultfile} PROPERTIES DEPENDS H5MKGRP-${resultfile}-clear-objects) add_test ( NAME H5MKGRP-${resultfile}-h5ls @@ -106,20 +115,18 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP-${resultfile}-h5ls PROPERTIES DEPENDS H5MKGRP-${resultfile}) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_TEST resultfile resultcode resultoption) + endif () + endmacro () - MACRO (ADD_H5_CMP resultfile resultcode) + macro (ADD_H5_CMP resultfile resultcode) if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5MKGRP_CMP-${resultfile} COMMAND $<TARGET_FILE:h5mkgrp> ${ARGN}) - else (HDF5_ENABLE_USING_MEMCHECKER) + else () add_test ( NAME H5MKGRP_CMP-${resultfile}-clear-objects COMMAND ${CMAKE_COMMAND} -E remove ${resultfile}.h5 - ${resultfile}.out - ${resultfile}.out.err ) set_tests_properties (H5MKGRP_CMP-${resultfile}-clear-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") add_test ( @@ -134,8 +141,8 @@ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" ) set_tests_properties (H5MKGRP_CMP-${resultfile} PROPERTIES DEPENDS H5MKGRP_CMP-${resultfile}-clear-objects) - endif (HDF5_ENABLE_USING_MEMCHECKER) - ENDMACRO (ADD_H5_CMP resultfile resultcode) + endif () + endmacro () ############################################################################## ############################################################################## @@ -158,7 +165,7 @@ ) if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5REPART-clearall-objects") # repartition family member size to 20,000 bytes. @@ -230,9 +237,9 @@ set_tests_properties (H5MKGRP-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") if (NOT "${last_test}" STREQUAL "") set_tests_properties (H5MKGRP-clearall-objects PROPERTIES DEPENDS ${last_test}) - endif (NOT "${last_test}" STREQUAL "") + endif () set (last_test "H5MKGRP-clearall-objects") - endif (HDF5_ENABLE_USING_MEMCHECKER) + endif () # Check that help & version is displayed properly ADD_H5_CMP (h5mkgrp_help 0 "-h") diff --git a/tools/misc/Makefile.am b/tools/misc/Makefile.am index 882f8f2..91a045e 100644 --- a/tools/misc/Makefile.am +++ b/tools/misc/Makefile.am @@ -5,12 +5,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. ## ## Makefile.am ## Run automake to generate a Makefile.in from this file. diff --git a/tools/misc/Makefile.in b/tools/misc/Makefile.in index dfbdc2a..6a54bd8 100644 --- a/tools/misc/Makefile.in +++ b/tools/misc/Makefile.in @@ -21,12 +21,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. # # HDF5 Library Makefile(.in) # @@ -583,6 +581,7 @@ THREADSAFE = @THREADSAFE@ TIME = @TIME@ TR = @TR@ TRACE_API = @TRACE_API@ +UNAME_CYGWIN = @UNAME_CYGWIN@ UNAME_INFO = @UNAME_INFO@ USE_FILTER_DEFLATE = @USE_FILTER_DEFLATE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ @@ -732,7 +731,7 @@ LDADD = $(LIBH5TOOLS) $(LIBHDF5) # named h5pcc if hdf5 is being built in parallel mode. @BUILD_PARALLEL_CONDITIONAL_TRUE@H5CC_NAME = h5pcc -# Automake needs to be taught how to build lib, progs, and tests targets. +# Automake needs to be taught how to build lib, dyn, progs, and tests targets. # These will be filled in automatically for the most part (e.g., # lib_LIBRARIES are built for lib target), but EXTRA_LIB, EXTRA_PROG, and # EXTRA_TEST variables are supplied to allow the user to force targets to diff --git a/tools/misc/h5cc.in b/tools/misc/h5cc.in index 1645855..9c4e3ca 100644 --- a/tools/misc/h5cc.in +++ b/tools/misc/h5cc.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. ## # This tool is adapted from the mpicc command of the MPICH Software. diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 9c9153a..f758b1f 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /*------------------------------------------------------------------------- @@ -57,15 +55,15 @@ /*------------------------------------------------------------------------- * Function: get_H5B2_class * - * Purpose: Determine the v2 B-tree class from the buffer read in. + * Purpose: Determine the v2 B-tree class from the buffer read in. * B-trees are debugged through the B-tree subclass. The subclass * identifier is two bytes after the B-tree signature. * - * Return: Non-NULL on success/NULL on failure + * Return: Non-NULL on success/NULL on failure * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * Sep 11 2008 + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Sep 11 2008 * *------------------------------------------------------------------------- */ @@ -143,16 +141,18 @@ get_H5B2_class(const uint8_t *sig) int main(int argc, char *argv[]) { - hid_t fid, fapl, dxpl; + hid_t fid, fapl, dxpl; H5F_t *f; haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; + H5E_auto2_t func; + void *edata; herr_t status = SUCCEED; if(argc == 1) { - HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); - HDexit(1); + HDfprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]); + HDexit(1); } /* end if */ /* Initialize the library */ @@ -161,6 +161,10 @@ main(int argc, char *argv[]) HDexit(1); } /* end if */ + /* Disable error reporting */ + H5Eget_auto2(H5E_DEFAULT, &func, &edata); + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + /* * Open the file and get the file descriptor. */ @@ -448,6 +452,8 @@ main(int argc, char *argv[]) H5Pclose(fapl); H5Fclose(fid); + H5Eset_auto2(H5E_DEFAULT, func, edata); + return 0; } /* main() */ diff --git a/tools/misc/h5mkgrp.c b/tools/misc/h5mkgrp.c index 8dee706..597b6b3 100644 --- a/tools/misc/h5mkgrp.c +++ b/tools/misc/h5mkgrp.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ @@ -63,7 +61,7 @@ param_t params; /* Command line parameter settings */ static void leave(int ret) { - int curr_group; + size_t curr_group; if (params.fname) HDfree (params.fname); @@ -180,8 +178,8 @@ parse_command_line(int argc, const char *argv[], param_t *parms) } /* end if */ /* Allocate space for the group name pointers */ - parms->ngroups = (argc - opt_ind); - parms->groups = HDmalloc(parms->ngroups * sizeof(char *)); + parms->ngroups = (size_t)(argc - opt_ind); + parms->groups = (char **)HDmalloc(parms->ngroups * sizeof(char *)); /* Retrieve the group names */ curr_group = 0; @@ -328,9 +326,6 @@ main(int argc, const char *argv[]) leave(EXIT_FAILURE); } /* end if */ - /* Shut down h5tools lib */ - h5tools_close(); - leave(EXIT_SUCCESS); } /* end main() */ diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index 6b6ef87..242459a 100644 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. # ## Update HDF5 compiler tools after the HDF5 software has been installed ## diff --git a/tools/misc/h5repart.c b/tools/misc/h5repart.c index ffd52e8..911e0c6 100644 --- a/tools/misc/h5repart.c +++ b/tools/misc/h5repart.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* @@ -194,27 +192,25 @@ main (int argc, char *argv[]) int src, dst=-1; /*source & destination files */ int need_seek=FALSE; /*destination needs to seek? */ int need_write; /*data needs to be written? */ - /*struct stat sb; temporary file stat buffer */ - /*struct _stati64 sb;*/ - h5_stat_t sb; + h5_stat_t sb; /*temporary file stat buffer */ int verbose=FALSE; /*display file names? */ - const char *src_gen_name; /*general source name */ - char src_name[NAMELEN]; /*source member name */ + const char *src_gen_name; /*general source name */ + char *src_name=NULL; /*source member name */ int src_is_family; /*is source name a family name? */ int src_membno=0; /*source member number */ - const char *dst_gen_name; /*general destination name */ - char dst_name[NAMELEN]; /*destination member name */ + const char *dst_gen_name; /*general destination name */ + char *dst_name=NULL; /*destination member name */ int dst_is_family; /*is dst name a family name? */ int dst_membno=0; /*destination member number */ off_t left_overs=0; /*amount of zeros left over */ off_t src_offset=0; /*offset in source member */ off_t dst_offset=0; /*offset in destination member */ - off_t src_size; /*source logical member size */ + off_t src_size; /*source logical member size */ off_t src_act_size; /*source actual member size */ off_t dst_size=1 GB; /*destination logical memb size */ hid_t fapl; /*file access property list */ @@ -232,24 +228,30 @@ main (int argc, char *argv[]) * Parse switches. */ while (argno<argc && '-'==argv[argno][0]) { - if (!strcmp (argv[argno], "-v")) { - verbose = TRUE; - argno++; - } else if (!strcmp(argv[argno], "-V")) { - printf("This is %s version %u.%u release %u\n", - prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); - exit(EXIT_SUCCESS); + if (!strcmp (argv[argno], "-v")) { + verbose = TRUE; + argno++; + } else if (!strcmp(argv[argno], "-V")) { + printf("This is %s version %u.%u release %u\n", + prog_name, H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE); + exit(EXIT_SUCCESS); } else if (!strcmp (argv[argno], "-family_to_sec2")) { - family_to_sec2 = TRUE; - argno++; - } else if ('b'==argv[argno][1]) { - blk_size = get_size (prog_name, &argno, argc, argv); - } else if ('m'==argv[argno][1]) { - dst_size = get_size (prog_name, &argno, argc, argv); - } else { - usage (prog_name); - } - } + family_to_sec2 = TRUE; + argno++; + } else if ('b'==argv[argno][1]) { + blk_size = (size_t)get_size (prog_name, &argno, argc, argv); + } else if ('m'==argv[argno][1]) { + dst_size = get_size (prog_name, &argno, argc, argv); + } else { + usage (prog_name); + } /* end if */ + } /* end while */ + + /* allocate names */ + if(NULL == (src_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) + exit(EXIT_FAILURE); + if(NULL == (dst_name = (char *)HDcalloc((size_t)NAMELEN, sizeof(char)))) + exit(EXIT_FAILURE); /* * Get the name for the source file and open the first member. The size @@ -261,13 +263,13 @@ main (int argc, char *argv[]) src_is_family = strcmp (src_name, src_gen_name); if ((src=HDopen(src_name, O_RDONLY,0))<0) { - perror (src_name); - exit (EXIT_FAILURE); + perror (src_name); + exit (EXIT_FAILURE); } if (HDfstat(src, &sb)<0) { - perror ("fstat"); - exit (EXIT_FAILURE); + perror ("fstat"); + exit (EXIT_FAILURE); } src_size = src_act_size = sb.st_size; if (verbose) fprintf (stderr, "< %s\n", src_name); @@ -290,7 +292,7 @@ main (int argc, char *argv[]) if (argno<argc) usage (prog_name); /* Now the real work, split the file */ - buf = HDmalloc (blk_size); + buf = (char *)HDmalloc(blk_size); while (src_offset<src_size) { /* Read a block. The amount to read is the minimum of: @@ -302,7 +304,7 @@ main (int argc, char *argv[]) if (dst_is_family) n = (size_t)MIN((off_t)n, dst_size-dst_offset); if (left_overs) { n = (size_t)MIN ((off_t)n, left_overs); - left_overs -= n; + left_overs = left_overs - (off_t)n; need_write = FALSE; } else if (src_offset<src_act_size) { n = (size_t)MIN ((off_t)n, src_act_size-src_offset); @@ -353,16 +355,16 @@ main (int argc, char *argv[]) * loop. The destination offset must be updated so we can fix * trailing holes. */ - src_offset += n; + src_offset = src_offset + (off_t)n; if (src_offset==src_act_size) { HDclose (src); if (!src_is_family) { - dst_offset += n; + dst_offset = dst_offset + (off_t)n; break; } sprintf (src_name, src_gen_name, ++src_membno); if ((src=HDopen (src_name, O_RDONLY,0))<0 && ENOENT==errno) { - dst_offset += n; + dst_offset = dst_offset + (off_t)n; break; } else if (src<0) { perror (src_name); @@ -386,7 +388,7 @@ main (int argc, char *argv[]) * needed. The first member is extended to the logical member size * but other members might be smaller if they end with a hole. */ - dst_offset += n; + dst_offset = dst_offset + (off_t)n; if (dst_is_family && dst_offset==dst_size) { if (0==dst_membno) { if (HDlseek (dst, dst_size-1, SEEK_SET)<0) { @@ -468,7 +470,7 @@ main (int argc, char *argv[]) } /* Set the property of the new member size as hsize_t */ - hdsize = dst_size; + hdsize = (hsize_t)dst_size; if(H5Pset(fapl, H5F_ACS_FAMILY_NEWSIZE_NAME, &hdsize) < 0) { perror ("H5Pset"); exit (EXIT_FAILURE); @@ -485,19 +487,22 @@ main (int argc, char *argv[]) H5E_BEGIN_TRY { file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl); } H5E_END_TRY; + if(file>=0) { if(H5Fclose(file)<0) { perror ("H5Fclose"); exit (EXIT_FAILURE); - } - } + } /* end if */ + } /* end if */ if(H5Pclose(fapl)<0) { perror ("H5Pclose"); exit (EXIT_FAILURE); - } + } /* end if */ /* Free resources and return */ - HDfree (buf); + HDfree(src_name); + HDfree(dst_name); + HDfree(buf); return EXIT_SUCCESS; -} +} /* end main */ diff --git a/tools/misc/h5repart_gentest.c b/tools/misc/h5repart_gentest.c index f7d9a73..5c1ff87 100644 --- a/tools/misc/h5repart_gentest.c +++ b/tools/misc/h5repart_gentest.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* @@ -27,12 +25,13 @@ #define FAMILY_SIZE 1024 #define FILENAME "family_file%05d.h5" +static int buf[FAMILY_NUMBER][FAMILY_SIZE]; + int main(void) { hid_t file=(-1), fapl, space=(-1), dset=(-1); char dname[]="dataset"; int i, j; - int buf[FAMILY_NUMBER][FAMILY_SIZE]; hsize_t dims[2]={FAMILY_NUMBER, FAMILY_SIZE}; /* Set property list and file name for FAMILY driver */ diff --git a/tools/misc/repart_test.c b/tools/misc/repart_test.c index e6da779..372f46a 100644 --- a/tools/misc/repart_test.c +++ b/tools/misc/repart_test.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* diff --git a/tools/misc/talign.c b/tools/misc/talign.c index 2d0a9d1..83bb92a 100644 --- a/tools/misc/talign.c +++ b/tools/misc/talign.c @@ -5,12 +5,10 @@ * * * This file is part of HDF5. The full HDF5 copyright notice, including * * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* @@ -19,7 +17,7 @@ */ #include <string.h> #include <stdlib.h> -/*#include <unistd.h> *//* Required for unlink() */ +/*#include <unistd.h> *//* Required for unlink() */ #include "hdf5.h" #include "H5private.h" @@ -37,11 +35,11 @@ const char *setname = "align"; int main(void) { - hid_t fil,spc,set; - hid_t cs6, cmp, fix; - hid_t cmp1, cmp2, cmp3; - hid_t plist; - hid_t array_dt; + hid_t fil=-1, spc=-1, set=-1; + hid_t cs6=-1, cmp=-1, fix=-1; + hid_t cmp1=-1, cmp2=-1, cmp3=-1; + hid_t plist=-1; + hid_t array_dt=-1; hsize_t dim[2]; hsize_t cdim[4]; @@ -49,7 +47,7 @@ int main(void) char string5[5]; float fok[2] = {1234.0f, 2341.0f}; float fnok[2] = {5678.0f, 6785.0f}; - float *fptr; + float *fptr = NULL; char *data = NULL; @@ -88,8 +86,7 @@ int main(void) H5Tinsert(cmp, "Not Ok", sizeof(fok) + sizeof(string5), array_dt); H5Tclose(array_dt); - fix = h5tools_get_native_type(cmp); - + fix = H5Tget_native_type(cmp, H5T_DIR_DEFAULT); cmp1 = H5Tcreate(H5T_COMPOUND, sizeof(fok)); cdim[0] = sizeof(fok) / sizeof(float); @@ -108,7 +105,7 @@ int main(void) H5Tclose(array_dt); plist = H5Pcreate(H5P_DATASET_XFER); - if((error = H5Pset_preserve(plist, 1)) < 0) + if((error = H5Pset_preserve(plist, 1)) < 0) goto out; /* @@ -137,6 +134,7 @@ int main(void) H5Dread(set, fix, spc, H5S_ALL, H5P_DEFAULT, data); fptr = (float *)(data + H5Tget_member_offset(fix, 1)); + H5Dclose(set); out: if(error < 0) { @@ -194,7 +192,9 @@ out: if(data) HDfree(data); H5Sclose(spc); + H5Tclose(cs6); H5Tclose(cmp); + H5Tclose(fix); H5Tclose(cmp1); H5Tclose(cmp2); H5Tclose(cmp3); @@ -205,35 +205,3 @@ out: return result; } -/*------------------------------------------------------------------------- - * Function: h5tools_get_native_type - * - * Purpose: Wrapper around H5Tget_native_type() to work around - * Problems with bitfields. - * - * Return: Success: datatype ID - * - * Failure: FAIL - * - * Programmer: Quincey Koziol - * Tuesday, October 5, 2004 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -hid_t -h5tools_get_native_type(hid_t type) -{ - hid_t p_type; - H5T_class_t type_class; - - type_class = H5Tget_class(type); - if(type_class==H5T_BITFIELD) - p_type=H5Tcopy(type); - else - p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); - - return(p_type); -} - diff --git a/tools/misc/testh5mkgrp.sh.in b/tools/misc/testh5mkgrp.sh.in index 190e824..2d2e5f7 100644 --- a/tools/misc/testh5mkgrp.sh.in +++ b/tools/misc/testh5mkgrp.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. # # Tests for the h5mkgrp tool # @@ -103,7 +101,7 @@ COPY_TESTFILES_TO_TESTDIR() $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -117,7 +115,7 @@ CLEAN_TESTFILES_AND_TESTDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=$SRC_H5MKGRP_TESTFILES INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -127,7 +125,7 @@ CLEAN_TESTFILES_AND_TESTDIR() # Print a line-line message left justified in a field of 70 characters # beginning with the word "Testing". -TESTING() +TESTING() { SPACES=" " echo "Testing $* $SPACES" |cut -c1-70 |tr -d '\012' @@ -139,7 +137,7 @@ TESTING() # Print a line-line message left justified in a field of 70 characters # beginning with the word "Verifying". # -VERIFY_H5LS() +VERIFY_H5LS() { SPACES=" " echo "Verifying h5ls file structure $* $SPACES" | cut -c1-70 | tr -d '\012' @@ -151,7 +149,7 @@ VERIFY_H5LS() # Assumed arguments: # $* arguments for h5mkgrp. -TOOLTEST() +TOOLTEST() { TESTING $H5MKGRP $@ ( @@ -176,7 +174,7 @@ TOOLTEST() # Call the h5ls tool to verify the correct output data in the destination file # -H5LSTEST() +H5LSTEST() { expect="$TESTDIR/`basename $1 .h5`.ls" actual="$TESTDIR/`basename $1 .h5`.out" @@ -196,9 +194,11 @@ H5LSTEST() STDERR_FILTER $actual if [ ! -f $expect ]; then - # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + echo " Expected result (*.ls) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then echo " PASSED" else @@ -220,7 +220,7 @@ H5LSTEST() # $1 is test file name # $2 is h5mkgrp options # $* are groups to create -RUNTEST() +RUNTEST() { FILEOUT=$1 shift @@ -249,7 +249,7 @@ RUNTEST() # $1 is test expected output file # $2 is h5mkgrp options # $* are groups to create -CMPTEST() +CMPTEST() { FILEOUT=$1 expect="$TESTDIR/`basename $1 .h5`.txt" @@ -265,11 +265,13 @@ CMPTEST() $RUNSERIAL $H5MKGRP_BIN $@ ) >$actual 2>$actual_err cat $actual_err >> $actual - + if [ ! -f $expect ]; then # Create the expect file if it doesn't yet exist. - echo " CREATED" - cp $actual $expect + echo " CREATED" + cp $actual $expect + echo " Expected result (*.txt) missing" + nerrors="`expr $nerrors + 1`" elif $CMP $expect $actual; then echo " PASSED" else @@ -307,7 +309,7 @@ RUNTEST h5mkgrp_several_v.h5 "-v" one two RUNTEST h5mkgrp_several_p.h5 "-p" one two RUNTEST h5mkgrp_several_l.h5 "-l" one two -# Create various nested groups +# Create various nested groups RUNTEST h5mkgrp_nested_p.h5 "-p" /one/two RUNTEST h5mkgrp_nested_lp.h5 "-lp" /one/two RUNTEST h5mkgrp_nested_mult_p.h5 "-p" /one/two /three/four diff --git a/tools/misc/testh5repart.sh.in b/tools/misc/testh5repart.sh.in index fc33e0e..e33a905 100644 --- a/tools/misc/testh5repart.sh.in +++ b/tools/misc/testh5repart.sh.in @@ -6,12 +6,10 @@ # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in -# the files COPYING and Copyright.html. COPYING can be found at the root -# of the source code distribution tree; Copyright.html can be found at the -# root level of an installed copy of the electronic HDF5 document set and -# is linked from the top-level documents page. It can also be found at -# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have -# access to either file, you may request a copy from help@hdfgroup.org. +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. # # Tests for the h5repart tool @@ -80,13 +78,13 @@ OUTPUTTEST() { # Print a "SKIP" message SKIP() { - TESTING $REPART $@ - echo " -SKIP-" + TESTING $REPART $@ + echo " -SKIP-" } ############################################################################## ############################################################################## -### T H E T E S T S ### +### T H E T E S T S ### ############################################################################## ############################################################################## |