diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-02-22 04:05:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-22 04:05:43 (GMT) |
commit | df1a4af96126682ea4a05c2b26bf6b7c916579ff (patch) | |
tree | 993205ed1edde76001a811532f91997138b46744 /tools/h5jam | |
parent | 88960489604861813b3676bc234f49ca8ee937d3 (diff) | |
download | hdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.zip hdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.tar.gz hdf5-df1a4af96126682ea4a05c2b26bf6b7c916579ff.tar.bz2 |
HDF5 1 8 merge of recent changes and tools (#353)
* Update supported platforms
* Merge PR#3 changes from develop
* # WARNING: head commit changed in the meantime
Merge gcc 10 diagnostics option from develop
Merge CMake changes from develop
Merge warnings from develop
Merge #318 OSX changes from develop
Merge tools changes from develop
Merge test macros from develop
* Format updates
* Fix missing semicolon and format fix
* Format update
* Correct actions, remove java option
* Update autotools build files
* Add testfiles
* Fix configure issue with make flags
* Init fapls to default
* Update generated files and fix h5repack id closure
* update format
Diffstat (limited to 'tools/h5jam')
-rw-r--r-- | tools/h5jam/Makefile.in | 35 | ||||
-rw-r--r-- | tools/h5jam/h5jam.c | 120 | ||||
-rw-r--r-- | tools/h5jam/h5unjam.c | 36 | ||||
-rw-r--r-- | tools/h5jam/tellub.c | 56 |
4 files changed, 129 insertions, 118 deletions
diff --git a/tools/h5jam/Makefile.in b/tools/h5jam/Makefile.in index 7a60ca3..fdcead9 100644 --- a/tools/h5jam/Makefile.in +++ b/tools/h5jam/Makefile.in @@ -420,19 +420,18 @@ AMTAR = @AMTAR@ # H5_CFLAGS holds flags that should be used when building hdf5, # but which should not be exported to h5cc for building other programs. -# AM_CFLAGS is an automake construct which should be used by Makefiles +# AM_CFLAGS is an automake construct which should be used by Makefiles # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS = @AM_CFLAGS@ @H5_CFLAGS@ # Include src and tools/lib directories AM_CPPFLAGS = @AM_CPPFLAGS@ @H5_CPPFLAGS@ -I$(top_srcdir)/src \ -I$(top_srcdir)/tools/lib -AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ +AM_CXXFLAGS = @AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AM_FCFLAGS = @AM_FCFLAGS@ @H5_FCFLAGS@ AM_LDFLAGS = @AM_LDFLAGS@ @H5_LDFLAGS@ -AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ @@ -463,6 +462,7 @@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DEPRECATED_SYMBOLS = @DEPRECATED_SYMBOLS@ DEV_WARNINGS = @DEV_WARNINGS@ +DIAGS = @DIAGS@ DIRECT_VFD = @DIRECT_VFD@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ @@ -490,8 +490,6 @@ GREP = @GREP@ H5_CFLAGS = @H5_CFLAGS@ H5_CPPFLAGS = @H5_CPPFLAGS@ H5_CXXFLAGS = @H5_CXXFLAGS@ -H5_ECFLAGS = @H5_ECFLAGS@ -H5_ECXXFLAGS = @H5_ECXXFLAGS@ H5_FCFLAGS = @H5_FCFLAGS@ H5_FORTRAN_SHARED = @H5_FORTRAN_SHARED@ H5_LDFLAGS = @H5_LDFLAGS@ @@ -670,15 +668,15 @@ LIBH5_HL = $(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL = $(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la LIBH5CPP_HL = $(top_builddir)/hl/c++/src/libhdf5_hl_cpp.la -# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below -# has been removed. According to the official description of DESTDIR by Gnu at -# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is -# prepended to the normal and complete install path that it precedes for the -# purpose of installing in a temporary directory which is useful for building -# rpms and other packages. The '/' after ${DESTDIR} will be followed by another -# '/' at the beginning of the normal install path. When DESTDIR is empty the -# path then begins with '//', which is incorrect and causes problems at least for -# Cygwin. +# Note that in svn revision 19400 the '/' after DESTDIR in H5* variables below +# has been removed. According to the official description of DESTDIR by Gnu at +# http://www.gnu.org/prep/standards/html_node/DESTDIR.html, DESTDIR is +# prepended to the normal and complete install path that it precedes for the +# purpose of installing in a temporary directory which is useful for building +# rpms and other packages. The '/' after ${DESTDIR} will be followed by another +# '/' at the beginning of the normal install path. When DESTDIR is empty the +# path then begins with '//', which is incorrect and causes problems at least for +# Cygwin. # Scripts used to build examples # If only shared libraries have been installed, have h5cc build examples with @@ -724,7 +722,7 @@ LIB = $(lib_LIBRARIES) $(lib_LTLIBRARIES) $(noinst_LIBRARIES) \ PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) -chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) +chk_TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) TEST_EXTENSIONS = .sh SH_LOG_COMPILER = $(SHELL) AM_SH_LOG_FLAGS = @@ -1254,8 +1252,9 @@ uninstall-am: uninstall-binPROGRAMS # commands that should be executed even if a file with the same name already # exists. .PHONY: build-check-clean build-check-p build-check-s build-lib build-progs \ - build-tests check-clean check-install check-p check-s check-vfd \ - install-doc lib progs tests uninstall-doc _exec_check-s _test help + build-tests check-clean check-install check-p check-s check-vfd \ + install-doc lib progs tests uninstall-doc \ + _exec_check-s _test help help: @$(top_srcdir)/bin/makehelp diff --git a/tools/h5jam/h5jam.c b/tools/h5jam/h5jam.c index a74d79d..1a85f24 100644 --- a/tools/h5jam/h5jam.c +++ b/tools/h5jam/h5jam.c @@ -92,13 +92,6 @@ usage(const char *prog) static void leave(int ret) { - if (ub_file) - HDfree(ub_file); - if (input_file) - HDfree(input_file); - if (output_file) - HDfree(output_file); - h5tools_close(); HDexit(ret); @@ -162,42 +155,40 @@ parse_command_line(int argc, const char *argv[]) int main(int argc, const char *argv[]) { - int ufid = -1; - int h5fid = -1; - int ofid = -1; - void * edata; - H5E_auto2_t func; - hid_t ifile = H5I_INVALID_HID; - hid_t plist = H5I_INVALID_HID; - herr_t status; - htri_t testval; - hsize_t usize; - hsize_t h5fsize; - hsize_t startub; - hsize_t where; - hsize_t newubsize; - off_t fsize; - h5_stat_t sbuf; - h5_stat_t sbuf2; - int res; + int ufid = -1; + int h5fid = -1; + int ofid = -1; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; + herr_t status; + htri_t testval; + hsize_t usize; + hsize_t h5fsize; + hsize_t startub; + hsize_t where; + hsize_t newubsize; + off_t fsize; + h5_stat_t sbuf; + h5_stat_t sbuf2; + int res; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); parse_command_line(argc, argv); + /* enable error reporting if command line option */ + h5tools_error_report(); + if (ub_file == NULL) { /* no user block */ error_msg("missing argument for -u <user_file>.\n"); help_ref_msg(stderr); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } testval = H5Fis_hdf5(ub_file); @@ -205,13 +196,15 @@ main(int argc, const char *argv[]) if (testval > 0) { error_msg("-u <user_file> cannot be HDF5 file, but it appears to be an HDF5 file.\n"); help_ref_msg(stderr); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } if (input_file == NULL) { error_msg("missing argument for -i <HDF5 file>.\n"); help_ref_msg(stderr); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } testval = H5Fis_hdf5(input_file); @@ -219,74 +212,76 @@ main(int argc, const char *argv[]) if (testval <= 0) { error_msg("Input HDF5 file \"%s\" is not HDF5 format.\n", input_file); help_ref_msg(stderr); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifile = H5Fopen(input_file, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", input_file); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", input_file); - H5Fclose(ifile); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", input_file); - H5Pclose(plist); - H5Fclose(ifile); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } H5Pclose(plist); + plist = H5I_INVALID_HID; H5Fclose(ifile); + ifile = H5I_INVALID_HID; - ufid = HDopen(ub_file, O_RDONLY, 0); + ufid = HDopen(ub_file, O_RDONLY); if (ufid < 0) { error_msg("unable to open user block file \"%s\"\n", ub_file); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } res = HDfstat(ufid, &sbuf); if (res < 0) { error_msg("Can't stat file \"%s\"\n", ub_file); - HDclose(ufid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } fsize = (off_t)sbuf.st_size; - h5fid = HDopen(input_file, O_RDONLY, 0); + h5fid = HDopen(input_file, O_RDONLY); if (h5fid < 0) { error_msg("unable to open HDF5 file for read \"%s\"\n", input_file); - HDclose(ufid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } res = HDfstat(h5fid, &sbuf2); if (res < 0) { error_msg("Can't stat file \"%s\"\n", input_file); - HDclose(h5fid); - HDclose(ufid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } h5fsize = (hsize_t)sbuf2.st_size; if (output_file == NULL) { - ofid = HDopen(input_file, O_WRONLY, 0); + ofid = HDopen(input_file, O_WRONLY); if (ofid < 0) { error_msg("unable to open output file \"%s\"\n", output_file); - HDclose(h5fid); - HDclose(ufid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } else { @@ -294,9 +289,8 @@ main(int argc, const char *argv[]) if (ofid < 0) { error_msg("unable to create output file \"%s\"\n", output_file); - HDclose(h5fid); - HDclose(ufid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } } @@ -335,12 +329,11 @@ main(int argc, const char *argv[]) /* pad the ub */ if (write_pad(ofid, where, &where) < 0) { error_msg("Can't pad file \"%s\"\n", output_file); - HDclose(h5fid); - HDclose(ufid); - HDclose(ofid); - leave(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); + goto done; } /* end if */ +done: if (ub_file) HDfree(ub_file); if (input_file) @@ -348,6 +341,11 @@ main(int argc, const char *argv[]) if (output_file) HDfree(output_file); + if (plist >= 0) + H5Pclose(plist); + if (ifile >= 0) + H5Fclose(ifile); + if (ufid >= 0) HDclose(ufid); if (h5fid >= 0) @@ -355,7 +353,7 @@ main(int argc, const char *argv[]) if (ofid >= 0) HDclose(ofid); - return h5tools_getstatus(); + leave(h5tools_getstatus()); } /*------------------------------------------------------------------------- diff --git a/tools/h5jam/h5unjam.c b/tools/h5jam/h5unjam.c index fff4520..04fd27a 100644 --- a/tools/h5jam/h5unjam.c +++ b/tools/h5jam/h5unjam.c @@ -159,6 +159,13 @@ done: return EXIT_FAILURE; } +static void +leave(int ret) +{ + h5tools_close(); + HDexit(ret); +} + /*------------------------------------------------------------------------- * Function: main * @@ -171,30 +178,27 @@ done: int main(int argc, const char *argv[]) { - void * edata; - H5E_auto2_t func; - hid_t ifile = H5I_INVALID_HID; - hid_t plist = H5I_INVALID_HID; - off_t fsize; - hsize_t usize; - htri_t testval; - herr_t status; - int res; - h5_stat_t sbuf; + hid_t ifile = H5I_INVALID_HID; + hid_t plist = H5I_INVALID_HID; + off_t fsize; + hsize_t usize; + htri_t testval; + herr_t status; + int res; + h5_stat_t sbuf; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - /* Initialize h5tools lib */ h5tools_init(); if (EXIT_FAILURE == parse_command_line(argc, argv)) goto done; + /* enable error reporting if command line option */ + h5tools_error_report(); + if (input_file == NULL) { /* no user block */ error_msg("missing argument for HDF5 file input.\n"); @@ -293,9 +297,7 @@ done: HDfree(ub_file); } - h5tools_close(); - - return h5tools_getstatus(); + leave(h5tools_getstatus()); } /*------------------------------------------------------------------------- diff --git a/tools/h5jam/tellub.c b/tools/h5jam/tellub.c index ecb67b5..54f545a 100644 --- a/tools/h5jam/tellub.c +++ b/tools/h5jam/tellub.c @@ -65,11 +65,12 @@ parse_command_line(int argc, const char *argv[]) switch ((char)opt) { case 'h': usage(h5tools_getprogname()); - HDexit(EXIT_SUCCESS); + h5tools_setstatus(EXIT_SUCCESS); + break; case '?': default: usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); } } @@ -77,10 +78,17 @@ parse_command_line(int argc, const char *argv[]) if (argc <= opt_ind) { error_msg("missing file name\n"); usage(h5tools_getprogname()); - HDexit(EXIT_FAILURE); + h5tools_setstatus(EXIT_FAILURE); } } /* end parse_command_line() */ +static void +leave(int ret) +{ + h5tools_close(); + HDexit(ret); +} + /*------------------------------------------------------------------------- * Function: main * @@ -92,14 +100,12 @@ parse_command_line(int argc, const char *argv[]) int main(int argc, const char *argv[]) { - char * ifname; - void * edata; - H5E_auto2_t func; - hid_t ifile; - hsize_t usize; - htri_t testval; - herr_t status; - hid_t plist = H5I_INVALID_HID; + char * ifname; + hid_t ifile = H5I_INVALID_HID; + hsize_t usize; + htri_t testval; + herr_t status; + hid_t plist = H5I_INVALID_HID; h5tools_setprogname(PROGRAMNAME); h5tools_setstatus(EXIT_SUCCESS); @@ -107,16 +113,16 @@ main(int argc, const char *argv[]) /* Initialize h5tools lib */ h5tools_init(); - /* Disable error reporting */ - H5Eget_auto2(H5E_DEFAULT, &func, &edata); - H5Eset_auto2(H5E_DEFAULT, NULL, NULL); - parse_command_line(argc, argv); + /* enable error reporting if command line option */ + h5tools_error_report(); + if (argc <= (opt_ind)) { error_msg("missing file name\n"); usage(h5tools_getprogname()); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifname = HDstrdup(argv[opt_ind]); @@ -125,32 +131,38 @@ main(int argc, const char *argv[]) if (testval <= 0) { error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } ifile = H5Fopen(ifname, H5F_ACC_RDONLY, H5P_DEFAULT); if (ifile < 0) { error_msg("Can't open input HDF5 file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } plist = H5Fget_create_plist(ifile); if (plist < 0) { error_msg("Can't get file creation plist for file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } status = H5Pget_userblock(plist, &usize); if (status < 0) { error_msg("Can't get user block for file \"%s\"\n", ifname); - return EXIT_FAILURE; + h5tools_setstatus(EXIT_FAILURE); + goto done; } HDprintf("%ld\n", (long)usize); +done: H5Pclose(plist); - H5Fclose(ifile); + if (ifile >= 0) + H5Fclose(ifile); - return EXIT_SUCCESS; + leave(h5tools_getstatus()); } /* end main() */ |