summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2019-02-28 21:24:02 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2019-02-28 21:24:02 (GMT)
commit646fc294078f560fc9bef784cb1c4e27cdc51f5b (patch)
tree21502062cfc4ab6410f6d81de11e28c1523e85bd
parent5eef94f83f4875b64ffe7f9cea05d965bddbd802 (diff)
parent6819c11508b0610f222fe3bfe8a19f637bf4319c (diff)
downloadhdf5-646fc294078f560fc9bef784cb1c4e27cdc51f5b.zip
hdf5-646fc294078f560fc9bef784cb1c4e27cdc51f5b.tar.gz
hdf5-646fc294078f560fc9bef784cb1c4e27cdc51f5b.tar.bz2
Merge pull request #1590 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:1.10/master to 1.10/masterhdf5-1_10_5
* commit '6819c11508b0610f222fe3bfe8a19f637bf4319c': (154 commits) CMake needs a tar.gz examples file for windows, too. Correct file permissions on README.txt. Address merge anomalies and incorrect file permissions. Update release date in README.txt and RELEASE.txt. Revisions to Platforms tested. Updated LT_VERS_AGE in config/lt_vers.am due to reinstatement of previously removed symbols, then ran autogen.sh to propagate so number changes and H5E_LOGFAIL_g addition to files checked in on release branch. Updated H5err.txt to replace a global variable that was removed during the metadata cache logging changes (to maintain binary compatibility). HDFFV-10552,10686 restore H5O_*1 functions Minor fix in h5str_sprintf for NULL region references Add new files to MANIFEST. Update so version numbers. fix 2 typos. Update RELEASE.txt for TRILABS-34 and remove unused sections. Add script for building HDF5 with CMake on HPC machines that use sbatch. Add README file for inclusion in CMake-hdf5-<version>.tar.gz file. Add updated README_HPC file with cross compile instructions. set version to 1.10.5-pre1. Change default build mode to production. Merge pull request #1560 in HDFFV/hdf5 from hdf5-1-10-documentation-only to hdf5_1_10_5 Update HISTORY-1_10.txt and RELEASE.txt files. Modify RELEASE.txt in response to PR comments Check in files generated by autogen.sh for hdf5_1_10_5 release branch. Check in files generated by autogen.sh for hdf5_1_10_5 release branch. 2019/02/16. Code improvement ...
-rw-r--r--CMakeFilters.cmake8
-rw-r--r--CMakeInstallation.cmake4
-rw-r--r--CMakeLists.txt29
-rw-r--r--CTestConfig.cmake4
-rw-r--r--MANIFEST137
-rw-r--r--Makefile.in2
-rw-r--r--[-rwxr-xr-x]README.txt2
-rw-r--r--bin/batch/cori_ctestP.sl.in.cmake17
-rw-r--r--bin/batch/cori_ctestS.sl.in.cmake16
-rw-r--r--bin/batch/cori_knl_ctestP.sl.in.cmake17
-rw-r--r--bin/batch/cori_knl_ctestS.sl.in.cmake16
-rw-r--r--bin/batch/ctestP.lsf.in.cmake19
-rw-r--r--bin/batch/ctestP.sl.in.cmake16
-rw-r--r--bin/batch/ctestS.lsf.in.cmake18
-rw-r--r--bin/batch/ctestS.sl.in.cmake15
-rw-r--r--bin/batch/knl_H5detect.sl.in.cmake20
-rw-r--r--bin/batch/knl_ctestP.sl.in.cmake18
-rw-r--r--bin/batch/knl_ctestS.sl.in.cmake17
-rw-r--r--bin/batch/ray_ctestP.lsf.in.cmake20
-rw-r--r--bin/batch/ray_ctestS.lsf.in.cmake18
-rwxr-xr-xbin/batch/raybsub7
-rwxr-xr-xbin/release18
-rw-r--r--c++/Makefile.in4
-rw-r--r--c++/examples/Makefile.in4
-rw-r--r--c++/src/H5CppDoc.h3
-rw-r--r--c++/src/H5LaccProp.h11
-rw-r--r--c++/src/H5LcreatProp.h11
-rw-r--r--c++/src/H5Object.cpp73
-rw-r--r--c++/src/H5Object.h26
-rw-r--r--c++/src/Makefile.in30
-rw-r--r--c++/src/cpp_doc_config2
-rw-r--r--c++/test/CMakeTests.cmake57
-rw-r--r--c++/test/CMakeVFDTests.cmake65
-rw-r--r--c++/test/Makefile.in4
-rw-r--r--c++/test/dsets.cpp80
-rw-r--r--c++/test/tarray.cpp2
-rw-r--r--c++/test/tlinks.cpp421
-rw-r--r--config/cmake/CTestCustom.cmake19
-rw-r--r--config/cmake/ConfigureChecks.cmake14
-rw-r--r--config/cmake/ConversionTests.c26
-rw-r--r--config/cmake/H5pubconf.h.in12
-rw-r--r--config/cmake/HDF518_Examples.cmake.in106
-rw-r--r--config/cmake/HDF5Macros.cmake10
-rw-r--r--config/cmake/HDF5UseFortran.cmake22
-rw-r--r--config/cmake/HDF5_Examples.cmake.in8
-rw-r--r--config/cmake/HDFCompilerFlags.cmake6
-rw-r--r--config/cmake/UserMacros/Windows_MT.cmake3
-rw-r--r--config/cmake/hdf5-config.cmake.in3
-rw-r--r--config/cmake/jrunTest.cmake121
-rw-r--r--config/cmake/libhdf5.settings.cmake.in1
-rw-r--r--config/cmake/patch.xml4
-rwxr-xr-xconfig/cmake/scripts/CTestScript.cmake628
-rwxr-xr-xconfig/cmake/scripts/HDF5config.cmake467
-rwxr-xr-xconfig/cmake/scripts/HDF5options.cmake57
-rw-r--r--config/cmake/scripts/HPC/bsub-HDF5options.cmake40
-rw-r--r--config/cmake/scripts/HPC/raybsub-HDF5options.cmake41
-rw-r--r--config/cmake/scripts/HPC/sbatch-HDF5options.cmake52
-rw-r--r--config/cmake/vfdTest.cmake8
-rw-r--r--config/cmake/wait_H5Tinit.cmake11
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake155
-rw-r--r--config/cmake_ext_mod/HDFLibMacros.cmake12
-rw-r--r--config/cmake_ext_mod/HDFMacros.cmake6
-rw-r--r--config/cmake_ext_mod/HDFUseCXX.cmake4
-rw-r--r--config/cmake_ext_mod/HDFUseFortran.cmake4
-rw-r--r--config/cmake_ext_mod/grepTest.cmake8
-rw-r--r--config/cmake_ext_mod/runTest.cmake174
-rw-r--r--config/conclude.am2
-rw-r--r--config/lt_vers.am26
-rw-r--r--config/toolchain/GCC.cmake11
-rw-r--r--config/toolchain/PGI.cmake11
-rw-r--r--config/toolchain/crayle.cmake10
-rw-r--r--config/toolchain/intel.cmake (renamed from config/intel.cmake)1
-rwxr-xr-xconfigure258
-rw-r--r--configure.ac136
-rw-r--r--examples/CMakeTests.cmake38
-rw-r--r--examples/Makefile.in4
-rw-r--r--fortran/Makefile.in4
-rw-r--r--fortran/examples/CMakeTests.cmake64
-rw-r--r--fortran/examples/Makefile.in4
-rw-r--r--fortran/examples/run-fortran-ex.sh.in18
-rw-r--r--fortran/src/CMakeLists.txt6
-rw-r--r--fortran/src/H5Aff.F903
-rw-r--r--fortran/src/H5Dff.F909
-rw-r--r--fortran/src/H5Fff.F9093
-rw-r--r--fortran/src/H5Of.c48
-rw-r--r--fortran/src/H5Off.F90107
-rw-r--r--fortran/src/H5Pff.F9099
-rw-r--r--fortran/src/H5Rff.F906
-rw-r--r--fortran/src/H5Tff.F902
-rw-r--r--fortran/src/H5_buildiface.F90194
-rw-r--r--fortran/src/H5_f.c11
-rw-r--r--fortran/src/H5_ff.F9074
-rw-r--r--fortran/src/H5config_f.inc.cmake2
-rw-r--r--fortran/src/H5f90global.F9013
-rw-r--r--fortran/src/H5f90proto.h10
-rw-r--r--fortran/src/H5match_types.c13
-rw-r--r--fortran/src/Makefile.in30
-rw-r--r--fortran/src/hdf5_fortrandll.def.in5
-rw-r--r--fortran/test/CMakeTests.cmake70
-rw-r--r--fortran/test/Makefile.in4
-rw-r--r--fortran/test/tH5F.F901
-rw-r--r--fortran/test/tH5O_F03.F90390
-rw-r--r--fortran/test/tH5P.F9052
-rw-r--r--fortran/testpar/CMakeTests.cmake2
-rw-r--r--fortran/testpar/Makefile.in4
-rw-r--r--hl/Makefile.in4
-rw-r--r--hl/c++/Makefile.in4
-rw-r--r--hl/c++/examples/Makefile.in4
-rw-r--r--hl/c++/src/Makefile.in30
-rw-r--r--hl/c++/test/Makefile.in4
-rw-r--r--hl/examples/Makefile.in4
-rw-r--r--hl/fortran/Makefile.in4
-rw-r--r--hl/fortran/examples/Makefile.in4
-rw-r--r--hl/fortran/src/Makefile.am16
-rw-r--r--hl/fortran/src/Makefile.in54
-rw-r--r--hl/fortran/test/Makefile.am12
-rw-r--r--hl/fortran/test/Makefile.in37
-rw-r--r--hl/src/CMakeLists.txt9
-rw-r--r--hl/src/Makefile.in30
-rw-r--r--hl/test/Makefile.in4
-rw-r--r--hl/tools/Makefile.in4
-rw-r--r--hl/tools/gif2h5/Makefile.in4
-rw-r--r--hl/tools/gif2h5/decompress.c2
-rw-r--r--hl/tools/h5watch/CMakeTests.cmake59
-rw-r--r--hl/tools/h5watch/Makefile.in4
-rw-r--r--hl/tools/h5watch/testh5watch.sh.in119
-rw-r--r--hl/tools/testfiles/w-err-cmpd1.err (renamed from hl/tools/testfiles/w-err-cmpd3.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd2.err (renamed from hl/tools/testfiles/w-err-cmpd4.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd3.err (renamed from hl/tools/testfiles/w-err-cmpd1.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd4.err (renamed from hl/tools/testfiles/w-err-cmpd2.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-cmpd5.err1
-rw-r--r--hl/tools/testfiles/w-err-dset-nomax.err (renamed from hl/tools/testfiles/w-err-dset-nomax.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset-none.err (renamed from hl/tools/testfiles/w-err-dset-none.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset1.err (renamed from hl/tools/testfiles/w-err-dset1.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-dset2.err (renamed from hl/tools/testfiles/w-err-dset2.ddl)1
-rw-r--r--hl/tools/testfiles/w-err-file.err (renamed from hl/tools/testfiles/w-err-file.ddl)0
-rw-r--r--hl/tools/testfiles/w-err-std.ddl (renamed from hl/tools/testfiles/w-err-cmpd5.ddl)0
-rw-r--r--java/Makefile.in4
-rw-r--r--java/examples/Makefile.in4
-rw-r--r--java/examples/datasets/Makefile.in4
-rw-r--r--java/examples/datatypes/Makefile.in4
-rw-r--r--java/examples/groups/Makefile.in4
-rw-r--r--java/examples/intro/Makefile.in4
-rw-r--r--java/src/Makefile.in2
-rw-r--r--java/src/hdf/hdf5lib/H5.java574
-rw-r--r--java/src/hdf/overview.html3
-rw-r--r--java/src/jni/CMakeLists.txt30
-rw-r--r--java/src/jni/Makefile.am5
-rw-r--r--java/src/jni/Makefile.in54
-rw-r--r--java/src/jni/exceptionImp.c206
-rw-r--r--java/src/jni/h5Constants.c4
-rw-r--r--java/src/jni/h5Imp.c110
-rw-r--r--java/src/jni/h5aImp.c2371
-rw-r--r--java/src/jni/h5aImp.h151
-rw-r--r--java/src/jni/h5dImp.c2650
-rw-r--r--java/src/jni/h5dImp.h11
-rw-r--r--java/src/jni/h5eImp.c604
-rw-r--r--java/src/jni/h5fImp.c588
-rw-r--r--java/src/jni/h5fImp.h27
-rw-r--r--java/src/jni/h5gImp.c236
-rw-r--r--java/src/jni/h5iImp.c233
-rw-r--r--java/src/jni/h5jni.h382
-rw-r--r--java/src/jni/h5lImp.c924
-rw-r--r--java/src/jni/h5oImp.c967
-rw-r--r--java/src/jni/h5pACPLImp.c (renamed from src/H5HLpublic.h)33
-rw-r--r--java/src/jni/h5pACPLImp.h (renamed from src/H5HGpublic.h)20
-rw-r--r--java/src/jni/h5pDAPLImp.c325
-rw-r--r--java/src/jni/h5pDAPLImp.h112
-rw-r--r--java/src/jni/h5pDCPLImp.c1415
-rw-r--r--java/src/jni/h5pDCPLImp.h396
-rw-r--r--java/src/jni/h5pDXPLImp.c505
-rw-r--r--java/src/jni/h5pDXPLImp.h209
-rw-r--r--java/src/jni/h5pFAPLImp.c1647
-rw-r--r--java/src/jni/h5pFAPLImp.h501
-rw-r--r--java/src/jni/h5pFCPLImp.c611
-rw-r--r--java/src/jni/h5pFCPLImp.h216
-rw-r--r--java/src/jni/h5pGAPLImp.c (renamed from src/H5Bpublic.h)35
-rw-r--r--java/src/jni/h5pGAPLImp.h27
-rw-r--r--java/src/jni/h5pGCPLImp.c227
-rw-r--r--java/src/jni/h5pGCPLImp.h99
-rw-r--r--java/src/jni/h5pImp.c6047
-rw-r--r--java/src/jni/h5pImp.h1453
-rw-r--r--java/src/jni/h5pLAPLImp.c240
-rw-r--r--java/src/jni/h5pLAPLImp.h107
-rw-r--r--java/src/jni/h5pLCPLImp.c (renamed from src/H5B2public.h)46
-rw-r--r--java/src/jni/h5pLCPLImp.h27
-rw-r--r--java/src/jni/h5pOCPLImp.c211
-rw-r--r--java/src/jni/h5pOCPLImp.h99
-rw-r--r--java/src/jni/h5pOCpyPLImp.c92
-rw-r--r--java/src/jni/h5pOCpyPLImp.h (renamed from src/H5FSpublic.h)69
-rw-r--r--java/src/jni/h5pStrCPLImp.c74
-rw-r--r--java/src/jni/h5pStrCPLImp.h45
-rw-r--r--java/src/jni/h5plImp.c189
-rw-r--r--java/src/jni/h5rImp.c401
-rw-r--r--java/src/jni/h5sImp.c1661
-rw-r--r--java/src/jni/h5tImp.c1467
-rw-r--r--java/src/jni/h5util.c4712
-rw-r--r--java/src/jni/h5util.h33
-rw-r--r--java/src/jni/h5zImp.c29
-rw-r--r--java/src/jni/nativeData.c1342
-rw-r--r--java/test/Makefile.in4
-rw-r--r--java/test/TestH5.java21
-rw-r--r--java/test/TestH5Dplist.java20
-rw-r--r--java/test/TestH5E.java2
-rw-r--r--java/test/TestH5Edefault.java4
-rw-r--r--java/test/TestH5Fbasic.java17
-rw-r--r--java/test/TestH5Fparams.java40
-rw-r--r--java/test/TestH5Oparams.java4
-rw-r--r--java/test/TestH5P.java65
-rw-r--r--java/test/TestH5Sbasic.java2
-rw-r--r--java/test/junit.sh.in73
-rw-r--r--java/test/testfiles/JUnit-TestH5.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5Dplist.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5Edefault.txt14
-rw-r--r--java/test/testfiles/JUnit-TestH5Fbasic.txt3
-rw-r--r--java/test/testfiles/JUnit-TestH5P.txt4
-rw-r--r--release_docs/HISTORY-1_10.txt367
-rw-r--r--[-rwxr-xr-x]release_docs/INSTALL0
-rw-r--r--release_docs/INSTALL_CMake.txt2
-rw-r--r--[-rwxr-xr-x]release_docs/INSTALL_Cygwin.txt0
-rw-r--r--[-rwxr-xr-x]release_docs/INSTALL_parallel10
-rw-r--r--release_docs/README_HDF5_CMake23
-rw-r--r--release_docs/README_HPC206
-rw-r--r--[-rwxr-xr-x]release_docs/RELEASE.txt553
-rw-r--r--src/CMakeLists.txt266
-rw-r--r--src/H5.c2
-rw-r--r--src/H5A.c6
-rw-r--r--src/H5AC.c726
-rw-r--r--src/H5ACdbg.c115
-rw-r--r--src/H5AClog.c1105
-rw-r--r--src/H5ACpkg.h69
-rw-r--r--src/H5ACprivate.h6
-rw-r--r--src/H5Adense.c35
-rw-r--r--src/H5Adeprec.c2
-rw-r--r--src/H5Aint.c259
-rw-r--r--src/H5Apkg.h7
-rw-r--r--src/H5B2private.h3
-rw-r--r--src/H5Bprivate.h1
-rw-r--r--src/H5C.c74
-rw-r--r--src/H5CX.c96
-rw-r--r--src/H5CXprivate.h3
-rw-r--r--src/H5Cdbg.c36
-rw-r--r--src/H5Cimage.c4
-rw-r--r--src/H5Clog.c946
-rw-r--r--src/H5Clog.h114
-rw-r--r--src/H5Clog_json.c1364
-rw-r--r--src/H5Clog_trace.c1007
-rw-r--r--src/H5Cpkg.h50
-rw-r--r--src/H5Cprivate.h22
-rw-r--r--src/H5Cquery.c58
-rw-r--r--src/H5Ctag.c26
-rw-r--r--src/H5D.c158
-rw-r--r--src/H5Dchunk.c474
-rw-r--r--src/H5Dint.c386
-rw-r--r--src/H5Dio.c43
-rw-r--r--src/H5Dmpio.c124
-rw-r--r--src/H5Dnone.c4
-rw-r--r--src/H5Dpkg.h6
-rw-r--r--src/H5Dprivate.h9
-rw-r--r--src/H5Dpublic.h3
-rw-r--r--src/H5E.c6
-rw-r--r--src/H5EA.c18
-rw-r--r--src/H5Edefin.h3
-rw-r--r--src/H5Einit.h7
-rw-r--r--src/H5Eint.c37
-rw-r--r--src/H5Epubgen.h4
-rw-r--r--src/H5Eterm.h1
-rw-r--r--src/H5F.c119
-rw-r--r--src/H5FA.c14
-rw-r--r--src/H5FDcore.c28
-rw-r--r--src/H5FDlog.c46
-rw-r--r--src/H5FDmpio.c126
-rw-r--r--src/H5FDsec2.c48
-rw-r--r--src/H5FSprivate.h3
-rw-r--r--src/H5Fefc.c4
-rw-r--r--src/H5Fint.c260
-rw-r--r--src/H5Fmount.c10
-rw-r--r--src/H5Fpkg.h12
-rw-r--r--src/H5Fprivate.h8
-rw-r--r--src/H5Fpublic.h4
-rw-r--r--src/H5Fquery.c19
-rw-r--r--src/H5G.c23
-rw-r--r--src/H5Gdeprec.c369
-rw-r--r--src/H5Gint.c213
-rw-r--r--src/H5Gpkg.h5
-rw-r--r--src/H5HFprivate.h3
-rw-r--r--src/H5HFpublic.h52
-rw-r--r--src/H5HG.c8
-rw-r--r--src/H5HGprivate.h3
-rw-r--r--src/H5HLprivate.h3
-rw-r--r--src/H5I.c107
-rw-r--r--src/H5Iprivate.h3
-rw-r--r--src/H5L.c369
-rw-r--r--src/H5O.c624
-rw-r--r--src/H5Oattr.c5
-rw-r--r--src/H5Obogus.c4
-rw-r--r--src/H5Ocache.c22
-rw-r--r--src/H5Ocopy.c7
-rw-r--r--src/H5Odeprec.c10
-rw-r--r--src/H5Oflush.c54
-rw-r--r--src/H5Oint.c501
-rw-r--r--src/H5Olayout.c8
-rw-r--r--src/H5Omessage.c25
-rw-r--r--src/H5Opkg.h13
-rw-r--r--src/H5Oprivate.h17
-rw-r--r--src/H5Opublic.h14
-rw-r--r--src/H5PL.c7
-rw-r--r--src/H5PLint.c2
-rw-r--r--src/H5Pdcpl.c104
-rw-r--r--src/H5Pdxpl.c3
-rw-r--r--src/H5Pfapl.c15
-rw-r--r--src/H5Ppublic.h5
-rw-r--r--src/H5RS.c4
-rw-r--r--src/H5RSprivate.h2
-rw-r--r--src/H5Rint.c20
-rw-r--r--src/H5Smpio.c18
-rw-r--r--src/H5T.c113
-rw-r--r--src/H5Tcommit.c94
-rw-r--r--src/H5Torder.c4
-rw-r--r--src/H5Tprivate.h1
-rw-r--r--src/H5VM.c2
-rw-r--r--src/H5Z.c8
-rw-r--r--src/H5config.h.in13
-rw-r--r--src/H5err.txt3
-rw-r--r--src/H5private.h56
-rw-r--r--src/H5public.h4
-rw-r--r--src/H5vers.txt5
-rw-r--r--src/H5version.h95
-rw-r--r--src/Makefile.am8
-rw-r--r--src/Makefile.in234
-rw-r--r--src/libhdf5.settings.in1
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/CMakeTests.cmake198
-rw-r--r--test/CMakeVFDTests.cmake113
-rw-r--r--test/Makefile.am21
-rw-r--r--test/Makefile.in156
-rw-r--r--test/ShellTests.cmake3
-rw-r--r--test/chunk_info.c1657
-rw-r--r--test/cork.c18
-rw-r--r--test/corrupted_name_len.h5bin0 -> 82816 bytes
-rw-r--r--test/del_many_dense_attrs.c203
-rw-r--r--test/direct_chunk.c182
-rw-r--r--test/dsets.c474
-rw-r--r--test/dt_arith.c81
-rw-r--r--test/enc_dec_plist.c3
-rw-r--r--test/gen_bogus.c8
-rw-r--r--test/gen_plist.c3
-rw-r--r--test/h5test.c54
-rw-r--r--test/links.c356
-rw-r--r--test/ohdr.c911
-rw-r--r--test/tattr.c334
-rw-r--r--test/tbogus.h5bin4512 -> 5056 bytes
-rw-r--r--test/testabort_fail.sh.in (renamed from test/test_filenotclosed.sh.in)39
-rw-r--r--test/tfile.c129
-rw-r--r--test/th5o.c88
-rw-r--r--test/titerate.c101
-rw-r--r--test/tsohm.c1783
-rw-r--r--test/tvlstr.c102
-rw-r--r--test/use.h2
-rw-r--r--test/use_append_chunk.c115
-rw-r--r--test/use_append_mchunks.c110
-rw-r--r--test/use_common.c142
-rw-r--r--testpar/CMakeLists.txt2
-rw-r--r--testpar/CMakeTests.cmake119
-rw-r--r--testpar/CMakeVFDTests.cmake73
-rw-r--r--testpar/Makefile.am12
-rw-r--r--testpar/Makefile.in34
-rw-r--r--testpar/t_bigio.c4
-rw-r--r--testpar/t_cache.c501
-rw-r--r--testpar/t_coll_md_read.c336
-rw-r--r--testpar/t_dset.c4
-rw-r--r--testpar/t_filters_parallel.c359
-rw-r--r--testpar/t_mdset.c173
-rw-r--r--testpar/t_pflush1.c247
-rw-r--r--testpar/t_pflush2.c265
-rw-r--r--testpar/t_pread.c422
-rw-r--r--testpar/testpflush.sh.in64
-rw-r--r--testpar/testphdf5.c5
-rw-r--r--testpar/testphdf5.h2
-rw-r--r--tools/Makefile.in4
-rw-r--r--tools/lib/CMakeLists.txt12
-rw-r--r--tools/lib/Makefile.in4
-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/lib/h5tools_utils.c17
-rw-r--r--tools/src/Makefile.in4
-rw-r--r--tools/src/h5copy/Makefile.in4
-rw-r--r--tools/src/h5diff/Makefile.in4
-rw-r--r--tools/src/h5dump/Makefile.in4
-rw-r--r--tools/src/h5dump/h5dump_xml.c3
-rw-r--r--tools/src/h5format_convert/CMakeLists.txt2
-rw-r--r--tools/src/h5format_convert/Makefile.in4
-rw-r--r--tools/src/h5import/Makefile.in4
-rw-r--r--tools/src/h5import/h5import.c135
-rw-r--r--tools/src/h5import/h5import.h4
-rw-r--r--tools/src/h5jam/Makefile.in4
-rw-r--r--tools/src/h5ls/Makefile.in4
-rw-r--r--tools/src/h5repack/Makefile.in4
-rw-r--r--tools/src/h5repack/h5repack_copy.c6
-rw-r--r--tools/src/h5repack/h5repack_filters.c6
-rw-r--r--tools/src/h5repack/h5repack_main.c2
-rw-r--r--tools/src/h5stat/Makefile.in4
-rw-r--r--tools/src/h5stat/h5stat.c68
-rw-r--r--tools/src/misc/Makefile.in4
-rw-r--r--tools/src/misc/h5clear.c39
-rw-r--r--tools/src/misc/h5repart.c45
-rw-r--r--tools/test/Makefile.in4
-rw-r--r--tools/test/h5copy/CMakeTests.cmake2
-rw-r--r--tools/test/h5copy/Makefile.in4
-rw-r--r--tools/test/h5copy/testfiles/h5copy_misc1.err1
-rw-r--r--tools/test/h5copy/testfiles/h5copy_misc1.out1
-rw-r--r--tools/test/h5copy/testh5copy.sh.in7
-rw-r--r--tools/test/h5diff/CMakeTests.cmake135
-rw-r--r--tools/test/h5diff/Makefile.in4
-rw-r--r--tools/test/h5diff/h5diff_plugin.sh.in87
-rw-r--r--tools/test/h5diff/h5diffgentest.c2
-rw-r--r--tools/test/h5diff/testfiles/dangling_link.err (renamed from tools/test/h5diff/testfiles/h5diff_459_ERR.err)0
-rw-r--r--tools/test/h5diff/testfiles/h5diff_454_ERR.err4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_454_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_455_ERR.err4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_455_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_457_ERR.err4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_457_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_458_ERR.err4
-rw-r--r--tools/test/h5diff/testfiles/h5diff_458_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_459_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_600.txt1
-rw-r--r--tools/test/h5diff/testfiles/h5diff_601_ERR.txt6
-rw-r--r--tools/test/h5diff/testfiles/h5diff_udfail.err12
-rw-r--r--tools/test/h5diff/testfiles/h5diff_udfail.txt1
-rw-r--r--tools/test/h5diff/testh5diff.sh.in6
-rw-r--r--tools/test/h5dump/CMakeLists.txt48
-rw-r--r--tools/test/h5dump/CMakeTests.cmake8
-rw-r--r--tools/test/h5dump/Makefile.in4
-rw-r--r--tools/test/h5dump/errfiles/tall-1.err19
-rw-r--r--tools/test/h5dump/errfiles/tall-2A.err19
-rw-r--r--tools/test/h5dump/errfiles/tall-2A0.err19
-rw-r--r--tools/test/h5dump/errfiles/tall-2B.err19
-rw-r--r--tools/test/h5dump/errfiles/tdset-2.err11
-rw-r--r--tools/test/h5dump/errfiles/textlink.err38
-rw-r--r--tools/test/h5dump/errfiles/textlinkfar.err33
-rw-r--r--tools/test/h5dump/errfiles/textlinksrc.err33
-rw-r--r--tools/test/h5dump/errfiles/torderlinks1.err19
-rw-r--r--tools/test/h5dump/errfiles/torderlinks2.err19
-rw-r--r--tools/test/h5dump/errfiles/tperror.err11
-rw-r--r--tools/test/h5dump/h5dumpgentest.c6
-rw-r--r--tools/test/h5dump/testh5dump.sh.in8
-rw-r--r--tools/test/h5dump/testh5dumppbits.sh.in4
-rw-r--r--tools/test/h5format_convert/CMakeTests.cmake61
-rw-r--r--tools/test/h5format_convert/Makefile.in4
-rw-r--r--tools/test/h5format_convert/h5fc_gentest.c357
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl25
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_d_file.ddl1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_dname.ddl1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_dname.err1
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err (renamed from tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl)0
-rw-r--r--tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err (renamed from tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl)0
-rw-r--r--tools/test/h5format_convert/testh5fc.sh.in60
-rw-r--r--tools/test/h5import/Makefile.in4
-rw-r--r--tools/test/h5jam/CMakeTests.cmake2
-rw-r--r--tools/test/h5jam/Makefile.in4
-rw-r--r--tools/test/h5jam/getub.c2
-rw-r--r--tools/test/h5jam/tellub.c184
-rw-r--r--tools/test/h5ls/CMakeLists.txt44
-rw-r--r--tools/test/h5ls/CMakeTests.cmake56
-rw-r--r--tools/test/h5ls/Makefile.in4
-rw-r--r--tools/test/h5ls/errfiles/nosuchfile.err1
-rw-r--r--tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err2
-rw-r--r--tools/test/h5ls/errfiles/tgroup-1.err2
-rw-r--r--tools/test/h5ls/testh5ls.sh.in11
-rw-r--r--tools/test/h5repack/CMakeLists.txt76
-rw-r--r--tools/test/h5repack/CMakeTests.cmake53
-rw-r--r--tools/test/h5repack/CMakeVFDTests.cmake65
-rw-r--r--tools/test/h5repack/Makefile.in4
-rw-r--r--tools/test/h5repack/h5repack.sh.in1
-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/CMakeTests.cmake64
-rw-r--r--tools/test/h5stat/Makefile.in4
-rw-r--r--tools/test/h5stat/h5stat_gentest.c312
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_dims.err (renamed from tools/test/h5stat/testfiles/h5stat_err1_dims.ddl)0
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_links.err (renamed from tools/test/h5stat/testfiles/h5stat_err1_links.ddl)0
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err1_numattrs.err (renamed from tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl)0
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err2_numattrs.err (renamed from tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl)0
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_old_fill.err1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_old_layout.err1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_refcount.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_err_refcount.err1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_nofile.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_nofile.err1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_notexist.ddl1
-rw-r--r--tools/test/h5stat/testfiles/h5stat_notexist.err1
-rw-r--r--tools/test/h5stat/testh5stat.sh.in37
-rw-r--r--tools/test/misc/CMakeTestsClear.cmake89
-rw-r--r--tools/test/misc/CMakeTestsRepart.cmake28
-rw-r--r--tools/test/misc/Makefile.in4
-rw-r--r--tools/test/misc/repart_test.c21
-rw-r--r--tools/test/misc/testfiles/h5clear_missing_file.ddl1
-rw-r--r--tools/test/misc/testfiles/h5clear_missing_file.err1
-rw-r--r--tools/test/misc/testfiles/h5clear_no_mdc_image.err (renamed from tools/test/misc/testfiles/h5clear_no_mdc_image.ddl)0
-rw-r--r--tools/test/misc/testfiles/h5clear_open_fail.err (renamed from tools/test/misc/testfiles/h5clear_open_fail.ddl)0
-rw-r--r--tools/test/misc/testh5clear.sh.in72
-rw-r--r--tools/test/misc/testh5repart.sh.in6
-rw-r--r--tools/test/misc/vds/Makefile.in4
-rw-r--r--tools/test/perform/CMakeTests.cmake6
-rw-r--r--tools/test/perform/Makefile.in4
-rw-r--r--tools/test/perform/zip_perf.c6
-rw-r--r--tools/testfiles/non_existing.ddl1
-rw-r--r--tools/testfiles/nosuchfile.ls1
-rw-r--r--tools/testfiles/pbits/tnofilename-with-packed-bits.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsIncomplete.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsLengthExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsLengthPositive.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsMaxExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetExceeded.ddl1
-rw-r--r--tools/testfiles/pbits/tpbitsOffsetNegative.ddl1
-rw-r--r--tools/testfiles/texceedsubblock.ddl1
-rw-r--r--tools/testfiles/texceedsubcount.ddl1
-rw-r--r--tools/testfiles/texceedsubstart.ddl1
-rw-r--r--tools/testfiles/texceedsubstride.ddl1
-rw-r--r--tools/testfiles/textlinksrc-nodangle-1.ls2
-rw-r--r--tools/testfiles/tgroup-1.ls2
533 files changed, 39328 insertions, 27146 deletions
diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake
index 71dabb1..5a89564 100644
--- a/CMakeFilters.cmake
+++ b/CMakeFilters.cmake
@@ -27,7 +27,15 @@ if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MAT
set (TGZPATH ${HDF5_SOURCE_DIR})
endif ()
set (ZLIB_URL ${TGZPATH}/${ZLIB_TGZ_NAME})
+ if (NOT EXISTS "${ZLIB_URL}")
+ set (HDF5_ENABLE_Z_LIB_SUPPORT OFF CACHE BOOL "" FORCE)
+ message (STATUS "Filter ZLIB file ${ZLIB_URL} not found")
+ endif ()
set (SZIP_URL ${TGZPATH}/${SZIP_TGZ_NAME})
+ if (NOT EXISTS "${SZIP_URL}")
+ set (HDF5_ENABLE_SZIP_SUPPORT OFF CACHE BOOL "" FORCE)
+ message (STATUS "Filter SZIP file ${SZIP_URL} not found")
+ endif ()
else ()
set (ZLIB_USE_EXTERNAL 0)
set (SZIP_USE_EXTERNAL 0)
diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake
index 2339049..7a0746a 100644
--- a/CMakeInstallation.cmake
+++ b/CMakeInstallation.cmake
@@ -125,7 +125,7 @@ else ()
endif ()
configure_file (
${HDF_RESOURCES_DIR}/libhdf5.settings.cmake.in
- ${HDF5_BINARY_DIR}/libhdf5.settings @ONLY
+ ${HDF5_BINARY_DIR}/libhdf5.settings ESCAPE_QUOTES @ONLY
)
install (
FILES ${HDF5_BINARY_DIR}/libhdf5.settings
@@ -134,7 +134,7 @@ install (
)
#-----------------------------------------------------------------------------
-# Configure the HDF518_Examples.cmake file and the examples
+# Configure the HDF5_Examples.cmake file and the examples
#-----------------------------------------------------------------------------
option (HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF)
if (HDF5_PACK_EXAMPLES)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 24bb83d..8e93231 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -482,6 +482,15 @@ if (HDF5_MEMORY_ALLOC_SANITY_CHECK)
endif ()
#-----------------------------------------------------------------------------
+# Option to enable/disable using pread/pwrite for VFDs
+#-----------------------------------------------------------------------------
+option (HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON)
+mark_as_advanced (HDF5_ENABLE_PREADWRITE)
+if (HDF5_ENABLE_PREADWRITE AND H5_HAVE_PREAD AND H5_HAVE_PWRITE)
+ set (H5_HAVE_PREADWRITE 1)
+endif ()
+
+#-----------------------------------------------------------------------------
# Option to use deprecated public API symbols
#-----------------------------------------------------------------------------
option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON)
@@ -739,6 +748,11 @@ if (BUILD_TESTING)
"Timeout in seconds for each test (default 1200=20minutes)"
)
+ # Generate a list of timeouts based on DART_TESTING_TIMEOUT
+ math (EXPR CTEST_SHORT_TIMEOUT "${DART_TESTING_TIMEOUT} / 2")
+ math (EXPR CTEST_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 2")
+ math (EXPR CTEST_VERY_LONG_TIMEOUT "${DART_TESTING_TIMEOUT} * 3")
+
option (HDF5_TEST_VFD "Execute tests with different VFDs" OFF)
mark_as_advanced (HDF5_TEST_VFD)
if (HDF5_TEST_VFD)
@@ -809,9 +823,6 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _")
if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran")
option (HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF)
if (HDF5_BUILD_FORTRAN)
-
- option (HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON)
-
include (${HDF_RESOURCES_EXT_DIR}/HDFUseFortran.cmake)
message (STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}")
@@ -824,10 +835,8 @@ if (EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/for
include (${HDF_RESOURCES_DIR}/HDF5UseFortran.cmake)
set (LINK_Fortran_LIBS ${LINK_LIBS})
- if (HDF5_ENABLE_F2003)
- if (NOT FORTRAN_HAVE_ISO_C_BINDING)
- set (HDF5_ENABLE_F2003 OFF)
- endif ()
+ if (NOT H5_FORTRAN_HAVE_ISO_C_BINDING)
+ message (FATAL_ERROR " **** Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, disable HDF5_BUILD_FORTRAN **** ")
endif ()
# Parallel IO usage requires MPI to be Linked and Included
@@ -903,4 +912,10 @@ endif ()
#-----------------------------------------------------------------------------
configure_file (${HDF_RESOURCES_DIR}/H5pubconf.h.in ${HDF5_BINARY_DIR}/H5pubconf.h @ONLY)
+#-----------------------------------------------------------------------------
+# Options for use by cross compiling and toolchains
+#-----------------------------------------------------------------------------
+option (HDF5_USE_PREGEN "Use pre-generated Files" OFF)
+option (HDF5_BATCH_H5DETECT "Use a batch command for running h5detect" OFF)
+
include (CMakeInstallation.cmake)
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index b741bec..886228d 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -45,9 +45,9 @@ set (VALGRIND_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=
set (CTEST_MEMORYCHECK_COMMAND "/usr/bin/valgrind")
set (CTEST_MEMORYCHECK_COMMAND_OPTIONS "-v --tool=memcheck --leak-check=full --track-fds=yes --num-callers=50 --show-reachable=yes --track-origins=yes --malloc-fill=0xff --free-fill=0xfe")
-set (CTEST_TEST_TIMEOUT 600 CACHE STRING
+set (CTEST_TEST_TIMEOUT 1200 CACHE STRING
"Maximum time allowed before CTest will kill the test.")
-set (DART_TESTING_TIMEOUT 600 CACHE STRING
+set (DART_TESTING_TIMEOUT 1200 CACHE STRING
"Maximum time allowed before CTest will kill the test." FORCE)
SET(CTEST_SUBMIT_RETRY_DELAY 20 CACHE STRING
diff --git a/MANIFEST b/MANIFEST
index 11611d6..73858a0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -92,6 +92,20 @@
./bin/timekeeper _DO_NOT_DISTRIBUTE_
./bin/trace
./bin/yodconfigure
+./bin/batch/cori_ctestP.sl.in.cmake
+./bin/batch/cori_ctestS.sl.in.cmake
+./bin/batch/cori_knl_ctestP.sl.in.cmake
+./bin/batch/cori_knl_ctestS.sl.in.cmake
+./bin/batch/ctestP.lsf.in.cmake
+./bin/batch/ctestP.sl.in.cmake
+./bin/batch/ctestS.lsf.in.cmake
+./bin/batch/ctestS.sl.in.cmake
+./bin/batch/knl_ctestP.sl.in.cmake
+./bin/batch/knl_ctestS.sl.in.cmake
+./bin/batch/knl_H5detect.sl.in.cmake
+./bin/batch/ray_ctestP.lsf.in.cmake
+./bin/batch/ray_ctestS.lsf.in.cmake
+./bin/batch/raybsub
./bin/pkgscrpts/h5rmflags _DO_NOT_DISTRIBUTE_
./bin/pkgscrpts/makeHDF5BinaryTarfiles.pl _DO_NOT_DISTRIBUTE_
./bin/pkgscrpts/makeInternalREADME.pl _DO_NOT_DISTRIBUTE_
@@ -448,6 +462,8 @@
./release_docs/INSTALL_Warnings.txt
./release_docs/INSTALL_Windows.txt
./release_docs/RELEASE.txt
+./release_docs/README_HDF5_CMake
+./release_docs/README_HPC
./release_docs/USING_HDF5_CMake.txt
./release_docs/USING_HDF5_VS.txt
@@ -482,7 +498,6 @@
./src/H5Apublic.h
./src/H5AC.c
./src/H5ACdbg.c
-./src/H5AClog.c
./src/H5ACmodule.h
./src/H5ACmpio.c
./src/H5ACpkg.h
@@ -495,7 +510,6 @@
./src/H5Bmodule.h
./src/H5Bpkg.h
./src/H5Bprivate.h
-./src/H5Bpublic.h
./src/H5B2.c
./src/H5B2cache.c
./src/H5B2dbg.c
@@ -506,7 +520,6 @@
./src/H5B2module.h
./src/H5B2pkg.h
./src/H5B2private.h
-./src/H5B2public.h
./src/H5B2stat.c
./src/H5B2test.c
./src/H5C.c
@@ -514,6 +527,9 @@
./src/H5Cepoch.c
./src/H5Cimage.c
./src/H5Clog.c
+./src/H5Clog.h
+./src/H5Clog_json.c
+./src/H5Clog_trace.c
./src/H5Cmodule.h
./src/H5Cmpio.c
./src/H5Cpkg.h
@@ -650,7 +666,6 @@
./src/H5FSmodule.h
./src/H5FSpkg.h
./src/H5FSprivate.h
-./src/H5FSpublic.h
./src/H5FSsection.c
./src/H5FSstat.c
./src/H5FStest.c
@@ -690,7 +705,6 @@
./src/H5HFmodule.h
./src/H5HFpkg.h
./src/H5HFprivate.h
-./src/H5HFpublic.h
./src/H5HFsection.c
./src/H5HFspace.c
./src/H5HFstat.c
@@ -702,7 +716,6 @@
./src/H5HGmodule.h
./src/H5HGpkg.h
./src/H5HGprivate.h
-./src/H5HGpublic.h
./src/H5HGquery.c
./src/H5HL.c
./src/H5HLcache.c
@@ -713,7 +726,6 @@
./src/H5HLpkg.h
./src/H5HLprfx.c
./src/H5HLprivate.h
-./src/H5HLpublic.h
./src/H5HP.c
./src/H5HPprivate.h
./src/H5I.c
@@ -945,6 +957,7 @@
./test/cross_read.c
./test/dangle.c
./test/deflate.h5
+./test/del_many_dense_attrs.c
./test/direct_chunk.c
./test/dsets.c
./test/dt_arith.c
@@ -1032,6 +1045,7 @@
./test/le_extlink2.h5
./test/lheap.c
./test/links.c
+./test/corrupted_name_len.h5
./test/mergemsg.h5
./test/mf.c
./test/mount.c
@@ -1076,10 +1090,10 @@
./test/tcheck_version.c
./test/tconfig.c
./test/tcoords.c
+./test/testabort_fail.sh.in
./test/testcheck_version.sh.in
./test/testerror.sh.in
./test/testlinks_env.sh.in
-./test/test_filenotclosed.sh.in
./test/test_filter_plugin.sh.in
./test/testflushrefresh.sh.in
./test/testframe.c
@@ -1268,6 +1282,7 @@
./testpar/t_span_tree.c
./testpar/t_init_term.c
./testpar/testpar.h
+./testpar/testpflush.sh.in
./testpar/testphdf5.c
./testpar/testphdf5.h
@@ -1374,14 +1389,17 @@
./tools/test/h5format_convert/testfiles/h5fc_v_err.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_v_non_chunked.ddl
./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
+./tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err
+./tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_ndata_bt1.ddl
./tools/test/h5format_convert/testfiles/h5fc_dname.ddl
-./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
+./tools/test/h5format_convert/testfiles/h5fc_dname.err
+./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err
+./tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err
./tools/test/h5format_convert/testfiles/h5fc_help.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_all.ddl
./tools/test/h5format_convert/testfiles/h5fc_nooption.ddl
./tools/test/h5format_convert/testfiles/h5fc_v_n_1d.ddl
-./tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl
./tools/test/h5format_convert/testfiles/h5fc_non_v3.h5
./tools/test/h5format_convert/testfiles/h5fc_edge_v3.h5
./tools/test/h5format_convert/testfiles/h5fc_err_level.h5
@@ -1451,6 +1469,11 @@
./tools/test/h5ls/vds_prefix/tvds-4.ls
./tools/test/h5ls/vds_prefix/tvds-5.ls
+# h5ls test error files
+./tools/test/h5ls/errfiles/nosuchfile.err
+./tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err
+./tools/test/h5ls/errfiles/tgroup-1.err
+
# h5copy sources
./tools/src/h5copy/Makefile.am
./tools/src/h5copy/h5copy.c
@@ -1506,10 +1529,11 @@
./tools/test/misc/testfiles/h5clear_less_after_size.ddl
./tools/test/misc/testfiles/h5clear_less_before_size.ddl
./tools/test/misc/testfiles/h5clear_missing_file.ddl
+./tools/test/misc/testfiles/h5clear_missing_file.err
./tools/test/misc/testfiles/h5clear_noclose_after_size.ddl
./tools/test/misc/testfiles/h5clear_noclose_before_size.ddl
-./tools/test/misc/testfiles/h5clear_no_mdc_image.ddl
-./tools/test/misc/testfiles/h5clear_open_fail.ddl
+./tools/test/misc/testfiles/h5clear_no_mdc_image.err
+./tools/test/misc/testfiles/h5clear_open_fail.err
./tools/test/misc/testfiles/h5clear_status_noclose_after_size.ddl
./tools/test/misc/testfiles/h5clear_usage.ddl
./tools/test/misc/testfiles/h5clear_user_equal_after_size.ddl
@@ -1563,10 +1587,6 @@
./tools/test/h5stat/testh5stat.sh.in
./tools/test/h5stat/testfiles/h5stat_dims1.ddl
./tools/test/h5stat/testfiles/h5stat_dims2.ddl
-./tools/test/h5stat/testfiles/h5stat_err1_dims.ddl
-./tools/test/h5stat/testfiles/h5stat_err1_links.ddl
-./tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl
-./tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl
./tools/test/h5stat/testfiles/h5stat_err_old_fill.h5
./tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl
./tools/test/h5stat/testfiles/h5stat_err_old_layout.h5
@@ -1604,6 +1624,15 @@
./tools/test/h5stat/testfiles/h5stat_threshold.h5
./tools/test/h5stat/testfiles/h5stat_tsohm.ddl
./tools/test/h5stat/testfiles/h5stat_tsohm.h5
+./tools/test/h5stat/testfiles/h5stat_err_refcount.err
+./tools/test/h5stat/testfiles/h5stat_err_old_layout.err
+./tools/test/h5stat/testfiles/h5stat_err_old_fill.err
+./tools/test/h5stat/testfiles/h5stat_err1_dims.err
+./tools/test/h5stat/testfiles/h5stat_err1_links.err
+./tools/test/h5stat/testfiles/h5stat_err1_numattrs.err
+./tools/test/h5stat/testfiles/h5stat_err2_numattrs.err
+./tools/test/h5stat/testfiles/h5stat_notexist.err
+./tools/test/h5stat/testfiles/h5stat_nofile.err
# h5dump test files
./tools/testfiles/charsets.h5
@@ -2263,7 +2292,6 @@
./tools/test/h5diff/testfiles/h5diff_600.txt
./tools/test/h5diff/testfiles/h5diff_601.txt
./tools/test/h5diff/testfiles/h5diff_601_ERR.err
-./tools/test/h5diff/testfiles/h5diff_601_ERR.txt
./tools/test/h5diff/testfiles/h5diff_603.txt
./tools/test/h5diff/testfiles/h5diff_604.txt
./tools/test/h5diff/testfiles/h5diff_605.txt
@@ -2370,21 +2398,12 @@
./tools/test/h5diff/testfiles/h5diff_452.txt
./tools/test/h5diff/testfiles/h5diff_453.txt
./tools/test/h5diff/testfiles/h5diff_454.txt
-./tools/test/h5diff/testfiles/h5diff_454_ERR.err
-./tools/test/h5diff/testfiles/h5diff_454_ERR.txt
+./tools/test/h5diff/testfiles/dangling_link.err
./tools/test/h5diff/testfiles/h5diff_455.txt
-./tools/test/h5diff/testfiles/h5diff_455_ERR.err
-./tools/test/h5diff/testfiles/h5diff_455_ERR.txt
./tools/test/h5diff/testfiles/h5diff_456.txt
./tools/test/h5diff/testfiles/h5diff_457.txt
-./tools/test/h5diff/testfiles/h5diff_457_ERR.err
-./tools/test/h5diff/testfiles/h5diff_457_ERR.txt
./tools/test/h5diff/testfiles/h5diff_458.txt
-./tools/test/h5diff/testfiles/h5diff_458_ERR.err
-./tools/test/h5diff/testfiles/h5diff_458_ERR.txt
./tools/test/h5diff/testfiles/h5diff_459.txt
-./tools/test/h5diff/testfiles/h5diff_459_ERR.err
-./tools/test/h5diff/testfiles/h5diff_459_ERR.txt
./tools/test/h5diff/testfiles/h5diff_465.txt
./tools/test/h5diff/testfiles/h5diff_466.txt
./tools/test/h5diff/testfiles/h5diff_467.txt
@@ -2474,6 +2493,7 @@
./tools/test/h5diff/testfiles/tudfilter.h5
./tools/test/h5diff/testfiles/tudfilter2.h5
./tools/test/h5diff/testfiles/h5diff_ud.txt
+./tools/test/h5diff/testfiles/h5diff_udfail.err
./tools/test/h5diff/testfiles/h5diff_udfail.txt
./tools/test/h5diff/testfiles/diff_strings1.h5
./tools/test/h5diff/testfiles/diff_strings2.h5
@@ -2574,6 +2594,7 @@
./tools/test/h5copy/testfiles/h5copy_extlinks_src.h5
./tools/test/h5copy/testfiles/h5copy_extlinks_trg.h5
./tools/test/h5copy/testfiles/h5copy_extlinks_src.out.ls
+./tools/test/h5copy/testfiles/h5copy_misc1.err
./tools/test/h5copy/testfiles/h5copy_misc1.out
./tools/test/h5copy/testfiles/h5copytst_new.h5
./tools/test/h5copy/testfiles/h5copytst_new.out.ls
@@ -2741,16 +2762,17 @@
# expected test output from testing h5watch
#
-./hl/tools/testfiles/w-err-cmpd1.ddl
-./hl/tools/testfiles/w-err-cmpd2.ddl
-./hl/tools/testfiles/w-err-cmpd3.ddl
-./hl/tools/testfiles/w-err-cmpd4.ddl
-./hl/tools/testfiles/w-err-cmpd5.ddl
-./hl/tools/testfiles/w-err-dset1.ddl
-./hl/tools/testfiles/w-err-dset2.ddl
-./hl/tools/testfiles/w-err-dset-nomax.ddl
-./hl/tools/testfiles/w-err-dset-none.ddl
-./hl/tools/testfiles/w-err-file.ddl
+./hl/tools/testfiles/w-err-std.ddl
+./hl/tools/testfiles/w-err-cmpd1.err
+./hl/tools/testfiles/w-err-cmpd2.err
+./hl/tools/testfiles/w-err-cmpd3.err
+./hl/tools/testfiles/w-err-cmpd4.err
+./hl/tools/testfiles/w-err-cmpd5.err
+./hl/tools/testfiles/w-err-dset1.err
+./hl/tools/testfiles/w-err-dset2.err
+./hl/tools/testfiles/w-err-dset-nomax.err
+./hl/tools/testfiles/w-err-dset-none.err
+./hl/tools/testfiles/w-err-file.err
./hl/tools/testfiles/w-err-poll0.ddl
./hl/tools/testfiles/w-err-poll.ddl
./hl/tools/testfiles/w-err-width.ddl
@@ -2852,6 +2874,32 @@
./java/src/jni/h5oImp.h
./java/src/jni/h5pImp.c
./java/src/jni/h5pImp.h
+./java/src/jni/h5pACPLImp.c
+./java/src/jni/h5pACPLImp.h
+./java/src/jni/h5pDAPLImp.c
+./java/src/jni/h5pDAPLImp.h
+./java/src/jni/h5pDCPLImp.c
+./java/src/jni/h5pDCPLImp.h
+./java/src/jni/h5pDXPLImp.c
+./java/src/jni/h5pDXPLImp.h
+./java/src/jni/h5pFAPLImp.c
+./java/src/jni/h5pFAPLImp.h
+./java/src/jni/h5pFCPLImp.c
+./java/src/jni/h5pFCPLImp.h
+./java/src/jni/h5pGAPLImp.c
+./java/src/jni/h5pGAPLImp.h
+./java/src/jni/h5pGCPLImp.c
+./java/src/jni/h5pGCPLImp.h
+./java/src/jni/h5pLAPLImp.c
+./java/src/jni/h5pLAPLImp.h
+./java/src/jni/h5pLCPLImp.c
+./java/src/jni/h5pLCPLImp.h
+./java/src/jni/h5pOCPLImp.c
+./java/src/jni/h5pOCPLImp.h
+./java/src/jni/h5pOCpyPLImp.c
+./java/src/jni/h5pOCpyPLImp.h
+./java/src/jni/h5pStrCPLImp.c
+./java/src/jni/h5pStrCPLImp.h
./java/src/jni/h5plImp.c
./java/src/jni/h5plImp.h
./java/src/jni/h5rImp.c
@@ -3146,7 +3194,10 @@
./java/lib/ext/slf4j-simple-1.7.25.jar
# CMake-specific Files
-./config/intel.cmake
+./config/toolchain/crayle.cmake
+./config/toolchain/GCC.cmake
+./config/toolchain/intel.cmake
+./config/toolchain/PGI.cmake
./config/cmake/cacheinit.cmake
./config/cmake/CMakeFindJavaCommon.cmake
@@ -3177,6 +3228,7 @@
./config/cmake/UseJavaSymlinks.cmake
./config/cmake/userblockTest.cmake
./config/cmake/vfdTest.cmake
+./config/cmake/wait_H5Tinit.cmake
./config/cmake_ext_mod/ConfigureChecks.cmake
./config/cmake_ext_mod/CTestCustom.cmake
@@ -3202,7 +3254,6 @@
# CMake-specific Examples Files
./config/cmake/HDF5_Examples.cmake.in
-./config/cmake/HDF518_Examples.cmake.in
./release_docs/USING_CMake_Examples.txt
./CMakeLists.txt
@@ -3216,6 +3267,7 @@
./c++/src/CMakeLists.txt
./c++/test/CMakeLists.txt
./c++/test/CMakeTests.cmake
+./c++/test/CMakeVFDTests.cmake
./examples/CMakeLists.txt
./examples/CMakeTests.cmake
./examples/run-all-ex.sh
@@ -3259,6 +3311,7 @@
./test/ShellTests.cmake
./testpar/CMakeLists.txt
./testpar/CMakeTests.cmake
+./testpar/CMakeVFDTests.cmake
./tools/CMakeLists.txt
./tools/lib/CMakeLists.txt
./tools/src/CMakeLists.txt
@@ -3291,6 +3344,7 @@
./tools/src/h5repack/CMakeLists.txt
./tools/test/h5repack/CMakeLists.txt
./tools/test/h5repack/CMakeTests.cmake
+./tools/test/h5repack/CMakeVFDTests.cmake
./tools/src/h5stat/CMakeLists.txt
./tools/test/h5stat/CMakeLists.txt
./tools/test/h5stat/CMakeTests.cmake
@@ -3310,6 +3364,11 @@
./config/cmake/scripts/HDF5config.cmake
./config/cmake/scripts/HDF5options.cmake
+# CMake-specific HPC Scripts
+./config/cmake/scripts/HPC/sbatch-HDF5options.cmake
+./config/cmake/scripts/HPC/bsub-HDF5options.cmake
+./config/cmake/scripts/HPC/raybsub-HDF5options.cmake
+
# Files generated by autogen
./aclocal.m4
./bin/compile
diff --git a/Makefile.in b/Makefile.in
index 77251b9..ef473e7 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -392,7 +392,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -426,6 +425,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
diff --git a/README.txt b/README.txt
index 0415e2a..29081b6 100755..100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.10.4 released on 2018-10-05
+HDF5 version 1.10.5 released on 2019-02-25
------------------------------------------------------------------------------
Please refer to the release_docs/INSTALL file for installation instructions.
diff --git a/bin/batch/cori_ctestP.sl.in.cmake b/bin/batch/cori_ctestP.sl.in.cmake
new file mode 100644
index 0000000..287fe3c
--- /dev/null
+++ b/bin/batch/cori_ctestP.sl.in.cmake
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#SBATCH -C haswell
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestP
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test"
+
+echo "Run $CMD. Test output will be in build/ctestP.out"
+$CMD >& ctestP.out
+echo "Done running $CMD"
+
diff --git a/bin/batch/cori_ctestS.sl.in.cmake b/bin/batch/cori_ctestS.sl.in.cmake
new file mode 100644
index 0000000..50bef6b
--- /dev/null
+++ b/bin/batch/cori_ctestS.sl.in.cmake
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH -C haswell
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestS
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test"
+
+echo "Run $CMD. Test output will be in build/ctestS.out"
+$CMD >& ctestS.out
+echo "Done running $CMD"
diff --git a/bin/batch/cori_knl_ctestP.sl.in.cmake b/bin/batch/cori_knl_ctestP.sl.in.cmake
new file mode 100644
index 0000000..82378ec
--- /dev/null
+++ b/bin/batch/cori_knl_ctestP.sl.in.cmake
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#SBATCH -C knl,quad,cache
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestP
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test"
+
+echo "Run $CMD. Test output will be in build/ctestP.out"
+$CMD >& ctestP.out
+echo "Done running $CMD"
+
diff --git a/bin/batch/cori_knl_ctestS.sl.in.cmake b/bin/batch/cori_knl_ctestS.sl.in.cmake
new file mode 100644
index 0000000..bcb4881
--- /dev/null
+++ b/bin/batch/cori_knl_ctestS.sl.in.cmake
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH -C knl,quad, cache
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestS
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test"
+
+echo "Run $CMD. Test output will be in build/ctestS.out"
+$CMD >& ctestS.out
+echo "Done running $CMD"
diff --git a/bin/batch/ctestP.lsf.in.cmake b/bin/batch/ctestP.lsf.in.cmake
new file mode 100644
index 0000000..2777f39
--- /dev/null
+++ b/bin/batch/ctestP.lsf.in.cmake
@@ -0,0 +1,19 @@
+#!/bin/tcsh
+### LSF syntax
+#BSUB -nnodes 1 #number of nodes
+#BSUB -W 30 #walltime in minutes
+#BSUB -G guests #account
+#BSUB -e ctestPerrors.txt #stderr
+#BSUB -o ctestPoutput.txt #stdout
+#BSUB -J hdf5_ctestP #job
+##BSUB -q pbatch #queue to use
+#BSUB -q pdebug
+
+##date; hostname
+##echo -n 'JobID is '; echo $LSB_JOBID
+
+cd @HDF5_BINARY_DIR@
+echo "Run parallel test command. Test output will be in build/ctestP.out"
+ctest . -R 'TEST_PAR|PH5DIFF|PERFORM' -E t_cache_image -C Release -T test >& ctestP.out
+
+echo "Done running ctest parallel command."
diff --git a/bin/batch/ctestP.sl.in.cmake b/bin/batch/ctestP.sl.in.cmake
new file mode 100644
index 0000000..8d216d6
--- /dev/null
+++ b/bin/batch/ctestP.sl.in.cmake
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestP
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test"
+
+echo "Run $CMD. Test output will be in build/ctestP.out"
+$CMD >& ctestP.out
+echo "Done running $CMD"
+
diff --git a/bin/batch/ctestS.lsf.in.cmake b/bin/batch/ctestS.lsf.in.cmake
new file mode 100644
index 0000000..7ef5af5
--- /dev/null
+++ b/bin/batch/ctestS.lsf.in.cmake
@@ -0,0 +1,18 @@
+#!/bin/tcsh
+### LSF syntax
+#BSUB -nnodes 1 #number of nodes
+#BSUB -W 29 #walltime in minutes
+#BSUB -G guests #account
+#BSUB -e ctestSerrors.txt #stderr
+#BSUB -o ctestSoutput.txt #stdout
+#BSUB -J hdf5_ctestS #job
+##BSUB -q pbatch #queue to use
+#BSUB -q pdebug
+
+cd @HDF5_BINARY_DIR@
+echo "Run command. Test output will be in build/ctestS.out"
+ctest . -E 'TEST_PAR|PH5DIFF|PERFORM' -C Release -j 32 -T test >& ctestS.out
+
+##$CMD >& ctestS.out
+echo "Done running command."
+
diff --git a/bin/batch/ctestS.sl.in.cmake b/bin/batch/ctestS.sl.in.cmake
new file mode 100644
index 0000000..4f96bb9
--- /dev/null
+++ b/bin/batch/ctestS.sl.in.cmake
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestS
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test"
+
+echo "Run $CMD. Test output will be in build/ctestS.out"
+$CMD >& ctestS.out
+echo "Done running $CMD"
diff --git a/bin/batch/knl_H5detect.sl.in.cmake b/bin/batch/knl_H5detect.sl.in.cmake
new file mode 100644
index 0000000..39a3ef3
--- /dev/null
+++ b/bin/batch/knl_H5detect.sl.in.cmake
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+#SBATCH -p knl -C quad
+#SBATCH --nodes=1
+#SBATCH -t 00:10:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+#SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=knl_h5detect
+
+
+# Inputs: Build directory, output file name, executable file name (username/email if available).
+PROGNAME=H5detect
+OUTPUT=H5Tinit.c
+
+CMD="@HDF5_BINARY_DIR@/bin/${PROGNAME} @HDF5_GENERATED_SOURCE_DIR@/${OUTPUT}"
+echo "Run $CMD"
+srun -n 1 $CMD
+echo "Done running $CMD"
+
diff --git a/bin/batch/knl_ctestP.sl.in.cmake b/bin/batch/knl_ctestP.sl.in.cmake
new file mode 100644
index 0000000..79dfb89
--- /dev/null
+++ b/bin/batch/knl_ctestP.sl.in.cmake
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+#SBATCH -p knl -C quad,cache
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestS
+
+cd @HDF5_BINARY_DIR@
+#run parallel tests except t_cache_image test
+CMD="ctest . -R MPI_TEST_ -E t_cache_image -C Release -T test"
+
+echo "Run $CMD. Test output will be in build/ctestP.out"
+$CMD >& ctestP.out
+echo "Done running $CMD"
+
diff --git a/bin/batch/knl_ctestS.sl.in.cmake b/bin/batch/knl_ctestS.sl.in.cmake
new file mode 100644
index 0000000..af6353b
--- /dev/null
+++ b/bin/batch/knl_ctestS.sl.in.cmake
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+#SBATCH -p knl -C quad,cache
+#SBATCH --nodes=1
+#SBATCH -t 00:30:00
+#SBATCH --mail-type=BEGIN,END,FAIL
+##SBATCH --mail-user=<username>@sandia.gov
+#SBATCH --export=ALL
+#SBATCH --job-name=h5_ctestS
+
+cd @HDF5_BINARY_DIR@
+CMD="ctest . -E MPI_TEST_ -C Release -j 32 -T test"
+
+echo "Run $CMD. Test output will be in build/ctestS.out"
+$CMD >& ctestS.out
+echo "Done running $CMD"
+
diff --git a/bin/batch/ray_ctestP.lsf.in.cmake b/bin/batch/ray_ctestP.lsf.in.cmake
new file mode 100644
index 0000000..082276a
--- /dev/null
+++ b/bin/batch/ray_ctestP.lsf.in.cmake
@@ -0,0 +1,20 @@
+#!/bin/tcsh
+### LSF syntax
+#BSUB -n 6 #number of nodes
+#BSUB -R "span[ptile=6]"
+#BSUB -W 30 #walltime in minutes
+#BSUB -G guests #account
+#BSUB -e ctestPerrors.txt #stderr
+#BSUB -o ctestPoutput.txt #stdout
+#BSUB -J hdf5_ctestP #job
+##BSUB -q pbatch #queue to use
+#BSUB -q pdebug
+
+##date; hostname
+##echo -n 'JobID is '; echo $LSB_JOBID
+
+cd @HDF5_BINARY_DIR@
+echo "Run parallel test command. Test output will be in build/ctestP.out"
+ctest . -R 'MPI_TEST_' -E t_cache_image -C Release -T test >& ctestP.out
+
+echo "Done running ctest parallel command."
diff --git a/bin/batch/ray_ctestS.lsf.in.cmake b/bin/batch/ray_ctestS.lsf.in.cmake
new file mode 100644
index 0000000..da20438
--- /dev/null
+++ b/bin/batch/ray_ctestS.lsf.in.cmake
@@ -0,0 +1,18 @@
+#!/bin/tcsh
+### LSF syntax
+#BSUB -n 1 #number of nodes
+#BSUB -W 29 #walltime in minutes
+#BSUB -G guests #account
+#BSUB -e ctestSerrors.txt #stderr
+#BSUB -o ctestSoutput.txt #stdout
+#BSUB -J hdf5_ctestS #job
+##BSUB -q pbatch #queue to use
+#BSUB -q pdebug
+
+cd @HDF5_BINARY_DIR@
+echo "Run command. Test output will be in build/ctestS.out"
+ctest . -E 'MPI_TEST_' -C Release -j 32 -T test >& ctestS.out
+
+##$CMD >& ctestS.out
+echo "Done running command."
+
diff --git a/bin/batch/raybsub b/bin/batch/raybsub
new file mode 100755
index 0000000..19dceef
--- /dev/null
+++ b/bin/batch/raybsub
@@ -0,0 +1,7 @@
+#!/bin/tcsh
+
+# ray.llnl.gov requires a '<' with bsub for submitting .lsf batch jobs.
+# CMake is reluctant to pass the '<', so we put it in this script and use
+# the script to submit the bsub command on ray.
+
+bsub < $1
diff --git a/bin/release b/bin/release
index e43be17..699acfc 100755
--- a/bin/release
+++ b/bin/release
@@ -55,11 +55,11 @@ for compressing the resulting tar archive (if none are given then
tar -- use tar and don't do any compressing.
gzip -- use gzip with "-9" and append ".gz" to the output name.
- cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh
- command file and all other CMake files needed to build HDF5 source
- using CMake on unix machines.
bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name.
zip -- convert all text files to DOS style and form a zip file for Windows use.
+ cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh
+ command file and all other CMake files needed to build HDF5 source
+ using CMake on unix machines, including HPC machines.
cmake-zip -- convert all text files to DOS style and create a zip file inluding cmake
scripts and .bat files to build HDF5 source using CMake on Windows.
doc -- produce the latest doc tree in addition to the archive.
@@ -225,7 +225,7 @@ tar2cmakezip()
# step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files
cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmziptmpsubdir
cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmziptmpsubdir
- cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmziptmpsubdir
+ cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.13-Source.tar.gz $cmziptmpsubdir
cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir
cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmziptmpsubdir
cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmziptmpsubdir
@@ -256,7 +256,7 @@ tar2cmakezip()
}
# Function name: tar2cmaketgz
-# Convert the release tarball to a Windows zipball with files to run CMake build.
+# Convert the release tarball to a gzipped tar file with files to run CMake build.
#
# Programmer: Larry Knox
# Creation date: 2017-02-20
@@ -271,12 +271,14 @@ tar2cmakezip()
# 3. add SZIP.tar.gz, ZLib.tar.gz and cmake files to top level directory.
# 4. create gzipped tar file with these contents:
# build-unix.sh script
+# build-unix-hpc.sh script
# hdf5-<version> source code directory extracted from tar file
# CTestScript.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts
# HDF5config.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts
# HDF5options.cmake cmake file copied from <hdf5 source code>/config/cmake/scripts
# SZip.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake
# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf5/CMake
+# README_HDF5_CMake copied from <hdf5 source code>/release_docs
# Parameters:
@@ -314,16 +316,18 @@ tar2cmaketgz()
fi
- # step 2: add build-unix.sh script
+ # step 2: add build-unix.sh and build-unix-hpc.sh scripts
(cd $cmgztmpsubdir; echo "ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log" > build-unix.sh; chmod 755 build-unix.sh)
+ (cd $cmgztmpsubdir; echo "ctest -S HDF5config.cmake,HPC=sbatch,MPI=true -C Release -V -O hdf5.log" > build-unix-hpc.sh; chmod 755 build-unix-hpc.sh)
# step 3: add SZIP.tar.gz, ZLib.tar.gz and cmake files
cp /mnt/scr1/pre-release/hdf5/CMake/SZip.tar.gz $cmgztmpsubdir
cp /mnt/scr1/pre-release/hdf5/CMake/ZLib.tar.gz $cmgztmpsubdir
- cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.10-Source.tar.gz $cmgztmpsubdir
+ cp /mnt/scr1/pre-release/hdf5/CMake/HDF5Examples-1.10.13-Source.tar.gz $cmgztmpsubdir
cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir
cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5config.cmake $cmgztmpsubdir
cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF5options.cmake $cmgztmpsubdir
+ cp $cmgztmpsubdir/$version/release_docs/README_HDF5_CMake $cmgztmpsubdir
tar czf $DEST/CMake-$HDF5_VERS.tar.gz -C $cmgztmpdir . || exit 1
# cleanup
diff --git a/c++/Makefile.in b/c++/Makefile.in
index 7714bd7..8a1c5d0b 100644
--- a/c++/Makefile.in
+++ b/c++/Makefile.in
@@ -553,7 +553,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -587,6 +586,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1442,7 +1442,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/c++/examples/Makefile.in b/c++/examples/Makefile.in
index dc73c53..16b8857 100644
--- a/c++/examples/Makefile.in
+++ b/c++/examples/Makefile.in
@@ -501,7 +501,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -535,6 +534,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1396,7 +1396,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/c++/src/H5CppDoc.h b/c++/src/H5CppDoc.h
index 0da98a4..5e80408 100644
--- a/c++/src/H5CppDoc.h
+++ b/c++/src/H5CppDoc.h
@@ -53,8 +53,7 @@
* <br />
* \section install_sec Installation
*
- * The HDF5 C++ API is included with the HDF5 source code and can
- * be obtained from
+ * The HDF5 C++ API is included with the HDF5 source code.
*
* Please refer to the release_docs/INSTALL file under the top directory
* of the HDF5 source code for information about installing, building,
diff --git a/c++/src/H5LaccProp.h b/c++/src/H5LaccProp.h
index 70890b3..ec5e54f 100644
--- a/c++/src/H5LaccProp.h
+++ b/c++/src/H5LaccProp.h
@@ -12,9 +12,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class LinkAccPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5LinkAccPropList_H
#define __H5LinkAccPropList_H
@@ -22,15 +19,15 @@ namespace H5 {
/*! \class LinkAccPropList
\brief Class LinkAccPropList inherits from PropList and provides
- wrappers for the HDF5 file access property list.
+ wrappers for the HDF5 link access property list.
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkAccPropList : public PropList {
public:
- ///\brief Default file access property list.
+ ///\brief Default link access property list.
static const LinkAccPropList& DEFAULT;
- // Creates a file access property list.
+ // Creates a link access property list.
LinkAccPropList();
///\brief Returns this class name.
@@ -39,7 +36,7 @@ class H5_DLLCPP LinkAccPropList : public PropList {
// Copy constructor: same as the original LinkAccPropList.
LinkAccPropList(const LinkAccPropList& original);
- // Creates a copy of an existing file access property list
+ // Creates a copy of an existing link access property list
// using the property list id.
LinkAccPropList (const hid_t plist_id);
diff --git a/c++/src/H5LcreatProp.h b/c++/src/H5LcreatProp.h
index 12cb479..f6e10bf 100644
--- a/c++/src/H5LcreatProp.h
+++ b/c++/src/H5LcreatProp.h
@@ -12,9 +12,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-// Class LinkCreatPropList represents the HDF5 file access property list and
-// inherits from DataType.
-
#ifndef __H5LinkCreatPropList_H
#define __H5LinkCreatPropList_H
@@ -22,15 +19,15 @@ namespace H5 {
/*! \class LinkCreatPropList
\brief Class LinkCreatPropList inherits from PropList and provides
- wrappers for the HDF5 file access property list.
+ wrappers for the HDF5 link creation property list.
*/
// Inheritance: PropList -> IdComponent
class H5_DLLCPP LinkCreatPropList : public PropList {
public:
- ///\brief Default file access property list.
+ ///\brief Default link creation property list.
static const LinkCreatPropList& DEFAULT;
- // Creates a file access property list.
+ // Creates a link creation property list.
LinkCreatPropList();
///\brief Returns this class name.
@@ -39,7 +36,7 @@ class H5_DLLCPP LinkCreatPropList : public PropList {
// Copy constructor: same as the original LinkCreatPropList.
LinkCreatPropList(const LinkCreatPropList& original);
- // Creates a copy of an existing file access property list
+ // Creates a copy of an existing link creation property list
// using the property list id.
LinkCreatPropList (const hid_t plist_id);
diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp
index 1c22efe..8d3334b 100644
--- a/c++/src/H5Object.cpp
+++ b/c++/src/H5Object.cpp
@@ -40,9 +40,8 @@
namespace H5 {
#ifndef DOXYGEN_SHOULD_SKIP_THIS
-// userAttrOpWrpr simply interfaces between the user's function and the
-// C library function H5Aiterate2; used to resolve the different prototype
-// problem. May be moved to Iterator later.
+// userAttrOpWrpr interfaces between the user's function and the
+// C library function H5Aiterate2
extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
const H5A_info_t *ainfo, void *op_data)
{
@@ -52,6 +51,17 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name,
return 0;
}
+// userVisitOpWrpr interfaces between the user's function and the
+// C library function H5Ovisit2
+extern "C" herr_t userVisitOpWrpr(hid_t obj_id, const char *attr_name,
+ const H5O_info_t *obj_info, void *op_data)
+{
+ H5std_string s_attr_name = H5std_string(attr_name);
+ UserData4Visit* myData = reinterpret_cast<UserData4Visit *> (op_data);
+ int status = myData->op(*myData->obj, s_attr_name, obj_info, myData->opData);
+ return status;
+}
+
//--------------------------------------------------------------------------
// Function: H5Object default constructor (protected)
// Programmer Binh-Minh Ribler - 2000
@@ -197,8 +207,6 @@ Attribute H5Object::openAttribute(const unsigned int idx) const
///\par Description
/// The signature of user_op is
/// void (*)(H5::H5Location&, H5std_string, void*).
-/// For information, please refer to the H5Aiterate2 API in
-/// the HDF5 C Reference Manual.
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_data)
@@ -228,6 +236,61 @@ int H5Object::iterateAttrs(attr_operator_t user_op, unsigned *_idx, void *op_dat
}
//--------------------------------------------------------------------------
+// Function: H5Object::visit
+///\brief Recursively visits all HDF5 objects accessible from this object.
+///\param idx_type - IN: Type of index; valid values include:
+/// \li \c H5_INDEX_NAME
+/// \li \c H5_INDEX_CRT_ORDER
+///\param order - IN: Order in which index is traversed; valid values include:
+/// \li \c H5_ITER_DEC
+/// \li \c H5_ITER_INC
+/// \li \c H5_ITER_NATIVE
+///\param user_op - IN: Callback function passing data regarding the
+/// object to the calling application
+///\param *op_data - IN: User-defined pointer to data required by the
+/// application for its processing of the object
+///\param fields - IN: Flags specifying the fields to be retrieved
+/// to the callback op via the H5O_info_t argument.
+/// \li \c H5O_INFO_BASIC fileno, addr, type, and rc fields
+/// \li \c H5O_INFO_TIME atime, mtime, ctime, and btime fields
+/// \li \c H5O_INFO_NUM_ATTRS num_attrs field
+/// \li \c H5O_INFO_HDR hdr field
+/// \li \c H5O_INFO_META_SIZE meta_size field
+/// \li \c H5O_INFO_ALL H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE
+///\return
+/// \li On success:
+/// \li the return value of the first operator that returns a positive value
+/// \li zero if all members were processed with no operator returning non-zero
+/// \li On failure:
+/// \li an exception Exception will be thrown if something went
+/// wrong within the library or the operator failed
+///\exception H5::Exception
+///\par Description
+/// For information, please refer to the H5Ovisit2 API in the HDF5
+/// C Reference Manual.
+// Programmer Binh-Minh Ribler - Feb, 2019
+//--------------------------------------------------------------------------
+void H5Object::visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields)
+{
+ // Store the user's function and data
+ UserData4Visit* userData = new UserData4Visit;
+ userData->opData = op_data;
+ userData->op = user_op;
+ userData->obj = this;
+
+ // Call the C API passing in op wrapper and info
+ herr_t ret_value = H5Ovisit2(getId(), idx_type, order, userVisitOpWrpr, static_cast<void *>(userData), fields);
+
+ // Release memory
+ delete userData;
+
+ // Throw exception if H5Ovisit2 failed, which could be a failure in
+ // the library or in the call back operator
+ if (ret_value < 0)
+ throw Exception(inMemFunc("visit"), "H5Ovisit2 failed");
+}
+
+//--------------------------------------------------------------------------
// Function: H5Object::objVersion
///\brief Returns the header version of this HDF5 object.
///\return Object version, which can have the following values:
diff --git a/c++/src/H5Object.h b/c++/src/H5Object.h
index 10b3865..4a4e909 100644
--- a/c++/src/H5Object.h
+++ b/c++/src/H5Object.h
@@ -40,16 +40,30 @@ namespace H5 {
// Inheritance: H5Location -> IdComponent
// Define the operator function pointer for H5Aiterate().
-typedef void (*attr_operator_t)(H5Object& loc/*in*/,
- const H5std_string attr_name/*in*/,
- void *operator_data/*in,out*/);
+typedef void (*attr_operator_t)(H5Object& loc,
+ const H5std_string attr_name,
+ void *operator_data);
+
+// Define the operator function pointer for H5Ovisit2().
+typedef int (*visit_operator_t)(H5Object& obj,
+ const H5std_string attr_name,
+ const H5O_info_t *oinfo,
+ void *operator_data);
// User data for attribute iteration
class UserData4Aiterate {
public:
attr_operator_t op;
void* opData;
- H5Object* location;
+ H5Object* location; // Consider changing to H5Location
+};
+
+// User data for visit iteration
+class UserData4Visit {
+ public:
+ visit_operator_t op;
+ void* opData;
+ H5Object* obj;
};
class H5_DLLCPP H5Object : public H5Location {
@@ -71,6 +85,9 @@ class H5_DLLCPP H5Object : public H5Location {
// Iterate user's function over the attributes of this object.
int iterateAttrs(attr_operator_t user_op, unsigned* idx = NULL, void* op_data = NULL);
+ // Recursively visit elements reachable from this object.
+ void visit(H5_index_t idx_type, H5_iter_order_t order, visit_operator_t user_op, void *op_data, unsigned int fields);
+
// Returns the object header version of an object
unsigned objVersion() const;
@@ -98,6 +115,7 @@ class H5_DLLCPP H5Object : public H5Location {
ssize_t getObjName(H5std_string& obj_name, size_t len = 0) const;
H5std_string getObjName() const;
+
#ifndef DOXYGEN_SHOULD_SKIP_THIS
protected:
diff --git a/c++/src/Makefile.in b/c++/src/Makefile.in
index fc58ec2..144c3d2 100644
--- a/c++/src/Makefile.in
+++ b/c++/src/Makefile.in
@@ -566,7 +566,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -600,6 +599,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -744,29 +744,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# This is our main target
@@ -1611,7 +1611,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config
index 0fdd91c..e2ed648 100644
--- a/c++/src/cpp_doc_config
+++ b/c++/src/cpp_doc_config
@@ -38,7 +38,7 @@ PROJECT_NAME =
# could be handy for archiving the generated documentation or if some version
# control system is used.
-PROJECT_NUMBER = "1.10.4"
+PROJECT_NUMBER = "1.10.5"
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
diff --git a/c++/test/CMakeTests.cmake b/c++/test/CMakeTests.cmake
index 6de801e..02bff3e 100644
--- a/c++/test/CMakeTests.cmake
+++ b/c++/test/CMakeTests.cmake
@@ -47,55 +47,12 @@ else ()
endif ()
set_tests_properties (CPP_testhdf5 PROPERTIES DEPENDS CPP_testhdf5-clear-objects)
-if (HDF5_TEST_VFD)
-
- set (VFD_LIST
- sec2
- stdio
- core
- split
- multi
- family
- )
-
- if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
- endif ()
-
- macro (ADD_VFD_TEST vfdname resultcode)
- if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
- add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- tattr_basic.h5
- tattr_compound.h5
- tattr_dtype.h5
- tattr_multi.h5
- tattr_scalar.h5
- tfattrs.h5
- titerate.h5
- )
- add_test (
- NAME CPP_VFD-${vfdname}-cpp_testhdf5
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=cpp_testhdf5"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
- set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT 30)
- endif ()
- endmacro ()
-
- # Run test with different Virtual File Driver
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
- endforeach ()
+##############################################################################
+##############################################################################
+### V F D T E S T S ###
+##############################################################################
+##############################################################################
+if (HDF5_TEST_VFD)
+ include (CMakeVFDTests.cmake)
endif ()
diff --git a/c++/test/CMakeVFDTests.cmake b/c++/test/CMakeVFDTests.cmake
new file mode 100644
index 0000000..6a8ce2c
--- /dev/null
+++ b/c++/test/CMakeVFDTests.cmake
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+ set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+ endif ()
+
+ macro (ADD_VFD_TEST vfdname resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdname}")
+ add_test (
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ tattr_basic.h5
+ tattr_compound.h5
+ tattr_dtype.h5
+ tattr_multi.h5
+ tattr_scalar.h5
+ tfattrs.h5
+ titerate.h5
+ )
+ add_test (
+ NAME CPP_VFD-${vfdname}-cpp_testhdf5
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:cpp_testhdf5>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=cpp_testhdf5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES DEPENDS CPP_VFD-${vfdname}-cpp_testhdf5-clear-objects)
+ set_tests_properties (CPP_VFD-${vfdname}-cpp_testhdf5 PROPERTIES TIMEOUT ${CTEST_SHORT_TIMEOUT})
+ endif ()
+ endmacro ()
+
+ # Run test with different Virtual File Driver
+ foreach (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ endforeach ()
diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in
index 46f194f..4c0a33b 100644
--- a/c++/test/Makefile.in
+++ b/c++/test/Makefile.in
@@ -556,7 +556,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -590,6 +589,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1454,7 +1454,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp
index 14f1bd4..cf4f6e4 100644
--- a/c++/test/dsets.cpp
+++ b/c++/test/dsets.cpp
@@ -58,13 +58,13 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
/*-------------------------------------------------------------------------
* Function: test_create
*
- * Purpose Attempts to create a dataset.
+ * Purpose: Attempts to create a dataset.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
@@ -184,15 +184,15 @@ static herr_t test_create( H5File& file)
/*-------------------------------------------------------------------------
* Function: test_simple_io
*
- * Purpose Tests simple I/O. That is, reading and writing a complete
+ * Purpose: Tests simple I/O. That is, reading and writing a complete
* multi-dimensional array without data type or data space
* conversions, without compression, and stored contiguously.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
@@ -268,13 +268,13 @@ static herr_t test_simple_io( H5File& file)
/*-------------------------------------------------------------------------
* Function: test_datasize
*
- * Purpose Tests DataSet::getInMemDataSize().
+ * Purpose: Tests DataSet::getInMemDataSize().
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler
+ * Programmer: Binh-Minh Ribler
* Thursday, March 22, 2012
*-------------------------------------------------------------------------
*/
@@ -334,13 +334,13 @@ static herr_t test_datasize(FileAccPropList &fapl)
/*-------------------------------------------------------------------------
* Function: test_tconv
*
- * Purpose Test some simple data type conversion stuff.
+ * Purpose: Test some simple data type conversion stuff.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
@@ -425,13 +425,13 @@ const H5Z_class2_t H5Z_BOGUS[1] = {{
/*-------------------------------------------------------------------------
* Function: bogus
*
- * Purpose A bogus compression method that doesn't do anything.
+ * Purpose: A bogus compression method that doesn't do anything.
*
- * Return Success: Data chunk size
+ * Return: Success: Data chunk size
*
* Failure: 0
*
- * Programmer Robb Matzke
+ * Programmer: Robb Matzke
* Tuesday, April 21, 1998
*-------------------------------------------------------------------------
*/
@@ -447,16 +447,16 @@ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts,
/*-------------------------------------------------------------------------
* Function: test_compression
*
- * Purpose Tests dataset compression. If compression is requested when
+ * Purpose: Tests dataset compression. If compression is requested when
* it hasn't been compiled into the library (such as when
* updating an existing compressed dataset) then data is sent to
* the file uncompressed but no errors are returned.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*-------------------------------------------------------------------------
*/
@@ -730,13 +730,13 @@ static herr_t test_compression(H5File& file)
/*-------------------------------------------------------------------------
* Function: test_nbit_methods
*
- * Purpose Tests setting nbit compression methods.
+ * Purpose: Tests setting nbit compression methods.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler
+ * Programmer: Binh-Minh Ribler
* Friday, April 22, 2016
*
*-------------------------------------------------------------------------
@@ -847,16 +847,16 @@ static herr_t test_nbit_compression(H5File& file)
/*-------------------------------------------------------------------------
* Function: test_multiopen
*
- * Purpose Tests that a bug no longer exists. If a dataset is opened
+ * Purpose: Tests that a bug no longer exists. If a dataset is opened
* twice and one of the handles is used to extend the dataset,
* then the other handle should return the new size when
* queried.
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Saturday, February 17, 2001
*-------------------------------------------------------------------------
*/
@@ -929,13 +929,13 @@ static herr_t test_multiopen (H5File& file)
/*-------------------------------------------------------------------------
* Function: test_types
*
- * Purpose Test various types - should be moved to dtypes.cpp
+ * Purpose: Test various types - should be moved to dtypes.cpp
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* February 17, 2001
*-------------------------------------------------------------------------
*/
@@ -1118,9 +1118,9 @@ static herr_t test_types(H5File& file)
/*-------------------------------------------------------------------------
* Function: test_getObjinfo
*
- * Purpose Tests getObjinfo()
+ * Purpose: Tests getObjinfo()
*
- * Return Success: 0
+ * Return: Success: 0
* Failure: -1
*
* July, 2018
@@ -1178,10 +1178,10 @@ static herr_t test_getinfo(H5File& file)
/*-------------------------------------------------------------------------
* Function: test_chunk_cache
*
- * Purpose Tests setting rdcc info on a DAPL, and interaction
+ * Purpose: Tests setting rdcc info on a DAPL, and interaction
* with the corresponding properties in the file structure.
*
- * Return Success: 0
+ * Return: Success: 0
* Failure: number of errors
*
* July 2018
@@ -1290,13 +1290,13 @@ static herr_t test_chunk_cache(FileAccPropList fapl)
/*-------------------------------------------------------------------------
* Function: test_virtual
*
- * Purpose Tests fixed, unlimited, and printf selections in the same
+ * Purpose: Tests fixed, unlimited, and printf selections in the same
* VDS
*
- * Return Success: 0
+ * Return: Success: 0
* Failure: number of errors
*
- * Programmer Binh-Minh Ribler
+ * Programmer: Binh-Minh Ribler
* Friday, March 10, 2017
*
*-------------------------------------------------------------------------
@@ -1368,13 +1368,13 @@ static herr_t test_virtual()
/*-------------------------------------------------------------------------
* Function: test_dset
*
- * Purpose Tests the dataset interface (H5D)
+ * Purpose: Tests the dataset interface (H5D)
*
- * Return Success: 0
+ * Return: Success: 0
*
* Failure: -1
*
- * Programmer Binh-Minh Ribler (using C version)
+ * Programmer: Binh-Minh Ribler (using C version)
* Friday, January 5, 2001
*
* Modifications:
@@ -1438,11 +1438,11 @@ void test_dset()
/*-------------------------------------------------------------------------
* Function: cleanup_dsets
*
- * Purpose Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return None
+ * Return: None
*
- * Programmer (use C version)
+ * Programmer: (use C version)
*-------------------------------------------------------------------------
*/
extern "C"
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index 6bd4ca6..a341885 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -286,7 +286,7 @@ H5::DataType getArr()
*dims = 5;
H5::ArrayType ret;
ret = H5::ArrayType(H5::PredType::NATIVE_INT, 1, dims);
- delete[] dims;
+ delete dims;
return ret;
}
diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp
index f8d7089..491cd6a 100644
--- a/c++/test/tlinks.cpp
+++ b/c++/test/tlinks.cpp
@@ -31,288 +31,27 @@ using namespace H5;
#include "h5test.h"
#include "h5cpputil.h" // C++ utilility header file
-// A lot of the definition inherited from C test links.c is left here until
-// the H5L API is implemented and tests are completed - BMR 10/19/2009
-/*
- * This file needs to access private information from the H5G package.
- * This file also needs to access the group testing code.
- */
-//#define H5G_FRIEND
-//#define H5G_TESTING
-
-//#include "h5test.h"
-//#include "H5Gpkg.h" /* Groups */
-//#include "H5Iprivate.h" /* IDs */
-//#include "H5Lprivate.h" /* Links */
-
-/* File for external link test. Created with gen_udlinks.c */
-#define LINKED_FILE "be_extlink2.h5"
-
-#if 0
-const char *FILENAME[] = {
- "links0",
- "links1",
- "links2",
- "links3",
- "links4a", /* 4 */
- "links4b", /* 5 */
- "links4c", /* 6 */
- "links4d", /* 7 */
- "links5", /* 8 */
- "links6", /* 9 */
- "links7", /* 10 */
- "links8", /* 11 */
- "extlinks0", /* 12: main files */
- "tmp/extlinks0", /* 13: */
- "extlinks1", /* 14: target files */
- "tmp/extlinks1", /* 15: */
- "extlinks2", /* 16: */
- "tmp/extlinks2", /* 17: */
- "extlinks3", /* 18: */
- "tmp/extlinks3", /* 19: */
- "extlinks4", /* 20: */
- "tmp/extlinks4", /* 21: */
- "extlinks5", /* 22: */
- "tmp/extlinks6", /* 23: */
- "extlinks7", /* 24: */
- "tmp/extlinks7", /* 25: */
- "tmp/extlinks8", /* 26: */
- "extlinks9", /* 27: */
- "tmp/extlinks9", /* 28: */
- "extlinks10", /* 29: */ /* TESTS for windows */
- "tmp/extlinks10", /* 30: */
- "tmp/extlinks11", /* 31: */
- "tmp/extlinks12", /* 32: */
- "extlinks13", /* 33: */
- "tmp/extlinks13", /* 34: */
- "tmp/extlinks14", /* 35: */
- "tmp/extlinks15", /* 36: */
- "extlinks16A", /* 37: */ /* TESTS for H5P_set_elink_fapl */
- "extlinks16B", /* 38: */
- "extlinks17", /* 39: */
- "extlinks18A", /* 40: */
- "extlinks18B", /* 41: */
- "extlinks19A", /* 42: */
- "extlinks19B", /* 43: */
- "extlinks20", /* 44: */
- NULL
-};
-
-#endif // 0
-
-#define TMPDIR "tmp"
-
-#define FAMILY_SIZE 1024
-#define CORE_INCREMENT 1024
-#define NUM400 400
-
-/* do not do check_all_closed() for "ext*" files and "tmp/ext*" */
-#define EXTSTOP 12
-
-#define LINK_BUF_SIZE 1024
#define NAME_BUF_SIZE 1024
-#define MAX_NAME_LEN ((64*1024)+1024)
-
-/* Link type IDs */
-#define UD_HARD_TYPE 201
-#define UD_CB_TYPE H5L_TYPE_MAX
-#define UD_PLIST_TYPE 128
-#define UD_CBFAIL_TYPE UD_PLIST_TYPE
-#define UD_ERROR_TYPE 189
-#define UD_BAD_TYPE1 H5L_TYPE_HARD
-#define UD_BAD_TYPE2 (H5L_TYPE_UD_MIN - 5)
-#define UD_BAD_VERS (H5L_LINK_CLASS_T_VERS + 1)
-
-#define DEST_PROP_NAME "destination_group"
-#define REREG_TARGET_NAME "rereg_target"
-
-#define UD_CB_LINK_NAME "ud_callback_link"
-#define NEW_UD_CB_LINK_NAME "ud_callback_link2"
-#define UD_CB_TARGET "ud_target"
-#define UD_CB_TARGET_LEN 10
-
-#define LE_FILENAME "le_extlink1.h5"
-#define BE_FILENAME "be_extlink1.h5"
-
-#define ELINK_CB_FAM_SIZE (hsize_t) 100
-
#define H5L_DIM1 100
#define H5L_DIM2 100
-/* Creation order macros */
-#define CORDER_SOFT_GROUP_NAME "corder_soft_group"
-#define CORDER_NLINKS 18
-
-/* Timestamp macros */
-#define TIMESTAMP_GROUP_1 "timestamp1"
-#define TIMESTAMP_GROUP_2 "timestamp2"
-
-/* Link iteration struct */
-typedef struct {
- H5_iter_order_t order; /* Direction of iteration */
- unsigned ncalled; /* # of times callback is entered */
- unsigned nskipped; /* # of links skipped */
- int stop; /* # of iterations to stop after */
- int64_t curr; /* Current creation order value */
- size_t max_visit; /* Size of "visited link" flag array */
- hbool_t *visited; /* Pointer to array of "visited link" flags */
-} link_iter_info_t;
-
-#if 0
-/* Link visit structs */
-typedef struct {
- const char *path; /* Path to link */
- H5L_type_t type; /* Type of link */
-} link_visit_t;
-static const link_visit_t lvisit0[] = {
- {"Dataset_zero", H5L_TYPE_HARD},
- {"Group1", H5L_TYPE_HARD},
- {"Group1/Dataset_one", H5L_TYPE_HARD},
- {"Group1/Group2", H5L_TYPE_HARD},
- {"Group1/Group2/Dataset_two", H5L_TYPE_HARD},
- {"Group1/Group2/Type_two", H5L_TYPE_HARD},
- {"Group1/Group2/hard_zero", H5L_TYPE_HARD},
- {"Group1/Type_one", H5L_TYPE_HARD},
- {"Group1/hard_one", H5L_TYPE_HARD},
- {"Type_zero", H5L_TYPE_HARD},
- {"ext_dangle", H5L_TYPE_EXTERNAL},
- {"ext_one", H5L_TYPE_EXTERNAL},
- {"hard_one", H5L_TYPE_HARD},
- {"hard_two", H5L_TYPE_HARD},
- {"hard_zero", H5L_TYPE_HARD},
- {"soft_dangle", H5L_TYPE_SOFT},
- {"soft_one", H5L_TYPE_SOFT},
- {"soft_two", H5L_TYPE_SOFT}
-};
-static const link_visit_t lvisit1[] = {
- {"Dataset_one", H5L_TYPE_HARD},
- {"Group2", H5L_TYPE_HARD},
- {"Group2/Dataset_two", H5L_TYPE_HARD},
- {"Group2/Type_two", H5L_TYPE_HARD},
- {"Group2/hard_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/Dataset_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/Group1", H5L_TYPE_HARD},
- {"Group2/hard_zero/Type_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
- {"Group2/hard_zero/ext_one", H5L_TYPE_EXTERNAL},
- {"Group2/hard_zero/hard_one", H5L_TYPE_HARD},
- {"Group2/hard_zero/hard_two", H5L_TYPE_HARD},
- {"Group2/hard_zero/hard_zero", H5L_TYPE_HARD},
- {"Group2/hard_zero/soft_dangle", H5L_TYPE_SOFT},
- {"Group2/hard_zero/soft_one", H5L_TYPE_SOFT},
- {"Group2/hard_zero/soft_two", H5L_TYPE_SOFT},
- {"Type_one", H5L_TYPE_HARD},
- {"hard_one", H5L_TYPE_HARD}
-};
-static const link_visit_t lvisit2[] = {
- {"Dataset_two", H5L_TYPE_HARD},
- {"Type_two", H5L_TYPE_HARD},
- {"hard_zero", H5L_TYPE_HARD},
- {"hard_zero/Dataset_zero", H5L_TYPE_HARD},
- {"hard_zero/Group1", H5L_TYPE_HARD},
- {"hard_zero/Group1/Dataset_one", H5L_TYPE_HARD},
- {"hard_zero/Group1/Group2", H5L_TYPE_HARD},
- {"hard_zero/Group1/Type_one", H5L_TYPE_HARD},
- {"hard_zero/Group1/hard_one", H5L_TYPE_HARD},
- {"hard_zero/Type_zero", H5L_TYPE_HARD},
- {"hard_zero/ext_dangle", H5L_TYPE_EXTERNAL},
- {"hard_zero/ext_one", H5L_TYPE_EXTERNAL},
- {"hard_zero/hard_one", H5L_TYPE_HARD},
- {"hard_zero/hard_two", H5L_TYPE_HARD},
- {"hard_zero/hard_zero", H5L_TYPE_HARD},
- {"hard_zero/soft_dangle", H5L_TYPE_SOFT},
- {"hard_zero/soft_one", H5L_TYPE_SOFT},
- {"hard_zero/soft_two", H5L_TYPE_SOFT}
-};
-
-typedef struct {
- unsigned idx; /* Index in link visit structure */
- const link_visit_t *info; /* Pointer to the link visit structure to use */
-} lvisit_ud_t;
-
-
-/* Object visit structs */
+// Object visit structs
typedef struct {
const char *path; /* Path to object */
H5O_type_t type; /* Type of object */
} obj_visit_t;
-static const obj_visit_t ovisit0_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_zero", H5O_TYPE_DATASET},
- {"Group1", H5O_TYPE_GROUP},
- {"Group1/Dataset_one", H5O_TYPE_DATASET},
- {"Group1/Group2", H5O_TYPE_GROUP},
- {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit0_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_zero", H5O_TYPE_DATASET},
- {"Group1", H5O_TYPE_GROUP},
- {"Group1/Dataset_one", H5O_TYPE_DATASET},
- {"Group1/Group2", H5O_TYPE_GROUP},
- {"Group1/Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group1/Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit1_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_one", H5O_TYPE_DATASET},
- {"Group2", H5O_TYPE_GROUP},
- {"Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group2/hard_zero", H5O_TYPE_GROUP},
- {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
- {"Type_one", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit1_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_one", H5O_TYPE_DATASET},
- {"Group2", H5O_TYPE_GROUP},
- {"Group2/Dataset_two", H5O_TYPE_DATASET},
- {"Group2/Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"Group2/hard_zero", H5O_TYPE_GROUP},
- {"Group2/hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"Group2/hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE},
- {"Type_one", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit2_old[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_two", H5O_TYPE_DATASET},
- {"Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero", H5O_TYPE_GROUP},
- {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"hard_zero/Group1", H5O_TYPE_GROUP},
- {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
- {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
-static const obj_visit_t ovisit2_new[] = {
- {".", H5O_TYPE_GROUP},
- {"Dataset_two", H5O_TYPE_DATASET},
- {"Type_two", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero", H5O_TYPE_GROUP},
- {"hard_zero/Dataset_zero", H5O_TYPE_DATASET},
- {"hard_zero/Group1", H5O_TYPE_GROUP},
- {"hard_zero/Group1/Dataset_one", H5O_TYPE_DATASET},
- {"hard_zero/Group1/Type_one", H5O_TYPE_NAMED_DATATYPE},
- {"hard_zero/Type_zero", H5O_TYPE_NAMED_DATATYPE}
-};
+// User data for callback function
typedef struct {
unsigned idx; /* Index in object visit structure */
const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
-#endif
static const char *FILENAME[] = {
"link0",
"link1.h5",
"link2.h5",
+ "visit",
NULL
};
@@ -842,6 +581,140 @@ static void test_num_links(hid_t fapl_id, hbool_t new_format)
} // test_num_links
+// Data for visit on the file
+static const obj_visit_t file_visit[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Data", H5O_TYPE_GROUP},
+ {"Data/Compressed_Data", H5O_TYPE_DATASET},
+ {"Data/Float_Data", H5O_TYPE_DATASET},
+};
+
+// Data for visit on the group
+static const obj_visit_t group_visit[] = {
+ {".", H5O_TYPE_GROUP},
+ {"Compressed_Data", H5O_TYPE_DATASET},
+ {"Float_Data", H5O_TYPE_DATASET},
+};
+
+const H5std_string FILE_NAME("tvisit.h5");
+const H5std_string GROUP_NAME("/Data");
+const H5std_string DSET1_NAME("/Data/Compressed_Data");
+const H5std_string DSET2_NAME("/Data/Float_Data");
+const int RANK = 2;
+const int DIM1 = 2;
+
+// Operator function
+static int visit_obj_cb(H5Object& obj, const H5std_string name, const H5O_info_t *oinfo, void *_op_data)
+{
+ ovisit_ud_t *op_data = static_cast <ovisit_ud_t *>(_op_data);
+
+ // Check for correct object information
+ if(strcmp(op_data->info[op_data->idx].path, name.c_str())) return(H5_ITER_ERROR);
+ if(op_data->info[op_data->idx].type != oinfo->type) return(H5_ITER_ERROR);
+
+ // Advance to next location
+ op_data->idx++;
+
+ return(H5_ITER_CONT);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: test_visit
+ *
+ * Purpose Test H5Object::visit
+ *
+ * Return None
+ *
+ * February 8, 2019
+ *-------------------------------------------------------------------------
+ */
+static void test_visit(hid_t fapl_id, hbool_t new_format)
+{
+ hsize_t dims[2];
+ hsize_t cdims[2];
+ char filename[NAME_BUF_SIZE];
+
+ if(new_format)
+ SUBTEST("H5Object::visit (w/new group format)")
+ else
+ SUBTEST("H5Object::visit")
+
+ try
+ {
+ // Use the file access template id to create a file access prop. list
+ FileAccPropList fapl(fapl_id);
+
+ // Build the hdf5 file name and create the file
+ h5_fixname(FILENAME[3], fapl_id, filename, sizeof filename);
+ H5File *file = new H5File(filename, H5F_ACC_TRUNC, FileCreatPropList::DEFAULT, fapl);
+
+ // Create a group
+ Group* group = new Group(file->createGroup(GROUP_NAME));
+
+ // Create a chunked/compressed dataset within this group specified by path
+ dims[0] = 20;
+ dims[1] = 2;
+ cdims[0] = 2;
+ cdims[1] = 2;
+ DataSpace *dataspace = new DataSpace(RANK, dims); // create new dspace
+ DSetCreatPropList ds_creatplist; // create dataset creation prop list
+ ds_creatplist.setChunk(2, cdims); // then modify it for compression
+ ds_creatplist.setDeflate(6);
+
+ DataSet* dataset = new DataSet(file->createDataSet(DSET1_NAME,
+ PredType::NATIVE_INT, *dataspace, ds_creatplist));
+
+ delete dataset;
+ delete dataspace;
+
+ // Create another dataset
+ dims[0] = 5;
+ dims[1] = 2;
+ dataspace = new DataSpace(RANK, dims); // create second dspace
+ dataset = new DataSet(file->createDataSet(DSET2_NAME,
+ PredType::NATIVE_FLOAT, *dataspace));
+
+ // Close everything
+ delete dataset;
+ delete dataspace;
+ delete group;
+ delete file;
+
+ // Reopen the file and group in the file.
+ file = new H5File(filename, H5F_ACC_RDWR);
+ group = new Group(file->openGroup("Data"));
+
+ // Open the group
+ dataset = new DataSet(group->openDataSet(DSET2_NAME));
+ delete dataset;
+
+ // Visit objects in the file
+ ovisit_ud_t udata; /* User-data for visiting */
+ udata.idx = 0;
+ udata.info = file_visit;
+
+ file->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
+
+ // Visit objects in the group
+ udata.idx = 0;
+ udata.info = group_visit;
+
+ group->visit(H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, &udata, H5O_INFO_BASIC);
+
+ // Close the group and file.
+ delete group;
+ delete file;
+
+ PASSED();
+ } // end of try block
+ catch (Exception& E)
+ {
+ cerr << "in catch" << endl;
+ issue_fail_msg("test_visit()", __LINE__, __FILE__, E.getCDetailMsg());
+ }
+} // test_visit()
+
+
/*-------------------------------------------------------------------------
* Function: test_links
*
@@ -857,13 +730,9 @@ void test_links()
{
hid_t fapl_id, fapl2_id; /* File access property lists */
unsigned new_format; /* Whether to use the new format or not */
- const char *envval;
- envval = HDgetenv("HDF5_DRIVER");
- if(envval == NULL)
- envval = "nomatch";
-
- fapl_id = h5_fileaccess();
+ if((fapl_id = h5_fileaccess()) < 0)
+ throw Exception("test_links", "Unable to get file access property list");
// Output message about test being performed
MESSAGE(5, ("Testing Various Links\n"));
@@ -896,24 +765,18 @@ void test_links()
test_move(my_fapl_id, new_format);
test_copy(my_fapl_id, new_format);
test_lcpl(my_fapl_id, new_format);
+ test_visit(my_fapl_id, new_format);
} /* end for */
/* Close 2nd FAPL */
H5Pclose(fapl2_id);
h5_clean_files(FILENAME, fapl_id);
-
- /* Test that external links can be used after a library reset. MUST be
- * called last so the reset doesn't interfere with the property lists. This
- * routine will delete its own file. */
- /* nerrors += external_reset_register() < 0 ? 1 : 0;
- */
}
catch (Exception& E)
{
issue_fail_msg("test_links()", __LINE__, __FILE__, E.getCDetailMsg());
}
-
}
@@ -931,7 +794,3 @@ void cleanup_links()
HDremove(FILENAME[0]);
HDremove(FILENAME[1]);
}
-
-
-
-
diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake
index 33e6d4c..2333f67 100644
--- a/config/cmake/CTestCustom.cmake
+++ b/config/cmake/CTestCustom.cmake
@@ -41,16 +41,20 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
H5TEST-err_compat #uses runTest.cmake
H5TEST-links_env #uses runTest.cmake
H5TEST-testlibinfo #uses grepTest.cmake
- H5TEST-clear-testhdf5-objects
+ #########
H5TEST-clear-objects
H5TEST-clear-cache-objects
H5TEST-clear-cache_api-objects
H5TEST-clear-cache_image-objects
H5TEST-clear-cache_tagging-objects
+ H5TEST-clear-del_many_dense_attrs-objects
H5TEST-clear-err_compat-objects
H5TEST-clear-error_test-objects
H5TEST-clear-filenotclosed-objects
+ H5TEST-clear-flush-objects
H5TEST-clear-links_env-objects
+ H5TEST-clear-testflushrefresh-objects
+ H5TEST-clear-testhdf5-objects
H5TEST-clear-ttsafe-objects
PERFORM_h5perform-clear-objects
HL_TOOLS-clear-objects
@@ -60,11 +64,19 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
CPP_testhdf5-clear-objects
######### tools/h5clear #########
H5CLEAR-clearall-objects
+ H5CLEAR-copy_h5clear_fsm_persist_equal.h5
+ H5CLEAR-copy_h5clear_fsm_persist_greater.h5
+ H5CLEAR-copy_h5clear_fsm_persist_less.h5
+ H5CLEAR-copy_h5clear_fsm_persist_noclose.h5
+ H5CLEAR-copy_h5clear_fsm_persist_user_equal.h5
+ H5CLEAR-copy_h5clear_fsm_persist_user_greater.h5
+ H5CLEAR-copy_h5clear_fsm_persist_user_less.h5
H5CLEAR-copy_h5clear_log_v3.h5
H5CLEAR-copy_h5clear_mdc_image.h5
H5CLEAR-copy_h5clear_sec2_v0.h5
H5CLEAR-copy_h5clear_sec2_v2.h5
H5CLEAR-copy_h5clear_sec2_v3.h5
+ H5CLEAR-copy_h5clear_status_noclear.h5
H5CLEAR-copy_latest_h5clear_log_v3.h5
H5CLEAR-copy_latest_h5clear_sec2_v3.h5
H5CLEAR-copy_mod_h5clear_mdc_image.h5
@@ -307,6 +319,11 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE
H5REPACK_VERIFY_LAYOUT_ALL-layout_short_switches #uses grepTest.cmake
H5REPACK-plugin
H5REPACK_CMP-plugin_zero
+ #########
+ ADD_H5_VERIFY_INVALIDBOUNDS-h5repack-latest_latest_invalid-clear-objects
+ H5REPACK_VERIFY_SUPERBLOCK-SB_IS_0-clear-objects
+ H5REPACK_VERIFY_SUPERBLOCK-SB_IS_2-clear-objects
+ H5REPACK_VERIFY_SUPERBLOCK-SB_IS_3-clear-objects
######### tools/h5stat #########
H5STAT-clearall-objects
######### tools/misc #########
diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake
index 6d1e3ce..c1abeed 100644
--- a/config/cmake/ConfigureChecks.cmake
+++ b/config/cmake/ConfigureChecks.cmake
@@ -28,15 +28,6 @@ if (HDF5_STRICT_FORMAT_CHECKS)
endif ()
MARK_AS_ADVANCED (HDF5_STRICT_FORMAT_CHECKS)
-#-----------------------------------------------------------------------------
-# Option for --enable-metadata-trace-file
-#-----------------------------------------------------------------------------
-option (HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF)
-if (HDF5_METADATA_TRACE_FILE)
- set (${HDF_PREFIX}_METADATA_TRACE_FILE 1)
-endif ()
-MARK_AS_ADVANCED (HDF5_METADATA_TRACE_FILE)
-
# ----------------------------------------------------------------------
# Decide whether the data accuracy has higher priority during data
# conversions. If not, some hard conversions will still be prefered even
@@ -256,6 +247,11 @@ H5ConversionTests (${HDF_PREFIX}_LDOUBLE_TO_LLONG_ACCURATE "Checking IF correctl
#
H5ConversionTests (${HDF_PREFIX}_LLONG_TO_LDOUBLE_CORRECT "Checking IF correctly converting (unsigned) long long to long double values")
# ----------------------------------------------------------------------
+# Set the flag to indicate that the machine can accurately convert
+# some long double values
+#
+H5ConversionTests (${HDF_PREFIX}_DISABLE_SOME_LDOUBLE_CONV "Checking IF the cpu is power9 and cannot correctly converting long double values")
+# ----------------------------------------------------------------------
# Check if pointer alignments are enforced
#
H5ConversionTests (${HDF_PREFIX}_NO_ALIGNMENT_RESTRICTIONS "Checking IF alignment restrictions are strictly enforced")
diff --git a/config/cmake/ConversionTests.c b/config/cmake/ConversionTests.c
index 321d879..6d597a0 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")))
@@ -287,3 +287,27 @@ main ()
#endif
+#ifdef H5_DISABLE_SOME_LDOUBLE_CONV_TEST
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int HDF_NO_UBSAN main(void)
+{
+ FILE *fp;
+ char cpu[64];
+
+ fp = popen("uname -m", "r");
+
+ fgets(cpu, sizeof(cpu)-1, fp);
+
+ pclose(fp);
+
+ if(strncmp(cpu, "ppc64le", 7) == 0)
+ return 0;
+
+ return 1;
+}
+
+#endif
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index 1d73bba..05b0fff 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -267,6 +267,9 @@
/* Define if we have parallel support */
#cmakedefine H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@
+/* Define if both pread and pwrite exist. */
+#cmakedefine H5_HAVE_PREADWRITE @H5_HAVE_PREADWRITE@
+
/* Define to 1 if you have the <pthread.h> header file. */
#cmakedefine H5_HAVE_PTHREAD_H @H5_HAVE_PTHREAD_H@
@@ -460,15 +463,15 @@
with special algorithm. */
#cmakedefine H5_LONG_TO_LDOUBLE_SPECIAL @H5_LONG_TO_LDOUBLE_SPECIAL@
+/* Define if your system is power6 and cannot convert some long double values. */
+#cmakedefine H5_DISABLE_SOME_LDOUBLE_CONV @H5_DISABLE_SOME_LDOUBLE_CONV@
+
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#cmakedefine H5_LT_OBJDIR @H5_LT_OBJDIR@
/* Define to enable internal memory allocation sanity checking. */
/* #cmakedefine H5_MEMORY_ALLOC_SANITY_CHECK @H5_MEMORY_ALLOC_SANITY_CHECK@ ** Define in CMakeLists.txt */
-/* Define if the metadata trace file code is to be compiled in */
-#cmakedefine H5_METADATA_TRACE_FILE @H5_METADATA_TRACE_FILE@
-
/* Define if we can violate pointer alignment restrictions */
#cmakedefine H5_NO_ALIGNMENT_RESTRICTIONS @H5_NO_ALIGNMENT_RESTRICTIONS@
@@ -602,6 +605,9 @@
/* The size of `short', as computed by sizeof. */
#cmakedefine H5_SIZEOF_SHORT @H5_SIZEOF_SHORT@
+/* The size of `time_t', as computed by sizeof. */
+#cmakedefine H5_SIZEOF_TIME_T @H5_SIZEOF_TIME_T@
+
/* The size of `uint16_t', as computed by sizeof. */
#cmakedefine H5_SIZEOF_UINT16_T @H5_SIZEOF_UINT16_T@
diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in
deleted file mode 100644
index ba79ef2..0000000
--- a/config/cmake/HDF518_Examples.cmake.in
+++ /dev/null
@@ -1,106 +0,0 @@
-#
-# 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.
-#
-cmake_minimum_required (VERSION 3.10)
-###############################################################################################################
-# This script will build and run the examples from a folder
-# Execute from a command line:
-# ctest -S HDF518_Examples.cmake,OPTION=VALUE -C Release -VV -O test.log
-###############################################################################################################
-
-set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
-if("@CMAKE_GENERATOR_TOOLSET@")
- set(CMAKE_GENERATOR_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
-endif()
-set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY})
-
-# handle input parameters to script.
-#INSTALLDIR - HDF5-1.8 root folder
-#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
-#CTEST_SOURCE_NAME - name of source folder; HDF5Examples
-if(DEFINED CTEST_SCRIPT_ARG)
- # transform ctest script arguments of the form
- # script.ctest,var1=value1,var2=value2
- # to variables with the respective names set to the respective values
- string(REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
- foreach(current_var ${script_args})
- if("${current_var}" MATCHES "^([^=]+)=(.+)$")
- set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
- endif()
- endforeach()
-endif()
-
-###################################################################
-### Following Line is one of [Release, RelWithDebInfo, Debug] #####
-set(CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
-if(NOT DEFINED CTEST_CONFIGURATION_TYPE)
- set(CTEST_CONFIGURATION_TYPE "Release")
-endif()
-set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${CTEST_CONFIGURATION_TYPE}")
-##################################################################
-
-if(NOT DEFINED INSTALLDIR)
- set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@")
-endif()
-
-if(NOT DEFINED CTEST_SOURCE_NAME)
- set(CTEST_SOURCE_NAME "HDF5Examples")
-endif()
-
-if(NOT DEFINED HDF_LOCAL)
- set(CDASH_LOCAL "NO")
-else()
- set(CDASH_LOCAL "YES")
-endif()
-if(NOT DEFINED CTEST_SITE)
- set(CTEST_SITE "local")
-endif()
-if(NOT DEFINED CTEST_BUILD_NAME)
- set(CTEST_BUILD_NAME "examples")
-endif()
-set(BUILD_OPTIONS "${BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
-
-#TAR_SOURCE - name of tarfile
-#if(NOT DEFINED TAR_SOURCE)
-# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.2.1-Source")
-#endif()
-
-###############################################################################################################
-if(WIN32)
- set(SITE_OS_NAME "Windows")
- set(ENV{HDF5_DIR} "${INSTALLDIR}/cmake")
- set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}\\build)
- set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
- set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
-else()
- set(ENV{HDF5_DIR} "${INSTALLDIR}/share/cmake")
- set(ENV{LD_LIBRARY_PATH} "${INSTALLDIR}/lib")
- set(CTEST_BINARY_NAME ${CTEST_SOURCE_NAME}/build)
- set(CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
- set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
-endif()
-if(${CDASH_LOCAL})
- set(BUILD_OPTIONS "${BUILD_OPTIONS} -DCDASH_LOCAL:BOOL=ON")
-endif()
-set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@")
-
-###############################################################################################################
-# For any comments please contact cdashhelp@hdfgroup.org
-#
-###############################################################################################################
-
-if(WIN32)
- include(${CTEST_SCRIPT_DIRECTORY}\\HDF5_Examples_options.cmake)
- include(${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
-else()
- include(${CTEST_SCRIPT_DIRECTORY}/HDF5_Examples_options.cmake)
- include(${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
-endif()
diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake
index 6c203e2..007bc29 100644
--- a/config/cmake/HDF5Macros.cmake
+++ b/config/cmake/HDF5Macros.cmake
@@ -15,6 +15,8 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage)
# SOVERSION passed in ARGN when shared
if (${libtype} MATCHES "SHARED")
set (PACKAGE_SOVERSION ${HDF5_${libpackage}_PACKAGE_SOVERSION})
+ set (PACKAGE_COMPATIBILITY ${H5_${libpackage}_SOVERS_INTERFACE}.0.0)
+ set (PACKAGE_CURRENT ${H5_${libpackage}_SOVERS_INTERFACE}.${H5_${libpackage}_SOVERS_MINOR}.0)
if (WIN32)
set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR})
else ()
@@ -26,6 +28,11 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage)
else ()
set_target_properties (${libtarget} PROPERTIES SOVERSION ${LIBHDF_VERSION})
endif ()
+ if (CMAKE_C_OSX_CURRENT_VERSION_FLAG)
+ set_property(TARGET ${libtarget} APPEND PROPERTY
+ LINK_FLAGS "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}${PACKAGE_CURRENT} ${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}${PACKAGE_COMPATIBILITY}"
+ )
+ endif ()
endif ()
HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype})
@@ -33,9 +40,6 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype libpackage)
if (APPLE)
option (HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF)
if (HDF5_BUILD_WITH_INSTALL_NAME)
- set_property(TARGET ${libtarget} APPEND PROPERTY
- LINK_FLAGS "-current_version ${HDF5_PACKAGE_VERSION} -compatibility_version ${HDF5_PACKAGE_VERSION}"
- )
set_target_properties (${libtarget} PROPERTIES
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib"
BUILD_WITH_INSTALL_RPATH ${HDF5_BUILD_WITH_INSTALL_NAME}
diff --git a/config/cmake/HDF5UseFortran.cmake b/config/cmake/HDF5UseFortran.cmake
index 157befd..03597f2 100644
--- a/config/cmake/HDF5UseFortran.cmake
+++ b/config/cmake/HDF5UseFortran.cmake
@@ -18,16 +18,6 @@ ENABLE_LANGUAGE (Fortran)
set (HDF_PREFIX "H5")
include (CheckFortranFunctionExists)
-## Check for non-standard extenstion quadmath.h
-
-CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH)
-
-if (${C_HAVE_QUADMATH})
- set(${HDF_PREFIX}_HAVE_QUADMATH_H 1)
-else ()
- set(${HDF_PREFIX}_HAVE_QUADMATH_H 0)
-endif ()
-
# The provided CMake Fortran macros don't provide a general compile/run function
# so this one is used.
#-----------------------------------------------------------------------------
@@ -40,7 +30,7 @@ macro (FORTRAN_RUN FUNCTION_NAME SOURCE_CODE RUN_RESULT_VAR1 COMPILE_RESULT_VAR1
TRY_RUN (RUN_RESULT_VAR COMPILE_RESULT_VAR
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler1.f90
- LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}"
+ LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}"
)
if (${COMPILE_RESULT_VAR})
@@ -67,8 +57,8 @@ endmacro ()
# Read source line beginning at the line matching Input:"START" and ending at the line matching Input:"END"
macro (READ_SOURCE SOURCE_START SOURCE_END RETURN_VAR)
- file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_CODE)
- string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_CODE})
+ file (READ "${HDF5_SOURCE_DIR}/m4/aclocal_fc.f90" SOURCE_MASTER)
+ string (REGEX MATCH "${SOURCE_START}[\\\t\\\n\\\r[].+]*${SOURCE_END}" SOURCE_CODE ${SOURCE_MASTER})
set (RETURN_VAR "${SOURCE_CODE}")
endmacro ()
@@ -244,7 +234,7 @@ foreach (KIND ${VAR} )
set (pack_real_sizeof "${pack_real_sizeof} ${PROG_OUTPUT1},")
endforeach ()
-if (pack_int_sizeof STREQUAL "")
+if (pack_real_sizeof STREQUAL "")
message (FATAL_ERROR "Failed to find available REAL KINDs for Fortran")
endif ()
@@ -367,9 +357,9 @@ ENABLE_LANGUAGE (C)
#-----------------------------------------------------------------------------
macro (C_RUN FUNCTION_NAME SOURCE_CODE RETURN_VAR)
message (STATUS "Detecting C ${FUNCTION_NAME}")
- if (CMAKE_REQUIRED_LIBRARIES)
+ if (HDF5_REQUIRED_LIBRARIES)
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}")
else ()
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
endif ()
diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in
index d30f2ab..6951b09 100644
--- a/config/cmake/HDF5_Examples.cmake.in
+++ b/config/cmake/HDF5_Examples.cmake.in
@@ -48,7 +48,11 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCTEST_CONFIGURATION_TYPE:STRING=${
##################################################################
if(NOT DEFINED INSTALLDIR)
- set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@")
+ if(WIN32)
+ set(INSTALLDIR "C:/Program Files/HDF_Group/@HDF5_PACKAGE_NAME@/@HDF5_PACKAGE_VERSION@")
+ else()
+ set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@")
+ endif()
endif()
if(NOT DEFINED CTEST_SOURCE_NAME)
@@ -70,7 +74,7 @@ set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDN
#TAR_SOURCE - name of tarfile
#if(NOT DEFINED TAR_SOURCE)
-# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.10-Source")
+# set(CTEST_USE_TAR_SOURCE "HDF5Examples-1.10.13-Source")
#endif()
###############################################################################################################
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 93ebc3c..0a39568 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -9,16 +9,16 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED TRUE)
message (STATUS "Warnings Configuration:")
+set (CMAKE_C_FLAGS "${CMAKE_C99_STANDARD_COMPILE_OPTION} ${CMAKE_C_FLAGS}")
#-----------------------------------------------------------------------------
# Compiler specific flags : Shouldn't there be compiler tests for these
#-----------------------------------------------------------------------------
if (CMAKE_COMPILER_IS_GNUCC)
set (CMAKE_C_FLAGS "${CMAKE_ANSI_CFLAGS} ${CMAKE_C_FLAGS}")
- if (NOT CYGWIN)
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
- endif ()
if (${HDF_CFG_NAME} MATCHES "Debug")
if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Og -ftrapv -fno-common")
diff --git a/config/cmake/UserMacros/Windows_MT.cmake b/config/cmake/UserMacros/Windows_MT.cmake
index b6cc513..78d8277 100644
--- a/config/cmake/UserMacros/Windows_MT.cmake
+++ b/config/cmake/UserMacros/Windows_MT.cmake
@@ -14,7 +14,8 @@
########################################################
# To use this option, copy both the macro and option code
-# into the root UserMacros.cmake file.
+# into the root UserMacros.cmake file. Then enable the option,
+# using the command line add "-DBUILD_STATIC_CRT_LIBS:BOOL=ON"
# OR add an include to the root UserMacros.cmake file:
# INCLUDE(path_to_file/WINDOWS_MT.cmake)
diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in
index e687a58..3bd9e1d 100644
--- a/config/cmake/hdf5-config.cmake.in
+++ b/config/cmake/hdf5-config.cmake.in
@@ -38,6 +38,7 @@ set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@)
set (${HDF5_PACKAGE_NAME}_BUILD_JAVA @HDF5_BUILD_JAVA@)
set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@)
set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@)
+set (${HDF5_PACKAGE_NAME}_ENABLE_THREADSAFE @HDF5_ENABLE_THREADSAFE@)
set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@)
set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_SUPPORT @HDF5_ENABLE_SZIP_SUPPORT@)
set (${HDF5_PACKAGE_NAME}_ENABLE_SZIP_ENCODING @HDF5_ENABLE_SZIP_ENCODING@)
@@ -45,6 +46,8 @@ set (${HDF5_PACKAGE_NAME}_BUILD_SHARED_LIBS @BUILD_SHARED_LIBS@)
set (${HDF5_PACKAGE_NAME}_PACKAGE_EXTLIBS @HDF5_PACKAGE_EXTLIBS@)
set (${HDF5_PACKAGE_NAME}_EXPORT_LIBRARIES @HDF5_LIBRARIES_TO_EXPORT@)
set (${HDF5_PACKAGE_NAME}_TOOLSET "@CMAKE_GENERATOR_TOOLSET@")
+set (${HDF5_PACKAGE_NAME}_DEFAULT_API_VERSION "@DEFAULT_API_VERSION@")
+set (${HDF5_PACKAGE_NAME}_PARALLEL_FILTERED_WRITES "@PARALLEL_FILTERED_WRITES@")
#-----------------------------------------------------------------------------
# Dependencies
diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake
index b66f3a8..23f297c 100644
--- a/config/cmake/jrunTest.cmake
+++ b/config/cmake/jrunTest.cmake
@@ -32,9 +32,6 @@ endif ()
if (NOT TEST_CLASSPATH)
message (STATUS "Require TEST_CLASSPATH to be defined")
endif ()
-if (NOT TEST_REFERENCE)
- message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
-endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
@@ -44,14 +41,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
-# if there is not an error reference file add the error output to the stdout file
-if (NOT TEST_ERRREF)
- if (NOT SKIP_APPEND)
- # append error file since skip was not defined
- set (ERROR_APPEND 1)
- endif ()
-endif ()
-
if (NOT TEST_LOG_LEVEL)
set (LOG_LEVEL "info")
else ()
@@ -88,10 +77,10 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
if (NOT ERROR_APPEND)
- # append error output to the stdout output file
+ # write back to original .err file
file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
else ()
- # write back to original .err file
+ # append error output to the stdout output file
file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
endif ()
endif ()
@@ -121,8 +110,8 @@ if (TEST_MASK_ERROR)
endif ()
endif ()
-# if the return value is !=0 bail out
-if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}")
+# if the return value is !=expected bail out
+if (NOT TEST_RESULT EQUAL TEST_EXPECT)
message (STATUS "ERROR OUTPUT: ${TEST_STREAM}")
message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}")
endif ()
@@ -131,52 +120,54 @@ message (STATUS "COMMAND Error: ${TEST_ERROR}")
# compare output files to references unless this must be skipped
if (NOT TEST_SKIP_COMPARE)
- if (WIN32 AND NOT MINGW)
- file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
- file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
- endif ()
+ if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE})
+ if (WIN32 AND NOT MINGW)
+ file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+ file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+ endif ()
- # now compare the output with the reference
- execute_process (
- COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
- RESULT_VARIABLE TEST_RESULT
- )
- if (NOT "${TEST_RESULT}" STREQUAL "0")
- set (TEST_RESULT 0)
- file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
- list (LENGTH test_act len_act)
- file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
- list (LENGTH test_ref len_ref)
- if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
- math (EXPR _FP_LEN "${len_ref} - 1")
- foreach (line RANGE 0 ${_FP_LEN})
- list (GET test_act ${line} str_act)
- list (GET test_ref ${line} str_ref)
- if (NOT "${str_act}" STREQUAL "${str_ref}")
- if (NOT "${str_act}" STREQUAL "")
- set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ # now compare the output with the reference
+ execute_process (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+ )
+ if (TEST_RESULT)
+ set (TEST_RESULT 0)
+ file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
+ list (LENGTH test_act len_act)
+ file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
+ list (LENGTH test_ref len_ref)
+ if (len_act GREATER 0 AND len_ref GREATER 0)
+ math (EXPR _FP_LEN "${len_ref} - 1")
+ foreach (line RANGE 0 ${_FP_LEN})
+ list (GET test_act ${line} str_act)
+ list (GET test_ref ${line} str_ref)
+ if (NOT ${str_act} STREQUAL ${str_ref})
+ if (NOT str_act STREQUAL "")
+ set (TEST_RESULT 1)
+ message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ endif ()
endif ()
+ endforeach ()
+ else ()
+ if (len_act EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
+ endif ()
+ if (len_ref EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
endif ()
- endforeach ()
- else ()
- if ("${len_act}" STREQUAL "0")
- message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
- if ("${len_ref}" STREQUAL "0")
- message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
+ if (NOT len_act EQUAL len_ref)
+ set (TEST_RESULT 1)
endif ()
endif ()
- if (NOT "${len_act}" STREQUAL "${len_ref}")
- set (TEST_RESULT 1)
- endif ()
- endif ()
- message (STATUS "COMPARE Result: ${TEST_RESULT}")
+ message (STATUS "COMPARE Result: ${TEST_RESULT}")
- # again, if return value is !=0 scream and shout
- if (NOT "${TEST_RESULT}" STREQUAL "0")
- message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+ # again, if return value is !=0 scream and shout
+ if (TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+ endif ()
endif ()
# now compare the .err file with the error reference, if supplied
@@ -191,34 +182,34 @@ if (NOT TEST_SKIP_COMPARE)
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
RESULT_VARIABLE TEST_RESULT
)
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ if (TEST_RESULT)
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
list (LENGTH test_ref len_ref)
math (EXPR _FP_LEN "${len_ref} - 1")
- if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
+ if (len_act GREATER 0 AND len_ref GREATER 0)
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
- if (NOT "${str_act}" STREQUAL "${str_ref}")
- if (NOT "${str_act}" STREQUAL "")
+ if (NOT ${str_act} STREQUAL ${str_ref})
+ if (NOT ${str_act} STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
endif ()
endif ()
endforeach ()
else ()
- if ("${len_act}" STREQUAL "0")
+ if (len_act EQUAL 0)
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty")
endif ()
- if ("${len_ref}" STREQUAL "0")
+ if (len_ref EQUAL 0)
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty")
endif ()
- endif()
- if (NOT "${len_act}" STREQUAL "${len_ref}")
+ endif ()
+ if (NOT len_act EQUAL len_ref)
set (TEST_RESULT 1)
endif ()
endif ()
@@ -226,7 +217,7 @@ if (NOT TEST_SKIP_COMPARE)
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
- if (NOT ${TEST_RESULT} STREQUAL 0)
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}")
endif ()
endif ()
@@ -239,15 +230,15 @@ if (TEST_GREP_COMPARE)
# TEST_REFERENCE should always be matched
string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
- if ("${TEST_RESULT}" STREQUAL "0")
+ if (NOT TEST_RESULT)
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
endif ()
string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
- if ("${TEST_EXPECT}" STREQUAL "1")
+ if (TEST_EXPECT)
# TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
string (LENGTH "${TEST_MATCH}" TEST_RESULT)
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
endif ()
endif ()
diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in
index 6a489e7..9a534df 100644
--- a/config/cmake/libhdf5.settings.cmake.in
+++ b/config/cmake/libhdf5.settings.cmake.in
@@ -79,7 +79,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
API Tracing: @HDF5_ENABLE_TRACE@
Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@
Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@
- Metadata trace file: @METADATATRACEFILE@
Function Stack Tracing: @HDF5_ENABLE_CODESTACK@
Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@
Optimization Instrumentation: @HDF5_Enable_Instrument@
diff --git a/config/cmake/patch.xml b/config/cmake/patch.xml
index 70571c5..1bdff3e 100644
--- a/config/cmake/patch.xml
+++ b/config/cmake/patch.xml
@@ -1,5 +1,5 @@
<CPackWiXPatch>
- <CPackWiXFragment Id="CM_CP_libraries.bin.hdf5.dll">
+ <CPackWiXFragment Id="CM_CP_libraries.bin.hdf5.dll">
<Environment Id="PATH"
Name="PATH"
Value="[CM_DP_libraries.bin]"
@@ -7,5 +7,5 @@
Part="last"
Action="set"
System="yes"/>
- </CPackWiXFragment>
+ </CPackWiXFragment>
</CPackWiXPatch>
diff --git a/config/cmake/scripts/CTestScript.cmake b/config/cmake/scripts/CTestScript.cmake
index 670196b..e234057 100755
--- a/config/cmake/scripts/CTestScript.cmake
+++ b/config/cmake/scripts/CTestScript.cmake
@@ -9,294 +9,340 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-cmake_minimum_required (VERSION 3.10)
-########################################################
-# This dashboard is maintained by The HDF Group
-# For any comments please contact cdashhelp@hdfgroup.org
-#
-########################################################
-# -----------------------------------------------------------
-# -- Get environment
-# -----------------------------------------------------------
-if (NOT SITE_OS_NAME)
- ## machine name not provided - attempt to discover with uname
- ## -- set hostname
- ## --------------------------
- find_program (HOSTNAME_CMD NAMES hostname)
- exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
- set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}")
- find_program (UNAME NAMES uname)
- macro (getuname name flag)
- exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
- endmacro ()
-
- getuname (osname -s)
- getuname (osrel -r)
- getuname (cpu -m)
- message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n")
-
- set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}")
- if (SITE_BUILDNAME_SUFFIX)
- set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}")
- endif ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS}")
-else ()
- ## machine name provided
- ## --------------------------
- if (CMAKE_HOST_UNIX)
- set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}")
- else ()
- set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
- endif ()
- if (SITE_BUILDNAME_SUFFIX)
- set (CTEST_BUILD_NAME "${CTEST_BUILD_NAME}-${SITE_BUILDNAME_SUFFIX}")
- endif ()
- set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
-endif ()
-
-#-----------------------------------------------------------------------------
-# MAC machines need special option
-#-----------------------------------------------------------------------------
-if (APPLE)
- # Compiler choice
- execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
- set (ENV{CC} "${XCODE_CC}")
- set (ENV{CXX} "${XCODE_CXX}")
-
- set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
-endif ()
-
-#-----------------------------------------------------------------------------
-set (NEED_REPOSITORY_CHECKOUT 0)
-set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
-if (CTEST_USE_TAR_SOURCE)
- ## Uncompress source if tar file provided
- ## --------------------------
- if (WIN32)
- message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]")
- execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
- else ()
- message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]")
- execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
- endif ()
-
- if (NOT rv EQUAL 0)
- message (STATUS "extracting... [error-(${rv}) clean up]")
- file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
- message (FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed")
- endif ()
-
- file (RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY})
- set (LOCAL_SKIP_UPDATE "TRUE")
-else ()
- if (LOCAL_UPDATE)
- if (CTEST_USE_GIT_SOURCE)
- find_program (CTEST_GIT_COMMAND NAMES git git.cmd)
- set (CTEST_GIT_UPDATE_OPTIONS)
-
- if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
- set (NEED_REPOSITORY_CHECKOUT 1)
- endif ()
-
- if (${NEED_REPOSITORY_CHECKOUT})
- if (REPOSITORY_BRANCH)
- set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules")
- else ()
- set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules")
- endif ()
- set (CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}")
- else ()
- set (CTEST_GIT_options "pull")
- endif ()
- set (CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
- else ()
- ## --------------------------
- ## use subversion to get source
- #-----------------------------------------------------------------------------
- ## cygwin does not handle the find_package() call
- ## --------------------------
- set (CTEST_UPDATE_COMMAND "SVNCommand")
- if (NOT SITE_CYGWIN})
- find_package (Subversion)
- set (CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}")
- set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}")
- else ()
- set (CTEST_SVN_COMMAND "/usr/bin/svn")
- set (CTEST_UPDATE_COMMAND "/usr/bin/svn")
- endif ()
-
- if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
- set (NEED_REPOSITORY_CHECKOUT 1)
- endif ()
-
- if (NOT CTEST_REPO_VERSION)
- set (CTEST_REPO_VERSION "HEAD")
- endif ()
- if (${NEED_REPOSITORY_CHECKOUT})
- set (CTEST_CHECKOUT_COMMAND
- "\"${CTEST_SVN_COMMAND}\" co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r ${CTEST_REPO_VERSION}")
- else ()
- if (CTEST_REPO_VERSION)
- set (CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}")
- endif ()
- endif ()
- endif ()
- endif ()
-endif ()
-
-#-----------------------------------------------------------------------------
-## Clear the build directory
-## --------------------------
-set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
-if (NOT EXISTS "${CTEST_BINARY_DIRECTORY}")
- file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
-else ()
- ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
-endif ()
-
-# Use multiple CPU cores to build
-include (ProcessorCount)
-ProcessorCount (N)
-if (NOT N EQUAL 0)
- if (NOT WIN32)
- set (CTEST_BUILD_FLAGS -j${N})
- endif ()
- set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
-endif ()
-
-#-----------------------------------------------------------------------------
-# Send the main script as a note.
-list (APPEND CTEST_NOTES_FILES
- "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
- "${CMAKE_CURRENT_LIST_FILE}"
- "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
-)
-
-#-----------------------------------------------------------------------------
-# Check for required variables.
-# --------------------------
-foreach (req
- CTEST_CMAKE_GENERATOR
- CTEST_SITE
- CTEST_BUILD_NAME
- )
- if (NOT DEFINED ${req})
- message (FATAL_ERROR "The containing script must set ${req}")
- endif ()
-endforeach ()
-
-#-----------------------------------------------------------------------------
-# Initialize the CTEST commands
-#------------------------------
-if(CMAKE_GENERATOR_TOOLSET)
- set(CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
-else ()
- set(CTEST_CONFIGURE_TOOLSET "")
-endif()
-if (LOCAL_MEMCHECK_TEST)
- find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
- set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
- )
-else ()
- if (LOCAL_COVERAGE_TEST)
- find_program (CTEST_COVERAGE_COMMAND NAMES gcov)
- endif ()
- set (CTEST_CONFIGURE_COMMAND
- "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
- )
-endif ()
-
-#-----------------------------------------------------------------------------
-## -- set output to english
-set ($ENV{LC_MESSAGES} "en_EN")
-
-# Print summary information.
-foreach (v
- CTEST_SITE
- CTEST_BUILD_NAME
- CTEST_SOURCE_DIRECTORY
- CTEST_BINARY_DIRECTORY
- CTEST_CMAKE_GENERATOR
- CTEST_CONFIGURATION_TYPE
- CTEST_GIT_COMMAND
- CTEST_CHECKOUT_COMMAND
- CTEST_CONFIGURE_COMMAND
- CTEST_SCRIPT_DIRECTORY
- CTEST_USE_LAUNCHERS
- )
- set (vars "${vars} ${v}=[${${v}}]\n")
-endforeach ()
-message (STATUS "Dashboard script configuration:\n${vars}\n")
-
-#-----------------------------------------------------------------------------
-#-----------------------------------------------------------------------------
- ## NORMAL process
- ## -- LOCAL_UPDATE updates the source folder from svn
- ## -- LOCAL_SUBMIT reports to CDash server
- ## -- LOCAL_SKIP_TEST skips the test process (only builds)
- ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing
- ## -- LOCAL_COVERAGE_TEST executes code coverage process
- ## --------------------------
- ctest_start (${MODEL} TRACK ${MODEL})
- if (LOCAL_UPDATE)
- ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}")
- endif ()
- configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
- ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}")
- ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Update Configure Notes)
- endif ()
- if (${res} LESS 0 OR ${res} GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n")
- endif ()
-
- ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Build)
- endif ()
- if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n")
- endif ()
-
- if (NOT LOCAL_SKIP_TEST)
- if (NOT LOCAL_MEMCHECK_TEST)
- ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Test)
- endif ()
- if (${res} LESS 0 OR ${res} GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n")
- endif ()
- else ()
- ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args})
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS MemCheck)
- endif ()
- endif ()
- if (LOCAL_COVERAGE_TEST)
- ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
- if (LOCAL_SUBMIT)
- ctest_submit (PARTS Coverage)
- endif ()
- endif ()
- endif ()
-
- if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD)
- ##-----------------------------------------------
- ## Package the product
- ##-----------------------------------------------
- execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V
- WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
- RESULT_VARIABLE cpackResult
- OUTPUT_VARIABLE cpackLog
- ERROR_VARIABLE cpackLog.err
- )
- file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
- if (cpackResult GREATER 0)
- file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n")
- endif ()
- endif ()
-#-----------------------------------------------------------------------------
+cmake_minimum_required (VERSION 3.10)
+########################################################
+# This dashboard is maintained by The HDF Group
+# For any comments please contact cdashhelp@hdfgroup.org
+#
+########################################################
+# -----------------------------------------------------------
+# -- Get environment
+# -----------------------------------------------------------
+if (NOT SITE_OS_NAME)
+ ## machine name not provided - attempt to discover with uname
+ ## -- set hostname
+ ## --------------------------
+ find_program (HOSTNAME_CMD NAMES hostname)
+ exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME)
+ set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}")
+ find_program (UNAME NAMES uname)
+ macro (getuname name flag)
+ exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}")
+ endmacro ()
+
+ getuname (osname -s)
+ getuname (osrel -r)
+ getuname (cpu -m)
+ message (STATUS "Dashboard script uname output: ${osname}-${osrel}-${cpu}\n")
+
+ set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}")
+else ()
+ ## machine name provided
+ ## --------------------------
+ if (CMAKE_HOST_UNIX)
+ set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_OS_BITS}-${SITE_COMPILER_NAME}-${SITE_COMPILER_VERSION}")
+ else ()
+ set (CTEST_BUILD_NAME "${SITE_OS_NAME}-${SITE_OS_VERSION}-${SITE_COMPILER_NAME}")
+ endif ()
+endif ()
+if (SITE_BUILDNAME_SUFFIX)
+ set (CTEST_BUILD_NAME "${SITE_BUILDNAME_SUFFIX}-${CTEST_BUILD_NAME}")
+endif ()
+set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}")
+
+#-----------------------------------------------------------------------------
+# MAC machines need special option
+#-----------------------------------------------------------------------------
+if (APPLE)
+ # Compiler choice
+ execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set (ENV{CC} "${XCODE_CC}")
+ set (ENV{CXX} "${XCODE_CXX}")
+
+ set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF")
+endif ()
+
+#-----------------------------------------------------------------------------
+set (NEED_REPOSITORY_CHECKOUT 0)
+set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"")
+if (CTEST_USE_TAR_SOURCE)
+ ## Uncompress source if tar file provided
+ ## --------------------------
+ if (WIN32)
+ message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} x ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip]")
+ execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}\\${CTEST_USE_TAR_SOURCE}.zip RESULT_VARIABLE rv)
+ else ()
+ message (STATUS "extracting... [${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar]")
+ execute_process (COMMAND ${CMAKE_EXECUTABLE_NAME} -E tar -xvf ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE}.tar RESULT_VARIABLE rv)
+ endif ()
+
+ if (NOT rv EQUAL 0)
+ message (STATUS "extracting... [error-(${rv}) clean up]")
+ file (REMOVE_RECURSE "${CTEST_SOURCE_DIRECTORY}")
+ message (FATAL_ERROR "error: extract of ${CTEST_USE_TAR_SOURCE} failed")
+ endif ()
+
+ file (RENAME ${CTEST_DASHBOARD_ROOT}/${CTEST_USE_TAR_SOURCE} ${CTEST_SOURCE_DIRECTORY})
+ set (LOCAL_SKIP_UPDATE "TRUE")
+else ()
+ if (LOCAL_UPDATE)
+ if (CTEST_USE_GIT_SOURCE)
+ find_program (CTEST_GIT_COMMAND NAMES git git.cmd)
+ set (CTEST_GIT_UPDATE_OPTIONS)
+
+ if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
+ set (NEED_REPOSITORY_CHECKOUT 1)
+ endif ()
+
+ if (${NEED_REPOSITORY_CHECKOUT})
+ if (REPOSITORY_BRANCH)
+ set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" --branch \"${REPOSITORY_BRANCH}\" --single-branch \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules")
+ else ()
+ set (CTEST_GIT_options "clone \"${REPOSITORY_URL}\" \"${CTEST_SOURCE_DIRECTORY}\" --recurse-submodules")
+ endif ()
+ set (CTEST_CHECKOUT_COMMAND "${CTEST_GIT_COMMAND} ${CTEST_GIT_options}")
+ else ()
+ set (CTEST_GIT_options "pull")
+ endif ()
+ set (CTEST_UPDATE_COMMAND "${CTEST_GIT_COMMAND}")
+ else ()
+ ## --------------------------
+ ## use subversion to get source
+ #-----------------------------------------------------------------------------
+ ## cygwin does not handle the find_package() call
+ ## --------------------------
+ set (CTEST_UPDATE_COMMAND "SVNCommand")
+ if (NOT SITE_CYGWIN})
+ find_package (Subversion)
+ set (CTEST_SVN_COMMAND "${Subversion_SVN_EXECUTABLE}")
+ set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}")
+ else ()
+ set (CTEST_SVN_COMMAND "/usr/bin/svn")
+ set (CTEST_UPDATE_COMMAND "/usr/bin/svn")
+ endif ()
+
+ if (NOT EXISTS "${CTEST_SOURCE_DIRECTORY}")
+ set (NEED_REPOSITORY_CHECKOUT 1)
+ endif ()
+
+ if (NOT CTEST_REPO_VERSION)
+ set (CTEST_REPO_VERSION "HEAD")
+ endif ()
+ if (${NEED_REPOSITORY_CHECKOUT})
+ set (CTEST_CHECKOUT_COMMAND
+ "\"${CTEST_SVN_COMMAND}\" co ${REPOSITORY_URL} \"${CTEST_SOURCE_DIRECTORY}\" -r ${CTEST_REPO_VERSION}")
+ else ()
+ if (CTEST_REPO_VERSION)
+ set (CTEST_SVN_UPDATE_OPTIONS "-r ${CTEST_REPO_VERSION}")
+ endif ()
+ endif ()
+ endif ()
+ endif ()
+endif ()
+
+#-----------------------------------------------------------------------------
+## Clear the build directory
+## --------------------------
+set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE)
+if (NOT EXISTS "${CTEST_BINARY_DIRECTORY}")
+ file (MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}")
+else ()
+ ctest_empty_binary_directory (${CTEST_BINARY_DIRECTORY})
+endif ()
+
+# Use multiple CPU cores to build
+include (ProcessorCount)
+ProcessorCount (N)
+if (NOT N EQUAL 0)
+ if (MAX_PROC_COUNT)
+ if (N GREATER MAX_PROC_COUNT)
+ set (N ${MAX_PROC_COUNT})
+ endif ()
+ endif ()
+ if (NOT WIN32)
+ set (CTEST_BUILD_FLAGS -j${N})
+ endif ()
+ set (ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N})
+endif ()
+
+#-----------------------------------------------------------------------------
+# Send the main script as a note.
+list (APPEND CTEST_NOTES_FILES
+ "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}"
+ "${CMAKE_CURRENT_LIST_FILE}"
+ "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake"
+)
+
+#-----------------------------------------------------------------------------
+# Check for required variables.
+# --------------------------
+foreach (req
+ CTEST_CMAKE_GENERATOR
+ CTEST_SITE
+ CTEST_BUILD_NAME
+ )
+ if (NOT DEFINED ${req})
+ message (FATAL_ERROR "The containing script must set ${req}")
+ endif ()
+endforeach ()
+
+#-----------------------------------------------------------------------------
+# Initialize the CTEST commands
+#------------------------------
+if (CMAKE_GENERATOR_TOOLSET)
+ set (CTEST_CONFIGURE_TOOLSET "-T${CMAKE_GENERATOR_TOOLSET}")
+else ()
+ set (CTEST_CONFIGURE_TOOLSET "")
+endif()
+if (LOCAL_MEMCHECK_TEST)
+ find_program (CTEST_MEMORYCHECK_COMMAND NAMES valgrind)
+ set (CTEST_CONFIGURE_COMMAND
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/mccacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ )
+else ()
+ if (LOCAL_COVERAGE_TEST)
+ find_program (CTEST_COVERAGE_COMMAND NAMES gcov)
+ endif ()
+ set (CTEST_CONFIGURE_COMMAND
+ "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_CONFIGURATION_TYPE} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_CONFIGURE_TOOLSET}\" \"${CTEST_SOURCE_DIRECTORY}\""
+ )
+endif ()
+
+#-----------------------------------------------------------------------------
+## -- set output to english
+set ($ENV{LC_MESSAGES} "en_EN")
+
+# Print summary information.
+foreach (v
+ CTEST_SITE
+ CTEST_BUILD_NAME
+ CTEST_SOURCE_DIRECTORY
+ CTEST_BINARY_DIRECTORY
+ CTEST_CMAKE_GENERATOR
+ CTEST_CONFIGURATION_TYPE
+ CTEST_GIT_COMMAND
+ CTEST_CHECKOUT_COMMAND
+ CTEST_CONFIGURE_COMMAND
+ CTEST_SCRIPT_DIRECTORY
+ CTEST_USE_LAUNCHERS
+ )
+ set (vars "${vars} ${v}=[${${v}}]\n")
+endforeach ()
+message (STATUS "Dashboard script configuration:\n${vars}\n")
+
+#-----------------------------------------------------------------------------
+#-----------------------------------------------------------------------------
+ ## NORMAL process
+ ## -- LOCAL_UPDATE updates the source folder from svn
+ ## -- LOCAL_SUBMIT reports to CDash server
+ ## -- LOCAL_SKIP_TEST skips the test process (only builds)
+ ## -- LOCAL_MEMCHECK_TEST executes the Valgrind testing
+ ## -- LOCAL_COVERAGE_TEST executes code coverage process
+ ## --------------------------
+ ctest_start (${MODEL} TRACK ${MODEL})
+ if (LOCAL_UPDATE)
+ ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}")
+ endif ()
+ configure_file (${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake)
+ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}")
+ ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS Update Configure Notes)
+ endif ()
+ if (${res} LESS 0 OR ${res} GREATER 0)
+ file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Configure: ${res}\n")
+ endif ()
+
+ # On Cray XC40, configuring fails in the Fortran section when using the craype-mic-knl module.
+ # When the configure phase is done with the craype-haswell module and the build phase is done
+ # with the craype-mic-knl module, configure succeeds and tests pass on the knl compute nodes
+ # for Intel, Cray, GCC and Clang compilers. If the variables aren't set or if not
+ # cross compiling, the module switch will not occur.
+ if (CMAKE_CROSSCOMPILING AND COMPILENODE_HWCOMPILE_MODULE AND COMPUTENODE_HWCOMPILE_MODULE)
+ execute_process (COMMAND module switch ${COMPILENODE_HWCOMPILE_MODULE} ${COMPUTENODE_HWCOMPILE_MODULE})
+ endif ()
+
+ ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res NUMBER_ERRORS errval)
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS Build)
+ endif ()
+ if (${res} LESS 0 OR ${res} GREATER 0 OR ${errval} GREATER 0)
+ file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed ${errval} Build: ${res}\n")
+ endif ()
+
+ if (NOT LOCAL_SKIP_TEST)
+ if (NOT LOCAL_MEMCHECK_TEST)
+ if (NOT LOCAL_BATCH_TEST)
+ ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res)
+ else ()
+ file(STRINGS ${CTEST_BINARY_DIRECTORY}/Testing/TAG TAG_CONTENTS REGEX "^2([0-9]+)[-]([0-9]+)$")
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub")
+ execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME})
+ else ()
+ execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_NAME})
+ endif ()
+ message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml")
+ execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
+ while(result)
+ ctest_sleep(60)
+ execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
+ endwhile(result)
+ if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME)
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS Test)
+ endif ()
+ message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for serial tests. Renaming to SerialTest.xml")
+ file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/SerialTest.xml)
+ file (RENAME ${CTEST_BINARY_DIRECTORY}/Testing/Temporary/LastTest_${TAG_CONTENTS}.log ${CTEST_BINARY_DIRECTORY}/Testing/Temporary/LastTest_${TAG_CONTENTS}_Serial.log)
+ unset(result CACHE)
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub")
+ execute_process (COMMAND ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME})
+ else ()
+ execute_process (COMMAND ${LOCAL_BATCH_SCRIPT_COMMAND} ${LOCAL_BATCH_SCRIPT_ARGS} ${CTEST_BINARY_DIRECTORY}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME})
+ endif ()
+ message(STATUS "Check for existence of ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml")
+ execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
+ while(result)
+ ctest_sleep(60)
+ execute_process(COMMAND ls ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml RESULT_VARIABLE result OUTPUT_QUIET ERROR_QUIET)
+ endwhile(result)
+ message(STATUS "Found ${CTEST_BINARY_DIRECTORY}/Testing/${TAG_CONTENTS}/Test.xml for parallel tests.")
+ endif()
+ endif ()
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS Test)
+ endif ()
+ if (${res} LESS 0 OR ${res} GREATER 0)
+ file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed Tests: ${res}\n")
+ endif ()
+ else ()
+ ctest_memcheck (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args})
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS MemCheck)
+ endif ()
+ endif ()
+ if (LOCAL_COVERAGE_TEST)
+ ctest_coverage (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND)
+ if (LOCAL_SUBMIT)
+ ctest_submit (PARTS Coverage)
+ endif ()
+ endif ()
+ endif ()
+
+ if (NOT LOCAL_MEMCHECK_TEST AND NOT LOCAL_NO_PACKAGE AND NOT LOCAL_SKIP_BUILD)
+ ##-----------------------------------------------
+ ## Package the product
+ ##-----------------------------------------------
+ execute_process (COMMAND cpack -C ${CTEST_CONFIGURATION_TYPE} -V
+ WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY}
+ RESULT_VARIABLE cpackResult
+ OUTPUT_VARIABLE cpackLog
+ ERROR_VARIABLE cpackLog.err
+ )
+ file (WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}")
+ if (cpackResult GREATER 0)
+ file (APPEND ${CTEST_SCRIPT_DIRECTORY}/FailedCTest.txt "Failed packaging: ${cpackResult}:${cpackLog.err} \n")
+ endif ()
+ endif ()
+#-----------------------------------------------------------------------------
diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake
index b6c8f56..07e687c 100755
--- a/config/cmake/scripts/HDF5config.cmake
+++ b/config/cmake/scripts/HDF5config.cmake
@@ -9,232 +9,251 @@
# If you do not have access to either file, you may request a copy from
# help@hdfgroup.org.
#
-#############################################################################################
-### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
-### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
-### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
-#############################################################################################
-
-cmake_minimum_required (VERSION 3.10)
-############################################################################
-# Usage:
-# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
-# where valid options for OPTION are:
-# BUILD_GENERATOR - The cmake build generator:
-# Unix * Unix Makefiles
+#############################################################################################
+### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ###
+### BUILD_GENERATOR required [Unix, VS2017, VS201764, VS2015, VS201564, VS2013, VS201364] ###
+### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201764 -C Release -VV -O hdf5.log ###
+#############################################################################################
+
+cmake_minimum_required (VERSION 3.10)
+############################################################################
+# Usage:
+# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log
+# where valid options for OPTION are:
+# BUILD_GENERATOR - The cmake build generator:
+# Unix * Unix Makefiles
# VS2017 * Visual Studio 15 2017
# VS201764 * Visual Studio 15 2017 Win64
-# VS2015 * Visual Studio 14 2015
-# VS201564 * Visual Studio 14 2015 Win64
-# VS2013 * Visual Studio 12 2013
-# VS201364 * Visual Studio 12 2013 Win64
-#
-# INSTALLDIR - root folder where hdf5 is installed
-# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
-# CTEST_SOURCE_NAME - source folder
-##############################################################################
-
-set (CTEST_SOURCE_VERSION "1.10.4")
-set (CTEST_SOURCE_VERSEXT "")
-
-##############################################################################
-# handle input parameters to script.
-#BUILD_GENERATOR - which CMake generator to use, required
-#INSTALLDIR - HDF5-1.10.0 root folder
-#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
-#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
-if (DEFINED CTEST_SCRIPT_ARG)
- # transform ctest script arguments of the form
- # script.ctest,var1=value1,var2=value2
- # to variables with the respective names set to the respective values
- string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
- foreach (current_var ${script_args})
- if ("${current_var}" MATCHES "^([^=]+)=(.+)$")
- set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
- endif ()
- endforeach ()
-endif ()
-
-# build generator must be defined
-if (NOT DEFINED BUILD_GENERATOR)
- message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
-endif ()
-
-###################################################################
-### Following Line is one of [Release, RelWithDebInfo, Debug] #####
+# VS2015 * Visual Studio 14 2015
+# VS201564 * Visual Studio 14 2015 Win64
+# VS2013 * Visual Studio 12 2013
+# VS201364 * Visual Studio 12 2013 Win64
+#
+# INSTALLDIR - root folder where hdf5 is installed
+# CTEST_CONFIGURATION_TYPE - Release, Debug, etc
+# CTEST_SOURCE_NAME - source folder
+##############################################################################
+
+set (CTEST_SOURCE_VERSION "1.10.5")
+set (CTEST_SOURCE_VERSEXT "")
+
+##############################################################################
+# handle input parameters to script.
+#BUILD_GENERATOR - which CMake generator to use, required
+#INSTALLDIR - HDF5-1.10.0 root folder
+#CTEST_CONFIGURATION_TYPE - Release, Debug, RelWithDebInfo
+#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0
+#MODEL - CDash group name
+#HPC - run alternate configurations for HPC machines; sbatch, bsub, raybsub
+#MPI - enable MPI;
+if (DEFINED CTEST_SCRIPT_ARG)
+ # transform ctest script arguments of the form
+ # script.ctest,var1=value1,var2=value2
+ # to variables with the respective names set to the respective values
+ string (REPLACE "," ";" script_args "${CTEST_SCRIPT_ARG}")
+ foreach (current_var ${script_args})
+ if ("${current_var}" MATCHES "^([^=]+)=(.+)$")
+ set ("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
+ endif ()
+ endforeach ()
+endif ()
+
+#HPC - run alternate configurations for HPC machines
+if (DEFINED HPC)
+ set (BUILD_GENERATOR "Unix")
+endif ()
+
+# build generator must be defined
+if (NOT DEFINED BUILD_GENERATOR)
+ message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+endif ()
+
+###################################################################
+### Following Line is one of [Release, RelWithDebInfo, Debug] #####
### (default use command line -C value)
-set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
-###################################################################
-
-if (NOT DEFINED INSTALLDIR)
- if (WIN32)
- set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
- else ()
- set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
- endif ()
-endif ()
-if (NOT DEFINED CTEST_CONFIGURATION_TYPE)
- set (CTEST_CONFIGURATION_TYPE "Release")
-endif ()
-if (NOT DEFINED CTEST_SOURCE_NAME)
- set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
-endif ()
-
-set (CTEST_BINARY_NAME "build")
-set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
-if (WIN32)
- set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
- set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
-else ()
- set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
- set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
-endif ()
-
-###################################################################
-######### Following describes compiler ############
-if (WIN32)
- set (SITE_OS_NAME "Windows")
- set (SITE_OS_VERSION "WIN7")
- if (${BUILD_GENERATOR} STREQUAL "VS201764")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2017")
- set (SITE_COMPILER_VERSION "15")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2017")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2017")
- set (SITE_COMPILER_VERSION "15")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201564")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2015")
- set (SITE_COMPILER_VERSION "14")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2015")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2015")
- set (SITE_COMPILER_VERSION "14")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201364")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2013")
- set (SITE_COMPILER_VERSION "12")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2013")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2013")
- set (SITE_COMPILER_VERSION "12")
- elseif (${BUILD_GENERATOR} STREQUAL "VS201264")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
- set (SITE_OS_BITS "64")
- set (SITE_COMPILER_NAME "vs2012")
- set (SITE_COMPILER_VERSION "11")
- elseif (${BUILD_GENERATOR} STREQUAL "VS2012")
- set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
- set (SITE_OS_BITS "32")
- set (SITE_COMPILER_NAME "vs2012")
- set (SITE_COMPILER_VERSION "11")
+set (CTEST_CONFIGURATION_TYPE "$ENV{CMAKE_CONFIG_TYPE}")
+###################################################################
+
+if (NOT DEFINED INSTALLDIR)
+ if (WIN32)
+ set (INSTALLDIR "C:/Program Files/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
+ else ()
+ set (INSTALLDIR "${CTEST_SCRIPT_DIRECTORY}/HDF_Group/HDF5/${CTEST_SOURCE_VERSION}")
+ endif ()
+endif ()
+if (NOT DEFINED CTEST_CONFIGURATION_TYPE)
+ set (CTEST_CONFIGURATION_TYPE "Release")
+endif ()
+if (NOT DEFINED CTEST_SOURCE_NAME)
+ set (CTEST_SOURCE_NAME "hdf5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
+endif ()
+
+set (CTEST_BINARY_NAME "build")
+set (CTEST_DASHBOARD_ROOT "${CTEST_SCRIPT_DIRECTORY}")
+if (WIN32)
+ set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_SOURCE_NAME}")
+ set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}\\${CTEST_BINARY_NAME}")
+else ()
+ set (CTEST_SOURCE_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_SOURCE_NAME}")
+ set (CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}")
+endif ()
+
+###################################################################
+######### Following describes compiler ############
+if (NOT DEFINED HPC)
+ if (NOT DEFINED BUILD_GENERATOR)
+ message (FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+ endif ()
+ if (WIN32)
+ set (SITE_OS_NAME "Windows")
+ set (SITE_OS_VERSION "WIN7")
+ if (BUILD_GENERATOR STREQUAL "VS201764")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (BUILD_GENERATOR STREQUAL "VS2017")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 15 2017")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2017")
+ set (SITE_COMPILER_VERSION "15")
+ elseif (BUILD_GENERATOR STREQUAL "VS201564")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2015")
+ set (SITE_COMPILER_VERSION "14")
+ elseif (BUILD_GENERATOR STREQUAL "VS2015")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 14 2015")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2015")
+ set (SITE_COMPILER_VERSION "14")
+ elseif (BUILD_GENERATOR STREQUAL "VS201364")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2013")
+ set (SITE_COMPILER_VERSION "12")
+ elseif (BUILD_GENERATOR STREQUAL "VS2013")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 12 2013")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2013")
+ set (SITE_COMPILER_VERSION "12")
+ elseif (BUILD_GENERATOR STREQUAL "VS201264")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012 Win64")
+ set (SITE_OS_BITS "64")
+ set (SITE_COMPILER_NAME "vs2012")
+ set (SITE_COMPILER_VERSION "11")
+ elseif (BUILD_GENERATOR STREQUAL "VS2012")
+ set (CTEST_CMAKE_GENERATOR "Visual Studio 11 2012")
+ set (SITE_OS_BITS "32")
+ set (SITE_COMPILER_NAME "vs2012")
+ set (SITE_COMPILER_VERSION "11")
+ else ()
+ message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+ endif ()
+ ## Set the following to unique id your computer ##
+ set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
+ else ()
+ set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
+ ## Set the following to unique id your computer ##
+ if (APPLE)
+ set (CTEST_SITE "MAC.XXXX")
+ else ()
+ set (CTEST_SITE "LINUX.XXXX")
+ endif ()
+ if (APPLE)
+ execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
+ set (ENV{CC} "${XCODE_CC}")
+ set (ENV{CXX} "${XCODE_CXX}")
+ set (CTEST_USE_LAUNCHERS 1)
+ set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare")
+ set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized")
+ set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat")
+ set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2")
+ set (RR_FLAGS_C "${RR_FLAGS_COMMON}")
+ set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}")
+ set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}")
+ set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}")
+ endif ()
+ endif ()
+else ()
+ set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
+ include (${CTEST_SOURCE_DIRECTORY}/config/cmake/scripts/HPC/${HPC}-HDF5options.cmake)
+endif ()
+###################################################################
+
+###################################################################
+######### Following is for submission to CDash ############
+###################################################################
+if (NOT DEFINED MODEL)
+ set (MODEL "Experimental")
+endif ()
+
+###################################################################
+
+###################################################################
+##### Following controls CDash submission #####
+#set (LOCAL_SUBMIT "TRUE")
+##### Following controls test process #####
+#set (LOCAL_SKIP_TEST "TRUE")
+#set (LOCAL_MEMCHECK_TEST "TRUE")
+#set (LOCAL_COVERAGE_TEST "TRUE")
+##### Following controls cpack command #####
+#set (LOCAL_NO_PACKAGE "TRUE")
+##### Following controls source update #####
+#set (LOCAL_UPDATE "TRUE")
+set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git")
+set (REPOSITORY_BRANCH "hdf5_1_10_5")
+
+#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows
+#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
+###################################################################
+
+
+###################################################################
+
+if (WIN32)
+ set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}")
+ include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake)
+ include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe")
+ file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi")
+ file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip")
+ file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+else ()
+ set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
+ include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake)
+ include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
+ if (APPLE)
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
else ()
- message (FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2017, or VS201764, VS2015, VS201564, VS2013, VS201364")
+ if (CYGWIN)
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ else ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz")
+ file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
+ endif ()
+ endif ()
endif ()
-## Set the following to unique id your computer ##
- set (CTEST_SITE "WIN7${BUILD_GENERATOR}.XXXX")
-else ()
- set (CTEST_CMAKE_GENERATOR "Unix Makefiles")
-## Set the following to unique id your computer ##
- if (APPLE)
- set (CTEST_SITE "MAC.XXXX")
- else ()
- set (CTEST_SITE "LINUX.XXXX")
- endif ()
- if (APPLE)
- execute_process (COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE)
- execute_process (COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE)
- set (ENV{CC} "${XCODE_CC}")
- set (ENV{CXX} "${XCODE_CXX}")
- set (CTEST_USE_LAUNCHERS 1)
- set (RR_WARNINGS_COMMON "-Wno-format-nonliteral -Wno-cast-align -Wno-unused -Wno-unused-variable -Wno-unused-function -Wno-self-assign -Wno-unused-parameter -Wno-sign-compare")
- set (RR_WARNINGS_C "${RR_WARNINGS_COMMON} -Wno-deprecated-declarations -Wno-uninitialized")
- set (RR_WARNINGS_CXX "${RR_WARNINGS_COMMON} -Woverloaded-virtual -Wshadow -Wwrite-strings -Wc++11-compat")
- set (RR_FLAGS_COMMON "-g -O0 -fstack-protector-all -D_FORTIFY_SOURCE=2")
- set (RR_FLAGS_C "${RR_FLAGS_COMMON}")
- set (RR_FLAGS_CXX "${RR_FLAGS_COMMON}")
- set (ENV{CFLAGS} "${RR_WARNINGS_C} ${RR_FLAGS_C}")
- set (ENV{CXXFLAGS} "${RR_WARNINGS_CXX} ${RR_FLAGS_CXX}")
- endif ()
-endif ()
-###################################################################
-
-###################################################################
-######### Following is for submission to CDash ############
-###################################################################
-set (MODEL "Experimental")
-###################################################################
-
-###################################################################
-##### Following controls CDash submission #####
-#set (LOCAL_SUBMIT "TRUE")
-##### Following controls test process #####
-#set (LOCAL_SKIP_TEST "TRUE")
-#set (LOCAL_MEMCHECK_TEST "TRUE")
-#set (LOCAL_COVERAGE_TEST "TRUE")
-##### Following controls cpack command #####
-#set (LOCAL_NO_PACKAGE "TRUE")
-##### Following controls source update #####
-#set (LOCAL_UPDATE "TRUE")
-set (REPOSITORY_URL "https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git")
-set (REPOSITORY_BRANCH "hdf5_1_10_4")
-
-#uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows
-#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}")
-###################################################################
-
-
-###################################################################
-
-if (WIN32)
- set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}-win${SITE_OS_BITS}")
- include (${CTEST_SCRIPT_DIRECTORY}\\HDF5options.cmake)
- include (${CTEST_SCRIPT_DIRECTORY}\\CTestScript.cmake)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.exe" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.msi" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip")
- file (COPY "${CTEST_BINARY_DIRECTORY}\\${BINFILEBASE}.zip" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
-else ()
- set (BINFILEBASE "HDF5-${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}")
- include (${CTEST_SCRIPT_DIRECTORY}/HDF5options.cmake)
- include (${CTEST_SCRIPT_DIRECTORY}/CTestScript.cmake)
- if (APPLE)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.dmg" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Darwin.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- else ()
- if (CYGWIN)
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-CYGWIN.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- else ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.sh" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- if (EXISTS "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz")
- file (COPY "${CTEST_BINARY_DIRECTORY}/${BINFILEBASE}-Linux.tar.gz" DESTINATION ${CTEST_SCRIPT_DIRECTORY})
- endif ()
- endif ()
- endif ()
-endif ()
+endif ()
diff --git a/config/cmake/scripts/HDF5options.cmake b/config/cmake/scripts/HDF5options.cmake
index 80a28d3..24eaf78 100755
--- a/config/cmake/scripts/HDF5options.cmake
+++ b/config/cmake/scripts/HDF5options.cmake
@@ -17,8 +17,12 @@
### uncomment/comment and change the following lines for other configuration options
#############################################################################################
+#### maximum parallel processor count for build and test ####
+#set (MAX_PROC_COUNT 8)
+
+#############################################################################################
#### alternate toolsets ####
-#set(CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0")
+#set (CMAKE_GENERATOR_TOOLSET "Intel C++ Compiler 17.0")
#############################################################################################
#### Only build static libraries ####
@@ -29,12 +33,8 @@
#############################################################################################
#### fortran enabled ####
#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=ON")
- ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN
-#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=ON")
#### fortran disabled ####
set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
- ### enable Fortran 2003 depends on HDF5_BUILD_FORTRAN
-set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_F2003:BOOL=OFF")
#############################################################################################
#### java enabled ####
@@ -50,54 +50,55 @@ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_INSTALL_PREFIX:PATH=${INSTA
#### ext libraries ####
### ext libs from tgz
-set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=TGZ -DTGZPATH:PATH=${CTEST_SCRIPT_DIRECTORY}")
### ext libs from git
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=GIT")
### ext libs on system
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include")
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=NO")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DZLIB_LIBRARY:FILEPATH=some_location/lib/zlib.lib -DZLIB_INCLUDE_DIR:PATH=some_location/include")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSZIP_LIBRARY:FILEPATH=some_location/lib/szlib.lib -DSZIP_INCLUDE_DIR:PATH=some_location/include")
-### disable ext zlib building
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF")
-### disable ext szip building
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")
+### disable using ext zlib
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF")
+### disable using ext szip
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_SZIP_ENCODING:BOOL=OFF")
#### package examples ####
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.9-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACK_EXAMPLES:BOOL=ON -DHDF5_EXAMPLES_COMPRESSED:STRING=HDF5Examples-1.10.13-Source.tar.gz -DHDF5_EXAMPLES_COMPRESSED_DIR:PATH=${CTEST_SCRIPT_DIRECTORY}")
#############################################################################################
### enable parallel builds
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON")
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”)
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF”)
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF”)
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF")
#############################################################################################
### enable thread-safety builds
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON”)
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF")
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF”)
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF”)
-#set(ADD_BUILD_OPTIONS “${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF”)
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=ON")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_HL_LIB:BOOL=OFF")
#############################################################################################
### disable test program builds
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF")
#############################################################################################
### disable packaging
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_NO_PACKAGES:BOOL=ON")
### Create install package with external libraries (szip, zlib)
-set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_PACKAGE_EXTLIBS:BOOL=ON")
#############################################################################################
### use a toolchain file
-#set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/intel.cmake")
+#set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/intel.cmake")
#############################################################################################
diff --git a/config/cmake/scripts/HPC/bsub-HDF5options.cmake b/config/cmake/scripts/HPC/bsub-HDF5options.cmake
new file mode 100644
index 0000000..83c17aa
--- /dev/null
+++ b/config/cmake/scripts/HPC/bsub-HDF5options.cmake
@@ -0,0 +1,40 @@
+#
+# 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.
+#
+#############################################################################################
+#### Change default configuration of options in config/cmake/cacheinit.cmake file ###
+#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ###
+#############################################################################################
+
+### uncomment/comment and change the following lines for other configuration options
+
+#############################################################################################
+### enable parallel builds
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF")
+endif ()
+#############################################################################################
+### options to run test scripts in batch commands
+set (LOCAL_BATCH_SCRIPT_COMMAND "bsub")
+set (LOCAL_BATCH_TEST "TRUE")
+set (LOCAL_BATCH_SCRIPT_NAME "ctestS.lsf")
+set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctestP.lsf")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=${LOCAL_BATCH_SCRIPT_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_EXECUTABLE:STRING=srun")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-n")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6")
diff --git a/config/cmake/scripts/HPC/raybsub-HDF5options.cmake b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake
new file mode 100644
index 0000000..4aad887
--- /dev/null
+++ b/config/cmake/scripts/HPC/raybsub-HDF5options.cmake
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+#############################################################################################
+#### Change default configuration of options in config/cmake/cacheinit.cmake file ###
+#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ###
+#############################################################################################
+
+### uncomment/comment and change the following lines for other configuration options
+
+#############################################################################################
+### enable parallel builds
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF")
+endif ()
+#############################################################################################
+### options to run test scripts in batch commands
+set (LOCAL_BATCH_SCRIPT_COMMAND "raybsub")
+set (LOCAL_BATCH_TEST "TRUE")
+set (LOCAL_BATCH_SCRIPT_NAME "ray_ctestS.lsf")
+set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ray_ctestP.lsf")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_COMMAND:STRING=${LOCAL_BATCH_SCRIPT_COMMAND}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=${LOCAL_BATCH_SCRIPT_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_EXECUTABLE:STRING=mpirun")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-np")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6")
diff --git a/config/cmake/scripts/HPC/sbatch-HDF5options.cmake b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake
new file mode 100644
index 0000000..f70526e
--- /dev/null
+++ b/config/cmake/scripts/HPC/sbatch-HDF5options.cmake
@@ -0,0 +1,52 @@
+#
+# 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.
+#
+#############################################################################################
+#### Change default configuration of options in config/cmake/cacheinit.cmake file ###
+#### format: set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DXXX:YY=ZZZZ") ###
+#############################################################################################
+
+### uncomment/comment and change the following lines for other configuration options
+
+#############################################################################################
+### enable parallel builds
+if (DEFINED MPI)
+ # maximum parallel processor count for build and test ####
+ set (MAX_PROC_COUNT 8)
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_PARALLEL:BOOL=ON")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_CPP_LIB:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_ENABLE_THREADSAFE:BOOL=OFF")
+endif ()
+#############################################################################################
+### options to run test scripts in batch commands
+if (DEFINED KNL)
+ ### some additions and alternatives to cross compile on haswell for knl
+ set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell")
+ set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl")
+ set (LOCAL_BATCH_SCRIPT_NAME "knl_ctestS.sl")
+ set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "knl_ctestP.sl")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake")
+else ()
+ set (LOCAL_BATCH_SCRIPT_NAME "ctestS.sl")
+ set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "ctestP.sl")
+endif ()
+set (LOCAL_BATCH_SCRIPT_COMMAND "sbatch")
+set (LOCAL_BATCH_TEST "TRUE")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_TEST:BOOL=ON")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_NAME:STRING=${LOCAL_BATCH_SCRIPT_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_EXECUTABLE:STRING=srun")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_NUMPROC_FLAG:STRING=-n")
+set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DMPIEXEC_MAX_NUMPROCS:STRING=6")
+
+#############################################################################################
+#############################################################################################
diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake
index 66a97c0..b616958 100644
--- a/config/cmake/vfdTest.cmake
+++ b/config/cmake/vfdTest.cmake
@@ -32,9 +32,9 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
# if there is not an error reference file add the error output to the stdout file
-if (NOT TEST_ERRREF)
- set (ERROR_APPEND 1)
-endif ()
+#if (NOT TEST_ERRREF)
+# set (ERROR_APPEND 1)
+#endif ()
message (STATUS "USING ${TEST_VFD} ON COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
@@ -60,7 +60,7 @@ if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err)
endif ()
# if the return value is !=${TEST_EXPECT} bail out
-if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}")
+if (NOT TEST_RESULT EQUAL TEST_EXPECT)
if (NOT TEST_NOERRDISPLAY)
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out TEST_STREAM)
diff --git a/config/cmake/wait_H5Tinit.cmake b/config/cmake/wait_H5Tinit.cmake
new file mode 100644
index 0000000..c0b4d06
--- /dev/null
+++ b/config/cmake/wait_H5Tinit.cmake
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 3.10)
+
+message(STATUS "Check for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
+execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET)
+while(H5TI_result)
+ ctest_sleep(30)
+ message(STATUS "Checking again for existence of ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
+ execute_process(COMMAND ls ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c RESULT_VARIABLE H5TI_result OUTPUT_QUIET ERROR_QUIET)
+endwhile(H5TI_result)
+file (TOUCH "${HDF5_BINARY_DIR}/H5Tinit_created")
+message(STATUS "Found ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c")
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 4204511..986280f 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -70,7 +70,7 @@ if (WIN32)
set (CMAKE_REQUIRED_FLAGS "-DWIN32_LEAN_AND_MEAN=1 -DNOGDI=1")
endif ()
set (${HDF_PREFIX}_HAVE_WIN32_API 1)
- set (CMAKE_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib")
+ set (HDF5_REQUIRED_LIBRARIES "ws2_32.lib;wsock32.lib")
if (NOT UNIX AND NOT MINGW)
set (WINDOWS 1)
set (CMAKE_REQUIRED_FLAGS "/DWIN32_LEAN_AND_MEAN=1 /DNOGDI=1")
@@ -109,6 +109,78 @@ endif ()
# END of WINDOWS Hard code Values
# ----------------------------------------------------------------------
+if (NOT WINDOWS)
+ TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN)
+endif ()
+
+#-----------------------------------------------------------------------------
+# Check IF header file exists and add it to the list.
+#-----------------------------------------------------------------------------
+macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
+ CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE})
+ if (${VARIABLE})
+ set (USE_INCLUDES ${USE_INCLUDES} ${FILE})
+ endif ()
+endmacro ()
+
+#-----------------------------------------------------------------------------
+# Check for the existence of certain header files
+#-----------------------------------------------------------------------------
+CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H)
+CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H)
+CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H)
+CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H)
+CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H)
+CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H)
+CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H)
+
+# Darwin
+CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H)
+
+# Windows
+CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H)
+if (NOT CYGWIN)
+ CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H)
+endif ()
+CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H)
+
+if (CMAKE_SYSTEM_NAME MATCHES "OSF")
+ CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H)
+ CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H)
+else ()
+ set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE)
+ set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE)
+endif ()
+
+CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H)
+CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H)
+CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H)
+CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H)
+CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H)
+CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H)
+CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H)
+CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H)
+CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H)
+CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H)
+# _Bool type support
+CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H)
+
+## Check for non-standard extenstion quadmath.h
+
+CHECK_INCLUDE_FILES(quadmath.h C_HAVE_QUADMATH)
+if (${C_HAVE_QUADMATH})
+ set(${HDF_PREFIX}_HAVE_QUADMATH_H 1)
+else ()
+ set(${HDF_PREFIX}_HAVE_QUADMATH_H 0)
+endif ()
+
if (CYGWIN)
set (${HDF_PREFIX}_HAVE_LSEEK64 0)
endif ()
@@ -127,17 +199,13 @@ endif ()
CHECK_LIBRARY_EXISTS_CONCAT ("ucb" gethostname ${HDF_PREFIX}_HAVE_LIBUCB)
# For other tests to use the same libraries
-set (CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${LINK_LIBS})
+set (HDF5_REQUIRED_LIBRARIES ${HDF5_REQUIRED_LIBRARIES} ${LINK_LIBS})
set (USE_INCLUDES "")
if (WINDOWS)
set (USE_INCLUDES ${USE_INCLUDES} "windows.h")
endif ()
-if (NOT WINDOWS)
- TEST_BIG_ENDIAN (${HDF_PREFIX}_WORDS_BIGENDIAN)
-endif ()
-
# For other specific tests, use this MACRO.
macro (HDF_FUNCTION_TEST OTHER_TEST)
if (NOT DEFINED ${HDF_PREFIX}_${OTHER_TEST})
@@ -165,7 +233,7 @@ macro (HDF_FUNCTION_TEST OTHER_TEST)
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_EXT_DIR}/HDFTests.c
COMPILE_DEFINITIONS "${MACRO_CHECK_FUNCTION_DEFINITIONS}"
- LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}"
+ LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}"
OUTPUT_VARIABLE OUTPUT
)
if (${OTHER_TEST})
@@ -188,63 +256,6 @@ endmacro ()
HDF_FUNCTION_TEST (STDC_HEADERS)
#-----------------------------------------------------------------------------
-# Check IF header file exists and add it to the list.
-#-----------------------------------------------------------------------------
-macro (CHECK_INCLUDE_FILE_CONCAT FILE VARIABLE)
- CHECK_INCLUDE_FILES ("${USE_INCLUDES};${FILE}" ${VARIABLE})
- if (${VARIABLE})
- set (USE_INCLUDES ${USE_INCLUDES} ${FILE})
- endif ()
-endmacro ()
-
-#-----------------------------------------------------------------------------
-# Check for the existence of certain header files
-#-----------------------------------------------------------------------------
-CHECK_INCLUDE_FILE_CONCAT ("sys/file.h" ${HDF_PREFIX}_HAVE_SYS_FILE_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/ioctl.h" ${HDF_PREFIX}_HAVE_SYS_IOCTL_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/resource.h" ${HDF_PREFIX}_HAVE_SYS_RESOURCE_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/socket.h" ${HDF_PREFIX}_HAVE_SYS_SOCKET_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/stat.h" ${HDF_PREFIX}_HAVE_SYS_STAT_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H)
-CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H)
-CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H)
-CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H)
-CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H)
-CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H)
-CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H)
-CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H)
-
-# Darwin
-CHECK_INCLUDE_FILE_CONCAT ("mach/mach_time.h" ${HDF_PREFIX}_HAVE_MACH_MACH_TIME_H)
-
-# Windows
-CHECK_INCLUDE_FILE_CONCAT ("io.h" ${HDF_PREFIX}_HAVE_IO_H)
-if (NOT CYGWIN)
- CHECK_INCLUDE_FILE_CONCAT ("winsock2.h" ${HDF_PREFIX}_HAVE_WINSOCK2_H)
-endif ()
-CHECK_INCLUDE_FILE_CONCAT ("sys/timeb.h" ${HDF_PREFIX}_HAVE_SYS_TIMEB_H)
-
-if (CMAKE_SYSTEM_NAME MATCHES "OSF")
- CHECK_INCLUDE_FILE_CONCAT ("sys/sysinfo.h" ${HDF_PREFIX}_HAVE_SYS_SYSINFO_H)
- CHECK_INCLUDE_FILE_CONCAT ("sys/proc.h" ${HDF_PREFIX}_HAVE_SYS_PROC_H)
-else ()
- set (${HDF_PREFIX}_HAVE_SYS_SYSINFO_H "" CACHE INTERNAL "" FORCE)
- set (${HDF_PREFIX}_HAVE_SYS_PROC_H "" CACHE INTERNAL "" FORCE)
-endif ()
-
-CHECK_INCLUDE_FILE_CONCAT ("globus/common.h" ${HDF_PREFIX}_HAVE_GLOBUS_COMMON_H)
-CHECK_INCLUDE_FILE_CONCAT ("pdb.h" ${HDF_PREFIX}_HAVE_PDB_H)
-CHECK_INCLUDE_FILE_CONCAT ("pthread.h" ${HDF_PREFIX}_HAVE_PTHREAD_H)
-CHECK_INCLUDE_FILE_CONCAT ("srbclient.h" ${HDF_PREFIX}_HAVE_SRBCLIENT_H)
-CHECK_INCLUDE_FILE_CONCAT ("string.h" ${HDF_PREFIX}_HAVE_STRING_H)
-CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H)
-CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H)
-CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H)
-CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H)
-CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H)
-CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H)
-
-#-----------------------------------------------------------------------------
# Check for large file support
#-----------------------------------------------------------------------------
@@ -263,17 +274,19 @@ if (NOT WINDOWS)
# functionality so clock_gettime and CLOCK_MONOTONIC are defined
# correctly. This was later updated to 200112L so that
# posix_memalign() is visible for the direct VFD code on Linux
- # systems.
+ # systems. Even later, this was changed to 200809L to support
+ # pread/pwrite in VFDs.
+ #
# POSIX feature information can be found in the gcc manual at:
# http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200112L)
+ set (HDF_EXTRA_C_FLAGS -D_POSIX_C_SOURCE=200809L)
# Need to add this so that O_DIRECT is visible for the direct
# VFD on Linux systems.
set (HDF_EXTRA_C_FLAGS -D_GNU_SOURCE)
option (HDF_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON)
- if (HDF_ENABLE_LARGE_FILE)
+ if (HDF_ENABLE_LARGE_FILE AND NOT DEFINED TEST_LFS_WORKS_RUN)
set (msg "Performing TEST_LFS_WORKS")
TRY_RUN (TEST_LFS_WORKS_RUN TEST_LFS_WORKS_COMPILE
${CMAKE_BINARY_DIR}
@@ -402,13 +415,13 @@ HDF_CHECK_TYPE_SIZE (off64_t ${HDF_PREFIX}_SIZEOF_OFF64_T)
if (NOT ${HDF_PREFIX}_SIZEOF_OFF64_T)
set (${HDF_PREFIX}_SIZEOF_OFF64_T 0)
endif ()
+HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T)
#-----------------------------------------------------------------------------
# Extra C99 types
#-----------------------------------------------------------------------------
# _Bool type support
-CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H)
if (HAVE_STDBOOL_H)
set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL)
@@ -495,6 +508,8 @@ CHECK_FUNCTION_EXISTS (lround ${HDF_PREFIX}_HAVE_LROUND)
CHECK_FUNCTION_EXISTS (lroundf ${HDF_PREFIX}_HAVE_LROUNDF)
CHECK_FUNCTION_EXISTS (lstat ${HDF_PREFIX}_HAVE_LSTAT)
+CHECK_FUNCTION_EXISTS (pread ${HDF_PREFIX}_HAVE_PREAD)
+CHECK_FUNCTION_EXISTS (pwrite ${HDF_PREFIX}_HAVE_PWRITE)
CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R)
CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM)
CHECK_FUNCTION_EXISTS (round ${HDF_PREFIX}_HAVE_ROUND)
@@ -563,7 +578,7 @@ endif ()
if (WINDOWS)
if (NOT HDF_NO_IOEO_TEST)
message (STATUS "Checking for InitOnceExecuteOnce:")
- if (NOT DEFINED ${${HDF_PREFIX}_HAVE_IOEO})
+ if (NOT DEFINED ${HDF_PREFIX}_HAVE_IOEO)
if (LARGEFILE)
set (CMAKE_REQUIRED_DEFINITIONS
"${CURRENT_TEST_DEFINITIONS} -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE"
@@ -580,7 +595,7 @@ if (WINDOWS)
${CMAKE_BINARY_DIR}
${HDF_RESOURCES_EXT_DIR}/HDFTests.c
COMPILE_DEFINITIONS "${CMAKE_REQUIRED_DEFINITIONS} ${MACRO_CHECK_FUNCTION_DEFINITIONS}"
- LINK_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES}"
+ LINK_LIBRARIES "${HDF5_REQUIRED_LIBRARIES}"
CMAKE_FLAGS "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES} -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH}"
COMPILE_OUTPUT_VARIABLE OUTPUT
)
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/config/cmake_ext_mod/HDFMacros.cmake b/config/cmake_ext_mod/HDFMacros.cmake
index 147ae2f..2f4ce52 100644
--- a/config/cmake_ext_mod/HDFMacros.cmake
+++ b/config/cmake_ext_mod/HDFMacros.cmake
@@ -14,7 +14,7 @@
macro (SET_HDF_BUILD_TYPE)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
- set(HDF_CFG_NAME ${CTEST_CONFIGURATION_TYPE})
+ set(HDF_CFG_NAME ${CMAKE_BUILD_TYPE})
set(HDF_BUILD_TYPE ${CMAKE_CFG_INTDIR})
set(HDF_CFG_BUILD_TYPE \${CMAKE_INSTALL_CONFIG_NAME})
else()
@@ -170,7 +170,7 @@ macro (HDF_IMPORT_SET_LIB_OPTIONS libtarget libname libtype libversion)
if (${importtype} MATCHES "IMPORT")
set (importprefix "${CMAKE_STATIC_LIBRARY_PREFIX}")
endif ()
- if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
+ if (${HDF_CFG_NAME} MATCHES "Debug")
set (IMPORT_LIB_NAME ${LIB_DEBUG_NAME})
else ()
set (IMPORT_LIB_NAME ${LIB_RELEASE_NAME})
@@ -273,7 +273,7 @@ macro (HDF_README_PROPERTIES target_fortran)
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2015")
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO 2017")
- endif ()
+ endif ()
else ()
set (BINARY_PLATFORM "${BINARY_PLATFORM}, using VISUAL STUDIO ${CMAKE_C_COMPILER_VERSION}")
endif ()
diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake
index f293ec5..efaa556 100644
--- a/config/cmake_ext_mod/HDFUseCXX.cmake
+++ b/config/cmake_ext_mod/HDFUseCXX.cmake
@@ -48,8 +48,8 @@ macro (HDF_CXX_FUNCTION_TEST OTHER_TEST)
if (NOT DEFINED ${OTHER_TEST})
set (MACRO_CHECK_FUNCTION_DEFINITIONS "-D${OTHER_TEST} ${CMAKE_REQUIRED_FLAGS}")
set (OTHER_TEST_ADD_LIBRARIES)
- if (CMAKE_REQUIRED_LIBRARIES)
- set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ if (HDF5_REQUIRED_LIBRARIES)
+ set (OTHER_TEST_ADD_LIBRARIES "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}")
endif ()
foreach (def
diff --git a/config/cmake_ext_mod/HDFUseFortran.cmake b/config/cmake_ext_mod/HDFUseFortran.cmake
index f8f3cea..c68c921 100644
--- a/config/cmake_ext_mod/HDFUseFortran.cmake
+++ b/config/cmake_ext_mod/HDFUseFortran.cmake
@@ -48,9 +48,9 @@ set (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}")
#-----------------------------------------------------------------------------
macro (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
message (STATUS "Testing Fortran ${FUNCTION}")
- if (CMAKE_REQUIRED_LIBRARIES)
+ if (HDF5_REQUIRED_LIBRARIES)
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
- "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ "-DLINK_LIBRARIES:STRING=${HDF5_REQUIRED_LIBRARIES}")
else ()
set (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
endif ()
diff --git a/config/cmake_ext_mod/grepTest.cmake b/config/cmake_ext_mod/grepTest.cmake
index b812d73..1417204 100644
--- a/config/cmake_ext_mod/grepTest.cmake
+++ b/config/cmake_ext_mod/grepTest.cmake
@@ -57,15 +57,15 @@ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
# TEST_REFERENCE should always be matched
string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
-if ("${TEST_RESULT}" STREQUAL "0")
+if (NOT TEST_RESULT)
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
endif ()
string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
-if ("${TEST_EXPECT}" STREQUAL "1")
- # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match
+if (TEST_EXPECT)
+ # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match
string (LENGTH "${TEST_MATCH}" TEST_RESULT)
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
endif ()
endif ()
diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake
index 5569a73..48402a2 100644
--- a/config/cmake_ext_mod/runTest.cmake
+++ b/config/cmake_ext_mod/runTest.cmake
@@ -26,9 +26,6 @@ endif ()
if (NOT TEST_EXPECT)
message (STATUS "Require TEST_EXPECT to be defined")
endif ()
-if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE)
- message (FATAL_ERROR "Require TEST_REFERENCE to be defined")
-endif ()
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT})
@@ -38,11 +35,6 @@ if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (REMOVE ${TEST_FOLDER}/${TEST_OUTPUT}.err)
endif ()
-# if there is not an error reference file add the error output to the stdout file
-if (NOT TEST_ERRREF)
- set (ERROR_APPEND 1)
-endif ()
-
message (STATUS "COMMAND: ${TEST_PROGRAM} ${TEST_ARGS}")
if (TEST_LIBRARY_DIRECTORY)
@@ -88,7 +80,7 @@ if (TEST_REGEX)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
string (REGEX MATCH "${TEST_REGEX}" REGEX_MATCH ${TEST_STREAM})
string (COMPARE EQUAL "${REGEX_MATCH}" "${TEST_MATCH}" REGEX_RESULT)
- if ("${REGEX_RESULT}" STREQUAL "0")
+ if (NOT REGEX_RESULT)
message (STATUS "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_MATCH}")
endif ()
endif ()
@@ -96,9 +88,21 @@ endif ()
message (STATUS "COMMAND Result: ${TEST_RESULT}")
# if the .err file exists and ERRROR_APPEND is enabled
-if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
+if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM)
- file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ if (TEST_MASK_FILE)
+ STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}")
+ endif ()
+ # remove special output
+ string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
+
+ if (NOT ERROR_APPEND)
+ # write back to original .err file
+ file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}")
+ else ()
+ # append error output to the stdout output file
+ file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}")
+ endif ()
endif ()
# append the test result status with a predefined text
@@ -107,7 +111,7 @@ if (TEST_APPEND)
endif ()
# if the return value is !=${TEST_EXPECT} bail out
-if (NOT "${TEST_RESULT}" STREQUAL "${TEST_EXPECT}")
+if (NOT TEST_RESULT EQUAL TEST_EXPECT)
if (NOT TEST_NOERRDISPLAY)
if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT})
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
@@ -119,6 +123,14 @@ endif ()
message (STATUS "COMMAND Error: ${TEST_ERROR}")
+# remove special output
+file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+string (FIND TEST_STREAM "_pmi_alps" "${TEST_FIND_RESULT}")
+if (TEST_FIND_RESULT GREATER 0)
+ string (REGEX REPLACE "^.*_pmi_alps[^\n]+\n" "" TEST_STREAM "${TEST_STREAM}")
+ file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_STREAM})
+endif ()
+
# if the output file needs Storage text removed
if (TEST_MASK)
file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
@@ -173,63 +185,65 @@ endif ()
# compare output files to references unless this must be skipped
if (NOT TEST_SKIP_COMPARE)
- if (WIN32 AND NOT MINGW)
- file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
- file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
- endif ()
+ if (EXISTS ${TEST_FOLDER}/${TEST_REFERENCE})
+ if (WIN32 AND NOT MINGW)
+ file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM)
+ file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}")
+ endif ()
- if (NOT TEST_SORT_COMPARE)
- # now compare the output with the reference
- execute_process (
- COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
- RESULT_VARIABLE TEST_RESULT
- )
- else ()
- file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1)
- file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2)
- list (SORT v1)
- list (SORT v2)
- if (NOT v1 STREQUAL v2)
- set(TEST_RESULT 1)
+ if (NOT TEST_SORT_COMPARE)
+ # now compare the output with the reference
+ execute_process (
+ COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE}
+ RESULT_VARIABLE TEST_RESULT
+ )
+ else ()
+ file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} v1)
+ file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} v2)
+ list (SORT v1)
+ list (SORT v2)
+ if (NOT v1 STREQUAL v2)
+ set(TEST_RESULT 1)
+ endif ()
endif ()
- endif ()
- if (NOT "${TEST_RESULT}" STREQUAL "0")
- set (TEST_RESULT 0)
- file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
- list (LENGTH test_act len_act)
- file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
- list (LENGTH test_ref len_ref)
- if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
- math (EXPR _FP_LEN "${len_ref} - 1")
- foreach (line RANGE 0 ${_FP_LEN})
- list (GET test_act ${line} str_act)
- list (GET test_ref ${line} str_ref)
- if (NOT "${str_act}" STREQUAL "${str_ref}")
- if (NOT "${str_act}" STREQUAL "")
- set (TEST_RESULT 1)
- message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ if (TEST_RESULT)
+ set (TEST_RESULT 0)
+ file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act)
+ list (LENGTH test_act len_act)
+ file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref)
+ list (LENGTH test_ref len_ref)
+ if (len_act GREATER 0 AND len_ref GREATER 0)
+ math (EXPR _FP_LEN "${len_ref} - 1")
+ foreach (line RANGE 0 ${_FP_LEN})
+ list (GET test_act ${line} str_act)
+ list (GET test_ref ${line} str_ref)
+ if (NOT ${str_act} STREQUAL ${str_ref})
+ if (NOT str_act STREQUAL "")
+ set (TEST_RESULT 1)
+ message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
+ endif ()
endif ()
+ endforeach ()
+ else ()
+ if (len_act EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
+ endif ()
+ if (len_ref EQUAL 0)
+ message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
endif ()
- endforeach ()
- else ()
- if ("${len_act}" STREQUAL "0")
- message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT} is empty")
endif ()
- if ("${len_ref}" STREQUAL "0")
- message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_REFERENCE} is empty")
+ if (NOT len_act EQUAL len_ref)
+ set (TEST_RESULT 1)
endif ()
endif ()
- if (NOT "${len_act}" STREQUAL "${len_ref}")
- set (TEST_RESULT 1)
- endif ()
- endif ()
- message (STATUS "COMPARE Result: ${TEST_RESULT}")
+ message (STATUS "COMPARE Result: ${TEST_RESULT}")
- # again, if return value is !=0 scream and shout
- if (NOT "${TEST_RESULT}" STREQUAL "0")
- message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+ # again, if return value is !=0 scream and shout
+ if (TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}")
+ endif ()
endif ()
# now compare the .err file with the error reference, if supplied
@@ -244,34 +258,34 @@ if (NOT TEST_SKIP_COMPARE)
COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF}
RESULT_VARIABLE TEST_RESULT
)
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ if (TEST_RESULT)
set (TEST_RESULT 0)
file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act)
list (LENGTH test_act len_act)
file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref)
list (LENGTH test_ref len_ref)
math (EXPR _FP_LEN "${len_ref} - 1")
- if (NOT "${len_act}" STREQUAL "0" AND NOT "${len_ref}" STREQUAL "0")
+ if (len_act GREATER 0 AND len_ref GREATER 0)
math (EXPR _FP_LEN "${len_ref} - 1")
foreach (line RANGE 0 ${_FP_LEN})
list (GET test_act ${line} str_act)
list (GET test_ref ${line} str_ref)
- if (NOT "${str_act}" STREQUAL "${str_ref}")
- if (NOT "${str_act}" STREQUAL "")
+ if (NOT ${str_act} STREQUAL ${str_ref})
+ if (NOT ${str_act} STREQUAL "")
set (TEST_RESULT 1)
message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n")
- endif ()
+ endif ()
endif ()
endforeach ()
else ()
- if ("${len_act}" STREQUAL "0")
+ if (len_act EQUAL 0)
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_OUTPUT}.err is empty")
endif ()
- if ("${len_ref}" STREQUAL "0")
+ if (len_ref EQUAL 0)
message (STATUS "COMPARE Failed: ${TEST_FOLDER}/${TEST_ERRREF} is empty")
endif ()
endif ()
- if (NOT "${len_act}" STREQUAL "${len_ref}")
+ if (NOT len_act EQUAL len_ref)
set (TEST_RESULT 1)
endif ()
endif ()
@@ -279,11 +293,33 @@ if (NOT TEST_SKIP_COMPARE)
message (STATUS "COMPARE Result: ${TEST_RESULT}")
# again, if return value is !=0 scream and shout
- if (NOT "${TEST_RESULT}" STREQUAL "0")
+ if (TEST_RESULT)
message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}")
endif ()
endif ()
endif ()
+if (TEST_GREP_COMPARE)
+ # now grep the output with the reference
+ file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM)
+
+ # TEST_REFERENCE should always be matched
+ string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM})
+ string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT)
+ if (NOT TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}")
+ endif ()
+
+ string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM})
+ if (TEST_EXPECT)
+ # TEST_EXPECT (1) interprets TEST_FILTER as; NOT to match
+ string (LENGTH "${TEST_MATCH}" TEST_RESULT)
+ if (TEST_RESULT)
+ message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}")
+ endif ()
+ endif ()
+endif ()
+
# everything went fine...
-message ("Passed: The output of ${TEST_PROGRAM} matches ${TEST_REFERENCE}")
+message ("${TEST_PROGRAM} Passed")
+
diff --git a/config/conclude.am b/config/conclude.am
index 4bdbb0b..27cd7ee 100644
--- a/config/conclude.am
+++ b/config/conclude.am
@@ -234,7 +234,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/config/lt_vers.am b/config/lt_vers.am
index 8b63c22..cba0782 100644
--- a/config/lt_vers.am
+++ b/config/lt_vers.am
@@ -16,9 +16,9 @@
## See libtool versioning documentation online.
## After making changes, run bin/reconfigure to update other configure related
## files like Makefile.in.
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
+LT_VERS_AGE = 1
## If the API changes *at all*, increment LT_VERS_INTERFACE and
## reset LT_VERS_REVISION to 0.
@@ -39,31 +39,31 @@ LT_VERS_AGE = 0
## the effects of the H5_V1_x_COMPAT flag.
##
## Version numbers for wrapper shared library files.
-LT_CXX_VERS_INTERFACE = 103
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
+LT_CXX_VERS_AGE = 1
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
diff --git a/config/toolchain/GCC.cmake b/config/toolchain/GCC.cmake
new file mode 100644
index 0000000..c41d0ca
--- /dev/null
+++ b/config/toolchain/GCC.cmake
@@ -0,0 +1,11 @@
+# Uncomment the following line and the correct system name to use cross-compiling
+#set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_COMPILER_VENDOR "GCC")
+
+set(CMAKE_C_COMPILER cc)
+set(CMAKE_CXX_COMPILER c++)
+set(CMAKE_Fortran_COMPILER gfortran)
+
+# the following is used if cross-compiling
+set(CMAKE_CROSSCOMPILING_EMULATOR "")
diff --git a/config/toolchain/PGI.cmake b/config/toolchain/PGI.cmake
new file mode 100644
index 0000000..ec58cbb
--- /dev/null
+++ b/config/toolchain/PGI.cmake
@@ -0,0 +1,11 @@
+# Uncomment the following to use cross-compiling
+#set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_COMPILER_VENDOR "PGI")
+
+set(CMAKE_C_COMPILER pgcc)
+set(CMAKE_CXX_COMPILER pgc++)
+set(CMAKE_Fortran_COMPILER pgf90)
+
+# the following is used if cross-compiling
+set(CMAKE_CROSSCOMPILING_EMULATOR "")
diff --git a/config/toolchain/crayle.cmake b/config/toolchain/crayle.cmake
new file mode 100644
index 0000000..bf7cf69
--- /dev/null
+++ b/config/toolchain/crayle.cmake
@@ -0,0 +1,10 @@
+# The following line will use cross-compiling
+set(CMAKE_SYSTEM_NAME Linux)
+
+set(CMAKE_COMPILER_VENDOR "CrayLinuxEnvironment")
+
+set(CMAKE_C_COMPILER cc)
+set(CMAKE_Fortran_COMPILER ftn)
+
+# the following is used if cross-compiling
+set(CMAKE_CROSSCOMPILING_EMULATOR "")
diff --git a/config/intel.cmake b/config/toolchain/intel.cmake
index f1a5734..97f6a64 100644
--- a/config/intel.cmake
+++ b/config/toolchain/intel.cmake
@@ -1,5 +1,6 @@
# Uncomment the following to use cross-compiling
#set(CMAKE_SYSTEM_NAME Linux)
+
set(CMAKE_COMPILER_VENDOR "intel")
set(CMAKE_C_COMPILER icc)
diff --git a/configure b/configure
index 23c268b..3a4a5c4 100755
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest .
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for HDF5 1.10.4.
+# Generated by GNU Autoconf 2.69 for HDF5 1.10.5.
#
# Report bugs to <help@hdfgroup.org>.
#
@@ -591,8 +591,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='HDF5'
PACKAGE_TARNAME='hdf5'
-PACKAGE_VERSION='1.10.4'
-PACKAGE_STRING='HDF5 1.10.4'
+PACKAGE_VERSION='1.10.5'
+PACKAGE_STRING='HDF5 1.10.5'
PACKAGE_BUGREPORT='help@hdfgroup.org'
PACKAGE_URL=''
@@ -655,6 +655,7 @@ BUILD_PARALLEL_CONDITIONAL_FALSE
BUILD_PARALLEL_CONDITIONAL_TRUE
BUILD_CXX_CONDITIONAL_FALSE
BUILD_CXX_CONDITIONAL_TRUE
+PREADWRITE
STRICT_FORMAT_CHECKS
DEFAULT_API_VERSION
DEPRECATED_SYMBOLS
@@ -682,7 +683,6 @@ ADD_PARALLEL_FILES
MEMORYALLOCSANITYCHECK
USINGMEMCHECKER
TRACE_API
-METADATATRACEFILE
CODESTACK
INTERNAL_DEBUG_OUTPUT
OPTIMIZATION
@@ -956,7 +956,6 @@ enable_profiling
enable_optimization
enable_internal_debug
enable_codestack
-enable_metadata_trace_file
enable_trace
enable_using_memchecker
enable_memory_alloc_sanity_check
@@ -971,6 +970,7 @@ enable_build_all
enable_deprecated_symbols
with_default_api_version
enable_strict_format_checks
+enable_preadwrite
enable_embedded_libinfo
'
ac_precious_vars='build_alias
@@ -1529,7 +1529,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures HDF5 1.10.4 to adapt to many kinds of systems.
+\`configure' configures HDF5 1.10.5 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1599,7 +1599,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of HDF5 1.10.4:";;
+ short | recursive ) echo "Configuration of HDF5 1.10.5:";;
esac
cat <<\_ACEOF
@@ -1691,8 +1691,6 @@ Optional Features:
otherwise none]
--enable-codestack Enable the function stack tracing (for developer
debugging). [default=no]
- --enable-metadata-trace-file
- Enable metadata trace file collection. [default=no]
--enable-trace Enable HDF5 API tracing capability. [default=yes if
debug build, otherwise no]
--enable-using-memchecker
@@ -1732,6 +1730,9 @@ Optional Features:
--enable-strict-format-checks
Enable strict file format checks. [default=yes if
debug build, otherwise no]
+ --enable-preadwrite Enable using pread/pwrite instead of read/write in
+ sec2/log/core VFDs. [default=yes if pread/pwrite are
+ present]
--enable-embedded-libinfo
Enable embedded library information [default=yes]
@@ -1856,7 +1857,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-HDF5 configure 1.10.4
+HDF5 configure 1.10.5
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2771,7 +2772,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by HDF5 $as_me 1.10.4, which was
+It was created by HDF5 $as_me 1.10.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3643,7 +3644,7 @@ fi
# Define the identity of the package.
PACKAGE='hdf5'
- VERSION='1.10.4'
+ VERSION='1.10.5'
cat >>confdefs.h <<_ACEOF
@@ -9563,7 +9564,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
-/* #line 9566 "configure" */
+/* #line 9567 "configure" */
public class Test {
}
EOF
@@ -9738,7 +9739,7 @@ EOF
if $UUDECODE Test.uue; then
ac_cv_prog_uudecode_base64=yes
else
- echo "configure: 9741: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+ echo "configure: 9742: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@@ -9855,7 +9856,7 @@ else
JAVA_TEST=Test.java
CLASS_TEST=Test.class
cat << \EOF > $JAVA_TEST
-/* #line 9858 "configure" */
+/* #line 9859 "configure" */
public class Test {
}
EOF
@@ -9890,7 +9891,7 @@ JAVA_TEST=Test.java
CLASS_TEST=Test.class
TEST=Test
cat << \EOF > $JAVA_TEST
-/* [#]line 9893 "configure" */
+/* [#]line 9894 "configure" */
public class Test {
public static void main (String args[]) {
System.exit (0);
@@ -10320,7 +10321,7 @@ EOF
if $UUDECODE Test.uue; then
:
else
- echo "configure: 10323: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
+ echo "configure: 10324: uudecode had trouble decoding base 64 file 'Test.uue'" >&5
echo "configure: failed file was:" >&5
cat Test.uue >&5
ac_cv_prog_uudecode_base64=no
@@ -10340,7 +10341,7 @@ EOF
else
cat << \EOF > Test.java
-/* #line 10343 "configure" */
+/* #line 10344 "configure" */
import junit.textui.TestRunner;
public class Test {
@@ -25447,11 +25448,12 @@ case "$host_cpu-$host_vendor-$host_os" in
## functionality so clock_gettime and CLOCK_MONOTONIC are defined
## correctly. This was later updated to 200112L so that
## posix_memalign() is visible for the direct VFD code on Linux
- ## systems.
+ ## systems. Even later, this was changed to 200809L to support
+ ## pread/pwrite in VFDs.
##
## POSIX feature information can be found in the gcc manual at:
## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_C_SOURCE=200809L $H5_CPPFLAGS"
## Need to add this so that O_DIRECT is visible for the direct
## VFD on Linux systems.
@@ -26539,6 +26541,48 @@ _ACEOF
fi
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
+$as_echo_n "checking size of time_t... " >&6; }
+if ${ac_cv_sizeof_time_t+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t" "
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+"; then :
+
+else
+ if test "$ac_cv_type_time_t" = yes; then
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (time_t)
+See \`config.log' for more details" "$LINENO" 5; }
+ else
+ ac_cv_sizeof_time_t=0
+ fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
+$as_echo "$ac_cv_sizeof_time_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
+_ACEOF
+
+
+
## Checkpoint the cache
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -26699,8 +26743,8 @@ else
fi
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_DMALLOC="yes"
for ac_header in dmalloc.h
do :
@@ -26777,7 +26821,7 @@ fi
as_fn_error $? "couldn't find dmalloc library" "$LINENO" 5
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_DMALLOC="no"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dmalloc library" >&5
$as_echo_n "checking for dmalloc library... " >&6; }
@@ -26917,8 +26961,8 @@ else
fi
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_ZLIB="yes"
for ac_header in zlib.h
do :
@@ -27003,7 +27047,7 @@ fi
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_ZLIB="no"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for zlib" >&5
$as_echo_n "checking for zlib... " >&6; }
@@ -27157,8 +27201,8 @@ else
fi
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_SZLIB="yes"
for ac_header in szlib.h
do :
@@ -27235,7 +27279,7 @@ fi
as_fn_error $? "couldn't find szlib library" "$LINENO" 5
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_SZLIB="no"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for szlib" >&5
$as_echo_n "checking for szlib... " >&6; }
@@ -29152,43 +29196,6 @@ $as_echo "no" >&6; }
esac
## ----------------------------------------------------------------------
-## Check if they would like the metadata trace file code compiled in
-##
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether metadata trace file code is enabled" >&5
-$as_echo_n "checking whether metadata trace file code is enabled... " >&6; }
-# Check whether --enable-metadata-trace-file was given.
-if test "${enable_metadata_trace_file+set}" = set; then :
- enableval=$enable_metadata_trace_file; METADATATRACEFILE=$enableval
-fi
-
-
-## Set the default level.
-if test "X-$METADATATRACEFILE" = X- ; then
- METADATATRACEFILE=no
-fi
-
-## Allow this variable to be substituted in
-## other files (src/libhdf5.settings.in, etc.)
-
-
-case "X-$METADATATRACEFILE" in
- X-yes)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-$as_echo "#define METADATA_TRACE_FILE 1" >>confdefs.h
-
- ;;
- X-no)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- *)
- as_fn_error $? "Unrecognized value: $METADATATRACEFILE" "$LINENO" 5
- ;;
-esac
-
-## ----------------------------------------------------------------------
## Enable tracing of the API
##
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for API tracing" >&5
@@ -30477,6 +30484,55 @@ $as_echo "no" >&6; }
fi
## ----------------------------------------------------------------------
+## Set the flag to indicate that the machine is IBM ppc64le and cannot
+## accurately convert some long double values.
+##
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the system is IBM ppc64le and cannot correctly convert some long double values" >&5
+$as_echo_n "checking if the system is IBM ppc64le and cannot correctly convert some long double values... " >&6; }
+
+TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_disable_some_ldouble_conv=${hdf5_cv_disable_some_ldouble_conv=no}
+else
+ if ${hdf5_cv_disable_some_ldouble_conv+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run test program while cross compiling
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$TEST_SRC
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ hdf5_cv_disable_some_ldouble_conv=yes
+else
+ hdf5_cv_disable_some_ldouble_conv=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+
+fi
+
+if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then
+
+$as_echo "#define DISABLE_SOME_LDOUBLE_CONV 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+## ----------------------------------------------------------------------
## Set some variables for general configuration information to be saved
## and installed with the libraries (used to generate libhdf5.settings).
##
@@ -30771,6 +30827,65 @@ esac
## ----------------------------------------------------------------------
+## Enable use of pread/pwrite instead of read/write in certain VFDs.
+##
+
+
+## Check these first to avoid interspersed output in the AC_ARG_ENABLE line
+## below. (Probably overkill to check for both, but we'll be extra careful)
+PREADWRITE_HAVE_BOTH=yes
+ac_fn_c_check_func "$LINENO" "pread" "ac_cv_func_pread"
+if test "x$ac_cv_func_pread" = xyes; then :
+
+else
+ PREADWRITE_HAVE_BOTH=no
+fi
+
+ac_fn_c_check_func "$LINENO" "pwrite" "ac_cv_func_pwrite"
+if test "x$ac_cv_func_pwrite" = xyes; then :
+
+else
+ PREADWRITE_HAVE_BOTH=no
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use pread/pwrite instead of read/write in certain VFDs" >&5
+$as_echo_n "checking whether to use pread/pwrite instead of read/write in certain VFDs... " >&6; }
+# Check whether --enable-preadwrite was given.
+if test "${enable_preadwrite+set}" = set; then :
+ enableval=$enable_preadwrite; PREADWRITE=$enableval
+fi
+
+
+## Set the default level.
+if test "X-$PREADWRITE" = X- ; then
+ PREADWRITE=yes
+fi
+
+case "X-$PREADWRITE" in
+ X-yes)
+ if test "X-$PREADWRITE_HAVE_BOTH" = "X-yes"; then
+
+$as_echo "#define HAVE_PREADWRITE 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ X-no)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ *)
+ as_fn_error $? "Unrecognized value: $PREADWRITE" "$LINENO" 5
+ ;;
+esac
+
+
+## ----------------------------------------------------------------------
## Enable embedded library information
##
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to have library information embedded in the executables" >&5
@@ -31332,7 +31447,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-HDF5 config.lt 1.10.4
+HDF5 config.lt 1.10.5
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -32791,7 +32906,7 @@ else
fi
-ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/H5srcdir_str.h test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh test/testlibinfo.sh test/testlinks_env.sh test/testswmr.sh test/testvdsswmr.sh test/test_filenotclosed.sh test/test_filter_plugin.sh test/test_usecases.sh testpar/Makefile tools/Makefile tools/lib/Makefile tools/src/Makefile tools/src/h5dump/Makefile tools/src/h5import/Makefile tools/src/h5diff/Makefile tools/src/h5jam/Makefile tools/src/h5repack/Makefile tools/src/h5ls/Makefile tools/src/h5copy/Makefile tools/src/misc/Makefile tools/src/misc/h5cc tools/src/h5stat/Makefile tools/test/Makefile tools/test/h5dump/Makefile tools/test/h5dump/h5dump_plugin.sh tools/test/h5dump/testh5dump.sh tools/test/h5dump/testh5dumppbits.sh tools/test/h5dump/testh5dumpvds.sh tools/test/h5dump/testh5dumpxml.sh tools/test/h5ls/Makefile tools/test/h5ls/h5ls_plugin.sh tools/test/h5ls/testh5ls.sh tools/test/h5ls/testh5lsvds.sh tools/test/h5import/Makefile tools/test/h5import/h5importtestutil.sh tools/test/h5diff/Makefile tools/test/h5diff/h5diff_plugin.sh tools/test/h5diff/testh5diff.sh tools/test/h5diff/testph5diff.sh tools/src/h5format_convert/Makefile tools/test/h5format_convert/Makefile tools/test/h5format_convert/testh5fc.sh tools/test/h5jam/Makefile tools/test/h5jam/testh5jam.sh tools/test/h5repack/Makefile tools/test/h5repack/h5repack.sh tools/test/h5repack/h5repack_plugin.sh tools/test/h5copy/Makefile tools/test/h5copy/testh5copy.sh tools/test/misc/Makefile tools/test/misc/testh5clear.sh tools/test/misc/testh5mkgrp.sh tools/test/misc/testh5repart.sh tools/test/misc/vds/Makefile tools/test/h5stat/Makefile tools/test/h5stat/testh5stat.sh tools/test/perform/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/src/H5fort_type_defines.h fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh java/Makefile java/src/Makefile java/src/jni/Makefile java/test/Makefile java/test/junit.sh java/examples/Makefile java/examples/intro/Makefile java/examples/intro/JavaIntroExample.sh java/examples/datasets/Makefile java/examples/datasets/JavaDatasetExample.sh java/examples/datatypes/Makefile java/examples/datatypes/JavaDatatypeExample.sh java/examples/groups/Makefile java/examples/groups/JavaGroupExample.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/tools/h5watch/Makefile hl/tools/h5watch/testh5watch.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh"
+ac_config_files="$ac_config_files src/libhdf5.settings Makefile src/Makefile test/Makefile test/H5srcdir_str.h test/testabort_fail.sh test/testcheck_version.sh test/testerror.sh test/testflushrefresh.sh test/testlibinfo.sh test/testlinks_env.sh test/testswmr.sh test/testvdsswmr.sh test/test_filter_plugin.sh test/test_usecases.sh testpar/Makefile testpar/testpflush.sh tools/Makefile tools/lib/Makefile tools/src/Makefile tools/src/h5dump/Makefile tools/src/h5import/Makefile tools/src/h5diff/Makefile tools/src/h5jam/Makefile tools/src/h5repack/Makefile tools/src/h5ls/Makefile tools/src/h5copy/Makefile tools/src/misc/Makefile tools/src/misc/h5cc tools/src/h5stat/Makefile tools/test/Makefile tools/test/h5dump/Makefile tools/test/h5dump/h5dump_plugin.sh tools/test/h5dump/testh5dump.sh tools/test/h5dump/testh5dumppbits.sh tools/test/h5dump/testh5dumpvds.sh tools/test/h5dump/testh5dumpxml.sh tools/test/h5ls/Makefile tools/test/h5ls/h5ls_plugin.sh tools/test/h5ls/testh5ls.sh tools/test/h5ls/testh5lsvds.sh tools/test/h5import/Makefile tools/test/h5import/h5importtestutil.sh tools/test/h5diff/Makefile tools/test/h5diff/h5diff_plugin.sh tools/test/h5diff/testh5diff.sh tools/test/h5diff/testph5diff.sh tools/src/h5format_convert/Makefile tools/test/h5format_convert/Makefile tools/test/h5format_convert/testh5fc.sh tools/test/h5jam/Makefile tools/test/h5jam/testh5jam.sh tools/test/h5repack/Makefile tools/test/h5repack/h5repack.sh tools/test/h5repack/h5repack_plugin.sh tools/test/h5copy/Makefile tools/test/h5copy/testh5copy.sh tools/test/misc/Makefile tools/test/misc/testh5clear.sh tools/test/misc/testh5mkgrp.sh tools/test/misc/testh5repart.sh tools/test/misc/vds/Makefile tools/test/h5stat/Makefile tools/test/h5stat/testh5stat.sh tools/test/perform/Makefile examples/Makefile examples/run-c-ex.sh examples/testh5cc.sh c++/Makefile c++/src/Makefile c++/src/h5c++ c++/test/Makefile c++/test/H5srcdir_str.h c++/examples/Makefile c++/examples/run-c++-ex.sh c++/examples/testh5c++.sh fortran/Makefile fortran/src/h5fc fortran/src/Makefile fortran/src/H5fort_type_defines.h fortran/test/Makefile fortran/testpar/Makefile fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh java/Makefile java/src/Makefile java/src/jni/Makefile java/test/Makefile java/test/junit.sh java/examples/Makefile java/examples/intro/Makefile java/examples/intro/JavaIntroExample.sh java/examples/datasets/Makefile java/examples/datasets/JavaDatasetExample.sh java/examples/datatypes/Makefile java/examples/datatypes/JavaDatatypeExample.sh java/examples/groups/Makefile java/examples/groups/JavaGroupExample.sh hl/Makefile hl/src/Makefile hl/test/Makefile hl/test/H5srcdir_str.h hl/tools/Makefile hl/tools/gif2h5/Makefile hl/tools/gif2h5/h52giftest.sh hl/tools/h5watch/Makefile hl/tools/h5watch/testh5watch.sh hl/examples/Makefile hl/examples/run-hlc-ex.sh hl/c++/Makefile hl/c++/src/Makefile hl/c++/test/Makefile hl/c++/examples/Makefile hl/c++/examples/run-hlc++-ex.sh hl/fortran/Makefile hl/fortran/src/Makefile hl/fortran/test/Makefile hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh"
ac_config_commands="$ac_config_commands .classes"
@@ -33380,7 +33495,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by HDF5 $as_me 1.10.4, which was
+This file was extended by HDF5 $as_me 1.10.5, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -33446,7 +33561,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-HDF5 config.status 1.10.4
+HDF5 config.status 1.10.5
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
@@ -34059,6 +34174,7 @@ do
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"test/H5srcdir_str.h") CONFIG_FILES="$CONFIG_FILES test/H5srcdir_str.h" ;;
+ "test/testabort_fail.sh") CONFIG_FILES="$CONFIG_FILES test/testabort_fail.sh" ;;
"test/testcheck_version.sh") CONFIG_FILES="$CONFIG_FILES test/testcheck_version.sh" ;;
"test/testerror.sh") CONFIG_FILES="$CONFIG_FILES test/testerror.sh" ;;
"test/testflushrefresh.sh") CONFIG_FILES="$CONFIG_FILES test/testflushrefresh.sh" ;;
@@ -34066,10 +34182,10 @@ do
"test/testlinks_env.sh") CONFIG_FILES="$CONFIG_FILES test/testlinks_env.sh" ;;
"test/testswmr.sh") CONFIG_FILES="$CONFIG_FILES test/testswmr.sh" ;;
"test/testvdsswmr.sh") CONFIG_FILES="$CONFIG_FILES test/testvdsswmr.sh" ;;
- "test/test_filenotclosed.sh") CONFIG_FILES="$CONFIG_FILES test/test_filenotclosed.sh" ;;
"test/test_filter_plugin.sh") CONFIG_FILES="$CONFIG_FILES test/test_filter_plugin.sh" ;;
"test/test_usecases.sh") CONFIG_FILES="$CONFIG_FILES test/test_usecases.sh" ;;
"testpar/Makefile") CONFIG_FILES="$CONFIG_FILES testpar/Makefile" ;;
+ "testpar/testpflush.sh") CONFIG_FILES="$CONFIG_FILES testpar/testpflush.sh" ;;
"tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
"tools/lib/Makefile") CONFIG_FILES="$CONFIG_FILES tools/lib/Makefile" ;;
"tools/src/Makefile") CONFIG_FILES="$CONFIG_FILES tools/src/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 3f06676..7246485 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,7 +24,7 @@ AC_PREREQ([2.69])
## NOTE: Do not forget to change the version number here when we do a
## release!!!
##
-AC_INIT([HDF5], [1.10.4], [help@hdfgroup.org])
+AC_INIT([HDF5], [1.10.5], [help@hdfgroup.org])
AC_CONFIG_SRCDIR([src/H5.c])
AC_CONFIG_HEADERS([src/H5config.h])
@@ -1131,11 +1131,12 @@ case "$host_cpu-$host_vendor-$host_os" in
## functionality so clock_gettime and CLOCK_MONOTONIC are defined
## correctly. This was later updated to 200112L so that
## posix_memalign() is visible for the direct VFD code on Linux
- ## systems.
+ ## systems. Even later, this was changed to 200809L to support
+ ## pread/pwrite in VFDs.
##
## POSIX feature information can be found in the gcc manual at:
## http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- H5_CPPFLAGS="-D_POSIX_C_SOURCE=200112L $H5_CPPFLAGS"
+ H5_CPPFLAGS="-D_POSIX_C_SOURCE=200809L $H5_CPPFLAGS"
## Need to add this so that O_DIRECT is visible for the direct
## VFD on Linux systems.
@@ -1211,6 +1212,15 @@ EOF
AC_CHECK_SIZEOF([bool])
fi
+AC_CHECK_SIZEOF(time_t, [], [
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+])
+
## Checkpoint the cache
AC_CACHE_SAVE
@@ -1262,8 +1272,8 @@ AC_ARG_WITH([dmalloc],
[Use dmalloc memory debugging aid [default=no]])],,
[withval=no])
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_DMALLOC="yes"
AC_CHECK_HEADERS([dmalloc.h],, [unset HAVE_DMALLOC])
if test "x$HAVE_DMALLOC" = "xyes"; then
@@ -1273,7 +1283,7 @@ case $withval in
AC_MSG_ERROR([couldn't find dmalloc library])
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_DMALLOC="no"
AC_MSG_CHECKING([for dmalloc library])
AC_MSG_RESULT([suppressed])
@@ -1341,8 +1351,8 @@ AC_ARG_WITH([zlib],
filter [default=yes]])],,
[withval=yes])
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_ZLIB="yes"
AC_CHECK_HEADERS([zlib.h], [HAVE_ZLIB_H="yes"], [unset HAVE_ZLIB])
if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes"; then
@@ -1356,7 +1366,7 @@ case $withval in
AC_CHECK_FUNC([compress2], [HAVE_COMPRESS2="yes"])
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_ZLIB="no"
AC_MSG_CHECKING([for zlib])
AC_MSG_RESULT([suppressed])
@@ -1435,8 +1445,8 @@ AC_ARG_WITH([szlib],
filter [default=no]])],,
[withval=no])
-case $withval in
- yes)
+case "X-$withval" in
+ X-yes)
HAVE_SZLIB="yes"
AC_CHECK_HEADERS([szlib.h], [HAVE_SZLIB_H="yes"], [unset HAVE_SZLIB])
if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then
@@ -1446,7 +1456,7 @@ case $withval in
AC_MSG_ERROR([couldn't find szlib library])
fi
;;
- no)
+ X-|X-no|X-none)
HAVE_SZLIB="no"
AC_MSG_CHECKING([for szlib])
AC_MSG_RESULT([suppressed])
@@ -2290,40 +2300,6 @@ case "X-$CODESTACK" in
esac
## ----------------------------------------------------------------------
-## Check if they would like the metadata trace file code compiled in
-##
-AC_MSG_CHECKING([whether metadata trace file code is enabled])
-AC_ARG_ENABLE([metadata-trace-file],
- [AS_HELP_STRING([--enable-metadata-trace-file],
- [Enable metadata trace file collection.
- [default=no]
- ])],
- [METADATATRACEFILE=$enableval])
-
-## Set the default level.
-if test "X-$METADATATRACEFILE" = X- ; then
- METADATATRACEFILE=no
-fi
-
-## Allow this variable to be substituted in
-## other files (src/libhdf5.settings.in, etc.)
-AC_SUBST([METADATATRACEFILE])
-
-case "X-$METADATATRACEFILE" in
- X-yes)
- AC_MSG_RESULT([yes])
- AC_DEFINE([METADATA_TRACE_FILE], [1],
- [Define if the metadata trace file code is to be compiled in])
- ;;
- X-no)
- AC_MSG_RESULT([no])
- ;;
- *)
- AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE])
- ;;
-esac
-
-## ----------------------------------------------------------------------
## Enable tracing of the API
##
AC_MSG_CHECKING([for API tracing]);
@@ -2995,6 +2971,30 @@ else
fi
## ----------------------------------------------------------------------
+## Set the flag to indicate that the machine is IBM ppc64le and cannot
+## accurately convert some long double values.
+##
+AC_MSG_CHECKING([if the system is IBM ppc64le and cannot correctly convert some long double values])
+
+TEST_SRC="`(echo \"#define H5_DISABLE_SOME_LDOUBLE_CONV_TEST 1\"; cat $srcdir/config/cmake/ConversionTests.c)`"
+
+if test ${ac_cv_sizeof_long_double} = 0; then
+ hdf5_cv_disable_some_ldouble_conv=${hdf5_cv_disable_some_ldouble_conv=no}
+else
+ AC_CACHE_VAL([hdf5_cv_disable_some_ldouble_conv],
+ [AC_RUN_IFELSE([AC_LANG_SOURCE([$TEST_SRC])],
+ [hdf5_cv_disable_some_ldouble_conv=yes], [hdf5_cv_disable_some_ldouble_conv=no],[])])
+fi
+
+if test ${hdf5_cv_disable_some_ldouble_conv} = "yes"; then
+ AC_DEFINE([DISABLE_SOME_LDOUBLE_CONV], [1],
+ [Define if your system is IBM ppc64le and cannot convert some long double values correctly.])
+ AC_MSG_RESULT([yes])
+else
+ AC_MSG_RESULT([no])
+fi
+
+## ----------------------------------------------------------------------
## Set some variables for general configuration information to be saved
## and installed with the libraries (used to generate libhdf5.settings).
##
@@ -3263,6 +3263,47 @@ esac
## ----------------------------------------------------------------------
+## Enable use of pread/pwrite instead of read/write in certain VFDs.
+##
+AC_SUBST([PREADWRITE])
+
+## Check these first to avoid interspersed output in the AC_ARG_ENABLE line
+## below. (Probably overkill to check for both, but we'll be extra careful)
+PREADWRITE_HAVE_BOTH=yes
+AC_CHECK_FUNC([pread], [], [PREADWRITE_HAVE_BOTH=no])
+AC_CHECK_FUNC([pwrite], [], [PREADWRITE_HAVE_BOTH=no])
+
+AC_MSG_CHECKING([whether to use pread/pwrite instead of read/write in certain VFDs])
+AC_ARG_ENABLE([preadwrite],
+ [AS_HELP_STRING([--enable-preadwrite],
+ [Enable using pread/pwrite instead of read/write in sec2/log/core VFDs.
+ [default=yes if pread/pwrite are present]])],
+ [PREADWRITE=$enableval])
+
+## Set the default level.
+if test "X-$PREADWRITE" = X- ; then
+ PREADWRITE=yes
+fi
+
+case "X-$PREADWRITE" in
+ X-yes)
+ if test "X-$PREADWRITE_HAVE_BOTH" = "X-yes"; then
+ AC_DEFINE([HAVE_PREADWRITE], [1], [Define if both pread and pwrite exist.])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ X-no)
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $PREADWRITE])
+ ;;
+esac
+
+
+## ----------------------------------------------------------------------
## Enable embedded library information
##
AC_MSG_CHECKING([whether to have library information embedded in the executables])
@@ -3429,6 +3470,7 @@ AC_CONFIG_FILES([src/libhdf5.settings
src/Makefile
test/Makefile
test/H5srcdir_str.h
+ test/testabort_fail.sh
test/testcheck_version.sh
test/testerror.sh
test/testflushrefresh.sh
@@ -3436,10 +3478,10 @@ AC_CONFIG_FILES([src/libhdf5.settings
test/testlinks_env.sh
test/testswmr.sh
test/testvdsswmr.sh
- test/test_filenotclosed.sh
test/test_filter_plugin.sh
test/test_usecases.sh
testpar/Makefile
+ testpar/testpflush.sh
tools/Makefile
tools/lib/Makefile
tools/src/Makefile
diff --git a/examples/CMakeTests.cmake b/examples/CMakeTests.cmake
index dd4766a..cb47c78 100644
--- a/examples/CMakeTests.cmake
+++ b/examples/CMakeTests.cmake
@@ -181,42 +181,42 @@
### Windows pops up a modal permission dialog on this test
if (H5_HAVE_PARALLEL AND NOT WIN32)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME EXAMPLES-ph5example COMMAND $<TARGET_FILE:ph5example>)
+ add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example> ${MPIEXEC_POSTFLAGS})
else ()
- add_test (NAME EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:ph5example>"
+ add_test (NAME MPI_TEST_EXAMPLES-ph5example COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5example>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=ph5example.txt"
- #-D "TEST_REFERENCE=ph5example.out"
+ -D "TEST_OUTPUT=ph5example.out"
+ -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors"
+ -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
endif ()
if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (MPI_TEST_EXAMPLES-ph5example PROPERTIES DEPENDS ${last_test})
endif ()
- set (last_test "EXAMPLES-ph5example")
+ set (last_test "MPI_TEST_EXAMPLES-ph5example")
if (BUILD_SHARED_LIBS)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME EXAMPLES-shared-ph5example COMMAND $<TARGET_FILE:ph5example-shared>)
+ add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5example-shared> ${MPIEXEC_POSTFLAGS})
else ()
- add_test (NAME EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:ph5example-shared>"
+ add_test (NAME MPI_TEST_EXAMPLES-shared-ph5example COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5example-shared>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=ph5example-shared.txt"
- #-D "TEST_REFERENCE=ph5example-shared.out"
+ -D "TEST_OUTPUT=ph5example-shared.out"
+ -D "TEST_REFERENCE:STRING=PHDF5 tests finished with no errors"
+ -D "TEST_FILTER:STRING=PHDF5 tests finished with no errors"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5EX-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ -P "${HDF_RESOURCES_EXT_DIR}/grepTest.cmake"
)
endif ()
- set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
+ set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/H5EX-shared)
if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (MPI_TEST_EXAMPLES-shared-ph5example PROPERTIES DEPENDS ${last_test})
endif ()
- set (last_test "EXAMPLES-shared-ph5example")
+ set (last_test "MPI_TEST_EXAMPLES-shared-ph5example")
endif ()
endif ()
diff --git a/examples/Makefile.in b/examples/Makefile.in
index bf484e2..4f5b84d 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -501,7 +501,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -535,6 +534,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1438,7 +1438,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/fortran/Makefile.in b/fortran/Makefile.in
index 892281d..6b6eb66 100644
--- a/fortran/Makefile.in
+++ b/fortran/Makefile.in
@@ -557,7 +557,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -591,6 +590,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1451,7 +1451,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/fortran/examples/CMakeTests.cmake b/fortran/examples/CMakeTests.cmake
index c3d94b4..face086 100644
--- a/fortran/examples/CMakeTests.cmake
+++ b/fortran/examples/CMakeTests.cmake
@@ -109,52 +109,50 @@ foreach (example ${examples})
endif ()
endforeach ()
-if (HDF5_ENABLE_F2003)
- foreach (example ${F2003_examples})
+foreach (example ${F2003_examples})
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME f03_ex_${example} COMMAND $<TARGET_FILE:f03_ex_${example}>)
+ else ()
+ add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_OUTPUT=f03_ex_${example}.txt"
+ #-D "TEST_REFERENCE=f03_ex_${example}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ endif ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "f03_ex_${example}")
+ if (BUILD_SHARED_LIBS)
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME f03_ex_${example} COMMAND $<TARGET_FILE:f03_ex_${example}>)
+ add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>)
else ()
- add_test (NAME f03_ex_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}>"
+ add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f03_ex_${example}.txt"
- #-D "TEST_REFERENCE=f03_ex_${example}.out"
+ -D "TEST_OUTPUT=f03_ex_${example}-shared.txt"
+ #-D "TEST_REFERENCE=f03_ex_${example}-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (f03_ex_${example} PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test})
endif ()
- set (last_test "f03_ex_${example}")
- if (BUILD_SHARED_LIBS)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME f03_ex-shared_${example} COMMAND $<TARGET_FILE:f03_ex_${example}-shared>)
- else ()
- add_test (NAME f03_ex-shared_${example} COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:f03_ex_${example}-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=f03_ex_${example}-shared.txt"
- #-D "TEST_REFERENCE=f03_ex_${example}-shared.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (f03_ex-shared_${example} PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "f03_ex-shared_${example}")
- endif ()
- endforeach ()
-endif ()
+ set (last_test "f03_ex-shared_${example}")
+ endif ()
+endforeach ()
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
- add_test (NAME f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
+ add_test (NAME MPI_TEST_f90_ex_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
if (BUILD_SHARED_LIBS)
- add_test (NAME f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
+ add_test (NAME MPI_TEST_f90_ex-shared_ph5example COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:f90_ex_ph5example> ${MPIEXEC_POSTFLAGS})
endif ()
endif ()
diff --git a/fortran/examples/Makefile.in b/fortran/examples/Makefile.in
index 9fa7de6..2307d40 100644
--- a/fortran/examples/Makefile.in
+++ b/fortran/examples/Makefile.in
@@ -506,7 +506,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -540,6 +539,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1426,7 +1426,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/fortran/examples/run-fortran-ex.sh.in b/fortran/examples/run-fortran-ex.sh.in
index da0c357..aa17f89 100644
--- a/fortran/examples/run-fortran-ex.sh.in
+++ b/fortran/examples/run-fortran-ex.sh.in
@@ -61,8 +61,6 @@ RunTest()
./$TEST_EXEC
}
-F2003_ENABLED=@HAVE_FORTRAN_2003@
-
################## MAIN ##################
# Run tests
@@ -97,17 +95,8 @@ then
RunTest mountexample &&\
rm mountexample &&\
RunTest compound &&\
- rm compound); then
- EXIT_VALUE=${EXIT_SUCCESS}
- else
- EXIT_VALUE=${EXIT_FAILURE}
- fi
-fi
-
-if [ $EXIT_VALUE -eq ${EXIT_SUCCESS} -a "$F2003_ENABLED" = "yes" ]
-then
-# Add attention tests for Fortran 2003 features
- if (RunTest rwdset_fortran2003 &&\
+ rm compound &&\
+ RunTest rwdset_fortran2003 &&\
rm rwdset_fortran2003 &&\
RunTest nested_derived_type &&\
rm nested_derived_type &&\
@@ -120,12 +109,11 @@ then
EXIT_VALUE=${EXIT_FAILURE}
fi
fi
-
# Cleanup
rm *.o
rm *.h5
echo
-exit $EXIT_VALUE
+exit $EXIT_VALUE
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
index 025fab5..f71e820 100644
--- a/fortran/src/CMakeLists.txt
+++ b/fortran/src/CMakeLists.txt
@@ -9,11 +9,7 @@ if (WIN32)
if (NOT H5_HAVE_PARALLEL)
set (H5_NOPAREXP ";")
endif ()
- if (NOT HDF5_ENABLE_F2003)
- set (H5_NOF03EXP ";")
- else ()
- set (H5_F03EXP ";")
- endif ()
+ set (H5_F03EXP ";")
configure_file (${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def.in ${HDF5_F90_SRC_BINARY_DIR}/hdf5_fortrandll.def @ONLY)
endif ()
endif ()
diff --git a/fortran/src/H5Aff.F90 b/fortran/src/H5Aff.F90
index 827b803..a728f2d 100644
--- a/fortran/src/H5Aff.F90
+++ b/fortran/src/H5Aff.F90
@@ -76,6 +76,9 @@ MODULE H5A
USE H5GLOBAL
+ PRIVATE h5awrite_char_scalar, h5awrite_ptr
+ PRIVATE h5aread_char_scalar, h5aread_ptr
+
INTERFACE h5awrite_f
MODULE PROCEDURE h5awrite_char_scalar
! This is the preferred way to call h5awrite
diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90
index 3915f72..77f0a15 100644
--- a/fortran/src/H5Dff.F90
+++ b/fortran/src/H5Dff.F90
@@ -90,6 +90,15 @@ MODULE H5D
USE, INTRINSIC :: ISO_C_BINDING
USE H5GLOBAL
+ PRIVATE h5dread_vl_integer, h5dread_vl_real, h5dread_vl_string
+ PRIVATE h5dwrite_vl_integer, h5dwrite_vl_real, h5dwrite_vl_string
+ PRIVATE h5dwrite_reference_obj, h5dwrite_reference_dsetreg, h5dwrite_char_scalar, h5dwrite_ptr
+ PRIVATE h5dread_reference_obj, h5dread_reference_dsetreg, h5dread_char_scalar, h5dread_ptr
+ PRIVATE h5dfill_integer, h5dfill_c_float, h5dfill_c_double, h5dfill_char
+#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0
+ PRIVATE h5dfill_c_long_double
+#endif
+
INTERFACE h5dextend_f
MODULE PROCEDURE h5dset_extent_f
END INTERFACE
diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90
index 358e421..bf797b2 100644
--- a/fortran/src/H5Fff.F90
+++ b/fortran/src/H5Fff.F90
@@ -874,4 +874,97 @@ CONTAINS
END SUBROUTINE h5fget_file_image_f
+!****s* H5F (F03)/h5fget_dset_no_attrs_hint_f_F03
+!
+! NAME
+! h5fget_dset_no_attrs_hint_f
+!
+! PURPOSE
+! Gets the value of the "minimize dataset headers" value which creates
+! smaller dataset object headers when its set and no attributes are present.
+!
+! INPUTS
+! file_id - Target file identifier.
+!
+! OUTPUTS
+! minimize - Value of the setting.
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! January 2019
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5fget_dset_no_attrs_hint_f(file_id, minimize, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: file_id
+ LOGICAL , INTENT(OUT) :: minimize
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_minimize
+
+ INTERFACE
+ INTEGER FUNCTION h5fget_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fget_dset_no_attrs_hint')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: file_id
+ LOGICAL(C_BOOL), INTENT(OUT) :: minimize
+ END FUNCTION h5fget_dset_no_attrs_hint_c
+ END INTERFACE
+
+ hdferr = INT(h5fget_dset_no_attrs_hint_c(file_id, c_minimize))
+
+ ! Transfer value of C C_BOOL type to Fortran LOGICAL
+ minimize = c_minimize
+
+ END SUBROUTINE h5fget_dset_no_attrs_hint_f
+
+!****s* H5F (F03)/h5fset_dset_no_attrs_hint_f_F03
+!
+! NAME
+! h5fset_dset_no_attrs_hint_f
+!
+! PURPOSE
+! Sets the value of the "minimize dataset headers" value which creates
+! smaller dataset object headers when its set and no attributes are present.
+!
+! INPUTS
+! file_id - Target file identifier.
+! minimize - Value of the setting.
+!
+! OUTPUTS
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! January 2019
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5fset_dset_no_attrs_hint_f(file_id, minimize, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: file_id
+ LOGICAL , INTENT(IN) :: minimize
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_minimize
+
+ INTERFACE
+ INTEGER FUNCTION h5fset_dset_no_attrs_hint_c(file_id, minimize) BIND(C, NAME='H5Fset_dset_no_attrs_hint')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: file_id
+ LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize
+ END FUNCTION h5fset_dset_no_attrs_hint_c
+ END INTERFACE
+
+ ! Transfer value of Fortran LOGICAL to C C_BOOL type
+ c_minimize = minimize
+
+ hdferr = INT(h5fset_dset_no_attrs_hint_c(file_id, c_minimize))
+
+ END SUBROUTINE h5fset_dset_no_attrs_hint_f
+
END MODULE H5F
+
diff --git a/fortran/src/H5Of.c b/fortran/src/H5Of.c
index 45b7f09..08305ea 100644
--- a/fortran/src/H5Of.c
+++ b/fortran/src/H5Of.c
@@ -27,11 +27,15 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info);
int_f
fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) {
+ /* This function does not used the field parameter because we want
+ * this function to fill the unfilled fields with C's default values.
+ */
+
struct tm *ts;
object_info->fileno = Oinfo.fileno;
object_info->addr = (haddr_t_f)Oinfo.addr;
-
+
object_info->type = (int_f)Oinfo.type;
object_info->rc = (int_f)Oinfo.rc;
@@ -96,6 +100,8 @@ fill_h5o_info_t_f(H5O_info_t Oinfo, H5O_info_t_f *object_info) {
object_info->meta_size.obj.index_size = (hsize_t_f)Oinfo.meta_size.obj.index_size;
object_info->meta_size.obj.heap_size = (hsize_t_f)Oinfo.meta_size.obj.heap_size;
+ object_info->meta_size.attr.index_size = (hsize_t_f)Oinfo.meta_size.attr.index_size;
+ object_info->meta_size.attr.heap_size = (hsize_t_f)Oinfo.meta_size.attr.heap_size;
return 0;
@@ -138,7 +144,7 @@ h5olink_c (hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen
* Call H5Olink function.
*/
if((hid_t_f)H5Olink((hid_t)*object_id, (hid_t)*new_loc_id, c_name,
- (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
+ (hid_t)*lcpl_id, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
done:
@@ -229,6 +235,7 @@ h5oclose_c ( hid_t_f *object_id )
* idx - Iteration position at which to start
* op - Callback function passing data regarding the link to the calling application
* op_data - User-defined pointer to data required by the application for its processing of the link
+ * fields - Flags specifying the fields to include in object_info.
*
* OUTPUTS
* idx - Position at which an interrupted iteration may be restarted
@@ -241,7 +248,7 @@ h5oclose_c ( hid_t_f *object_id )
* SOURCE
*/
int_f
-h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data )
+h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields )
/******/
{
int_f ret_value = -1; /* Return value */
@@ -250,7 +257,8 @@ h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op,
/*
* Call H5Ovisit2
*/
- func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, H5O_INFO_ALL);
+
+ func_ret_value = H5Ovisit2( (hid_t)*group_id, (H5_index_t)*index_type, (H5_iter_order_t)*order, op, op_data, (unsigned)*fields);
ret_value = (int_f)func_ret_value;
@@ -302,6 +310,7 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id)
* name - Name of group, relative to loc_id.
* namelen - Name length.
* lapl_id - Link access property list.
+ * fields - Flags specifying the fields to include in object_info.
* OUTPUTS
* object_info - Buffer in which to return object information.
*
@@ -314,7 +323,7 @@ h5oopen_by_addr_c (hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id)
*/
int_f
h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
- H5O_info_t_f *object_info)
+ H5O_info_t_f *object_info, int_f *fields)
/******/
{
char *c_name = NULL; /* Buffer to hold C string */
@@ -331,10 +340,10 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l
* Call H5Oinfo_by_name function.
*/
if(H5Oget_info_by_name2((hid_t)*loc_id, c_name,
- &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0)
+ &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
- ret_value = fill_h5o_info_t_f(Oinfo,object_info);
+ ret_value = fill_h5o_info_t_f(Oinfo, object_info);
done:
if(c_name)
@@ -354,6 +363,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l
* lapl_id - Link access property list.
* OUTPUTS
* object_info - Buffer in which to return object information.
+ * fields - Flags specifying the fields to include in object_info.
*
* RETURNS
* 0 on success, -1 on failure
@@ -364,7 +374,7 @@ h5oget_info_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *l
*/
int_f
h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info)
+ int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
@@ -386,7 +396,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
* Call H5Oinfo_by_idx function.
*/
if(H5Oget_info_by_idx2((hid_t)*loc_id, c_group_name, c_index_field, c_order, (hsize_t)*n,
- &Oinfo, H5O_INFO_ALL, (hid_t)*lapl_id) < 0)
+ &Oinfo, (unsigned)*fields, (hid_t)*lapl_id) < 0)
HGOTO_DONE(FAIL);
ret_value = fill_h5o_info_t_f(Oinfo,object_info);
@@ -404,6 +414,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
* Calls H5Oget_info
* INPUTS
* object_id - Identifier for target object.
+ * fields - Flags specifying the fields to include in object_info.
* OUTPUTS
* object_info - Buffer in which to return object information.
*
@@ -415,7 +426,7 @@ h5oget_info_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
* SOURCE
*/
int_f
-h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info)
+h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields)
/******/
{
int_f ret_value = 0; /* Return value */
@@ -424,7 +435,7 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info)
/*
* Call H5Oinfo_by_name function.
*/
- if(H5Oget_info2((hid_t)*object_id, &Oinfo, H5O_INFO_ALL) < 0)
+ if(H5Oget_info2((hid_t)*object_id, &Oinfo, (unsigned)*fields) < 0)
HGOTO_DONE(FAIL);
ret_value = fill_h5o_info_t_f(Oinfo,object_info);
@@ -457,8 +468,8 @@ h5oget_info_c (hid_t_f *object_id, H5O_info_t_f *object_info)
*/
int_f
h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
- hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
- hid_t_f *ocpypl_id, hid_t_f *lcpl_id )
+ hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
+ hid_t_f *ocpypl_id, hid_t_f *lcpl_id )
/******/
{
char *c_src_name = NULL; /* Buffer to hold C string */
@@ -478,7 +489,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
* Call H5Ocopy function.
*/
if(H5Ocopy( (hid_t)*src_loc_id, c_src_name, (hid_t)*dst_loc_id, c_dst_name,
- (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0)
+ (hid_t)*ocpypl_id, (hid_t)*lcpl_id) < 0)
HGOTO_DONE(FAIL);
done:
@@ -503,6 +514,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
* idx - Iteration position at which to start
* op - Callback function passing data regarding the link to the calling application
* op_data - User-defined pointer to data required by the application for its processing of the link
+ * fields - Flags specifying the fields to include in object_info.
*
* OUTPUTS
* idx - Position at which an interrupted iteration may be restarted
@@ -516,7 +528,7 @@ h5ocopy_c (hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
*/
int_f
h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
- H5O_iterate_t op, void *op_data, hid_t_f *lapl_id )
+ H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields )
/******/
{
int_f ret_value = -1; /* Return value */
@@ -533,7 +545,7 @@ h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f
* Call H5Ovisit
*/
func_ret_value = H5Ovisit_by_name2( (hid_t)*loc_id, c_object_name, (H5_index_t)*index_type, (H5_iter_order_t)*order,
- op, op_data, H5O_INFO_ALL, (hid_t)*lapl_id);
+ op, op_data, (unsigned)*fields, (hid_t)*lapl_id);
ret_value = (int_f)func_ret_value;
done:
@@ -763,7 +775,7 @@ h5oset_comment_by_name_c (hid_t_f *object_id, _fcd name, size_t_f *namelen, _fc
*/
int_f
h5oopen_by_idx_c (hid_t_f *loc_id, _fcd group_name, size_t_f *group_namelen,
- int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id)
+ int_f *index_type, int_f *order, hsize_t_f *n, hid_t_f *obj_id, hid_t_f *lapl_id)
/******/
{
char *c_group_name = NULL; /* Buffer to hold C string */
@@ -868,7 +880,7 @@ h5oget_comment_c (hid_t_f *object_id, _fcd comment, size_t_f *commentsize, hssi
*/
int_f
h5oget_comment_by_name_c (hid_t_f *loc_id, _fcd name, size_t_f *name_size,
- _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id)
+ _fcd comment, size_t_f *commentsize, size_t_f *bufsize, hid_t_f *lapl_id)
/******/
{
char *c_comment = NULL; /* Buffer to hold C string */
diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90
index 243ec29..8c77230 100644
--- a/fortran/src/H5Off.F90
+++ b/fortran/src/H5Off.F90
@@ -69,6 +69,15 @@ MODULE H5O
TYPE(mesg_t) :: mesg
END TYPE hdr_t
+ TYPE, BIND(C) :: c_hdr_t
+ INTEGER(C_INT) :: version ! Version number of header format in file
+ INTEGER(C_INT) :: nmesgs ! Number of object header messages
+ INTEGER(C_INT) :: nchunks ! Number of object header chunks
+ INTEGER(C_INT) :: flags ! Object header status flags
+ TYPE(space_t) :: space
+ TYPE(mesg_t) :: mesg
+ END TYPE c_hdr_t
+
! Extra metadata storage for obj & attributes
TYPE, BIND(C) :: H5_ih_info_t
INTEGER(hsize_t) :: index_size ! btree and/or list
@@ -83,7 +92,7 @@ MODULE H5O
TYPE, BIND(C) :: h5o_info_t
INTEGER(C_LONG) :: fileno ! File number that object is located in
INTEGER(haddr_t) :: addr ! Object address in file
- INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.)
+ INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.)
INTEGER :: rc ! Reference count of object
INTEGER, DIMENSION(8) :: atime ! Access time ! -- NOTE --
@@ -98,6 +107,28 @@ MODULE H5O
TYPE(meta_size_t) :: meta_size
END TYPE h5o_info_t
+! C interoperable structure for h5o_info_t. The Fortran derived type returns the time
+! values as an integer array as specified in the Fortran intrinsic DATE_AND_TIME(VALUES).
+! Whereas, this derived type does not.
+
+ TYPE, BIND(C) :: c_h5o_info_t
+ INTEGER(C_LONG) :: fileno ! File number that object is located in
+ INTEGER(haddr_t) :: addr ! Object address in file
+ INTEGER(C_INT) :: type ! Basic object type (group, dataset, etc.)
+ INTEGER(C_INT) :: rc ! Reference count of object
+
+ INTEGER(KIND=TIME_T) :: atime ! Access time
+ INTEGER(KIND=TIME_T) :: mtime ! modify time
+ INTEGER(KIND=TIME_T) :: ctime ! create time
+ INTEGER(KIND=TIME_T) :: btime ! Access time
+
+ INTEGER(hsize_t) :: num_attrs ! # of attributes attached to object
+
+ TYPE(c_hdr_t) :: hdr
+
+ TYPE(meta_size_t) :: meta_size
+ END TYPE c_h5o_info_t
+
!*****
CONTAINS
@@ -834,12 +865,16 @@ CONTAINS
! return_value - returns the return value of the first operator that returns a positive value, or
! zero if all members were processed with no operator returning non-zero.
! hdferr - Returns 0 if successful and -1 if fails
+!
+! Optional parameters:
+! fields - Flags specifying the fields to include in object_info.
+!
! AUTHOR
! M. Scot Breitenfeld
! November 19, 2008
!
! Fortran2003 Interface:
- SUBROUTINE h5ovisit_f(object_id, index_type, order, op, op_data, return_value, hdferr)
+ SUBROUTINE h5ovisit_f(object_id, index_type, order, op, op_data, return_value, hdferr, fields)
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: object_id
INTEGER, INTENT(IN) :: index_type
@@ -849,10 +884,12 @@ CONTAINS
TYPE(C_PTR) :: op_data
INTEGER, INTENT(OUT) :: return_value
INTEGER, INTENT(OUT) :: hdferr
+ INTEGER, INTENT(IN), OPTIONAL :: fields
!*****
+ INTEGER :: fields_c
INTERFACE
- INTEGER FUNCTION h5ovisit_c(object_id, index_type, order, op, op_data) &
+ INTEGER FUNCTION h5ovisit_c(object_id, index_type, order, op, op_data, fields) &
BIND(C, NAME='h5ovisit_c')
IMPORT :: C_FUNPTR, C_PTR
IMPORT :: HID_T
@@ -862,10 +899,14 @@ CONTAINS
INTEGER, INTENT(IN) :: order
TYPE(C_FUNPTR), VALUE :: op
TYPE(C_PTR), VALUE :: op_data
+ INTEGER, INTENT(IN) :: fields
END FUNCTION h5ovisit_c
END INTERFACE
- return_value = h5ovisit_c(object_id, index_type, order, op, op_data)
+ fields_c = H5O_INFO_ALL_F
+ IF(PRESENT(fields)) fields_c = fields
+
+ return_value = h5ovisit_c(object_id, index_type, order, op, op_data, fields_c)
IF(return_value.GE.0)THEN
hdferr = 0
@@ -894,26 +935,29 @@ CONTAINS
!
! Optional parameters:
! lapl_id - Link access property list.
+! fields - Flags specifying the fields to include in object_info.
!
! AUTHOR
! M. Scot Breitenfeld
! December 1, 2008
!
! Fortran2003 Interface:
- SUBROUTINE h5oget_info_by_name_f(loc_id, name, object_info, hdferr, lapl_id)
+ SUBROUTINE h5oget_info_by_name_f(loc_id, name, object_info, hdferr, lapl_id, fields)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: name
TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
+ INTEGER , INTENT(IN) , OPTIONAL :: fields
!*****
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
TYPE(C_PTR) :: ptr
+ INTEGER :: fields_c
INTERFACE
- INTEGER FUNCTION h5oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, object_info) &
+ INTEGER FUNCTION h5oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, object_info, fields) &
BIND(C, NAME='h5oget_info_by_name_c')
IMPORT :: c_char, c_ptr
IMPORT :: HID_T, SIZE_T
@@ -923,10 +967,13 @@ CONTAINS
INTEGER(SIZE_T) , INTENT(IN) :: namelen
INTEGER(HID_T) , INTENT(IN) :: lapl_id_default
TYPE(C_PTR),VALUE :: object_info
-
+ INTEGER , INTENT(IN) :: fields
END FUNCTION h5oget_info_by_name_c
END INTERFACE
+ fields_c = H5O_INFO_ALL_F
+ IF(PRESENT(fields)) fields_c = fields
+
namelen = LEN(name)
lapl_id_default = H5P_DEFAULT_F
@@ -934,7 +981,7 @@ CONTAINS
ptr = C_LOC(object_info)
- hdferr = H5Oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, ptr)
+ hdferr = H5Oget_info_by_name_c(loc_id, name, namelen, lapl_id_default, ptr, fields_c)
END SUBROUTINE H5Oget_info_by_name_f
@@ -953,34 +1000,43 @@ CONTAINS
! object_info - Buffer in which to return object information.
! hdferr - Returns 0 if successful and -1 if fails.
!
+! Optional parameters:
+! fields - Flags specifying the fields to include in object_info.
+!
! AUTHOR
! M. Scot Breitenfeld
! May 11, 2012
!
! Fortran2003 Interface:
- SUBROUTINE h5oget_info_f(object_id, object_info, hdferr)
+ SUBROUTINE h5oget_info_f(object_id, object_info, hdferr, fields)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: object_id
TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info
INTEGER , INTENT(OUT) :: hdferr
+ INTEGER , INTENT(IN), OPTIONAL :: fields
!*****
TYPE(C_PTR) :: ptr
-
+ INTEGER :: fields_c
+
INTERFACE
- INTEGER FUNCTION h5oget_info_c(object_id, object_info) &
+ INTEGER FUNCTION h5oget_info_c(object_id, object_info, fields) &
BIND(C, NAME='h5oget_info_c')
IMPORT :: C_PTR
IMPORT :: HID_T
IMPLICIT NONE
INTEGER(HID_T), INTENT(IN) :: object_id
TYPE(C_PTR), VALUE :: object_info
+ INTEGER, INTENT(IN) :: fields
END FUNCTION h5oget_info_c
END INTERFACE
+ fields_c = H5O_INFO_ALL_F
+ IF(PRESENT(fields)) fields_c = fields
+
ptr = C_LOC(object_info)
- hdferr = H5Oget_info_c(object_id, ptr)
+ hdferr = H5Oget_info_c(object_id, ptr, fields_c)
END SUBROUTINE H5Oget_info_f
@@ -1006,6 +1062,7 @@ CONTAINS
!
! Optional parameters:
! lapl_id - Link access property list. (Not currently used.)
+! fields - Flags specifying the fields to include in object_info.
!
! AUTHOR
! M. Scot Breitenfeld
@@ -1013,7 +1070,7 @@ CONTAINS
!
! Fortran2003 Interface:
SUBROUTINE h5oget_info_by_idx_f(loc_id, group_name, index_field, order, n, &
- object_info, hdferr, lapl_id)
+ object_info, hdferr, lapl_id, fields)
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
@@ -1025,14 +1082,16 @@ CONTAINS
TYPE(h5o_info_t), INTENT(OUT), TARGET :: object_info
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
+ INTEGER , INTENT(IN) , OPTIONAL :: fields
!*****
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
TYPE(C_PTR) :: ptr
+ INTEGER :: fields_c
INTERFACE
INTEGER FUNCTION h5oget_info_by_idx_c(loc_id, group_name, namelen, &
- index_field, order, n, lapl_id_default, object_info) BIND(C, NAME='h5oget_info_by_idx_c')
+ index_field, order, n, lapl_id_default, object_info, fields) BIND(C, NAME='h5oget_info_by_idx_c')
IMPORT :: c_char, c_ptr, c_funptr
IMPORT :: HID_T, SIZE_T, HSIZE_T
INTEGER(HID_T) , INTENT(IN) :: loc_id
@@ -1043,17 +1102,20 @@ CONTAINS
INTEGER(HSIZE_T), INTENT(IN) :: n
INTEGER(HID_T) , INTENT(IN) :: lapl_id_default
TYPE(C_PTR), VALUE :: object_info
-
+ INTEGER, INTENT(IN) :: fields
END FUNCTION h5oget_info_by_idx_c
END INTERFACE
+ fields_c = H5O_INFO_ALL_F
+ IF(PRESENT(fields)) fields_c = fields
+
namelen = LEN(group_name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
ptr = C_LOC(object_info)
- hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr)
+ hdferr = H5Oget_info_by_idx_c(loc_id, group_name, namelen, index_field, order, n, lapl_id_default, ptr, fields_c)
END SUBROUTINE H5Oget_info_by_idx_f
@@ -1086,6 +1148,7 @@ CONTAINS
!
! Optional parameters:
! lapl_id - Link access property list identifier.
+! fields - Flags specifying the fields to include in object_info.
!
! AUTHOR
! M. Scot Breitenfeld
@@ -1093,7 +1156,7 @@ CONTAINS
!
! Fortran2003 Interface:
SUBROUTINE h5ovisit_by_name_f(loc_id, object_name, index_type, order, op, op_data, &
- return_value, hdferr, lapl_id)
+ return_value, hdferr, lapl_id, fields)
IMPLICIT NONE
INTEGER(HID_T) , INTENT(IN) :: loc_id
CHARACTER(LEN=*), INTENT(IN) :: object_name
@@ -1105,14 +1168,16 @@ CONTAINS
INTEGER , INTENT(OUT) :: return_value
INTEGER , INTENT(OUT) :: hdferr
INTEGER(HID_T) , INTENT(IN) , OPTIONAL :: lapl_id
+ INTEGER , INTENT(IN) , OPTIONAL :: fields
!*****
INTEGER(SIZE_T) :: namelen
INTEGER(HID_T) :: lapl_id_default
+ INTEGER :: fields_c
INTERFACE
INTEGER FUNCTION h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, &
- op, op_data, lapl_id) BIND(C, NAME='h5ovisit_by_name_c')
+ op, op_data, lapl_id, fields) BIND(C, NAME='h5ovisit_by_name_c')
IMPORT :: C_CHAR, C_PTR, C_FUNPTR
IMPORT :: HID_T, SIZE_T
IMPLICIT NONE
@@ -1124,16 +1189,20 @@ CONTAINS
TYPE(C_FUNPTR) , VALUE :: op
TYPE(C_PTR) , VALUE :: op_data
INTEGER(HID_T) , INTENT(IN) :: lapl_id
+ INTEGER , INTENT(IN) :: fields
END FUNCTION h5ovisit_by_name_c
END INTERFACE
+ fields_c = H5O_INFO_ALL_F
+ IF(PRESENT(fields)) fields_c = fields
+
namelen = LEN(object_name)
lapl_id_default = H5P_DEFAULT_F
IF(PRESENT(lapl_id)) lapl_id_default = lapl_id
return_value = h5ovisit_by_name_c(loc_id, object_name, namelen, index_type, order, &
- op, op_data, lapl_id_default)
+ op, op_data, lapl_id_default, fields_c)
IF(return_value.GE.0)THEN
hdferr = 0
diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90
index afb9136..13a2953 100644
--- a/fortran/src/H5Pff.F90
+++ b/fortran/src/H5Pff.F90
@@ -42,6 +42,14 @@ MODULE H5P
USE H5GLOBAL
USE H5fortkit
+ PRIVATE h5pset_fapl_multi_l, h5pset_fapl_multi_s
+ PRIVATE h5pset_fill_value_integer, h5pset_fill_value_char, h5pset_fill_value_ptr
+ PRIVATE h5pget_fill_value_integer, h5pget_fill_value_char, h5pget_fill_value_ptr
+ PRIVATE h5pset_integer, h5pset_char, h5pset_ptr
+ PRIVATE h5pget_integer, h5pget_char, h5pget_ptr
+ PRIVATE h5pregister_integer, h5pregister_ptr
+ PRIVATE h5pinsert_integer, h5pinsert_char, h5pinsert_ptr
+
INTERFACE h5pset_fapl_multi_f
MODULE PROCEDURE h5pset_fapl_multi_l
MODULE PROCEDURE h5pset_fapl_multi_s
@@ -8015,8 +8023,97 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len)
END SUBROUTINE h5pget_virtual_dsetname_f
+!****s* H5P (F03)/h5pget_dset_no_attrs_hint_f_F03
+!
+! NAME
+! h5pget_dset_no_attrs_hint_f
+!
+! PURPOSE
+! Gets the value of the "minimize dataset headers" value which creates
+! smaller dataset object headers when its set and no attributes are present.
+!
+! INPUTS
+! dcpl_id - Target dataset creation property list identifier.
+!
+! OUTPUTS
+! minimize - Value of the setting.
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! January 2019
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5pget_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: dcpl_id
+ LOGICAL , INTENT(OUT) :: minimize
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_minimize
+
+ INTERFACE
+ INTEGER FUNCTION h5pget_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pget_dset_no_attrs_hint')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id
+ LOGICAL(C_BOOL), INTENT(OUT) :: minimize
+ END FUNCTION h5pget_dset_no_attrs_hint_c
+ END INTERFACE
+
+ hdferr = INT(h5pget_dset_no_attrs_hint_c(dcpl_id, c_minimize))
-END MODULE H5P
+ ! Transfer value of C C_BOOL type to Fortran LOGICAL
+ minimize = c_minimize
+
+ END SUBROUTINE h5pget_dset_no_attrs_hint_f
+!****s* H5P (F03)/h5pset_dset_no_attrs_hint_f_F03
+!
+! NAME
+! h5pset_dset_no_attrs_hint_f
+!
+! PURPOSE
+! Sets the value of the "minimize dataset headers" value which creates
+! smaller dataset object headers when its set and no attributes are present.
+!
+! INPUTS
+! dcpl_id - Target dataset creation property list identifier.
+! minimize - Value of the setting.
+!
+! OUTPUTS
+! hdferr - error code:
+! 0 on success and -1 on failure
+!
+! AUTHOR
+! Dana Robinson
+! January 2019
+!
+! Fortran2003 Interface:
+ SUBROUTINE h5pset_dset_no_attrs_hint_f(dcpl_id, minimize, hdferr)
+ IMPLICIT NONE
+ INTEGER(HID_T) , INTENT(IN) :: dcpl_id
+ LOGICAL , INTENT(IN) :: minimize
+ INTEGER , INTENT(OUT) :: hdferr
+!*****
+ LOGICAL(C_BOOL) :: c_minimize
+
+ INTERFACE
+ INTEGER FUNCTION h5pset_dset_no_attrs_hint_c(dcpl_id, minimize) BIND(C, NAME='H5Pset_dset_no_attrs_hint')
+ IMPORT :: HID_T, C_BOOL
+ IMPLICIT NONE
+ INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id
+ LOGICAL(C_BOOL), INTENT(IN), VALUE :: minimize
+ END FUNCTION h5pset_dset_no_attrs_hint_c
+ END INTERFACE
+
+ ! Transfer value of Fortran LOGICAL to C C_BOOL type
+ c_minimize = minimize
+ hdferr = INT(h5pset_dset_no_attrs_hint_c(dcpl_id, c_minimize))
+
+ END SUBROUTINE h5pset_dset_no_attrs_hint_f
+
+END MODULE H5P
diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90
index f5a9c6e..6c2ba28 100644
--- a/fortran/src/H5Rff.F90
+++ b/fortran/src/H5Rff.F90
@@ -56,6 +56,12 @@ MODULE H5R
! END TYPE
!
+ PRIVATE h5rget_object_type_obj_f
+ PRIVATE h5rget_region_region_f, h5rget_region_ptr_f
+ PRIVATE h5rcreate_object_f, h5rcreate_region_f, h5rcreate_ptr_f
+ PRIVATE h5rdereference_object_f, h5rdereference_region_f, h5rdereference_ptr_f
+ PRIVATE h5rget_name_object_f, h5rget_name_region_f, h5rget_name_ptr_f
+
INTERFACE h5rget_object_type_f
MODULE PROCEDURE h5rget_object_type_obj_f
diff --git a/fortran/src/H5Tff.F90 b/fortran/src/H5Tff.F90
index b63c61d..46c8f39 100644
--- a/fortran/src/H5Tff.F90
+++ b/fortran/src/H5Tff.F90
@@ -41,6 +41,8 @@ MODULE H5T
USE H5GLOBAL
IMPLICIT NONE
+ PRIVATE h5tenum_insert_f03, h5tenum_insert_f90
+
!****t* H5T/hvl_t
! Fortran2003 Derived Type:
TYPE hvl_t
diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90
index d4ebdd3..f793b7f 100644
--- a/fortran/src/H5_buildiface.F90
+++ b/fortran/src/H5_buildiface.F90
@@ -135,162 +135,268 @@ PROGRAM H5_buildiface
WRITE(11,'(A)') "MODULE H5_GEN"
- WRITE(11,'(A)') ' USE, INTRINSIC :: ISO_C_BINDING'
- WRITE(11,'(A)') ' USE H5GLOBAL'
+ WRITE(11,'(2X,A)') 'USE, INTRINSIC :: ISO_C_BINDING'
+ WRITE(11,'(2X,A)') 'USE H5GLOBAL'
+
+ WRITE(11,'(2X,A)') 'USE H5A'
+ WRITE(11,'(2X,A)') 'USE H5D'
+ WRITE(11,'(2X,A)') 'USE H5P'
+ WRITE(11,'(2X,A)') 'IMPLICIT NONE'
+
+!******************************
+! DECLARE PRIVATE INTERFACES
+!******************************
+
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO i = 1, num_ikinds
+ j = ikind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO k = 2, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5awrite_ckind_rank"//chr_rank(k)
+ ENDDO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO i = 1, num_ikinds
+ j = ikind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO k = 2, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5aread_ckind_rank"//chr_rank(k)
+ ENDDO
+
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO i = 1, num_ikinds
+ j = ikind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO k = 2, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dwrite_ckind_rank"//chr_rank(k)
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO i = 1, num_ikinds
+ j = ikind(i)
+ WRITE(chr2,'(I2)') j
+ DO k = 1, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ ENDDO
+ END DO
+ DO k = 2, 8
+ WRITE(11,'(2X,A)') "PRIVATE h5dread_ckind_rank"//chr_rank(k)
+ ENDDO
+
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pset_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pget_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pregister_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
+ DO i = 1, num_rkinds
+ j = rkind(i)
+ WRITE(chr2,'(I2)') j
+ WRITE(11,'(2X,A)') "PRIVATE h5pinsert_kind_"//TRIM(ADJUSTL(chr2))
+ END DO
- WRITE(11,'(A)') ' USE H5A'
- WRITE(11,'(A)') ' USE H5D'
- WRITE(11,'(A)') ' USE H5P'
- WRITE(11,'(A)') ' IMPLICIT NONE'
!***************
! H5A INTERFACES
!***************
!
! H5Awrite_f
!
- WRITE(11,'(A)') " INTERFACE h5awrite_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5awrite_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO i = 1, num_ikinds
j = ikind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO k = 2, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5awrite_ckind_rank"//chr_rank(k)
ENDDO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Aread_f
- WRITE(11,'(A)') " INTERFACE h5aread_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5aread_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO i = 1, num_ikinds
j = ikind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO k = 2, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5aread_ckind_rank"//chr_rank(k)
ENDDO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
!***************
! H5D INTERFACES
!***************
!
! H5Dwrite_f
- WRITE(11,'(A)') " INTERFACE h5dwrite_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5dwrite_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO i = 1, num_ikinds
j = ikind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO k = 2, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dwrite_ckind_rank"//chr_rank(k)
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Dread_f
- WRITE(11,'(A)') " INTERFACE h5dread_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5dread_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_rkind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO i = 1, num_ikinds
j = ikind(i)
WRITE(chr2,'(I2)') j
DO k = 1, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ikind_"//TRIM(ADJUSTL(chr2))//'_rank'//chr_rank(k)
ENDDO
END DO
DO k = 2, 8
- WRITE(11,'(A)') " MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k)
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5dread_ckind_rank"//chr_rank(k)
ENDDO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
!***************
! H5P INTERFACES
!***************
!
! H5Pset_fill_value_f
- WRITE(11,'(A)') " INTERFACE h5pset_fill_value_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pset_fill_value_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_fill_value_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Pget_fill_value_f
- WRITE(11,'(A)') " INTERFACE h5pget_fill_value_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pget_fill_value_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_fill_value_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Pset_f
- WRITE(11,'(A)') " INTERFACE h5pset_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pset_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pset_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Pget_f
- WRITE(11,'(A)') " INTERFACE h5pget_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pget_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pget_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Pregister_f
- WRITE(11,'(A)') " INTERFACE h5pregister_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pregister_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pregister_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
! H5Pinsert_f
- WRITE(11,'(A)') " INTERFACE h5pinsert_f"
+ WRITE(11,'(2X,A)') "INTERFACE h5pinsert_f"
DO i = 1, num_rkinds
j = rkind(i)
WRITE(chr2,'(I2)') j
- WRITE(11,'(A)') " MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2))
+ WRITE(11,'(5X,A)') "MODULE PROCEDURE h5pinsert_kind_"//TRIM(ADJUSTL(chr2))
END DO
- WRITE(11,'(A)') " END INTERFACE"
+ WRITE(11,'(2X,A)') "END INTERFACE"
WRITE(11,'(A)') 'CONTAINS'
diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c
index 352ffab..69ba8b3 100644
--- a/fortran/src/H5_f.c
+++ b/fortran/src/H5_f.c
@@ -556,6 +556,17 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags,
h5o_flags[24] = (int_f)H5O_TYPE_DATASET; /* Object is a dataset */
h5o_flags[25] = (int_f)H5O_TYPE_NAMED_DATATYPE; /* Object is a named data type */
h5o_flags[26] = (int_f)H5O_TYPE_NTYPES; /* Number of different object types */
+
+/* Flags for H5Oget_info.
+ * These flags determine which fields will be filled in in the H5O_info_t
+ * struct.
+ */
+ h5o_flags[27] = (int_f)H5O_INFO_ALL; /* (H5O_INFO_BASIC|H5O_INFO_TIME|H5O_INFO_NUM_ATTRS|H5O_INFO_HDR|H5O_INFO_META_SIZE) */
+ h5o_flags[28] = (int_f)H5O_INFO_BASIC; /* Fill in the fileno, addr, type, and rc fields */
+ h5o_flags[29] = (int_f)H5O_INFO_TIME; /* Fill in the atime, mtime, ctime, and btime fields */
+ h5o_flags[30] = (int_f)H5O_INFO_NUM_ATTRS; /* Fill in the num_attrs field */
+ h5o_flags[31] = (int_f)H5O_INFO_HDR; /* Fill in the hdr field */
+ h5o_flags[32] = (int_f)H5O_INFO_META_SIZE; /* Fill in the meta_size field */
/*
* H5P flags
*/
diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90
index f63e734..84529e4 100644
--- a/fortran/src/H5_ff.F90
+++ b/fortran/src/H5_ff.F90
@@ -98,8 +98,8 @@ MODULE H5LIB
!
! H5O flags declaration
!
- INTEGER, PARAMETER :: H5O_FLAGS_LEN = 27
- INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5o_flags
+ INTEGER, PARAMETER :: H5O_FLAGS_LEN = 33
+ INTEGER, DIMENSION(1:H5O_FLAGS_LEN) :: H5O_flags
!
! H5P flags declaration
!
@@ -139,8 +139,8 @@ MODULE H5LIB
!
INTEGER, PARAMETER :: H5LIB_FLAGS_LEN = 2
INTEGER, DIMENSION(1:H5LIB_FLAGS_LEN) :: H5LIB_flags
-
- PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof
+
+ PUBLIC :: h5open_f, h5close_f, h5get_libversion_f, h5dont_atexit_f, h5kind_to_type, h5offsetof, h5gmtime
PUBLIC :: h5garbage_collect_f, h5check_version_f
CONTAINS
@@ -488,7 +488,13 @@ CONTAINS
H5O_TYPE_GROUP_F = h5o_flags(24)
H5O_TYPE_DATASET_F = h5o_flags(25)
H5O_TYPE_NAMED_DATATYPE_F = h5o_flags(26)
- H5O_TYPE_NTYPES_F = h5o_flags(27)
+ H5O_TYPE_NTYPES_F = h5o_flags(27)
+ H5O_INFO_ALL_F = h5o_flags(28)
+ H5O_INFO_BASIC_F = h5o_flags(29)
+ H5O_INFO_TIME_F = h5o_flags(30)
+ H5O_INFO_NUM_ATTRS_F = h5o_flags(31)
+ H5O_INFO_HDR_F = h5o_flags(32)
+ H5O_INFO_META_SIZE_F = h5o_flags(33)
!
! H5P flags
!
@@ -898,4 +904,62 @@ CONTAINS
END FUNCTION h5offsetof
+!****f* H5LIB_PROVISIONAL/h5gmtime
+!
+! NAME
+! h5gmtime
+!
+! PURPOSE
+! Convert time_t structure (C) to Fortran DATE AND TIME storage format.
+!
+! Inputs:
+! stdtime_t - Object of type time_t that contains a time value
+!
+! Outputs:
+! datetime - A date/time array using Fortran conventions:
+! datetime(1) = year
+! datetime(2) = month
+! datetime(3) = day
+! datetime(4) = 0 ! time is expressed as UTC (or GMT timezone) */
+! datetime(5) = hour
+! datetime(6) = minute
+! datetime(7) = second
+! datetime(8) = millisecond -- not available, assigned - HUGE(0)
+!
+! AUTHOR
+! M. Scot Breitenfeld
+! January, 2019
+!
+! Fortran Interface:
+ FUNCTION h5gmtime(stdtime_t)
+ IMPLICIT NONE
+ INTEGER(KIND=TIME_T), INTENT(IN) :: stdtime_t
+ INTEGER, DIMENSION(1:8) :: h5gmtime
+!*****
+ TYPE(C_PTR) :: cptr
+ INTEGER(C_INT), DIMENSION(:), POINTER :: c_time
+
+ INTERFACE
+ FUNCTION gmtime(stdtime_t) BIND(C, NAME='gmtime')
+ IMPORT :: TIME_T, C_PTR
+ IMPLICIT NONE
+ INTEGER(KIND=TIME_T) :: stdtime_t
+ TYPE(C_PTR) :: gmtime
+ END FUNCTION gmtime
+ END INTERFACE
+
+ cptr = gmtime(stdtime_t)
+ CALL C_F_POINTER(cptr, c_time, [9])
+
+ h5gmtime(1) = INT(c_time(6)+1900) ! year starts at 1900
+ h5gmtime(2) = INT(c_time(5)+1) ! month starts at 0 in C
+ h5gmtime(3) = INT(c_time(4)) ! day
+ h5gmtime(4) = 0 ! time is expressed as UTC (or GMT timezone)
+ h5gmtime(5) = INT(c_time(3)) ! hour
+ h5gmtime(6) = INT(c_time(2)) ! minute
+ h5gmtime(7) = INT(c_time(1)) ! second
+ h5gmtime(8) = -32767 ! millisecond is not available, assign it -HUGE(0)
+
+ END FUNCTION h5gmtime
+
END MODULE H5LIB
diff --git a/fortran/src/H5config_f.inc.cmake b/fortran/src/H5config_f.inc.cmake
index aa3d135..3dd3c8c 100644
--- a/fortran/src/H5config_f.inc.cmake
+++ b/fortran/src/H5config_f.inc.cmake
@@ -12,7 +12,7 @@
! fortran/src/H5config_f.inc. Generated from fortran/src/H5config_f.inc.in by configure
! Define if we have parallel support
-#cmakedefine01 H5_HAVE_PARALLEL @H5_HAVE_PARALLEL@
+#cmakedefine01 H5_HAVE_PARALLEL
#if H5_HAVE_PARALLEL == 0
#undef H5_HAVE_PARALLEL
#endif
diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90
index 078778a..b705cc1 100644
--- a/fortran/src/H5f90global.F90
+++ b/fortran/src/H5f90global.F90
@@ -493,6 +493,13 @@ MODULE H5GLOBAL
!DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_DATASET_F
!DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NAMED_DATATYPE_F
!DEC$ATTRIBUTES DLLEXPORT :: H5O_TYPE_NTYPES_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_ALL_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_BASIC_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_TIME_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_NUM_ATTRS_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_HDR_F
+ !DEC$ATTRIBUTES DLLEXPORT :: H5O_INFO_META_SIZE_F
+ !
!DEC$endif
INTEGER :: H5O_COPY_SHALLOW_HIERARCHY_F ! *** THESE VARIABLES DO
@@ -522,6 +529,12 @@ MODULE H5GLOBAL
INTEGER :: H5O_TYPE_DATASET_F
INTEGER :: H5O_TYPE_NAMED_DATATYPE_F
INTEGER :: H5O_TYPE_NTYPES_F
+ INTEGER :: H5O_INFO_ALL_F
+ INTEGER :: H5O_INFO_BASIC_F
+ INTEGER :: H5O_INFO_TIME_F
+ INTEGER :: H5O_INFO_NUM_ATTRS_F
+ INTEGER :: H5O_INFO_HDR_F
+ INTEGER :: H5O_INFO_META_SIZE_F
!
! H5P flags declaration
!
diff --git a/fortran/src/H5f90proto.h b/fortran/src/H5f90proto.h
index 46ef8ef..fc6567c 100644
--- a/fortran/src/H5f90proto.h
+++ b/fortran/src/H5f90proto.h
@@ -315,14 +315,14 @@ H5_FCDLL int_f h5oclose_c(hid_t_f *object_id );
H5_FCDLL int_f h5oopen_by_addr_c(hid_t_f *loc_id, haddr_t_f *addr, hid_t_f *obj_id);
H5_FCDLL int_f h5olink_c(hid_t_f *object_id, hid_t_f *new_loc_id, _fcd name, size_t_f *namelen,
hid_t_f *lcpl_id, hid_t_f *lapl_id);
-H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data);
+H5_FCDLL int_f h5ovisit_c(hid_t_f *group_id, int_f *index_type, int_f *order, H5O_iterate_t op, void *op_data, int_f *fields);
H5_FCDLL int_f h5ovisit_by_name_c(hid_t_f *loc_id, _fcd object_name, size_t_f *namelen, int_f *index_type, int_f *order,
- H5O_iterate_t op, void *op_data, hid_t_f *lapl_id );
-H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info);
+ H5O_iterate_t op, void *op_data, hid_t_f *lapl_id, int_f *fields );
+H5_FCDLL int_f h5oget_info_c(hid_t_f *object_id, H5O_info_t_f *object_info, int_f *fields);
H5_FCDLL int_f h5oget_info_by_idx_c(hid_t_f *loc_id, _fcd group_name, size_t_f *namelen,
- int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info);
+ int_f *index_field, int_f *order, hsize_t_f *n, hid_t_f *lapl_id, H5O_info_t_f *object_info, int_f *fields);
H5_FCDLL int_f h5oget_info_by_name_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hid_t_f *lapl_id,
- H5O_info_t_f *object_info);
+ H5O_info_t_f *object_info, int_f *fields);
H5_FCDLL int_f h5ocopy_c(hid_t_f *src_loc_id, _fcd src_name, size_t_f *src_name_len,
hid_t_f *dst_loc_id, _fcd dst_name, size_t_f *dst_name_len,
hid_t_f *ocpypl_id, hid_t_f *lcpl_id );
diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c
index 7e0b7e8..57f7dda 100644
--- a/fortran/src/H5match_types.c
+++ b/fortran/src/H5match_types.c
@@ -191,6 +191,8 @@ int main(void)
}
if(sizeof(size_t) == IntKinds_SizeOf[i])
writeTypedef("size_t", "size_t", IntKinds[i]);
+ if(sizeof(time_t) == IntKinds_SizeOf[i])
+ writeTypedef("time_t", "time_t", IntKinds[i]);
if(sizeof(hsize_t) == IntKinds_SizeOf[i])
writeTypedef("hsize_t", "hsize_t", IntKinds[i]);
}
@@ -306,6 +308,17 @@ int main(void)
return -1;
}
+ /* time_t */
+ for(i=0;i< FORTRAN_NUM_INTEGER_KINDS;i++) {
+ if(IntKinds_SizeOf[i] == H5_SIZEOF_TIME_T) {
+ writeToFiles("time_t","TIME_T", "time_t_f", IntKinds[i]);
+ break;
+ }
+ if(i == (FORTRAN_NUM_INTEGER_KINDS-1) )
+ /* Error: couldn't find a size for time_t */
+ return -1;
+ }
+
/* int */
writeToFiles("int","Fortran_INTEGER", "int_f", H5_FORTRAN_NATIVE_INTEGER_KIND);
diff --git a/fortran/src/Makefile.in b/fortran/src/Makefile.in
index 23a6170..777e777 100644
--- a/fortran/src/Makefile.in
+++ b/fortran/src/Makefile.in
@@ -594,7 +594,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -628,6 +627,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -772,29 +772,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
AM_FCLIBS = $(LIBHDF5)
@@ -1680,7 +1680,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in
index 3a5a91f..b9e2314 100644
--- a/fortran/src/hdf5_fortrandll.def.in
+++ b/fortran/src/hdf5_fortrandll.def.in
@@ -8,6 +8,7 @@ H5LIB_mp_H5GARBAGE_COLLECT_F
H5LIB_mp_H5DONT_ATEXIT_F
H5LIB_mp_H5KIND_TO_TYPE
H5LIB_mp_H5OFFSETOF
+H5LIB_mp_H5GMTIME
; H5A
H5A_mp_H5AWRITE_CHAR_SCALAR
H5A_mp_H5AREAD_CHAR_SCALAR
@@ -98,6 +99,8 @@ H5F_mp_H5FIS_HDF5_F
H5F_mp_H5FGET_NAME_F
H5F_mp_H5FGET_FILESIZE_F
H5F_mp_H5FGET_FILE_IMAGE_F
+H5F_mp_H5FGET_DSET_NO_ATTRS_HINT_F
+H5F_mp_H5FSET_DSET_NO_ATTRS_HINT_F
; H5G
H5G_mp_H5GOPEN_F
H5G_mp_H5GCREATE_F
@@ -328,6 +331,8 @@ H5P_mp_H5PGET_VIRTUAL_VSPACE_F
H5P_mp_H5PGET_VIRTUAL_SRCSPACE_F
H5P_mp_H5PGET_VIRTUAL_FILENAME_F
H5P_mp_H5PGET_VIRTUAL_DSETNAME_F
+H5P_mp_H5PGET_DSET_NO_ATTRS_HINT_F
+H5P_mp_H5PSET_DSET_NO_ATTRS_HINT_F
; Parallel
@H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F
@H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F
diff --git a/fortran/test/CMakeTests.cmake b/fortran/test/CMakeTests.cmake
index 4d06359..2824ef7 100644
--- a/fortran/test/CMakeTests.cmake
+++ b/fortran/test/CMakeTests.cmake
@@ -103,26 +103,24 @@ endif ()
set_tests_properties (FORTRAN_testhdf5_fortran_1_8 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran)
#-- Adding test for fortranlib_test_F03
-if (HDF5_ENABLE_F2003)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>)
- else ()
- add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=fortranlib_test_F03.txt"
- #-D "TEST_REFERENCE=fortranlib_test_F03.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
+if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND $<TARGET_FILE:fortranlib_test_F03>)
+else ()
+ add_test (NAME FORTRAN_fortranlib_test_F03 COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_REGEX= 0 error.s."
+ -D "TEST_MATCH= 0 error(s)"
+ -D "TEST_OUTPUT=fortranlib_test_F03.txt"
+ #-D "TEST_REFERENCE=fortranlib_test_F03.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+endif ()
# set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
set_tests_properties (FORTRAN_fortranlib_test_F03 PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8)
-endif ()
#-- Adding test for fflush1
add_test (NAME FORTRAN_fflush1 COMMAND $<TARGET_FILE:fflush1>)
@@ -215,26 +213,24 @@ if (BUILD_SHARED_LIBS)
set_tests_properties (FORTRAN_testhdf5_fortran_1_8-shared PROPERTIES DEPENDS FORTRAN_testhdf5_fortran_1_8)
#-- Adding test for fortranlib_test_F03
- if (HDF5_ENABLE_F2003)
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>)
- else ()
- add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_REGEX= 0 error.s."
- -D "TEST_MATCH= 0 error(s)"
- -D "TEST_OUTPUT=fortranlib_test_F03.txt"
- #-D "TEST_REFERENCE=fortranlib_test_F03.out"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
-# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
- set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03)
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND $<TARGET_FILE:fortranlib_test_F03-shared>)
+ else ()
+ add_test (NAME FORTRAN_fortranlib_test_F03-shared COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:fortranlib_test_F03-shared>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_EXPECT=0"
+ -D "TEST_SKIP_COMPARE=TRUE"
+ -D "TEST_REGEX= 0 error.s."
+ -D "TEST_MATCH= 0 error(s)"
+ -D "TEST_OUTPUT=fortranlib_test_F03.txt"
+ #-D "TEST_REFERENCE=fortranlib_test_F03.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/fshared"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
endif ()
+# set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES PASS_REGULAR_EXPRESSION "[ ]*0 error.s")
+ set_tests_properties (FORTRAN_fortranlib_test_F03-shared PROPERTIES DEPENDS FORTRAN_fortranlib_test_F03)
#-- Adding test for fflush1
add_test (NAME FORTRAN_fflush1-shared COMMAND $<TARGET_FILE:fflush1-shared>)
diff --git a/fortran/test/Makefile.in b/fortran/test/Makefile.in
index 70c0c2d..2e614bc 100644
--- a/fortran/test/Makefile.in
+++ b/fortran/test/Makefile.in
@@ -607,7 +607,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -641,6 +640,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1624,7 +1624,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90
index ee386dd..75a7748 100644
--- a/fortran/test/tH5F.F90
+++ b/fortran/test/tH5F.F90
@@ -841,5 +841,4 @@ CONTAINS
END SUBROUTINE file_space
-
END MODULE TH5F
diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90
index 44c4bff..d1a9ddb 100644
--- a/fortran/test/tH5O_F03.F90
+++ b/fortran/test/tH5O_F03.F90
@@ -58,21 +58,224 @@ MODULE visit_cb
TYPE, bind(c) :: ovisit_ud_t
INTEGER :: idx ! Index in object visit structure
TYPE(obj_visit_t), DIMENSION(1:info_size) :: info ! Pointer to the object visit structure to use
+ INTEGER :: field
END TYPE ovisit_ud_t
CONTAINS
- INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo, op_data) bind(C)
+! Compares the field values of a C h5O_info_t and a Fortran H5O_info_t.
+
+ INTEGER FUNCTION compare_h5o_info_t( oinfo_f, oinfo_c, field, full_f_field ) RESULT(status)
+
+ IMPLICIT NONE
+ TYPE(h5o_info_t) :: oinfo_f
+ TYPE(c_h5o_info_t) :: oinfo_c
+ INTEGER :: field
+ LOGICAL :: full_f_field ! All the fields of Fortran H5O_info_t where filled
+! local
+ INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime
+ INTEGER :: i
+
+ status = 0
+
+ IF( (field .EQ. H5O_INFO_BASIC_F).OR.(field .EQ. H5O_INFO_ALL_F) )THEN
+ IF( (oinfo_f%fileno.LE.0) .OR. (oinfo_c%fileno .NE. oinfo_f%fileno) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%addr.LE.0) .OR. (oinfo_c%addr .NE. oinfo_f%addr) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%type.LT.0) .OR. (oinfo_c%type .NE. oinfo_f%type) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%rc.LT.0) .OR. (oinfo_c%rc .NE. oinfo_f%rc) )THEN
+ status = -1
+ RETURN
+ ENDIF
+
+ ENDIF
+
+ IF((field .EQ. H5O_INFO_TIME_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN
+
+ atime(1:8) = h5gmtime(oinfo_c%atime)
+ btime(1:8) = h5gmtime(oinfo_c%btime)
+ ctime(1:8) = h5gmtime(oinfo_c%ctime)
+ mtime(1:8) = h5gmtime(oinfo_c%mtime)
+
+ DO i = 1, 8
+ IF( (atime(i) .NE. oinfo_f%atime(i)) )THEN
+ status = -1
+ RETURN
+ ENDIF
+
+ IF( (btime(i) .NE. oinfo_f%btime(i)) )THEN
+ status = -1
+ RETURN
+ ENDIF
+
+ IF( (ctime(i) .NE. oinfo_f%ctime(i)) )THEN
+ status = -1
+ RETURN
+ ENDIF
+
+ IF( (mtime(i) .NE. oinfo_f%mtime(i)) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ ENDDO
+
+ ELSE IF(field .EQ. H5O_INFO_TIME_F.AND. full_f_field)THEN
+ ! check other field values are not filled (using only a small subset to check)
+ status = 0
+ IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1
+ IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1
+ IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1
+ IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1
+ IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled.
+ status = -1
+ RETURN
+ ENDIF
+ status = 0 ! reset
+ ENDIF
+
+ IF((field .EQ. H5O_INFO_NUM_ATTRS_F).OR.(field .EQ. H5O_INFO_ALL_F))THEN
+ IF( (oinfo_f%num_attrs.LT.0) .OR. (oinfo_c%num_attrs .NE. oinfo_f%num_attrs) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ ELSE IF( field .EQ. H5O_INFO_ALL_F.AND.full_f_field)THEN
+ ! check other field values are not filled (using only a small subset to check)
+ status = 0
+ IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1
+ IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1
+ IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1
+ IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1
+ IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled.
+ status = -1
+ RETURN
+ ENDIF
+ status = 0 ! reset
+
+ ENDIF
+
+ IF((field).EQ.H5O_INFO_HDR_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN
+ IF( (oinfo_f%hdr%version.LT.0) .OR. (oinfo_c%hdr%version .NE. oinfo_f%hdr%version) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%nmesgs.LT.0) .OR. (oinfo_c%hdr%nmesgs .NE. oinfo_f%hdr%nmesgs) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%nchunks.LT.0) .OR. (oinfo_c%hdr%nchunks .NE. oinfo_f%hdr%nchunks) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%flags.LT.0) .OR. (oinfo_c%hdr%flags .NE. oinfo_f%hdr%flags) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%space%total.LT.0) .OR. (oinfo_c%hdr%space%total .NE. oinfo_f%hdr%space%total) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%space%meta.LT.0) .OR. (oinfo_c%hdr%space%meta .NE. oinfo_f%hdr%space%meta) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%space%mesg.LT.0) .OR. (oinfo_c%hdr%space%mesg .NE. oinfo_f%hdr%space%mesg) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%space%free.LT.0) .OR. (oinfo_c%hdr%space%free .NE. oinfo_f%hdr%space%free) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%mesg%present.LT.0) .OR. (oinfo_c%hdr%mesg%present .NE. oinfo_f%hdr%mesg%present) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF( (oinfo_f%hdr%mesg%shared.LT.0) .OR. (oinfo_c%hdr%mesg%shared .NE. oinfo_f%hdr%mesg%shared) )THEN
+ status = -1
+ RETURN
+ ENDIF
+ ELSE IF( field .EQ. H5O_INFO_HDR_F.AND.full_f_field)THEN
+ ! check other field values are not filled (using only a small subset to check)
+ status = 0
+ IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1
+ IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1
+ IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1
+ IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1
+ IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled.
+ status = -1
+ RETURN
+ ENDIF
+ status = 0 ! reset
+ ENDIF
+ IF((field).EQ.H5O_INFO_META_SIZE_F.OR.(field .EQ. H5O_INFO_ALL_F))THEN
+ IF((oinfo_f%meta_size%obj%index_size.LT.0).OR.(oinfo_c%meta_size%obj%index_size.NE.oinfo_f%meta_size%obj%index_size))THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF((oinfo_f%meta_size%obj%heap_size.LT.0).OR.(oinfo_c%meta_size%obj%heap_size.NE.oinfo_f%meta_size%obj%heap_size))THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF((oinfo_f%meta_size%attr%index_size.LT.0).OR.(oinfo_c%meta_size%attr%index_size.NE.oinfo_f%meta_size%attr%index_size))THEN
+ status = -1
+ RETURN
+ ENDIF
+ IF((oinfo_f%meta_size%attr%heap_size.LT.0).OR.(oinfo_c%meta_size%attr%heap_size.NE.oinfo_f%meta_size%attr%heap_size))THEN
+ status = -1
+ RETURN
+ ENDIF
+ ELSE IF( field .EQ. H5O_INFO_META_SIZE_F.AND.full_f_field)THEN
+ ! check other field values are not filled (using only a small subset to check)
+ status = 0
+ IF( oinfo_c%fileno .NE. oinfo_f%fileno) status = status + 1
+ IF( oinfo_c%addr .NE. oinfo_f%addr) status = status + 1
+ IF( oinfo_c%type .NE. oinfo_f%type) status = status + 1
+ IF( oinfo_c%rc .NE. oinfo_f%rc) status = status + 1
+ IF(status.EQ.0) THEN ! There was no difference found, which is only possible if the field was filled.
+ status = -1
+ RETURN
+ ENDIF
+ status = 0 ! reset
+ ENDIF
+
+ END FUNCTION compare_h5o_info_t
+
+ INTEGER FUNCTION visit_obj_cb( group_id, name, oinfo_c, op_data) bind(C)
IMPLICIT NONE
INTEGER(HID_T), VALUE :: group_id
CHARACTER(LEN=1), DIMENSION(1:180) :: name
- TYPE(h5o_info_t) :: oinfo
+ CHARACTER(LEN=180) :: name2
+ TYPE(c_h5o_info_t) :: oinfo_c
TYPE(ovisit_ud_t) :: op_data
-
+ TYPE(h5o_info_t) :: oinfo_f
+!
+! MEMBER | TYPE | MEANING | RANGE
+! A(1) = tm_sec int seconds after the minute 0-61*
+! A(2) = tm_min int minutes after the hour 0-59
+! A(3) = tm_hour int hours since midnight 0-23
+! A(4) = tm_mday int day of the month 1-31
+! A(5) = tm_mon int months since January 0-11
+! A(6) = tm_year int years since 1900
+! A(7) = tm_wday int days since Sunday 0-6
+! A(8) = tm_yday int days since January 1 0-365
+! A(9) = tm_isdst int Daylight Saving Time flag
+!
+ INTEGER(C_INT), DIMENSION(:), POINTER :: c_atime, c_btime, c_ctime, c_mtime
+ INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime
INTEGER :: len, i
INTEGER :: idx
+ INTEGER :: ierr
+ TYPE(C_PTR) :: cptr
visit_obj_cb = 0
@@ -87,21 +290,53 @@ CONTAINS
len = len - 1
! Check for correct object information
+ name2(1:180) = ""
+ DO i = 1, len
+ name2(i:i) = name(i)(1:1)
+ ENDDO
- idx = op_data%idx
+ IF(op_data%field .EQ. H5O_INFO_ALL_F)THEN
- DO i = 1, len
- IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN
- visit_obj_cb = -1
- RETURN
- ENDIF
-
- IF(op_data%info(idx)%type_obj .NE. oinfo%type)THEN
- visit_obj_cb = -1
- RETURN
- ENDIF
+ idx = op_data%idx
+
+ DO i = 1, len
+ IF(op_data%info(idx)%path(i)(1:1) .NE. name(i)(1:1))THEN
+ visit_obj_cb = -1
+ RETURN
+ ENDIF
+
+ IF(op_data%info(idx)%type_obj .NE. oinfo_c%type)THEN
+ visit_obj_cb = -1
+ RETURN
+ ENDIF
+ ENDDO
- ENDDO
+ ENDIF
+
+ ! Check H5Oget_info_by_name_f; if partial field values where filled correctly
+ CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr);
+ visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. )
+ IF(visit_obj_cb.EQ.-1) RETURN
+
+ ! Check H5Oget_info_by_name_f, only check field values
+ CALL H5Oget_info_by_name_f(group_id, name2, oinfo_f, ierr, fields = op_data%field);
+ visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. )
+ IF(visit_obj_cb.EQ.-1) RETURN
+
+
+ IF(op_data%idx.EQ.1)THEN
+
+ ! Check H5Oget_info_f, only check field values
+ CALL H5Oget_info_f(group_id, oinfo_f, ierr, fields = op_data%field);
+ visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .FALSE. )
+ IF(visit_obj_cb.EQ.-1) RETURN
+
+ ! Check H5Oget_info_f; if partial field values where filled correctly
+ CALL H5Oget_info_f(group_id, oinfo_f, ierr);
+ visit_obj_cb = compare_h5o_info_t( oinfo_f, oinfo_c, op_data%field, .TRUE. )
+ IF(visit_obj_cb.EQ.-1) RETURN
+
+ ENDIF
! Advance to next location in expected output
op_data%idx = op_data%idx + 1
@@ -110,7 +345,6 @@ CONTAINS
END MODULE visit_cb
-
MODULE TH5O_F03
CONTAINS
@@ -310,29 +544,110 @@ SUBROUTINE obj_visit(total_error)
udata%info(9)%type_obj = H5O_TYPE_NAMED_DATATYPE_F
! Visit all the objects reachable from the root group (with file ID)
- udata%idx = 1
fun_ptr = C_FUNLOC(visit_obj_cb)
f_ptr = C_LOC(udata)
! Test h5ovisit_f
+ udata%field = H5O_INFO_ALL_F
+ udata%idx = 1
CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error)
CALL check("h5ovisit_f", error, total_error)
IF(ret_val.LT.0)THEN
CALL check("h5ovisit_f", -1, total_error)
ENDIF
- ! Test h5ovisit_by_name_f
+ ! Test fields option
+ udata%field = H5O_INFO_ALL_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ udata%field = H5O_INFO_BASIC_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ udata%field = H5O_INFO_TIME_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ udata%field = H5O_INFO_NUM_ATTRS_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ udata%field = H5O_INFO_HDR_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ udata%field = H5O_INFO_META_SIZE_F
+ udata%idx = 1
+ CALL h5ovisit_f(fid, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_f", -1, total_error)
+ ENDIF
+ ! Test h5ovisit_by_name_f
object_name = "/"
udata%idx = 1
-
- CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error)
+ udata%field = H5O_INFO_ALL_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
CALL check("h5ovisit_by_name_f", error, total_error)
IF(ret_val.LT.0)THEN
CALL check("h5ovisit_by_name_f", -1, total_error)
ENDIF
+ ! Test fields option
+ udata%idx = 1
+ udata%field = H5O_INFO_BASIC_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_by_name_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_by_name_f", -1, total_error)
+ ENDIF
+ udata%idx = 1
+ udata%field = H5O_INFO_TIME_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_by_name_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_by_name_f", -1, total_error)
+ ENDIF
+ udata%idx = 1
+ udata%field = H5O_INFO_NUM_ATTRS_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_by_name_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_by_name_f", -1, total_error)
+ ENDIF
+ udata%idx = 1
+ udata%field = H5O_INFO_HDR_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_by_name_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_by_name_f", -1, total_error)
+ ENDIF
+ udata%idx = 1
+ udata%field = H5O_INFO_META_SIZE_F
+ CALL h5ovisit_by_name_f(fid, object_name, H5_INDEX_NAME_F, H5_ITER_INC_F, fun_ptr, f_ptr, ret_val, error, fields=udata%field)
+ CALL check("h5ovisit_by_name_f", error, total_error)
+ IF(ret_val.LT.0)THEN
+ CALL check("h5ovisit_by_name_f", -1, total_error)
+ ENDIF
+
CALL h5fclose_f(fid, error)
CALL check("h5fclose_f",error, total_error)
@@ -450,11 +765,32 @@ SUBROUTINE obj_info(total_error)
IF(oinfo%rc.NE.1)THEN
CALL check("h5oget_info_by_idx_f", -1, total_error)
ENDIF
+ IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN
+ CALL check("h5oget_info_by_idx_f", -1, total_error)
+ ENDIF
+ ! Check partial fields
+ CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error, fields=H5O_INFO_BASIC_F )
+ CALL check("h5oget_info_by_idx_f", error, total_error)
+
+ IF(oinfo%rc.NE.1)THEN
+ CALL check("h5oget_info_by_idx_f", -1, total_error)
+ ENDIF
IF(oinfo%type.NE.H5O_TYPE_DATASET_F)THEN
CALL check("h5oget_info_by_idx_f", -1, total_error)
ENDIF
+ CALL h5oget_info_by_idx_f(gid, ".", H5_INDEX_NAME_F, H5_ITER_INC_F, 0_hsize_t, oinfo, error, fields=H5O_INFO_TIME_F )
+ CALL check("h5oget_info_by_idx_f", error, total_error)
+ ! These field values should not be filled
+ IF(oinfo%rc.EQ.1)THEN
+ CALL check("h5oget_info_by_idx_f", -1, total_error)
+ ENDIF
+ IF(oinfo%type.EQ.H5O_TYPE_DATASET_F)THEN
+ CALL check("h5oget_info_by_idx_f", -1, total_error)
+ ENDIF
+
+
! Close objects
CALL h5dclose_f(did, error)
CALL check("h5dclose_f", error, total_error)
@@ -483,11 +819,12 @@ SUBROUTINE build_visit_file(fid)
USE TH5_MISC
IMPLICIT NONE
- INTEGER(hid_t) :: fid ! File ID
- INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs
+ INTEGER(hid_t) :: fid ! File ID
+ INTEGER(hid_t) :: gid = -1, gid2 = -1 ! Group IDs
INTEGER(hid_t) :: sid = -1 ! Dataspace ID
INTEGER(hid_t) :: did = -1 ! Dataset ID
INTEGER(hid_t) :: tid = -1 ! Datatype ID
+ INTEGER(hid_t) :: aid = -1, aid2 = -1, aid3 = -1 ! Attribute ID
CHARACTER(LEN=20) :: filename = 'visit.h5'
INTEGER :: error
@@ -500,6 +837,15 @@ SUBROUTINE build_visit_file(fid)
! Create nested group
CALL H5Gcreate_f(gid, "Group2", gid2, error)
+ CALL H5Screate_f(H5S_SCALAR_F, sid, error)
+ CALL H5Acreate_f(gid2, "Attr1", H5T_NATIVE_INTEGER, sid, aid, error)
+ CALL H5Acreate_f(gid2, "Attr2", H5T_NATIVE_INTEGER, sid, aid2, error)
+ CALL H5Acreate_f(gid2, "Attr3", H5T_NATIVE_INTEGER, sid, aid3, error)
+ CALL H5Aclose_f(aid,error)
+ CALL H5Aclose_f(aid2,error)
+ CALL H5Aclose_f(aid3,error)
+ CALL H5Sclose_f(sid,error)
+
! Close groups
CALL h5gclose_f(gid2, error)
CALL h5gclose_f(gid, error)
diff --git a/fortran/test/tH5P.F90 b/fortran/test/tH5P.F90
index 563926b..c42dd7e 100644
--- a/fortran/test/tH5P.F90
+++ b/fortran/test/tH5P.F90
@@ -444,6 +444,7 @@ SUBROUTINE test_chunk_cache(cleanup, total_error)
INTEGER(size_t) rdcc_nelmts
INTEGER(size_t) rdcc_nbytes
REAL :: rdcc_w0
+ LOGICAL :: minimize ! Flag for minimized headers
CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error)
IF (error .NE. 0) THEN
@@ -648,6 +649,57 @@ SUBROUTINE test_chunk_cache(cleanup, total_error)
CALL verify("H5Pget_chunk_cache_f", INT(nbytes_2), INT(nbytes_4), total_error)
CALL verify("H5Pget_chunk_cache_f", w0_3, w0_4, total_error)
+ ! Check that the dataset object header minimization hint
+ ! can be set and retrieved.
+
+ ! H5P version
+ ! Check the default value
+ minimize = .TRUE.
+ CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error)
+ CALL check("h5pget_dset_no_attrs_hint_f",error,total_error)
+ if(minimize .neqv. .FALSE.) then
+ total_error = total_error + 1
+ write(*,*) "Default dataset minimize flag was incorrect (H5P)"
+ endif
+
+ ! Check setter
+ minimize = .TRUE.
+ CALL h5pset_dset_no_attrs_hint_f(dcpl, minimize, error)
+ CALL check("h5pset_dset_no_attrs_hint_f",error,total_error)
+
+ ! Check getter
+ minimize = .FALSE.
+ CALL h5pget_dset_no_attrs_hint_f(dcpl, minimize, error)
+ CALL check("h5pget_dset_no_attrs_hint_f",error,total_error)
+ if(minimize .neqv. .TRUE.) then
+ total_error = total_error + 1
+ write(*,*) "Unable to get correct dataset minimize flag (H5P)"
+ endif
+
+ ! H5F version
+ ! Check the default value
+ minimize = .TRUE.
+ CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error)
+ CALL check("h5fget_dset_no_attrs_hint_f",error,total_error)
+ if(minimize .neqv. .FALSE.) then
+ total_error = total_error + 1
+ write(*,*) "Default dataset minimize flag was incorrect (H5F)"
+ endif
+
+ ! Check setter
+ minimize = .TRUE.
+ CALL h5fset_dset_no_attrs_hint_f(fid, minimize, error)
+ CALL check("h5fset_dset_no_attrs_hint_f",error,total_error)
+
+ ! Check getter
+ minimize = .FALSE.
+ CALL h5fget_dset_no_attrs_hint_f(fid, minimize, error)
+ CALL check("h5fget_dset_no_attrs_hint_f",error,total_error)
+ if(minimize .neqv. .TRUE.) then
+ total_error = total_error + 1
+ write(*,*) "Unable to get correct dataset minimize flag (H5F)"
+ endif
+
! Close
CALL H5Dclose_f(dsid, error)
diff --git a/fortran/testpar/CMakeTests.cmake b/fortran/testpar/CMakeTests.cmake
index d00a6fc..d0abe0e 100644
--- a/fortran/testpar/CMakeTests.cmake
+++ b/fortran/testpar/CMakeTests.cmake
@@ -15,4 +15,4 @@
### T E S T I N G ###
##############################################################################
##############################################################################
-add_test (NAME FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS})
+add_test (NAME MPI_TEST_FORT_parallel_test COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:parallel_test> ${MPIEXEC_POSTFLAGS})
diff --git a/fortran/testpar/Makefile.in b/fortran/testpar/Makefile.in
index 2379260..f1ae198 100644
--- a/fortran/testpar/Makefile.in
+++ b/fortran/testpar/Makefile.in
@@ -558,7 +558,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -592,6 +591,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1406,7 +1406,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/Makefile.in b/hl/Makefile.in
index 11340ff..02bacbc 100644
--- a/hl/Makefile.in
+++ b/hl/Makefile.in
@@ -557,7 +557,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -591,6 +590,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1452,7 +1452,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/c++/Makefile.in b/hl/c++/Makefile.in
index 7a7566c..fdc8f5d 100644
--- a/hl/c++/Makefile.in
+++ b/hl/c++/Makefile.in
@@ -553,7 +553,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -587,6 +586,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1442,7 +1442,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/c++/examples/Makefile.in b/hl/c++/examples/Makefile.in
index ade2766..629ba83 100644
--- a/hl/c++/examples/Makefile.in
+++ b/hl/c++/examples/Makefile.in
@@ -500,7 +500,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -534,6 +533,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1360,7 +1360,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/c++/src/Makefile.in b/hl/c++/src/Makefile.in
index 2fa13f0..cf48b26 100644
--- a/hl/c++/src/Makefile.in
+++ b/hl/c++/src/Makefile.in
@@ -556,7 +556,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -590,6 +589,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -734,29 +734,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# This is our main target
@@ -1494,7 +1494,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/c++/test/Makefile.in b/hl/c++/test/Makefile.in
index b443df5..531daab 100644
--- a/hl/c++/test/Makefile.in
+++ b/hl/c++/test/Makefile.in
@@ -553,7 +553,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -587,6 +586,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1419,7 +1419,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/examples/Makefile.in b/hl/examples/Makefile.in
index 9131f46..580e617 100644
--- a/hl/examples/Makefile.in
+++ b/hl/examples/Makefile.in
@@ -500,7 +500,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -534,6 +533,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1399,7 +1399,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/fortran/Makefile.in b/hl/fortran/Makefile.in
index 6c66c03..b3decd8 100644
--- a/hl/fortran/Makefile.in
+++ b/hl/fortran/Makefile.in
@@ -557,7 +557,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -591,6 +590,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1446,7 +1446,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/fortran/examples/Makefile.in b/hl/fortran/examples/Makefile.in
index 045bca1..0f12020 100644
--- a/hl/fortran/examples/Makefile.in
+++ b/hl/fortran/examples/Makefile.in
@@ -506,7 +506,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -540,6 +539,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1377,7 +1377,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am
index a495e220..37e074c 100644
--- a/hl/fortran/src/Makefile.am
+++ b/hl/fortran/src/Makefile.am
@@ -50,6 +50,21 @@ libhdf5hl_fortran_la_SOURCES=H5DSfc.c H5LTfc.c H5IMfc.c H5IMcc.c H5TBfc.c \
# HDF5 HL Fortran library depends on HDF5 Library.
libhdf5hl_fortran_la_LIBADD=$(LIBH5_HL) $(LIBH5F)
+# The name of the lib file doesn't follow the same pattern as the other hl lib
+# files, namely libhdf5_hl_*. Add a symlink with the compliant name to the
+# actual lib file.
+install-exec-hook:
+ cd $(DESTDIR)$(libdir) && \
+ if test -f libhdf5hl_fortran.a -a \
+ ! -f libhdf5_hl_fortran.a; then \
+ $(LN_S) libhdf5hl_fortran.a libhdf5_hl_fortran.a; \
+ fi; \
+ if test -f libhdf5hl_fortran.so -a \
+ ! -f libhdf5_hl_fortran.so; then \
+ $(LN_S) libhdf5hl_fortran.so libhdf5_hl_fortran.so; \
+ fi;
+
+
# Fortran module files can have different extensions and different names
# (e.g., different capitalizations) on different platforms. Write rules
# for them explicitly rather than trying to teach automake about them.
@@ -72,6 +87,7 @@ uninstall-local:
set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
fi; \
fi
+ $(RM) $(DESTDIR)$(libdir)/libhdf5_hl_fortran*
# These are the helper programs we need to build.
noinst_PROGRAMS = H5HL_buildiface
diff --git a/hl/fortran/src/Makefile.in b/hl/fortran/src/Makefile.in
index 1776360..7f8f672 100644
--- a/hl/fortran/src/Makefile.in
+++ b/hl/fortran/src/Makefile.in
@@ -584,7 +584,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -618,6 +617,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -762,29 +762,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# Our main target, the high-level fortran library
@@ -1264,7 +1264,8 @@ install-dvi: install-dvi-am
install-dvi-am:
install-exec-am: install-libLTLIBRARIES
-
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
install-html: install-html-am
install-html-am:
@@ -1306,7 +1307,7 @@ ps-am:
uninstall-am: uninstall-libLTLIBRARIES uninstall-local
-.MAKE: check-am install-am install-strip
+.MAKE: check-am install-am install-exec-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am all-local check check-TESTS \
check-am clean clean-generic clean-libLTLIBRARIES \
@@ -1315,8 +1316,8 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local
distclean-libtool distclean-local distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-data-local install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am \
+ install-dvi-am install-exec install-exec-am install-exec-hook \
+ install-html install-html-am install-info install-info-am \
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
@@ -1340,6 +1341,20 @@ uninstall-am: uninstall-libLTLIBRARIES uninstall-local
help:
@$(top_srcdir)/bin/makehelp
+# The name of the lib file doesn't follow the same pattern as the other hl lib
+# files, namely libhdf5_hl_*. Add a symlink with the compliant name to the
+# actual lib file.
+install-exec-hook:
+ cd $(DESTDIR)$(libdir) && \
+ if test -f libhdf5hl_fortran.a -a \
+ ! -f libhdf5_hl_fortran.a; then \
+ $(LN_S) libhdf5hl_fortran.a libhdf5_hl_fortran.a; \
+ fi; \
+ if test -f libhdf5hl_fortran.so -a \
+ ! -f libhdf5_hl_fortran.so; then \
+ $(LN_S) libhdf5hl_fortran.so libhdf5_hl_fortran.so; \
+ fi;
+
# Fortran module files can have different extensions and different names
# (e.g., different capitalizations) on different platforms. Write rules
# for them explicitly rather than trying to teach automake about them.
@@ -1362,6 +1377,7 @@ uninstall-local:
set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
fi; \
fi
+ $(RM) $(DESTDIR)$(libdir)/libhdf5_hl_fortran*
# H5HL_buildiface.F90 generates all the APIs that have a KIND type associated
# with them.
@@ -1583,7 +1599,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am
index ba672aa..0552aaa 100644
--- a/hl/fortran/test/Makefile.am
+++ b/hl/fortran/test/Makefile.am
@@ -58,18 +58,6 @@ clean-local:
$(RM) *.$(F9XMODEXT); \
fi
-install-data-local:
- @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \
- $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \
- fi
-
-uninstall-local:
- @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \
- if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \
- set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
- fi; \
- fi
-
# Mark this directory as part of the Fortran API (this affects output
# from tests in conclude.am)
FORTRAN_API=yes
diff --git a/hl/fortran/test/Makefile.in b/hl/fortran/test/Makefile.in
index c4719bf..c857de9 100644
--- a/hl/fortran/test/Makefile.in
+++ b/hl/fortran/test/Makefile.in
@@ -573,7 +573,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -607,6 +606,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1185,7 +1185,7 @@ info: info-am
info-am:
-install-data-am: install-data-local
+install-data-am:
install-dvi: install-dvi-am
@@ -1231,7 +1231,7 @@ ps: ps-am
ps-am:
-uninstall-am: uninstall-local
+uninstall-am:
.MAKE: check-am install-am install-strip
@@ -1241,15 +1241,14 @@ uninstall-am: uninstall-local
distclean-compile distclean-generic distclean-libtool \
distclean-local distclean-tags distdir dvi dvi-am html html-am \
info info-am install install-am install-data install-data-am \
- install-data-local install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic maintainer-clean-local mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- mostlyclean-local pdf pdf-am ps ps-am recheck tags tags-am \
- uninstall uninstall-am uninstall-local
+ install-dvi install-dvi-am install-exec install-exec-am \
+ install-html install-html-am install-info install-info-am \
+ install-man install-pdf install-pdf-am install-ps \
+ install-ps-am install-strip installcheck installcheck-am \
+ installdirs maintainer-clean maintainer-clean-generic \
+ maintainer-clean-local mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \
+ pdf-am ps ps-am recheck tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
@@ -1276,18 +1275,6 @@ clean-local:
$(RM) *.$(F9XMODEXT); \
fi
-install-data-local:
- @if test -n "$(F9XMODEXT)" && test "X$(F9XMODEXT)" != "Xo"; then \
- $(CP) $(top_builddir)/$(subdir)/*.$(F9XMODEXT) $(DESTDIR)$(includedir)/. ; \
- fi
-
-uninstall-local:
- @if test -n "$(F9XMODEXT)" -a "X$(F9XMODEXT)" != "Xo"; then \
- if test -f "$(includedir)/hdf5.$(F9XMODEXT)" -o -f "$(DESTDIR)$(includedir)/HDF5.$(F9XMODEXT)"; then \
- set -x; $(RM) $(includedir)/*.$(F9XMODEXT); \
- fi; \
- fi
-
# Treat all .f90 and .F90 files as preprocessed Fortran.
.f90.o:
$(PPFCCOMPILE) -c -o $@ $<
@@ -1490,7 +1477,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt
index e339f11..bf0f6ff 100644
--- a/hl/src/CMakeLists.txt
+++ b/hl/src/CMakeLists.txt
@@ -21,7 +21,6 @@ set (HL_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/H5DOpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5DSpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5IMpublic.h
- ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
${HDF5_HL_SRC_SOURCE_DIR}/H5LTpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5PTpublic.h
${HDF5_HL_SRC_SOURCE_DIR}/H5TBpublic.h
@@ -29,7 +28,11 @@ set (HL_HEADERS
${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h
)
-add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS})
+set (HL_PRIVATE_HEADERS
+ ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h
+)
+
+add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
target_include_directories(${HDF5_HL_LIB_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
@@ -42,7 +45,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF
set (install_targets ${HDF5_HL_LIB_TARGET})
if (BUILD_SHARED_LIBS)
- add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS})
+ add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS})
target_include_directories(${HDF5_HL_LIBSH_TARGET}
PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
INTERFACE "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
diff --git a/hl/src/Makefile.in b/hl/src/Makefile.in
index ec70cfb..44c42cc 100644
--- a/hl/src/Makefile.in
+++ b/hl/src/Makefile.in
@@ -555,7 +555,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -589,6 +588,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -733,29 +733,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# This library is our main target.
@@ -1500,7 +1500,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/test/Makefile.in b/hl/test/Makefile.in
index 0e615b6..ab221ab 100644
--- a/hl/test/Makefile.in
+++ b/hl/test/Makefile.in
@@ -607,7 +607,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -641,6 +640,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1607,7 +1607,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/tools/Makefile.in b/hl/tools/Makefile.in
index 70c0e26..46c01f6 100644
--- a/hl/tools/Makefile.in
+++ b/hl/tools/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1428,7 +1428,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/tools/gif2h5/Makefile.in b/hl/tools/gif2h5/Makefile.in
index 41c069d..18b4040 100644
--- a/hl/tools/gif2h5/Makefile.in
+++ b/hl/tools/gif2h5/Makefile.in
@@ -568,7 +568,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -602,6 +601,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1502,7 +1502,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/hl/tools/h5watch/CMakeTests.cmake b/hl/tools/h5watch/CMakeTests.cmake
index 0b7b4d4..13d5e47 100644
--- a/hl/tools/h5watch/CMakeTests.cmake
+++ b/hl/tools/h5watch/CMakeTests.cmake
@@ -18,16 +18,16 @@
set (H5WATCH_TEST_FILES
w-help1.ddl
- w-err-cmpd1.ddl
- w-err-cmpd2.ddl
- w-err-cmpd3.ddl
- w-err-cmpd4.ddl
- w-err-cmpd5.ddl
- w-err-dset1.ddl
- w-err-dset2.ddl
- w-err-dset-nomax.ddl
- w-err-dset-none.ddl
- w-err-file.ddl
+ w-err-cmpd1.err
+ w-err-cmpd2.err
+ w-err-cmpd3.err
+ w-err-cmpd4.err
+ w-err-cmpd5.err
+ w-err-dset1.err
+ w-err-dset2.err
+ w-err-dset-nomax.err
+ w-err-dset-none.err
+ w-err-file.err
w-err-poll.ddl
w-err-poll0.ddl
w-err-width.ddl
@@ -86,6 +86,25 @@ add_custom_target(H5WATCH_files ALL COMMENT "Copying files needed by H5WATCH tes
endif ()
endmacro ()
+ macro (ADD_H5_ERR_TEST resultfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5WATCH_ARGS-h5watch-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5watch>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5WATCH_ARGS-h5watch-${resultfile} PROPERTIES DEPENDS ${last_test})
+ set (last_test "H5WATCH_ARGS-h5watch-${resultfile}")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_WATCH resultfile resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -162,20 +181,20 @@ if (NOT SWMR_INCOMPAT)
ADD_H5_TEST (w-help1 0 --help)
#
# Tests on expected failures
- ADD_H5_TEST (w-err-dset1 1 WATCH.h5)
- ADD_H5_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
- ADD_H5_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
- ADD_H5_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
- ADD_H5_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-dset1 1 WATCH.h5)
+ ADD_H5_ERR_TEST (w-err-dset2 1 WATCH.h5/group/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-dset-none 1 WATCH.h5/DSET_NONE)
+ ADD_H5_ERR_TEST (w-err-dset-nomax 1 WATCH.h5/DSET_NOMAX)
+ ADD_H5_ERR_TEST (w-err-file 1 ../WATCH.h5/DSET_CMPD)
ADD_H5_TEST (w-err-width 1 --width=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll 1 --polling=-8 WATCH.h5/DSET_ONE)
ADD_H5_TEST (w-err-poll0 1 --polling=0 WATCH.h5/DSET_ONE)
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
- ADD_H5_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
- ADD_H5_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd1 1 --fields=fieldx WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd2 1 --fields=field1,field2. WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd3 1 --fields=field1,field2, WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd4 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD)
+ ADD_H5_ERR_TEST (w-err-cmpd5 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD)
#
endif ()
diff --git a/hl/tools/h5watch/Makefile.in b/hl/tools/h5watch/Makefile.in
index dc7a7c0..ffc0277 100644
--- a/hl/tools/h5watch/Makefile.in
+++ b/hl/tools/h5watch/Makefile.in
@@ -571,7 +571,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -605,6 +604,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1527,7 +1527,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/hl/tools/h5watch/testh5watch.sh.in b/hl/tools/h5watch/testh5watch.sh.in
index 3f8f5ae..d31bcc3 100644
--- a/hl/tools/h5watch/testh5watch.sh.in
+++ b/hl/tools/h5watch/testh5watch.sh.in
@@ -32,19 +32,19 @@ fi
#echo
#exit 0
-H5WATCH=h5watch # The tool name
-H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
-EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
-EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
+H5WATCH=h5watch # The tool name
+H5WATCH_BIN=`pwd`/$H5WATCH # The path of H5WATCH
+EXTEND_DSET=extend_dset # Routine to extend the dataset when watching
+EXTEND_BIN=`pwd`/$EXTEND_DSET # The path of EXTEND_DSET
#
EXIT_SUCCESS=0
EXIT_FAILURE=1
#
-GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
-GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
+GEN_TEST=h5watchgentest # Generate HDF5 file with various datasets
+GEN_TEST_BIN=`pwd`/$GEN_TEST # Path of the binary GEN_TEST
WATCHFILE=`pwd`/WATCH.h5 # The HDF5 file generated to test h5watch
TESTFILE=TEST.h5 # The temporary file (a copy of WATCH.h5) used by tests
-TRY_MAX=30 # Try running the test again
+TRY_MAX=30 # Try running the test again
#
# These 3 defines should be the same as the defines in ./extend_dset.c
WRITER_MESSAGE=writer_message # The message file created by the "extend" process
@@ -53,7 +53,7 @@ MESSAGE_TIMEOUT=300 # Message timeout length in secs
#
CMP='cmp -s'
DIFF='diff -c'
-NLINES=20 # Max. lines of output to display if test fails
+NLINES=20 # Max. lines of output to display if test fails
#
# Mac OS: just to make sure echo "backslash backslash" behaves properly
if test `uname -s` = 'Darwin'; then
@@ -83,9 +83,9 @@ TESTING() {
# Overall algorithm:
#
# Run a test and print PASSED or FAILED
-# If a test did not return with the expected return code,
+# If a test did not return with the expected return code,
# increment the `nerrors' global variable and (if $verbose is set) display up to $NLINES
-# lines of the actual output from the test.
+# lines of the actual output from the test.
# If the test did return the expected code,
# compare the actual output with the expected output;
# If the outputs are the same, print PASSED,
@@ -137,7 +137,54 @@ TOOLTEST() {
# Clean up output file
if test -z "$HDF5_NOCLEANUP"; then
- rm -f $actual $actual_err
+ rm -f $actual $actual_err
+ fi
+}
+#
+# TOOLTEST_ERR():
+# same as toolset only compare error file
+#
+# Arguments:
+#
+# $1 -- expected output
+# $2 -- expected return code
+# $3 and on -- arguments for h5watch
+TOOLTEST_ERR() {
+ expect="$srcdir/../testfiles/$1"
+ expect_err="$srcdir/../testfiles/`basename $1 .ddl`.err"
+ actual="../testfiles/`basename $1 .ddl`.out"
+ actual_err="../testfiles/`basename $1 .ddl`.out.err"
+ shift
+ retvalexpect=$1
+ shift
+ # Run test.
+ TESTING $H5WATCH $@
+ (
+ $RUNSERIAL $H5WATCH_BIN "$@"
+ ) > $actual 2>$actual_err
+ exitcode=$?
+ if [ $exitcode -ne $retvalexpect ]; then
+ $ECHO "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if [ yes = "$verbose" ]; then
+ $ECHO "test returned with exit code $exitcode"
+ $ECHO "test output: (up to $NLINES lines)"
+ head -$NLINES $actual
+ $ECHO "***end of test output***"
+ $ECHO ""
+ fi
+ elif $CMP $expect_err $actual_err; then
+ $ECHO " PASSED"
+ else
+ $ECHO "*FAILED*"
+ $ECHO " Expected result differs from actual result"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err
fi
}
@@ -176,15 +223,15 @@ do
# Wait for message from "extend_dset" process to start h5watch--
# To wait for the writer message file or till the maximum # of seconds is reached
# This performs similar function as the routine h5_wait_message() in test/h5test.c
- mexist=0 # Indicate whether the message file is found
- t0=`date +%s` # Get current time in seconds
- difft=0 # Initialize the time difference
- while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
+ mexist=0 # Indicate whether the message file is found
+ t0=`date +%s` # Get current time in seconds
+ difft=0 # Initialize the time difference
+ while [ $difft -lt $MESSAGE_TIMEOUT ] ; # Loop till message times out
do
- t1=`date +%s` # Get current time in seconds
- difft=`expr $t1 - $t0` # Calculate the time difference
+ t1=`date +%s` # Get current time in seconds
+ difft=`expr $t1 - $t0` # Calculate the time difference
if [ -e $WRITER_MESSAGE ]; then # If message file is found:
- mexist=1 # indicate the message file is found
+ mexist=1 # indicate the message file is found
rm $WRITER_MESSAGE # remove the message file
break # get out of the while loop
fi
@@ -211,8 +258,8 @@ do
wait $extend_pid # Wait for "extend" process to complete
extend_exit=$? # Collect "extend" process' exit code
sleep 1 # Sleep to make sure output is flushed
- kill $watch_pid # Kill h5watch
- wait $watch_pid # Wait for "h5watch" process to complete
+ kill $watch_pid # Kill h5watch
+ wait $watch_pid # Wait for "h5watch" process to complete
#
if [ $extend_exit -ne 0 ]; then # Error returned from "extend" process
$ECHO "*FAILED*"
@@ -265,7 +312,7 @@ done;
# DSET_ONE: one-dimensional dataset #
# DSET_TWO: two-dimensional dataset #
# DSET_CMPD: one-dimensional dataset with compound type #
-# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
+# DSET_CMPD_ESC: one-dimensional dataset with compound type & escape/separator characters #
# DSET_CMPD_TWO: two-dimensional dataset with compound type #
# #
# The following datasets are one-dimensional, chunked, max. dimension setting: #
@@ -282,11 +329,11 @@ done;
#################################################################################################
# #
# Tests on expected failures: #
-# Invalid file name #
-# Unable to find dataset, invalid dataset #
-# DSET_NONE and DSET_NOMAX #
-# Invalid input to options --width and --polling #
-# Invalid field names for -f option #
+# Invalid file name #
+# Unable to find dataset, invalid dataset #
+# DSET_NONE and DSET_NOMAX #
+# Invalid input to options --width and --polling #
+# Invalid field names for -f option #
# #
#################################################################################################
#
@@ -296,21 +343,21 @@ $GEN_TEST_BIN
TOOLTEST w-help1.ddl 0 --help
#
# Tests on expected failures
-TOOLTEST w-err-dset1.ddl 1 WATCH.h5
-TOOLTEST w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
-TOOLTEST w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
-TOOLTEST w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
-TOOLTEST w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-dset1.ddl 1 WATCH.h5
+TOOLTEST_ERR w-err-dset2.ddl 1 WATCH.h5/group/DSET_CMPD
+TOOLTEST_ERR w-err-dset-none.ddl 1 WATCH.h5/DSET_NONE
+TOOLTEST_ERR w-err-dset-nomax.ddl 1 WATCH.h5/DSET_NOMAX
+TOOLTEST_ERR w-err-file.ddl 1 ../WATCH.h5/DSET_CMPD
TOOLTEST w-err-width.ddl 1 --width=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll.ddl 1 --polling=-8 WATCH.h5/DSET_ONE
TOOLTEST w-err-poll0.ddl 1 --polling=0 WATCH.h5/DSET_ONE
#
# Tests on invalid field names via --fields option for a compound typed dataset: DSET_CMPD
-TOOLTEST w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
-TOOLTEST w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd1.ddl 1 --fields=fieldx WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd2.ddl 1 --fields=field1,field2. WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd3.ddl 1 --fields=field1,field2, WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd4.ddl 1 --fields=field1,field2.b.k WATCH.h5/DSET_CMPD
+TOOLTEST_ERR w-err-cmpd5.ddl 1 --fields=field1 --fields=field2.b.k WATCH.h5/DSET_CMPD
#
echo "DONE WITH 1st SET OF TESTS"
#
diff --git a/hl/tools/testfiles/w-err-cmpd3.ddl b/hl/tools/testfiles/w-err-cmpd1.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd3.ddl
+++ b/hl/tools/testfiles/w-err-cmpd1.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd4.ddl b/hl/tools/testfiles/w-err-cmpd2.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd4.ddl
+++ b/hl/tools/testfiles/w-err-cmpd2.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd1.ddl b/hl/tools/testfiles/w-err-cmpd3.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd1.ddl
+++ b/hl/tools/testfiles/w-err-cmpd3.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd2.ddl b/hl/tools/testfiles/w-err-cmpd4.err
index 775d6a0..9c165fb 100644
--- a/hl/tools/testfiles/w-err-cmpd2.ddl
+++ b/hl/tools/testfiles/w-err-cmpd4.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-cmpd5.err b/hl/tools/testfiles/w-err-cmpd5.err
new file mode 100644
index 0000000..9c165fb
--- /dev/null
+++ b/hl/tools/testfiles/w-err-cmpd5.err
@@ -0,0 +1 @@
+h5watch error: error in processing <list_of_fields>
diff --git a/hl/tools/testfiles/w-err-dset-nomax.ddl b/hl/tools/testfiles/w-err-dset-nomax.err
index b99cf84..fd5ca7e 100644
--- a/hl/tools/testfiles/w-err-dset-nomax.ddl
+++ b/hl/tools/testfiles/w-err-dset-nomax.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NOMAX" should have unlimited or max. dimension setting
diff --git a/hl/tools/testfiles/w-err-dset-none.ddl b/hl/tools/testfiles/w-err-dset-none.err
index cbf6770..db781c3 100644
--- a/hl/tools/testfiles/w-err-dset-none.ddl
+++ b/hl/tools/testfiles/w-err-dset-none.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: "/DSET_NONE" should be a chunked or virtual dataset
diff --git a/hl/tools/testfiles/w-err-dset1.ddl b/hl/tools/testfiles/w-err-dset1.err
index 433c4d6..d6b2a6e 100644
--- a/hl/tools/testfiles/w-err-dset1.ddl
+++ b/hl/tools/testfiles/w-err-dset1.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: no dataset specified
diff --git a/hl/tools/testfiles/w-err-dset2.ddl b/hl/tools/testfiles/w-err-dset2.err
index 81b52de..3f77ec8 100644
--- a/hl/tools/testfiles/w-err-dset2.ddl
+++ b/hl/tools/testfiles/w-err-dset2.err
@@ -1,2 +1 @@
-Opened "WATCH.h5" with sec2 driver.
h5watch error: unable to open dataset "/group/DSET_CMPD"
diff --git a/hl/tools/testfiles/w-err-file.ddl b/hl/tools/testfiles/w-err-file.err
index 015661f..015661f 100644
--- a/hl/tools/testfiles/w-err-file.ddl
+++ b/hl/tools/testfiles/w-err-file.err
diff --git a/hl/tools/testfiles/w-err-cmpd5.ddl b/hl/tools/testfiles/w-err-std.ddl
index 775d6a0..775d6a0 100644
--- a/hl/tools/testfiles/w-err-cmpd5.ddl
+++ b/hl/tools/testfiles/w-err-std.ddl
diff --git a/java/Makefile.in b/java/Makefile.in
index 268b4d1..9a3ad25 100644
--- a/java/Makefile.in
+++ b/java/Makefile.in
@@ -558,7 +558,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -592,6 +591,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1433,7 +1433,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/examples/Makefile.in b/java/examples/Makefile.in
index cbbfded..a2f844e 100644
--- a/java/examples/Makefile.in
+++ b/java/examples/Makefile.in
@@ -558,7 +558,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -592,6 +591,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1430,7 +1430,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/examples/datasets/Makefile.in b/java/examples/datasets/Makefile.in
index 4bd266c..e7a420c 100644
--- a/java/examples/datasets/Makefile.in
+++ b/java/examples/datasets/Makefile.in
@@ -498,7 +498,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -532,6 +531,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1311,7 +1311,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/examples/datatypes/Makefile.in b/java/examples/datatypes/Makefile.in
index 1db68a7..ed8988e 100644
--- a/java/examples/datatypes/Makefile.in
+++ b/java/examples/datatypes/Makefile.in
@@ -498,7 +498,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -532,6 +531,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1311,7 +1311,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/examples/groups/Makefile.in b/java/examples/groups/Makefile.in
index 53027b7..d2b2ff9 100644
--- a/java/examples/groups/Makefile.in
+++ b/java/examples/groups/Makefile.in
@@ -498,7 +498,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -532,6 +531,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1300,7 +1300,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/examples/intro/Makefile.in b/java/examples/intro/Makefile.in
index 52f937a..f7a424c 100644
--- a/java/examples/intro/Makefile.in
+++ b/java/examples/intro/Makefile.in
@@ -498,7 +498,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -532,6 +531,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1300,7 +1300,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/src/Makefile.in b/java/src/Makefile.in
index 1523e8a..4c5f8df 100644
--- a/java/src/Makefile.in
+++ b/java/src/Makefile.in
@@ -389,7 +389,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -423,6 +422,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java
index d8df814..255a8ec 100644
--- a/java/src/hdf/hdf5lib/H5.java
+++ b/java/src/hdf/hdf5lib/H5.java
@@ -70,8 +70,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF
* Reference Manual.
*
- * <center>
- * <table border=2 cellpadding=2>
+ * <table border=1>
* <caption><b>HDF-5 C types to Java types</b> </caption>
* <tr>
* <td><b>HDF-5</b></td>
@@ -107,8 +106,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* <td>Special -- see HDFArray</td>
* </tr>
* </table>
- * </center>
- * <center> <b>General Rules for Passing Arguments and Results</b> </center>
+ * <b>General Rules for Passing Arguments and Results</b>
* <p>
* In general, arguments passed <b>IN</b> to Java are the analogous basic types, as above. The exception is for arrays,
* which are discussed below.
@@ -143,7 +141,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* <p>
* All the routines where this convention is used will have specific documentation of the details, given below.
* <p>
- * <a NAME="ARRAYS"> <b>Arrays</b> </a>
+ * <b>Arrays</b>
* <p>
* HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the
* layout of the source and destination, and the data for the array passed as a block of bytes, for instance,
@@ -176,7 +174,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* and the parameter <i>data</i> can be any multi-dimensional array of numbers, such as float[][], or int[][][], or
* Double[][].
* <p>
- * <a NAME="CONSTANTS"> <b>HDF-5 Constants</b></a>
+ * <b>HDF-5 Constants</b>
* <p>
* The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs
* via the class <a href="./hdf.hdf5lib.HDF5Constants.html"> <b>HDF5Constants</b></a>. For example, the parameters for
@@ -196,7 +194,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* The Java application uses both types of constants the same way, the only difference is that the
* <b><i>HDF5CDataTypes</i></b> may have different values on different platforms.
* <p>
- * <a NAME="ERRORS"> <b>Error handling and Exceptions</b></a>
+ * <b>Error handling and Exceptions</b>
* <p>
* The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the
* JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural
@@ -214,7 +212,7 @@ import hdf.hdf5lib.structs.H5O_info_t;
* exception handlers to print out the HDF-5 error stack.
* <hr>
*
- * @version HDF5 1.10.4 <BR>
+ * @version HDF5 1.10.5 <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 +235,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, 10, 4 };
+ public final static int LIB_VERSION[] = { 1, 10, 5 };
public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib";
@@ -499,9 +497,9 @@ public class H5 implements java.io.Serializable {
private synchronized static native boolean H5is_library_threadsafe();
// /////// unimplemented ////////
- // H5_DLL herr_t H5free_memory(void *mem);
- // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear);
- // H5_DLL void *H5resize_memory(void *mem, size_t size);
+ // herr_t H5free_memory(void *mem);
+ // void *H5allocate_memory(size_t size, hbool_t clear);
+ // void *H5resize_memory(void *mem, size_t size);
// ////////////////////////////////////////////////////////////
// //
@@ -852,7 +850,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public static long H5Aget_space(long attr_id) throws HDF5LibraryException {
+ public static long H5Aget_space(long attr_id) throws HDF5LibraryException
+ {
long id = _H5Aget_space(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_space add {}", id);
@@ -888,7 +887,8 @@ public class H5 implements java.io.Serializable {
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
**/
- public static long H5Aget_type(long attr_id) throws HDF5LibraryException {
+ public static long H5Aget_type(long attr_id) throws HDF5LibraryException
+ {
long id = _H5Aget_type(attr_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aget_type add {}", id);
@@ -918,8 +918,9 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - Name is null.
**/
- public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException,
- NullPointerException {
+ public static long H5Aopen(long obj_id, String attr_name, long aapl_id)
+ throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen(obj_id, attr_name, aapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen add {}", id);
@@ -959,7 +960,8 @@ public class H5 implements java.io.Serializable {
* - Name is null.
**/
public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id,
- long lapl_id) throws HDF5LibraryException, NullPointerException {
+ long lapl_id) throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id);
@@ -994,7 +996,8 @@ public class H5 implements java.io.Serializable {
* - obj_name is null.
**/
public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id)
- throws HDF5LibraryException, NullPointerException {
+ throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Aopen_by_name add {}", id);
@@ -1015,8 +1018,10 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of an attribute to read.
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
- * @param buf
- * IN: Buffer for data to be read.
+ * @param obj
+ * Buffer to store data read from the file.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
@@ -1025,9 +1030,19 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data buffer is null.
**/
- public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf)
+ public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] obj, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ return H5Aread(attr_id, mem_type_id, obj, true);
+ }
+
/**
* H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is read into data object from the file.
@@ -1038,31 +1053,143 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Object for data to be read.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
+ * @exception HDF5Exception
+ * - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
* - data buffer is null. See public synchronized static native int H5Aread( )
**/
- public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception,
- NullPointerException {
- HDFArray theArray = new HDFArray(obj);
- byte[] buf = theArray.emptyBytes();
+ public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ int status = -1;
+ boolean is1D = false;
- // This will raise an exception if there is an error
- int status = H5Aread(attr_id, mem_type_id, buf);
+ Class dataClass = obj.getClass();
+ if (!dataClass.isArray()) {
+ throw (new HDF5JavaException("H5Aread: data is not an array"));
+ }
- // No exception: status really ought to be OK
- if (status >= 0) {
- obj = theArray.arrayify(buf);
+ String cname = dataClass.getName();
+ is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
+ char dname = cname.charAt(cname.lastIndexOf("[") + 1);
+ log.trace("H5Aread: cname={} is1D={} dname={}", cname, is1D, dname);
+
+ if (is1D && (dname == 'B')) {
+ log.trace("H5Aread_dname_B");
+ status = H5Aread(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'S')) {
+ log.trace("H5Aread_dname_S");
+ status = H5Aread_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'I')) {
+ log.trace("H5Aread_dname_I");
+ status = H5Aread_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'J')) {
+ log.trace("H5Aread_dname_J");
+ status = H5Aread_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'F')) {
+ log.trace("H5Aread_dname_F");
+ status = H5Aread_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'D')) {
+ log.trace("H5Aread_dname_D");
+ status = H5Aread_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
+ }
+ else if ((H5.H5Tdetect_class(mem_type_id, HDF5Constants.H5T_REFERENCE) && (is1D && (dataClass.getComponentType() == String.class))) || H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) {
+ log.trace("H5Aread_reg_ref");
+ status = H5Aread_reg_ref(attr_id, mem_type_id, (String[]) obj);
+ }
+ else if (is1D && (dataClass.getComponentType() == String.class)) {
+ log.trace("H5Aread_string type");
+ status = H5Aread_string(attr_id, mem_type_id, (String[]) obj);
+ }
+ else {
+ // Create a data buffer to hold the data into a Java Array
+ HDFArray theArray = new HDFArray(obj);
+ byte[] buf = theArray.emptyBytes();
+ log.trace("H5Aread_else");
+
+ // This will raise an exception if there is an error
+ status = H5Aread(attr_id, mem_type_id, buf, isCriticalPinning);
+
+ // No exception: status really ought to be OK
+ if (status >= 0) {
+ obj = theArray.arrayify(buf);
+ }
+
+ // clean up these: assign 'null' as hint to gc()
+ buf = null;
+ theArray = null;
}
return status;
}
- public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf)
+ public synchronized static native int H5Aread_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_double(long attr_id, long mem_type_id, double[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_double(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_float(long attr_id, long mem_type_id, float[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_float(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_int(long attr_id, long mem_type_id, int[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_int(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_long(long attr_id, long mem_type_id, long[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_long(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Aread_reg_ref(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Aread_short(long attr_id, long mem_type_id, short[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Aread_short(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, Object[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_string(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5Aread_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
public synchronized static native int H5AreadComplex(long attr_id, long mem_type_id, String[] buf)
@@ -1123,7 +1250,9 @@ public class H5 implements java.io.Serializable {
* @param mem_type_id
* IN: Identifier of the attribute datatype (in memory).
* @param buf
- * IN: Data to be written.
+ * IN: Buffer with data to be written to the file.
+ * @param isCriticalPinning
+ * IN: request lock on data reference.
*
* @return a non-negative value if successful
*
@@ -1132,9 +1261,21 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - data is null.
**/
- public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
+ public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, byte[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite(attr_id, mem_type_id, obj, true);
+ }
+
/**
* H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with
* mem_type_id. The entire attribute is written from data object to the file.
@@ -1145,28 +1286,140 @@ public class H5 implements java.io.Serializable {
* IN: Identifier of the attribute datatype (in memory).
* @param obj
* IN: Data object to be written.
+ * @param isCriticalPinning
+ * request lock on data reference.
*
* @return a non-negative value if successful
*
+ * @exception HDF5Exception
+ * - Failure in the data conversion.
* @exception HDF5LibraryException
* - Error from the HDF-5 Library.
* @exception NullPointerException
- * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int
- * mem_type_id, byte[] buf);
+ * - data object is null
**/
- public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj)
- throws HDF5Exception, NullPointerException
+ public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj, boolean isCriticalPinning)
+ throws HDF5Exception, HDF5LibraryException, NullPointerException
{
- HDFArray theArray = new HDFArray(obj);
- byte[] buf = theArray.byteify();
+ int status = -1;
+ boolean is1D = false;
- int retVal = H5Awrite(attr_id, mem_type_id, buf);
- buf = null;
- theArray = null;
- return retVal;
+ Class dataClass = obj.getClass();
+ if (!dataClass.isArray()) {
+ throw (new HDF5JavaException("H5Dwrite: data is not an array"));
+ }
+
+ String cname = dataClass.getName();
+ is1D = (cname.lastIndexOf('[') == cname.indexOf('['));
+ char dname = cname.charAt(cname.lastIndexOf("[") + 1);
+
+ if (is1D && (dname == 'B')) {
+ status = H5Awrite(attr_id, mem_type_id, (byte[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'S')) {
+ status = H5Awrite_short(attr_id, mem_type_id, (short[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'I')) {
+ status = H5Awrite_int(attr_id, mem_type_id, (int[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'J')) {
+ status = H5Awrite_long(attr_id, mem_type_id, (long[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'F')) {
+ status = H5Awrite_float(attr_id, mem_type_id, (float[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dname == 'D')) {
+ status = H5Awrite_double(attr_id, mem_type_id, (double[]) obj, isCriticalPinning);
+ }
+ else if (is1D && (dataClass.getComponentType() == String.class)) {
+ log.trace("H5Dwrite_string type");
+ status = H5Awrite_string(attr_id, mem_type_id, (String[]) obj);
+ }
+ else {
+ HDFArray theArray = new HDFArray(obj);
+ byte[] buf = theArray.byteify();
+
+ status = H5Awrite(attr_id, mem_type_id, buf);
+ buf = null;
+ theArray = null;
+ }
+
+ return status;
+ }
+
+ public synchronized static native int H5Awrite_double(long attr_id, long mem_type_id, double[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_double(long attr_id, long mem_type_id, double[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_double(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_float(long attr_id, long mem_type_id, float[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_float(long attr_id, long mem_type_id, float[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_float(attr_id, mem_type_id, buf, true);
}
- public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf)
+ public synchronized static native int H5Awrite_int(long attr_id, long mem_type_id, int[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_int(long attr_id, long mem_type_id, int[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_int(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_long(long attr_id, long mem_type_id, long[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_long(long attr_id, long mem_type_id, long[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_long(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_short(long attr_id, long mem_type_id, short[] buf, boolean isCriticalPinning)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static int H5Awrite_short(long attr_id, long mem_type_id, short[] buf)
+ throws HDF5LibraryException, NullPointerException
+ {
+ return H5Awrite_short(attr_id, mem_type_id, buf, true);
+ }
+
+ public synchronized static native int H5Awrite_string(long attr_id, long mem_type_id, String[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, Object[] buf)
+ throws HDF5LibraryException, NullPointerException;
+
+ /**
+ * H5Awrite_VLStrings writes a variable length String dataset, specified by its identifier attr_id, from
+ * the application memory buffer buf into the file.
+ *
+ * ---- contributed by Rosetta Biosoftware
+ *
+ * @param attr_id
+ * Identifier of the attribute read from.
+ * @param mem_type_id
+ * Identifier of the memory datatype.
+ * @param buf
+ * Buffer with data to be written to the file.
+ *
+ * @return a non-negative value if successful
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ * @exception NullPointerException
+ * - name is null.
+ **/
+
+ public synchronized static native int H5Awrite_VLStrings(long attr_id, long mem_type_id, Object[] buf)
throws HDF5LibraryException, NullPointerException;
/**
@@ -1614,8 +1867,8 @@ public class H5 implements java.io.Serializable {
* @exception NullPointerException
* - name is null.
**/
- public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException,
- NullPointerException {
+ public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, NullPointerException
+ {
long id = _H5Dopen2(loc_id, name, dapl_id);
if (id > 0) {
log.trace("OPEN_IDS: H5Dopen add {}", id);
@@ -1664,12 +1917,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@@ -1703,7 +1958,8 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
- NullPointerException {
+ NullPointerException
+ {
int status = -1;
boolean is1D = false;
@@ -1734,7 +1990,8 @@ public class H5 implements java.io.Serializable {
}
else if (is1D && (dname == 'J')) {
log.trace("H5Dread_dname_J");
- status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj);
+ status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj,
+ isCriticalPinning);
}
else if (is1D && (dname == 'F')) {
log.trace("H5Dread_dname_F");
@@ -1783,7 +2040,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1792,7 +2050,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1801,7 +2060,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1810,22 +2070,21 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
- public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException;
-
public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning)
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -1929,12 +2188,14 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
- long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException {
+ long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException
+ {
return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true);
}
@@ -1968,7 +2229,8 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id,
long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException,
- NullPointerException {
+ NullPointerException
+ {
int status = -1;
boolean is1D = false;
@@ -2031,7 +2293,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2040,7 +2303,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2049,7 +2313,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2058,7 +2323,8 @@ public class H5 implements java.io.Serializable {
NullPointerException;
public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2067,7 +2333,8 @@ public class H5 implements java.io.Serializable {
throws HDF5LibraryException, NullPointerException;
public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id,
- long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException {
+ long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException
+ {
return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true);
}
@@ -2133,10 +2400,10 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Drefresh(long dset_id) throws HDF5LibraryException;
// /////// unimplemented ////////
- // H5_DLL herr_t H5Ddebug(hid_t dset_id);
- // H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
- // H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
- // H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
+ // herr_t H5Ddebug(hid_t dset_id);
+ // herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
+ // herr_t H5Dformat_convert(hid_t dset_id);
+ // herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
// herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
// size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data);
@@ -2941,21 +3208,64 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Fget_mdc_logging_status(long file_id, boolean[] mdc_logging_status)
throws HDF5LibraryException, NullPointerException;
+ /**
+ * H5Fget_dset_no_attrs_hint gets the file-level setting to create minimized dataset object headers.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native boolean H5Fget_dset_no_attrs_hint(long file_id)
+ throws HDF5LibraryException;
+
+
+ /**
+ * H5Fset_dset_no_attrs_hint sets the file-level setting to create minimized dataset object headers.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ * @param minimize
+ * the minimize hint setting
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fset_dset_no_attrs_hint(long file_id, boolean minimize)
+ throws HDF5LibraryException;
+
+
+ /**
+ * H5Fset_libver_bounds sets a different low and high bounds while a file is open.
+ *
+ * @param file_id
+ * IN: Identifier of the target file.
+ * @param low
+ * IN: The earliest version of the library that will be used for writing objects
+ * @param high
+ * IN: The latest version of the library that will be used for writing objects.
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Fset_libver_bounds(long file_id, int low, int high)
+ throws HDF5LibraryException;
+
// /////// unimplemented ////////
- // H5_DLL herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
- // H5_DLL herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
+ // herr_t H5Fget_eoa(hid_t file_id, haddr_t *eoa);
+ // herr_t H5Fincrement_filesize(hid_t file_id, hsize_t increment);
// ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len);
// herr_t H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info);
// ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/);
- // H5_DLL herr_t H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high);
- // H5_DLL herr_t H5Fformat_convert(hid_t fid);
- // H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
- // H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
+ // herr_t H5Fformat_convert(hid_t fid);
+ // herr_t H5Freset_page_buffering_stats(hid_t file_id);
+ // herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
// unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
- // H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
+ // herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
// #ifdef H5_HAVE_PARALLEL
- // H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
- // H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
+ // herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
+ // herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
// #endif /* H5_HAVE_PARALLEL */
// /**
@@ -3015,25 +3325,25 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// /////// unimplemented ////////
- // H5_DLL hid_t H5FDregister(const H5FD_class_t *cls);
- // H5_DLL herr_t H5FDunregister(hid_t driver_id);
- // H5_DLL H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
- // H5_DLL herr_t H5FDclose(H5FD_t *file);
- // H5_DLL int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
- // H5_DLL int H5FDquery(const H5FD_t *f, unsigned long *flags);
- // H5_DLL haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
- // H5_DLL herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
- // H5_DLL haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
- // H5_DLL herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
- // H5_DLL haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
- // H5_DLL herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
- // H5_DLL herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/);
- // H5_DLL herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf);
- // H5_DLL herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
- // H5_DLL herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
- // H5_DLL herr_t H5FDlock(H5FD_t *file, hbool_t rw);
- // H5_DLL herr_t H5FDunlock(H5FD_t *file);
- // H5_DLL herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
+ // hid_t H5FDregister(const H5FD_class_t *cls);
+ // herr_t H5FDunregister(hid_t driver_id);
+ // H5FD_t *H5FDopen(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr);
+ // herr_t H5FDclose(H5FD_t *file);
+ // int H5FDcmp(const H5FD_t *f1, const H5FD_t *f2);
+ // int H5FDquery(const H5FD_t *f, unsigned long *flags);
+ // haddr_t H5FDalloc(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size);
+ // herr_t H5FDfree(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, hsize_t size);
+ // haddr_t H5FDget_eoa(H5FD_t *file, H5FD_mem_t type);
+ // herr_t H5FDset_eoa(H5FD_t *file, H5FD_mem_t type, haddr_t eoa);
+ // haddr_t H5FDget_eof(H5FD_t *file, H5FD_mem_t type);
+ // herr_t H5FDget_vfd_handle(H5FD_t *file, hid_t fapl, void**file_handle);
+ // herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *buf/*out*/);
+ // herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *buf);
+ // herr_t H5FDflush(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
+ // herr_t H5FDtruncate(H5FD_t *file, hid_t dxpl_id, hbool_t closing);
+ // herr_t H5FDlock(H5FD_t *file, hbool_t rw);
+ // herr_t H5FDunlock(H5FD_t *file);
+ // herr_t H5FDdriver_query(hid_t driver_id, unsigned long *flags/*out*/);
// ////////////////////////////////////////////////////////////
// //
@@ -3506,7 +3816,7 @@ public class H5 implements java.io.Serializable {
// ////////////////////////////////////////////////////////////
// //
- // H5I: HDF5 1.8 Identifier Interface API Functions //
+ // H5I: HDF5 Identifier Interface API Functions //
// //
// ////////////////////////////////////////////////////////////
@@ -4695,9 +5005,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native void H5Orefresh(long object_id) throws HDF5LibraryException;
// /////// unimplemented ////////
- // H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
- // H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
- // H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
+ // herr_t H5Odisable_mdc_flushes(hid_t object_id);
+ // herr_t H5Oenable_mdc_flushes(hid_t object_id);
+ // herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
// ////////////////////////////////////////////////////////////
// //
@@ -6600,8 +6910,6 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException,
NullPointerException;
- // /////// Dataset creation property list (DCPL) routines ///////
-
/**
* H5Pset_chunk_opts Sets the edge chunk option in a dataset creation property list.
*
@@ -6630,6 +6938,36 @@ public class H5 implements java.io.Serializable {
**/
public synchronized static native int H5Pget_chunk_opts(long dcpl_id) throws HDF5LibraryException;
+ /**
+ * H5Pget_dset_no_attrs_hint accesses the flag for whether or not datasets created by the given dcpl
+ * will be created with a "minimized" object header.
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native boolean H5Pget_dset_no_attrs_hint(long dcpl_id)
+ throws HDF5LibraryException;
+
+
+ /**
+ * H5Pset_dset_no_attrs_hint sets the dcpl to minimize (or explicitly to not minimized) dataset object
+ * headers upon creation.
+ *
+ * @param dcpl_id
+ * IN: Dataset creation property list
+ *
+ * @param minimize
+ * the minimize hint setting
+ *
+ * @exception HDF5LibraryException
+ * - Error from the HDF-5 Library.
+ **/
+ public synchronized static native void H5Pset_dset_no_attrs_hint(long dcpl_id, boolean minimize)
+ throws HDF5LibraryException;
+
// /////// Dataset access property list (DAPL) routines ///////
/**
@@ -7360,6 +7698,8 @@ public class H5 implements java.io.Serializable {
* - version_info is null.
* @exception IllegalArgumentException
* - version_info is illegal.
+ *
+ * @deprecated As of HDF5 1.10.0 in favor of H5Fget_info.
**/
public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException,
NullPointerException, IllegalArgumentException;
@@ -7523,13 +7863,13 @@ public class H5 implements java.io.Serializable {
// herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size);
// #ifdef H5_HAVE_PARALLEL
// herr_t H5Pset_all_coll_metadata_ops(hid_t accpl_id, hbool_t is_collective);
- // H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
+ // herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective);
// herr_t H5Pset_coll_metadata_write(hid_t fapl_id, hbool_t is_collective);
// herr_t H5Pget_coll_metadata_write(hid_t fapl_id, hbool_t *is_collective);
// #endif /* H5_HAVE_PARALLEL */
- // H5_DLL herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
- // H5_DLL herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
- // H5_DLL herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
+ // herr_t H5Pset_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr);
+ // herr_t H5Pget_mdc_image_config(hid_t plist_id, H5AC_cache_image_config_t *config_ptr /*out*/);
+ // herr_t H5Pset_page_buffer_size(hid_t plist_id, size_t buf_size, unsigned min_meta_per, unsigned min_raw_per);
// herr_t H5Pget_page_buffer_size(hid_t fapl_id, size_t *buf_size, unsigned *min_meta_perc, unsigned *min_raw_perc);
// herr_t H5Pset_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t func, void *user_data);
// herr_t H5Pget_object_flush_cb (hid_t fapl_id, H5F_flush_cb_t *func, void **user_data);
@@ -7552,9 +7892,9 @@ public class H5 implements java.io.Serializable {
// herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data)
// herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data)
// #ifdef H5_HAVE_PARALLEL
- // H5_DLL herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
- // H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
- // H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause);
+ // herr_t H5Pget_mpio_actual_chunk_opt_mode(hid_t plist_id, H5D_mpio_actual_chunk_opt_mode_t *actual_chunk_opt_mode);
+ // herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode_t *actual_io_mode);
+ // herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause, uint32_t *global_no_collective_cause);
// #endif /* H5_HAVE_PARALLEL */
// Link creation property list (LCPL) routines //
@@ -8497,14 +8837,14 @@ public class H5 implements java.io.Serializable {
// /////// unimplemented ////////
// #ifdef NEW_HYPERSLAB_API
- // H5_DLL hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
+ // hid_t H5Scombine_hyperslab(hid_t space_id, H5S_seloper_t op,
// const hsize_t start[],
// const hsize_t _stride[],
// const hsize_t count[],
// const hsize_t _block[]);
- // H5_DLL herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
+ // herr_t H5Sselect_select(hid_t space1_id, H5S_seloper_t op,
// hid_t space2_id);
- // H5_DLL hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
+ // hid_t H5Scombine_select(hid_t space1_id, H5S_seloper_t op,
// hid_t space2_id);
// #endif /* NEW_HYPERSLAB_API */
@@ -9995,9 +10335,9 @@ public class H5 implements java.io.Serializable {
public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException;
-}
+ // /////// unimplemented ////////
-// /////// unimplemented ////////
+ // herr_t H5Zregister(const void *cls);
-// herr_t H5Zregister(const void *cls);
+}
diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html
index edb1b76..e3a032b 100644
--- a/java/src/hdf/overview.html
+++ b/java/src/hdf/overview.html
@@ -90,8 +90,7 @@ like this:
The <i><b>H5</b> </i>class automatically loads the native method implementations
and the HDF5 library.
-<h3>
-<a NAME="DOWNLOAD"></a>To Obtain</h3>
+<h3>To Obtain</h3>
The JHI5 is included with the <a href="https://portal.hdfgroup.org/display/support/Downloads">HDF5</a> library.
</body>
diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt
index 7b95e0b..ca48fa6 100644
--- a/java/src/jni/CMakeLists.txt
+++ b/java/src/jni/CMakeLists.txt
@@ -14,6 +14,19 @@ set (HDF5_JAVA_JNI_CSRCS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pACPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDXPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLAPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCpyPLImp.c
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pStrCPLImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.c
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c
@@ -35,6 +48,19 @@ set (HDF5_JAVA_JNI_CHDRS
${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pACPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pDXPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pFCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pGCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLAPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pLCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pOCpyPLImp.h
+ ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pStrCPLImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.h
${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h
@@ -48,7 +74,9 @@ set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
########### JNI libraries always must be built shared ###############
add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS})
-target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET} PRIVATE ${HDF5_BINARY_DIR} ${HDF5_JAVA_JNI_SOURCE_DIR})
+target_include_directories(${HDF5_JAVA_JNI_LIB_TARGET}
+ PRIVATE "${HDF5_BINARY_DIR};${HDF5_JAVA_JNI_SOURCE_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>"
+)
TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED)
target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} PUBLIC ${HDF5_LIBSH_TARGET})
set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni)
diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am
index 6ded371..1bded3d 100644
--- a/java/src/jni/Makefile.am
+++ b/java/src/jni/Makefile.am
@@ -34,7 +34,10 @@ libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $
# Source files for the library
libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \
h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \
- h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c
+ h5pImp.c h5pACPLImp.c h5pDAPLImp.c h5pDCPLImp.c h5pDXPLImp.c \
+ h5pFAPLImp.c h5pFCPLImp.c h5pGAPLImp.c h5pGCPLImp.c h5pLAPLImp.c h5pLCPLImp.c \
+ h5pOCPLImp.c h5pOCpyPLImp.c h5pStrCPLImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c \
+ h5zImp.c
# HDF5 Java (JNI) library depends on HDF5 Library.
libhdf5_java_la_LIBADD=$(LIBHDF5)
diff --git a/java/src/jni/Makefile.in b/java/src/jni/Makefile.in
index d0862c3..76eec4e 100644
--- a/java/src/jni/Makefile.in
+++ b/java/src/jni/Makefile.in
@@ -165,7 +165,11 @@ libhdf5_java_la_DEPENDENCIES = $(LIBHDF5)
am_libhdf5_java_la_OBJECTS = exceptionImp.lo h5Constants.lo \
nativeData.lo h5util.lo h5Imp.lo h5aImp.lo h5dImp.lo h5eImp.lo \
h5fImp.lo h5gImp.lo h5iImp.lo h5lImp.lo h5oImp.lo h5pImp.lo \
- h5plImp.lo h5rImp.lo h5sImp.lo h5tImp.lo h5zImp.lo
+ h5pACPLImp.lo h5pDAPLImp.lo h5pDCPLImp.lo h5pDXPLImp.lo \
+ h5pFAPLImp.lo h5pFCPLImp.lo h5pGAPLImp.lo h5pGCPLImp.lo \
+ h5pLAPLImp.lo h5pLCPLImp.lo h5pOCPLImp.lo h5pOCpyPLImp.lo \
+ h5pStrCPLImp.lo h5plImp.lo h5rImp.lo h5sImp.lo h5tImp.lo \
+ h5zImp.lo
libhdf5_java_la_OBJECTS = $(am_libhdf5_java_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -556,7 +560,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -590,6 +593,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -734,29 +738,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# Mark this directory as part of the JNI API
@@ -771,7 +775,10 @@ libhdf5_java_la_LDFLAGS = -avoid-version -shared -export-dynamic -version-info $
# Source files for the library
libhdf5_java_la_SOURCES = exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \
h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \
- h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c
+ h5pImp.c h5pACPLImp.c h5pDAPLImp.c h5pDCPLImp.c h5pDXPLImp.c \
+ h5pFAPLImp.c h5pFCPLImp.c h5pGAPLImp.c h5pGCPLImp.c h5pLAPLImp.c h5pLCPLImp.c \
+ h5pOCPLImp.c h5pOCpyPLImp.c h5pStrCPLImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c \
+ h5zImp.c
# HDF5 Java (JNI) library depends on HDF5 Library.
@@ -887,7 +894,20 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5iImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5lImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5oImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pACPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pDAPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pDCPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pDXPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pFAPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pFCPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pGAPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pGCPLImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pLAPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pLCPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pOCPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pOCpyPLImp.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5pStrCPLImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5plImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5rImp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5sImp.Plo@am__quote@
@@ -1493,7 +1513,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c
index ccda0d2..0faa0cc 100644
--- a/java/src/jni/exceptionImp.c
+++ b/java/src/jni/exceptionImp.c
@@ -33,21 +33,14 @@ extern "C" {
#include "h5jni.h"
#include "exceptionImp.h"
-extern H5E_auto2_t efunc;
-extern void *edata;
+extern H5E_auto2_t efunc;
+extern void *edata;
/*******************/
/* Local Variables */
/*******************/
-/* These types are copied from H5Eprivate.h
- * They should be moved to a public include file, and deleted from
- * here.
- */
-
-#define H5E_NSLOTS 32 /*number of slots in an error stack */
-
/*
* The list of error messages in the system is kept as an array of
* error_code/message pairs, one for major error numbers and another for
@@ -73,29 +66,29 @@ typedef struct H5E_num_t {
/* Local Macros */
/********************/
-#define THROWEXCEPTION(className,args) { \
- jclass jc; \
- jmethodID jm; \
- jobject ex; \
- jc = ENVPTR->FindClass(ENVPAR (className)); \
- if (jc == NULL) { \
- return JNI_FALSE; \
- } \
- jm = ENVPTR->GetMethodID(ENVPAR jc, "<init>", "(Ljava/lang/String;)V"); \
- if (jm == NULL) { \
- printf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
- return JNI_FALSE; \
- } \
- ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \
- if (ex == NULL) { \
- printf("THROWEXCEPTION FATAL ERROR: %s: Creation failed\n", (className)); \
- return JNI_FALSE; \
- } \
- if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \
- printf("THROWEXCEPTION FATAL ERROR: %s: Throw failed\n", (className)); \
- return JNI_FALSE; \
- } \
- return JNI_TRUE; \
+#define THROWEXCEPTION(className, args) \
+{ \
+ jmethodID jm; \
+ jclass jc; \
+ jobject ex; \
+ \
+ if (NULL == (jc = ENVPTR->FindClass(ENVONLY, (className)))) \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ \
+ if (NULL == (jm = ENVPTR->GetMethodID(ENVONLY, jc, "<init>", "(Ljava/lang/String;)V"))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: GetMethodID failed\n"); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (NULL == (ex = ENVPTR->NewObjectA(ENVONLY, jc, jm, (jvalue *)(args)))) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Creation failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
+ \
+ if (ENVPTR->Throw(ENVONLY, (jthrowable)ex) < 0) { \
+ HDprintf("THROWEXCEPTION FATAL ERROR: Class %s: Throw failed\n", (className)); \
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE); \
+ } \
}
/********************/
@@ -112,7 +105,9 @@ walk_error_callback
{
H5E_num_t *err_nums = (H5E_num_t *)_err_nums;
- if(err_desc) {
+ UNUSED(n);
+
+ if (err_desc) {
err_nums->maj_num = err_desc->maj_num;
err_nums->min_num = err_desc->min_num;
} /* end if */
@@ -130,8 +125,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5error_1off
(JNIEnv *env, jclass clss)
{
- H5Eget_auto2(H5E_DEFAULT, &efunc, &edata);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+ UNUSED(env);
+ UNUSED(clss);
+
+ if (H5Eget_auto2(H5E_DEFAULT, &efunc, &edata) < 0)
+ return -1;
+
+ if (H5Eset_auto2(H5E_DEFAULT, NULL, NULL) < 0)
+ return -1;
+
return 0;
} /* end Java_hdf_hdf5lib_H5_H5error_1off() */
@@ -145,10 +147,12 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5error_1on
(JNIEnv *env, jclass clss)
{
+ UNUSED(env);
+ UNUSED(clss);
+
H5Eset_auto2(H5E_DEFAULT, efunc, edata);
} /* end Java_hdf_hdf5lib_H5_H5error_1on() */
-
/*
* Class: hdf_hdf5lib_exceptions_HDFLibraryException
* Method: printStackTrace0
@@ -163,18 +167,25 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0
FILE *stream = NULL;
const char *file = NULL;
- if(file_name == NULL) {
+ UNUSED(obj);
+
+ if (NULL == file_name) {
H5Eprint2(H5E_DEFAULT, stderr);
- } /* end if */
+ }
else {
- file = ENVPTR->GetStringUTFChars(ENVPAR file_name, 0);
- stream = HDfopen(file, "a+");
- if(stream) {
+ PIN_JAVA_STRING(ENVONLY, file_name, file, NULL, "printStackTrace0: file name not pinned");
+
+ if ((stream = HDfopen(file, "a+"))) {
H5Eprint2(H5E_DEFAULT, stream);
HDfclose(stream);
- } /* end if */
- ENVPTR->ReleaseStringUTFChars(ENVPAR file_name, file);
- } /* end else */
+ }
+ }
+
+done:
+ if (file)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, file);
+
+ return;
} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0() */
/*
@@ -189,10 +200,15 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber
(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
+
+ UNUSED(env);
+ UNUSED(obj);
+
err_nums.maj_num = 0;
err_nums.min_num = 0;
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums);
+ if (H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums) < 0)
+ return -1;
return err_nums.maj_num;
} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMajorErrorNumber() */
@@ -209,27 +225,42 @@ Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber
(JNIEnv *env, jobject obj)
{
H5E_num_t err_nums;
+
+ UNUSED(env);
+ UNUSED(obj);
+
err_nums.maj_num = 0;
err_nums.min_num = 0;
- H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums);
+ if (H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums) < 0)
+ return -1;
return err_nums.min_num;
} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException__1getMinorErrorNumber() */
/*
- * Routine to raise particular Java exceptions from C
+ * Routine to raise particular Java exceptions from C.
*/
static jboolean
H5JNIErrorClass
(JNIEnv *env, const char *message, const char *className)
{
- char *args[2];
- jstring str = ENVPTR->NewStringUTF(ENVPAR message);
- args[0] = (char *)str;
+ jstring str;
+ char *args[2];
+ jboolean retVal = JNI_FALSE;
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, message)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ args[0] = (char *) str;
args[1] = 0;
THROWEXCEPTION(className, args);
+
+ retVal = JNI_TRUE;
+
+done:
+ return retVal;
} /* end H5JNIErrorClass() */
/*
@@ -316,7 +347,7 @@ h5unimplemented
*/
jboolean
h5raiseException
- (JNIEnv *env, const char *exception, const char *message)
+ (JNIEnv *env, const char *message, const char *exception)
{
return H5JNIErrorClass(env, message, exception);
} /* end h5raiseException() */
@@ -336,51 +367,76 @@ jboolean
h5libraryError
(JNIEnv *env)
{
- char *args[2];
const char *exception = NULL;
- char *msg_str = NULL;
- int num_errs = 0;
- hid_t min_num;
- hid_t maj_num;
- ssize_t msg_size = 0;
H5E_type_t error_msg_type;
- jstring str = NULL;
- hid_t stk_id = -1;
H5E_num_t exceptionNumbers;
+ jstring str = NULL;
+ ssize_t msg_size = 0;
+ hid_t min_num;
+ hid_t maj_num;
+ hid_t stk_id = H5I_INVALID_HID;
+ char *args[2];
+ char *msg_str = NULL;
+ jboolean retVal = JNI_FALSE;
exceptionNumbers.maj_num = 0;
exceptionNumbers.min_num = 0;
/* Save current stack contents for future use */
- stk_id = H5Eget_current_stack(); /* This will clear current stack */
- if(stk_id >= 0)
- H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers);
+ if ((stk_id = H5Eget_current_stack()) >= 0)
+ /* This will clear current stack */
+ if (H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers) < 0)
+ goto done;
+
maj_num = exceptionNumbers.maj_num;
min_num = exceptionNumbers.min_num;
+ /*
+ * TODO: handle < 0 case.
+ */
+
+ /*
+ * No error detected in HDF5 error stack.
+ */
+ if (!maj_num && !min_num)
+ goto done;
+
exception = defineHDF5LibraryException(maj_num);
/* get the length of the name */
- msg_size = H5Eget_msg(min_num, NULL, NULL, 0);
- if(msg_size > 0) {
- msg_size++; /* add extra space for the null terminator */
- msg_str = (char*)HDcalloc((size_t)msg_size, sizeof(char));
- if(msg_str) {
- msg_size = H5Eget_msg(min_num, &error_msg_type, (char *)msg_str, (size_t)msg_size);
- str = ENVPTR->NewStringUTF(ENVPAR msg_str);
- HDfree(msg_str);
- } /* end if */
- } /* end if */
+ if ((msg_size = H5Eget_msg(min_num, NULL, NULL, 0)) < 0)
+ goto done;
+
+ if (msg_size > 0) {
+ if (NULL == (msg_str = (char *) HDcalloc((size_t)msg_size + 1, sizeof(char))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5libraryerror: failed to allocate buffer for error message");
+
+ if ((msg_size = H5Eget_msg(min_num, &error_msg_type, msg_str, (size_t)msg_size + 1)) < 0)
+ goto done;
+ msg_str[msg_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, msg_str)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
else
str = NULL;
- if(stk_id >= 0)
+
+ if (stk_id >= 0)
H5Eset_current_stack(stk_id);
- args[0] = (char *)str;
+ args[0] = (char *) str;
args[1] = 0;
+
THROWEXCEPTION(exception, args);
-} /* end h5libraryError() */
+ retVal = JNI_TRUE;
+
+done:
+ if (msg_str)
+ HDfree(msg_str);
+
+ return retVal;
+} /* end h5libraryError() */
/*
* defineHDF5LibraryException() returns the name of the sub-class
diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c
index c99745d..1ea549e 100644
--- a/java/src/jni/h5Constants.c
+++ b/java/src/jni/h5Constants.c
@@ -21,8 +21,10 @@
extern "C" {
#endif /* __cplusplus */
-#include <jni.h>
#include "hdf5.h"
+#include <jni.h>
+#include <stdlib.h>
+#include "h5jni.h"
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c
index 1ad6b17..99c91fd 100644
--- a/java/src/jni/h5Imp.c
+++ b/java/src/jni/h5Imp.c
@@ -35,7 +35,10 @@ extern "C" {
#include "h5jni.h"
#include "h5Imp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -46,10 +49,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5open
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5open();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+ if ((retVal = H5open()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5open */
@@ -62,10 +69,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5close
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5close();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5close()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5close */
@@ -78,10 +89,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5dont_1atexit
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5dont_atexit();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+ UNUSED(clss);
+
+ if ((retVal = H5dont_atexit()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5dont_1atexit */
@@ -94,29 +109,25 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5get_1libversion
(JNIEnv *env, jclass clss, jintArray libversion)
{
- unsigned *theArray = NULL;
- herr_t status = -1;
- jboolean isCopy;
-
- if (libversion == NULL) {
- h5nullArgument(env, "H5get_version: libversion is NULL");
- } /* end if */
- else {
- theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5get_libversion: input not pinned");
- } /* end if */
- else {
- status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0);
- } /* end else */
- } /* end else */
- return (jint)status;
+ jboolean libversionArrayIsCopy;
+ int *libversionArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (libversion == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5get_libversion: libversion is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, libversion, libversionArray, &libversionArrayIsCopy, "H5get_libversion: libversion input not pinned");
+
+ if ((status = H5get_libversion((unsigned *) &(libversionArray[0]), (unsigned *) &(libversionArray[1]), (unsigned *) &(libversionArray[2]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (libversionArray)
+ UNPIN_INT_ARRAY(ENVONLY, libversion, libversionArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5get_1libversion */
/*
@@ -128,6 +139,9 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5check_1version
(JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum)
{
+ UNUSED(env);
+ UNUSED(clss);
+
return (jint)H5check_version((unsigned)majnum, (unsigned)minnum, (unsigned)relnum);
} /* end Java_hdf_hdf5lib_H5_H5check_1version */
@@ -141,10 +155,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5garbage_1collect
(JNIEnv *env, jclass clss)
{
- herr_t retVal = H5garbage_collect();
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5garbage_collect()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5garbage_1collect */
@@ -158,11 +176,15 @@ Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits
(JNIEnv *env, jclass clss, jint reg_global_lim, jint reg_list_lim,
jint arr_global_lim, jint arr_list_lim, jint blk_global_lim, jint blk_list_lim )
{
- herr_t retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim,
- (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim);
- if (retVal < 0)
- h5libraryError(env);
+ herr_t retVal = FAIL;
+ UNUSED(clss);
+
+ if ((retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim,
+ (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits */
@@ -176,7 +198,13 @@ Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe
(JNIEnv *env, jclass clss)
{
hbool_t is_ts = false;
- H5is_library_threadsafe(&is_ts);
+
+ UNUSED(clss);
+
+ if (H5is_library_threadsafe(&is_ts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jboolean)is_ts;
} /* end Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe */
diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c
index aba2240..eaa356e 100644
--- a/java/src/jni/h5aImp.c
+++ b/java/src/jni/h5aImp.c
@@ -21,13 +21,17 @@
extern "C" {
#endif /* __cplusplus */
-#include "hdf5.h"
-#include "h5util.h"
#include <jni.h>
#include <stdlib.h>
#include <string.h>
+#include "hdf5.h"
+#include "h5util.h"
+#include "h5jni.h"
#include "h5aImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@@ -35,31 +39,21 @@ typedef struct _cb_wrapper {
jobject op_data;
} cb_wrapper;
-#ifdef __cplusplus
-#define CBENVPTR (cbenv)
-#define CBENVPAR
-#define JVMPTR (jvm)
-#define JVMPAR
-#define JVMPAR2
-#else
-#define CBENVPTR (*cbenv)
-#define CBENVPAR cbenv,
-#define JVMPTR (*jvm)
-#define JVMPAR jvm
-#define JVMPAR2 jvm,
-#endif
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5AwriteVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
-static herr_t H5AwriteVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
-static herr_t H5AreadVL_asstr (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
-static herr_t H5AreadVL_str (JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
+static herr_t H5AwriteVL_asstr(JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
+static herr_t H5AwriteVL_str(JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
+static herr_t H5AreadVL_asstr(JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
+static herr_t H5AreadVL_str(JNIEnv *env, hid_t attr_id, hid_t mem_id, jobjectArray buf);
static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data);
+/********************/
+/* Local Macros */
+/********************/
+
/*
* Class: hdf_hdf5lib_H5
@@ -71,18 +65,22 @@ Java_hdf_hdf5lib_H5__1H5Acreate
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist)
{
- hid_t attr_id = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t attr_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- attr_id = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate: attribute name is NULL");
- if (attr_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate: attribute name not pinned");
+
+ if ((attr_id = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate */
@@ -96,18 +94,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- hid_t attr_id = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t attr_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- attr_id = H5Aopen_name((hid_t)loc_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name,aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_name: attribute name is null");
- if (attr_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen_name: attribute name not pinned");
+
+ if((attr_id = H5Aopen_name((hid_t)loc_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */
@@ -121,401 +123,1306 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jint idx)
{
- hid_t attr_id = H5Aopen_idx((hid_t)loc_id, (unsigned int) idx);
+ hid_t attr_id = H5I_INVALID_HID;
- if (attr_id < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((attr_id = H5Aopen_idx((hid_t) loc_id, (unsigned int) idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)attr_id;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1idx */
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Aread
+ * Signature: (JJ[BZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jbyte *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not critically pinned");
+ }
+ else {
+ PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread */
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Awrite
- * Signature: (JJ[B)I
+ * Signature: (JJ[BZ)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf)
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+ jboolean writeBufIsCopy;
+ jbyte *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (buf == NULL) {
- h5nullArgument( env,"H5Awrite: buf is NULL");
- } /* end if */
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not critically pinned");
+ }
else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env,"H5Awrite: buf is not pinned");
- } /* end if */
- else {
- status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, byteP);
+ PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite: write buffer not pinned");
+ }
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
}
- } /* end else */
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Awrite */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Aread
- * Signature: (JJ[B)I
+ * Method: H5Aread_short
+ * Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf)
+Java_hdf_hdf5lib_H5_H5Aread_1short
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+ jboolean readBufIsCopy;
+ jshort *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (buf == NULL) {
- h5nullArgument( env,"H5Aread: buf is NULL");
- } /* end if */
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not critically pinned");
+ }
else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError( env,"H5Aread: buf is not pinned");
- } /* end if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_short: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Aread */
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1short */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5AwriteVL
- * Signature: (JJ[Ljava/lang/String;)I
+ * Method: H5Awrite_short
+ * Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AwriteVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Awrite_1short
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5AwriteVL: buf is NULL");
- } /* end if */
+ jboolean writeBufIsCopy;
+ jshort *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not critically pinned");
+ }
else {
- isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
- if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) {
- unsigned i;
- int nm = H5Tget_nmembers(mem_type_id);
- for(i = 0; i <nm; i++) {
- hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
- isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
- H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
- H5Tclose(nested_tid);
- }
+ PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_short: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
}
- else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
- isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
+ else {
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
}
- if (isStr == 0 || isComplex>0 || isVlenStr) {
- status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1short */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1int
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint *readBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (buf == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not critically pinned");
+ }
+ else {
+ PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_int: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
}
- else if (isStr > 0) {
- status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
+ else {
+ UNPIN_INT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
}
- } /* end else */
+ }
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Awrite_1VL */
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1int */
-herr_t
-H5AwriteVL_str
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1int
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- char **wdata;
- jsize size;
- jint i;
+ jboolean writeBufIsCopy;
+ jint *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (buf == NULL)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: variable length type not supported");
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*));
- if (!wdata) {
- h5JNIFatalError(env, "H5AwriteVL_str: cannot allocate buffer");
- } /* end if */
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not critically pinned");
+ }
else {
- HDmemset(wdata, 0, (size_t)size * sizeof(char*));
- for (i = 0; i < size; ++i) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- wdata[i] = (char*)HDmalloc((size_t)length + 1);
- if (wdata[i]) {
- HDmemset(wdata[i], 0, ((size_t)length + 1));
- HDstrncpy(wdata[i], utf8, (size_t)length);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
-
- status = H5Awrite((hid_t)aid, (hid_t)tid, wdata);
+ PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_int: write buffer not pinned");
+ }
- for (i = 0; i < size; i++) {
- if(wdata[i]) {
- HDfree(wdata[i]);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_INT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
-}
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1int */
-herr_t
-H5AwriteVL_asstr
- (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1long
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jlong *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not critically pinned");
+ }
+ else {
+ PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_long: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_LONG_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1long */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1long
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jlongArray buf, jboolean isCriticalPinning)
{
- char **strs;
- jstring jstr;
- jint i;
- jint n;
- hid_t sid;
- hsize_t dims[H5S_MAX_RANK];
- herr_t status = -1;
-
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- strs =(hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
-
- if (strs == NULL) {
- h5JNIFatalError(env, "H5AwriteVL_asstr: failed to allocate buff for read variable length strings");
- } /* end if */
+ jboolean writeBufIsCopy;
+ jlong *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not critically pinned");
+ }
else {
- status = H5Awrite(aid, tid, strs);
-
- if (status < 0) {
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs);
- H5Sclose(sid);
- HDfree(strs);
- h5JNIFatalError(env, "H5AwriteVL_str: failed to read variable length strings");
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_long: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- for (i=0; i < n; i++) {
- jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- H5free_memory (strs[i]);
- } /* end for */
+ UNPIN_LONG_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
- /*
- for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings,
- H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
- free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings
- after it is done.
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- */
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1long */
- HDfree(strs);
- } /* end else */
- } /* end else */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1float
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+{
+ jboolean readBufIsCopy;
+ jfloat *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- return status;
-} /* end H5AwriteVL_str */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not critically pinned");
+ }
+ else {
+ PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_float: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1float */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5AreadVL
- * Signature: (JJJJJ[Ljava/lang/String;)I
+ * Method: H5Awrite_float
+ * Signature: (JJ[FZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Awrite_1float
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jfloatArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jfloat *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not critically pinned");
+ }
+ else {
+ PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_float: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ else {
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1float */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1double
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5AreadVL: buf is NULL");
- } /* end if */
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not critically pinned");
+ }
else {
- isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
- if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) {
- unsigned i;
- int nm = H5Tget_nmembers(mem_type_id);
- for(i = 0; i <nm; i++) {
- hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
- isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
- H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
- H5Tclose(nested_tid);
- }
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Aread_double: read buffer not pinned");
+ }
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
}
- else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
- isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
+ else {
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1double */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1double
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jdoubleArray buf, jboolean isCriticalPinning)
+{
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not critically pinned");
+ }
+ else {
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Awrite_double: write buffer not pinned");
+ }
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
}
- if (isStr == 0 || isComplex>0 || isVlenStr) {
- status = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
+ else {
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1double */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1string
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+{
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char *c_buf = NULL;
+ char *cstr = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aread_string: read buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_string: read buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: memory allocation failed");
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, pos = 0; i < n; i++) {
+ HDmemcpy(cstr, c_buf+pos, str_len);
+ cstr[str_len] = '\0';
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_string: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ pos += str_len;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (c_buf)
+ HDfree(c_buf);
+ if (cstr)
+ HDfree(cstr);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1string */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1string
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray j_buf)
+{
+ const char *utf8 = NULL;
+ jstring obj;
+ size_t i, str_len;
+ jsize n;
+ char *c_buf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Awrite_string: write buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Awrite_string: write buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Awrite_string: memory allocation failed");
+
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&c_buf[i * str_len], 0, str_len);
+ continue;
}
- else if (isStr > 0) {
- status = H5AreadVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf);
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Awrite_string: string not pinned");
+
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for */
+
+ if ((status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (c_buf)
+ HDfree(c_buf);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1string */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AreadVL
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AreadVL: read buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
}
- } /* end else */
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5AreadVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5AreadVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Aread_1VL */
-herr_t
+/*
+ * Helper method to read in a buffer of variable-length strings from an HDF5
+ * attribute. Each C-string is converted to a Java string and set in the output
+ * buffer in turn.
+ */
+static herr_t
+H5AreadVL_str
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ jstring jstr;
+ jsize i, n;
+ char **strs = NULL;
+ herr_t status = FAIL;
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_str: buf length < 0");
+ }
+
+ if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_str: failed to allocate variable length string read buffer");
+
+ if ((status = H5Aread(aid, tid, strs)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /*
+ * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < n; i++) {
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, strs[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ H5free_memory(strs[i]);
+ strs[i] = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (strs) {
+ for (i = 0; i < n; i++) {
+ if (strs[i])
+ H5free_memory(strs[i]);
+ }
+
+ HDfree(strs);
+ }
+
+ return status;
+} /* end H5AreadVL_str */
+
+/*
+ * Helper method to read in a buffer of variable-length (hvl_t)
+ * structures from an HDF5 attribute and convert each variable-length
+ * element's buffer into a Java string. Each string is then set
+ * in the output buffer in turn.
+ */
+static herr_t
H5AreadVL_asstr
(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
- jint i;
- jint n;
- hid_t sid;
- jstring jstr;
- h5str_t h5str;
- hvl_t *rdata;
- hsize_t dims[H5S_MAX_RANK];
- size_t size;
- size_t max_len = 0;
- herr_t status = -1;
+ hsize_t dims[H5S_MAX_RANK];
+ jstring jstr;
+ h5str_t h5str;
+ size_t typeSize;
+ size_t i;
+ hid_t sid = H5I_INVALID_HID;
+ jsize n;
+ void *readBuf = NULL;
+ herr_t status = FAIL;
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
/* Get size of string array */
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- /* we will need to read n number of hvl_t structures */
- rdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
- if (rdata == NULL) {
- h5JNIFatalError(env, "H5AreadVL_asstr: failed to allocate buff for read");
- } /* end if */
- else {
- status = H5Aread(aid, tid, rdata);
-
- if (status < 0) {
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata);
- H5Sclose(sid);
- HDfree(rdata);
- h5JNIFatalError(env, "H5AreadVL_asstr: failed to read data");
- } /* end if */
- else {
- /* calculate the largest size of all the hvl_t structures read */
- max_len = 1;
- for (i=0; i < n; i++) {
- if ((rdata + i)->len > max_len)
- max_len = (rdata + i)->len;
- }
-
- /* create one malloc to hold largest element */
- size = H5Tget_size(tid) * max_len;
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 4 * size);
-
- if (h5str.s == NULL) {
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata);
- H5Sclose(sid);
- HDfree(rdata);
- h5JNIFatalError(env, "H5AreadVL_asstr: failed to allocate buf");
- } /* end if */
- else {
- H5T_class_t tclass = H5Tget_class(tid);
- /* convert each element to char string */
- for (i=0; i < n; i++) {
- h5str.s[0] = '\0';
- h5str_vlsprintf(&h5str, aid, tid, rdata+i, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
- h5str_free(&h5str);
-
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, rdata);
- H5Sclose(sid);
- HDfree(rdata);
- } /* end else */
- } /* end else */
- } /* end else */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadVL_asstr: buf length < 0");
+ }
+
+ dims[0] = (hsize_t)n;
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (readBuf = HDcalloc((size_t)n, typeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate read buffer");
+
+ if ((status = H5Aread(aid, tid, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Allocate a decent-sized initial string */
+ h5str_new(&h5str, 4 * typeSize);
+
+ if (!h5str.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadVL_asstr: failed to allocate buffer");
+
+ /* Convert each element to a char string */
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, aid, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf) {
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, readBuf);
+ HDfree(readBuf);
+ }
+ if (sid >= 0)
+ H5Sclose(sid);
return status;
}
-herr_t
-H5AreadVL_str
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AwriteVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AwriteVL
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL: write buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for(i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
+ }
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5AwriteVL_asstr(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5AwriteVL_str(env, (hid_t)attr_id, (hid_t)mem_type_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Awrite_1VL */
+
+/*
+ * Helper method to convert an array of Java strings into a buffer of C-strings.
+ * The buffer of C-strings is then written to the HDF5 attribute specified.
+ */
+static herr_t
+H5AwriteVL_str
(JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
{
- char **strs;
- jstring jstr;
- jint i;
- jint n;
- hid_t sid;
- hsize_t dims[H5S_MAX_RANK];
- herr_t status = -1;
-
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- strs =(char**)HDcalloc((size_t)n, sizeof(char*));
-
- if (strs == NULL) {
- h5JNIFatalError(env, "H5AreadVL_str: failed to allocate buff for read variable length strings");
- } /* end if */
- else {
- status = H5Aread(aid, tid, strs);
-
- if (status < 0) {
- dims[0] = (hsize_t)n;
- sid = H5Screate_simple(1, dims, NULL);
- H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs);
- H5Sclose(sid);
- HDfree(strs);
- h5JNIFatalError(env, "H5AreadVL_str: failed to read variable length strings");
- } /* end if */
- else {
- for (i=0; i < n; i++) {
- jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- H5free_memory (strs[i]);
- } /* end for */
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jint i;
+ char **writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_str: buf length < 0");
+ }
+
+ if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate variable length string write buffer")
+
+ for (i = 0; i < size; ++i) {
+ jsize length;
+
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ writeBuf[i] = NULL;
+ continue;
+ }
+
+ length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5AwriteVL_str: string not pinned");
+
+ if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_str: failed to allocate string buffer");
+
+ HDstrncpy(writeBuf[i], utf8, (size_t)length);
+ writeBuf[i][length] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
+
+ if ((status = H5Awrite((hid_t)aid, (hid_t)tid, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
+ for (i = 0; i < size; i++) {
+ if (writeBuf[i])
+ HDfree(writeBuf[i]);
+ }
+
+ HDfree(writeBuf);
+ }
+
+ return (jint)status;
+}
+
+/*
+ * Helper method to convert an array of Java strings into a buffer of
+ * variable-length (hvl_t) elements. The buffer of variable-length
+ * elements is then written to the HDF5 attribute.
+ */
+static herr_t
+H5AwriteVL_asstr
+ (JNIEnv *env, hid_t aid, hid_t tid, jobjectArray buf)
+{
+ const char *utf8 = NULL;
+ hsize_t dims[H5S_MAX_RANK];
+ jstring jstr;
+ size_t typeSize;
+ size_t i;
+ hid_t sid = H5I_INVALID_HID;
+ jsize n;
+ void *writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AwriteVL_asstr: buf length < 0");
+ }
+
+ dims[0] = (hsize_t)n;
+ if ((sid = H5Screate_simple(1, dims, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer");
+
+ /*
+ * When repeatedly writing a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (jstr = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
/*
- for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings,
- H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
- free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings
- after it is done.
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- */
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, jstr);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, jstr, utf8, NULL, "H5AwriteVL_asstr: failed to pin string buffer");
+
+ /*
+ * TODO: If the string isn't a copy, we should probably make
+ * one before destroying it with h5str_convert.
+ */
+
+ if (!h5str_convert(ENVONLY, (char **) &utf8, aid, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ UNPIN_JAVA_STRING(ENVONLY, jstr, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for (i = 0; i < n; i++) */
- HDfree(strs);
- } /* end else */
- } /* end else */
+ if ((status = H5Awrite(aid, tid, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, jstr, utf8);
+ if (writeBuf) {
+ H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, writeBuf);
+ HDfree(writeBuf);
+ }
+ if (sid >= 0)
+ H5Sclose(sid);
return status;
-} /* end H5AreadVL_str */
+} /* end H5AwriteVL_str */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_reg_ref
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
+ (JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
+{
+ hdset_reg_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Aread_reg_ref: buf length < 0");
+ }
+
+ if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate read buffer");
+
+ if ((status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, ref_data)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ h5str_new(&h5str, 1024);
+
+ if (!h5str.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aread_reg_ref: failed to allocate buffer");
+
+ for (i = 0; i < n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)attr_id, (hid_t)mem_type_id, ref_data[i], 0, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (ref_data)
+ HDfree(ref_data);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref */
/*
* Class: hdf_hdf5lib_H5
@@ -526,12 +1433,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1space
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Aget_space((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Aget_space((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1space */
@@ -544,12 +1453,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1type
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Aget_type((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aget_type((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1type */
@@ -562,34 +1473,29 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1name
(JNIEnv *env, jclass clss, jlong attr_id)
{
- char *aName;
jstring str = NULL;
ssize_t buf_size;
+ char *attrName = NULL;
+
+ UNUSED(clss);
+
+ if ((buf_size = H5Aget_name((hid_t)attr_id, 0, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aget_name: failed to allocate attribute name buffer");
+
+ if (H5Aget_name((hid_t)attr_id, (size_t)buf_size + 1, attrName) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ attrName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, attrName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ HDfree(attrName);
- /* get the length of the name */
- buf_size = H5Aget_name((hid_t)attr_id, 0, NULL);
- if (buf_size <= 0) {
- h5badArgument(env, "H5Aget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Aget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Aget_name((hid_t)attr_id, (size_t)buf_size, aName);
- if (buf_size < 0) {
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- /* save the string; */
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- HDfree(aName);
- } /* end else */
- } /* end else */
- } /* end else */
return str;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1name */
@@ -602,12 +1508,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs
(JNIEnv *env, jclass clss, jlong loc_id)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Aget_num_attrs((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Aget_num_attrs((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs */
@@ -620,18 +1528,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Adelete
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- herr_t status = -1;
- const char *aName;
+ const char *attrName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- status = H5Adelete((hid_t)loc_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Adelete: attribute name not pinned");
+
+ if ((status = H5Adelete((hid_t)loc_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Adelete */
@@ -645,14 +1557,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Aclose
(JNIEnv *env, jclass clss, jlong attr_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- if (attr_id > 0)
- retVal = H5Aclose((hid_t)attr_id);
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aclose((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aclose */
@@ -666,24 +1578,27 @@ Java_hdf_hdf5lib_H5__1H5Acreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist, jlong access_plist)
{
- hid_t status = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- status = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate2: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Acreate2: attribute name not pinned");
+
+ if ((status = H5Acreate2((hid_t)loc_id, attrName, (hid_t)type_id,
+ (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate2 */
-
/*
* Class: hdf_hdf5lib_H5
* Method: _H5Aopen
@@ -694,18 +1609,22 @@ Java_hdf_hdf5lib_H5__1H5Aopen
(JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist)
{
- hid_t retVal = -1;
- const char *aName;
+ const char *attrName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, attrName, NULL, "H5Aopen: attribute name not pinned");
+
+ if ((retVal = H5Aopen((hid_t)obj_id, attrName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, name, attrName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen */
@@ -719,19 +1638,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type, jint order, jlong n, jlong aapl_id, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *aName;
+ const char *objName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, aName);
- if (aName != NULL) {
- retVal = H5Aopen_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, aName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_idx: object name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aopen_by_idx: object name not pinned");
+
+ if ((retVal = H5Aopen_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */
@@ -745,20 +1668,29 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id, jlong aapl_id, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *aName;
- const char *attrName;
+ const char *objName = NULL;
+ const char *attrName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- retVal = H5Acreate_by_name((hid_t)loc_id, aName, attrName, (hid_t)type_id,
- (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Acreate_by_name: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Acreate_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Acreate_by_name: attribute name not pinned");
+
+ if ((retVal = H5Acreate_by_name((hid_t)loc_id, objName, attrName, (hid_t)type_id,
+ (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name */
@@ -772,21 +1704,30 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Aexists_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
+ const char *objName = NULL;
+ const char *attrName = NULL;
htri_t bval = JNI_FALSE;
- const char *aName;
- const char *attrName;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- bval = H5Aexists_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists_by_name: attribute name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aexists_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists_by_name: attribute name not pinned");
+
+ if ((bval = H5Aexists_by_name((hid_t)loc_id, objName, attrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists_1by_1name */
@@ -800,24 +1741,32 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Arename
(JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name, jstring new_attr_name)
{
- herr_t retVal = -1;
- const char *oName;
- const char *nName;
+ const char *oldAttrName = NULL;
+ const char *newAttrName = NULL;
+ herr_t retVal = FAIL;
- PIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
- if (oName != NULL && nName != NULL) {
- retVal = H5Arename((hid_t)loc_id, oName, nName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName);
+ if (NULL == old_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: old attribute name is NULL");
+ if (NULL == new_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename: new attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename: old attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename: new attribute name not pinned");
+
+ if ((retVal = H5Arename((hid_t)loc_id, oldAttrName, newAttrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName);
+ if (oldAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Arename_by_name
@@ -827,20 +1776,34 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Arename_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring old_attr_name, jstring new_attr_name, jlong lapl_id)
{
- herr_t retVal = -1;
- const char *aName;
- const char *oName;
- const char *nName;
-
- PIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName);
- if (aName != NULL && oName != NULL && nName != NULL) {
- retVal = H5Arename_by_name((hid_t)loc_id, aName, oName, nName, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName);
-
- if (retVal < 0)
- h5libraryError(env);
- }
+ const char *objName = NULL;
+ const char *oldAttrName = NULL;
+ const char *newAttrName = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: object name is NULL");
+ if (NULL == old_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: old attribute name is NULL");
+ if (NULL == new_attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Arename_by_name: new attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Arename_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName, NULL, "H5Arename_by_name: old attribute name not pinned");
+ PIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName, NULL, "H5Arename_by_name: new attribute name not pinned");
+
+ if ((retVal = H5Arename_by_name((hid_t)loc_id, objName, oldAttrName, newAttrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, new_attr_name, newAttrName);
+ if (oldAttrName)
+ UNPIN_JAVA_STRING(ENVONLY, old_attr_name, oldAttrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Arename_1by_1name */
@@ -854,51 +1817,40 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- size_t buf_size;
- char *aValue;
- jlong status_size;
- jstring str = NULL;
- const char *aName;
-
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- /* get the length of the attribute name */
- status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char*)NULL, (size_t)0, (hid_t)lapl_id);
-
- if(status_size < 0) {
- UNPIN_JAVA_STRING(obj_name, aName);
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
-
- aValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (aValue == NULL) {
- UNPIN_JAVA_STRING(obj_name, aName);
- h5outOfMemory(env, "H5Aget_name_by_idx: malloc failed ");
- } /* end if */
- else {
- status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t) order, (hsize_t) n, (char*)aValue, (size_t)buf_size, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING(obj_name, aName);
-
- if (status_size < 0) {
- HDfree(aValue);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aValue);
- HDfree(aValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- h5JNIFatalError(env, "H5Aget_name_by_idx: return string not created");
- } /* end if */
- } /* end else */
- } /* end else */
- } /* end else */
- }
+ const char *objName = NULL;
+ jstring str = NULL;
+ ssize_t status_size = -1;
+ char *attrName = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_name_by_idx: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_name_by_idx: object name not pinned");
+
+ /* Get the length of the attribute name */
+ if ((status_size = H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t) order, (hsize_t) n, (char *)NULL, (size_t)0, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (attrName = (char *) HDmalloc(sizeof(char) * (size_t) status_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Aget_name_by_idx: failed to allocate buffer for attribute name");
+
+ if ((H5Aget_name_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t) order, (hsize_t) n, (char *)attrName, (size_t)status_size + 1, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ attrName[status_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, attrName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (attrName)
+ HDfree(attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
+
return str;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx */
@@ -911,14 +1863,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1storage_1size
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hsize_t retVal = (hsize_t)-1;
+ hsize_t retVal = 0;
+
+ UNUSED(clss);
- retVal = H5Aget_storage_size((hid_t)attr_id);
-/* probably returns '0' if fails--don't do an exception */
+ if (!(retVal = H5Aget_storage_size((hid_t)attr_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1storage_1size */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Aget_info
@@ -928,23 +1883,23 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info
(JNIEnv *env, jclass clss, jlong attr_id)
{
- herr_t status = -1;
H5A_info_t ainfo;
- jvalue args[4];
jobject ret_obj = NULL;
+ jvalue args[4];
- status = H5Aget_info((hid_t)attr_id, &ainfo);
+ UNUSED(clss);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
+ if (H5Aget_info((hid_t)attr_id, &ainfo) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info */
@@ -957,30 +1912,34 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- herr_t status;
+ const char *objName = NULL;
H5A_info_t ainfo;
+ herr_t status;
jvalue args[4];
jobject ret_obj = NULL;
- const char *aName;
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- status = H5Aget_info_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type,
- (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(obj_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_idx: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_idx: object name not pinned");
+
+ if ((status = H5Aget_info_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type,
+ (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
- }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx */
@@ -993,30 +1952,39 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
- const char *aName;
- const char *attrName;
- herr_t status;
+ const char *objName = NULL;
+ const char *attrName = NULL;
H5A_info_t ainfo;
+ herr_t status;
jvalue args[4];
jobject ret_obj = NULL;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- status = H5Aget_info_by_name((hid_t)loc_id, aName, attrName, &ainfo, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aget_info_by_name: attribute name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aget_info_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aget_info_by_name: attribute name not pinned");
+
+ if ((status = H5Aget_info_by_name((hid_t)loc_id, objName, attrName, &ainfo, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].z = ainfo.corder_valid;
+ args[1].j = ainfo.corder;
+ args[2].i = ainfo.cset;
+ args[3].j = (jlong)ainfo.data_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args, ret_obj);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].z = ainfo.corder_valid;
- args[1].j = ainfo.corder;
- args[2].i = ainfo.cset;
- args[3].j = (jlong)ainfo.data_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args);
- } /* end else */
- }
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name */
@@ -1029,19 +1997,28 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Adelete_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id)
{
- herr_t retVal = -1;
- const char *aName;
- const char *attrName;
+ const char *objName = NULL;
+ const char *attrName = NULL;
+ herr_t retVal = FAIL;
- PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
- if (aName != NULL && attrName != NULL) {
- retVal = H5Adelete_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_name: attribute name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Adelete_by_name: attribute name not pinned");
+
+ if ((retVal = H5Adelete_by_name((hid_t)loc_id, objName, attrName, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1name */
@@ -1055,20 +2032,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Aexists
(JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name)
{
+ const char *attrName = NULL;
htri_t bval = JNI_FALSE;
- const char *aName;
- PIN_JAVA_STRING(attr_name, aName);
- if (aName != NULL) {
- bval = H5Aexists((hid_t)obj_id, aName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(attr_name, aName);
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aexists: attribute name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aexists: attribute name not pinned");
+
+ if ((bval = H5Aexists((hid_t)obj_id, attrName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Aexists */
@@ -1082,18 +2063,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id)
{
- herr_t status = -1;
- const char *aName;
+ const char *objName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(obj_name, aName);
- if (aName != NULL) {
- status = H5Adelete_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(obj_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Adelete_by_idx: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Adelete_by_idx: object name not pinned");
+
+ if ((status = H5Adelete_by_idx((hid_t)loc_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx */
/*
@@ -1106,19 +2091,28 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong aapl_id, jlong lapl_id)
{
- hid_t status = -1;
- const char *aName;
- const char *oName;
+ const char *attrName = NULL;
+ const char *objName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
- if (oName != NULL && aName != NULL) {
- status = H5Aopen_by_name((hid_t)loc_id, oName, aName, (hid_t)aapl_id, (hid_t)lapl_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName);
+ if (NULL == obj_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: object name is NULL");
+ if (NULL == attr_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aopen_by_name: attribute name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, obj_name, objName, NULL, "H5Aopen_by_name: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, attr_name, attrName, NULL, "H5Aopen_by_name: attribute name not pinned");
+
+ if ((status = H5Aopen_by_name((hid_t)loc_id, objName, attrName, (hid_t)aapl_id, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (attrName)
+ UNPIN_JAVA_STRING(ENVONLY, attr_name, attrName);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, obj_name, objName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name */
@@ -1132,60 +2126,69 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist
(JNIEnv *env, jclass clss, jlong attr_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Aget_create_plist((hid_t)attr_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Aget_create_plist((hid_t)attr_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist */
static herr_t
H5A_iterate_cb
(hid_t g_id, const char *name, const H5A_info_t *info, void *cb_data) {
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[4];
- jobject cb_info_t = NULL;
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].z = info->corder_valid;
- args[1].j = info->corder;
- args[2].i = info->cset;
- args[3].j = (jlong)info->data_size;
- /* get a reference to your class if you don't have it already */
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5A_info_t");
- if (cls != 0) {
- /* get a reference to the constructor; the name is <init> */
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(ZJIJ)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (cb_info_t == NULL) {
- printf("FATAL ERROR: hdf/hdf5lib/structs/H5A_info_t: Creation failed\n");
- }
- else {
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- }
- } /* end if (constructor != 0) */
- } /* end if (cls != 0) */
- } /* end if (mid != 0) */
- } /* end if (cls != 0) */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
+ jmethodID constructor, mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jvalue args[4];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5A_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].z = info->corder_valid;
+ args[1].j = info->corder;
+ args[2].i = info->cset;
+ args[3].j = (jlong)info->data_size;
+
+ /* Get a reference to your class if you don't have it already */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5A_info_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(ZJIJ)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("FATAL ERROR: hdf/hdf5lib/structs/H5A_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
} /* end H5A_iterate_cb */
@@ -1200,22 +2203,24 @@ Java_hdf_hdf5lib_H5_H5Aiterate
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- cb_wrapper wrapper = {callback_op, op_data};
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
- } /* end if */
- else {
- status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate: callback_op is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Aiterate */
@@ -1229,27 +2234,31 @@ Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data, jlong access_id)
{
- const char *lName;
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
- cb_wrapper wrapper = {callback_op, op_data};
+ const char *objName = NULL;
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Aiterate_by_name: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Aiterate_by_name: object name not pinned");
+
+ if ((status = H5Aiterate_by_name((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name */
diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h
index f3758eb..15cc83e 100644
--- a/java/src/jni/h5aImp.h
+++ b/java/src/jni/h5aImp.h
@@ -51,21 +51,120 @@ Java_hdf_hdf5lib_H5__1H5Aopen_1idx
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Aread
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Awrite
* Signature: (JJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Awrite
- (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jboolean);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Aread
- * Signature: (JJ[B)I
+ * Method: H5Aread_short
+ * Signature: (JJ[SZ)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Aread
- (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+Java_hdf_hdf5lib_H5_H5Aread_1short
+ (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_short
+ * Signature: (JJ[SZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1short
+ (JNIEnv*, jclass, jlong, jlong, jshortArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1int
+ (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_int
+ * Signature: (JJ[IZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1int
+ (JNIEnv*, jclass, jlong, jlong, jintArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1long
+ (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_long
+ * Signature: (JJ[JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1long
+ (JNIEnv*, jclass, jlong, jlong, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1float
+ (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_float
+ * Signature: (JJ[FZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1float
+ (JNIEnv*, jclass, jlong, jlong, jfloatArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1double
+ (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_double
+ * Signature: (JJ[DZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1double
+ (JNIEnv*, jclass, jlong, jlong, jdoubleArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5AreadVL
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5AreadVL
+ (JNIEnv *, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
@@ -78,12 +177,48 @@ Java_hdf_hdf5lib_H5_H5AwriteVL
/*
* Class: hdf_hdf5lib_H5
- * Method: H5AreadVL
+ * Method: H5Aread_string
* Signature: (JJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5AreadVL
- (JNIEnv *, jclass, jlong, jlong, jobjectArray);
+Java_hdf_hdf5lib_H5_H5Aread_1string
+ (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_string
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1string
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_VLStrings
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1VLStrings
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Awrite_VLStrings
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Awrite_1VLStrings
+ (JNIEnv*, jclass, jlong, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Aread_reg_ref
+ * Signature: (JJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Aread_1reg_1ref
+(JNIEnv*, jclass, jlong, jlong, jobjectArray);
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c
index 652c873..5500847 100644
--- a/java/src/jni/h5dImp.c
+++ b/java/src/jni/h5dImp.c
@@ -27,8 +27,12 @@ extern "C" {
#include <string.h>
#include "hdf5.h"
#include "h5util.h"
+#include "h5jni.h"
#include "h5dImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@@ -36,121 +40,19 @@ typedef struct _cb_wrapper {
jobject op_data;
} cb_wrapper;
-#ifdef __cplusplus
- #ifdef _WINDOWS
- #include <direct.h>
- #endif
- #define CBENVPTR (cbenv)
- #define CBENVPAR
- #define JVMPTR (jvm)
- #define JVMPAR
- #define JVMPAR2
-#else
- #define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
- #define JVMPTR (*jvm)
- #define JVMPAR jvm
- #define JVMPAR2 jvm,
-#endif
-
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5DreadVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DreadVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_asstr (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
-static herr_t H5DwriteVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DreadVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DwriteVL_asstr(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
+static herr_t H5DwriteVL_str(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf);
/********************/
/* Local Macros */
/********************/
-#define PIN_BYTE_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jbyte*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_BYTE_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_SHORT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jshort*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetShortArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_SHORT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseShortArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_INT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jint*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetIntArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_INT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseIntArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_LONG_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jlong*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetLongArrayElements(ENVPAR buf,&isCopy); \
-}
-
-#define UNPIN_LONG_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_FLOAT_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jfloat*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetFloatArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_FLOAT_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseFloatArrayElements(ENVPAR buf, buffP, mode); \
-}
-
-#define PIN_DOUBLE_ARRAY() { \
- if (isCriticalPinning) \
- buffP = (jdouble*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \
- else \
- buffP = ENVPTR->GetDoubleArrayElements(ENVPAR buf, &isCopy); \
-}
-
-#define UNPIN_DOUBLE_ARRAY(mode) { \
- if (isCriticalPinning) \
- ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \
- else \
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR buf, buffP, mode); \
-}
/*
* Class: hdf_hdf5lib_H5
@@ -162,18 +64,22 @@ Java_hdf_hdf5lib_H5__1H5Dcreate
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong create_plist_id)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate: dataset name is NULL");
- if (dset_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate: dataset name not pinned");
+
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate */
@@ -187,17 +93,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dopen
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen: dataset name not pinned");
+
+ if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, H5P_DEFAULT)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen */
@@ -211,12 +122,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1space
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Dget_space((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dget_space((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1space */
@@ -229,12 +142,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1type
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Dget_type((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Dget_type((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1type */
@@ -247,40 +162,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Dget_create_plist((hid_t)dataset_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dget_create_plist((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist */
-static htri_t
-H5Tdetect_variable_str
- (hid_t tid) {
- htri_t ret_val = 0;
-
- if (H5Tget_class(tid) == H5T_COMPOUND) {
- unsigned i;
- unsigned nm = (unsigned)H5Tget_nmembers(tid);
- for(i = 0; i < nm; i++) {
- htri_t status = 0;
- hid_t mtid = 0;
- if((mtid = H5Tget_member_type(tid, i)) < 0)
- return -1; /* exit immediately on error */
- if((status = H5Tdetect_variable_str(mtid)) < 0)
- return status; /* exit immediately on error */
- ret_val |= status;
- H5Tclose (mtid);
- } /* end for */
- } /* end if */
- else
- ret_val = H5Tis_variable_str(tid);
-
- return ret_val;
-} /* end H5Tdetect_variable_str */
-
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dread
@@ -291,48 +183,49 @@ Java_hdf_hdf5lib_H5_H5Dread
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jbyte *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread: buf does not support variable length type");
- } /* end else if */
+ PIN_BYTE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_BYTE_ARRAY();
-
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_BYTE_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_BYTE_ARRAY(0); /* update java buffer for return */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread */
@@ -347,44 +240,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jbyte *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_BYTE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite: buf does not support variable length type");
- } /* end else if */
+ PIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_BYTE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite */
@@ -398,13 +296,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Dclose
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Dclose((hid_t)dataset_id);
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Dclose((hid_t)dataset_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Dclose */
@@ -417,15 +316,17 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dget_1storage_1size
(JNIEnv *env, jclass clss, jlong dataset_id)
{
- hsize_t retVal = (hsize_t)-1;
+ hsize_t retVal = 0;
- if (dataset_id < 0) {
- h5badArgument(env, "H5Dget_storage_size: not a dataset");
- } /* end if */
- else {
- retVal = H5Dget_storage_size((hid_t)dataset_id);
- } /* end else */
+ UNUSED(clss);
+
+ if (dataset_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dget_storage_size: not a dataset");
+ if (!(retVal = H5Dget_storage_size((hid_t)dataset_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1storage_1size */
@@ -439,27 +340,23 @@ Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim
(JNIEnv *env, jclass clss, jlong type_id, jlong space_id,
jlong xfer_plist_id, jbyteArray buf)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
+ jboolean vlenBufIsCopy;
+ jbyte *vlenBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dvlen_reclaim: buf is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Dvlen_reclaim: buf not pinned");
- } /* end if */
- else {
- status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, byteP);
+ UNUSED(clss);
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT);
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dvlen_reclaim: buffer is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ PIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, &vlenBufIsCopy, "H5Dvlen_reclaim: buffer not pinned");
+
+ if ((status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, vlenBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (vlenBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, vlenBuf, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim */
@@ -474,47 +371,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1short
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ jshort *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_short: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_short: buf does not support variable length type");
- } /* end else if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_short: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_short: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_SHORT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_SHORT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1short */
@@ -529,44 +428,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1short
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jshort *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ jshort *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL ) {
- h5nullArgument(env, "H5Dwrite_short: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_short: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_short: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_SHORT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_short: buf does not support variable length type");
- } /* end else if */
+ PIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_short: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_SHORT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_short: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_SHORT_ARRAY(JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_SHORT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1short */
@@ -581,47 +485,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1int
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jint *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_int: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_int: buf does not support variable length type");
- } /* end else if */
+ PIN_INT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_int: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_int: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_INT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_INT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_INT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1int */
@@ -636,44 +542,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1int
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jint *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jint *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_int: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_int: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_int: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_INT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_int: buf does not support variable length type");
- } /* end else if */
+ PIN_INT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_int: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_INT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_int: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_INT_ARRAY(JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_INT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1int */
@@ -688,47 +599,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1long
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jlong *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_long: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_long: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_long: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_long: buf does not support variable length type");
- } /* end else if */
+ PIN_LONG_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_long: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_long: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_LONG_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_LONG_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_LONG_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1long */
@@ -743,43 +656,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1long
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jlong *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jlong *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_long: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_long: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_long: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_LONG_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_long: buf does not support variable length type");
- } /* end else if */
+ PIN_LONG_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_long: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_LONG_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_long: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_LONG_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_LONG_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1long */
@@ -794,47 +713,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1float
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ htri_t data_class;
+ jfloat *readBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_float: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_float: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_float: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_float: buf does not support variable length type");
- } /* end else if */
+ PIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_float: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_float: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_FLOAT_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_FLOAT_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1float */
@@ -849,43 +770,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1float
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jfloat *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ htri_t data_class;
+ jfloat *writeBuf = NULL;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_float: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_float: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_float: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_FLOAT_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_float: buf does not support variable length type");
- } /* end else if */
+ PIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_float: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_FLOAT_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_float: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_FLOAT_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_FLOAT_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1float */
@@ -900,47 +827,49 @@ Java_hdf_hdf5lib_H5_H5Dread_1double
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean readBufIsCopy;
+ jdouble *readBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dread_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_double: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: read buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dread_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dread_double: buf does not support variable length type");
- } /* end else if */
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, &readBufIsCopy, "H5Dread_double: read buffer not pinned");
+ }
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (readBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dread_double: buf not pinned");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- if (status < 0) {
- UNPIN_DOUBLE_ARRAY(JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- UNPIN_DOUBLE_ARRAY(0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, readBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1double */
@@ -955,43 +884,49 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1double
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning)
{
- herr_t status = -1;
- jdouble *buffP;
- jboolean isCopy;
- htri_t data_class;
+ jboolean writeBufIsCopy;
+ jdouble *writeBuf = NULL;
+ htri_t data_class;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_double: buf is NULL");
- } /* end if */
- else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_class() failed");
- } /* end else if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_double: buf does not support variable length type");
- } /* end else if */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: write buffer is NULL");
+
+ if ((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported");
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ if ((data_class = H5Tdetect_variable_str(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (data_class)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_double: variable length type not supported");
+
+ if (isCriticalPinning) {
+ PIN_DOUBLE_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not critically pinned");
+ }
else {
- /* recursive detect any vlen string in type (compound, array ...) */
- if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) {
- h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_variable_str() failed");
- } /* end if */
- else if(data_class == 1) {
- h5badArgument(env, "H5Dwrite_double: buf does not support variable length type");
- } /* end else if */
+ PIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, &writeBufIsCopy, "H5Dwrite_double: write buffer not pinned");
+ }
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (writeBuf) {
+ if (isCriticalPinning) {
+ UNPIN_ARRAY_CRITICAL(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
else {
- PIN_DOUBLE_ARRAY();
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dwrite_double: buf not pinned");
- } /* end if */
- else {
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP);
-
- UNPIN_DOUBLE_ARRAY(JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ UNPIN_DOUBLE_ARRAY(ENVONLY, buf, writeBuf, (status < 0) ? JNI_ABORT : 0);
+ }
+ }
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1double */
@@ -1006,68 +941,59 @@ Java_hdf_hdf5lib_H5_H5Dread_1string
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
{
- herr_t status = -1;
- char *c_buf;
- char *cstr;
- size_t str_len;
- jsize i;
- jsize n;
- size_t pos;
- jstring jstr;
-
- c_buf = cstr = NULL;
- if (j_buf == NULL) {
- h5nullArgument(env, "H5Dread_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Dread_string: buf length <= 0");
- } /* end else if */
- else if ((str_len = H5Tget_size((hid_t)mem_type_id)) <=0) {
- h5libraryError(env);
- } /* end else if */
- else {
- if ((cstr = (char*)HDmalloc(str_len + 1)) == NULL) {
- h5JNIFatalError(env, "H5Dread_string: memory allocation failed.");
- } /* end if */
- else {
- if ((c_buf = (char*)HDmalloc((size_t)n * str_len)) == NULL) {
- if (cstr)
- HDfree(cstr);
- cstr = NULL;
- h5JNIFatalError(env, "H5Dread_string: memory allocation failed.");
- } /* end if */
- else {
- status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf);
-
- if (status < 0) {
- if (cstr)
- HDfree(cstr);
- cstr = NULL;
- if (c_buf)
- HDfree(c_buf);
- c_buf = NULL;
- h5libraryError(env);
- } /* end if */
- else {
- pos = 0;
- for (i = 0; i < n; i++) {
- HDmemcpy(cstr, c_buf+pos, str_len);
- cstr[str_len] = '\0';
- jstr = ENVPTR->NewStringUTF(ENVPAR cstr);
- ENVPTR->SetObjectArrayElement(ENVPAR j_buf, i, jstr);
- pos += str_len;
- } /* end for */
- } /* end else */
-
- if (c_buf)
- HDfree(c_buf);
- } /* end else cbuf allocation*/
-
- if (cstr)
- HDfree(cstr);
- } /* end else cstr allocation*/
- } /* end else */
+ jstring jstr;
+ size_t str_len;
+ size_t pos;
+ jsize i, n;
+ char *c_buf = NULL;
+ char *cstr = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_string: read buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_string: read buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (cstr = (char *) HDmalloc(str_len + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: memory allocation failed");
+
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, pos = 0; i < n; i++) {
+ HDmemcpy(cstr, c_buf+pos, str_len);
+ cstr[str_len] = '\0';
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, cstr))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_string: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, j_buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ pos += str_len;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (c_buf)
+ HDfree(c_buf);
+ if (cstr)
+ HDfree(cstr);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1string */
@@ -1082,53 +1008,64 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf)
{
- herr_t status = -1;
- char *c_buf;
- jsize str_len;
- jsize i;
- jsize n;
-
- if (j_buf == NULL) {
- h5nullArgument(env, "H5Dwrite_string: buf is NULL");
- } /* end if */
- else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) {
- h5nullArgument(env, "H5Dwrite_string: buf length <= 0");
- } /* end else if */
- else if ((str_len = (jsize)H5Tget_size((hid_t)mem_type_id)) <=0) {
- h5libraryError(env);
- } /* end else if */
- else {
- if ((c_buf = (char*)HDmalloc((size_t)n * (size_t)str_len)) == NULL) {
- h5JNIFatalError(env, "H5Dwrite_string: memory allocation failed.");
- } /* end if */
- else {
- for (i = 0; i < n; i++) {
- jstring obj = (jstring)ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)j_buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- HDstrncpy(&c_buf[i * str_len], utf8, str_len);
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for */
-
- status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
- (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf);
-
- if (c_buf)
- HDfree(c_buf);
- c_buf = NULL;
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- } /* end else */
- } /* end else */
+ const char *utf8 = NULL;
+ jstring obj;
+ size_t i, str_len;
+ jsize n;
+ char *c_buf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == j_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_string: write buffer is NULL");
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, j_buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_string: write buffer length <= 0");
+ }
+
+ if (!(str_len = H5Tget_size((hid_t)mem_type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (c_buf = (char *) HDmalloc((size_t)n * str_len)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dwrite_string: memory allocation failed");
+
+ for (i = 0; i < (size_t) n; i++) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)j_buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&c_buf[i * str_len], 0, str_len);
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Dwrite_string: string not pinned");
+
+ HDstrncpy(&c_buf[i * str_len], utf8, str_len);
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for */
+
+ if ((status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id,
+ (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (c_buf)
+ HDfree(c_buf);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1string */
@@ -1143,106 +1080,216 @@ Java_hdf_hdf5lib_H5_H5DreadVL
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5DreadVL: buf is NULL");
- } /* end if */
- else {
- isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
- if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) {
- unsigned i;
- int nm = H5Tget_nmembers(mem_type_id);
- for(i = 0; i <nm; i++) {
- hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
- isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
- H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
- H5Tclose(nested_tid);
- }
- }
- else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
- isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
- }
- if (isStr == 0 || isComplex>0 || isVlenStr) {
- status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- }
- else if (isStr > 0) {
- status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DreadVL: read buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
}
- } /* end else */
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5DreadVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dread_1VL */
-herr_t
+/*
+ * Helper method to read in a buffer of variable-length strings from an HDF5
+ * dataset. Each C-string is converted to a Java string and set in the output
+ * buffer in turn.
+ */
+static herr_t
+H5DreadVL_str
+ (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+{
+ jstring jstr;
+ jsize i, n;
+ char **strs = NULL;
+ herr_t status = FAIL;
+
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_str: buf length < 0");
+ }
+
+ if (NULL == (strs = (char **) HDcalloc((size_t)n, sizeof(char *))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_str: failed to allocate variable length string read buffer");
+
+ if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /*
+ * When repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings),
+ * H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
+ * free space in time. Instead, we use "H5free_memory(strs[i])" to free individual strings
+ * once done.
+ */
+ for (i = 0; i < n; i++) {
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, strs[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ H5free_memory(strs[i]);
+ strs[i] = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (strs) {
+ for (i = 0; i < n; i++) {
+ if (strs[i])
+ H5free_memory(strs[i]);
+ }
+
+ HDfree(strs);
+ }
+
+ return status;
+} /* end H5DreadVL_str */
+
+/*
+ * Helper method to read in a buffer of variable-length (hvl_t)
+ * structures from an HDF5 dataset and convert each variable-length
+ * element's buffer into a Java string. Each string is then set
+ * in the output buffer in turn.
+ */
+static herr_t
H5DreadVL_asstr
(JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
{
- jint i;
- jint n;
- jstring jstr;
- h5str_t h5str;
- hvl_t *rdata;
- size_t size;
- size_t max_len = 0;
- herr_t status = -1;
+ H5T_class_t tclass;
+ jstring jstr;
+ h5str_t h5str;
+ hbool_t close_mem_space = FALSE;
+ size_t typeSize;
+ size_t i;
+ hid_t mem_space = mem_sid;
+ jsize n;
+ void *readBuf = NULL;
+ herr_t status = FAIL;
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ if (mem_space == H5S_ALL) {
+ mem_space = file_sid;
+
+ if (mem_space == H5S_ALL) {
+ /*
+ * Retrieve a valid dataspace for H5Dvlen_reclaim().
+ */
+ if ((mem_space = H5Dget_space(did)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ close_mem_space = TRUE;
+
+ if (H5Sselect_all(mem_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ }
/* Get size of string array */
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- /* we will need to read n number of hvl_t structures */
- rdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
- if (rdata == NULL) {
- h5JNIFatalError(env, "H5DreadVL_asstr: failed to allocate buff for read");
- } /* end if */
- else {
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, rdata);
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DreadVL_asstr: buf length < 0");
+ }
- if (status < 0) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- h5JNIFatalError(env, "H5DreadVL_asstr: failed to read data");
- } /* end if */
- else {
- /* calculate the largest size of all the hvl_t structures read */
- max_len = 1;
- for (i=0; i < n; i++) {
- if ((rdata + i)->len > max_len)
- max_len = (rdata + i)->len;
- }
-
- /* create one malloc to hold largest element */
- size = H5Tget_size(tid) * max_len;
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 4 * size);
-
- if (h5str.s == NULL) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- h5JNIFatalError(env, "H5DreadVL_asstr: failed to allocate buf");
- } /* end if */
- else {
- H5T_class_t tclass = H5Tget_class(tid);
- /* convert each element to char string */
- for (i=0; i < n; i++) {
- h5str.s[0] = '\0';
- h5str_vlsprintf(&h5str, did, tid, rdata+i, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
- h5str_free(&h5str);
-
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, rdata);
- HDfree(rdata);
- } /* end else */
- } /* end else */
- } /* end else */
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (readBuf = HDcalloc((size_t)n, typeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate read buffer");
+
+ if ((status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Allocate a decent-sized initial string */
+ h5str_new(&h5str, 4 * typeSize);
+
+ if (!h5str.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5DreadVL_asstr: failed to allocate buffer");
+
+ if ((tclass = H5Tget_class(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Convert each element to a char string */
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, did, tid, &(((char *) readBuf)[i * typeSize]), typeSize, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf) {
+ H5Dvlen_reclaim(tid, mem_space, xfer_plist_id, readBuf);
+ HDfree(readBuf);
+ }
+ if (close_mem_space)
+ H5Sclose(mem_space);
return status;
}
@@ -1264,73 +1311,28 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isVlenStr=0;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Dread_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
-
- if (isVlenStr) {
- status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- } /* end if */
- else
- h5badArgument(env, "H5Dread_VLStrings: type is not variable length String");
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
-
-herr_t
-H5DreadVL_str
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
-{
- char **strs;
- jstring jstr;
- jint i;
- jint n;
- herr_t status = -1;
-
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- strs =(char**)HDcalloc((size_t)n, sizeof(char*));
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
- if (strs == NULL) {
- h5JNIFatalError(env, "H5DreadVL_str: failed to allocate buff for read variable length strings");
- } /* end if */
- else {
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs);
+ UNUSED(clss);
- if (status < 0) {
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- HDfree(strs);
- h5JNIFatalError(env, "H5DreadVL_str: failed to read variable length strings");
- } /* end if */
- else {
- for (i=0; i < n; i++) {
- jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- H5free_memory (strs[i]);
- } /* end for */
-
- /*
- for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings,
- H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect
- free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings
- after it is done.
- H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs);
- */
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dread_VLStrings: read buffer is NULL");
- HDfree(strs);
- } /* end else */
- } /* end else */
+ if ((isVlenStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return status;
-} /* end H5DreadVL_str */
+ if (isVlenStr) {
+ if ((status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_VLStrings: datatype is not variable length String");
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */
/*
* Class: hdf_hdf5lib_H5
@@ -1342,313 +1344,329 @@ Java_hdf_hdf5lib_H5_H5DwriteVL
(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isStr = 0;
- htri_t isVlenStr = 0;
- htri_t isComplex = 0;
+ H5T_class_t type_class;
+ htri_t isStr = 0;
+ htri_t isVlenStr = 0;
+ htri_t isComplex = 0;
+ htri_t isComplex2 = 0;
+ hid_t nested_tid = H5I_INVALID_HID;
+ herr_t status = FAIL;
- if (buf == NULL) {
- h5nullArgument(env, "H5DwriteVL: buf is NULL");
- } /* end if */
- else {
- isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING);
- if (H5Tget_class((hid_t)mem_type_id) == H5T_COMPOUND) {
- unsigned i;
- int nm = H5Tget_nmembers(mem_type_id);
- for(i = 0; i <nm; i++) {
- hid_t nested_tid = H5Tget_member_type((hid_t)mem_type_id, i);
- isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND) ||
- H5Tdetect_class((hid_t)nested_tid, H5T_VLEN);
- H5Tclose(nested_tid);
- }
- }
- else if (H5Tget_class((hid_t)mem_type_id) == H5T_VLEN) {
- isVlenStr = 1; /* strings created by H5Tvlen_create(H5T_C_S1) */
- }
- if (isStr == 0 || isComplex>0 || isVlenStr) {
- status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- }
- else if (isStr > 0) {
- status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL: write buffer is NULL");
+
+ if ((isStr = H5Tdetect_class((hid_t)mem_type_id, H5T_STRING)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((type_class = H5Tget_class((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (type_class == H5T_COMPOUND) {
+ unsigned i;
+ int num_members;
+
+ if ((num_members = H5Tget_nmembers(mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (unsigned) num_members; i++) {
+ if ((nested_tid = H5Tget_member_type((hid_t)mem_type_id, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex = H5Tdetect_class((hid_t)nested_tid, H5T_COMPOUND)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((isComplex2 = H5Tdetect_class((hid_t)nested_tid, H5T_VLEN)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ isComplex = isComplex || isComplex2;
+
+ if (H5Tclose(nested_tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nested_tid = H5I_INVALID_HID;
}
- } /* end else */
+ }
+ else if (type_class == H5T_VLEN) {
+ isVlenStr = 1; /* Strings created by H5Tvlen_create(H5T_C_S1) */
+ }
+
+ if (!isStr || isComplex || isVlenStr) {
+ if ((status = H5DwriteVL_asstr(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else if (isStr) {
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (nested_tid >= 0)
+ H5Tclose(nested_tid);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VL */
-herr_t
-H5DwriteVL_asstr
- (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
+/*
+ * Helper method to convert an array of Java strings into a buffer of C-strings.
+ * The buffer of C-strings is then written to the HDF5 dataset specified.
+ */
+static herr_t
+H5DwriteVL_str
+ (JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- hvl_t *wdata;
- jsize size;
- jint i;
- jint n;
+ const char *utf8 = NULL;
+ jstring obj;
+ jsize size;
+ jsize i;
+ char **writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, (jarray) buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_str: buf length < 0");
+ }
- /* Get size of string array */
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- wdata = (hvl_t*)HDcalloc((size_t)n, sizeof(hvl_t));
+ if (NULL == (writeBuf = (char **) HDcalloc((size_t)size + 1, sizeof(char *))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate variable length string write buffer");
- if (wdata == NULL) {
- h5JNIFatalError(env, "H5DwriteVL_asstr: failed to allocate buff for write");
- } /* end if */
- else {
- for (i = 0; i < n; ++i) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
+ for (i = 0; i < size; ++i) {
+ jsize length;
- if (utf8) {
- h5str_vlconvert(utf8, did, tid, wdata+i, 0);
- } /* end if */
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
+ /*
+ * If the string object was NULL, skip it.
+ */
+ writeBuf[i] = NULL;
+ continue;
+ }
- status = H5Dwrite(did, tid, mem_sid, file_sid, xfer_plist_id, wdata);
+ length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- /* now free memory*/
- for (i = 0; i < n; i++) {
- if(wdata+i) {
- HDfree(wdata+i);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_str: string not pinned");
+
+ if (NULL == (writeBuf[i] = (char *) HDmalloc((size_t)length + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5DwriteVL_str: failed to allocate string buffer");
+
+ HDstrncpy(writeBuf[i], utf8, (size_t)length + 1);
+ writeBuf[i][length] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
+ for (i = 0; i < size; i++) {
+ if (writeBuf[i])
+ HDfree(writeBuf[i]);
+ }
+
+ HDfree(writeBuf);
+ }
return status;
-} /* end H5DwriteVL_asstr */
+} /* end H5DwriteVL_str */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Dwrite_VLStrings
- * Signature: (JJJJJ[Ljava/lang/String;)I
+ * Helper method to convert an array of Java strings into a buffer of
+ * variable-length (hvl_t) elements. The buffer of variable-length
+ * elements is then written to the HDF5 dataset.
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
- (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+static herr_t
+H5DwriteVL_asstr
+ (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- htri_t isVlenStr=0;
+ const char *utf8 = NULL;
+ jstring obj;
+ hbool_t close_mem_space = FALSE;
+ size_t typeSize;
+ size_t i;
+ hid_t mem_space = mem_sid;
+ jsize n;
+ void *writeBuf = NULL;
+ herr_t status = FAIL;
+
+ if (mem_space == H5S_ALL) {
+ mem_space = file_sid;
+
+ if (mem_space == H5S_ALL) {
+ /*
+ * Retrieve a valid dataspace for H5Dvlen_reclaim().
+ */
+ if ((mem_space = H5Dget_space(did)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ close_mem_space = TRUE;
+
+ if (H5Sselect_all(mem_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ }
- if (buf == NULL) {
- h5nullArgument(env, "H5Dwrite_VLStrings: buf is NULL");
- } /* end if */
- else {
- isVlenStr = H5Tis_variable_str((hid_t)mem_type_id);
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5DwriteVL_asstr: buf length < 0");
+ }
- if (isVlenStr) {
- status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
- (hid_t)mem_space_id, (hid_t)file_space_id,
- (hid_t)xfer_plist_id, buf);
- } /* end if */
- else
- h5badArgument(env, "H5Dwrite_VLStrings: type is not variable length String");
- } /* end else */
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
+ if (NULL == (writeBuf = HDcalloc((size_t)n, typeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AwriteVL_asstr: failed to allocate write buffer");
-herr_t
-H5DwriteVL_str
- (JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf)
-{
- herr_t status = -1;
- char **wdata;
- jsize size;
- jsize i;
+ for (i = 0; i < (size_t) n; ++i) {
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray)buf, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf);
- wdata = (char**)HDmalloc((size_t)size * sizeof (char*));
+ /*
+ * If the string object was NULL, skip it.
+ */
+ HDmemset(&(((char *) writeBuf)[i * typeSize]), 0, typeSize);
+ continue;
+ }
- if (!wdata) {
- h5JNIFatalError(env, "H5DwriteVL_str: cannot allocate buffer");
- } /* end if */
- else {
- HDmemset(wdata, 0, (size_t)size * sizeof(char*));
- for (i = 0; i < size; ++i) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- wdata[i] = (char*)HDmalloc((size_t)length + 1);
- if (wdata[i]) {
- HDmemset(wdata[i], 0, (size_t)length + 1);
- HDstrncpy(wdata[i], utf8, (size_t)length + 1);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for (i = 0; i < size; ++i) */
-
- status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, wdata);
-
- /* now free memory*/
- for (i = 0; i < size; i++) {
- if(wdata[i]) {
- HDfree(wdata[i]);
- } /* end if */
- } /* end for */
- HDfree(wdata);
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5DwriteVL_asstr: failed to pin string buffer");
+
+ /*
+ * TODO: If the string isn't a copy, we should probably make
+ * one before destroying it with h5str_convert.
+ */
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if (!h5str_convert(ENVONLY, (char **) &utf8, did, tid, &(((char *) writeBuf)[i * typeSize]), 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ } /* end for (i = 0; i < size; ++i) */
+
+ if ((status = H5Dwrite(did, tid, mem_sid, file_sid, xfer_plist_id, writeBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (writeBuf) {
+ H5Dvlen_reclaim(tid, mem_space, xfer_plist_id, writeBuf);
+ HDfree(writeBuf);
+ }
+ if (close_mem_space)
+ H5Sclose(mem_space);
return status;
-} /* end H5DwriteVL_str */
+} /* end H5DwriteVL_asstr */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref
+ * Method: H5Dwrite_VLStrings
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
- (JNIEnv *env, jclass clss,
- jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
- jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
+Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
+ (JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
+ jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- h5str_t h5str;
- size_t size;
- hdset_reg_ref_t *ref_data;
- jint i;
- jint n;
- jstring jstr;
-
- hid_t region = -1;
- hid_t did = (hid_t) dataset_id;
- hid_t tid = (hid_t) mem_type_id;
- hid_t mem_sid = (hid_t) mem_space_id;
- hid_t file_sid = (hid_t) file_space_id;
+ htri_t isVlenStr = 0;
+ herr_t status = FAIL;
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/
- ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n);
+ UNUSED(clss);
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: write buffer is NULL");
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
+ if ((isVlenStr = H5Tis_variable_str((hid_t)mem_type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Dread_reg_ref: failed to read data");
- return -1;
+ if (isVlenStr) {
+ if ((status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id,
+ (hid_t)mem_space_id, (hid_t)file_space_id, (hid_t)xfer_plist_id, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
} /* end if */
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dwrite_VLStrings: datatype is not variable length String");
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 1024);
- for (i=0; i<n; i++) {
- h5str.s[0] = '\0';
- h5str_sprintf(&h5str, did, tid, ref_data[i], 0, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
-
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
-
- h5str_free(&h5str);
- HDfree(ref_data);
-
+done:
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */
+} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref_data
+ * Method: H5Dread_reg_ref
* Signature: (JJJJJ[Ljava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
+Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
(JNIEnv *env, jclass clss,
jlong dataset_id, jlong mem_type_id, jlong mem_space_id,
jlong file_space_id, jlong xfer_plist_id, jobjectArray buf)
{
- herr_t status = -1;
- h5str_t h5str;
- size_t size;
- hdset_reg_ref_t *ref_data;
- jint i;
- jint n;
- jstring jstr;
+ hdset_reg_ref_t *ref_data = NULL;
+ h5str_t h5str;
+ jstring jstr;
+ jsize i, n;
+ herr_t status = FAIL;
- hid_t region_obj;
- H5S_sel_type region_type;
+ UNUSED(clss);
- hid_t region = -1;
- hid_t did = (hid_t) dataset_id;
- hid_t tid = (hid_t) mem_type_id;
- hid_t mem_sid = (hid_t) mem_space_id;
- hid_t file_sid = (hid_t) file_space_id;
+ HDmemset(&h5str, 0, sizeof(h5str_t));
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/
- ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n);
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dread_reg_ref: buf length < 0");
+ }
- if (ref_data == NULL) {
- h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read");
- return -1;
- } /* end if */
+ if (NULL == (ref_data = (hdset_reg_ref_t *) HDcalloc(1, (size_t)n * sizeof(hdset_reg_ref_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate read buffer");
- status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data);
+ if ((status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, (hid_t)file_space_id, xfer_plist_id, ref_data)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0) {
- HDfree(ref_data);
- h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data");
- return -1;
- } /* end if */
-
- HDmemset(&h5str, 0, sizeof(h5str_t));
h5str_new(&h5str, 1024);
- for (i=0; i<n; i++) {
+
+ if (!h5str.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dread_reg_ref: failed to allocate buffer");
+
+ for (i = 0; i < n; i++) {
h5str.s[0] = '\0';
- /* get name of the dataset the region reference points to using H5Rget_name */
- region_obj = H5Rdereference2(did, H5P_DEFAULT, H5R_DATASET_REGION, ref_data[i]);
- if (region_obj >= 0) {
- region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]);
- if (region >= 0) {
- region_type = H5Sget_select_type(region);
- if(region_type==H5S_SEL_POINTS) {
- h5str_dump_region_points_data(&h5str, region, region_obj);
- } /* end if */
- else {
- h5str_dump_region_blocks_data(&h5str, region, region_obj);
- } /* end else */
-
- H5Sclose(region);
- } /* end if */
- H5Dclose(region_obj);
- } /* end if */
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
-
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
+ if (!h5str_sprintf(ENVONLY, &h5str, (hid_t)dataset_id, (hid_t)mem_type_id, &ref_data[i], 0, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
} /* end for */
- h5str_free(&h5str);
- HDfree(ref_data);
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (ref_data)
+ HDfree(ref_data);
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */
+} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */
/*
* Class: hdf_hdf5lib_H5
@@ -1660,17 +1678,22 @@ Java_hdf_hdf5lib_H5__1H5Dcreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id,
jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dcreate2: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dcreate2: dataset name not pinned");
+
+ if ((dset_id = H5Dcreate2((hid_t)loc_id, dsetName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate2 */
@@ -1684,17 +1707,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dopen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t dset_id = -1;
- const char *fileName;
+ const char *dsetName = NULL;
+ hid_t dset_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
- if (dset_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dopen2: dataset name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, dsetName, NULL, "H5Dopen2: dataset name not pinned");
+
+ if ((dset_id = H5Dopen2((hid_t)loc_id, dsetName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dsetName)
+ UNPIN_JAVA_STRING(ENVONLY, name, dsetName);
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dopen2 */
@@ -1708,12 +1736,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Dcreate_1anon
(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id)
{
- hid_t dset_id = -1;
+ hid_t dset_id = H5I_INVALID_HID;
- dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id);
- if (dset_id < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)dset_id;
} /* end Java_hdf_hdf5lib_H5__1H5Dcreate_1anon */
@@ -1728,9 +1758,12 @@ Java_hdf_hdf5lib_H5_H5Dget_1space_1status
{
H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR;
+ UNUSED(clss);
+
if (H5Dget_space_status((hid_t)loc_id, &space_status) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)space_status;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1space_1status */
@@ -1743,12 +1776,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dget_1access_1plist
(JNIEnv *env, jclass clss, jlong loc_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Dget_access_plist((hid_t)loc_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Dget_access_plist((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1access_1plist */
@@ -1763,10 +1798,12 @@ Java_hdf_hdf5lib_H5_H5Dget_1offset
{
haddr_t offset = HADDR_UNDEF;
- offset = H5Dget_offset((hid_t)loc_id);
- if (offset == HADDR_UNDEF)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (HADDR_UNDEF == (offset = H5Dget_offset((hid_t)loc_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)offset;
} /* end Java_hdf_hdf5lib_H5_H5Dget_1offset */
@@ -1779,12 +1816,15 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size
(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id)
{
- hsize_t sz = 0;
+ hsize_t sz = 0;
- if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jlong)sz;
+ if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)sz;
} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size_1long */
/*
@@ -1796,49 +1836,36 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dfill
(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id)
{
- herr_t status;
- jbyte *fillP;
- jbyte *buffP;
jboolean isCopy1;
jboolean isCopy2;
+ herr_t status = FAIL;
+ jbyte *fillP = NULL;
+ jbyte *buffP = NULL;
+ UNUSED(clss);
- if (buf == NULL) {
- h5nullArgument(env, "H5Dfill: buf is NULL");
- } /* end if */
- else {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Dfill: buf not pinned");
- } /* end if */
- else {
- if(fill) {
- fillP = ENVPTR->GetByteArrayElements(ENVPAR fill, &isCopy1);
- if (fillP == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5JNIFatalError( env, "H5Dfill: fill not pinned");
- return;
- } /* end if */
- } /* end if */
- else
- fillP = NULL;
-
- status = H5Dfill((const void*)fillP, (hid_t)fill_type_id, (void*)buffP, (hid_t)buf_type_id, (hid_t)space_id);
- if(fillP) {
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR fill, fillP, JNI_ABORT);
- } /* end if */
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (isCopy2 == JNI_TRUE) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0);
- } /* end if */
- } /* end else */
- }
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dfill: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, buffP, &isCopy2, "H5Dfill: buffer not pinned");
+
+ if (fill) {
+ PIN_BYTE_ARRAY(ENVONLY, fill, fillP, &isCopy1, "H5Dfill: fill buffer not pinned");
}
+
+ if ((status = H5Dfill((const void *)fillP, (hid_t)fill_type_id, (void *)buffP, (hid_t)buf_type_id, (hid_t)space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (fillP) {
+ UNPIN_BYTE_ARRAY(ENVONLY, fill, fillP, JNI_ABORT);
+ fillP = NULL;
+ }
+
+done:
+ if (fillP)
+ UNPIN_BYTE_ARRAY(ENVONLY, fill, fillP, JNI_ABORT);
+ if (buffP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, buffP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Dfill */
/*
@@ -1850,106 +1877,97 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dset_1extent
(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf)
{
+ jboolean isCopy;
+ hsize_t *dims = NULL;
herr_t status;
- hsize_t *dims;
- jlong *buffP;
jsize rank;
- jboolean isCopy;
+ jlong *dimsBuf = NULL;
int i = 0;
- if (buf == NULL) {
- h5nullArgument(env, "H5Dset_extent: buf is NULL");
- } /* end if */
- else {
- rank = ENVPTR->GetArrayLength(ENVPAR buf);
- if (rank <= 0) {
- h5JNIFatalError(env, "H5Dset_extent: rank <=0");
- } /* end if */
- else {
- buffP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (buffP == NULL) {
- h5JNIFatalError( env, "H5Dset_extent: buf not pinned");
- } /* end if */
- else {
- dims = (hsize_t*)HDmalloc((size_t)rank * sizeof(hsize_t));
- for (i = 0; i< rank; i++)
- dims[i] = (hsize_t)buffP[i];
-
- status = H5Dset_extent((hid_t)loc_id, (hsize_t*)dims);
-
- HDfree (dims);
-
- /* free the buffer without copying back */
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- } /* end else */
- } /* end else */
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Dset_extent: buffer is NULL");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Dset_extent: buf length <= 0");
}
+
+ PIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, &isCopy, "H5Dset_extent: buffer not pinned");
+
+ if (NULL == (dims = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dset_extent: failed to allocate dataset dimension buffer");
+
+ for (i = 0; i < rank; i++)
+ dims[i] = (hsize_t)dimsBuf[i];
+
+ if ((status = H5Dset_extent((hid_t)loc_id, (hsize_t *)dims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dims)
+ HDfree(dims);
+ if (dimsBuf)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, dimsBuf, JNI_ABORT);
} /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */
static herr_t
H5D_iterate_cb
- (void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
- JNIEnv *cbenv;
- jint status;
- jclass cls;
- jmethodID mid;
- jbyteArray elemArray;
- jlongArray pointArray;
- jsize size;
+ (void *elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *cb_data) {
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
+ jbyteArray elemArray;
+ jlongArray pointArray;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = FAIL;
+ jsize size;
+ void *op_data = (void *)wrapper->op_data;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5D_iterate_cb: failed to attach current thread to JVM");
+ }
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I");
- if (mid == 0) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (elem == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- if (point == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- size = (jsize)H5Tget_size(elem_id);
- elemArray = CBENVPTR->NewByteArray(CBENVPAR size);
- if (elemArray == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- CBENVPTR->SetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem);
+ if (NULL == elem)
+ H5_NULL_ARGUMENT_ERROR(CBENVONLY, "H5D_iterate_cb: element buffer is NULL");
+ if (NULL == point)
+ H5_NULL_ARGUMENT_ERROR(CBENVONLY, "H5D_iterate_cb: point is NULL");
- pointArray = CBENVPTR->NewLongArray(CBENVPAR 2);
- if (pointArray == NULL) {
- JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- CBENVPTR->SetLongArrayRegion(CBENVPAR pointArray, 0, 2, (const jlong *)point);
+ if (!(size = (jsize)H5Tget_size(elem_id)))
+ H5_LIBRARY_ERROR(CBENVONLY);
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, (void*)elemArray, elem_id, ndim, pointArray, op_data);
+ if (NULL == (elemArray = CBENVPTR->NewByteArray(CBENVONLY, size)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- CBENVPTR->GetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem);
+ CBENVPTR->SetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- JVMPTR->DetachCurrentThread(JVMPAR);
+ if (NULL == (pointArray = CBENVPTR->NewLongArray(CBENVONLY, 2)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return status;
+ CBENVPTR->SetLongArrayRegion(CBENVONLY, pointArray, 0, 2, (const jlong *)point);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, (void *)elemArray, elem_id, ndim, pointArray, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ CBENVPTR->GetByteArrayRegion(CBENVONLY, elemArray, 0, size, (jbyte *)elem);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
} /* end H5D_iterate_cb */
/*
@@ -1962,41 +1980,31 @@ Java_hdf_hdf5lib_H5_H5Diterate
(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space,
jobject callback_op, jobject op_data)
{
- herr_t status = -1;
- jboolean isCopy;
- jbyte *buffP;
- cb_wrapper wrapper = {callback_op, op_data};
+ cb_wrapper wrapper = { callback_op, op_data };
+ jboolean isCopy;
+ jbyte *iterBuf = NULL;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ UNUSED(clss);
- if (op_data == NULL) {
- h5nullArgument(env, "H5Diterate: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Diterate: callback_op is NULL");
- } /* end if */
- else if (buf == NULL) {
- h5nullArgument(env, "H5Diterate: buf is NULL");
- } /* end if */
- else {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Diterate: buf not pinned");
- } /* end if */
- else {
- status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)&wrapper);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (isCopy == JNI_TRUE) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0);
- } /* end if */
- } /* end else */
- } /* end else */
- }
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: callback_op is NULL");
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Diterate: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, &isCopy, "H5Diterate: buffer not pinned");
+
+ if ((status = H5Diterate((void *)iterBuf, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (iterBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, iterBuf, (status < 0) ? (JNI_ABORT) : ((isCopy == JNI_TRUE) ? 0 : JNI_ABORT));
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Diterate */
@@ -2010,8 +2018,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Dflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Dflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/*
@@ -2023,11 +2036,14 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Drefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
- if (H5Drefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
-}
+ UNUSED(clss);
+ if (H5Drefresh((hid_t)loc_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ return;
+}
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h
index 1fe71a8..f824452 100644
--- a/java/src/jni/h5dImp.h
+++ b/java/src/jni/h5dImp.h
@@ -250,7 +250,7 @@ Java_hdf_hdf5lib_H5_H5Dread_1VLStrings
/*
* Class: hdf_hdf5lib_H5
* Method: H5Dwrite_VLStrings
- * Signature: (JJJJJ[BZ)I
+ * Signature: (JJJJJ[B)I
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings
@@ -267,15 +267,6 @@ Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Dread_reg_ref_data
- * Signature: (JJJJJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data
- (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: _H5Dcreate2
* Signature: (JLjava/lang/String;JJJJJ)J
*/
diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c
index 9c80461..4ab00df 100644
--- a/java/src/jni/h5eImp.c
+++ b/java/src/jni/h5eImp.c
@@ -39,6 +39,9 @@ extern "C" {
#include "h5jni.h"
#include "h5eImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@@ -46,20 +49,6 @@ typedef struct _cb_wrapper {
jobject op_data;
} cb_wrapper;
-#ifdef __cplusplus
- #define CBENVPTR (cbenv)
- #define CBENVPAR
- #define JVMPTR (jvm)
- #define JVMPAR
- #define JVMPAR2
-#else /* __cplusplus */
- #define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
- #define JVMPTR (*jvm)
- #define JVMPAR jvm
- #define JVMPAR2 jvm,
-#endif /* __cplusplus */
-
/********************/
/* Local Prototypes */
/********************/
@@ -77,12 +66,15 @@ Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2
{
unsigned int is_stack = 0;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eauto_is_v2: invalid argument");
- } /* end if */
- else if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eauto_is_v2: invalid stack ID");
+ if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jboolean)is_stack;
} /* end Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 */
@@ -95,20 +87,34 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eregister_1class
(JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version)
{
- hid_t ret_val = -1;
- const char* the_cls_name;
- const char* the_lib_name;
- const char* the_version;
-
- PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
- if (the_cls_name != NULL && the_lib_name != NULL && the_version != NULL) {
- ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version);
-
- UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version);
-
- if (ret_val < 0)
- h5libraryError(env);
- }
+ const char* the_cls_name = NULL;
+ const char* the_lib_name = NULL;
+ const char* the_version = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
+
+ UNUSED(cls);
+
+ if (NULL == cls_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: class name is NULL");
+ if (NULL == lib_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: lib name is NULL");
+ if (NULL == version)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eregister_class: version string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, cls_name, the_cls_name, NULL, "H5Eregister_class: class name not pinned");
+ PIN_JAVA_STRING(ENVONLY, lib_name, the_lib_name, NULL, "H5Eregister_class: lib name not pinned");
+ PIN_JAVA_STRING(ENVONLY, version, the_version, NULL, "H5Eregister_class: version string not pinned");
+
+ if ((ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (the_version)
+ UNPIN_JAVA_STRING(ENVONLY, version, the_version);
+ if (the_lib_name)
+ UNPIN_JAVA_STRING(ENVONLY, lib_name, the_lib_name);
+ if (the_cls_name)
+ UNPIN_JAVA_STRING(ENVONLY, cls_name, the_cls_name);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */
@@ -122,11 +128,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eunregister_1class
(JNIEnv *env, jclass cls, jlong cls_id)
{
- if (cls_id < 0) {
- h5badArgument(env, "H5Eunregister_class: invalid argument");
- } /* end if */
- else if (H5Eunregister_class((hid_t)cls_id) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (cls_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eunregister_class: invalid error class ID");
+
+ if (H5Eunregister_class((hid_t)cls_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eunregister_1class */
/*
@@ -138,11 +149,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1msg
(JNIEnv *env, jclass cls, jlong err_id)
{
- if (err_id < 0) {
- h5badArgument(env, "H5Eclose_msg: invalid argument");
- } /* end if */
- else if (H5Eclose_msg((hid_t)err_id) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (err_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_msg: invalid error message ID");
+
+ if (H5Eclose_msg((hid_t)err_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclose_1msg */
/*
@@ -154,24 +170,25 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1msg
(JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg)
{
- hid_t ret_val = -1;
- const char *the_err_msg;
H5E_type_t error_msg_type = (H5E_type_t)msg_type;
+ const char *the_err_msg = NULL;
+ hid_t ret_val = H5I_INVALID_HID;
- if (err_id < 0) {
- h5badArgument(env, "H5Ecreate_msg: invalid argument");
- } /* end if */
- else {
- PIN_JAVA_STRING(err_msg, the_err_msg);
- if (the_err_msg != NULL) {
- ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg);
+ UNUSED(cls);
+
+ if (err_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: invalid error class ID");
+ if (NULL == err_msg)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ecreate_msg: error message string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg, NULL, "H5Ecreate_msg: error message string not pinned");
- UNPIN_JAVA_STRING(err_msg, the_err_msg);
+ if ((ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ret_val < 0)
- h5libraryError(env);
- }
- } /* end else */
+done:
+ if (the_err_msg)
+ UNPIN_JAVA_STRING(ENVONLY, err_msg, the_err_msg);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1msg */
@@ -185,12 +202,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Ecreate_1stack
(JNIEnv *env, jclass cls)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
- ret_val = H5Ecreate_stack();
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(cls);
+ if ((ret_val = H5Ecreate_stack()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */
@@ -203,12 +222,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1current_1stack
(JNIEnv *env, jclass cls)
{
- hid_t ret_val = -1;
+ hid_t ret_val = H5I_INVALID_HID;
+
+ UNUSED(cls);
- ret_val = H5Eget_current_stack();
- if (ret_val < 0)
- h5libraryError(env);
+ if ((ret_val = H5Eget_current_stack()) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1current_1stack */
@@ -221,11 +242,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclose_1stack
(JNIEnv *env, jclass cls, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eclose_stack: invalid argument");
- } /* end if */
- else if (H5Eclose_stack((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclose_stack: invalid error stack ID");
+
+ if (H5Eclose_stack((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclose_1stack */
/*
@@ -237,20 +263,24 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eprint2
(JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj)
{
- herr_t ret_val = -1;
+ herr_t ret_val = FAIL;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eprint2: invalid argument");
- } /* end if */
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eprint2: invalid error stack ID");
+
+ if (!stream_obj) {
+ if ((ret_val = H5Eprint2((hid_t)stk_id, stdout)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
else {
- if(!stream_obj)
- ret_val = H5Eprint2((hid_t)stk_id, stdout);
- else
- ret_val = H5Eprint2((hid_t)stk_id, (FILE*)stream_obj);
-
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
+ if ((ret_val = H5Eprint2((hid_t)stk_id, (FILE *)stream_obj)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eprint2 */
/*
@@ -262,43 +292,36 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1class_1name
(JNIEnv *env, jclass cls, jlong cls_id)
{
- char *namePtr;
- jstring str = NULL;
- ssize_t buf_size;
+ jstring str = NULL;
+ ssize_t buf_size;
+ char *namePtr = NULL;
+
+ UNUSED(cls);
+
+ if (cls_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: invalid error class ID");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!buf_size)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_class_name: no class name");
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_class_name: malloc failed");
+
+ if ((H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
- if (cls_id < 0) {
- h5badArgument(env, "H5Eget_class_name: invalid argument");
- } /* end if */
- else {
- /* get the length of the name */
- buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0);
-
- if (buf_size < 0) {
- h5badArgument( env, "H5Eget_class_name: buf_size < 0");
- } /* end if */
- else if (buf_size == 0) {
- h5badArgument( env, "H5Eget_class_name: No class name");
- } /* end else if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory( env, "H5Eget_class_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size);
-
- if (buf_size < 0) {
- HDfree(namePtr);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
return str;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1class_1name */
@@ -311,11 +334,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eset_1current_1stack
(JNIEnv *env, jclass cls, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eset_current_stack: invalid argument");
- } /* end if */
- else if (H5Eset_current_stack((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eset_current_stack: invalid error stack ID");
+
+ if (H5Eset_current_stack((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eset_1current_1stack */
/*
@@ -327,11 +355,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Epop
(JNIEnv *env, jclass cls, jlong stk_id, jlong count)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Epop: invalid argument");
- } /* end if */
- else if (H5Epop((hid_t)stk_id, (size_t)count) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epop: invalid error stack ID");
+
+ if (H5Epop((hid_t)stk_id, (size_t)count) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Epop */
/*
@@ -344,35 +377,43 @@ Java_hdf_hdf5lib_H5_H5Epush2
(JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname,
jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc)
{
- herr_t ret_val = -1;
- const char* fName;
- const char* fncName;
- const char* errMsg;
-
- if (stk_id < 0) {
- h5badArgument(env, "H5Epush: invalid argument");
- } /* end if */
- else if (class_id < 0) {
- h5badArgument(env, "H5Epush: invalid class_id argument");
- } /* end else if */
- else if (major_id < 0) {
- h5badArgument(env, "H5Epush: invalid major_id argument");
- } /* end else if */
- else if (minor_id < 0) {
- h5badArgument(env, "H5Epush: invalid minor_id argument");
- } /* end else if */
- else {
- PIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
- if (fName != NULL && fncName != NULL && errMsg != NULL) {
- ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id,
- (hid_t)major_id, (hid_t)minor_id, errMsg);
-
- UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg);
-
- if (ret_val < 0)
- h5libraryError(env);
- }
- } /* end else */
+ const char *fName = NULL;
+ const char *fncName = NULL;
+ const char *errMsg = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error stack ID");
+ if (class_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid error class ID");
+ if (major_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid major error class ID");
+ if (minor_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Epush2: invalid minor error class ID");
+ if (NULL == filename)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: filename is NULL");
+ if (NULL == funcname)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: function name is NULL");
+ if (NULL == err_desc)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Epush2: error message is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, filename, fName, NULL, "H5Epush2: filename not pinned");
+ PIN_JAVA_STRING(ENVONLY, funcname, fncName, NULL, "H5Epush2: function name not pinned");
+ PIN_JAVA_STRING(ENVONLY, err_desc, errMsg, NULL, "H5Epush2: error message not pinned");
+
+ if ((ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id,
+ (hid_t)major_id, (hid_t)minor_id, errMsg)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (errMsg)
+ UNPIN_JAVA_STRING(ENVONLY, err_desc, errMsg);
+ if (fncName)
+ UNPIN_JAVA_STRING(ENVONLY, funcname, fncName);
+ if (fName)
+ UNPIN_JAVA_STRING(ENVONLY, filename, fName);
} /* end Java_hdf_hdf5lib_H5_H5Epush2 */
/*
@@ -384,11 +425,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Eclear2
(JNIEnv *env, jclass cls, jlong stk_id)
{
- if (stk_id < 0) {
- h5badArgument(env, "H5Eclear2: invalid argument");
- } /* end if */
- else if (H5Eclear2((hid_t)stk_id) < 0)
- h5libraryError(env);
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eclear2: invalid error stack ID");
+
+ if (H5Eclear2((hid_t)stk_id) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Eclear2 */
/*
@@ -400,57 +446,45 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Eget_1msg
(JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list)
{
- char *namePtr;
- jstring str = NULL;
- jboolean isCopy;
- ssize_t buf_size;
- jint *theArray;
- H5E_type_t error_msg_type;
-
- if (msg_id < 0) {
- h5badArgument(env, "H5Eget_msg: invalid argument");
- } /* end if */
- else if (error_msg_type_list == NULL) {
- h5nullArgument(env, "H5Eget_msg: error_msg_type_list is NULL");
- } /* end if */
- else {
- /* get the length of the name */
- buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0);
-
- if ((buf_size < 0) || (buf_size == 0)) {
- h5JNIFatalError(env, "H5Eget_msg: Invalid message");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory(env, "H5Eget_msg: malloc failed");
- } /* end if */
- else {
- theArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR error_msg_type_list, &isCopy);
- if (theArray == NULL) {
- HDfree(namePtr);
- h5JNIFatalError(env, "H5Eget_msg: error_msg_type_list not pinned");
- } /* end if */
- else {
- buf_size = H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size);
-
- if (buf_size < 0) {
- HDfree(namePtr);
- ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = error_msg_type;
- ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, 0);
-
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ H5E_type_t error_msg_type;
+ jstring str = NULL;
+ ssize_t buf_size;
+ jint *theArray = NULL;
+ char *namePtr = NULL;
+
+ UNUSED(cls);
+
+ if (msg_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: invalid error message ID");
+ if (NULL == error_msg_type_list)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Eget_msg: error_msg_type_list is NULL");
+
+ /* Get the length of the name */
+ if ((buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!buf_size)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_msg: invalid message");
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Eget_msg: malloc failed");
+
+ PIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, NULL, "H5Eget_msg: error_msg_type_list not pinned");
+
+ if ((H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ theArray[0] = error_msg_type;
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, error_msg_type_list, theArray, 0);
+ if (namePtr)
+ HDfree(namePtr);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */
@@ -466,14 +500,15 @@ Java_hdf_hdf5lib_H5_H5Eget_1num
{
ssize_t ret_val = -1;
- if (stk_id < 0) {
- h5badArgument(env, "H5Eget_num: invalid argument");
- } /* end if */
- else {
- ret_val = H5Eget_num((hid_t)stk_id);
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
+ UNUSED(cls);
+
+ if (stk_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Eget_num: invalid error stack ID");
+
+ if ((ret_val = H5Eget_num((hid_t)stk_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Eget_1num */
@@ -481,52 +516,67 @@ static herr_t
H5E_walk_cb
(int nindx, const H5E_error2_t *info, void *cb_data)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str1, str2, str3;
- jmethodID constructor;
- jvalue args[7];
- jobject cb_info_t = NULL;
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I");
- if (mid != 0) {
- args[0].j = info->cls_id;
- args[1].j = info->maj_num;
- args[2].j = info->min_num;
- args[3].i = (jint)info->line;
- str1 = CBENVPTR->NewStringUTF(CBENVPAR info->func_name);
- args[4].l = str1;
- str2 = CBENVPTR->NewStringUTF(CBENVPAR info->file_name);
- args[5].l = str2;
- str3 = CBENVPTR->NewStringUTF(CBENVPAR info->desc);
- args[6].l = str3;
- // get a reference to your class if you don't have it already
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5E_error2_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (cb_info_t == NULL) {
- printf("FATAL ERROR: hdf/hdf5lib/structs/H5E_error2_t: Creation failed\n");
- }
- else {
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, nindx, cb_info_t, op_data);
- }
- } /* end if (constructor != 0) */
- } /* end if(cls != 0) */
- } /* end if (mid != 0) */
- } /* end if (cls != 0) */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
+ jmethodID constructor;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str1, str2, str3;
+ jobject cb_info_t = NULL;
+ jvalue args[7];
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ void *op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5E_walk_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].j = info->cls_id;
+ args[1].j = info->maj_num;
+ args[2].j = info->min_num;
+ args[3].i = (jint)info->line;
+
+ if (NULL == (str1 = CBENVPTR->NewStringUTF(CBENVONLY, info->func_name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[4].l = str1;
+
+ if (NULL == (str2 = CBENVPTR->NewStringUTF(CBENVONLY, info->file_name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[5].l = str2;
+
+ if (NULL == (str3 = CBENVPTR->NewStringUTF(CBENVONLY, info->desc)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[6].l = str3;
+
+ /* Get a reference to your class if you don't have it already */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5E_error2_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, nindx, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (CBENVONLY)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
return (herr_t)status;
} /* end H5E_walk_cb */
@@ -539,15 +589,23 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ewalk2
(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data)
{
- cb_wrapper wrapper = {callback_op, op_data};
+ cb_wrapper wrapper = { callback_op, op_data };
+
+ UNUSED(cls);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ewalk2: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ewalk2: callback_op is NULL");
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void *)&wrapper) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL");
- } /* end if */
- else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)&wrapper) < 0)
- h5libraryError(env);
+done:
+ return;
} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */
#ifdef __cplusplus
diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c
index 9d68290..52b0970 100644
--- a/java/src/jni/h5fImp.c
+++ b/java/src/jni/h5fImp.c
@@ -28,7 +28,10 @@ extern "C" {
#include "h5fImp.h"
#include "h5util.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -39,18 +42,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fopen
(JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id)
{
- hid_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fopen: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fopen: file name not pinned");
+
+ if ((status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fopen */
@@ -64,18 +71,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fcreate
(JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id, jlong access_id)
{
- hid_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fcreate: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fcreate: file name not pinned");
+
+ if ((status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fcreate */
@@ -89,12 +100,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fflush
(JNIEnv *env, jclass clss, jlong object_id, jint scope)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope );
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Fflush */
@@ -107,34 +120,29 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1name
(JNIEnv *env, jclass cls, jlong file_id)
{
- char *namePtr;
- jstring str = NULL;
- ssize_t buf_size;
-
- /* get the length of the name */
- buf_size = H5Fget_name((hid_t)file_id, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5Fget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (namePtr == NULL) {
- h5outOfMemory(env, "H5Fget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size);
- if (buf_size < 0) {
- HDfree(namePtr);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR namePtr);
- HDfree(namePtr);
- }/* end else */
- }/* end else */
- }/* end else */
+ jstring str = NULL;
+ ssize_t buf_size;
+ char *namePtr = NULL;
+
+ UNUSED(cls);
+
+ /* Get the length of the name */
+ if ((buf_size = H5Fget_name((hid_t)file_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (namePtr = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Fget_name: malloc failed");
+
+ if ((H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ namePtr[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, namePtr)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (namePtr)
+ HDfree(namePtr);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1name */
@@ -148,20 +156,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Fis_1hdf5
(JNIEnv *env, jclass clss, jstring name)
{
+ const char *fileName = NULL;
htri_t bval = JNI_FALSE;
- const char *fileName;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- bval = H5Fis_hdf5(fileName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fis_hdf5: file name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fis_hdf5: file name not pinned");
+
+ if ((bval = H5Fis_hdf5(fileName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */
@@ -175,12 +187,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Fget_create_plist((hid_t)file_id );
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Fget_create_plist((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist */
@@ -193,12 +207,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Fget_access_plist((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Fget_access_plist((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist */
@@ -213,9 +229,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1intent
{
unsigned intent = 0;
+ UNUSED(cls);
+
if (H5Fget_intent((hid_t)file_id, &intent) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)intent;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1intent */
@@ -228,14 +247,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Fclose
(JNIEnv *env, jclass clss, jlong file_id)
{
- herr_t status = -1;
+ herr_t status = FAIL;
- if (file_id > 0)
- status = H5Fclose((hid_t)file_id );
+ UNUSED(clss);
- if (status < 0)
- h5libraryError(env);
+ if ((status = H5Fclose((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)status;
} /* end Java_hdf_hdf5lib_H5__1H5Fclose */
@@ -248,18 +267,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fmount
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id, jlong plist_id)
{
- herr_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fmount: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Fmount: file name not pinned");
+
+ if ((status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Fmount */
@@ -273,18 +296,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Funmount
(JNIEnv *env, jclass clss, jlong loc_id, jstring name)
{
- herr_t status = -1;
- const char *fileName;
+ const char *fileName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Funmount((hid_t)loc_id, fileName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, fileName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Funmount: file name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Funmount: file name not pinned");
+
+ if ((status = H5Funmount((hid_t)loc_id, fileName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Funmount */
@@ -298,11 +325,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1freespace
(JNIEnv *env, jclass cls, jlong file_id)
{
- hssize_t ret_val = H5Fget_freespace((hid_t)file_id);
+ hssize_t ret_val = -1;
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(cls);
+ if ((ret_val = H5Fget_freespace((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1freespace */
@@ -315,12 +345,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Freopen
(JNIEnv *env, jclass clss, jlong file_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Freopen((hid_t)file_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Freopen((hid_t)file_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Freopen */
@@ -334,47 +366,40 @@ Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids
(JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs,
jlongArray obj_id_list)
{
- ssize_t ret_val = -1;
- jlong *obj_id_listP;
- jboolean isCopy;
- hid_t *id_list;
- size_t rank;
- size_t i;
-
- if (obj_id_list == NULL) {
- h5nullArgument(env, "H5Fget_obj_ids: obj_id_list is NULL");
- } /* end if */
- else {
- obj_id_listP = ENVPTR->GetLongArrayElements(ENVPAR obj_id_list, &isCopy);
- if (obj_id_listP == NULL) {
- h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not pinned");
- } /* end if */
- else {
- rank = (size_t)ENVPTR->GetArrayLength(ENVPAR obj_id_list);
-
- id_list = (hid_t *)HDmalloc(rank * sizeof(hid_t));
- if (id_list == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT);
- h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not converted to hid_t");
- } /* end if */
- else {
- ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list);
-
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT);
- HDfree(id_list);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- obj_id_listP[i] = (jlong)id_list[i];
- } /* end for */
- HDfree(id_list);
- ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ ssize_t ret_val = -1;
+ size_t i;
+ jsize rank;
+ jlong *obj_id_listP = NULL;
+ hid_t *id_list = NULL;
+
+ UNUSED(cls);
+
+ if (NULL == obj_id_list)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, obj_id_list, obj_id_listP, &isCopy, "H5Fget_obj_ids: obj_id_list not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, obj_id_list)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_obj_ids: obj_id_list length < 0");
+ }
+
+ if (NULL == (id_list = (hid_t *) HDmalloc((size_t)rank * sizeof(hid_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Fget_obj_ids: malloc failed");
+
+ if ((ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t)rank; i++) {
+ obj_id_listP[i] = (jlong)id_list[i];
+ } /* end for */
+
+done:
+ if (id_list)
+ HDfree(id_list);
+ if (obj_id_listP)
+ UNPIN_LONG_ARRAY(ENVONLY, obj_id_list, obj_id_listP, (ret_val < 0) ? JNI_ABORT : 0);
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids */
@@ -388,11 +413,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1obj_1count
(JNIEnv *env, jclass cls, jlong file_id, jint types)
{
- ssize_t ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types);
+ ssize_t ret_val = -1;
- if (ret_val < 0)
- h5libraryError(env);
+ UNUSED(cls);
+ if ((ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1count_1long */
@@ -407,9 +435,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1filesize
{
hsize_t size = 0;
- if (H5Fget_filesize ((hid_t)file_id, &size) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Fget_filesize((hid_t)file_id, &size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) size;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1filesize */
@@ -424,9 +455,12 @@ Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate
{
double rate = 0.0;
+ UNUSED(cls);
+
if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jdouble)rate;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate */
@@ -439,33 +473,37 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size
(JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache)
{
- jint size = 0;
- jlong *metadata_cache_ptr;
- size_t max_size = 0, min_clean_size = 0, cur_size = 0;
- int cur_num_entries = -1;
- jboolean isCopy;
-
- if (metadata_cache == NULL) {
- h5nullArgument(env, "H5Fget_mdc_size: metadata_cache is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR metadata_cache);
- if (size < 3) {
- h5badArgument(env, "H5Fget_mdc_size: length of metadata_cache < 3.");
- } /* end if */
- else {
- if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- metadata_cache_ptr = ENVPTR->GetLongArrayElements(ENVPAR metadata_cache, &isCopy);
- metadata_cache_ptr[0] = (jlong)max_size;
- metadata_cache_ptr[1] = (jlong)min_clean_size;
- metadata_cache_ptr[2] = (jlong)cur_size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR metadata_cache, metadata_cache_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ size_t max_size = 0, min_clean_size = 0, cur_size = 0;
+ jlong *metadata_cache_ptr = NULL;
+ jsize size = 0;
+ int cur_num_entries = -1;
+
+ UNUSED(cls);
+
+ if (NULL == metadata_cache)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata cache array is NULL");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, metadata_cache)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: metadata_cache length < 0");
+ }
+
+ if (size < 3)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_size: length of metadata_cache array < 3");
+
+ if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, &isCopy, "H5Fget_mdc_size: metadata_cache array not pinned");
+
+ metadata_cache_ptr[0] = (jlong)max_size;
+ metadata_cache_ptr[1] = (jlong)min_clean_size;
+ metadata_cache_ptr[2] = (jlong)cur_size;
+
+done:
+ if (metadata_cache_ptr)
+ UNPIN_LONG_ARRAY(ENVONLY, metadata_cache, metadata_cache_ptr, 0);
return (jint)cur_num_entries;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size */
@@ -479,31 +517,36 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1info
(JNIEnv *env, jclass clss, jlong obj_id)
{
- H5F_info2_t finfo;
- jvalue args[9];
+ H5F_info2_t finfo;
jobject ihinfobuf;
+ jvalue args[9];
jobject ret_obj = NULL;
- if (H5Fget_info2((hid_t)obj_id, &finfo) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].j = (jlong)finfo.sohm.msgs_info.index_size;
- args[1].j = (jlong)finfo.sohm.msgs_info.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf = ret_obj;
-
- args[0].i = (jint)finfo.super.version;
- args[1].j = (jlong)finfo.super.super_size;
- args[2].j = (jlong)finfo.super.super_ext_size;
- args[3].i = (jint)finfo.free.version;
- args[4].j = (jlong)finfo.free.meta_size;
- args[5].j = (jlong)finfo.free.tot_space;
- args[6].j = (jint)finfo.sohm.version;
- args[7].j = (jlong)finfo.sohm.hdr_size;
- args[8].l = ihinfobuf;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- } /* end else */
+ UNUSED(clss);
+
+ if (H5Fget_info2((hid_t)obj_id, &finfo) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].j = (jlong)finfo.sohm.msgs_info.index_size;
+ args[1].j = (jlong)finfo.sohm.msgs_info.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+
+ ihinfobuf = ret_obj;
+
+ args[0].i = (jint)finfo.super.version;
+ args[1].j = (jlong)finfo.super.super_size;
+ args[2].j = (jlong)finfo.super.super_ext_size;
+ args[3].i = (jint)finfo.free.version;
+ args[4].j = (jlong)finfo.free.meta_size;
+ args[5].j = (jlong)finfo.free.tot_space;
+ args[6].j = (jint)finfo.sohm.version;
+ args[7].j = (jlong)finfo.sohm.hdr_size;
+ args[8].l = ihinfobuf;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1info */
@@ -516,8 +559,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats
(JNIEnv *env, jclass cls, jlong file_id)
{
+ UNUSED(cls);
+
if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats */
/*
@@ -529,8 +577,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache
(JNIEnv *env, jclass cls, jlong file_id)
{
+ UNUSED(cls);
+
if (H5Fclear_elink_file_cache((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */
/*
@@ -542,8 +595,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write
(JNIEnv *env, jclass cls, jlong file_id)
{
+ UNUSED(cls);
+
if (H5Fstart_swmr_write((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstart_1swmr_1write */
/*
@@ -555,8 +613,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging
(JNIEnv *env, jclass cls, jlong file_id)
{
+ UNUSED(cls);
+
if (H5Fstart_mdc_logging((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstart_1mdc_1logging */
/*
@@ -568,8 +631,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging
(JNIEnv *env, jclass cls, jlong file_id)
{
+ UNUSED(cls);
+
if (H5Fstop_mdc_logging((hid_t)file_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fstop_1mdc_1logging */
/*
@@ -581,34 +649,106 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
(JNIEnv *env, jclass cls, jlong file_id, jbooleanArray mdc_logging_status)
{
+ jboolean *mdc_logging_status_ptr = NULL;
+ jboolean isCopy;
hbool_t is_enabled;
hbool_t is_currently_logging;
- jboolean *mdc_logging_status_ptr;
- jint size;
- jboolean isCopy;
+ jsize size;
+
+ UNUSED(cls);
+
+ if (NULL == mdc_logging_status)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, mdc_logging_status)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: mdc_logging_status length < 0");
+ }
- if (mdc_logging_status == NULL) {
- h5nullArgument(env, "H5Fget_mdc_logging_status: mdc_logging_status is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_logging_status);
- if (size < 2) {
- h5badArgument(env, "H5Fget_mdc_logging_status: length of mdc_logging_status < 2.");
- } /* end if */
- else {
- if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mdc_logging_status_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_logging_status, &isCopy);
- mdc_logging_status_ptr[0] = (jboolean)is_enabled;
- mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_logging_status, mdc_logging_status_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
+ if (size < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Fget_mdc_logging_status: length of mdc_logging_status < 2");
+
+ if (H5Fget_mdc_logging_status((hid_t)file_id, &is_enabled, &is_currently_logging) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, &isCopy, "H5Fget_mdc_logging_status: mdc_logging_status array not pinned");
+
+ mdc_logging_status_ptr[0] = (jboolean)is_enabled;
+ mdc_logging_status_ptr[1] = (jboolean)is_currently_logging;
+
+done:
+ if (mdc_logging_status_ptr)
+ UNPIN_BOOL_ARRAY(ENVONLY, mdc_logging_status, mdc_logging_status_ptr, 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status */
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong file_id, jboolean minimize)
+{
+ hbool_t minimize_val;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ minimize_val = (minimize == JNI_TRUE) ? TRUE : FALSE;
+
+ if ((retVal = H5Fset_dset_no_attrs_hint((hid_t)file_id, (hbool_t)minimize_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+}
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong file_id)
+{
+ jboolean bval = JNI_FALSE;
+ hbool_t minimize = FALSE;
+
+ UNUSED(clss);
+
+ if (H5Fget_dset_no_attrs_hint((hid_t)file_id, (hbool_t *)&minimize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (minimize == TRUE)
+ bval = JNI_TRUE;
+
+done:
+ return bval;
+}
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong file_id, jint low, jint high)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Fset_libver_bounds((hid_t)file_id, (H5F_libver_t)low, (H5F_libver_t)high)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds */
#ifdef __cplusplus
diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h
index fcfdedf..0b36772 100644
--- a/java/src/jni/h5fImp.h
+++ b/java/src/jni/h5fImp.h
@@ -246,6 +246,33 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Fget_1mdc_1logging_1status
(JNIEnv *, jclass, jlong, jbooleanArray);
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Fget_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Fset_libver_bounds
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Fset_1libver_1bounds
+(JNIEnv *, jclass, jlong, jint, jint);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c
index 42c042a..b579f31 100644
--- a/java/src/jni/h5gImp.c
+++ b/java/src/jni/h5gImp.c
@@ -29,7 +29,10 @@ extern "C" {
#include "h5util.h"
#include "h5gImp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -40,12 +43,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Gclose
(JNIEnv *env, jclass clss, jlong group_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Gclose((hid_t)group_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Gclose((hid_t)group_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Gclose */
@@ -63,33 +68,46 @@ jobject
create_H5G_info_t
(JNIEnv *env, H5G_info_t group_info)
{
- jclass cls;
+ jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted;
jboolean jmounted;
+ jclass cls;
jint storage_type;
jobject obj = NULL;
- jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted;
- cls = ENVPTR->FindClass(ENVPAR "hdf/hdf5lib/structs/H5G_info_t");
- if (cls != NULL) {
- obj = ENVPTR->AllocObject(ENVPAR cls);
- if (obj != NULL) {
- if ((fid_storage_type = ENVPTR->GetFieldID(ENVPAR cls, "storage_type", "I")) != NULL) {
- if ((fid_nlinks = ENVPTR->GetFieldID(ENVPAR cls, "nlinks", "J")) != NULL) {
- if ((fid_max_corder = ENVPTR->GetFieldID(ENVPAR cls, "max_corder", "J")) != NULL) {
- if ((fid_mounted = ENVPTR->GetFieldID(ENVPAR cls, "mounted", "Z")) != NULL) {
- jmounted = (group_info.mounted==0) ? JNI_FALSE : JNI_TRUE;
- storage_type = (jint)group_info.storage_type;
-
- ENVPTR->SetIntField(ENVPAR obj, fid_storage_type, (jint)storage_type);
- ENVPTR->SetLongField(ENVPAR obj, fid_nlinks, (jlong)group_info.nlinks);
- ENVPTR->SetLongField(ENVPAR obj, fid_max_corder, (jlong)group_info.max_corder);
- ENVPTR->SetBooleanField(ENVPAR obj, fid_mounted, jmounted);
- }
- }
- }
- }
- }
- }
+ if (NULL == (cls = ENVPTR->FindClass(ENVONLY, "hdf/hdf5lib/structs/H5G_info_t")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (obj = ENVPTR->AllocObject(ENVONLY, cls)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_storage_type = ENVPTR->GetFieldID(ENVONLY, cls, "storage_type", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_nlinks = ENVPTR->GetFieldID(ENVONLY, cls, "nlinks", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_max_corder = ENVPTR->GetFieldID(ENVONLY, cls, "max_corder", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid_mounted = ENVPTR->GetFieldID(ENVONLY, cls, "mounted", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ jmounted = (group_info.mounted == 0) ? JNI_FALSE : JNI_TRUE;
+ storage_type = (jint)group_info.storage_type;
+
+ ENVPTR->SetIntField(ENVONLY, obj, fid_storage_type, (jint)storage_type);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetLongField(ENVONLY, obj, fid_nlinks, (jlong)group_info.nlinks);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetLongField(ENVONLY, obj, fid_max_corder, (jlong)group_info.max_corder);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetBooleanField(ENVONLY, obj, fid_mounted, jmounted);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
return obj;
} /* end create_H5G_info_t */
@@ -103,17 +121,22 @@ Java_hdf_hdf5lib_H5__1H5Gcreate2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- hid_t group_id = -1;
- const char *gName;
+ const char *grpName = NULL;
+ hid_t group_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- group_id = H5Gcreate2((hid_t)loc_id, gName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, gName);
- if (group_id < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gcreate2: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gcreate2: group name not pinned");
+
+ if ((group_id = H5Gcreate2((hid_t)loc_id, grpName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gcreate2 */
@@ -127,12 +150,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gcreate_1anon
(JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id)
{
- hid_t group_id = -1;
+ hid_t group_id = H5I_INVALID_HID;
+
+ UNUSED(cls);
- group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id);
- if (group_id < 0)
- h5libraryError(env);
+ if ((group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gcreate_1anon */
@@ -145,18 +170,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Gopen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- hid_t group_id = -1;
- const char *gName;
+ const char *grpName = NULL;
+ hid_t group_id = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, gName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gopen2: group name is NULL");
- if (group_id < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gopen2: group name not pinned");
+
+ if ((group_id = H5Gopen2((hid_t)loc_id, grpName, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)group_id;
} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */
@@ -171,11 +200,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1create_1plist
(JNIEnv *env, jclass cls, jlong loc_id)
{
- hid_t plist_id = H5Gget_create_plist((hid_t)loc_id);
+ hid_t plist_id = H5I_INVALID_HID;
- if (plist_id < 0)
- h5libraryError(env);
+ UNUSED(cls);
+ if ((plist_id = H5Gget_create_plist((hid_t)loc_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)plist_id;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1create_1plist */
@@ -188,14 +220,18 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info
(JNIEnv *env, jclass cls, jlong loc_id)
{
- jobject obj = NULL;
H5G_info_t group_info;
+ jobject obj = NULL;
+
+ UNUSED(cls);
if (H5Gget_info((hid_t)loc_id, &group_info) < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (obj = create_H5G_info_t(env, group_info)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info: unable to create H5G_info_t object");
+done:
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info */
@@ -208,23 +244,30 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name
(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id)
{
- jobject obj = NULL;
- herr_t ret_val = -1;
- const char *gName;
H5G_info_t group_info;
+ const char *grpName = NULL;
+ jobject obj = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(cls);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_name: group name is NULL");
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id);
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_name: group name not pinned");
- UNPIN_JAVA_STRING(name, gName);
+ if ((ret_val = H5Gget_info_by_name((hid_t)loc_id, grpName, &group_info, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ret_val < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ if (NULL == (obj = create_H5G_info_t(env, group_info))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info_by_name: unable to create H5G_info_t object");
}
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name */
@@ -238,26 +281,33 @@ Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx
(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type,
jint order, jlong n, jlong lapl_id)
{
- jobject obj = NULL;
- herr_t ret_val = -1;
- const char *gName;
- H5G_info_t group_info;
- H5_index_t cindex_type = (H5_index_t)index_type;
- H5_iter_order_t corder = (H5_iter_order_t)order;
-
- PIN_JAVA_STRING(name, gName);
- if (gName != NULL) {
- ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type,
- corder, (hsize_t)n, &group_info, (hid_t)lapl_id);
-
- UNPIN_JAVA_STRING(name, gName);
-
- if (ret_val < 0)
- h5libraryError(env);
- else
- obj = create_H5G_info_t(env, group_info);
+ H5_iter_order_t corder = (H5_iter_order_t)order;
+ H5_index_t cindex_type = (H5_index_t)index_type;
+ H5G_info_t group_info;
+ const char *grpName = NULL;
+ jobject obj = NULL;
+ herr_t ret_val = FAIL;
+
+ UNUSED(cls);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Gget_info_by_idx: group name not pinned");
+
+ if ((ret_val = H5Gget_info_by_idx((hid_t)loc_id, grpName, cindex_type,
+ corder, (hsize_t)n, &group_info, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (obj = create_H5G_info_t(env, group_info))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_info_by_idx: unable to create H5G_info_t object");
}
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return obj;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */
@@ -270,8 +320,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Gflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Gflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Gflush */
/*
@@ -283,8 +338,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Grefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Grefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Grefresh */
diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c
index b8bd1cd..a367802 100644
--- a/java/src/jni/h5iImp.c
+++ b/java/src/jni/h5iImp.c
@@ -27,7 +27,10 @@ extern "C" {
#include "h5jni.h"
#include "h5iImp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -40,10 +43,12 @@ Java_hdf_hdf5lib_H5_H5Iget_1type
{
H5I_type_t retVal = H5I_BADID;
- retVal = H5Iget_type((hid_t)obj_id);
- if (retVal == H5I_BADID)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5I_BADID == (retVal = H5Iget_type((hid_t)obj_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1type */
@@ -56,32 +61,32 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1name_1long
(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size)
{
- char *aName;
- jstring str;
- hssize_t size = -1;
- long bs;
-
- bs = (long)buf_size;
- if (bs <= 0) {
- h5badArgument(env, "H5Iget_name: buf_size <= 0");
- } /* end if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Iget_name: malloc failed");
- } /* end if */
- else {
- size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size);
- if (size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str);
- }
- HDfree(aName);
- }
- }
+ ssize_t size = -1;
+ jstring str;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ if (buf_size < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Iget_name_long: buf_size < 0");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Iget_name_long: malloc failed");
+
+ if ((size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+
return (jlong)size;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@@ -95,33 +100,30 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1name
(JNIEnv *env, jclass clss, jlong obj_id)
{
- char *aName;
jstring str = NULL;
- ssize_t buf_size;
-
- /* get the length of the name */
- buf_size = H5Iget_name((hid_t)obj_id, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5Iget_name: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Iget_name: malloc failed");
- } /* end if */
- else {
- buf_size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size);
- if (buf_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- }
- HDfree(aName);
- }
- }
+ ssize_t buf_size = -1;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ /* Get the length of the name */
+ if ((buf_size = H5Iget_name((hid_t)obj_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Iget_name: malloc failed");
+
+ if (H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+
return str;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */
@@ -134,12 +136,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Iget_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Iget_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1ref */
@@ -152,12 +156,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iinc_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Iinc_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Iinc_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iinc_1ref */
@@ -170,12 +176,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Idec_1ref
(JNIEnv *env, jclass clss, jlong obj_id)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Idec_ref((hid_t)obj_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Idec_ref((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Idec_1ref */
@@ -189,12 +197,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1file_1id
(JNIEnv *env, jclass clss, jlong obj_id)
{
- hid_t file_id = -1;
+ hid_t file_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
- file_id = H5Iget_file_id((hid_t)obj_id);
- if (file_id < 0)
- h5libraryError(env);
+ if ((file_id = H5Iget_file_id((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) file_id;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1file_1id */
@@ -207,12 +217,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iget_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Iget_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Iget_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iget_1type_1ref */
@@ -225,12 +237,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Idec_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Idec_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Idec_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Idec_1type_1ref */
@@ -243,12 +257,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref
(JNIEnv *env, jclass clss, jint type)
{
- int retVal = -1;
+ int retVal = FAIL;
- retVal = H5Iinc_type_ref((H5I_type_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Iinc_type_ref((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref */
@@ -261,11 +277,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Inmembers
(JNIEnv *env, jclass clss, jint type)
{
- hsize_t num_members;
+ hsize_t num_members = 0;
+
+ UNUSED(clss);
if (H5Inmembers((H5I_type_t)type, &num_members) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)num_members;
} /* end Java_hdf_hdf5lib_H5_H5Inmembers */
@@ -280,12 +299,14 @@ Java_hdf_hdf5lib_H5_H5Iis_1valid
{
htri_t bval = JNI_FALSE;
- bval = H5Iis_valid((hid_t)obj_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Iis_valid((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Iis_1valid */
/*
@@ -299,12 +320,14 @@ Java_hdf_hdf5lib_H5_H5Itype_1exists
{
htri_t bval = JNI_FALSE;
- bval = H5Itype_exists((H5I_type_t)type);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Itype_exists((H5I_type_t)type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end else Java_hdf_hdf5lib_H5_H5Itype_1exists */
@@ -317,8 +340,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Iclear_1type
(JNIEnv *env, jclass clss, jint type, jboolean force)
{
- if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Iclear_1type */
/*
@@ -330,8 +358,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Idestroy_1type
(JNIEnv *env, jclass clss, jint type)
{
- if (H5Idestroy_type((H5I_type_t)type) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Idestroy_type((H5I_type_t)type) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Idestroy_1type */
#ifdef __cplusplus
diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h
index 2970e14..4a94180 100644
--- a/java/src/jni/h5jni.h
+++ b/java/src/jni/h5jni.h
@@ -27,147 +27,299 @@
#ifdef __cplusplus
#define ENVPTR (env)
- #define ENVPAR
#define ENVONLY
#define CBENVPTR (cbenv)
- #define CBENVPAR
+ #define CBENVONLY
#define JVMPTR (jvm)
#define JVMPAR
- #define JVMPAR2
#else /* __cplusplus */
#define ENVPTR (*env)
- #define ENVPAR env,
#define ENVONLY env
#define CBENVPTR (*cbenv)
- #define CBENVPAR cbenv,
+ #define CBENVONLY cbenv
#define JVMPTR (*jvm)
#define JVMPAR jvm
- #define JVMPAR2 jvm,
#endif /* __cplusplus */
+/*
+ * Used to silence compiler when a particular
+ * function parameter is not used.
+ */
+#define UNUSED(o) (void) o
+
/* Macros for class access */
/* Calling code must define ret_obj as jobject */
-#define CALL_CONSTRUCTOR(classname,classsig,args) { \
- jclass cls; \
- jmethodID constructor; \
- cls = ENVPTR->FindClass(ENVPAR (classname)); \
- if (cls == 0) { \
- h5JNIFatalError(env, "JNI error: GetObjectClass\n"); \
- ret_obj = NULL; \
- } \
- constructor = ENVPTR->GetMethodID(ENVPAR cls, "<init>", (classsig)); \
- if (constructor == 0) { \
- h5JNIFatalError(env, "JNI error: GetMethodID failed\n"); \
- ret_obj = NULL; \
- } \
- ret_obj = ENVPTR->NewObjectA(ENVPAR cls, constructor, (args)); \
+#define CALL_CONSTRUCTOR(env, classname, classsig, args, ret_obj) \
+{ \
+ jmethodID constructor; \
+ jclass cls; \
+ \
+ if (NULL == (cls = ENVPTR->FindClass(env, (classname)))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, "JNI error: GetObjectClass"); \
+ } \
+ if (NULL == (constructor = ENVPTR->GetMethodID(ENVONLY, cls, "<init>", (classsig)))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, "JNI error: GetMethodID failed"); \
+ } \
+ if (NULL == (ret_obj = ENVPTR->NewObjectA(ENVONLY, cls, constructor, (args)))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_FALSE); \
+ } \
+}
+
+/*
+ * Macros for pinning/unpinning objects.
+ */
+#define PIN_BYTE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetByteArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_BYTE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jbyte *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_BYTE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseByteArrayElements(env, pinnedArray, (jbyte *) bufToRelease, freeMode); \
+}
+
+#define PIN_SHORT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetShortArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_SHORT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jshort *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_SHORT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseShortArrayElements(env, pinnedArray, (jshort *) bufToRelease, freeMode); \
+}
+
+#define PIN_INT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetIntArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_INT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jint *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_INT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseIntArrayElements(env, pinnedArray, (jint *) bufToRelease, freeMode); \
+}
+
+#define PIN_LONG_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetLongArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_LONG_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jlong *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_LONG_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseLongArrayElements(env, pinnedArray, (jlong *) bufToRelease, freeMode); \
+}
+
+#define PIN_FLOAT_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetFloatArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_FLOAT_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jfloat *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_FLOAT_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseFloatArrayElements(env, pinnedArray, (jfloat *) bufToRelease, freeMode); \
+}
+
+#define PIN_DOUBLE_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetDoubleArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_DOUBLE_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jdouble *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_DOUBLE_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseDoubleArrayElements(env, pinnedArray, (jdouble *) bufToRelease, freeMode); \
+}
+
+#define PIN_BOOL_ARRAY(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = ENVPTR->GetBooleanArrayElements(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define PIN_BOOL_ARRAY_CRITICAL(env, arrayToPin, outBuf, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outBuf = (jboolean *) ENVPTR->GetPrimitiveArrayCritical(env, arrayToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
}
+#define UNPIN_BOOL_ARRAY(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleaseBooleanArrayElements(env, pinnedArray, (jboolean *) bufToRelease, freeMode); \
+}
+
+#define UNPIN_ARRAY_CRITICAL(env, pinnedArray, bufToRelease, freeMode) \
+{ \
+ ENVPTR->ReleasePrimitiveArrayCritical(env, pinnedArray, bufToRelease, freeMode); \
+}
/* Macros for string access */
-#define PIN_JAVA_STRING(javastr,localstr) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING(javastr,localstr) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
-}
-
-#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- (local2str) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- else { \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- } \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
-}
-
-#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \
- jboolean isCopy; \
- (localstr) = NULL; \
- (local2str) = NULL; \
- (local3str) = NULL; \
- if ((javastr) == NULL) { \
- h5nullArgument(env, "java string is NULL"); \
- } \
- else if ((java2str) == NULL) { \
- h5nullArgument(env, "second java string is NULL"); \
- } \
- else if ((java3str) == NULL) { \
- h5nullArgument(env, "third java string is NULL"); \
- } \
- else { \
- (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \
- if ((localstr) == NULL) { \
- h5JNIFatalError(env, "local c string is not pinned"); \
- } \
- else { \
- (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \
- if ((local2str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- h5JNIFatalError(env, "second local c string is not pinned"); \
- } \
- else { \
- (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \
- if ((local3str) == NULL) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
- h5JNIFatalError(env, "third local c string is not pinned"); \
- } \
- } \
- } \
- } \
-}
-
-#define UNPIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \
- ENVPTR->ReleaseStringUTFChars(ENVPAR (java3str), (local3str)); \
+#define PIN_JAVA_STRING(env, stringToPin, outString, isCopy, failErrMsg) \
+{ \
+ if (NULL == (outString = ENVPTR->GetStringUTFChars(env, stringToPin, isCopy))) { \
+ CHECK_JNI_EXCEPTION(env, JNI_TRUE); \
+ H5_JNI_FATAL_ERROR(env, failErrMsg); \
+ } \
+}
+
+#define UNPIN_JAVA_STRING(env, pinnedString, stringToRelease) \
+{ \
+ ENVPTR->ReleaseStringUTFChars(env, pinnedString, stringToRelease); \
+}
+
+/*
+ * Macro to check for a JNI exception after a JNI method is called.
+ * If an exception occurred, the value of 'clearException' will determine
+ * whether or not the exception will be cleared in order for the native
+ * method to do its own error handling.
+ *
+ * If the exception does not get cleared, this macro will skip to the
+ * cleanup+return section of the native method, since at that point
+ * cleaning up and returning is the only safe thing that can be done.
+ */
+#define CHECK_JNI_EXCEPTION(env, clearException) \
+{ \
+ if (JNI_TRUE == (*env)->ExceptionCheck(env)) { \
+ if (JNI_TRUE == clearException) \
+ (*env)->ExceptionClear(env); \
+ else \
+ goto done; \
+ } \
}
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
-extern jboolean h5JNIFatalError(JNIEnv *, const char *);
-extern jboolean h5nullArgument(JNIEnv *, const char *);
-extern jboolean h5badArgument (JNIEnv *, const char *);
-extern jboolean h5outOfMemory (JNIEnv *, const char *);
-extern jboolean h5libraryError(JNIEnv *env );
-extern jboolean h5raiseException(JNIEnv *, const char *, const char *);
+extern jboolean h5JNIFatalError(JNIEnv *env, const char *);
+extern jboolean h5nullArgument(JNIEnv *env, const char *);
+extern jboolean h5badArgument(JNIEnv *env, const char *);
+extern jboolean h5outOfMemory(JNIEnv *env, const char *);
+extern jboolean h5libraryError(JNIEnv *env);
+extern jboolean h5raiseException(JNIEnv *env, const char *, const char *);
extern jboolean h5unimplemented( JNIEnv *env, const char *functName);
+/*
+ * The following macros are to facilitate immediate cleanup+return
+ * from a native JNI method when an exception is to be thrown.
+ * Since, in general, the "cleanup" methods are the only safe JNI
+ * methods to call once an exception has occurred, we want to immediately
+ * cleanup and return instead of letting the native method continue.
+ *
+ * Note that a native method can clear the exception when one occurs and
+ * then do its own error handling, but we instead opt to immediately return.
+ */
+#define H5_JNI_FATAL_ERROR(env, message) \
+{ \
+ h5JNIFatalError(env, message); \
+ goto done; \
+}
+
+#define H5_NULL_ARGUMENT_ERROR(env, message) \
+{ \
+ h5nullArgument(env, message); \
+ goto done; \
+}
+
+#define H5_BAD_ARGUMENT_ERROR(env, message) \
+{ \
+ h5badArgument(env, message); \
+ goto done; \
+}
+
+#define H5_OUT_OF_MEMORY_ERROR(env, message) \
+{ \
+ h5outOfMemory(env, message); \
+ goto done; \
+}
+
+#define H5_LIBRARY_ERROR(env) \
+{ \
+ h5libraryError(env); \
+ goto done; \
+}
+
+#define H5_RAISE_EXCEPTION(env, message, exception) \
+{ \
+ h5raiseException(env, message, exception); \
+ goto done; \
+}
+
+#define H5_UNIMPLEMENTED(env, message) \
+{ \
+ h5unimplemented(env, message); \
+ goto done; \
+}
+
/* implemented at H5.c */
extern jint get_enum_value(JNIEnv *env, jobject enum_obj);
extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name,
diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c
index e1ec3bd..7413023 100644
--- a/java/src/jni/h5lImp.c
+++ b/java/src/jni/h5lImp.c
@@ -27,6 +27,9 @@ extern "C" {
#include "h5jni.h"
#include "h5lImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@@ -50,19 +53,28 @@ Java_hdf_hdf5lib_H5_H5Lcopy
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcopy: dest name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcopy: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcopy: dest name not pinned");
+
+ if ((status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lcopy */
/*
@@ -75,20 +87,34 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1external
(JNIEnv *env, jclass clss, jstring file_name, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lFileName;
- const char *lCurName;
- const char *lDstName;
-
- PIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
- if (lFileName != NULL && lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
-
- UNPIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName);
-
- if (status < 0)
- h5libraryError(env);
- }
+ const char *lFileName = NULL;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: file name is NULL");
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: object name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_external: link name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, file_name, lFileName, NULL, "H5Lcreate_external: file name not pinned");
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_external: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_external: link name not pinned");
+
+ if ((status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
+ if (lFileName)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, lFileName);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1external */
/*
@@ -101,19 +127,28 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1hard
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: object name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_hard: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lcreate_hard: object name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lcreate_hard: link name not pinned");
+
+ if ((status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1hard */
/*
@@ -126,19 +161,28 @@ Java_hdf_hdf5lib_H5_H5Lcreate_1soft
(JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *linkTarget = NULL;
+ const char *linkName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lcreate_soft(lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link target is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lcreate_soft: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, linkTarget, NULL, "H5Lcreate_soft: link target not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, linkName, NULL, "H5Lcreate_soft: link name not pinned");
+
+ if ((status = H5Lcreate_soft(linkTarget, (hid_t)dst_loc_id, linkName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, linkName);
+ if (linkTarget)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, linkTarget);
} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1soft */
/*
@@ -150,18 +194,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Ldelete
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
+ const char *linkName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete: link name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Ldelete: link name not pinned");
+
+ if ((status = H5Ldelete((hid_t)loc_id, linkName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
} /* end Java_hdf_hdf5lib_H5_H5Ldelete */
/*
@@ -174,19 +222,23 @@ Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
+ const char *groupName = NULL;
hsize_t n = (hsize_t)link_n;
- herr_t status;
- const char *lName;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ldelete_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ldelete_by_idx: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Ldelete_by_idx: group name not pinned");
+
+ if ((status = H5Ldelete_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
} /* end Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx */
/*
@@ -198,20 +250,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Lexists
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- htri_t bval = JNI_FALSE;
- const char *lName;
+ const char *linkName = NULL;
+ htri_t bval = JNI_FALSE;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lexists: link name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lexists: link name not pinned");
+
+ if ((bval = H5Lexists((hid_t)loc_id, linkName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Lexists */
@@ -225,33 +281,34 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1info
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- jobject ret_obj = NULL;
- jvalue args[5];
- herr_t status;
H5L_info_t infobuf;
- const char *lName;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = infobuf.type;
- args[1].z = infobuf.corder_valid;
- args[2].j = infobuf.corder;
- args[3].i = infobuf.cset;
- if(infobuf.type==0)
- args[4].j = (jlong)infobuf.u.address;
- else
- args[4].j = (jlong)infobuf.u.val_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args);
- } /* end else */
- } /* end if */
+ const char *linkName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info: link name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_info: link name not pinned");
+
+ if ((status = H5Lget_info((hid_t)loc_id, linkName, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].j = (infobuf.type == H5L_TYPE_HARD) ? (jlong) infobuf.u.address : (jlong) infobuf.u.val_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj);
+
+done:
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
+
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info */
@@ -265,33 +322,34 @@ Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
- jobject ret_obj = NULL;
- jvalue args[5];
- herr_t status;
H5L_info_t infobuf;
- const char *lName;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = infobuf.type;
- args[1].z = infobuf.corder_valid;
- args[2].j = infobuf.corder;
- args[3].i = infobuf.cset;
- if(infobuf.type==0)
- args[4].j = (jlong)infobuf.u.address;
- else
- args[4].j = (jlong)infobuf.u.val_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args);
- } /* end els */
- }
+ const char *groupName = NULL;
+ jvalue args[5];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_info_by_idx: group name not pinned");
+
+ if ((status = H5Lget_info_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = infobuf.type;
+ args[1].z = infobuf.corder_valid;
+ args[2].j = infobuf.corder;
+ args[3].i = infobuf.cset;
+ args[4].j = (infobuf.type == H5L_TYPE_HARD) ? (jlong) infobuf.u.address : (jlong) infobuf.u.val_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args, ret_obj);
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
+
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx */
@@ -305,43 +363,38 @@ Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong access_id)
{
- jlong status_size;
+ const char *groupName = NULL;
jstring str = NULL;
- size_t buf_size;
- const char *lName;
- char *lValue;
-
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link name */
- status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)NULL, (size_t)0, H5P_DEFAULT);
- if(status_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */
-
- lValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed ");
- } /* end if */
- else {
- status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)lValue, (size_t)buf_size, (hid_t)access_id);
-
- if (status_size < 0) {
- HDfree(lValue);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- HDfree(lValue);
- if (str == NULL)
- h5JNIFatalError(env, "H5Lget_name_by_idx: return string not created");
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
- }
+ ssize_t status_size = -1;
+ char *linkName = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_name_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Lget_name_by_idx: group name not pinned");
+
+ /* Get the length of the link name */
+ if ((status_size = H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)NULL, (size_t)0, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* add extra space for the null terminator */
+ if (NULL == (linkName = (char *) HDmalloc(sizeof(char) * (size_t)status_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_name_by_idx: failed to allocate buffer for link name");
+
+ if ((H5Lget_name_by_idx((hid_t)loc_id, groupName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char *)linkName, (size_t)status_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ linkName[status_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, linkName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (linkName)
+ HDfree(linkName);
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx */
@@ -355,80 +408,83 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Lget_1value
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id)
{
- size_t buf_size;
- herr_t status;
H5L_info_t infobuf;
- const char *lName;
- char *lValue;
- const char *file_name;
- const char *obj_name;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *linkName = NULL;
jstring str;
+ herr_t status;
+ char *linkValue = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_value: link name is NULL");
+
+ infobuf.type = H5L_TYPE_ERROR;
+
+ PIN_JAVA_STRING(ENVONLY, name, linkName, NULL, "H5Lget_value: link name not pinned");
+
+ /* Get the length of the link value */
+ if ((status = H5Lget_info((hid_t)loc_id, linkName, &infobuf, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- infobuf.type = -1;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link val */
- status = H5Lget_info((hid_t)loc_id, lName, &infobuf, H5P_DEFAULT);
- if(status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = infobuf.u.val_size + 1;/* add extra space for the null terminator */
-
- if(infobuf.type == H5L_TYPE_HARD) {
- h5JNIFatalError(env, "H5Lget_val: link is hard type");
- } /* end if */
- else {
- lValue = (char*)HDmalloc(sizeof(char) * buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_val: malloc failed");
- } /* end if */
- else {
- status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else if(infobuf.type == H5L_TYPE_EXTERNAL) {
- status = H5Lunpack_elink_val(lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, &file_name, &obj_name);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lValue);
- if (str == NULL) {
- /* exception -- fatal JNI error */
- h5JNIFatalError(env, "H5Lget_val: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- } /* end else */
- } /* end else */
- HDfree(lValue);
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
+ if (H5L_TYPE_HARD == infobuf.type)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: hard links are unsupported");
+
+ if (NULL == (linkValue = (char *) HDmalloc(sizeof(char) * infobuf.u.val_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: failed to allocate buffer for link value");
+
+ if ((status = H5Lget_val((hid_t)loc_id, linkName, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ linkValue[infobuf.u.val_size] = '\0';
+
+ switch (infobuf.type) {
+ case H5L_TYPE_SOFT:
+ {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, linkValue)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_EXTERNAL:
+ {
+ if ((status = H5Lunpack_elink_val(linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, &file_name, &obj_name)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 1, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val: invalid link type");
+ break;
}
+done:
+ if (linkValue)
+ HDfree(linkValue);
+ if (linkName)
+ UNPIN_JAVA_STRING(ENVONLY, name, linkName);
+
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val */
@@ -442,78 +498,86 @@ Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order,
jlong link_n, jobjectArray link_value, jlong access_id)
{
- herr_t status;
- size_t buf_size;
H5L_info_t infobuf;
- const char *lName;
- void *lValue;
- const char *file_name;
- const char *obj_name;
+ const char *file_name = NULL;
+ const char *obj_name = NULL;
+ const char *grpName = NULL;
jstring str;
+ herr_t status;
+ void *linkValue = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lget_val_by_idx: group name is NULL");
+
+ infobuf.type = H5L_TYPE_ERROR;
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lget_val_by_idx: group name not pinned");
+
+ /* Get the length of the link value */
+ if ((status = H5Lget_info_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5L_TYPE_HARD == infobuf.type)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: hard links are unsupported")
+
+ if (!infobuf.u.val_size)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (linkValue = (void *) HDmalloc(infobuf.u.val_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: failed to allocate buffer for link value");
+
+ if ((status = H5Lget_val_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void *)linkValue, infobuf.u.val_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ ((char *) linkValue)[infobuf.u.val_size] = '\0';
+
+ switch (infobuf.type) {
+ case H5L_TYPE_SOFT:
+ {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, (char *)linkValue)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_EXTERNAL:
+ {
+ if ((status = H5Lunpack_elink_val((char *)linkValue, (size_t)infobuf.u.val_size, (unsigned *)NULL, (const char **)&file_name, (const char**)&obj_name)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, obj_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- infobuf.type = -1;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- /* get the length of the link valuee */
- status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id);
- if(status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = infobuf.u.val_size;
- if(buf_size == 0) {
- h5libraryError(env);
- } /* end if */
- else {
- lValue = (void*)HDmalloc(buf_size);
- if (lValue == NULL) {
- h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed ");
- } /* end if */
- else {
- status = H5Lget_val_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void*)lValue, (size_t)buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else if(infobuf.type == H5L_TYPE_EXTERNAL) {
- status = H5Lunpack_elink_val((char*)lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, (const char**)&file_name, (const char**)&obj_name);
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR obj_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
-
- str = ENVPTR->NewStringUTF(ENVPAR file_name);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR (char *)lValue);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created");
- } /* end if */
- else {
- ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str);
- } /* end else */
- } /* end else */
- HDfree(lValue);
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, lName);
+ ENVPTR->SetObjectArrayElement(ENVONLY, link_value, 1, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ case H5L_TYPE_ERROR:
+ case H5L_TYPE_MAX:
+ case H5L_TYPE_HARD:
+ default:
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Lget_val_by_idx: invalid link type");
+ break;
}
+done:
+ if (linkValue)
+ HDfree(linkValue);
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
+
return infobuf.type;
} /* end Java_hdf_hdf5lib_H5_H5Lget_1val_1by_1idx */
@@ -527,73 +591,86 @@ Java_hdf_hdf5lib_H5_H5Lmove
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lmove: dest name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Lmove: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Lmove: dest name not pinned");
+ if ((status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Lmove */
static herr_t
H5L_iterate_cb
(hid_t g_id, const char *name, const H5L_info_t *info, void *cb_data)
{
- JNIEnv *cbenv;
- jint status;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[5];
- jobject cb_info_t = NULL;
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].i = info->type;
- args[1].z = info->corder_valid;
- args[2].j = info->corder;
- args[3].i = info->cset;
- if(info->type==0)
- args[4].j = (jlong)info->u.address;
- else
- args[4].j = (jlong)info->u.val_size;
- // get a reference to your class if you don't have it already
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5L_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IZJIJ)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (cb_info_t == NULL) {
- printf("FATAL ERROR: hdf/hdf5lib/structs/H5L_info_t: Creation failed\n");
- }
- else {
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- }
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ jmethodID constructor, mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jvalue args[5];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5L_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].i = info->type;
+ args[1].z = info->corder_valid;
+ args[2].j = info->corder;
+ args[3].i = info->cset;
+ args[4].j = (info->type == H5L_TYPE_HARD) ? (jlong)info->u.address : (jlong)info->u.val_size;
+
+ /* Get a reference to your class if you don't have it already */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5L_info_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(IZJIJ)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("FATAL ERROR: hdf/hdf5lib/structs/H5L_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
} /* end H5L_iterate_cb */
/*
@@ -606,20 +683,23 @@ Java_hdf_hdf5lib_H5_H5Lvisit
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jobject callback_op, jobject op_data)
{
- herr_t status = -1;
- cb_wrapper wrapper = {callback_op, op_data};
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL");
- } /* end if */
- else {
- status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit: callback_op is NULL");
+
+ if ((status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Lvisit */
@@ -633,26 +713,30 @@ Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jobject callback_op, jobject op_data, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
- cb_wrapper wrapper = {callback_op, op_data};
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *grpName = NULL;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Lvisit_by_name: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Lvisit_by_name: group name not pinned");
+
+ if ((status = H5Lvisit_by_name((hid_t)grp_id, grpName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void *)&wrapper, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name */
@@ -667,22 +751,24 @@ Java_hdf_hdf5lib_H5_H5Literate
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
- cb_wrapper wrapper = {callback_op, op_data};
+ cb_wrapper wrapper = { callback_op, op_data };
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
- ENVPTR->GetJavaVM(ENVPAR &jvm);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate: op_data or callback_op is NULL");
- } /* end if */
- else {
- status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate: callback_op is NULL");
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if ((status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t *)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Literate */
@@ -696,27 +782,31 @@ Java_hdf_hdf5lib_H5_H5Literate_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jlong idx, jobject callback_op, jobject op_data, jlong access_id)
{
- hsize_t start_idx = (hsize_t)idx;
- herr_t status = -1;
- const char *lName;
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *groupName = NULL;
+ hsize_t start_idx = (hsize_t)idx;
+ herr_t status = FAIL;
- ENVPTR->GetJavaVM(ENVPAR &jvm);
- cb_wrapper wrapper = {callback_op, op_data};
+ UNUSED(clss);
- if ((op_data == NULL) || (callback_op == NULL)) {
- h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, lName);
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Literate_by_name: group name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, name, groupName, NULL, "H5Literate_by_name: group name not pinned");
+
+ if ((status = H5Literate_by_name((hid_t)grp_id, groupName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)&wrapper, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (groupName)
+ UNPIN_JAVA_STRING(ENVONLY, name, groupName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Literate_1by_1name */
@@ -730,11 +820,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Lis_1registered
(JNIEnv *env, jclass clss, jint link_cls_id)
{
- htri_t ret_val = H5Lis_registered((H5L_type_t)link_cls_id);
+ htri_t ret_val = FAIL;
+
+ UNUSED(clss);
- if (ret_val < 0)
- h5libraryError(env);
+ if ((ret_val = H5Lis_registered((H5L_type_t)link_cls_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (int)ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Lis_1registered */
@@ -747,8 +840,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Lunregister
(JNIEnv *env, jclass clss, jint link_cls_id)
{
+ UNUSED(clss);
+
if (H5Lunregister((H5L_type_t)link_cls_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Lunregister */
diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c
index 1de505a..cc88b81 100644
--- a/java/src/jni/h5oImp.c
+++ b/java/src/jni/h5oImp.c
@@ -26,6 +26,9 @@ extern "C" {
#include "h5jni.h"
#include "h5oImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
typedef struct _cb_wrapper {
@@ -48,18 +51,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Oopen
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id)
{
- hid_t status = -1;
- const char *oName;
+ const char *objName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen: object name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oopen: object name not pinned");
+
+ if ((status = H5Oopen((hid_t)loc_id, objName, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen */
@@ -73,11 +80,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Oclose
(JNIEnv *env, jclass clss, jlong object_id)
{
- herr_t retVal = H5Oclose((hid_t)object_id);
+ herr_t retVal = FAIL;
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Oclose((hid_t)object_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oclose */
@@ -91,19 +101,28 @@ Java_hdf_hdf5lib_H5_H5Ocopy
(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name,
jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lCurName;
- const char *lDstName;
+ const char *lCurName = NULL;
+ const char *lDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
- if (lCurName != NULL && lDstName != NULL) {
- status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName);
+ if (NULL == cur_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: src name is NULL");
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ocopy: dst name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, cur_name, lCurName, NULL, "H5Ocopy: src name not pinned");
+ PIN_JAVA_STRING(ENVONLY, dst_name, lDstName, NULL, "H5Ocopy: dest name not pinned");
+
+ if ((status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (lDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, lDstName);
+ if (lCurName)
+ UNPIN_JAVA_STRING(ENVONLY, cur_name, lCurName);
} /* end Java_hdf_hdf5lib_H5_H5Ocopy */
/*
@@ -115,57 +134,61 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info
(JNIEnv *env, jclass clss, jlong loc_id, jint fields)
{
- herr_t status = -1;
- H5O_info_t infobuf;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
- jobject ret_obj = NULL;
-
- status = H5Oget_info2((hid_t)loc_id, &infobuf, (unsigned)fields);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
-
+ H5O_info_t infobuf;
+ jobject hdrinfobuf;
+ jobject ihinfobuf1;
+ jobject ihinfobuf2;
+ jvalue args[12];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ if ((status = H5Oget_info2((hid_t)loc_id, &infobuf, (unsigned)fields)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf1 = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf2 = ret_obj;
+
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].j = (jlong)infobuf.addr;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = (jlong)infobuf.num_attrs;
+ args[5].j = infobuf.atime;
+ args[6].j = infobuf.mtime;
+ args[7].j = infobuf.ctime;
+ args[8].j = infobuf.btime;
+ args[9].l = hdrinfobuf;
+ args[10].l = ihinfobuf1;
+ args[11].l = ihinfobuf2;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */
@@ -178,62 +201,69 @@ JNIEXPORT jobject JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint fields, jlong access_id)
{
- const char *lName;
- herr_t status = -1;
H5O_info_t infobuf;
- jvalue args[12];
+ const char *objName = NULL;
jobject hdrinfobuf;
jobject ihinfobuf1;
jobject ihinfobuf2;
+ jvalue args[12];
+ herr_t status = FAIL;
jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Oget_info_by_name2((hid_t)loc_id, lName, &infobuf, (unsigned)fields, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
- }
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_info_by_name: object name not pinned");
+
+ if ((status = H5Oget_info_by_name2((hid_t)loc_id, objName, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf1 = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf2 = ret_obj;
+
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].j = (jlong)infobuf.addr;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = (jlong)infobuf.num_attrs;
+ args[5].j = infobuf.atime;
+ args[6].j = infobuf.mtime;
+ args[7].j = infobuf.ctime;
+ args[8].j = infobuf.btime;
+ args[9].l = hdrinfobuf;
+ args[10].l = ihinfobuf1;
+ args[11].l = ihinfobuf2;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */
@@ -248,62 +278,69 @@ Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id,
jstring name, jint index_field, jint order, jlong link_n, jint fields, jlong access_id)
{
- const char *lName;
- herr_t status;
H5O_info_t infobuf;
- jvalue args[12];
+ const char *grpName = NULL;
jobject hdrinfobuf;
jobject ihinfobuf1;
jobject ihinfobuf2;
+ jvalue args[12];
+ herr_t status = FAIL;
jobject ret_obj = NULL;
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Oget_info_by_idx2((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = (jint)infobuf.hdr.version;
- args[1].i = (jint)infobuf.hdr.nmesgs;
- args[2].i = (jint)infobuf.hdr.nchunks;
- args[3].i = (jint)infobuf.hdr.flags;
- args[4].j = (jlong)infobuf.hdr.space.total;
- args[5].j = (jlong)infobuf.hdr.space.meta;
- args[6].j = (jlong)infobuf.hdr.space.mesg;
- args[7].j = (jlong)infobuf.hdr.space.free;
- args[8].j = (jlong)infobuf.hdr.mesg.present;
- args[9].j = (jlong)infobuf.hdr.mesg.shared;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args);
- hdrinfobuf = ret_obj;
-
- args[0].j = (jlong)infobuf.meta_size.obj.index_size;
- args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf1 = ret_obj;
- args[0].j = (jlong)infobuf.meta_size.attr.index_size;
- args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args);
- ihinfobuf2 = ret_obj;
-
- args[0].j = (jlong)infobuf.fileno;
- args[1].j = (jlong)infobuf.addr;
- args[2].i = infobuf.type;
- args[3].i = (jint)infobuf.rc;
- args[4].j = (jlong)infobuf.num_attrs;
- args[5].j = infobuf.atime;
- args[6].j = infobuf.mtime;
- args[7].j = infobuf.ctime;
- args[8].j = infobuf.btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args);
- }
- }
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_info_by_idx: group name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oget_info_by_idx: group name not pinned");
+
+ if ((status = H5Oget_info_by_idx2((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = (jint)infobuf.hdr.version;
+ args[1].i = (jint)infobuf.hdr.nmesgs;
+ args[2].i = (jint)infobuf.hdr.nchunks;
+ args[3].i = (jint)infobuf.hdr.flags;
+ args[4].j = (jlong)infobuf.hdr.space.total;
+ args[5].j = (jlong)infobuf.hdr.space.meta;
+ args[6].j = (jlong)infobuf.hdr.space.mesg;
+ args[7].j = (jlong)infobuf.hdr.space.free;
+ args[8].j = (jlong)infobuf.hdr.mesg.present;
+ args[9].j = (jlong)infobuf.hdr.mesg.shared;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args, ret_obj);
+ hdrinfobuf = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.obj.index_size;
+ args[1].j = (jlong)infobuf.meta_size.obj.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf1 = ret_obj;
+
+ args[0].j = (jlong)infobuf.meta_size.attr.index_size;
+ args[1].j = (jlong)infobuf.meta_size.attr.heap_size;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args, ret_obj);
+ ihinfobuf2 = ret_obj;
+
+ args[0].j = (jlong)infobuf.fileno;
+ args[1].j = (jlong)infobuf.addr;
+ args[2].i = infobuf.type;
+ args[3].i = (jint)infobuf.rc;
+ args[4].j = (jlong)infobuf.num_attrs;
+ args[5].j = infobuf.atime;
+ args[6].j = infobuf.mtime;
+ args[7].j = infobuf.ctime;
+ args[8].j = infobuf.btime;
+ args[9].l = hdrinfobuf;
+ args[10].l = ihinfobuf1;
+ args[11].l = ihinfobuf2;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args, ret_obj);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return ret_obj;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */
@@ -318,130 +355,138 @@ Java_hdf_hdf5lib_H5_H5Olink
(JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id,
jstring dst_name, jlong create_id, jlong access_id)
{
- herr_t status = -1;
- const char *lDstName;
+ const char *linkDstName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(dst_name, lDstName);
- if (lDstName != NULL) {
- status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(dst_name, lDstName);
+ if (NULL == dst_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Olink: link destination name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, dst_name, linkDstName, NULL, "H5Olink: link destination name not pinned");
+
+ if ((status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, linkDstName, (hid_t)create_id, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkDstName)
+ UNPIN_JAVA_STRING(ENVONLY, dst_name, linkDstName);
} /* end Java_hdf_hdf5lib_H5_H5Olink */
static herr_t
H5O_iterate_cb
(hid_t g_id, const char *name, const H5O_info_t *info, void *cb_data)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
- jmethodID constructor;
- jvalue args[12];
- jobject hdrinfobuf;
- jobject ihinfobuf1;
- jobject ihinfobuf2;
- jobject cb_info_t = NULL;
cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
+ jmethodID constructor, mid;
+ jobject cb_info_t = NULL;
+ jobject visit_callback = wrapper->visit_callback;
+ jobject hdrinfobuf;
+ jobject ihinfobuf1;
+ jobject ihinfobuf2;
+ jstring str;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jvalue args[12];
+ void *op_data = (void *)wrapper->op_data;
+ jint status = FAIL;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5O_iterate_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ args[0].i = (jint)info->hdr.version;
+ args[1].i = (jint)info->hdr.nmesgs;
+ args[2].i = (jint)info->hdr.nchunks;
+ args[3].i = (jint)info->hdr.flags;
+ args[4].j = (jlong)info->hdr.space.total;
+ args[5].j = (jlong)info->hdr.space.meta;
+ args[6].j = (jlong)info->hdr.space.mesg;
+ args[7].j = (jlong)info->hdr.space.free;
+ args[8].j = (jlong)info->hdr.mesg.present;
+ args[9].j = (jlong)info->hdr.mesg.shared;
+
+ /* Get a reference to the H5_hdr_info_t class */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_hdr_info_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(IIIIJJJJJJ)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (hdrinfobuf = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */
+ args[0].j = (jlong)info->meta_size.obj.index_size;
+ args[1].j = (jlong)info->meta_size.obj.heap_size;
+
+ /* Get a reference to the H5_ih_info_t class */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5_ih_info_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJ)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (ihinfobuf1 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+ args[0].j = (jlong)info->meta_size.attr.index_size;
+ args[1].j = (jlong)info->meta_size.attr.heap_size;
+
+ if (NULL == (ihinfobuf2 = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+ args[0].j = (jlong)info->fileno;
+ args[1].j = (jlong)info->addr;
+ args[2].i = info->type;
+ args[3].i = (jint)info->rc;
+ args[4].j = (jlong)info->num_attrs;
+ args[5].j = info->atime;
+ args[6].j = info->mtime;
+ args[7].j = info->ctime;
+ args[8].j = info->btime;
+ args[9].l = hdrinfobuf;
+ args[10].l = ihinfobuf1;
+ args[11].l = ihinfobuf2;
+
+ /* Get a reference to the H5O_info_t class */
+ if (NULL == (cls = CBENVPTR->FindClass(CBENVONLY, "hdf/hdf5lib/structs/H5O_info_t")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ /* Get a reference to the constructor; the name is <init> */
+ if (NULL == (constructor = CBENVPTR->GetMethodID(CBENVONLY, cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (cb_info_t = CBENVPTR->NewObjectA(CBENVONLY, cls, constructor, args))) {
+ HDprintf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_info_t: Creation failed\n");
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, g_id, str, cb_info_t, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- args[0].i = (jint)info->hdr.version;
- args[1].i = (jint)info->hdr.nmesgs;
- args[2].i = (jint)info->hdr.nchunks;
- args[3].i = (jint)info->hdr.flags;
- args[4].j = (jlong)info->hdr.space.total;
- args[5].j = (jlong)info->hdr.space.meta;
- args[6].j = (jlong)info->hdr.space.mesg;
- args[7].j = (jlong)info->hdr.space.free;
- args[8].j = (jlong)info->hdr.mesg.present;
- args[9].j = (jlong)info->hdr.mesg.shared;
- // get a reference to the H5_hdr_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_hdr_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(IIIIJJJJJJ)V");
- if (constructor != 0) {
- hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (hdrinfobuf == NULL) {
- printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_hdr_info_t: Creation failed\n");
- }
- else {
- args[0].j = (jlong)info->meta_size.obj.index_size;
- args[1].j = (jlong)info->meta_size.obj.heap_size;
- // get a reference to the H5_ih_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJ)V");
- if (constructor != 0) {
- ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (ihinfobuf1 == NULL) {
- printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
- }
- else {
- args[0].j = (jlong)info->meta_size.attr.index_size;
- args[1].j = (jlong)info->meta_size.attr.heap_size;
- ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (ihinfobuf2 == NULL) {
- printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5_ih_info_t: Creation failed\n");
- }
- else {
- args[0].j = (jlong)info->fileno;
- args[1].j = (jlong)info->addr;
- args[2].i = info->type;
- args[3].i = (jint)info->rc;
- args[4].j = (jlong)info->num_attrs;
- args[5].j = info->atime;
- args[6].j = info->mtime;
- args[7].j = info->ctime;
- args[8].j = info->btime;
- args[9].l = hdrinfobuf;
- args[10].l = ihinfobuf1;
- args[11].l = ihinfobuf2;
- // get a reference to the H5O_info_t class
- cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t");
- if (cls != 0) {
- // get a reference to the constructor; the name is <init>
- constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "<init>", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V");
- if (constructor != 0) {
- cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args);
- if (cb_info_t == NULL) {
- printf("H5O_iterate_cb ERROR: hdf/hdf5lib/structs/H5O_info_t: Creation failed\n");
- }
- else {
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data);
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return status;
+ return (herr_t)status;
} /* end H5O_iterate_cb */
/*
@@ -454,24 +499,23 @@ Java_hdf_hdf5lib_H5_H5Ovisit
(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order,
jobject callback_op, jobject op_data, jint fields)
{
- herr_t status = -1;
- cb_wrapper wrapper = {callback_op, op_data};
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Ovisit: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Ovisit: callback_op is NULL");
- } /* end if */
- else {
- status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields);
-
- if (status < 0)
- h5libraryError(env);
- }
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit: callback_op is NULL");
+
+ if ((status = H5Ovisit2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void *)&wrapper, (unsigned)fields)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit */
@@ -485,31 +529,30 @@ Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name
(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order,
jobject callback_op, jobject op_data, jint fields, jlong access_id)
{
- herr_t status = -1;
- const char *lName;
- cb_wrapper wrapper = {callback_op, op_data};
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL");
- return -1;
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Ovisit_by_name: callback_op is NULL");
- return -1;
- } /* end if */
- else {
- PIN_JAVA_STRING(name, lName);
- if (lName != NULL) {
- status = H5Ovisit_by_name2((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)&wrapper, (unsigned)fields, (hid_t)access_id);
-
- UNPIN_JAVA_STRING(name, lName);
-
- if (status < 0)
- h5libraryError(env);
- }
- }
+ cb_wrapper wrapper = { callback_op, op_data };
+ const char *objName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: callback_op is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Ovisit_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Ovisit_by_name: object name not pinned");
+
+ if ((status = H5Ovisit_by_name2((hid_t)grp_id, objName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void *)&wrapper, (unsigned)fields, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return status;
} /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */
@@ -523,24 +566,20 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oset_1comment
(JNIEnv *env, jclass clss, jlong loc_id, jstring comment)
{
- herr_t status = -1;
const char *oComment = NULL;
- jboolean isCopy;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
- if (comment == NULL) {
- status = H5Oset_comment((hid_t)loc_id, oComment);
- } /* end if */
- else {
- oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment != NULL) {
- status = H5Oset_comment((hid_t)loc_id, oComment);
+ if (NULL != comment)
+ PIN_JAVA_STRING(ENVONLY, comment, oComment, NULL, "H5Oset_comment: object comment not pinned");
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
- }
- } /* end else */
+ if ((status = H5Oset_comment((hid_t)loc_id, oComment)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (oComment)
+ UNPIN_JAVA_STRING(ENVONLY, comment, oComment);
} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment */
/*
@@ -553,29 +592,29 @@ Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id,
jstring name, jstring comment, jlong access_id)
{
- herr_t status = -1;
- const char *oName;
- const char *oComment;
-
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- if (comment == NULL) {
- status = H5Oset_comment_by_name((hid_t)loc_id, oName, NULL, (hid_t)access_id);
- } /* end if */
- else {
- jboolean isCopy;
- oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy);
- if (oComment != NULL) {
- status = H5Oset_comment_by_name((hid_t)loc_id, oName, oComment, (hid_t)access_id);
- ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment);
- } /* end if */
- } /* end else */
-
- UNPIN_JAVA_STRING(name, oName);
-
- if (status < 0)
- h5libraryError(env);
- }
+ const char *objName = NULL;
+ const char *objComment = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oset_comment_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oset_comment_by_name: object name not pinned");
+
+ if (NULL != comment)
+ PIN_JAVA_STRING(ENVONLY, comment, objComment, &isCopy, "H5Oset_comment_by_name: object comment not pinned");
+
+ if ((status = H5Oset_comment_by_name((hid_t)loc_id, objName, objComment, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (objComment)
+ UNPIN_JAVA_STRING(ENVONLY, comment, objComment);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name */
/*
@@ -587,39 +626,32 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment
(JNIEnv *env, jclass clss, jlong loc_id)
{
- char *oComment;
- ssize_t buf_size;
- ssize_t status;
jstring str = NULL;
+ ssize_t buf_size;
+ ssize_t status = -1;
+ char *oComment = NULL;
+
+ UNUSED(clss);
+
+ /* Get the length of the comment */
+ if ((buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size) {
+ if (NULL == (oComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment: failed to allocate object comment buffer");
- /* get the length of the comment */
- buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Oget_comment: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (oComment == NULL) {
- /* exception -- out of memory */
- h5outOfMemory( env, "H5Oget_comment: malloc failed");
- } /* end if */
- else {
- status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment: return string not allocated");
- } /* end if */
- } /* end else */
- HDfree(oComment);
- }
- } /* end else if */
+ if ((status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ oComment[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oComment)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (oComment)
+ HDfree(oComment);
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */
@@ -633,44 +665,41 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
- char *oComment;
- const char *oName;
+ const char *objName = NULL;
+ jstring str = NULL;
ssize_t buf_size;
ssize_t status;
- jstring str = NULL;
+ char *objComment = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oget_comment_by_name: object name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oget_comment_by_name: object name not pinned");
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- /* get the length of the comment */
- buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id);
- if (buf_size < 0) {
- h5badArgument( env, "H5Oget_comment_by_name: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (oComment == NULL) {
- h5outOfMemory( env, "H5Oget_comment_by_name: malloc failed");
- } /* end if */
- else {
- status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR oComment);
- if (str == NULL) {
- h5JNIFatalError( env, "H5Oget_comment_by_name: return string not allocated");
- } /* end if */
- } /* end else */
- HDfree(oComment);
- }
- } /* end if */
- UNPIN_JAVA_STRING(name, oName);
+ /* Get the length of the comment */
+ if ((buf_size = H5Oget_comment_by_name((hid_t)loc_id, objName, NULL, 0, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size) {
+ if (NULL == (objComment = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Oget_comment_by_name: failed to allocate buffer for object comment");
+
+ if ((status = H5Oget_comment_by_name((hid_t)loc_id, objName, objComment, (size_t)buf_size + 1, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ objComment[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, objComment)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
+done:
+ if (objComment)
+ HDfree(objComment);
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
+
return (jstring)str;
} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */
@@ -683,20 +712,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Oexists_1by_1name
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id)
{
+ const char *objName = NULL;
htri_t bval = JNI_FALSE;
- const char *oName;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oexists_by_name: object name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, objName, NULL, "H5Oexists_by_name: object name not pinned");
+
+ if ((bval = H5Oexists_by_name((hid_t)loc_id, objName, (hid_t)access_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (objName)
+ UNPIN_JAVA_STRING(ENVONLY, name, objName);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Oexists_1by_1name */
@@ -710,8 +743,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Odecr_1refcount
(JNIEnv *env, jclass clss, jlong object_id)
{
+ UNUSED(clss);
+
if (H5Odecr_refcount((hid_t)object_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/* end Java_hdf_hdf5lib_H5_H5Odecr_1refcount */
/*
@@ -723,8 +761,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oincr_1refcount
(JNIEnv *env, jclass clss, jlong object_id)
{
+ UNUSED(clss);
+
if (H5Oincr_refcount((hid_t)object_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Oincr_1refcount */
/*
@@ -736,12 +779,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr
(JNIEnv *env, jclass clss, jlong loc_id, jlong addr)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr );
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr */
@@ -755,18 +800,22 @@ Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx
(JNIEnv *env, jclass clss, jlong loc_id, jstring name,
jint index_field, jint order, jlong link_n, jlong lapl_id)
{
- hid_t retVal = -1;
- const char *oName;
+ const char *grpName = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, oName);
- if (oName != NULL) {
- retVal = H5Oopen_by_idx((hid_t)loc_id, oName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, oName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Oopen_by_idx: object name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, grpName, NULL, "H5Oopen_by_idx: object name not pinned");
+
+ if ((retVal = H5Oopen_by_idx((hid_t)loc_id, grpName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (grpName)
+ UNPIN_JAVA_STRING(ENVONLY, name, grpName);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx */
@@ -780,8 +829,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Oflush
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Oflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Oflush */
/*
@@ -793,8 +847,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Orefresh
(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Orefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Orefresh */
diff --git a/src/H5HLpublic.h b/java/src/jni/h5pACPLImp.c
index 143bb78..f6c14e1 100644
--- a/src/H5HLpublic.h
+++ b/java/src/jni/h5pACPLImp.c
@@ -11,27 +11,26 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
*
- * Created: H5HLpublic.h
- * Jul 16 1997
- * Robb Matzke <matzke@llnl.gov>
- *
- * Purpose: Public declarations for the H5HL (local heap) package.
- *
- *-------------------------------------------------------------------------
*/
-#ifndef _H5HLpublic_H
-#define _H5HLpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pACPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
#ifdef __cplusplus
-}
-#endif
-#endif
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/src/H5HGpublic.h b/java/src/jni/h5pACPLImp.h
index fcec593..194afc0 100644
--- a/src/H5HGpublic.h
+++ b/java/src/jni/h5pACPLImp.h
@@ -11,21 +11,17 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*
- * Programmer: Robb Matzke <matzke@llnl.gov>
- * Friday, March 27, 1998
- */
-#ifndef _H5HGpublic_H
-#define _H5HGpublic_H
+#ifndef _Included_hdf_hdf5lib_H5_H5PACPL
+#define _Included_hdf_hdf5lib_H5_H5PACPL
-/* Public headers needed by this file */
-#include "H5public.h"
+#include <jni.h>
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
#ifdef __cplusplus
-}
-#endif
-#endif
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PACPL */
diff --git a/java/src/jni/h5pDAPLImp.c b/java/src/jni/h5pDAPLImp.c
new file mode 100644
index 0000000..fb39b84
--- /dev/null
+++ b/java/src/jni/h5pDAPLImp.c
@@ -0,0 +1,325 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+extern JavaVM *jvm;
+
+typedef struct _cb_wrapper {
+ jobject visit_callback;
+ jobject op_data;
+} cb_wrapper;
+
+static herr_t H5D_append_cb(hid_t dataset_id, hsize_t *cur_dims, void *cb_data);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_cache
+ * Signature: (JJJD)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
+ (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
+{
+ UNUSED(clss);
+
+ if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_cache
+ * Signature: (J[J[J[D)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
+ (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
+ jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+{
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong *rdcc_nslotsArray = NULL;
+ jlong *nbytesArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL != rdcc_w0)
+ PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_chunk_cache: rdcc_w0 array not pinned");
+ if (NULL != rdcc_nslots)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, &isCopy, "H5Pget_chunk_cache: rdcc_nslots array not pinned");
+ if (NULL != rdcc_nbytes)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_chunk_cache: nbytesArray array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long rdcc_nslots_temp = *rdcc_nslotsArray;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nslots_t = (size_t) rdcc_nslots_temp;
+ size_t nbytes_t = (size_t) nbytes_temp;
+
+ if ((status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *rdcc_nslotsArray = (jlong)rdcc_nslots_t;
+ *nbytesArray = (jlong)nbytes_t;
+ } /* end direct cast special handling */
+
+done:
+ if (nbytesArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, (status < 0) ? JNI_ABORT : 0);
+ if (rdcc_nslotsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nslots, rdcc_nslotsArray, (status < 0) ? JNI_ABORT : 0);
+ if (w0Array)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_efile_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+{
+ const char *extFilePrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_efile_prefix: external file prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix, NULL, "H5Pset_efile_prefix: external file prefix not pinned");
+
+ if ((retVal = H5Pset_efile_prefix((hid_t)dapl_id, extFilePrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (extFilePrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, extFilePrefix);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_efile_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ ssize_t prefix_size = -1;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if ((prefix_size = H5Pget_efile_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t)prefix_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: memory allocation failed");
+
+ if (H5Pget_efile_prefix((hid_t)dapl_id, (char *)pre, (size_t)prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[(size_t)prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_efile_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_append_flush
+ * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
+ (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
+{
+ cb_wrapper wrapper = { callback_op, op_data };
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_append_flush: callback_op is NULL");
+
+ if ((status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t *)boundary, (H5D_append_cb_t)H5D_append_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1append_1flush */
+
+/*
+ * TODO: H5Pget_append_flush
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_view
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
+ (JNIEnv *env, jclass clss, jlong dapl_id, jint view)
+{
+ UNUSED(clss);
+
+ if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_view
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ H5D_vds_view_t virtual_view = H5D_VDS_ERROR;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)virtual_view;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_printf_gap
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
+ (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_printf_gap
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ hsize_t gap_size = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)gap_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
+
+static herr_t
+H5D_append_cb
+ (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
+{
+ cb_wrapper *wrapper = (cb_wrapper *)cb_data;
+ jlongArray cur_dimsArray;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ void *op_data = (void *)wrapper->op_data;
+ jint status = -1;
+
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5D_append_cb: failed to attach current thread to JVM");
+ }
+
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL != cur_dims) {
+ if (NULL == (cur_dimsArray = CBENVPTR->NewLongArray(CBENVONLY, 2)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ CBENVPTR->SetLongArrayRegion(CBENVONLY, cur_dimsArray, 0, 2, (const jlong *)cur_dims);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, dataset_id, cur_dims, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (CBENVONLY)
+ JVMPTR->DetachCurrentThread(JVMPAR);
+
+ return (herr_t)status;
+} /* end H5D_append_cb */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDAPLImp.h b/java/src/jni/h5pDAPLImp.h
new file mode 100644
index 0000000..a9fbadd
--- /dev/null
+++ b/java/src/jni/h5pDAPLImp.h
@@ -0,0 +1,112 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDAPL
+#define _Included_hdf_hdf5lib_H5_H5PDAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_cache
+ * Signature: (JJJD)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
+(JNIEnv *, jclass, jlong, jlong, jlong, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_cache
+ * Signature: (J[J[J[D)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
+(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_efile_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_efile_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_append_flush
+ * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
+ (JNIEnv*, jclass, jlong, jint, jlongArray, jobject, jobject);
+
+/*
+ * TODO: H5Pget_append_flush
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_view
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_view
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_printf_gap
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_printf_gap
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDAPL */
diff --git a/java/src/jni/h5pDCPLImp.c b/java/src/jni/h5pDCPLImp.c
new file mode 100644
index 0000000..7559c3b
--- /dev/null
+++ b/java/src/jni/h5pDCPLImp.c
@@ -0,0 +1,1415 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_layout
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1layout
+ (JNIEnv *env, jclass clss, jlong plist, jint layout)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_layout
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1layout
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5D_layout_t retVal = H5D_LAYOUT_ERROR;
+
+ UNUSED(clss);
+
+ if (H5D_LAYOUT_ERROR == (retVal = H5Pget_layout((hid_t)plist)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk
+ * Signature: (JI[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk
+ (JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
+{
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ hsize_t *lp = NULL;
+ size_t i;
+ size_t rank;
+ jsize arrLen;
+ jbyte *theArray = NULL;
+ jlong *jlp = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (ndims < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: ndims < 0");
+ if (NULL == dim)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dim array is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, dim)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dim array length < 0");
+ }
+
+ rank = (size_t) arrLen / sizeof(jlong);
+ if (rank < (size_t) ndims)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_chunk: dims array rank < ndims");
+
+ PIN_BYTE_ARRAY(ENVONLY, dim, theArray, &isCopy, "H5Pset_chunk: dim array not pinned");
+
+ if (NULL == (da = lp = (hsize_t *) HDmalloc(rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_chunk: memory allocation failed");
+
+ jlp = (jlong *)theArray;
+ for (i = 0; i < rank; i++) {
+ *lp = (hsize_t)*jlp;
+ lp++;
+ jlp++;
+ } /* end if */
+
+ if ((status = H5Pset_chunk((hid_t)plist, (int)ndims, da)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (da)
+ HDfree(da);
+ if (theArray)
+ UNPIN_BYTE_ARRAY(ENVONLY, dim, theArray, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk
+ * Signature: (JI[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk
+ (JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
+{
+ jboolean isCopy;
+ hsize_t *da = NULL;
+ jlong *theArray = NULL;
+ jsize arrLen;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims array length < 0");
+ }
+ if (arrLen < max_ndims)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_chunk: dims array < max_ndims");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, theArray, &isCopy, "H5Pget_chunk: input dims not pinned");
+
+ if (NULL == (da = (hsize_t *) HDmalloc((size_t)max_ndims * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_chunk: memory allocation failed");
+
+ if ((status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < max_ndims; i++)
+ theArray[i] = (jlong)da[i];
+
+done:
+ if (da)
+ HDfree(da);
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_opts
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_opts
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ unsigned opts = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_chunk_opts((hid_t)dcpl_id, &opts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)opts;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong dcpl_id, jboolean minimize)
+{
+ hbool_t minimize_val;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ minimize_val = (JNI_TRUE == minimize) ? TRUE : FALSE;
+
+ if ((retVal = H5Pset_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t)minimize_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
+(JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ hbool_t minimize = FALSE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_dset_no_attrs_hint((hid_t)dcpl_id, (hbool_t *)&minimize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (minimize == TRUE)
+ bval = JNI_TRUE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_deflate
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1deflate
+ (JNIEnv *env, jclass clss, jlong plist, jint level)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_deflate((hid_t)plist, (unsigned)level)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+{
+ jboolean isCopy;
+ jbyte *byteP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value) {
+ if ((status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else {
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Pget_fill_value: value array not pinned");
+
+ if ((status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
+{
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *byteP = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fill_value: value is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Pget_fill_value: value array not pinned");
+
+ if ((status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pfill_value_defined
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
+ (JNIEnv *env, jclass clss, jlong plist, jintArray status)
+{
+ H5D_fill_value_t value = H5D_FILL_VALUE_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == status)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pfill_value_defined: status is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, status, theArray, &isCopy, "H5Pfill_value_defined: status not pinned");
+
+ if ((retVal = H5Pfill_value_defined((hid_t)plist, &value)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jint)value;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, status, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
+ (JNIEnv *env, jclass clss, jlong plist, jint fill_time)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
+ (JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
+{
+ H5D_fill_time_t time = H5D_FILL_TIME_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fill_time)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fill_time: fill_time is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, fill_time, theArray, &isCopy, "H5Pget_fill_time: fill_time not pinned");
+
+ if ((retVal = H5Pget_fill_time((hid_t)plist, &time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jint)time;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, fill_time, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alloc_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
+ (JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alloc_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
+ (JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
+{
+ H5D_alloc_time_t time = H5D_ALLOC_TIME_ERROR;
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == alloc_time)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_alloc_time: alloc_time is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, alloc_time, theArray, &isCopy, "H5Pget_alloc_time: alloc_time not pinned");
+
+ if ((retVal = H5Pget_alloc_time((hid_t)plist, &time)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = time;
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, alloc_time, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
+ jlong cd_nelmts, jintArray cd_values)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == cd_values) {
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int)flags, (size_t)cd_nelmts, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+ else {
+ PIN_INT_ARRAY(ENVONLY, cd_values, theArray, &isCopy, "H5Pset_filter: input array not pinned");
+
+ if ((status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, theArray, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pall_filters_avail
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ htri_t bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if ((bval = H5Pall_filters_avail((hid_t)dcpl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return (jboolean)bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nfilters
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nfilters
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_nfilters((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
+ jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+{
+ jboolean isCopy;
+ jstring str;
+ jint *flagsArray = NULL;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ char *filter = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (namelen <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: namelen <= 0");
+ if (NULL == flags)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter: cd_values is NULL");
+
+ if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter: flags array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter: nelmts array not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter: elmts array not pinned");
+
+
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ {
+ unsigned int filter_config;
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, filter, &filter_config)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ }
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0)
+ if (filter)
+ HDfree(filter);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter2
+ (JNIEnv *env, jclass clss, jlong plist, jint filter_number,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
+ jobjectArray name, jintArray filter_config)
+{
+ jboolean isCopy;
+ jstring str;
+ jint *flagsArray = NULL;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *filter_configArray = NULL;
+ char *filter = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (namelen <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: namelen <= 0");
+ if (NULL == flags)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: cd_nelmts is NULL");
+ if (NULL == filter_config)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: filter_config is NULL");
+
+ if (NULL == (filter = (char *) HDmalloc(sizeof(char) * (size_t)namelen)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter2: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter2: flags array not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter2: nelmts array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter2: filter_config array not pinned");
+
+ if (NULL == cd_values && *cd_nelmtsArray == 0) {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = 0;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, NULL,
+ (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ }
+ else {
+ if (NULL == cd_values)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter2: cd_values is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter2: elmts array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, filter, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ filter[namelen - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special */
+ }
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, filter))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter2: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (filter_configArray)
+ UNPIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (filter)
+ HDfree(filter);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
+{
+ jboolean isCopy;
+ jstring str;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *flagsArray = NULL;
+ char *aName = NULL;
+ long bs;
+ int rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ bs = (long)namelen;
+
+ if (bs <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: namelen <= 0");
+ if (NULL == flags)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_values is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: name is NULL");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id: flags not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id: cd_nelms not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id: cd_values array not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, cd_values)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id: cd_values array length < 0");
+ }
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ unsigned int filter_config;
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, (char *)aName, &filter_config)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ aName[bs - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special */
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (aName)
+ HDfree(aName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config)
+{
+ jboolean isCopy;
+ jstring str;
+ jlong *cd_nelmtsArray = NULL;
+ jint *cd_valuesArray = NULL;
+ jint *flagsArray = NULL;
+ jint *filter_configArray = NULL;
+ long bs;
+ char *aName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ bs = (long)namelen;
+
+ if (bs <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: namelen <= 0");
+ if (NULL == flags)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: flags is NULL");
+ if (NULL == cd_nelmts)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: cd_nelmts is NULL");
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: cd_values is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: name is NULL");
+ if (NULL == filter_config)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_filter_by_id2: filter_config is NULL");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)bs)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id2: memory allocation failed");
+
+ PIN_INT_ARRAY(ENVONLY, flags, flagsArray, &isCopy, "H5Pget_filter_by_id2: flags not pinned");
+ PIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, &isCopy, "H5Pget_filter_by_id2: cd_nelms not pinned");
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, &isCopy, "H5Pget_filter_by_id2: cd_values array not pinned");
+ PIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, &isCopy, "H5Pget_filter_by_id2: filter_config not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long cd_nelmts_temp = *cd_nelmtsArray;
+ size_t cd_nelmts_t = (size_t) cd_nelmts_temp;
+
+ if ((status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
+ (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
+ (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ aName[bs - 1] = '\0';
+
+ *cd_nelmtsArray = (jlong)cd_nelmts_t;
+ } /* end direct cast special handling */
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_filter_by_id2: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (filter_configArray)
+ UNPIN_INT_ARRAY(ENVONLY, filter_config, filter_configArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_valuesArray)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesArray, (status < 0) ? JNI_ABORT : 0);
+ if (cd_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, cd_nelmts, cd_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (flagsArray)
+ UNPIN_INT_ARRAY(ENVONLY, flags, flagsArray, (status < 0) ? JNI_ABORT : 0);
+ if (aName)
+ HDfree(aName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pmodify_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pmodify_1filter
+ (JNIEnv *env, jclass clss, jlong plist, jint filter,
+ jint flags, jlong cd_nelmts, jintArray cd_values)
+{
+ jboolean isCopy;
+ jint *cd_valuesP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == cd_values)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pmodify_filter: cd_values is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesP, &isCopy, "H5Pmodify_filter: cd_values not pinned");
+
+ if ((status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter, (const unsigned int)flags,
+ (size_t)cd_nelmts, (unsigned int *)cd_valuesP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cd_valuesP)
+ UNPIN_INT_ARRAY(ENVONLY, cd_values, cd_valuesP, JNI_ABORT);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Premove_filter
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5P1remove_1filter
+ (JNIEnv *env, jclass clss, jlong obj_id, jint filter)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Premove_filter((hid_t)obj_id, (H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fletcher32
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fletcher32((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nbit
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nbit
+ (JNIEnv *env, jclass clss, jlong plist_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_nbit((hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_scaleoffset
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
+ (JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (scale_factor < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: scale factor must be >= 0");
+ if (scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_scaleoffset: invalid scale type");
+
+ if ((retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shuffle
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shuffle
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_shuffle((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_szip
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1szip
+ (JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_external
+ * Signature: (JLjava/lang/String;JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1external
+ (JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size)
+{
+ const char *fileName = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_external: file name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, fileName, NULL, "H5Pset_external: file name not pinned");
+
+ if ((status = H5Pset_external((hid_t)plist, fileName, (off_t)offset, (hsize_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, name, fileName);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external
+ * Signature: (JIJ[Ljava/lang/String;[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external
+ (JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
+ jobjectArray name, jlongArray size)
+{
+ jboolean isCopy;
+ jstring str;
+ hsize_t s;
+ off_t o;
+ jsize arrLen;
+ jlong *theArray = NULL;
+ char *file = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (name_size < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: name_size < 0");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size array length < 0");
+ }
+ if ((size != NULL) && (arrLen < 2))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_external: size input array < 2");
+
+ if (name_size > 0)
+ if (NULL == (file = (char *) HDmalloc(sizeof(char) * (size_t)name_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_external: memory allocation failed");
+
+ if ((status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
+ file, (off_t *)&o, (hsize_t *)&s)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL != size) {
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_external: size array not pinned");
+
+ theArray[0] = o;
+ theArray[1] = (jlong)s;
+ }
+
+ if (NULL != file) {
+ file[name_size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, file))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_external: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+ if (file)
+ HDfree(file);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external_count
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external_1count
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_external_count((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual
+ * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
+ jstring src_file_name, jstring src_dset_name, jlong src_space_id)
+{
+ const char *fstr = NULL;
+ const char *dstr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == src_file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_file_name is NULL");
+ if (NULL == src_dset_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual: src_dset_name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, src_file_name, fstr, NULL, "H5Pset_virtual: src_file_name not pinned");
+ PIN_JAVA_STRING(ENVONLY, src_dset_name, dstr, NULL, "H5Pset_virtual: src_dset_name not pinned");
+
+ if ((retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (dstr)
+ UNPIN_JAVA_STRING(ENVONLY, src_dset_name, dstr);
+ if (fstr)
+ UNPIN_JAVA_STRING(ENVONLY, src_file_name, fstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_count
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
+ (JNIEnv *env, jclass clss, jlong dcpl_id)
+{
+ size_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_dsetname
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+{
+ ssize_t buf_size;
+ char *dname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ /* get the length of the filename */
+ if ((buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (dname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_dsetname: memory allocation failed");
+
+ if (H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ dname[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, dname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_dsetname: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (dname)
+ HDfree(dname);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_filename
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+{
+ ssize_t buf_size;
+ char *fname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ /* get the length of the filename */
+ if ((buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (fname = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_filename: memory allocation failed");
+
+ if (H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ fname[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, fname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_filename: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (fname)
+ HDfree(fname);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_srcspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+{
+ hid_t space_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)space_id;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_vspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
+ (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+{
+ hid_t space_id = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)space_id;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
+{
+ const char *virtPrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_virtual_prefix: virtual prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, virtPrefix, NULL, "H5Pset_virtual_prefix: virtual prefix not pinned");
+
+ if ((retVal = H5Pset_virtual_prefix((hid_t)dapl_id, virtPrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (virtPrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, virtPrefix);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+ (JNIEnv *env, jclass clss, jlong dapl_id)
+{
+ ssize_t prefix_size = -1;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if ((prefix_size = H5Pget_virtual_prefix((hid_t)dapl_id, (char *)NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_prefix: memory allocation failed");
+
+ if (H5Pget_virtual_prefix((hid_t)dapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_virtual_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDCPLImp.h b/java/src/jni/h5pDCPLImp.h
new file mode 100644
index 0000000..6e5c225
--- /dev/null
+++ b/java/src/jni/h5pDCPLImp.h
@@ -0,0 +1,396 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDCPL
+#define _Included_hdf_hdf5lib_H5_H5PDCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_layout
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1layout
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_layout
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1layout
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk
+ * Signature: (JI[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk
+(JNIEnv *, jclass, jlong, jint, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk
+ * Signature: (JI[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk
+(JNIEnv *, jclass, jlong, jint, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_chunk_opts
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_chunk_opts
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_dset_no_attrs_hint
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_dset_no_attrs_hint
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1dset_1no_1attrs_1hint
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_deflate
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1deflate
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
+(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_value
+ * Signature: (JJ[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
+(JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pfill_value_defined
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fill_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fill_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alloc_time
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alloc_time
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1filter
+(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pall_filters_avail
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nfilters
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nfilters
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter2
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_filter_by_id2
+ * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
+(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pmodify_filter
+ * Signature: (JIIJ[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pmodify_1filter
+(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Premove_filter
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5P1remove_1filter
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fletcher32
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nbit
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nbit
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_scaleoffset
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shuffle
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shuffle
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_szip
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1szip
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_external
+ * Signature: (JLjava/lang/String;JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1external
+(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external
+ * Signature: (JIJ[Ljava/lang/String;[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external
+(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_external_count
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1external_1count
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual
+ * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual
+(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_count
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_dsetname
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_filename
+ * Signature: (JJ)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_srcspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_vspace
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_virtual_prefix
+ * Signature: (JLjava/lang/String;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_virtual_prefix
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDCPL */
diff --git a/java/src/jni/h5pDXPLImp.c b/java/src/jni/h5pDXPLImp.c
new file mode 100644
index 0000000..323fa8c
--- /dev/null
+++ b/java/src/jni/h5pDXPLImp.c
@@ -0,0 +1,505 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pDXPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer
+ * Signature: (JJ[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer
+ (JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg)
+{
+#ifdef notdef
+ jboolean isCopy;
+ jbyte *tconvP = NULL;
+ jbyte *bkgP = NULL;
+#endif
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+#ifndef notdef
+ UNUSED(plist);
+ UNUSED(size);
+ UNUSED(tconv);
+ UNUSED(bkg);
+#endif
+
+ H5_UNIMPLEMENTED(ENVONLY, "H5Pset_buffer: not implemented");
+
+ /* NOTE: DON'T IMPLEMENT THIS!!! */
+#ifdef notdef
+ if (NULL != tconv)
+ PIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, &isCopy, "H5Pset_buffer: tconv not pinned");
+ if (NULL != bkg)
+ PIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, &isCopy, "H5Pset_buffer: bkg not pinned");
+
+ if ((status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifdef notdef
+ if (bkgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, (status < 0) ? JNI_ABORT : 0);
+ if (tconvP)
+ UNPIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, (status < 0) ? JNI_ABORT : 0);
+#endif
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer
+ * Signature: (J[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer
+ (JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
+{
+#ifdef notdef
+ jboolean isCopy;
+ jbyte *tconvP = NULL;
+ jbyte *bkgP = NULL;
+#endif
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+#ifndef notdef
+ UNUSED(plist);
+ UNUSED(tconv);
+ UNUSED(bkg);
+#endif
+
+ H5_UNIMPLEMENTED(ENVONLY, "H5Pget_buffer: not implemented");
+
+ /* NOTE: DON'T IMPLEMENT THIS!!! */
+#ifdef notdef
+ if (NULL == tconv)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_buffer: tconv input array is NULL");
+ if (NULL == bkg)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_buffer: bkg array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, &isCopy, "H5Pget_buffer: tconv not pinned");
+ PIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, &isCopy, "H5Pget_buffer: bkg not pinned");
+
+ if ((status = H5Pget_buffer((hid_t)plist, tconvP, bkgP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+#endif
+
+done:
+#ifdef notdef
+ if (bkgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, bkg, bkgP, (status < 0) ? JNI_ABORT : 0);
+ if (tconvP)
+ UNPIN_BYTE_ARRAY(ENVONLY, tconv, tconvP, (status < 0) ? JNI_ABORT : 0);
+#endif
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ size_t size = 0;
+
+ UNUSED(clss);
+
+ if (!(size = H5Pget_buffer((hid_t)plist, NULL, NULL)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_preserve
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1preserve
+ (JNIEnv *env, jclass clss, jlong plist, jboolean status)
+{
+ hbool_t st = JNI_FALSE;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (JNI_TRUE == status)
+ st = TRUE;
+ else if (JNI_FALSE == status)
+ st = false;
+ else
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_preserve: status not TRUE or FALSE");
+
+ if ((retVal = H5Pset_preserve((hid_t)plist, st)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_preserve
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1preserve
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_preserve((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_edc_check
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
+ (JNIEnv *env, jclass clss, jlong plist, jint check)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_edc_check
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5Z_EDC_t retVal = -1;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_edc_check((hid_t)plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */
+
+/*
+ * TODO: H5Pset_filter_callback
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_data_transform
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
+ (JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
+{
+ const char *express = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == expression)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_data_transform: data transform expression is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, expression, express, NULL, "H5Pset_data_transform: data transform expression not pinned");
+
+ if ((retVal = H5Pset_data_transform((hid_t)plist_id, express)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (express)
+ UNPIN_JAVA_STRING(ENVONLY, expression, express);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_data_transform
+ * Signature: (J[Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
+ (JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size)
+{
+ jstring str = NULL;
+ char *express = NULL;
+ ssize_t express_size = -1;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_data_transform: size <= 0");
+
+ if ((express_size = H5Pget_data_transform((hid_t)plist_id, (char *)NULL, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (express = (char *) HDmalloc(sizeof(char) * (size_t)express_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_data_transform: memory allocation failed");
+
+ if (H5Pget_data_transform((hid_t)plist_id, express, (size_t)express_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ express[express_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, express))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_data_transform: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, expression, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (express)
+ HDfree(express);
+
+ return (jlong)express_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */
+
+/*
+ * TODO: H5Pset_type_conv_cb
+ */
+
+/*
+ * TODO: H5Pget_type_conv_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_hyper_vector_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_hyper_vector_size
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
+{
+ jboolean isCopy;
+ size_t size;
+ jlong *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == vector_size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_hyper_vector_size: vector_size is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, vector_size, theArray, &isCopy, "H5Pget_hyper_vector_size: vector_size not pinned");
+
+ if ((retVal = H5Pget_hyper_vector_size((hid_t)plist, &size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)size;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, vector_size, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_btree_ratios
+ * Signature: (JDDD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
+ (JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right)
+{
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_btree_ratios
+ * Signature: (J[D[D[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
+ (JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
+ jdoubleArray middle, jdoubleArray right)
+{
+ jboolean isCopy;
+ jdouble *leftP = NULL;
+ jdouble *middleP = NULL;
+ jdouble *rightP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == left)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: left input array is NULL");
+ if (NULL == middle)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: middle input array is NULL");
+ if (NULL == right)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_btree_ratios: right input array is NULL");
+
+ PIN_DOUBLE_ARRAY(ENVONLY, left, leftP, &isCopy, "H5Pget_btree_ratios: left array not pinned");
+ PIN_DOUBLE_ARRAY(ENVONLY, middle, middleP, &isCopy, "H5Pget_btree_ratios: middle array not pinned");
+ PIN_DOUBLE_ARRAY(ENVONLY, right, rightP, &isCopy, "H5Pget_btree_ratios: right array not pinned");
+
+ if ((status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP,
+ (double *)middleP, (double *)rightP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (rightP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, right, rightP, (status < 0) ? JNI_ABORT : 0);
+ if (middleP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, middle, middleP, (status < 0) ? JNI_ABORT : 0);
+ if (leftP)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, left, leftP, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */
+
+/*
+ * TODO: H5Pset_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pget_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pget_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_num
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_ratio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_collective_opt
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_chunk_opt_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_io_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_no_collective_cause
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pDXPLImp.h b/java/src/jni/h5pDXPLImp.h
new file mode 100644
index 0000000..d62f9c5
--- /dev/null
+++ b/java/src/jni/h5pDXPLImp.h
@@ -0,0 +1,209 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PDXPL
+#define _Included_hdf_hdf5lib_H5_H5PDXPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer
+ * Signature: (JJ[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer
+(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer
+ * Signature: (J[B[B)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer
+(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_buffer_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_buffer_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_preserve
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1preserve
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_preserve
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1preserve
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_edc_check
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_edc_check
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_filter_callback
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_data_transform
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_data_transform
+ * Signature: (J[Ljava/lang/String;J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
+(JNIEnv *, jclass, jlong, jobjectArray, jlong);
+
+/*
+ * TODO: H5Pset_type_conv_cb
+ */
+
+/*
+ * TODO: H5Pget_type_conv_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_hyper_vector_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_hyper_vector_size
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_btree_ratios
+ * Signature: (JDDD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
+(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_btree_ratios
+ * Signature: (J[D[D[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
+(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray);
+
+/*
+ * TODO: H5Pset_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pget_vlen_mem_manager
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pget_dxpl_mpio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_num
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_chunk_opt_ratio
+ */
+
+/*
+ * TODO: H5Pset_dxpl_mpio_collective_opt
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_chunk_opt_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_actual_io_mode
+ */
+
+/*
+ * TODO: H5Pget_mpio_no_collective_cause
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PDXPL */
diff --git a/java/src/jni/h5pFAPLImp.c b/java/src/jni/h5pFAPLImp.c
new file mode 100644
index 0000000..acfc853
--- /dev/null
+++ b/java/src/jni/h5pFAPLImp.c
@@ -0,0 +1,1647 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5util.h"
+#include "h5pFAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * TODO: H5Pset_driver
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_driver
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1driver
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_driver((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */
+
+/*
+ * TODO: H5Pget_driver_info
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fclose_degree
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
+ (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fclose_degree
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5F_close_degree_t degree = H5F_CLOSE_DEFAULT;
+
+ UNUSED(clss);
+
+ if (H5Pget_fclose_degree((hid_t)plist, &degree) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)degree;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_core
+ * Signature: (JJZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_core
+ * Signature: (J[J[Z)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
+{
+ jboolean isCopy;
+ jboolean *backArray = NULL;
+ jlong *incArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == increment)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: increment is NULL");
+ if (NULL == backing_store)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_core: backing_store is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, increment, incArray, &isCopy, "H5Pget_fapl_core: incArray not pinned");
+ PIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, &isCopy, "H5Pget_fapl_core: backArray not pinned");
+
+ {
+ /* Direct cast (size_t *)variable fails on 32-bit environment */
+ long long inc_temp = *incArray;
+ size_t inc_t = (size_t) inc_temp;
+
+ if ((status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *incArray = (jlong)inc_t;
+ }
+
+done:
+ if (backArray)
+ UNPIN_BOOL_ARRAY(ENVONLY, backing_store, backArray, (status < 0) ? JNI_ABORT : 0);
+ if (incArray)
+ UNPIN_LONG_ARRAY(ENVONLY, increment, incArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */
+
+/*
+ * TODO: H5Pset_core_write_tracking
+ */
+
+/*
+ * TODO: H5Pget_core_write_tracking
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_direct
+ * Signature: (JJJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
+ jlong block_size, jlong cbuf_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_DIRECT
+ if ((retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+ UNUSED(alignment);
+ UNUSED(block_size);
+ UNUSED(cbuf_size);
+#endif
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_direct
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
+{
+#ifdef H5_HAVE_DIRECT
+ jboolean isCopy;
+ jlong *theArray = NULL;
+ size_t alignment = 0;
+ size_t block_size = 0;
+ size_t cbuf_size = 0;
+ jsize arrLen;
+#endif
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_DIRECT
+ if (NULL == info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, info)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info array length < 0");
+ }
+ if (arrLen < 3)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_fapl_direct: info input array < 3");
+
+ PIN_LONG_ARRAY(ENVONLY, info, theArray, &isCopy, "H5Pget_fapl_direct: info not pinned");
+
+ if ((retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)alignment;
+ theArray[1] = (jlong)block_size;
+ theArray[2] = (jlong)cbuf_size;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+ UNUSED(info);
+#endif
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_family
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
+ (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
+{
+ long ms = (long)memb_size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_family
+ * Signature: (J[J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
+ (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
+{
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ size_t i;
+ jlong *sizeArray = NULL;
+ jlong *plistArray = NULL;
+ jsize rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == memb_size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size is NULL");
+ if (NULL == memb_plist)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_plist is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, &isCopy, "H5Pget_family: sizeArray not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, memb_size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_family: memb_size array length < 0");
+ }
+
+ if (NULL == (sa = (hsize_t *) HDmalloc((size_t) rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_family: memory allocation failed");
+
+ PIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, &isCopy, "H5Pget_family: plistArray not pinned");
+
+ if ((status = H5Pget_fapl_family((hid_t)tid, sa, (hid_t *)plistArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) rank; i++)
+ sizeArray[i] = (jlong)sa[i];
+
+done:
+ if (plistArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_plist, plistArray, (status < 0) ? JNI_ABORT : 0);
+ if (sa)
+ HDfree(sa);
+ if (sizeArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_size, sizeArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_family_offset
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
+ (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_family_offset((hid_t)fapl_id, (hsize_t)offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_family_offset
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hsize_t offset = 0;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_family_offset((hid_t)fapl_id, &offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)offset;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_log
+ * Signature: (JLjava/lang/String;JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
+ (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
+{
+ const char *pLogfile = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == logfile)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_log: log file name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, logfile, pLogfile, NULL, "H5Pset_fapl_log: log file name not pinned");
+
+ if ((retVal = H5Pset_fapl_log((hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (pLogfile)
+ UNPIN_JAVA_STRING(ENVONLY, logfile, pLogfile);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */
+
+/*
+ * TODO: H5Pset_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pset_fapl_mpiposix
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpiposix
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
+ (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
+{
+ const char * const *mName = NULL;
+ const char *utf8 = NULL;
+ jboolean isCopy;
+ jboolean bb;
+ jobject o;
+ jstring rstring;
+ jstring obj;
+ jclass Sjc;
+ size_t i;
+ jlong *thefaplArray = NULL;
+ jlong *theaddrArray = NULL;
+ jint *themapArray = NULL;
+ char *member_name[H5FD_MEM_NTYPES];
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char *));
+
+ if (memb_map)
+ PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pset_fapl_multi: memb_map not pinned");
+ if (memb_fapl)
+ PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pset_fapl_multi: memb_fapl not pinned");
+ if (memb_addr)
+ PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pset_fapl_multi: memb_addr not pinned");
+
+ if (memb_name) {
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ size_t str_len;
+
+ if (NULL == (obj = (jstring) ENVPTR->GetObjectArrayElement(ENVONLY, (jobjectArray) memb_name, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ member_name[i] = NULL;
+ continue;
+ }
+
+ /*
+ * length = ENVPTR->GetStringUTFLength(ENVONLY, obj);
+ * CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ */
+
+ PIN_JAVA_STRING(ENVONLY, obj, utf8, NULL, "H5Pset_fapl_multi: string not pinned");
+
+ str_len = HDstrlen(utf8);
+
+ if (NULL == (member_name[i] = (char *) HDmalloc(str_len + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: memory allocation failed");
+
+ HDstrncpy(member_name[i], utf8, str_len + 1);
+ (member_name[i])[str_len] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ utf8 = NULL;
+
+ ENVPTR->DeleteLocalRef(ENVONLY, obj);
+ }
+
+ mName = (const char * const *)member_name;
+ }
+
+ if ((status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray,
+ mName, (const haddr_t *)theaddrArray, (hbool_t)relax)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (memb_name && mName) {
+ if (NULL == (Sjc = ENVPTR->FindClass(ENVONLY, "java/lang/String")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (!member_name[i]) continue;
+
+ if (NULL == (rstring = ENVPTR->NewStringUTF(ENVONLY, member_name[i]))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pset_fapl_multi: out of memory - unable to construct string from UTF characters");
+ }
+
+ if (NULL == (o = ENVPTR->GetObjectArrayElement(ENVONLY, memb_name, (jsize) i))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /*
+ * If the string object was NULL, skip it.
+ */
+ ENVPTR->DeleteLocalRef(ENVONLY, rstring);
+ continue;
+ }
+
+ if (JNI_TRUE == (bb = ENVPTR->IsInstanceOf(ENVONLY, o, Sjc))) {
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)rstring);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ ENVPTR->DeleteLocalRef(ENVONLY, o);
+ ENVPTR->DeleteLocalRef(ENVONLY, rstring);
+
+ HDfree(member_name[i]);
+ member_name[i] = NULL;
+ }
+ }
+
+done:
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (member_name[i])
+ HDfree(member_name[i]);
+ }
+ if (utf8)
+ UNPIN_JAVA_STRING(ENVONLY, obj, utf8);
+ if (theaddrArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
+ if (thefaplArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
+ if (themapArray)
+ UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
+ (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
+ jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
+{
+ jboolean isCopy;
+ jstring str;
+ herr_t status = FAIL;
+ size_t i;
+ jlong *thefaplArray = NULL;
+ jlong *theaddrArray = NULL;
+ jint *themapArray = NULL;
+ char **mName = NULL;
+ int relax = 0;
+ int retVal = 0;
+
+ UNUSED(clss);
+
+ if (memb_map)
+ PIN_INT_ARRAY(ENVONLY, memb_map, themapArray, &isCopy, "H5Pget_fapl_multi: memb_map not pinned");
+ if (memb_fapl)
+ PIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, &isCopy, "H5Pget_fapl_multi: memb_fapl not pinned");
+ if (memb_addr)
+ PIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, &isCopy, "H5Pget_fapl_multi: memb_addr not pinned");
+ if (memb_name)
+ if (NULL == (mName = (char **) HDcalloc(H5FD_MEM_NTYPES, sizeof(*mName))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: memory allocation failed");
+
+ if ((status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t *)themapArray, (hid_t *)thefaplArray,
+ mName, (haddr_t *)theaddrArray, (hbool_t *)&relax)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (memb_name && mName) {
+ for (i = 0; i < H5FD_MEM_NTYPES; i++) {
+ if (mName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, mName[i]))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_fapl_multi: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, memb_name, (jsize) i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
+ }
+ }
+ }
+
+ retVal = (relax != 0);
+
+done:
+ h5str_array_free(mName, H5FD_MEM_NTYPES);
+ if (theaddrArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_addr, theaddrArray, (status < 0) ? JNI_ABORT : 0);
+ if (thefaplArray)
+ UNPIN_LONG_ARRAY(ENVONLY, memb_fapl, thefaplArray, (status < 0) ? JNI_ABORT : 0);
+ if (themapArray)
+ UNPIN_INT_ARRAY(ENVONLY, memb_map, themapArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jboolean)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi */
+
+/*
+ * TODO: H5Pset_multi_type
+ */
+
+/*
+ * TODO: H5Pget_multi_type
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_split
+ * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
+ (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
+{
+ const char *mstr = NULL;
+ const char *rstr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == metaext)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: metaext is NULL");
+ if (NULL == rawext)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_fapl_split: rawext is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, metaext, mstr, NULL, "H5Pset_fapl_split: metaext not pinned");
+ PIN_JAVA_STRING(ENVONLY, rawext, rstr, NULL, "H5Pset_fapl_split: rawext not pinned");
+
+ if ((retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (rstr)
+ UNPIN_JAVA_STRING(ENVONLY, rawext, rstr);
+ if (mstr)
+ UNPIN_JAVA_STRING(ENVONLY, metaext, mstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_sec2
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_sec2((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_stdio
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_fapl_stdio((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_windows
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+#ifdef H5_HAVE_WINDOWS
+ if ((retVal = H5Pset_fapl_windows((hid_t) fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+#else
+ UNUSED(env);
+ UNUSED(fapl_id);
+#endif
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */
+
+/*
+ * TODO: H5Pset_file_image
+ */
+
+/*
+ * TODO: H5Pget_file_image
+ */
+
+/*
+ * TODO: H5Pset_file_image_callbacks
+ */
+
+/*
+ * TODO: H5Pget_file_image_callbacks
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_meta_block_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_meta_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hsize_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_meta_block_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */
+
+/*
+ * TODO: H5Pset_page_buffer_size
+ */
+
+/*
+ * TODO: H5Pget_page_buffer_size
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sieve_buf_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ size_t sz = (size_t)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sieve_buf_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ size_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alignment
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alignment
+ (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
+{
+ long thr = (long)threshold;
+ long align = (long)alignment;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alignment
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alignment
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
+{
+ jboolean isCopy;
+ hsize_t t = 0;
+ hsize_t a = 0;
+ jsize arrLen;
+ jlong *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == alignment)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: input alignment is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, alignment)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_alignment: alignment input array < 2");
+
+ PIN_LONG_ARRAY(ENVONLY, alignment, theArray, &isCopy, "H5Pget_alignment: input array not pinned");
+
+ if ((status = H5Pget_alignment((hid_t)plist, &t, &a)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)t;
+ theArray[1] = (jlong)a;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, alignment, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_cache
+ * Signature: (JIJJD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1cache
+ (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
+ jlong rdcc_nbytes, jdouble rdcc_w0)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
+ (size_t)rdcc_nbytes, (double) rdcc_w0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_cache
+ * Signature: (J[I[J[J[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1cache
+ (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
+ jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+{
+ jboolean isCopy;
+ jdouble *w0Array = NULL;
+ jlong *rdcc_nelmtsArray = NULL;
+ jlong *nbytesArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+ UNUSED(mdc_nelmts);
+
+ if (NULL != rdcc_w0)
+ PIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, &isCopy, "H5Pget_cache: rdcc_w0 array not pinned");
+ if (NULL != rdcc_nelmts)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, &isCopy, "H5Pget_cache: rdcc_nelmts array not pinned");
+ if (NULL != rdcc_nbytes)
+ PIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, &isCopy, "H5Pget_cache: nbytesArray array not pinned");
+
+ {
+ /* direct cast (size_t *)variable fails on 32-bit environment */
+ long long rdcc_nelmts_temp = *rdcc_nelmtsArray;
+ long long nbytes_temp = *nbytesArray;
+ size_t rdcc_nelmts_t = (size_t) rdcc_nelmts_temp;
+ size_t nbytes_t = (size_t) nbytes_temp;
+
+ if ((status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
+ &nbytes_t, (double *)w0Array)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
+ *nbytesArray = (jlong)nbytes_t;
+ } /* end direct cast special */
+
+done:
+ if (nbytesArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nbytes, nbytesArray, (status < 0) ? JNI_ABORT : 0);
+ if (rdcc_nelmtsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, rdcc_nelmts, rdcc_nelmtsArray, (status < 0) ? JNI_ABORT : 0);
+ if (w0Array)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rdcc_w0, w0Array, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_file_cache_size
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
+ (JNIEnv *env, jclass clss, jlong plist, jint size)
+{
+ unsigned sz = (unsigned)size;
+
+ UNUSED(clss);
+
+ if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_file_cache_size
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ unsigned s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_evict_on_close
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
+{
+ hbool_t evict_on_close_val = FALSE;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ evict_on_close_val = (evict_on_close == JNI_TRUE) ? TRUE : FALSE;
+
+ if ((retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_evict_on_close
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ hbool_t evict_on_close_val = FALSE;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (evict_on_close_val == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_metadata_read_attempts
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
+ (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
+{
+ UNUSED(clss);
+
+ if (attempts <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_metadata_read_attempts: attempts <= 0");
+
+ if (H5Pset_metadata_read_attempts((hid_t)plist_id, (unsigned)attempts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_metadata_read_attempts
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
+ (JNIEnv *env, jclass clss, jlong plist_id)
+{
+ unsigned attempts = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_metadata_read_attempts((hid_t)plist_id, &attempts) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong) attempts;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_config
+ * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
+ (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
+{
+ H5AC_cache_config_t cacheinfo;
+ const char *str = NULL;
+ jfieldID fid;
+ jstring j_str;
+ jclass cls;
+ jint flash_incr_mode;
+ jint incr_mode;
+ jint decr_mode;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
+
+ if (NULL == (cls = ENVPTR->GetObjectClass(ENVONLY, cache_config)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "version", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.version = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "rpt_fcn_enabled", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "open_trace_file", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "close_trace_file", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "trace_file_name", "Ljava/lang/String;")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (j_str = (jstring)ENVPTR->GetObjectField(ENVONLY, cache_config, fid)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (j_str) {
+ PIN_JAVA_STRING(ENVONLY, j_str, str, NULL, "H5Pset_mdc_config: cache_config not pinned");
+
+ HDstrncpy(cacheinfo.trace_file_name, str, H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+ cacheinfo.trace_file_name[H5AC__MAX_TRACE_FILE_NAME_LEN] = '\0';
+
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+ str = NULL;
+ }
+ else
+ HDmemset(cacheinfo.trace_file_name, 0, H5AC__MAX_TRACE_FILE_NAME_LEN + 1);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "evictions_enabled", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "set_initial_size", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "initial_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_clean_fraction", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "min_size", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epoch_length", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "incr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_incr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.incr_mode = (enum H5C_cache_incr_mode) incr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "lower_hr_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "increment", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.increment = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_increment", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_increment", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_incr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ flash_incr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.flash_incr_mode = (enum H5C_cache_flash_incr_mode) flash_incr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_multiple", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "flash_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decr_mode", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ decr_mode = ENVPTR->GetIntField(ENVONLY, cache_config, fid); /*(enum H5C_cache_decr_mode) */
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ cacheinfo.decr_mode = (enum H5C_cache_decr_mode) decr_mode;
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "upper_hr_threshold", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "decrement", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.decrement = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_max_decrement", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "max_decrement", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "epochs_before_eviction", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "apply_empty_reserve", "Z")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "empty_reserve", "D")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "dirty_bytes_threshold", "J")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (fid = ENVPTR->GetFieldID(ENVONLY, cls, "metadata_write_strategy", "I")))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVONLY, cache_config, fid);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((status = H5Pset_mdc_config((hid_t)plist, &cacheinfo)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (str)
+ UNPIN_JAVA_STRING(ENVONLY, j_str, str);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_config
+ * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ H5AC_cache_config_t cacheinfo;
+ jstring j_str = NULL;
+ jvalue args[30];
+ herr_t status = FAIL;
+ jobject ret_obj = NULL;
+
+ UNUSED(clss);
+
+ HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
+ cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION;
+
+ if ((status = H5Pget_mdc_config((hid_t)plist, &cacheinfo)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ args[0].i = cacheinfo.version;
+ args[1].z = cacheinfo.rpt_fcn_enabled;
+ args[2].z = cacheinfo.open_trace_file;
+ args[3].z = cacheinfo.close_trace_file;
+
+ if (NULL != cacheinfo.trace_file_name) {
+ if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, cacheinfo.trace_file_name))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_config: out of memory - unable to construct string from UTF characters");
+ }
+ }
+
+ args[4].l = j_str;
+ args[5].z = cacheinfo.evictions_enabled;
+ args[6].z = cacheinfo.set_initial_size;
+ args[7].j = (jlong)cacheinfo.initial_size;
+ args[8].d = cacheinfo.min_clean_fraction;
+ args[9].j = (jlong)cacheinfo.max_size;
+ args[10].j = (jlong)cacheinfo.min_size;
+ args[11].j = cacheinfo.epoch_length;
+ args[12].i = cacheinfo.incr_mode;
+ args[13].d = cacheinfo.lower_hr_threshold;
+ args[14].d = cacheinfo.increment;
+ args[15].z = cacheinfo.apply_max_increment;
+ args[16].j = (jlong)cacheinfo.max_increment;
+ args[17].i = cacheinfo.flash_incr_mode;
+ args[18].d = cacheinfo.flash_multiple;
+ args[19].d = cacheinfo.flash_threshold;
+ args[20].i = cacheinfo.decr_mode;
+ args[21].d = cacheinfo.upper_hr_threshold;
+ args[22].d = cacheinfo.decrement;
+ args[23].z = cacheinfo.apply_max_decrement;
+ args[24].j = (jlong)cacheinfo.max_decrement;
+ args[25].i = cacheinfo.epochs_before_eviction;
+ args[26].z = cacheinfo.apply_empty_reserve;
+ args[27].d = cacheinfo.empty_reserve;
+ args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
+ args[29].i = cacheinfo.metadata_write_strategy;
+
+ CALL_CONSTRUCTOR(ENVONLY, "hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args, ret_obj);
+
+done:
+ return ret_obj;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */
+
+/*
+ * TODO: H5Pset_mdc_image_config
+ */
+
+/*
+ * TODO: H5Pget_mdc_image_config
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
+{
+ const char *locStr = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == location)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_mdc_log_options: location string is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, location, locStr, NULL, "H5Pset_mdc_log_options: location string not pinned");
+
+ if ((retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, locStr, (hbool_t)start_on_access)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (locStr)
+ UNPIN_JAVA_STRING(ENVONLY, location, locStr);
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+ (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
+{
+ jboolean isCopy;
+ jboolean *mdc_log_options_ptr = NULL;
+ hbool_t is_enabled;
+ hbool_t start_on_access;
+ ssize_t status = -1;
+ size_t location_size;
+ jsize arrLen;
+ char *lname = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == mdc_log_options)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, mdc_log_options)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: mdc_log_options array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: length of mdc_log_options < 2");
+
+ PIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, &isCopy, "H5Pget_mdc_log_options: mdc_log_options array not pinned");
+
+ /* get the length of the filename */
+ if (H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!location_size)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_mdc_log_options: location_size is 0");
+
+ location_size++; /* add extra space for the null terminator */
+ if (NULL == (lname = (char *) HDmalloc(sizeof(char) * location_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: memory allocation failed");
+
+ if ((status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ lname[location_size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, lname))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_mdc_log_options: out of memory - unable to construct string from UTF characters");
+ }
+
+ mdc_log_options_ptr[0] = (jboolean)is_enabled;
+ mdc_log_options_ptr[1] = (jboolean)start_on_access;
+
+done:
+ if (lname)
+ HDfree(lname);
+ if (mdc_log_options_ptr)
+ UNPIN_BOOL_ARRAY(ENVONLY, mdc_log_options, mdc_log_options_ptr, (status < 0) ? JNI_ABORT : 0);
+
+ return (jstring)str;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options */
+
+/*
+ * TODO: H5Pset_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pget_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pset_coll_metadata_write
+ */
+
+/*
+ * TODO: H5Pget_coll_metadata_write
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_gc_references
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
+ (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
+{
+ unsigned gc_ref_val = 0;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ gc_ref_val = (gc_ref == JNI_TRUE) ? 1 : 0;
+
+ if ((retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_gc_references
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
+ (JNIEnv *env, jclass clss, jlong fapl_id)
+{
+ unsigned gc_ref_val = 0;
+ jboolean bval = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (gc_ref_val == 1) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return bval;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_small_data_block_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long)size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_small_data_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
+ (JNIEnv *env, jclass clss, jlong plist)
+{
+ hsize_t s = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)s;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_libver_bounds
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_libver_bounds
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
+ (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == libver)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_libver_bounds: libversion bounds is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, libver, theArray, &isCopy, "H5Pget_libver_bounds: input not pinned");
+
+ if ((retVal = H5Pget_libver_bounds((hid_t)fapl_id, (H5F_libver_t *)&(theArray[0]), (H5F_libver_t *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, libver, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */
+
+/*
+ * TODO: H5Pset_object_flush_cb
+ */
+
+/*
+ * TODO: H5Pget_object_flush_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pFAPLImp.h b/java/src/jni/h5pFAPLImp.h
new file mode 100644
index 0000000..28b1d95
--- /dev/null
+++ b/java/src/jni/h5pFAPLImp.h
@@ -0,0 +1,501 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PFAPL
+#define _Included_hdf_hdf5lib_H5_H5PFAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * TODO: H5Pset_driver
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_driver
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1driver
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pget_driver_info
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fclose_degree
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fclose_degree
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_core
+ * Signature: (JJZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
+(JNIEnv *, jclass, jlong, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_core
+ * Signature: (J[J[Z)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
+(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray);
+
+/*
+ * TODO: H5Pset_core_write_tracking
+ */
+
+/*
+ * TODO: H5Pget_core_write_tracking
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_direct
+ * Signature: (JJJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
+(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_direct
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_family
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
+(JNIEnv *, jclass, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_family
+ * Signature: (J[J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
+(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_family_offset
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_family_offset
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_log
+ * Signature: (JLjava/lang/String;JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
+(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+
+/*
+ * TODO: H5Pset_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpio
+ */
+
+/*
+ * TODO: H5Pset_fapl_mpiposix
+ */
+
+/*
+ * TODO: H5Pget_fapl_mpiposix
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_fapl_multi
+ * Signature: (J[I[J[Ljava/lang/String;[J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray);
+
+/*
+ * TODO: H5Pset_multi_type
+ */
+
+/*
+ * TODO: H5Pget_multi_type
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_split
+ * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
+(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_sec2
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_stdio
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_fapl_windows
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_file_image
+ */
+
+/*
+ * TODO: H5Pget_file_image
+ */
+
+/*
+ * TODO: H5Pset_file_image_callbacks
+ */
+
+/*
+ * TODO: H5Pget_file_image_callbacks
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_meta_block_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_meta_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_page_buffer_size
+ */
+
+/*
+ * TODO: H5Pget_page_buffer_size
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sieve_buf_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sieve_buf_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_alignment
+ * Signature: (JJJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1alignment
+(JNIEnv *, jclass, jlong, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_alignment
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1alignment
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_cache
+ * Signature: (JIJJD)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1cache
+(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_cache
+ * Signature: (J[I[J[J[D)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1cache
+(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_file_cache_size
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_file_cache_size
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_evict_on_close
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_evict_on_close
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_metadata_read_attempts
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_metadata_read_attempts
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_config
+ * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
+(JNIEnv *, jclass, jlong, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_config
+ * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
+ */
+JNIEXPORT jobject JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_mdc_image_config
+ */
+
+/*
+ * TODO: H5Pget_mdc_image_config
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_mdc_log_options
+ * Signature: (JZLjava/lang/String;Z)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_mdc_log_options
+ * Signature: (J[Z)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
+(JNIEnv *, jclass, jlong, jbooleanArray);
+
+/*
+ * TODO: H5Pset_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pget_all_coll_metadata_ops
+ */
+
+/*
+ * TODO: H5Pset_coll_metadata_write
+ */
+
+/*
+ * TODO: H5Pget_coll_metadata_write
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_gc_references
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_gc_references
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_small_data_block_size
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_small_data_block_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_libver_bounds
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_libver_bounds
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * TODO: H5Pset_object_flush_cb
+ */
+
+/*
+ * TODO: H5Pget_object_flush_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PFAPL */
diff --git a/java/src/jni/h5pFCPLImp.c b/java/src/jni/h5pFCPLImp.c
new file mode 100644
index 0000000..34ac065
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.c
@@ -0,0 +1,611 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pFCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_version
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1version
+ (JNIEnv *env, jclass clss, jlong plist, jintArray version_info)
+{
+ jboolean isCopy;
+ jsize arrLen;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == version_info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_version: version_info input array is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, version_info)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_version: version_info array length < 0");
+ }
+ if (arrLen < 4)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_version: version_info input array length < 4");
+
+ PIN_INT_ARRAY(ENVONLY, version_info, theArray, &isCopy, "H5Pget_version: version_info not pinned");
+
+ if ((status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]),
+ (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, version_info, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_userblock
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1userblock
+ (JNIEnv *env, jclass clss, jlong plist, jlong size)
+{
+ long sz = (long) size;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_userblock
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1userblock
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+{
+ jboolean isCopy;
+ hsize_t s;
+ jlong *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_userblock: size is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_userblock: size not pinned");
+
+ if ((status = H5Pget_userblock((hid_t)plist, &s)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)s;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sizes
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sizes
+ (JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sizes
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sizes
+ (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
+{
+ jboolean isCopy;
+ jlong *theArray = NULL;
+ jsize arrLen;
+ size_t ss;
+ size_t sa;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sizes: size input array < 2 elements");
+
+ PIN_LONG_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_sizes: size not pinned");
+
+ if ((status = H5Pget_sizes((hid_t)plist, &sa, &ss)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ theArray[0] = (jlong)sa;
+ theArray[1] = (jlong)ss;
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sym_k
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
+ (JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sym_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
+ (JNIEnv *env, jclass clss, jlong plist, jintArray size)
+{
+ jboolean isCopy;
+ jsize arrLen;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, size)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size array length < 0");
+ }
+ if (arrLen < 2)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_sym_k: size < 2 elements");
+
+ PIN_INT_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_sym_k: size not pinned");
+
+ if ((status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_LONG_ARRAY(ENVONLY, size, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_istore_k
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
+ (JNIEnv *env, jclass clss, jlong plist, jint ik)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_istore_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
+ (JNIEnv *env, jclass clss, jlong plist, jintArray ik)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ik)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_store_k: ik is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, ik, theArray, &isCopy, "H5Pget_store_k: size not pinned");
+
+ if ((status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, ik, theArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)status;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_page_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
+{
+ UNUSED(clss);
+
+ if (H5Pset_file_space_page_size((hid_t)fcpl_id, (hsize_t)fsp_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_page_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hsize_t fsp_size = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_file_space_page_size((hid_t)fcpl_id, &fsp_size) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)fsp_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_strategy
+ * Signature: (JIZJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
+{
+ UNUSED(clss);
+
+ if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_file_space_strategy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy
+ * Signature: (J[Z[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
+{
+ H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
+ jboolean isCopy;
+ jboolean *persistArray = NULL;
+ jlong *thresholdArray = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (persist)
+ PIN_BOOL_ARRAY(ENVONLY, persist, persistArray, &isCopy, "H5Pget_file_space: persist not pinned");
+ if (threshold)
+ PIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, &isCopy, "H5Pget_file_space: threshold not pinned");
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t *)persistArray, (hsize_t *)thresholdArray)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (thresholdArray)
+ UNPIN_LONG_ARRAY(ENVONLY, threshold, thresholdArray, (status < 0) ? JNI_ABORT : 0);
+ if (persistArray)
+ UNPIN_BOOL_ARRAY(ENVONLY, persist, persistArray, (status < 0) ? JNI_ABORT : 0);
+
+ return (jint)thestrategy;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_persist
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hbool_t persist = FALSE;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, &persist, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jboolean)persist;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_threshold
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ hsize_t threshold = 0;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if ((status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &threshold)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)threshold;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1threshold */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_nindexes
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
+ (JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (nindexes > H5O_SHMESG_MAX_NINDEXES)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
+
+ if ((retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_nindexes
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
+ (JNIEnv *env, jclass clss, jlong fcpl_id)
+{
+ unsigned nindexes;
+
+ UNUSED(clss);
+
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)nindexes;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_index
+ * Signature: (JIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
+ jint mesg_type_flags, jint min_mesg_size)
+{
+ unsigned nindexes; /* Number of SOHM indexes */
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Check arguments */
+ if ((unsigned) mesg_type_flags > H5O_SHMESG_ALL_FLAG)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags");
+
+ /* Read the current number of indexes */
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Range check */
+ if ((unsigned) index_num >= nindexes)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_index: index_num is too large; no such index");
+
+ if ((retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_index
+ * Signature: (JI[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info)
+{
+ jboolean isCopy;
+ unsigned nindexes; /* Number of SOHM indexes */
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == mesg_info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_index: mesg_info is NULL");
+
+ /* Read the current number of indexes */
+ if (H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Range check */
+ if ((unsigned) index_num >= nindexes)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_index: index_num is too large; no such index");
+
+ PIN_INT_ARRAY(ENVONLY, mesg_info, theArray, &isCopy, "H5Pget_shared_mesg_index: input not pinned");
+
+ if ((retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, mesg_info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Check that values are sensible. The min_btree value must be no greater
+ * than the max list plus one.
+ *
+ * Range check to make certain they will fit into encoded form.
+ */
+
+ if (max_list + 1 < min_btree)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
+ if (max_list > H5O_SHMESG_MAX_LIST_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+ if (min_btree > H5O_SHMESG_MAX_LIST_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
+
+ if ((retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
+ (JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == size)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_shared_mesg_phase_change: size is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, size, theArray, &isCopy, "H5Pget_shared_mesg_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, size, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pFCPLImp.h b/java/src/jni/h5pFCPLImp.h
new file mode 100644
index 0000000..89ea143
--- /dev/null
+++ b/java/src/jni/h5pFCPLImp.h
@@ -0,0 +1,216 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PFCPL
+#define _Included_hdf_hdf5lib_H5_H5PFCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_version
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1version
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_userblock
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1userblock
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_userblock
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1userblock
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sizes
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sizes
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sizes
+ * Signature: (J[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sizes
+(JNIEnv *, jclass, jlong, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_sym_k
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_sym_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_istore_k
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_istore_k
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_page_size
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_page_size
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_file_space_strategy
+ * Signature: (JIZJ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
+(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy
+ * Signature: (J[Z[J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
+(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_persist
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_file_space_strategy_threshold
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_nindexes
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_nindexes
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_index
+ * Signature: (JIII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
+(JNIEnv *, jclass, jlong, jint, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_index
+ * Signature: (JI[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
+(JNIEnv *, jclass, jlong, jint, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_shared_mesg_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_shared_mesg_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PFCPL */
diff --git a/src/H5Bpublic.h b/java/src/jni/h5pGAPLImp.c
index 1764f61..9540387 100644
--- a/src/H5Bpublic.h
+++ b/java/src/jni/h5pGAPLImp.c
@@ -11,29 +11,26 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
*
- * Created: H5Bproto.h
- * Jul 10 1997
- * Robb Matzke <matzke@llnl.gov>
- *
- * Purpose: Public declarations for the H5B package.
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
*/
-#ifndef _H5Bpublic_H
-#define _H5Bpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pGAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
#ifdef __cplusplus
-}
-#endif
-#endif
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pGAPLImp.h b/java/src/jni/h5pGAPLImp.h
new file mode 100644
index 0000000..73ad4a8
--- /dev/null
+++ b/java/src/jni/h5pGAPLImp.h
@@ -0,0 +1,27 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PGAPL
+#define _Included_hdf_hdf5lib_H5_H5PGAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PGAPL */
diff --git a/java/src/jni/h5pGCPLImp.c b/java/src/jni/h5pGCPLImp.c
new file mode 100644
index 0000000..2ba1c7d
--- /dev/null
+++ b/java/src/jni/h5pGCPLImp.c
@@ -0,0 +1,227 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pGCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_local_heap_size_hint
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_local_heap_size_hint
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
+ (JNIEnv *env, jclass clss, jlong gcpl_id)
+{
+ size_t size_hint = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)size_hint;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
+ (JNIEnv *env, jclass clss, jlong gcpl_id)
+{
+ unsigned crt_order_flags;
+
+ UNUSED(clss);
+
+ if (H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)crt_order_flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_est_link_info
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ /* Range check values */
+ if ((est_num_entries > 65535) || (est_name_len > 65535))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
+
+ if ((retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_est_link_info
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == link_info)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_est_link_info: link_info is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, link_info, theArray, &isCopy, "H5Pget_est_link_info: input not pinned");
+
+ if ((retVal = H5Pget_est_link_info((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, link_info, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (max_compact < min_dense)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be >= min dense value");
+ if (max_compact > 65535)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: max compact value must be < 65536");
+ if (min_dense > 65535)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_link_phase_change: min dense value must be < 65536");
+
+ if ((retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
+ (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == links)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_link_phase_change: links is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, links, theArray, &isCopy, "H5Pget_link_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_link_phase_change((hid_t)gcpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, links, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pGCPLImp.h b/java/src/jni/h5pGCPLImp.h
new file mode 100644
index 0000000..9c32063
--- /dev/null
+++ b/java/src/jni/h5pGCPLImp.h
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PGCPL
+#define _Included_hdf_hdf5lib_H5_H5PGCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_local_heap_size_hint
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_local_heap_size_hint
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_est_link_info
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_est_link_info
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_link_phase_change
+ * Signature: (JII)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_link_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PGCPL */
diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c
index 52008ce..726e08c 100644
--- a/java/src/jni/h5pImp.c
+++ b/java/src/jni/h5pImp.c
@@ -26,7 +26,11 @@ extern "C" {
#include "h5util.h"
#include "h5pImp.h"
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
extern JavaVM *jvm;
+
extern jobject copy_callback;
extern jobject close_callback;
extern jobject create_callback;
@@ -44,17 +48,16 @@ typedef struct _cb_wrapper {
/* Local Prototypes */
/********************/
-static herr_t H5P_cls_create_func_cb(hid_t prop_id, void *create_data);
-static herr_t H5P_cls_copy_func_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
-static herr_t H5P_cls_close_func_cb(hid_t prop_id, void *close_data);
-
-static herr_t H5P_prp_create_func_cb(const char *name, size_t size, void *value);
-static herr_t H5P_prp_copy_func_cb(const char *name, size_t size, void *value);
-static herr_t H5P_prp_close_func_cb(const char *name, size_t size, void *value);
-static int H5P_prp_compare_func_cb(void *value1, void *value2, size_t size);
-static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
-static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P_cls_create_cb(hid_t prop_id, void *create_data);
+static herr_t H5P_cls_copy_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
+static herr_t H5P_cls_close_cb(hid_t prop_id, void *close_data);
+static herr_t H5P_prp_create_cb(const char *name, size_t size, void *value);
+static herr_t H5P_prp_copy_cb(const char *name, size_t size, void *value);
+static herr_t H5P_prp_close_cb(const char *name, size_t size, void *value);
+static int H5P_prp_compare_cb(void *value1, void *value2, size_t size);
+static herr_t H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value);
+static herr_t H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value);
static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *cb_data);
@@ -67,37 +70,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Pcreate
(JNIEnv *env, jclass clss, jlong type)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Pcreate((hid_t)type);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Pcreate((hid_t) type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Pcreate */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pclose
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = 0;
-
- if (plist > 0)
- retVal = H5Pclose((hid_t)plist);
-
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pclose */
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: H5Pget_class
* Signature: (J)J
*/
@@ -105,12 +90,19 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Pget_class((hid_t) plist);
- if (retVal == H5P_ROOT)
- h5libraryError(env);
+ if ((retVal = H5Pget_class((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ /*
+ * if (retVal == H5P_ROOT)
+ * H5_LIBRARY_ERROR(ENVONLY);
+ */
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class */
@@ -123,2066 +115,264 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Pcopy
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Pcopy((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pcopy((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Pcopy */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_version
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1version
- (JNIEnv *env, jclass clss, jlong plist, jintArray version_info)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (version_info == NULL) {
- h5nullArgument(env, "H5Pget_version: version_info input array is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) {
- h5badArgument(env, "H5Pget_version: version_info input array < 4");
- } /* end else if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_version: version_info not pinned");
- } /* end if */
- else {
- status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]),
- (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_userblock
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- herr_t retVal = -1;
- long sz = (long)size;
-
- retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_userblock
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t s;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_userblock: size is NULL");
- } /* end if */
- else {
- theArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_userblock: size not pinned");
- } /* end if */
- else {
- status = H5Pget_userblock((hid_t)plist, &s);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)s;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sizes
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sizes
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
- (JNIEnv *env, jclass clss, jlong plist, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- size_t ss;
- size_t sa;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_sizes: size is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) {
- h5badArgument(env, "H5Pget_sizes: size input array < 2 elements");
- }
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_sizes: size not pinned");
- } /* end if */
- else {
- status = H5Pget_sizes((hid_t)plist, &sa, &ss);
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)sa;
- theArray[1] = (jlong)ss;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sym_k
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sym_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray size)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_sym_k: size is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) {
- h5badArgument(env, "H5Pget_sym_k: size < 2 elements");
- } /* end else if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_sym_k: size not pinned");
- } /* end if */
- else {
- status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_istore_k
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jint ik)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_istore_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
- (JNIEnv *env, jclass clss, jlong plist, jintArray ik)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (ik == NULL) {
- h5nullArgument(env, "H5Pget_store_k: ik is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ik, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_store_k: size not pinned");
- } /* end if */
- else {
- status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0]));
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_layout
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
- (JNIEnv *env, jclass clss, jlong plist, jint layout)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_layout
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5D_layout_t retVal = H5D_LAYOUT_ERROR;
-
- retVal = H5Pget_layout((hid_t)plist);
- if (retVal == H5D_LAYOUT_ERROR)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk
- * Signature: (JI[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim)
-{
- herr_t status = -1;
- jbyte *theArray;
- jboolean isCopy;
- hsize_t *da;
- hsize_t *lp;
- jlong *jlp;
- size_t i;
- size_t rank;
-
- if (dim == NULL) {
- h5nullArgument(env, "H5Pset_chunk: dim array is NULL");
- } /* end if */
- else {
- i = (size_t)ENVPTR->GetArrayLength(ENVPAR dim);
- rank = i / sizeof(jlong);
- if (rank < ndims) {
- h5badArgument(env, "H5Pset_chunk: dims array < ndims");
- } /* end if */
- else {
- theArray = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR dim, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pset_chunk: dim array not pinned");
- } /* end if */
- else {
- da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
- if (da == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pset_chunk: dims not converted to hsize_t");
- } /* end if */
- else {
- jlp = (jlong *)theArray;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t)*jlp;
- lp++;
- jlp++;
- } /* end if */
-
- status = H5Pset_chunk((hid_t)plist, (int)ndims, da);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT);
- HDfree(da);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk
- * Signature: (JI[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
- (JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t *da;
- int i;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Pget_chunk: dims is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR dims) < max_ndims) {
- h5badArgument(env, "H5Pget_chunk: dims array < max_ndims");
- } /* end else if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_chunk: input dims not pinned");
- } /* end if */
- else {
- da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t));
- if (da == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_chunk: dims not converted to hsize_t");
- } /* end if */
- else {
- status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT);
- HDfree (da);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < max_ndims; i++) {
- theArray[i] = (jlong)da[i];
- }
- HDfree (da);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alignment
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment)
-{
- herr_t retVal = -1;
- long thr = (long)threshold;
- long align = (long)alignment;
-
- retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alignment
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
- (JNIEnv *env, jclass clss, jlong plist, jlongArray alignment)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- hsize_t t;
- hsize_t a;
-
- if (alignment == NULL) {
- h5nullArgument(env, "H5Pget_alignment: input alignment is NULL");
- } /* end if */
- else {
- if (ENVPTR->GetArrayLength(ENVPAR alignment) < 2) {
- h5badArgument(env, "H5Pget_alignment: alignment input array < 2");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR alignment, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_alignment: input array not pinned");
- } /* end if */
- else {
- status = H5Pget_alignment((hid_t)plist, &t, &a);
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)t;
- theArray[1] = (jlong)a;
- ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_external
- * Signature: (JLjava/lang/String;JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
- (JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size)
-{
- herr_t status = -1;
- const char *fileName;
- off_t off;
- hsize_t sz;
- hid_t plid;
-
- plid = (hid_t)plist;
- off = (off_t)offset;
- sz = (hsize_t)size;
-
- PIN_JAVA_STRING(name, fileName);
- if (fileName != NULL) {
- status = H5Pset_external(plid, fileName, off, sz);
-
- UNPIN_JAVA_STRING(name, fileName);
-
- if (status < 0)
- h5libraryError(env);
- }
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external_count
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
- (JNIEnv *env, jclass clss, jlong plist)
-{
- int retVal = -1;
-
- retVal = H5Pget_external_count((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external
- * Signature: (JIJ[Ljava/lang/String;[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
- (JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size,
- jobjectArray name, jlongArray size)
-{
- herr_t status = -1;
- jlong *theArray;
- jboolean isCopy;
- char *file = NULL;
- jstring str;
- off_t o;
- hsize_t s;
-
- if (name_size < 0) {
- h5badArgument(env, "H5Pget_external: name_size < 0");
- } /* end if */
- else if ((size != NULL) && (ENVPTR->GetArrayLength(ENVPAR size) < 2)) {
- h5badArgument(env, "H5Pget_external: size input array < 2");
- } /* end else if */
- else {
- if (name_size > 0) {
- file = (char *)HDmalloc(sizeof(char)*(size_t)name_size);
- } /* end else */
-
- status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size,
- file, (off_t *)&o, (hsize_t *)&s);
- if (status < 0) {
- HDfree(file);
- h5libraryError(env);
- } /* end if */
- else {
- if (size != NULL) {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5Pget_external: size array not pinned");
- } /* end if */
- else {
- theArray[0] = o;
- theArray[1] = (jlong)s;
- ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0);
- }
- } /* end if */
-
- if (file != NULL) {
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR file);
- if (str == NULL) {
- HDfree(file);
- h5JNIFatalError(env, "H5Pget_external: return array not created");
- } /* end if */
- else {
- /* SetObjectArrayElement may raise exceptions */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- HDfree(file);
- } /* end else */
- } /* end if */
- } /* end else */
- }
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
-{
- jint status = -1;
- jbyte *byteP = NULL;
- jboolean isCopy;
-
- if (value != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned");
- } /* end if */
- else {
- status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- }
- } /* end if */
- else {
- status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
- }
-
- if (status < 0)
- h5libraryError(env);
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
- (JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value)
-{
- jint status = -1;
- jbyte *byteP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5badArgument(env, "H5Pget_fill_value: value is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned");
- } /* end if */
- else {
- status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags,
- jlong cd_nelmts, jintArray cd_values)
-{
- herr_t status = -1;
- jint *theArray;
- jboolean isCopy;
-
- if (cd_values == NULL) {
- status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, NULL);
- if (status < 0)
- h5libraryError(env);
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pset_filter: input array not pinned");
- }/* end if */
- else {
- status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, theArray, JNI_ABORT);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nfilters
+ * Method: H5Pclose
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
- (JNIEnv *env, jclass clss, jlong plist)
-{
- int retVal = -1;
-
- retVal = H5Pget_nfilters((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags,
- jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
-{
- herr_t status = -1;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jint *cd_valuesArray;
- jint mode = JNI_ABORT;
- jboolean isCopy;
- jstring str;
- char *filter;
-
- if (namelen <= 0) {
- h5badArgument(env, "H5Pget_filter: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5badArgument(env, "H5Pget_filter: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_values is NULL");
- } /* end else if */
- else {
- filter = (char *)HDmalloc(sizeof(char)*(size_t)namelen);
- if (filter == NULL) {
- h5outOfMemory(env, "H5Pget_filter: namelen malloc failed");
- } /* end if */
- else {
- flagsArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: flags array not pinned");
- } /* end if */
- else {
- cd_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned");
- } /* end if */
- else {
- cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned");
- } /* end if */
- else {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- unsigned int filter_config;
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, &filter_config);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- /* end direct cast special */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mode = 0;
-
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR filter);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_filter: return string not pinned");
- } /* end if */
- else {
- /* SetObjectArrayElement may throw exceptiosn */
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, mode);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, mode);
- }
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, mode);
- }
- HDfree(filter);
- }
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_driver
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
+Java_hdf_hdf5lib_H5__1H5Pclose
(JNIEnv *env, jclass clss, jlong plist)
{
- hid_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Pget_driver((hid_t) plist);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jlong)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_cache
- * Signature: (JIJJD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
- (JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts,
- jlong rdcc_nbytes, jdouble rdcc_w0)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts,
- (size_t)rdcc_nbytes, (double) rdcc_w0);
- if (retVal < 0)
- h5libraryError(env);
+ if (plist >= 0)
+ if ((retVal = H5Pclose((hid_t) plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_cache
- * Signature: (J[I[J[J[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
- (JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts,
- jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
-{
- herr_t status = -1;
- jint mode;
- jdouble *w0Array = (jdouble *)NULL;
- jlong *rdcc_nelmtsArray = (jlong *)NULL;
- jlong *nbytesArray = (jlong *)NULL;
- jboolean isCopy;
-
- if (rdcc_w0 != NULL) {
- w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy);
- if (w0Array == NULL) {
- h5JNIFatalError(env, "H5Pget_cache: w0_array array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- if (rdcc_nelmts != NULL) {
- rdcc_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nelmts, &isCopy);
- if (rdcc_nelmtsArray == NULL) {
- /* exception -- out of memory */
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- }
- h5JNIFatalError(env, "H5Pget_cache: rdcc_nelmts array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- if (rdcc_nbytes != NULL) {
- nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
- if (nbytesArray == NULL) {
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- if (rdcc_nelmtsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_cache: nbytesArray array not pinned");
- return -1;
- } /* end if */
- } /* end else */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long rdcc_nelmts_temp = *(rdcc_nelmtsArray);
- size_t rdcc_nelmts_t = (size_t)rdcc_nelmts_temp;
- long long nbytes_temp = *(nbytesArray);
- size_t nbytes_t = (size_t)nbytes_temp;
-
- status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t,
- &nbytes_t, (double *)w0Array);
-
- *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t;
- *nbytesArray = (jlong)nbytes_t;
- } /* end direct cast special */
-
-
- if (status < 0) {
- mode = JNI_ABORT;
- } /* end if */
- else {
- mode = 0; /* commit and free */
- } /* end else */
-
- if (rdcc_nelmtsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, mode);
- } /* end if */
-
- if (nbytesArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode);
- } /* end if */
-
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode);
- } /* end if */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer
- * Signature: (JJ[B[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg)
-{
- h5unimplemented(env, "H5Pset_buffer: not implemented");
- return -1;
-#ifdef notdef
-
-/* DON'T IMPLEMENT THIS!!! */
- jint status = -1;
- jbyte *tconvP;
- jbyte *bkgP;
- jboolean isCopy;
-
- if (tconv == NULL)
- tconvP = (jbyte *)NULL;
- else {
- tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy);
- if (tconvP == NULL) {
- h5JNIFatalError(env, "H5Pset_buffer: tconv not pinned");
- return -1;
- }
- }
- if (bkg == NULL)
- bkgP = (jbyte *)NULL;
- else {
- bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy);
- if (bkgP == NULL) {
- h5JNIFatalError(env, "H5Pset_buffer: bkg not pinned");
- return -1;
- }
- }
-
- status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP);
- if (status < 0) {
- if (tconv != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT);
- if (bkg != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT);
- h5libraryError(env);
- return -1;
- }
-
- if (tconv != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0);
- if (bkg != NULL)
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
-
- return (jint)status;
-#endif
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */
+} /* end Java_hdf_hdf5lib_H5__1H5Pclose */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer
- * Signature: (J[B[B)I
+ * TODO: H5Pencode
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
- (JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg)
-{
- h5unimplemented(env, "H5Pget_buffer: not implemented");
- return -1;
-#ifdef notdef
-
-/* DON'T IMPLEMENT THIS!!! */
- jlong status = -1;
- jbyte *tconvP;
- jbyte *bkgP;
- jboolean isCopy;
-
- if (tconv == NULL) {
- h5nullArgument(env, "H5Pget_buffer: tconv input array is NULL");
- return -1;
- }
- tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy);
- if (tconvP == NULL) {
- h5JNIFatalError(env, "H5Pget_buffer: tconv not pinned");
- return -1;
- }
- if (bkg == NULL) {
- h5nullArgument(env, "H5Pget_buffer: bkg array is NULL");
- return -1;
- }
- bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy);
- if (bkgP == NULL) {
- h5JNIFatalError(env, "H5Pget_buffer: bkg not pinned");
- return -1;
- }
-
- status = H5Pget_buffer((hid_t)plist, tconvP, bkgP);
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT);
- h5libraryError(env);
- return -1;
- }
- ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0);
-
- return (jint)status;
-#endif
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer_size
- * Signature: (JJ)V
+ * TODO: H5Pdecode
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- size_t size = 0;
-
- size = H5Pget_buffer((hid_t)plist, NULL, NULL);
- if (size == 0)
- h5libraryError(env);
-
- return (jlong)size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_preserve
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
- (JNIEnv *env, jclass clss, jlong plist, jboolean status)
-{
- hbool_t st;
- herr_t retVal = -1;
-
- if (status == JNI_TRUE) {
- st = TRUE;
- } /* end if */
- else if (status == JNI_FALSE) {
- st = false;
- } /* end else if */
- else {
- h5badArgument(env, "H5Pset_preserve: status not TRUE or FALSE");
- return -1;
- } /* end else */
-
- retVal = H5Pset_preserve((hid_t)plist, st);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_preserve
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pget_preserve((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_deflate
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
- (JNIEnv *env, jclass clss, jlong plist, jint level)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_deflate((hid_t)plist, (unsigned)level);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_gc_references
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref)
-{
- herr_t retVal = -1;
- unsigned gc_ref_val;
-
- if (gc_ref == JNI_TRUE)
- gc_ref_val = 1;
- else
- gc_ref_val = 0;
-
- retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_gc_references
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- unsigned gc_ref_val = 0;
- jboolean bval = JNI_FALSE;
-
- if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- if (gc_ref_val == 1)
- bval = JNI_TRUE;
- } /* end else */
-
- return bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_btree_ratios
- * Signature: (JDDD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class
+ (JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op,
+ jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data)
{
- herr_t status = -1;
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right);
- if (status < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */
+ create_callback = create_op;
+ close_callback = close_op;
+ copy_callback = copy_op;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_btree_ratios
- * Signature: (J[D[D[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
- (JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left,
- jdoubleArray middle, jdoubleArray right)
-{
- herr_t status = -1;
- jdouble *leftP;
- jdouble *middleP;
- jdouble *rightP;
- jboolean isCopy;
-
- if (left == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: left input array is NULL");
- } /* end if */
- else if (middle == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: middle input array is NULL");
- } /* end else if */
- else if (right == NULL) {
- h5nullArgument(env, "H5Pget_btree_ratios: right input array is NULL");
- } /* end else if */
- else {
- leftP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR left, &isCopy);
- if (leftP == NULL) {
- h5JNIFatalError(env, "H5Pget_btree_ratios: left not pinned");
- } /* end if */
- else {
- middleP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR middle, &isCopy);
- if (middleP == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned");
- } /* end if */
- else {
- rightP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR right, &isCopy);
- if (rightP == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned");
- } /* end if */
- else {
- status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP,
- (double *)middleP, (double *)rightP);
- if (status < 0) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class: class name is NULL");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class: class name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_small_data_block_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- long sz = (long)size;
- herr_t retVal = -1;
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void *) create_data,
+ (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void *) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void *) close_data)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz);
- if (retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */
+ return (jlong)class_id;
+} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_small_data_block_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class_nocb
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- hsize_t s;
-
- if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alloc_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jint alloc_time)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alloc_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_alloc_time_t time;
-
- if (alloc_time == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_alloc_time: alloc_time is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR alloc_time, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_alloc_time: alloc_time not pinned");
- } /* end if */
- else {
- retVal = H5Pget_alloc_time((hid_t)plist, &time);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = time;
- ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jint fill_time)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
- (JNIEnv *env, jclass clss, jlong plist, jintArray fill_time)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_fill_time_t time;
-
- if (fill_time == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_fill_time: fill_time is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR fill_time, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fill_time: fill_time not pinned");
- } /* end if */
- else {
- retVal = H5Pget_fill_time((hid_t)plist, &time);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jint)time;
- ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pfill_value_defined
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
- (JNIEnv *env, jclass clss, jlong plist, jintArray status)
-{
- herr_t retVal = -1;
- jint *theArray;
- jboolean isCopy;
- H5D_fill_value_t value;
-
- if (status == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pfill_value_defined: status is NULL");
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR status, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pfill_value_defined: status not pinned");
- } /* end if */
- else {
- retVal = H5Pfill_value_defined((hid_t)plist, &value);
- if (retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = value;
- ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fletcher32
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_fletcher32((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_edc_check
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist, jint check)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_edc_check
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5Z_EDC_t retVal = -1;
-
- retVal = H5Pget_edc_check((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shuffle
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
- (JNIEnv *env, jclass clss, jlong plist)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_shuffle((hid_t)plist);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_szip
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
- (JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_hyper_vector_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong vector_size)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_hyper_vector_size
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
- (JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size)
-{
- herr_t retVal = -1;
- jlong *theArray;
- size_t size;
- jboolean isCopy;
-
- if (vector_size == NULL) {
- /* exception ? */
- h5nullArgument(env, "H5Pget_hyper_vector_size: vector_size is NULL");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR vector_size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_hyper_vector_size: vector_size not pinned");
- } /* end if */
- else {
- retVal = H5Pget_hyper_vector_size((hid_t)plist, &size);
- if (retVal < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pall_filters_avail
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
- (JNIEnv *env, jclass clss, jlong dcpl_id)
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
+ (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
{
- htri_t bval = JNI_FALSE;
+ const char *cstr = NULL;
+ hid_t class_id = H5I_INVALID_HID;
- bval = H5Pall_filters_avail((hid_t)dcpl_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jboolean)bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "_H5Pcreate_class_nocb: class name is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pmodify_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jint flags, jlong cd_nelmts, jintArray cd_values)
-{
- herr_t status = -1;
- jint *cd_valuesP;
- jboolean isCopy;
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "_H5Pcreate_class_nocb: class name not pinned");
- if (cd_values == NULL) {
- h5nullArgument(env, "H5Pmodify_filter: cd_values is NULL");
- } /* end if */
- else {
- cd_valuesP = ENVPTR->GetIntArrayElements(ENVPAR cd_values,&isCopy);
- if (cd_valuesP == NULL) {
- h5JNIFatalError(env, "H5Pmodify_filter: cd_values not pinned");
- } /* end if */
- else {
- status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter,(const unsigned int)flags,
- (size_t)cd_nelmts, (unsigned int *)cd_valuesP);
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesP, JNI_ABORT);
+ if ((class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name)
-{
- jboolean isCopy;
- herr_t status = -1;
- jint *cd_valuesArray;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jstring str;
- char *aName;
- int i = 0;
- int rank;
- long bs;
-
- bs = (long)namelen;
- if (bs <= 0) {
- h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL");
- } /* end else if */
- else if (name == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: name is NULL");
- } /* end else if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed");
- return -1;
- } /* end if */
-
- flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
-
- cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned");
- return -1;
- } /* end if */
-
- cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- rank = ENVPTR->GetArrayLength(ENVPAR cd_values);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int.");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
- unsigned int filter_config;
-
- status = H5Pget_filter_by_id2( (hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, &filter_config);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special */
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
-
- HDfree(aName);
- } /* end else */
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */
+ return (jlong)class_id;
+} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fclose_degree
- * Signature: (JI)I
+ * Method: H5Pregister2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist, jint fc_degree)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete,
+ jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */
+ copy_callback = prp_copy;
+ close_callback = prp_close;
+ create_callback = prp_create;
+ compare_callback = prp_cmp;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fclose_degree
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5F_close_degree_t degree;
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2: property name is NULL");
- if (H5Pget_fclose_degree((hid_t)plist, &degree) < 0)
- h5libraryError(env);
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2: property name not pinned");
- return (jint)degree;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2: default property value buffer not pinned");
+ if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, (H5P_prp_create_func_t)H5P_prp_create_cb,
+ (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
+ (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
-/**********************************************************************
- * *
- * File access properties *
- * *
- **********************************************************************/
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_family
- * Signature: (JJJ)I
+ * Method: H5Pregister2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
- (JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
{
- long ms = (long)memb_size;
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pregister2_nocb: property name is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_family
- * Signature: (J[J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
- (JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist)
-{
- herr_t status = -1;
- jlong *sizeArray;
- jlong *plistArray;
- jint mode = JNI_ABORT;
- jboolean isCopy;
- hsize_t *sa;
- size_t i;
- size_t rank;
-
- if (memb_size == NULL) {
- h5nullArgument(env, "H5Pget_family: memb_size is NULL");
- } /* end if */
- else if (memb_plist == NULL) {
- h5nullArgument(env, "H5Pget_family: memb_plist is NULL");
- } /* end else if */
- else {
- sizeArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_size, &isCopy);
- if (sizeArray == NULL) {
- h5JNIFatalError(env, "H5Pget_family: sizeArray not pinned");
- } /* end if */
- else {
- rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size);
- sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t));
- if (sa == NULL) {
- h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t");
- } /* end if */
- else {
- plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy);
- if (plistArray == NULL) {
- h5JNIFatalError(env, "H5Pget_family: plistArray not pinned");
- } /* end if */
- else {
- status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- sizeArray[i] = (jlong)sa[i];
- } /* end for */
- mode = 0;
- } /* end else */
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, mode);
- }
- HDfree(sa);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, mode);
- }
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pregister2_nocb: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_core
- * Signature: (JJZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store)
-{
- herr_t retVal = -1;
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pregister2_nocb: default property value buffer not pinned");
- retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store);
- if (retVal < 0)
- h5libraryError(env);
+ if ((status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_core
- * Signature: (J[J[Z)I
+ * Method: H5Pinsert2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store)
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pinsert2
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
+ jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
+ jobject prp_copy, jobject prp_cmp, jobject prp_close)
{
- herr_t status = -1;
- jint mode = JNI_ABORT;
- jlong *incArray;
- jboolean *backArray;
- jboolean isCopy;
-
- if (increment == NULL) {
- h5nullArgument(env, "H5Pget_fapl_core: increment is NULL");
- } /* end if */
- else if (backing_store == NULL) {
- h5nullArgument(env, "H5Pget_fapl_core: backing_store is NULL");
- } /* end else if */
- else {
- incArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR increment, &isCopy);
- if (incArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_core: incArray not pinned");
- } /* end if */
- else {
- backArray = (jboolean *)ENVPTR->GetBooleanArrayElements(ENVPAR backing_store, &isCopy);
- if (backArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_core: backArray not pinned");
- } /* end if */
- else {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long inc_temp = *(incArray);
- size_t inc_t = (size_t)inc_temp;
-
- status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray);
-
- *incArray = (jlong)inc_t;
- /* end direct cast special */
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- mode = 0;
- } /* end else */
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, mode);
- }
- ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, mode);
- }
- } /* end else */
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */
+ UNUSED(clss);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_family_offset
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong offset)
-{
- herr_t retVal = -1;
+ copy_callback = prp_copy;
+ close_callback = prp_close;
+ compare_callback = prp_cmp;
+ set_callback = prp_set;
+ get_callback = prp_get;
+ delete_callback = prp_delete;
- retVal = H5Pset_family_offset ((hid_t)fapl_id, (hsize_t)offset);
- if (retVal < 0)
- h5libraryError(env);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2: property name is NULL");
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_family_offset
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- hsize_t offset = 0;
- herr_t retVal = -1;
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2: property value buffer not pinned");
- retVal = H5Pget_family_offset ((hid_t)fapl_id, &offset);
- if (retVal < 0)
- h5libraryError(env);
+ if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf,
+ (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
+ (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jlong)offset;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_log
- * Signature: (JLjava/lang/String;JJ)V
+ * Method: H5Pinsert2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size)
+Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
+ (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
{
- herr_t retVal = -1;
- const char *pLogfile;
+ const char *cstr = NULL;
+ jboolean isCopy;
+ herr_t status = FAIL;
+ jbyte *propValBuf = NULL;
- PIN_JAVA_STRING(logfile, pLogfile);
- if (pLogfile != NULL) {
- retVal = H5Pset_fapl_log( (hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size );
+ UNUSED(clss);
- UNPIN_JAVA_STRING(logfile, pLogfile);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pinsert2_nocb: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pinsert2_nocb: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Premove_filter
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
- (JNIEnv *env, jclass clss, jlong obj_id, jint filter)
-{
- herr_t status = -1;
+ PIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, &isCopy, "H5Pinsert2_nocb: property value buffer not pinned");
- status = H5Premove_filter ((hid_t)obj_id, (H5Z_filter_t)filter);
- if (status < 0)
- h5libraryError(env);
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */
+ if ((status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void *)propValBuf, NULL, NULL, NULL, NULL, NULL, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ if (propValBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, def_value, propValBuf, (status < 0) ? JNI_ABORT : 0);
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
+} /* end Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb */
/*
* Class: hdf_hdf5lib_H5
@@ -2193,18 +383,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pset
(JNIEnv *env, jclass clss, jlong plid, jstring name, jint val)
{
- hid_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
+ hid_t retVal = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pset((hid_t)plid, cstr, &val);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pset: property name not pinned");
+
+ if ((retVal = H5Pset((hid_t)plid, cstr, &val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pset */
@@ -2218,20 +412,24 @@ JNIEXPORT jboolean JNICALL
Java_hdf_hdf5lib_H5_H5Pexist
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- htri_t bval = JNI_FALSE;
- const char *cstr;
+ const char *cstr = NULL;
+ htri_t bval = JNI_FALSE;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- bval = H5Pexist((hid_t)plid, cstr);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pexist: property name is NULL");
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pexist: property name not pinned");
+
+ if ((bval = H5Pexist((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Pexist */
@@ -2245,19 +443,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1size
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- hid_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
size_t size = 0;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pget_size((hid_t)plid, cstr, &size);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_size: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget_size: property name not pinned");
+
+ if ((status = H5Pget_size((hid_t)plid, cstr, &size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jlong) size;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */
@@ -2271,11 +473,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1nprops
(JNIEnv *env, jclass clss, jlong plid)
{
- size_t nprops;
+ size_t nprops = 0;
+
+ UNUSED(clss);
if (H5Pget_nprops((hid_t)plid, &nprops) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)nprops;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1nprops */
@@ -2288,20 +493,23 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class_1name
(JNIEnv *env, jclass clss, jlong plid)
{
- char *c_str;
- jstring j_str = NULL;
+ char *c_str = NULL;
+ jstring j_str = NULL;
- c_str = H5Pget_class_name((hid_t)plid);
- if (c_str == NULL) {
- h5libraryError(env);
- } /* end if */
- else {
- j_str = ENVPTR->NewStringUTF(ENVPAR c_str);
+ UNUSED(clss);
+
+ if (NULL == (c_str = H5Pget_class_name((hid_t)plid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (j_str = ENVPTR->NewStringUTF(ENVONLY, c_str))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_class_name: out of memory - unable to construct string from UTF characters");
+ }
+
+done:
+ if (c_str)
H5free_memory(c_str);
- if (j_str == NULL)
- h5JNIFatalError(env,"H5Pget_class_name: return string failed");
- } /* end else */
return j_str;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1name */
@@ -2314,12 +522,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Pget_1class_1parent
(JNIEnv *env, jclass clss, jlong plid)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
- retVal = H5Pget_class_parent((hid_t)plid);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Pget_class_parent((hid_t)plid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1parent */
@@ -2332,12 +542,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pisa_1class
(JNIEnv *env, jclass clss, jlong plid, jlong pcls)
{
- htri_t retVal = -1;
+ htri_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pisa_1class */
@@ -2350,19 +562,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pget
(JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
- const char *cstr;
+ const char *cstr = NULL;
jint val;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pget((hid_t)plid, cstr, &val);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget: property name is NULL");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pget: property name not pinned");
+
+ if ((status = H5Pget((hid_t)plid, cstr, &val)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)val;
} /* end Java_hdf_hdf5lib_H5_H5Pget */
@@ -2376,3575 +592,526 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Pequal
(JNIEnv *env, jclass clss, jlong plid1, jlong plid2)
{
- htri_t retVal = -1;
+ htri_t retVal = FAIL;
- retVal = H5Pequal((hid_t)plid1, (hid_t)plid2);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Pequal((hid_t)plid1, (hid_t)plid2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Pequal */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pcopy_prop
- * Signature: (JJLjava/lang/String;)I
+ * Method: H5Piterate
+ * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pcopy_1prop
- (JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
+Java_hdf_hdf5lib_H5_H5Piterate
+ (JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op, jobject op_data)
{
- herr_t retVal = -1;
- const char *cstr;
+ cb_wrapper wrapper = { callback_op, op_data };
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, cstr);
+ ENVPTR->GetJavaVM(ENVONLY, &jvm);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (retVal < 0)
- h5libraryError(env);
- }
+ if (NULL == op_data)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Piterate: op_data is NULL");
+ if (NULL == callback_op)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Piterate: callback_op is NULL");
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Premove
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Premove
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
-{
- herr_t retVal = -1;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Premove((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
+ if (NULL == idx) {
+ if ((status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
}
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Premove */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Punregister
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Punregister
- (JNIEnv *env, jclass clss, jlong plid, jstring name)
-{
- herr_t retVal = -1;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- retVal = H5Punregister((hid_t)plid, cstr);
-
- UNPIN_JAVA_STRING(name, cstr);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Punregister */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pclose_class
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose_1class
- (JNIEnv *env, jclass clss, jlong plid)
-{
- herr_t retVal = -1;
-
- retVal = H5Pclose_class((hid_t)plid);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
- (JNIEnv *env, jclass clss, jlong plist, jint filter_number,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen,
- jobjectArray name, jintArray filter_config)
-{
- herr_t status = -1;
- jint *flagsArray;
- jlong *cd_nelmtsArray;
- jint *cd_valuesArray;
- jint *filter_configArray;
- jboolean isCopy;
- char *filter;
- jstring str;
-
- if (namelen <= 0) {
- h5badArgument(env, "H5Pget_filter: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5badArgument(env, "H5Pget_filter: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL");
- } /* end else if */
- else if (filter_config == NULL) {
- h5badArgument(env, "H5Pget_filter: filter_config is NULL");
- } /* end else if */
else {
- filter = (char*)HDmalloc(sizeof(char)*(size_t)namelen);
- if (filter == NULL) {
- h5outOfMemory(env, "H5Pget_filter: namelent malloc failed");
- return -1;
- } /* end if */
- flagsArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy);
- if (flagsArray == NULL) {
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: flags array not pinned");
- return -1;
- } /* end if */
-
- cd_nelmtsArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned");
- return -1;
- } /* end if */
- filter_configArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy);
- if (filter_configArray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: filter_config array not pinned");
- return -1;
- } /* end if */
-
- if (*cd_nelmtsArray == 0 && cd_values == NULL) {
- /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = 0;
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, NULL,
- (size_t)namelen, filter, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end if */
- else {
- if (cd_values == NULL) {
- h5badArgument(env, "H5Pget_filter: cd_values is NULL");
- return -1;
- } /* end if */
- cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, filter, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special */
- } /* end else */
-
- if (status < 0) {
- if (cd_values)
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(filter);
- h5libraryError(env);
- } /* end if */
- else {
- if (cd_values)
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- /* NewStringUTF may throw OutOfMemoryError */
- str = ENVPTR->NewStringUTF(ENVPAR filter);
- HDfree(filter);
- if (str == NULL)
- h5JNIFatalError(env, "H5Pget_filter: return string not pinned");
- else
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
+ PIN_INT_ARRAY(ENVONLY, idx, theArray, &isCopy, "H5Piterate: idx not pinned");
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */
+ if ((status = H5Piterate((hid_t)prop_id, (int *)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void *)&wrapper)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
- (JNIEnv *env, jclass clss, jlong plist, jint filter,
- jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config)
-{
- herr_t status = -1;
- int i = 0;
- jint *cd_valuesArray;
- jint *flagsArray;
- jint *filter_configArray;
- jlong *cd_nelmtsArray;
- jboolean isCopy;
- long bs;
- char *aName;
- jstring str;
-
- bs = (long)namelen;
- if (bs <= 0) {
- h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0");
- } /* end if */
- else if (flags == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL");
- } /* end else if */
- else if (cd_nelmts == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL");
- } /* end else if */
- else if (cd_values == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL");
- } /* end else if */
- else if (name == NULL) {
- h5nullArgument(env, "H5Pget_filter_by_id: name is NULL");
- } /* end else if */
- else if (filter_config == NULL) {
- h5badArgument(env, "H5Pget_filter_by_id: filter_config is NULL");
- } /* end else if */
- else {
- aName = (char*)HDmalloc(sizeof(char) * (size_t)bs);
- if (aName == NULL) {
- h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed");
- return -1;
- } /* end if */
- flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags,&isCopy);
- if (flagsArray == NULL) {
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
- cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy);
- if (cd_nelmtsArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned");
- return -1;
- } /* end if */
- cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy);
- if (cd_valuesArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int.");
- return -1;
- } /* end if */
- filter_configArray = ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy);
- if (filter_configArray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- HDfree(aName);
- h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned");
- return -1;
- } /* end if */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long cd_nelmts_temp = *(cd_nelmtsArray);
- size_t cd_nelmts_t = (size_t)cd_nelmts_temp;
-
- status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter,
- (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray,
- (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray);
-
- *cd_nelmtsArray = (jlong)cd_nelmts_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT);
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- HDfree(aName);
- ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0);
- } /* end else */
- } /* end else */
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, idx, theArray, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nlinks
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- size_t nlinks;
- if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0)
- h5libraryError(env);
-
- return (jlong) nlinks;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nlinks
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
-{
- herr_t retVal = -1;
-
- if (nlinks <= 0) {
- h5badArgument(env, "H5Pset_1nlinks: nlinks_l <= 0");
- } /* end if */
- else {
- retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_libver_bounds
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver)
-{
- herr_t retVal = -1;
- H5F_libver_t *theArray = NULL;
- jboolean isCopy;
-
- if (libver == NULL) {
- h5nullArgument(env, "H5Pget_libver_bounds: libversion bounds is NULL");
- } /* end if */
- else {
- theArray = (H5F_libver_t*)ENVPTR->GetIntArrayElements(ENVPAR libver, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_libver_bounds: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_libver_bounds((hid_t)fapl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_libver_bounds
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
- (JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id)
-{
- unsigned crt_order_flags;
-
- if(H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0)
- h5libraryError(env);
-
- return (jint)crt_order_flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id)
-{
- unsigned crt_order_flags;
-
- if(H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0)
- h5libraryError(env);
-
- return (jint)crt_order_flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */
+} /* end Java_hdf_hdf5lib_H5_H5Piterate */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_creation_order
- * Signature: (JI)I
+ * Method: H5Pcopy_prop
+ * Signature: (JJLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_copy_object
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
+Java_hdf_hdf5lib_H5_H5Pcopy_1prop
+ (JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
- retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options);
- if(retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_copy_object
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
- (JNIEnv *env, jclass clss, jlong ocp_plist_id)
-{
- unsigned copy_options;
+ UNUSED(clss);
- if(H5Pget_copy_object((hid_t)ocp_plist_id, &copy_options) < 0)
- h5libraryError(env);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pcopy_prop: property name is NULL");
- return (jint)copy_options;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Pcopy_prop: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_create_intermediate_group
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_create_intermediate_group
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
- (JNIEnv *env, jclass clss, jlong lcpl_id)
-{
- unsigned crt_intermed_group;
-
- if(H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0)
- h5libraryError(env);
-
- return (jboolean)crt_intermed_group;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */
+} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_data_transform
+ * Method: H5Premove
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jstring expression)
-{
- herr_t retVal = -1;
- const char *express;
-
- PIN_JAVA_STRING(expression, express);
- if (express != NULL) {
- retVal = H5Pset_data_transform((hid_t)plist_id, express);
-
- UNPIN_JAVA_STRING(expression, express);
-
- if (retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_data_transform
- * Signature: (J[Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
- (JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size)
-{
- size_t buf_size;
- char *express;
- jlong express_size = -1;
- jstring str = NULL;
-
- if (size <= 0) {
- h5badArgument(env, "H5Pget_data_transform: size <= 0");
- } /* end if */
- else {
- express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, (char*)NULL, (size_t)size);
- if(express_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- buf_size = (size_t)express_size + 1;/* add extra space for the null terminator */
- express = (char*)HDmalloc(sizeof(char) * buf_size);
- if (express == NULL) {
- h5outOfMemory(env, "H5Pget_data_transform: malloc failed ");
- } /* end if */
- else {
- express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, express, (size_t)size);
- if (express_size < 0) {
- HDfree(express);
- h5libraryError(env);
- }
- else {
- str = ENVPTR->NewStringUTF(ENVPAR express);
- HDfree(express);
- if (str == NULL)
- h5JNIFatalError(env, "H5Pget_data_transform: return string not created");
- else
- ENVPTR->SetObjectArrayElement(ENVPAR expression, 0, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- return express_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_acc_flags
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- unsigned flags;
-
- if(H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0)
- h5libraryError(env);
-
- return (jint)flags;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_acc_flags
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
- (JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jint) retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense)
-{
- herr_t retVal = -1;
-
- if(max_compact < min_dense) {
- h5badArgument(env, "H5Pset_link_phase_change: max compact value must be >= min dense value");
- } /* end if */
- else if(max_compact > 65535) {
- h5badArgument(env, "H5Pset_link_phase_change: max compact value must be < 65536");
- } /* end else if */
- else if(min_dense > 65535) {
- h5badArgument(env, "H5Pset_link_phase_change: min dense value must be < 65536");
- } /* end else if */
- else {
- retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (links == NULL) {
- h5nullArgument( env, "H5Pget_link_phase_change: links is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR links, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError( env, "H5Pget_link_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_link_phase_change((hid_t)gcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (attributes == NULL) {
- h5nullArgument(env, "H5Pget_attr_phase_change: attributes is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR attributes, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_attr_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_phase_change
- * Signature: (JII)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
- (JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense);
- if(retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- if (size == NULL) {
- h5nullArgument(env, "H5Pget_shared_mesg_phase_change: size is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_shared_mesg_phase_change: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree)
-{
- herr_t retVal = -1;
-
- /* Check that values are sensible. The min_btree value must be no greater
- * than the max list plus one.
- *
- * Range check to make certain they will fit into encoded form.
- */
-
- if(max_list + 1 < min_btree) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value");
- } /* end if */
- else if(max_list > H5O_SHMESG_MAX_LIST_SIZE) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE");
- } /* end else if */
- else if(min_btree > H5O_SHMESG_MAX_LIST_SIZE) {
- h5badArgument(env, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE");
- } /* end else if */
- else {
- retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_nindexes
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- unsigned nindexes;
-
- if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0)
- h5libraryError(env);
-
- return (jint)nindexes;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_nindexes
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
- (JNIEnv *env, jclass clss, jlong plist_id, jint nindexes)
-{
- herr_t retVal = -1;
-
- if (nindexes > H5O_SHMESG_MAX_NINDEXES) {
- h5badArgument(env, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES");
- } /* end if */
- else {
- retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_index
- * Signature: (JIII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num,
- jint mesg_type_flags, jint min_mesg_size)
-{
- herr_t retVal = -1;
- unsigned nindexes;/* Number of SOHM indexes */
-
- /* Check arguments */
- if(mesg_type_flags > H5O_SHMESG_ALL_FLAG) {
- h5badArgument(env, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags");
- } /* end if */
- else if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) { /* Read the current number of indexes */
- h5libraryError(env);
- } /* end else if */
- else {
- /* Range check */
- if((unsigned)index_num >= nindexes) {
- h5badArgument(env, "H5Pset_shared_mesg_index: index_num is too large; no such index");
- } /* end if */
- else {
- retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_index
- * Signature: (JI[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info)
-{
- herr_t retVal = -1;
- unsigned nindexes;/* Number of SOHM indexes */
- unsigned *theArray = NULL;
- jboolean isCopy;
-
- /* Read the current number of indexes */
- if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes)<0) {
- h5libraryError(env);
- } /* end if */
- else {
- /* Range check */
- if((unsigned)index_num >= nindexes) {
- h5badArgument(env, "H5Pget_shared_mesg_index: index_num is too large; no such index");
- } /* end if */
- else if (mesg_info == NULL) {
- h5nullArgument(env, "H5Pget_shared_mesg_index: mesg_info is NULL");
- } /* end else if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR mesg_info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_shared_mesg_index: input not pinned");
- } /* end if */
- else {
- retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_local_heap_size_hint
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_local_heap_size_hint
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
- (JNIEnv *env, jclass clss, jlong gcpl_id)
-{
- size_t size_hint;
-
- if(H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0)
- h5libraryError(env);
-
- return (jlong)size_hint;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nbit
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
- (JNIEnv *env, jclass clss, jlong plist_id)
-{
- herr_t retVal = -1;
-
- retVal = H5Pset_nbit((hid_t)plist_id);
- if(retVal < 0)
- h5libraryError(env);
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_scaleoffset
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
- (JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor)
-{
- herr_t retVal = -1;
-
- /* Check arguments */
- if(scale_factor < 0) {
- h5badArgument(env, "H5Pset_scaleoffset: scale factor must be > 0");
- } /* end if */
- else {
- if(scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT){
- h5badArgument(env, "H5Pset_scaleoffset: invalid scale type");
- } /* end if */
- else {
- retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_est_link_info
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len)
+Java_hdf_hdf5lib_H5_H5Premove
+ (JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
-
- /* Range check values */
- if((est_num_entries > 65535) || (est_name_len > 65535)) {
- h5badArgument(env, "H5Pset_est_link_info: est. name length or number of entries must be < 65536");
- } /* end if */
- else {
- retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len);
- if(retVal < 0)
- h5libraryError(env);
- } /* end else */
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_est_link_info
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
- (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info)
-{
- herr_t retVal = -1;
- unsigned *theArray = NULL;
- jboolean isCopy;
+ UNUSED(clss);
- if (link_info == NULL) {
- h5nullArgument(env, "H5Pget_est_link_info: link_info is NULL");
- } /* end if */
- else {
- theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR link_info,&isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_est_link_info: input not pinned");
- } /* end if */
- else {
- retVal= H5Pget_est_link_info((hid_t)gcpl_id, &(theArray[0]), &(theArray[1]));
- if(retVal < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, 0);
- } /* end else */
- } /* end else */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Premove: property name is NULL");
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Premove: property name not pinned");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_fapl
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Premove((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id);
- if(retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pget_elink_fapl
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
- (JNIEnv *env, jclass clss, jlong lapl_id)
-{
- hid_t retVal = -1;
-
- retVal = H5Pget_elink_fapl((hid_t)lapl_id);
- if (retVal < 0)
- h5libraryError(env);
-
- return (jlong)retVal;
-} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */
+} /* end Java_hdf_hdf5lib_H5_H5Premove */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_prefix
+ * Method: H5Punregister
* Signature: (JLjava/lang/String;)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
-{
- herr_t retVal = -1;
- const char *aName;
-
- PIN_JAVA_STRING(prefix, aName);
- if (aName != NULL) {
- retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName);
-
- UNPIN_JAVA_STRING(prefix, aName);
-
- if(retVal < 0)
- h5libraryError(env);
- }
-
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_prefix
- * Signature: (J[Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
- (JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
-{
- size_t size = 0;
- char *pre;
- jlong prefix_size = -1;
- jstring str = NULL;
-
- if (prefix == NULL) {
- h5nullArgument(env, "H5Pget_elink_prefix: prefix is NULL");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)NULL, size);
- if(prefix_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
- pre = (char*)HDmalloc(sizeof(char)*size);
- if (pre == NULL) {
- h5outOfMemory(env, "H5Pget_elink_prefix: malloc failed ");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)pre, size);
-
- if (prefix_size < 0) {
- HDfree(pre);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR pre);
- HDfree(pre);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_elink_prefix: return string not created");
- } /* end if */
- else
- ENVPTR->SetObjectArrayElement(ENVPAR prefix, 0, str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-
- return prefix_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_direct
- * Signature: (JJJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment,
- jlong block_size, jlong cbuf_size)
+Java_hdf_hdf5lib_H5_H5Punregister
+ (JNIEnv *env, jclass clss, jlong plid, jstring name)
{
- herr_t retVal = -1;
+ const char *cstr = NULL;
+ herr_t retVal = FAIL;
-#ifdef H5_HAVE_DIRECT
- retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size);
-#endif
- if(retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Punregister: property name is NULL");
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_direct
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
- (JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info)
-{
- herr_t retVal = -1;
-
-#ifdef H5_HAVE_DIRECT
- size_t alignment = 0;
- size_t block_size = 0;
- size_t cbuf_size = 0;
- jlong *theArray;
- jboolean isCopy;
- if (info == NULL) {
- h5nullArgument(env, "H5Pget_fapl_direct: info input array is NULL");
- } /* end if */
- else {
- if (ENVPTR->GetArrayLength(ENVPAR info) < 3) {
- h5badArgument( env, "H5Pget_fapl_direct: info input array < 4");
- } /* end if */
- else {
- theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR info, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_direct: info not pinned");
- } /* end if */
- else {
- retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size);
- if(retVal < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- theArray[0] = (jlong)alignment;
- theArray[1] = (jlong)block_size;
- theArray[2] = (jlong)cbuf_size;
- ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
-#else
- if (retVal < 0)
- h5libraryError(env);
-#endif
+ PIN_JAVA_STRING(ENVONLY, name, cstr, NULL, "H5Punregister: property name not pinned");
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_sec2
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- herr_t retVal = -1;
+ if ((retVal = H5Punregister((hid_t)plid, cstr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Pset_fapl_sec2((hid_t) fapl_id);
- if (retVal < 0)
- h5libraryError(env);
+done:
+ if (cstr)
+ UNPIN_JAVA_STRING(ENVONLY, name, cstr);
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */
+} /* end Java_hdf_hdf5lib_H5_H5Punregister */
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_stdio
+ * Method: _H5Pclose_class
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
- (JNIEnv *env, jclass clss, jlong fapl_id)
+Java_hdf_hdf5lib_H5__1H5Pclose_1class
+ (JNIEnv *env, jclass clss, jlong plid)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Pset_fapl_stdio((hid_t) fapl_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_windows
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- herr_t retVal = -1;
-
-#ifdef H5_HAVE_WINDOWS
- retVal = H5Pset_fapl_windows((hid_t) fapl_id);
-#endif
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Pclose_class((hid_t)plid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr)
-{
- herr_t status = -1;
- int i;
- jint *themapArray = NULL;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- char **mName = NULL;
- jstring str;
- jboolean isCopy;
- int relax = 0;
-
- if (memb_map) {
- themapArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy);
- if (themapArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_fapl) {
- thefaplArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy);
- if (thefaplArray == NULL) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_addr) {
- theaddrArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy);
- if (theaddrArray == NULL) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned");
- return 0;
- } /* end if */
- } /* end if */
-
- if (memb_name)
- mName = (char**)HDcalloc(H5FD_MEM_NTYPES, sizeof (*mName));
-
- status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t*)themapArray, (hid_t*)thefaplArray, mName, (haddr_t*)theaddrArray, (hbool_t*)&relax);
-
- if (status < 0) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT);
- if (memb_name) h5str_array_free(mName, H5FD_MEM_NTYPES);
- h5libraryError(env);
- } /* end if */
- else {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0);
-
- if (memb_name) {
- if (mName) {
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- if (*(mName + i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(mName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)str);
- } /* end if */
- } /* for (i=0; i<n; i++)*/
- } /* end if */
- h5str_array_free(mName, H5FD_MEM_NTYPES);
- } /* end if */
- } /* end else */
-
- return (relax!=0);
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
- (JNIEnv *env, jclass clss, jlong tid, jintArray memb_map,
- jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr, jboolean relax)
-{
- herr_t status = -1;
- jint *themapArray = NULL;
- jlong *thefaplArray = NULL;
- jlong *theaddrArray = NULL;
- jboolean isCopy;
- jclass Sjc;
- jstring rstring;
- jobject o;
- jboolean bb;
- const char **mName = NULL;
- char *member_name[H5FD_MEM_NTYPES];
-
- if (memb_map) {
- themapArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy);
- if (themapArray == NULL) {
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned");
- return;
- } /* end if */
- } /* end if */
-
- if (memb_fapl) {
- thefaplArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy);
- if (thefaplArray == NULL) {
- if (memb_map)
- ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned");
- return;
- } /* end if */
- } /* end if */
-
- if (memb_addr) {
- theaddrArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy);
- if (theaddrArray == NULL) {
- if (memb_map)
- ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl)
- ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned");
- return;
- } /* end if */
- } /* end if */
-
- HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char*));
- if (memb_name) {
- int i;
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) memb_name, i);
- if (obj != 0) {
- jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj);
- const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
-
- if (utf8) {
- member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1);
- if (member_name[i]) {
- strcpy(member_name[i], utf8);
- } /* end if */
- } /* end if */
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);
- ENVPTR->DeleteLocalRef(ENVPAR obj);
- } /* end if */
- } /* end for */
- mName = (const char **)member_name;
- } /* end if */
-
- status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray, mName, (const haddr_t *)theaddrArray, (hbool_t)relax);
-
- if (status < 0) {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT);
- if (memb_name) {
- int i;
- for (i = 0; i < H5FD_MEM_NTYPES; i++)
- HDfree(member_name[i]);
- } /* end if */
- h5libraryError(env);
- } /* end if */
- else {
- if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0);
- if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0);
- if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0);
- if (memb_name) {
- if (mName != NULL) {
- int i;
- Sjc = ENVPTR->FindClass(ENVPAR "java/lang/String");
- if (Sjc != NULL) {
- for (i = 0; i < H5FD_MEM_NTYPES; i++) {
- rstring = ENVPTR->NewStringUTF(ENVPAR member_name[i]);
- o = ENVPTR->GetObjectArrayElement(ENVPAR memb_name, i);
- if (o != NULL) {
- bb = ENVPTR->IsInstanceOf(ENVPAR o, Sjc);
- if (bb == JNI_TRUE) {
- ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)rstring);
- } /* end if */
- ENVPTR->DeleteLocalRef(ENVPAR o);
- } /* end if */
- HDfree(member_name[i]);
- } /* end for */
- } /* end if */
- } /* end if */
- } /* end if */
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */
+} /* end Java_hdf_hdf5lib_H5__1H5Pclose_1class */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_split
- * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
- (JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id)
+static herr_t
+H5P_cls_create_cb
+ (hid_t prop_id, void *create_data)
{
- herr_t retVal = -1;
- const char *mstr;
- const char *rstr;
-
- PIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr);
- if (mstr != NULL && rstr != NULL) {
- retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id);
-
- UNPIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr);
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (retVal < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_create_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_meta_block_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- long sz = (long)size;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, create_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_meta_block_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- hsize_t s;
-
- if (H5Pget_meta_block_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sieve_buf_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist, jlong size)
-{
- size_t sz = (size_t)size;
-
- if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sieve_buf_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- size_t s;
-
- if (H5Pget_sieve_buf_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
-
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_file_cache_size
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist, jint size)
-{
- unsigned sz = (unsigned)size;
-
- if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_file_cache_size
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
- (JNIEnv *env, jclass clss, jlong plist)
-{
- unsigned s;
-
- if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0)
- h5libraryError(env);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, prop_id, create_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jint)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */
-
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_config
- * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
- */
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist)
-{
- H5AC_cache_config_t cacheinfo;
- herr_t status = -1;
- jvalue args[30];
- jstring j_str = NULL;
- jobject ret_obj = NULL;
-
- HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t));
- cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION;
-
- status = H5Pget_mdc_config((hid_t)plist, &cacheinfo);
-
- if (status < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- args[0].i = cacheinfo.version;
- args[1].z = cacheinfo.rpt_fcn_enabled;
- args[2].z = cacheinfo.open_trace_file;
- args[3].z = cacheinfo.close_trace_file;
- if (cacheinfo.trace_file_name != NULL) {
- j_str = ENVPTR->NewStringUTF(ENVPAR cacheinfo.trace_file_name);
- } /* end if */
- args[4].l = j_str;
- args[5].z = cacheinfo.evictions_enabled;
- args[6].z = cacheinfo.set_initial_size;
- args[7].j = (jlong)cacheinfo.initial_size;
- args[8].d = cacheinfo.min_clean_fraction;
- args[9].j = (jlong)cacheinfo.max_size;
- args[10].j = (jlong)cacheinfo.min_size;
- args[11].j = cacheinfo.epoch_length;
- args[12].i = cacheinfo.incr_mode;
- args[13].d = cacheinfo.lower_hr_threshold;
- args[14].d = cacheinfo.increment;
- args[15].z = cacheinfo.apply_max_increment;
- args[16].j = (jlong)cacheinfo.max_increment;
- args[17].i = cacheinfo.flash_incr_mode;
- args[18].d = cacheinfo.flash_multiple;
- args[19].d = cacheinfo.flash_threshold;
- args[20].i = cacheinfo.decr_mode;
- args[21].d = cacheinfo.upper_hr_threshold;
- args[22].d = cacheinfo.decrement;
- args[23].z = cacheinfo.apply_max_decrement;
- args[24].j = (jlong)cacheinfo.max_decrement;
- args[25].i = cacheinfo.epochs_before_eviction;
- args[26].z = cacheinfo.apply_empty_reserve;
- args[27].d = cacheinfo.empty_reserve;
- args[28].j = (jlong)cacheinfo.dirty_bytes_threshold;
- args[29].i = cacheinfo.metadata_write_strategy;
- CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args);
- } /* end else */
- return ret_obj;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_config
- * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
- (JNIEnv *env, jclass clss, jlong plist, jobject cache_config)
-{
- herr_t status = -1;
- jclass cls;
- jfieldID fid;
- jstring j_str;
- const char *str;
- H5AC_cache_config_t cacheinfo;
-
- cls = ENVPTR->GetObjectClass(ENVPAR cache_config);
- fid = ENVPTR->GetFieldID(ENVPAR cls, "version", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: version");
- return;
- } /* end if */
- cacheinfo.version = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading version failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "rpt_fcn_enabled", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: rpt_fcn_enabled");
- return;
- } /* end if */
- cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading rpt_fcn_enabled failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "open_trace_file", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: open_trace_file");
- return;
- } /* end if */
- cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading open_trace_file failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "close_trace_file", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: close_trace_file");
- return;
- } /* end if */
- cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading close_trace_file failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "trace_file_name", "Ljava/lang/String;");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: trace_file_name");
- return;
- } /* end if */
- j_str = (jstring)ENVPTR->GetObjectField(ENVPAR cache_config, fid);
- str = ENVPTR->GetStringUTFChars(ENVPAR j_str, NULL);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name");
- return;
- } /* end if */
- HDstrncpy(cacheinfo.trace_file_name, str, 1025);
- ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "evictions_enabled", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: evictions_enabled");
- return;
- } /* end if */
- cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading evictions_enabled failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "set_initial_size", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: set_initial_size");
- return;
- } /* end if */
- cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading set_initial_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "initial_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: initial_size");
- return;
- } /* end if */
- cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading initial_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "min_clean_fraction", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: min_clean_fraction");
- return;
- } /* end if */
- cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading min_clean_fraction failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_size");
- return;
- } /* end if */
- cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "min_size", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: min_size");
- return;
- } /* end if */
- cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading min_size failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "epoch_length", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: epoch_length");
- return;
- }
- cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading epoch_length failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "incr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: incr_mode");
- return;
- } /* end if */
- cacheinfo.incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_incr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading incr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "lower_hr_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: lower_hr_threshold");
- return;
- } /* end if */
- cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading lower_hr_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "increment", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: increment");
- return;
- } /* end if */
- cacheinfo.increment = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_increment", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_max_increment");
- return;
- } /* end if */
- cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_increment", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_increment");
- return;
- } /* end if */
- cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_increment failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_incr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_incr_mode");
- return;
- } /* end if */
- cacheinfo.flash_incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_incr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_multiple", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_multiple");
- return;
- } /* end if */
- cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_multiple failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: flash_threshold");
- return;
- } /* end if */
- cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "decr_mode", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: decr_mode");
- return;
- } /* end if */
- cacheinfo.decr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_decr_mode) */
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading decr_mode failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "upper_hr_threshold", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: upper_hr_threshold");
- return;
- } /* end if */
- cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading upper_hr_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "decrement", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: decrement");
- return;
- } /* end if */
- cacheinfo.decrement = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_decrement", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_max_decrement");
- return;
- } /* end if */
- cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "max_decrement", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: max_decrement");
- return;
- } /* end if */
- cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading max_decrement failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "epochs_before_eviction", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: epochs_before_eviction");
- return;
- } /* end if */
- cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading epochs_before_eviction failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_empty_reserve", "Z");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: apply_empty_reserve");
- return;
- } /* end if */
- cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_empty_reserve failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "empty_reserve", "D");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: empty_reserve");
- return;
- } /* end if */
- cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading empty_reserve failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "dirty_bytes_threshold", "J");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: dirty_bytes_threshold");
- return;
- } /* end if */
- cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading dirty_bytes_threshold failed");
- return;
- } /* end if */
-
- fid = ENVPTR->GetFieldID(ENVPAR cls, "metadata_write_strategy", "I");
- if(fid == 0) {
- h5badArgument(env, "H5Pset_mdc_config: metadata_write_strategy");
- return;
- } /* end if */
- cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVPAR cache_config, fid);
- if(ENVPTR->ExceptionOccurred(ENVONLY)) {
- h5JNIFatalError(env, "H5Pset_mdc_config: loading metadata_write_strategy failed");
- } /* end if */
- else {
- status = H5Pset_mdc_config((hid_t)plist, &cacheinfo);
-
- if (status < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_cache
- * Signature: (JJJD)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots,
- jlong rdcc_nbytes, jdouble rdcc_w0)
-{
- if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */
+ return (herr_t)status;
+} /* end H5P_cls_create_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_cache
- * Signature: (J[J[J[D)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
- (JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots,
- jlongArray rdcc_nbytes, jdoubleArray rdcc_w0)
+static herr_t
+H5P_cls_copy_cb
+ (hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
{
- herr_t status = -1;
- jint mode;
- jdouble *w0Array = (jdouble *)NULL;
- jlong *rdcc_nslotsArray = (jlong *)NULL;
- jlong *nbytesArray = (jlong *)NULL;
- jboolean isCopy;
-
- if (rdcc_w0 != NULL) {
- w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy);
- if (w0Array == NULL) {
- h5JNIFatalError(env, "H5Pget_chunk_cache: w0_array array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- if (rdcc_nslots != NULL) {
- rdcc_nslotsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nslots, &isCopy);
- if (rdcc_nslotsArray == NULL) {
- /* exception -- out of memory */
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_chunk_cache: rdcc_nslots array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- if (rdcc_nbytes != NULL) {
- nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy);
- if (nbytesArray == NULL) {
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT);
- } /* end if */
- if (rdcc_nslotsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, JNI_ABORT);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_chunk_cache: nbytesArray array not pinned");
- return;
- } /* end if */
- } /* end else */
-
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- long long rdcc_nslots_temp = *(rdcc_nslotsArray);
- size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp;
- long long nbytes_temp = *(nbytesArray);
- size_t nbytes_t = (size_t)nbytes_temp;
-
- status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array);
-
- *rdcc_nslotsArray = (jlong)rdcc_nslots_t;
- *nbytesArray = (jlong)nbytes_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- mode = JNI_ABORT;
- } /* end if */
- else {
- mode = 0; /* commit and free */
- } /* end else */
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (rdcc_nslotsArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, mode);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_copy_cb: failed to attach current thread to JVM");
}
- /* end if */
- if (nbytesArray != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode);
- } /* end if */
-
- if (w0Array != NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode);
- } /* end if */
-
- if (status < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_obj_track_times
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid)
-{
- hbool_t track_times;
-
- if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0) {
- h5libraryError(env);
- return JNI_FALSE;
- } /* end if */
- if (track_times == 1) {
- return JNI_TRUE;
- } /* end if */
- return JNI_FALSE;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_obj_track_times
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
- (JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
-{
- hbool_t track;
- if (track_times == JNI_TRUE) {
- track = 1;
- } /* end if */
- else {
- track = 0;
- } /* end else */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pset_obj_track_times((hid_t)objplid, track) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_char_encoding
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl)
-{
- H5T_cset_t encoding;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, new_prop_id, old_prop_id, copy_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0)
- h5libraryError(env);
-
- return encoding;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_char_encoding
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
- (JNIEnv *env, jclass clss, jlong acpl, jint encoding)
-{
- if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */
+ return (herr_t)status;
+} /* end H5P_cls_copy_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual
- * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id,
- jstring src_file_name, jstring src_dset_name, jlong src_space_id)
+static herr_t
+H5P_cls_close_cb
+ (hid_t prop_id, void *close_data)
{
- herr_t retVal = -1;
- const char *fstr;
- const char *dstr;
-
- PIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr);
- if (fstr != NULL && dstr != NULL) {
- retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id);
-
- UNPIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr);
+ jmethodID mid;
+ JNIEnv *cbenv = NULL;
+ jclass cls;
+ jint status = -1;
- if (retVal < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_cls_close_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_count
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
- (JNIEnv *env, jclass clss, jlong dcpl_id)
-{
- size_t s;
-
- if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0)
- h5libraryError(env);
- return (jlong)s;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_vspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- hid_t space_id = -1;
-
- space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index);
- if (space_id < 0)
- h5libraryError(env);
-
- return (jlong)space_id;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_srcspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- hid_t space_id = -1;
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index);
- if (space_id < 0)
- h5libraryError(env);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, prop_id, close_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jlong)space_id;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_filename
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
-{
- char *fname;
- ssize_t buf_size;
- ssize_t status;
- jstring str = NULL;
-
- /* get the length of the filename */
- buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Pget_virtual_filename: buf_size < 0");
- } /* end if */
- else if (buf_size >= 0) {
- buf_size++; /* add extra space for the null terminator */
- fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (fname == NULL) {
- h5outOfMemory( env, "H5Pget_virtual_filename: malloc failed");
- } /* end if */
- else {
- status = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size);
-
- if (status >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR fname);
- HDfree(fname);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_virtual_filename: return string not allocated");
- } /* end if */
- else {
- HDfree(fname);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else if */
-
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */
+ return (herr_t)status;
+} /* end H5P_cls_close_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_dsetname
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
- (JNIEnv *env, jclass clss, jlong dcpl_id, jlong index)
+static herr_t
+H5P_prp_create_cb
+ (const char *name, size_t size, void *value)
{
- char *dname;
- ssize_t buf_size;
- ssize_t status;
- jstring str = NULL;
-
- /* get the length of the filename */
- buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0);
- if (buf_size < 0) {
- h5badArgument( env, "H5Pget_virtual_dsetname: buf_size < 0");
- } /* end if */
- else if (buf_size > 0) {
- buf_size++; /* add extra space for the null terminator */
- dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (dname == NULL) {
- h5outOfMemory( env, "H5Pget_virtual_dsetname: malloc failed");
- } /* end if */
- else {
- status = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size);
-
- if (status >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR dname);
- HDfree(dname);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_virtual_dsetname: return string not allocated");
- } /* end if */
- else {
- HDfree(dname);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else if */
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_view
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- H5D_vds_view_t virtual_view;
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_create_cb: failed to attach current thread to JVM");
+ }
- if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0)
- h5libraryError(env);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, create_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jint)virtual_view;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_view
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
- (JNIEnv *env, jclass clss, jlong dapl_id, jint view)
-{
- if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_printf_gap
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- hsize_t gap_size;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, create_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0)
- h5libraryError(env);
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- return (jlong)gap_size;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */
+ return (herr_t)status;
+} /* end H5P_prp_create_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_printf_gap
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
- (JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size)
+static herr_t
+H5P_prp_set_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy
- * Signature: (J[Z[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jbooleanArray persist, jlongArray threshold)
-{
- herr_t status = -1;
- H5F_fspace_strategy_t thestrategy = H5F_FSPACE_STRATEGY_FSM_AGGR; /* Library default */
- jlong *thethresholdArray = NULL;
- jboolean *thepersistArray = NULL;
- jboolean isCopy;
-
- if (persist) {
- thepersistArray = (jboolean*)ENVPTR->GetBooleanArrayElements(ENVPAR persist, &isCopy);
- if (thepersistArray == NULL) {
- h5JNIFatalError(env, "H5Pget_file_space: persist not pinned");
- return -1;
- }
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_set_cb: failed to attach current thread to JVM");
}
- if (threshold) {
- thethresholdArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR threshold, &isCopy);
- if (thethresholdArray == NULL) {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
- h5JNIFatalError(env, "H5Pget_file_space: threshold not pinned");
- return -1;
- } /* end if */
- } /* end if */
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, &thestrategy, (hbool_t*)thepersistArray, (hsize_t*)thethresholdArray);
-
- if (status < 0) {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, JNI_ABORT);
- if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- if (persist) ENVPTR->ReleaseBooleanArrayElements(ENVPAR persist, thepersistArray, 0);
- if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, 0);
- } /* end else */
- return (jint)thestrategy;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy */
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, set_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_persist
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- herr_t status = -1;
- hbool_t thepersist = FALSE;
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, &thepersist, NULL);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (status < 0)
- h5libraryError(env);
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jboolean)thepersist;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist */
+ status = CBENVPTR->CallIntMethod(CBENVONLY, set_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_threshold
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- herr_t status = -1;
- hsize_t thethreshold;
-
- status = H5Pget_file_space_strategy((hid_t)fcpl_id, NULL, NULL, &thethreshold);
-
- if (status < 0)
- h5libraryError(env);
-
- return (jlong)thethreshold;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1threshold */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_strategy
- * Signature: (JIZJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
- (JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jboolean persist, jlong threshold)
-{
- if (H5Pset_file_space_strategy((hid_t)fcpl_id, (H5F_fspace_strategy_t)strategy, (hbool_t)persist, (hsize_t)threshold) < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_file_space_strategy */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_page_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id, jlong fsp_size)
-{
- if (H5Pset_file_space_page_size((hid_t)fcpl_id, (hsize_t)fsp_size) < 0)
- h5libraryError(env);
-}
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_page_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
- (JNIEnv *env, jclass clss, jlong fcpl_id)
-{
- hsize_t fsp_size = 0;
- if (H5Pget_file_space_page_size((hid_t)fcpl_id, &fsp_size) < 0)
- h5libraryError(env);
- return (jlong)fsp_size;
-}
-
-static herr_t
-H5P_cls_create_cb
- (hid_t prop_id, void *create_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I");
- if (mid != 0) {
- /* fprintf(stderr, "JNI H5P_cls_create_func_cb execute\n"); fflush(stderr); */
- status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, prop_id, create_data);
- /* fprintf(stderr, "\nJNI H5P_cls_create_func_cb status: %d\n", status); fflush(stderr); */
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_cls_create_cb */
+} /* end H5P_prp_set_cb */
static herr_t
-H5P_cls_copy_cb
- (hid_t new_prop_id, hid_t old_prop_id, void *copy_data)
+H5P_prp_get_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, new_prop_id, old_prop_id, copy_data);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_cls_copy_cb */
-
-static herr_t
-H5P_cls_close_cb
- (hid_t prop_id, void *close_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
+ jstring str;
jclass cls;
- jmethodID mid;
-
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, prop_id, close_data);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_cls_close_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_log_options
- * Signature: (JZLjava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean is_enabled, jstring location, jboolean start_on_access)
-{
- herr_t retVal = -1;
- const char *lstr;
-
- PIN_JAVA_STRING(location, lstr);
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- retVal = H5Pset_mdc_log_options((hid_t)fapl_id, (hbool_t)is_enabled, lstr, (hbool_t)start_on_access);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_get_cb: failed to attach current thread to JVM");
+ }
- UNPIN_JAVA_STRING(location, lstr);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, get_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (retVal < 0) {
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_log_options
- * Signature: (J[Z)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
- (JNIEnv *env, jclass clss, jlong fapl_id, jbooleanArray mdc_log_options)
-{
- hbool_t is_enabled;
- hbool_t start_on_access;
- jboolean *mdc_log_options_ptr;
- char *lname;
- size_t location_size;
- ssize_t status;
- jstring str = NULL;
- jint size;
- jboolean isCopy;
-
- if (mdc_log_options == NULL) {
- h5nullArgument(env, "H5Fget_mdc_log_options: mdc_log_options is NULL");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR mdc_log_options);
- if (size < 2) {
- h5badArgument(env, "H5Fget_mdc_log_options: length of mdc_log_options < 2.");
- } /* end if */
- else {
- /* get the length of the filename */
- H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, NULL, &location_size, &start_on_access);
- if (location_size == 0) {
- h5badArgument(env, "H5Pget_mdc_log_options: location_size is 0");
- }/* end if */
- else if (location_size > 0) {
- location_size++; /* add extra space for the null terminator */
- lname = (char *)HDmalloc(sizeof(char) * location_size);
- if (lname == NULL) {
- h5outOfMemory(env, "H5Pget_mdc_log_options: malloc failed");
- } /* end if */
- else {
- status = H5Pget_mdc_log_options((hid_t)fapl_id, &is_enabled, lname, &location_size, &start_on_access);
-
- if (status < 0) {
- HDfree(lname);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR lname);
- HDfree(lname);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Pget_mdc_log_options: return string not allocated");
- } /* end if */
- else {
- mdc_log_options_ptr = ENVPTR->GetBooleanArrayElements(ENVPAR mdc_log_options, &isCopy);
- mdc_log_options_ptr[0] = (jboolean)is_enabled;
- mdc_log_options_ptr[1] = (jboolean)start_on_access;
- ENVPTR->ReleaseBooleanArrayElements(ENVPAR mdc_log_options, mdc_log_options_ptr, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else if*/
- } /* end else */
- } /* end else */
-
- return (jstring)str;
-} /* end if */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5D_append_cb
- (hid_t dataset_id, hsize_t *cur_dims, void *cb_data)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jlongArray cur_dimsArray;
- cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, get_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
+done:
+ if (cbenv)
JVMPTR->DetachCurrentThread(JVMPAR);
- return -1;
- } /* end if */
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(J[JLhdf/hdf5lib/callbacks/H5D_append_t;)I");
- if (mid != 0) {
- if (cur_dims != NULL) {
- cur_dimsArray = CBENVPTR->NewLongArray(CBENVPAR 2);
- if (cur_dimsArray != NULL) {
- CBENVPTR->SetLongArrayRegion(CBENVPAR cur_dimsArray, 0, 2, (const jlong *)cur_dims);
-
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, dataset_id, cur_dims, op_data);
- }
- }
- }
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5D_append_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_append_flush
- * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
- (JNIEnv *env, jclass clss, jlong plist_id, jint ndims, jlongArray boundary, jobject callback_op, jobject op_data)
-{
- herr_t status = -1;
- cb_wrapper wrapper = {callback_op, op_data};
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Pset_append_flush: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Pset_append_flush: callback_op is NULL");
- } /* end if */
- else {
- status = H5Pset_append_flush((hid_t)plist_id, (unsigned)ndims, (const hsize_t*)boundary, (H5D_append_cb_t)H5D_append_cb, (void*)&wrapper);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1append_1flush */
+} /* end H5P_prp_get_cb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class_nocb
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name)
+static herr_t
+H5P_prp_delete_cb
+ (hid_t prop_id, const char *name, size_t size, void *value)
{
- hid_t class_id = -1;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL);
-
- UNPIN_JAVA_STRING(name, cstr);
+ jmethodID mid;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if (class_id < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_delete_cb: failed to attach current thread to JVM");
}
- return (jlong)class_id;
-} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op,
- jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data)
-{
- hid_t class_id = -1;
- const char *cstr;
- copy_callback = copy_op;
- close_callback = close_op;
- create_callback = create_op;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void*) create_data,
- (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void*) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void*) close_data);
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, delete_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- UNPIN_JAVA_STRING(name, cstr);
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (class_id < 0)
- h5libraryError(env);
- }
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- return (jlong)class_id;
-} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */
+ status = CBENVPTR->CallIntMethod(CBENVONLY, delete_callback, mid, prop_id, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5P_prp_create_cb
- (const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_create_cb */
+} /* end H5P_prp_delete_cb */
static herr_t
H5P_prp_copy_cb
(const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_copy_cb */
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_copy_cb: failed to attach current thread to JVM");
+ }
-static herr_t
-H5P_prp_close_cb
- (const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, copy_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+ status = CBENVPTR->CallIntMethod(CBENVONLY, copy_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_close_cb */
+} /* end H5P_prp_copy_cb */
static int
H5P_prp_compare_cb
(void *value1, void *value2, size_t size)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR compare_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([B[BJ)I");
- if (mid != 0) {
- status = CBENVPTR->CallIntMethod(CBENVPAR compare_callback, mid, value1, value2, size);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_compare_cb */
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_compare_cb: failed to attach current thread to JVM");
+ }
-static herr_t
-H5P_prp_get_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, compare_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR get_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR get_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_get_cb */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "([B[BJ)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-static herr_t
-H5P_prp_set_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
-{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, compare_callback, mid, value1, value2, size);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR set_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR set_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
return (herr_t)status;
-} /* end H5P_prp_set_cb */
+} /* end H5P_prp_compare_cb */
static herr_t
-H5P_prp_delete_cb
- (hid_t prop_id, const char *name, size_t size, void *value)
+H5P_prp_close_cb
+ (const char *name, size_t size, void *value)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
jmethodID mid;
jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ jint status = -1;
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) {
- cls = CBENVPTR->GetObjectClass(CBENVPAR delete_callback);
- if (cls != 0) {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I");
- if (mid != 0) {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
- status = CBENVPTR->CallIntMethod(CBENVPAR delete_callback, mid, prop_id, str, size, value);
- } /* end if */
- } /* end if */
- } /* end if */
- JVMPTR->DetachCurrentThread(JVMPAR);
- return (herr_t)status;
-} /* end H5P_prp_delete_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pregister2: buf not pinned");
- } /* end if */
- else {
- status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void **)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_prp_close_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
- copy_callback = prp_copy;
- close_callback = prp_close;
- create_callback = prp_create;
- compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, close_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pregister2: buf not pinned");
- } /* end if */
- else {
- status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, (H5P_prp_create_func_t)H5P_prp_create_cb,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(Ljava/lang/String;J[B)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
-
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- h5JNIFatalError(env, "H5Pinsert2: buf not pinned");
- } /* end if */
- else {
- status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
+ status = CBENVPTR->CallIntMethod(CBENVONLY, close_callback, mid, str, size, value);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size,
- jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete,
- jobject prp_copy, jobject prp_cmp, jobject prp_close)
-{
- herr_t status = -1;
- jbyte *buffP;
- jboolean isCopy2;
- const char *cstr;
- copy_callback = prp_copy;
- close_callback = prp_close;
- compare_callback = prp_cmp;
- set_callback = prp_set;
- get_callback = prp_get;
- delete_callback = prp_delete;
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- PIN_JAVA_STRING(name, cstr);
- if (cstr != NULL) {
- buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2);
- if (buffP == NULL) {
- UNPIN_JAVA_STRING(name, cstr);
- h5JNIFatalError(env, "H5Pinsert2: buf not pinned");
- } /* end if */
- else {
- status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP,
- (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb,
- (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0);
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, cstr);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */
+ return (herr_t)status;
+} /* end H5P_prp_close_cb */
static herr_t
H5P_iterate_cb
(hid_t prop_id, const char *name, void *cb_data)
{
- JNIEnv *cbenv;
- jint status = -1;
- jclass cls;
- jmethodID mid;
- jstring str;
- cb_wrapper *wrapper = (cb_wrapper *)cb_data;
- void *op_data = (void *)wrapper->op_data;
- jobject visit_callback = wrapper->visit_callback;
-
- /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */
- if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: AttachCurrentThread failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback);
- if (cls == 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetObjectClass failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I");
- if (mid == 0) {
- /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetMethodID failed\n"); fflush(stderr); */
- JVMPTR->DetachCurrentThread(JVMPAR);
- } /* end if */
- else {
- str = CBENVPTR->NewStringUTF(CBENVPAR name);
-
- /* fprintf(stderr, "JNI H5P_iterate_cb execute\n"); fflush(stderr); */
- status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, prop_id, str, op_data);
- /* fprintf(stderr, "\nJNI H5P_iterate_cb status: %d\n", status); fflush(stderr); */
- } /* end else */
- } /* end else */
- } /* end else */
-
- JVMPTR->DetachCurrentThread(JVMPAR);
- /* fprintf(stderr, "\nJNI H5P_iterate_cb leave\n"); fflush(stderr); */
-
- return status;
-} /* end H5P_iterate_cb */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Piterate
- * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, jobject callback_op, jobject op_data)
-{
- herr_t status = -1;
- jint *theArray = NULL;
- jboolean isCopy;
- cb_wrapper wrapper = {callback_op, op_data};
-
- ENVPTR->GetJavaVM(ENVPAR &jvm);
-
- if (op_data == NULL) {
- h5nullArgument(env, "H5Piterate: op_data is NULL");
- } /* end if */
- else if (callback_op == NULL) {
- h5nullArgument(env, "H5Piterate: callback_op is NULL");
- } /* end else if */
- else {
- if (idx == NULL) {
- status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
- } /* end if */
- else {
- theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy);
- if (theArray == NULL) {
- h5JNIFatalError(env, "H5Piterate: idx not pinned");
- } /* end if */
- else
- status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)&wrapper);
- } /* end else */
-
- if (status < 0) {
- if(idx)
- ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else if (idx)
- ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, 0);
- } /* end else */
-
- return (jint)status;
-} /* end Java_hdf_hdf5lib_H5_H5Piterate */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_metadata_read_attempts
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id)
-{
- unsigned attempts;
- if (H5Pget_metadata_read_attempts((hid_t)plist_id, &attempts) < 0)
- h5libraryError(env);
-
- return (jlong) attempts;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_metadata_read_attempts
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
- (JNIEnv *env, jclass clss, jlong plist_id, jlong attempts)
-{
- if (attempts <= 0) {
- h5badArgument(env, "H5Pset_metadata_read_attempts: attempts <= 0");
- } /* end if */
- else {
- if(H5Pset_metadata_read_attempts((hid_t)plist_id, (unsigned)attempts) < 0)
- h5libraryError(env);
- } /* end else */
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts */
-
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_prefix
- * Signature: (JLjava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
-{
- herr_t retVal = -1;
- const char *aName;
-
- PIN_JAVA_STRING(prefix, aName);
- if (aName != NULL) {
- retVal = H5Pset_virtual_prefix((hid_t)dapl_id, aName);
-
- UNPIN_JAVA_STRING(prefix, aName);
-
- if(retVal < 0)
- h5libraryError(env);
- }
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_prefix
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- size_t size = 0;
- char *pre;
- jlong prefix_size = -1;
- jstring str = NULL;
-
- prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)NULL, size);
- if(prefix_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
- pre = (char*)HDmalloc(sizeof(char)*size);
- if (pre == NULL) {
- h5outOfMemory(env, "H5Pget_virtual_prefix: malloc failed ");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_virtual_prefix((hid_t)dapl_id, (char*)pre, size);
-
- if (prefix_size >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR pre);
- HDfree(pre);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_virtual_prefix: return string not allocated");
- } /* end if */
- else {
- HDfree(pre);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_efile_prefix
- * Signature: (JLjava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id, jstring prefix)
-{
- herr_t retVal = -1;
- const char *aName;
-
- PIN_JAVA_STRING(prefix, aName);
- if (aName != NULL) {
- retVal = H5Pset_efile_prefix((hid_t)dapl_id, aName);
-
- UNPIN_JAVA_STRING(prefix, aName);
+ cb_wrapper *wrapper = (cb_wrapper *) cb_data;
+ jmethodID mid;
+ jobject visit_callback = wrapper->visit_callback;
+ jstring str;
+ jclass cls;
+ JNIEnv *cbenv = NULL;
+ void *op_data = (void *) wrapper->op_data;
+ jint status = -1;
- if(retVal < 0)
- h5libraryError(env);
+ if (JVMPTR->AttachCurrentThread(JVMPAR, (void**)&cbenv, NULL) < 0) {
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(CBENVONLY, "H5P_iterate_cb: failed to attach current thread to JVM");
}
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_efile_prefix
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
- (JNIEnv *env, jclass clss, jlong dapl_id)
-{
- size_t size = 0;
- char *pre;
- jlong prefix_size = -1;
- jstring str = NULL;
-
- prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)NULL, size);
- if(prefix_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- size = (size_t)prefix_size + 1;/* add extra space for the null terminator */
- pre = (char*)HDmalloc(sizeof(char)*size);
- if (pre == NULL) {
- h5outOfMemory(env, "H5Pget_efile_prefix: malloc failed ");
- } /* end if */
- else {
- prefix_size = (jlong)H5Pget_efile_prefix((hid_t)dapl_id, (char*)pre, size);
-
- if (prefix_size >= 0) {
- str = ENVPTR->NewStringUTF(ENVPAR pre);
- HDfree(pre);
- if (str == NULL)
- h5JNIFatalError( env, "H5Pget_efile_prefix: return string not allocated");
- } /* end if */
- else {
- HDfree(pre);
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
-
- return (jstring)str;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_evict_on_close
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
- (JNIEnv *env, jclass clss, jlong fapl_id, jboolean evict_on_close)
-{
- herr_t retVal = -1;
- hbool_t evict_on_close_val;
- if (evict_on_close == JNI_TRUE)
- evict_on_close_val = TRUE;
- else
- evict_on_close_val = FALSE;
+ if (NULL == (cls = CBENVPTR->GetObjectClass(CBENVONLY, visit_callback)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- retVal = H5Pset_evict_on_close((hid_t)fapl_id, (hbool_t)evict_on_close_val);
- if (retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_evict_on_close
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
- (JNIEnv *env, jclass clss, jlong fapl_id)
-{
- hbool_t evict_on_close_val = FALSE;
- jboolean bval = JNI_FALSE;
-
- if (H5Pget_evict_on_close((hid_t)fapl_id, (hbool_t *)&evict_on_close_val) < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- if (evict_on_close_val == TRUE)
- bval = JNI_TRUE;
- } /* end else */
-
- return bval;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close */
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_opts
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
- (JNIEnv *env, jclass clss, jlong dcpl_id, jint opts)
-{
- herr_t retVal = -1;
+ if (NULL == (mid = CBENVPTR->GetMethodID(CBENVONLY, cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I")))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- retVal = H5Pset_chunk_opts((hid_t)dcpl_id, (unsigned)opts);
- if (retVal < 0)
- h5libraryError(env);
-} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts */
+ if (NULL == (str = CBENVPTR->NewStringUTF(CBENVONLY, name)))
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_opts
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
- (JNIEnv *env, jclass clss, jlong dcpl_id)
-{
- unsigned opts = 0;
+ status = CBENVPTR->CallIntMethod(CBENVONLY, visit_callback, mid, prop_id, str, op_data);
+ CHECK_JNI_EXCEPTION(CBENVONLY, JNI_FALSE);
- if (H5Pget_chunk_opts((hid_t)dcpl_id, opts) < 0)
- h5libraryError(env);
+done:
+ if (cbenv)
+ JVMPTR->DetachCurrentThread(JVMPAR);
- return (jint)opts;
-} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts */
+ return status;
+} /* end H5P_iterate_cb */
#ifdef __cplusplus
} /* end extern "C" */
diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h
index 1d12e3d..8318be4 100644
--- a/java/src/jni/h5pImp.h
+++ b/java/src/jni/h5pImp.h
@@ -11,12 +11,13 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <jni.h>
/* Header for class hdf_hdf5lib_H5_H5_H5P */
#ifndef _Included_hdf_hdf5lib_H5_H5P
#define _Included_hdf_hdf5lib_H5_H5P
+#include <jni.h>
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
@@ -32,15 +33,6 @@ Java_hdf_hdf5lib_H5__1H5Pcreate
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pclose
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5__1H5Pclose
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
* Method: H5Pget_class
* Signature: (J)J
*/
@@ -59,579 +51,74 @@ Java_hdf_hdf5lib_H5__1H5Pcopy
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_version
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1version
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_userblock
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1userblock
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_userblock
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1userblock
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sizes
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sizes
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sizes
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sizes
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sym_k
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sym_1k
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sym_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sym_1k
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_istore_k
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1istore_1k
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_istore_k
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1istore_1k
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_layout
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1layout
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_layout
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1layout
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk
- * Signature: (JI[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk
-(JNIEnv *, jclass, jlong, jint, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk
- * Signature: (JI[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk
-(JNIEnv *, jclass, jlong, jint, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alignment
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alignment
-(JNIEnv *, jclass, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alignment
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alignment
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_external
- * Signature: (JLjava/lang/String;JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1external
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external_count
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external_1count
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_external
- * Signature: (JIJ[Ljava/lang/String;[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1external
-(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_value
- * Signature: (JJ[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1value
-(JNIEnv *, jclass, jlong, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nfilters
+ * Method: H5Pclose
* Signature: (J)I
*/
JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nfilters
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_driver
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1driver
+Java_hdf_hdf5lib_H5__1H5Pclose
(JNIEnv *, jclass, jlong);
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_cache
- * Signature: (JIJJD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1cache
-(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_cache
- * Signature: (J[I[J[J[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1cache
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer
- * Signature: (JJ[B[B)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer
-(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer
- * Signature: (J[B[B)I
+ * TODO: H5Pencode
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer
-(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_buffer_size
- * Signature: (JJ)V
+ * TODO: H5Pdecode
*/
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size
-(JNIEnv *, jclass, jlong, jlong);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_buffer_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class
+ * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_preserve
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1preserve
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_preserve
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1preserve
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_deflate
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1deflate
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_gc_references
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1gc_1references
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_gc_references
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1gc_1references
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_btree_ratios
- * Signature: (JDDD)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_btree_ratios
- * Signature: (J[D[D[D)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios
-(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_small_data_block_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class
+ (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_small_data_block_size
- * Signature: (J)J
+ * Method: _H5Pcreate_class_nocb
+ * Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_alloc_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_alloc_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fill_time
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fill_1time
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fill_time
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fill_1time
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pfill_value_defined
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fletcher32
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fletcher32
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_edc_check
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1edc_1check
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_edc_check
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1edc_1check
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shuffle
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shuffle
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_szip
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1szip
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_hyper_vector_size
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_hyper_vector_size
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pall_filters_avail
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pmodify_filter
- * Signature: (JIIJ[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pmodify_1filter
-(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id
- * Signature: (JI[I[J[IJ[Ljava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fclose_degree
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fclose_degree
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_family
- * Signature: (JJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family
-(JNIEnv *, jclass, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_family
- * Signature: (J[J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_core
- * Signature: (JJZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core
-(JNIEnv *, jclass, jlong, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_core
- * Signature: (J[J[Z)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core
-(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray);
+Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
+ (JNIEnv*, jclass, jlong, jstring);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_family_offset
- * Signature: (JJ)I
+ * Method: H5Pregister2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1family_1offset
-(JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pget_family_offset
- * Signature: (J)J
+ * Method: H5Pregister2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1family_1offset
-(JNIEnv *, jclass, jlong);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_log
- * Signature: (JLjava/lang/String;JJ)V
+ * Method: H5Pinsert2
+ * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
*/
JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log
-(JNIEnv *, jclass, jlong, jstring, jlong, jlong);
+Java_hdf_hdf5lib_H5_H5Pinsert2
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject);
/*
* Class: hdf_hdf5lib_H5
- * Method: H5Premove_filter
- * Signature: (JI)I
+ * Method: H5Pinsert2_nocb
+ * Signature: (JLjava/lang/String;J[B)V
*/
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5P1remove_1filter
-(JNIEnv *, jclass, jlong, jint);
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
+ (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
/*
* Class: hdf_hdf5lib_H5
@@ -716,6 +203,15 @@ Java_hdf_hdf5lib_H5_H5Pequal
/*
* Class: hdf_hdf5lib_H5
+ * Method: H5Piterate
+ * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Piterate
+ (JNIEnv*, jclass, jlong, jintArray, jobject, jobject);
+
+/*
+ * Class: hdf_hdf5lib_H5
* Method: H5Pcopy_prop
* Signature: (JJLjava/lang/String;)I
*/
@@ -750,871 +246,6 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Pclose_1class
(JNIEnv *, jclass, jlong);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_filter_by_id2
- * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2
-(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_nlinks
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1nlinks
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nlinks
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nlinks
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_libver_bounds
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_libver_bounds
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_creation_order
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_creation_order
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_copy_object
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_copy_object
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_create_intermediate_group
- * Signature: (JZ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_create_intermediate_group
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_data_transform
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1data_1transform
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_data_transform
- * Signature: (J[Ljava/lang/String;J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1data_1transform
-(JNIEnv *, jclass, jlong, jobjectArray, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_acc_flags
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_acc_flags
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_link_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_link_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_attr_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_attr_phase_change
- * Signature: (JII)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_phase_change
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_phase_change
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_nindexes
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_nindexes
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_shared_mesg_index
- * Signature: (JIII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_shared_mesg_index
- * Signature: (JI[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index
-(JNIEnv *, jclass, jlong, jint, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_local_heap_size_hint
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_local_heap_size_hint
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_nbit
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1nbit
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_scaleoffset
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_est_link_info
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info
-(JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_est_link_info
- * Signature: (J[I)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info
-(JNIEnv *, jclass, jlong, jintArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_fapl
- * Signature: (JJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pget_elink_fapl
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_prefix
- * Signature: (JLjava/lang/String;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_prefix
- * Signature: (J[Ljava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
-(JNIEnv *, jclass, jlong, jobjectArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_direct
- * Signature: (JJJJ)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlong, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_direct
- * Signature: (J[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct
-(JNIEnv *, jclass, jlong, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_sec2
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_stdio
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_windows
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_muti
- * Signature: (J[I[J[Ljava/lang/String;[JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
-(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_fapl_split
- * Signature: (JLjava/lang/String;JLjava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split
-(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_meta_block_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_meta_block_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_sieve_buf_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_sieve_buf_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_elink_file_cache_size
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_elink_file_cache_size
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size
-(JNIEnv *, jclass, jlong);
-
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_config
- * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t;
- */
-JNIEXPORT jobject JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_config
- * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
-(JNIEnv *, jclass, jlong, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_cache
- * Signature: (JJJD)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlong, jlong, jdouble);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_cache
- * Signature: (J[J[J[D)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache
-(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_obj_track_times
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_obj_track_times
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_char_encoding
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_char_encoding
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual
- * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual
-(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_count
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_vspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_srcspace
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_filename
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_dsetname
- * Signature: (JJ)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_view
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_view
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_printf_gap
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_printf_gap
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy
- * Signature: (J[Z[J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jbooleanArray, jlongArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_persist
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1persist
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_strategy_threshold
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1strategy_1threshold
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_strategy
- * Signature: (JIZJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1strategy
-(JNIEnv *, jclass, jlong, jint, jboolean, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_file_space_page_size
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_file_space_page_size
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1file_1space_1page_1size
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_mdc_log_options
- * Signature: (JZLjava/lang/String;Z)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jboolean, jstring, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_mdc_log_options
- * Signature: (J[Z)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1mdc_1log_1options
-(JNIEnv *, jclass, jlong, jbooleanArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_append_flush
- * Signature: (JI[JLjava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1append_1flush
- (JNIEnv*, jclass, jlong, jint, jlongArray, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class_nocb
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb
- (JNIEnv*, jclass, jlong, jstring);
-/*
- * Class: hdf_hdf5lib_H5
- * Method: _H5Pcreate_class
- * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5__1H5Pcreate_1class
- (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pregister2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pregister2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2_nocb
- * Signature: (JLjava/lang/String;J[B)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pinsert2
- * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pinsert2
- (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Piterate
- * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Piterate
- (JNIEnv*, jclass, jlong, jintArray, jobject, jobject);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_metadata_read_attempts
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_metadata_read_attempts
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1metadata_1read_1attempts
-(JNIEnv *, jclass, jlong, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_virtual_prefix
- * Signature: (JLjava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1virtual_1prefix
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_virtual_prefix
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1virtual_1prefix
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_efile_prefix
- * Signature: (JLjava/lang/String;)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1efile_1prefix
-(JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_efile_prefix
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1efile_1prefix
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_evict_on_close
- * Signature: (JZ)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1evict_1on_1close
-(JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_evict_on_close
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1evict_1on_1close
-(JNIEnv *, jclass, jlong);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pset_chunk_opts
- * Signature: (JI)V
- */
-JNIEXPORT void JNICALL
-Java_hdf_hdf5lib_H5_H5Pset_1chunk_1opts
-(JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: hdf_hdf5lib_H5
- * Method: H5Pget_chunk_opts
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_hdf_hdf5lib_H5_H5Pget_1chunk_1opts
-(JNIEnv *, jclass, jlong);
-
-
#ifdef __cplusplus
} /* end extern "C" */
#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLAPLImp.c b/java/src/jni/h5pLAPLImp.c
new file mode 100644
index 0000000..f2cb80a
--- /dev/null
+++ b/java/src/jni/h5pLAPLImp.c
@@ -0,0 +1,240 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pLAPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nlinks
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nlinks
+ (JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (nlinks <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Pset_nlinks: nlinks <= 0");
+
+ if ((retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nlinks
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nlinks
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ size_t nlinks = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong) nlinks;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */
+
+/*
+ * TODO: H5Pset_elink_cb
+ */
+
+/*
+ * TODO: H5Pget_elink_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_prefix
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
+ (JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix)
+{
+ const char *linkPrefix = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pset_elink_prefix: prefix is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, prefix, linkPrefix, NULL, "H5Pset_elink_prefix: link prefix not pinned");
+
+ if ((retVal = H5Pset_elink_prefix((hid_t)lapl_id, linkPrefix)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (linkPrefix)
+ UNPIN_JAVA_STRING(ENVONLY, prefix, linkPrefix);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_prefix
+ * Signature: (J[Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
+ (JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix)
+{
+ ssize_t prefix_size = -1;
+ size_t size = 0;
+ char *pre = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
+
+ if (NULL == prefix)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_elink_prefix: prefix is NULL");
+
+ if ((prefix_size = H5Pget_elink_prefix((hid_t)lapl_id, (char *)NULL, size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (pre = (char *) HDmalloc(sizeof(char) * (size_t) prefix_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_elink_prefix: memory allocation failed");
+
+ if (H5Pget_elink_prefix((hid_t)lapl_id, (char *)pre, (size_t) prefix_size + 1) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ pre[prefix_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, pre))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Pget_elink_prefix: out of memory - unable to construct string from UTF characters");
+ }
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, prefix, 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (pre)
+ HDfree(pre);
+
+ return (jlong)prefix_size;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_fapl
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
+ (JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Pget_elink_fapl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pget_elink_fapl((hid_t)lapl_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jlong)retVal;
+} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_acc_flags
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
+ (JNIEnv *env, jclass clss, jlong lapl_id, jint flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint) retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_acc_flags
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
+ (JNIEnv *env, jclass clss, jlong lapl_id)
+{
+ unsigned flags;
+
+ UNUSED(clss);
+
+ if (H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLAPLImp.h b/java/src/jni/h5pLAPLImp.h
new file mode 100644
index 0000000..8efcfb5
--- /dev/null
+++ b/java/src/jni/h5pLAPLImp.h
@@ -0,0 +1,107 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PLAPL
+#define _Included_hdf_hdf5lib_H5_H5PLAPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_nlinks
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1nlinks
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_nlinks
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1nlinks
+(JNIEnv *, jclass, jlong);
+
+/*
+ * TODO: H5Pset_elink_cb
+ */
+
+/*
+ * TODO: H5Pget_elink_cb
+ */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_prefix
+ * Signature: (JLjava/lang/String;)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix
+(JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_prefix
+ * Signature: (J[Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix
+(JNIEnv *, jclass, jlong, jobjectArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_fapl
+ * Signature: (JJ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl
+(JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: _H5Pget_elink_fapl
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL
+Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_elink_acc_flags
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_elink_acc_flags
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PLAPL */
diff --git a/src/H5B2public.h b/java/src/jni/h5pLCPLImp.c
index 6e0b964..7c79796 100644
--- a/src/H5B2public.h
+++ b/java/src/jni/h5pLCPLImp.c
@@ -11,42 +11,26 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
*
- * Created: H5B2public.h
- * Jan 31 2005
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the v2 B-tree package.
- *
- *-------------------------------------------------------------------------
*/
-#ifndef _H5B2public_H
-#define _H5B2public_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
-#ifdef __cplusplus
-}
-#endif
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pLCPLImp.h"
-#endif /* _H5B2public_H */
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pLCPLImp.h b/java/src/jni/h5pLCPLImp.h
new file mode 100644
index 0000000..009d1b4
--- /dev/null
+++ b/java/src/jni/h5pLCPLImp.h
@@ -0,0 +1,27 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PLCPL
+#define _Included_hdf_hdf5lib_H5_H5PLCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PLCPL */
diff --git a/java/src/jni/h5pOCPLImp.c b/java/src/jni/h5pOCPLImp.c
new file mode 100644
index 0000000..241842e
--- /dev/null
+++ b/java/src/jni/h5pOCPLImp.c
@@ -0,0 +1,211 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pOCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_create_intermediate_group
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
+ (JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_create_intermediate_group
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
+ (JNIEnv *env, jclass clss, jlong lcpl_id)
+{
+ unsigned crt_intermed_group = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jboolean)crt_intermed_group;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_obj_track_times
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
+ (JNIEnv *env, jclass clss, jlong objplid, jboolean track_times)
+{
+ hbool_t track = FALSE;
+
+ UNUSED(clss);
+
+ track = (JNI_TRUE == track_times) ? 1 : 0;
+
+ if (H5Pset_obj_track_times((hid_t)objplid, track) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_obj_track_times
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
+ (JNIEnv *env, jclass clss, jlong objplid)
+{
+ hbool_t track_times = FALSE;
+ jboolean retVal = JNI_FALSE;
+
+ UNUSED(clss);
+
+ if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ retVal = (track_times == TRUE) ? JNI_TRUE : JNI_FALSE;
+
+done:
+ return retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_phase_change
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes)
+{
+ jboolean isCopy;
+ jint *theArray = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == attributes)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Pget_attr_phase_change: attributes is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, attributes, theArray, &isCopy, "H5Pget_attr_phase_change: input not pinned");
+
+ if ((retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (theArray)
+ UNPIN_INT_ARRAY(ENVONLY, attributes, theArray, (retVal < 0) ? JNI_ABORT : 0);
+
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
+ (JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
+ (JNIEnv *env, jclass clss, jlong ocpl_id)
+{
+ unsigned crt_order_flags = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)crt_order_flags;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pOCPLImp.h b/java/src/jni/h5pOCPLImp.h
new file mode 100644
index 0000000..fe01f06
--- /dev/null
+++ b/java/src/jni/h5pOCPLImp.h
@@ -0,0 +1,99 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5POCPL
+#define _Included_hdf_hdf5lib_H5_H5POCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_create_intermediate_group
+ * Signature: (JZ)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_create_intermediate_group
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_obj_track_times
+ * Signature: (JZ)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times
+(JNIEnv *, jclass, jlong, jboolean);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_obj_track_times
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times
+(JNIEnv *, jclass, jlong);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_phase_change
+ * Signature: (JII)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change
+(JNIEnv *, jclass, jlong, jint, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_phase_change
+ * Signature: (J[I)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change
+(JNIEnv *, jclass, jlong, jintArray);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_attr_creation_order
+ * Signature: (JI)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_attr_creation_order
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5POCPL */
diff --git a/java/src/jni/h5pOCpyPLImp.c b/java/src/jni/h5pOCpyPLImp.c
new file mode 100644
index 0000000..9481f91
--- /dev/null
+++ b/java/src/jni/h5pOCpyPLImp.c
@@ -0,0 +1,92 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pOCpyPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_copy_object
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
+ (JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options)
+{
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
+
+ if ((retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_copy_object
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
+ (JNIEnv *env, jclass clss, jlong ocp_plist_id)
+{
+ unsigned copy_options = 0;
+
+ UNUSED(clss);
+
+ if (H5Pget_copy_object((hid_t)ocp_plist_id, &copy_options) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)copy_options;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */
+
+/*
+ * TODO: H5Padd_merge_committed_dtype_path
+ */
+
+/*
+ * TODO: H5Pfree_merge_committed_dtype_paths
+ */
+
+/*
+ * TODO: H5Pset_mcdt_search_cb
+ */
+
+/*
+ * TODO: H5Pget_mcdt_search_cb
+ */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/src/H5FSpublic.h b/java/src/jni/h5pOCpyPLImp.h
index 3090d0d..f1dca58 100644
--- a/src/H5FSpublic.h
+++ b/java/src/jni/h5pOCpyPLImp.h
@@ -11,42 +11,51 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/*-------------------------------------------------------------------------
- *
- * Created: H5FSpublic.h
- * May 2 2006
- * Quincey Koziol <koziol@hdfgroup.org>
- *
- * Purpose: Public declarations for the file free space package.
- *
- *-------------------------------------------------------------------------
- */
+#ifndef _Included_hdf_hdf5lib_H5_H5POCpyPL
+#define _Included_hdf_hdf5lib_H5_H5POCpyPL
-#ifndef _H5FSpublic_H
-#define _H5FSpublic_H
+#include <jni.h>
-/* Public headers needed by this file */
-#include "H5public.h"
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
-/*****************/
-/* Public Macros */
-/*****************/
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_copy_object
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1copy_1object
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_copy_object
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1copy_1object
+(JNIEnv *, jclass, jlong);
-/*******************/
-/* Public Typedefs */
-/*******************/
+/*
+ * TODO: H5Padd_merge_committed_dtype_path
+ */
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
+/*
+ * TODO: H5Pfree_merge_committed_dtype_paths
+ */
-#ifdef __cplusplus
-extern "C" {
-#endif
+/*
+ * TODO: H5Pset_mcdt_search_cb
+ */
-#ifdef __cplusplus
-}
-#endif
+/*
+ * TODO: H5Pget_mcdt_search_cb
+ */
-#endif /* _H5FSpublic_H */
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+#endif /* _Included_hdf_hdf5lib_H5_H5POCpyPL */
diff --git a/java/src/jni/h5pStrCPLImp.c b/java/src/jni/h5pStrCPLImp.c
new file mode 100644
index 0000000..e69847d
--- /dev/null
+++ b/java/src/jni/h5pStrCPLImp.c
@@ -0,0 +1,74 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * For details of the HDF libraries, see the HDF Documentation at:
+ * http://hdfgroup.org/HDF5/doc/
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+#include <stdlib.h>
+#include "hdf5.h"
+#include "h5jni.h"
+#include "h5pStrCPLImp.h"
+
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_char_encoding
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
+ (JNIEnv *env, jclass clss, jlong acpl, jint encoding)
+{
+ UNUSED(clss);
+
+ if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
+} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_char_encoding
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
+ (JNIEnv *env, jclass clss, jlong acpl)
+{
+ H5T_cset_t encoding = H5T_CSET_ERROR;
+
+ UNUSED(clss);
+
+ if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return encoding;
+} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
diff --git a/java/src/jni/h5pStrCPLImp.h b/java/src/jni/h5pStrCPLImp.h
new file mode 100644
index 0000000..6e140d3
--- /dev/null
+++ b/java/src/jni/h5pStrCPLImp.h
@@ -0,0 +1,45 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+#ifndef _Included_hdf_hdf5lib_H5_H5PStrCPL
+#define _Included_hdf_hdf5lib_H5_H5PStrCPL
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pset_char_encoding
+ * Signature: (JI)V
+ */
+JNIEXPORT void JNICALL
+Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding
+(JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: hdf_hdf5lib_H5
+ * Method: H5Pget_char_encoding
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL
+Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding
+(JNIEnv *, jclass, jlong);
+
+#ifdef __cplusplus
+} /* end extern "C" */
+#endif /* __cplusplus */
+
+#endif /* _Included_hdf_hdf5lib_H5_H5PStrCPL */
diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c
index d551120..90d78fe 100644
--- a/java/src/jni/h5plImp.c
+++ b/java/src/jni/h5plImp.c
@@ -26,7 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5plImp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -37,9 +40,13 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLset_1loading_1state
(JNIEnv *env, jclass clss, jint plugin_flags)
{
- if (H5PLset_loading_state((unsigned int)plugin_flags) < 0) {
- h5libraryError(env);
- }
+ UNUSED(clss);
+
+ if (H5PLset_loading_state((unsigned int)plugin_flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5PLset_1loading_1state */
/*
@@ -52,9 +59,13 @@ Java_hdf_hdf5lib_H5_H5PLget_1loading_1state
(JNIEnv *env, jclass clss)
{
unsigned int plugin_type = 0;
- if (H5PLget_loading_state(&plugin_type) < 0) {
- h5libraryError(env);
- }
+
+ UNUSED(clss);
+
+ if (H5PLget_loading_state(&plugin_type) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)plugin_type;
} /* end Java_hdf_hdf5lib_H5_H5PLget_1loading_1state */
@@ -67,18 +78,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLappend
(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLappend(aName);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLappend: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLappend: new path not pinned");
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5PLappend(newPath)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLappend */
/*
* Class: hdf_hdf5lib_H5
@@ -89,18 +104,22 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLprepend
(JNIEnv *env, jclass clss, jobjectArray plugin_path)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLprepend(aName);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLprepend: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLprepend: new path not pinned");
- if (retVal < 0)
- h5libraryError(env);
- }
+ if ((retVal = H5PLprepend(newPath)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLprepend */
/*
@@ -112,18 +131,25 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLreplace
(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLreplace(aName, index);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ if (index < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLreplace: index < 0");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLreplace: new path not pinned");
+
+ if ((retVal = H5PLreplace(newPath, (unsigned) index)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLreplace */
/*
@@ -135,18 +161,25 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLinsert
(JNIEnv *env, jclass clss, jobjectArray plugin_path, jint index)
{
- const char *aName;
- herr_t retVal = -1;
+ const char *newPath = NULL;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- PIN_JAVA_STRING(plugin_path, aName);
- if (aName != NULL) {
- retVal = H5PLinsert(aName, index);
+ if (NULL == plugin_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: new path is NULL");
- UNPIN_JAVA_STRING(plugin_path, aName);
+ if (index < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLinsert: index < 0");
- if (retVal < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, plugin_path, newPath, NULL, "H5PLinsert: new path not pinned");
+
+ if ((retVal = H5PLinsert(newPath, (unsigned) index)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (newPath)
+ UNPIN_JAVA_STRING(ENVONLY, plugin_path, newPath);
} /* end Java_hdf_hdf5lib_H5_H5PLinsert */
/*
@@ -158,8 +191,16 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5PLremove
(JNIEnv *env, jclass clss, jint index)
{
- if (H5PLremove(index) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (index < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLremove: index < 0");
+
+ if (H5PLremove((unsigned) index) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5PLremove */
/*
@@ -171,33 +212,33 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5PLget
(JNIEnv *env, jclass clss, jint index)
{
- char *aName;
jstring str = NULL;
ssize_t buf_size;
+ char *aName = NULL;
+
+ UNUSED(clss);
+
+ if (index < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5PLget: index < 0");
+
+ /* Get the length of the name */
+ if ((buf_size = H5PLget((unsigned) index, NULL, 0)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)buf_size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5PLget: failed to allocate plugin name buffer");
+
+ if ((H5PLget((unsigned) index, aName, (size_t)buf_size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[buf_size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
- /* get the length of the name */
- buf_size = H5PLget(index, NULL, 0);
-
- if (buf_size <= 0) {
- h5badArgument(env, "H5PLget: buf_size <= 0");
- } /* end if */
- else {
- buf_size++; /* add extra space for the null terminator */
- aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size);
- if (aName == NULL) {
- h5outOfMemory(env, "H5PLget: malloc failed");
- } /* end if */
- else {
- buf_size = H5PLget(index, aName, (size_t)buf_size);
- if (buf_size < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- }
- HDfree(aName);
- }
- }
return str;
} /* end Java_hdf_hdf5lib_H5_H5PLget */
@@ -211,9 +252,13 @@ Java_hdf_hdf5lib_H5_H5PLsize
(JNIEnv *env, jclass clss)
{
unsigned int listsize = 0;
- if (H5PLsize(&listsize) < 0) {
- h5libraryError(env);
- }
+
+ UNUSED(clss);
+
+ if (H5PLsize(&listsize) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)listsize;
} /* end Java_hdf_hdf5lib_H5_H5PLsize */
diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c
index 5f2b86d..1a77fd3 100644
--- a/java/src/jni/h5rImp.c
+++ b/java/src/jni/h5rImp.c
@@ -26,8 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5rImp.h"
-extern JavaVM *jvm;
-
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -38,47 +40,44 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rcreate
(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id)
{
- const char *rName;
- herr_t status = -1;
- jbyte *refP;
- jboolean isCopy2;
-
- PIN_JAVA_STRING(name, rName);
- if (rName != NULL) {
- if (ref == NULL) {
- h5nullArgument( env, "H5Rcreate: ref is NULL");
- } /* end if */
- else {
- if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end if */
- else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rcreate: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else if ((ref_type != H5R_OBJECT) && (ref_type != H5R_DATASET_REGION)) {
- h5badArgument( env, "H5Rcreate: ref_type unknown type ");
- } /* end else if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rcreate: ref not pinned");
- } /* end if */
- else {
- status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- UNPIN_JAVA_STRING(name, rName);
+ const char *refName = NULL;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: name is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: ref array length < 0");
}
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: reference input array length != H5R_OBJ_REF_BUF_SIZE")
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE")
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rcreate: unknown reference type");
+
+ PIN_JAVA_STRING(ENVONLY, name, refName, NULL, "H5Rcreate: reference name not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rcreate: reference buffer not pinned");
+
+ if ((status = H5Rcreate(refBuf, (hid_t)loc_id, refName, (H5R_type_t)ref_type, (hid_t)space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (status < 0) ? JNI_ABORT : 0);
+ if (refName)
+ UNPIN_JAVA_STRING(ENVONLY, name, refName);
+
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Rcreate */
@@ -91,33 +90,36 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Rdereference
(JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref)
{
- jboolean isCopy;
- jbyte *refP;
- hid_t retVal = -1;
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rdereference: ref is NULL");
- } /* end if */
- else if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rdereference: obj ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end else if */
- else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rdereference: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rderefernce: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: ref array length < 0");
+ }
+
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: reference input array length != H5R_OBJ_REF_BUF_SIZE")
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE")
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rdereference: unknown reference type");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rderefernce: reference buffer not pinned");
+
+ if ((retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Rdereference */
@@ -131,33 +133,34 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Rget_1region
(JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref)
{
- hid_t retVal = -1;
- jboolean isCopy;
- jbyte *refP;
-
- if (ref_type != H5R_DATASET_REGION) {
- h5badArgument( env, "H5Rget_region: bad ref_type ");
- } /* end if */
- else if (ref == NULL) {
- h5nullArgument( env, "H5Rget_region: ref is NULL");
- } /* end if */
- else if ( ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument( env, "H5Rget_region: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_region: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ jsize refBufLen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (H5R_DATASET_REGION != ref_type)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: bad reference type");
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: ref array length < 0");
+ }
+
+ if (refBufLen != H5R_DSET_REG_REF_BUF_SIZE)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_region: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_region: reference buffer not pinned");
+
+ if ((retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Rget_1region */
@@ -171,31 +174,27 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1obj_1type
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref)
{
- int retVal =-1;
- jboolean isCopy;
- jbyte *refP;
- H5O_type_t object_info;
-
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref is NULL");
- } /* end if */
- else {
- refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_object_type: ref not pinned");
- } /* end if */
- else {
- retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, &object_info);
- if(retVal >= 0)
- retVal = object_info;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ H5O_type_t object_info;
+ jboolean isCopy;
+ jbyte *refBuf = NULL;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
+
+ if ((retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, &object_info)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (retVal >= 0)
+ retVal = object_info;
+
+done:
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, (retVal < 0) ? JNI_ABORT : 0);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type */
@@ -209,46 +208,33 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj)
{
+ jboolean isCopy, isCopy2;
+ jbyte *refBuf = NULL;
+ jint *ref_objP = NULL;
+ jint status = -1;
+ int retVal = -1;
+
+ UNUSED(clss);
+
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference buffer is NULL");
+ if (NULL == ref_obj)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_obj_type: reference object is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_obj_type: reference buffer not pinned");
- jint status;
- jboolean isCopy;
- jbyte *refP;
- jint *ref_objP;
- int retVal = -1;
-
-
- if (ref == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref is NULL");
- } /* end if */
- else if (ref_obj == NULL) {
- h5nullArgument( env, "H5Rget_object_type: ref_obj is NULL");
- } /* end else if */
- else {
- refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_object_type: ref not pinned");
- } /* end if */
- else {
- ref_objP = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ref_obj, &isCopy);
- if (ref_objP == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref,refP,0);
- h5JNIFatalError(env, "H5Rget_object_type: ref_obj not pinned");
- } /* end if */
- else {
- status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, (H5O_type_t*)ref_objP);
- retVal = ref_objP[0];
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj,ref_objP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj, ref_objP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ PIN_INT_ARRAY(ENVONLY, ref_obj, ref_objP, &isCopy2, "H5Rget_obj_type: reference object array not pinned");
+
+ if ((status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, (H5O_type_t *)ref_objP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ retVal = ref_objP[0];
+
+done:
+ if (ref_objP)
+ UNPIN_INT_ARRAY(ENVONLY, ref_obj, ref_objP, (status < 0) ? JNI_ABORT : 0);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 */
@@ -262,57 +248,52 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Rget_1name
(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size)
{
- jlong ret_val = -1;
- jbyte *refP;
- jboolean isCopy;
- char *aName = NULL;
- jstring str;
- size_t bs;
-
- bs = (size_t)size;
- if (bs <= 0) {
- h5badArgument(env, "H5Rget_name: size <= 0");
- } /* end if */
- else if (ref == NULL) {
- h5nullArgument(env, "H5Rget_name: ref is NULL");
- } /* end else if */
- else {
- if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) {
- h5badArgument(env, "H5Rget_name: obj ref input array != H5R_OBJ_REF_BUF_SIZE");
- } /* end if */
- else if ((ref_type == H5R_DATASET_REGION)
- && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) {
- h5badArgument(env, "H5Rget_name: region ref input array != H5R_DSET_REG_REF_BUF_SIZE");
- } /* end else if */
- else {
- refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy);
- if (refP == NULL) {
- h5JNIFatalError(env, "H5Rget_name: ref not pinned");
- } /* end if */
- else {
- aName = (char*)HDmalloc(sizeof(char)*bs);
- if (aName == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- h5outOfMemory(env, "H5Rget_name: malloc failed");
- } /* end if */
- else {
- ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refP, aName, bs) ;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT);
- if (ret_val < 0) {
- HDfree(aName);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR aName);
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str);
-
- HDfree(aName);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str;
+ jsize refBufLen;
+ jbyte *refBuf = NULL;
+ char *aName = NULL;
+ jlong ret_val = -1;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: size <= 0");
+ if (NULL == ref)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference buffer is NULL");
+
+ if ((refBufLen = ENVPTR->GetArrayLength(ENVONLY, ref)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: ref array length < 0");
+ }
+
+ if ((H5R_OBJECT == ref_type) && (refBufLen != H5R_OBJ_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: reference input array length != H5R_OBJ_REF_BUF_SIZE")
+ else if ((H5R_DATASET_REGION == ref_type) && (refBufLen != H5R_DSET_REG_REF_BUF_SIZE))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: region reference input array length != H5R_DSET_REG_REF_BUF_SIZE")
+ else if ((H5R_OBJECT != ref_type) && (H5R_DATASET_REGION != ref_type))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Rget_name: unknown reference type");
+
+ PIN_BYTE_ARRAY(ENVONLY, ref, refBuf, &isCopy, "H5Rget_name: reference buffer not pinned");
+
+ if (NULL == (aName = (char *) HDmalloc(sizeof(char) * (size_t)size + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Rget_name: failed to allocate referenced object name buffer");
+
+ if ((ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refBuf, aName, (size_t)size + 1)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ aName[(size_t)size] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, aName)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, (jsize) 0, str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (aName)
+ HDfree(aName);
+ if (refBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, ref, refBuf, JNI_ABORT);
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Rget_1name */
diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c
index 65cdd7b..087cda8 100644
--- a/java/src/jni/h5sImp.c
+++ b/java/src/jni/h5sImp.c
@@ -26,7 +26,10 @@ extern "C" {
#include "h5jni.h"
#include "h5sImp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -37,12 +40,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Screate
(JNIEnv *env, jclass clss, jint type)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Screate((H5S_class_t) type);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Screate((H5S_class_t) type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Screate */
@@ -55,98 +60,83 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Screate_1simple
(JNIEnv *env, jclass clss, jint rank, jlongArray dims, jlongArray maxdims)
{
- hid_t retVal = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa = NULL;
- hsize_t *msa = NULL;
- int i;
- int drank, mrank;
- hsize_t *lp;
- jlong *jlp;
-
- if (rank < 0) {
- h5badArgument(env, "H5Screate_simple: rank is invalid");
- } /* end if */
- else if (dims == NULL) {
- h5nullArgument(env, "H5Screate_simple: dims is NULL");
- } /* end else if */
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ jlong *jlp = NULL;
+ jsize drank = 0, mrank = 0;
+ int i;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (rank < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: rank is invalid");
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims is NULL");
+
+ if ((drank = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims array length < 0");
+ }
+
+ if (drank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: dims rank is invalid");
+
+ if (NULL != maxdims) {
+ if ((mrank = ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: maxdims array length < 0");
+ }
+
+ if (mrank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Screate_simple: maxdims rank is invalid");
+ }
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Screate_simple: dims not pinned");
+
+ if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate dims buffer")
+
+ jlp = (jlong *) dimsP;
+ for (i = 0; i < rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
+ } /* end for */
+
+ if (NULL == maxdims) {
+ maxdimsP = NULL;
+ msa = (hsize_t *)maxdimsP;
+ }
else {
- drank = (int)ENVPTR->GetArrayLength(ENVPAR dims);
- if (drank != rank) {
- h5badArgument(env, "H5Screate_simple: dims rank is invalid");
- return -1;
- } /* end if */
- if (maxdims != NULL) {
- mrank = (int)ENVPTR->GetArrayLength(ENVPAR maxdims);
- if (mrank != rank) {
- h5badArgument(env, "H5Screate_simple: maxdims rank is invalid");
- return -1;
- } /* end if */
- } /* end if */
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Screate_simple: dims not pinned");
- return -1;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Screate_simple: maxdims not pinned");
- sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t");
- return -1;
- } /* end if */
+ if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Screate_simple: failed to allocate maxdims buffer")
- jlp = (jlong *) dimsP;
- for (i = 0; i < rank; i++) {
+ jlp = (jlong *) maxdimsP;
+ for (i = 0; i < mrank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
+ }
- if (maxdims == NULL) {
- maxdimsP = NULL;
- msa = (hsize_t *)maxdimsP;
- } /* end if */
- else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Screate_simple: maxdims not pinned");
- return -1;
- } /* end if */
- msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *)maxdimsP;
- for (i = 0; i < mrank; i++) {
- *lp = (hsize_t)*jlp;
- lp++;
- jlp++;
- } /* end for */
- } /* end else */
-
- retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa);
-
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- if (msa)
- HDfree(msa);
- } /* end if */
+ if ((retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- if (sa)
- HDfree(sa);
-
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
+done:
+ if (msa)
+ HDfree(msa);
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Screate_1simple */
@@ -160,12 +150,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Scopy
(JNIEnv *env, jclass clss, jlong space_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Scopy(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Scopy(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Scopy */
@@ -185,41 +177,37 @@ Java_hdf_hdf5lib_H5__1H5Scopy
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coord)
+ (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coords)
{
- herr_t status = -1;
- jint i;
- jlong *P;
- jboolean isCopy;
- hssize_t *sa;
- int rank;
-
- if (coord == NULL) {
- h5nullArgument( env, "H5Sselect_elements: coord is NULL");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hssize_t *sa = NULL;
+ jlong *P = NULL;
+ jint i;
+ int rank;
+ herr_t status = FAIL;
- P = ENVPTR->GetLongArrayElements(ENVPAR env,coord,&isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Sselect_elements: coord not pinned");
- return -1;
- } /* end if */
- sa = (hssize_t *)HDmalloc( (size_t)num_elems * 2 * sizeof(hssize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR env,coord,P,JNI_ABORT);
- h5JNIFatalError(env, "H5Sselect_elements: coord array not converted to hssize_t");
- return -1;
- } /* end if */
- for (i= 0; i < (num_elsms * 2); i++) {
+ UNUSED(clss);
+
+ if (NULL == coords)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned");
+
+ if (NULL == (sa = (hssize_t *) HDmalloc( (size_t)num_elemn * 2 * sizeof(hssize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+
+ for (i = 0; i < (num_elemn * 2); i++) {
sa[i] = P[i];
} /* end for */
- status = H5Sselect_elements (space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR env, coord, P, JNI_ABORT);
- HDfree(sa);
+ if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (sa)
+ HDfree(sa);
+ if (P)
+ UNPIN_LONG_ARRAY(ENVONLY, coords, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */
@@ -232,49 +220,51 @@ Java_hdf_hdf5lib_H5_H5Sselect_1elements
*/
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1elements
- (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coord)
+ (JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jbyteArray coords)
{
- int ii;
- hsize_t *lp = NULL;
- hsize_t *llp;
- jlong *jlp;
- herr_t status = -1;
- jbyte *P;
- jboolean isCopy;
- jsize size;
- int nlongs;
-
- if (coord == NULL) {
- h5nullArgument(env, "H5Sselect_elements: coord is NULL");
- } /* end if */
- else {
- P = ENVPTR->GetByteArrayElements(ENVPAR coord, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Sselect_elements: coord not pinned");
- } /* end if */
- else {
- size = (int)ENVPTR->GetArrayLength(ENVPAR coord);
- nlongs = (int)((size_t)size / sizeof(jlong));
- lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t));
- jlp = (jlong *) P;
- llp = lp;
- for (ii = 0; ii < nlongs; ii++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end for */
-
- status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR coord, P, JNI_ABORT);
-
- if (llp)
- HDfree(llp);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *lp = NULL;
+ hsize_t *llp = NULL;
+ jlong *jlp = NULL;
+ jbyte *P = NULL;
+ jsize size;
+ int ii;
+ int nlongs;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == coords)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, coords, P, &isCopy, "H5Sselect_elements: coords not pinned");
+
+ if ((size = ENVPTR->GetArrayLength(ENVONLY, coords)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_elements: coords array length < 0");
+ }
+
+ nlongs = (int)((size_t)size / sizeof(jlong));
+
+ if (NULL == (lp = (hsize_t *) HDmalloc((size_t)nlongs * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_elements: failed to allocate coordinate buffer");
+
+ jlp = (jlong *) P;
+ llp = lp;
+ for (ii = 0; ii < nlongs; ii++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
+ } /* end for */
+
+ if ((status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (llp)
+ HDfree(llp);
+ if (P)
+ UNPIN_BYTE_ARRAY(ENVONLY, coords, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */
@@ -288,12 +278,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1all
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sselect_all(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sselect_all(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */
@@ -306,12 +298,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1none
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Sselect_none(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sselect_none(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */
@@ -326,12 +320,14 @@ Java_hdf_hdf5lib_H5_H5Sselect_1valid
{
htri_t bval = JNI_FALSE;
- bval = H5Sselect_valid(space_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Sselect_valid(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1valid */
@@ -344,11 +340,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints
(JNIEnv *env, jclass clss, jlong space_id)
{
- hssize_t retVal = H5Sget_simple_extent_npoints(space_id);
+ hssize_t retVal = -1;
+
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sget_simple_extent_npoints(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */
@@ -361,11 +360,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints
(JNIEnv *env, jclass clss, jlong space_id)
{
- hssize_t retVal = H5Sget_select_npoints(space_id);
+ hssize_t retVal = -1;
+
+ UNUSED(clss);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sget_select_npoints(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */
@@ -380,10 +382,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1type
{
int retVal = -1;
- retVal = H5Sget_select_type(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5S_SEL_ERROR == (retVal = H5Sget_select_type(space_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */
@@ -398,10 +402,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims
{
int retVal = -1;
- retVal = H5Sget_simple_extent_ndims(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint) retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */
@@ -414,100 +420,78 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims
(JNIEnv *env, jclass clss, jlong space_id, jlongArray dims, jlongArray maxdims)
{
- int status = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa;
- hsize_t *msa;
- int i;
- int rank = -1;
- int mrank;
-
- if (dims == NULL) {
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ int i;
+ int rank = -1;
+ int mrank;
+ int status = -1;
+
+ UNUSED(clss);
+
+ if (NULL == dims) {
dimsP = NULL;
sa = (hsize_t *) dimsP;
- } /* end if */
+ }
else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Pget_simple_extent_dims: dims not pinned");
- return -1;
- } /* end if */
- rank = (int)ENVPTR->GetArrayLength(ENVPAR dims);
- sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: dims not converted to hsize_t");
- return -1;
- } /* end if */
- } /* end else */
- if (maxdims == NULL) {
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sget_simple_extent_dims: dims not pinned");
+
+ if ((rank = (int)ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: dims array length < 0");
+ }
+
+ if (NULL == (sa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate dimension buffer");
+ }
+
+ if (NULL == maxdims) {
maxdimsP = NULL;
msa = (hsize_t *) maxdimsP;
- } /* end if */
+ }
else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- h5JNIFatalError(env, "H5Pget_simple_extent_dims: maxdims not pinned");
- return -1;
- } /* end if */
- mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims);
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sget_simple_extent_dims: maxdims not pinned");
+
+ if ((mrank = (int) ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims array length < 0");
+ }
+
if (rank < 0)
rank = mrank;
- else if (mrank != rank) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
- return -1;
- } /* end else if */
- msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims not converted to hsize_t");
- return -1;
- } /* end if */
- } /* end else */
+ else if (mrank != rank)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: maxdims rank not same as dims");
- status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa);
+ if (NULL == (msa = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_simple_extent_dims: failed to allocate maximum dimension buffer");
+ }
- if (status < 0) {
- if (dimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- } /* end if */
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(msa);
- } /* end if */
- h5libraryError(env);
- return -1;
- } /* end if */
+ if ((status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (dimsP != NULL) {
+ if (NULL != dimsP) {
for (i = 0; i < rank; i++) {
dimsP[i] = (jlong)sa[i];
} /* end for */
- HDfree(sa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
- } /* end if */
- if (maxdimsP != NULL) {
+ }
+
+ if (NULL != maxdimsP) {
for (i = 0; i < rank; i++) {
maxdimsP[i] = (jlong)msa[i];
} /* end for */
+ }
+
+done:
+ if (msa)
HDfree(msa);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, 0);
- } /* end if */
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, (status < 0) ? JNI_ABORT : 0);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims */
@@ -523,11 +507,15 @@ Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type
{
H5S_class_t retVal = H5S_NO_CLASS;
+ UNUSED(clss);
+
if (space_id < 0)
- h5libraryError(env);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_simple_extent_type: space_id < 0");
- retVal = H5Sget_simple_extent_type(space_id);
+ if (H5S_NO_CLASS == (retVal = H5Sget_simple_extent_type(space_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type */
@@ -540,87 +528,81 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
(JNIEnv *env, jclass clss, jlong space_id, jint rank, jlongArray dims, jlongArray maxdims)
{
- herr_t status = -1;
- jlong *dimsP, *maxdimsP;
- jboolean isCopy;
- hsize_t *sa;
- hsize_t *msa;
- int i;
- int drank, mrank;
- hsize_t *lp;
- jlong *jlp;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Sset_simple_extent: dims is NULL");
- return -1;
- } /* end if */
- drank = (int) ENVPTR->GetArrayLength(ENVPAR dims);
- if (drank != rank) {
- h5badArgument(env, "H5Screate_simple: dims rank is invalid");
- return -1;
- } /* end if */
- if (maxdims != NULL) {
- mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims);
- if (mrank != rank) {
- h5badArgument(env, "H5Screate_simple: maxdims rank is invalid");
- return -1;
- } /* end if */
- } /* end if */
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned");
- return -1;
- } /* end if */
- sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hsize_t *sa = NULL;
+ hsize_t *msa = NULL;
+ hsize_t *lp = NULL;
+ jlong *dimsP = NULL, *maxdimsP = NULL;
+ jlong *jlp = NULL;
+ jsize drank, mrank;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims is NULL");
+
+ if ((drank = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims array length < 0");
+ }
+
+ if (drank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: dims rank is invalid");
+
+ if (NULL != maxdims) {
+ if ((mrank = ENVPTR->GetArrayLength(ENVONLY, maxdims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: maxdims array length < 0");
+ }
+
+ if (mrank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sset_extent_simple: maxdims rank is invalid");
+ }
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Sset_extent_simple: dims not pinned");
+
+ if (NULL == (sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate dimension buffer");
+
jlp = (jlong *) dimsP;
for (i = 0; i < rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
- if (maxdims == NULL) {
+
+ if (NULL == maxdims) {
maxdimsP = NULL;
msa = (hsize_t *) maxdimsP;
- } /* end if */
+ }
else {
- maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy);
- if (maxdimsP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5JNIFatalError(env, "H5Pset_simple_extent: maxdims not pinned");
- return -1;
- } /* end if */
- msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (msa == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
- HDfree(sa);
- h5JNIFatalError(env, "H5Sset_simple_extent: maxdims not converted to hsize_t");
- return -1;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, &isCopy, "H5Sset_extent_simple: maxdims not pinned");
+
+ if (NULL == (msa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sset_extent_simple: failed to allocate maximum dimension buffer");
+
jlp = (jlong *) maxdimsP;
for (i = 0; i < rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end for */
- } /* end else */
+ }
- status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa);
+ if ((status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- HDfree(sa);
- if (maxdimsP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT);
+done:
+ if (msa)
HDfree(msa);
- } /* end if */
-
- if (status < 0)
- h5libraryError(env);
+ if (maxdimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, maxdims, maxdimsP, JNI_ABORT);
+ if (sa)
+ HDfree(sa);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple */
@@ -636,12 +618,14 @@ Java_hdf_hdf5lib_H5_H5Sis_1simple
{
htri_t bval = JNI_FALSE;
- bval = H5Sis_simple(space_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Sis_simple(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sis_1simple */
@@ -654,49 +638,50 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Soffset_1simple
(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset)
{
- herr_t status;
- jbyte *P = NULL;
jboolean isCopy;
- hssize_t *sa;
+ hssize_t *sa = NULL;
+ hssize_t *lp = NULL;
size_t rank;
- size_t i;
- hssize_t *lp;
- jlong *jlp;
-
- if (offset != NULL) {
- P = ENVPTR->GetByteArrayElements(ENVPAR offset, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Soffset_simple: offset not pinned");
- return -1;
- } /* end if */
- i = (size_t)ENVPTR->GetArrayLength(ENVPAR offset);
- rank = i / sizeof(jlong);
- sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t));
- if (sa == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT);
- h5JNIFatalError(env, "H5Soffset_simple: offset not converted to hssize_t");
- return -1;
- } /* end if */
+ jsize i;
+ jbyte *P = NULL;
+ jlong *jlp = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL != offset) {
+ PIN_BYTE_ARRAY(ENVONLY, offset, P, &isCopy, "H5Soffset_simple: offset not pinned");
+
+ if ((i = ENVPTR->GetArrayLength(ENVONLY, offset)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Soffset_simple: offset array length < 0");
+ }
+
+ rank = (size_t) i / sizeof(jlong);
+
+ if (NULL == (sa = lp = (hssize_t *) HDmalloc((size_t)rank * sizeof(hssize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Soffset_simple: failed to allocate offset buffer");
+
jlp = (jlong *) P;
- for (i = 0; i < rank; i++) {
+ for (i = 0; (size_t) i < rank; i++) {
*lp = (hssize_t) *jlp;
lp++;
jlp++;
} /* end for */
- } /* end if */
+ }
else {
P = NULL;
sa = (hssize_t *) P;
- } /* end else */
+ }
- status = H5Soffset_simple(space_id, sa);
- if (P != NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT);
- HDfree(sa);
- } /* end if */
+ if ((status = H5Soffset_simple(space_id, sa)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (status < 0)
- h5libraryError(env);
+done:
+ if (sa)
+ HDfree(sa);
+ if (P)
+ UNPIN_BYTE_ARRAY(ENVONLY, offset, P, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Soffset_1simple */
@@ -710,12 +695,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sextent_1copy
(JNIEnv *env, jclass clss, jlong space_id, jlong src_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sextent_copy(space_id, src_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sextent_copy(space_id, src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sextent_1copy */
@@ -730,12 +717,14 @@ Java_hdf_hdf5lib_H5_H5Sextent_1equal
{
htri_t bval = JNI_FALSE;
- bval = H5Sextent_equal(space_id, src_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Sextent_equal(space_id, src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sextent_1equal */
@@ -748,12 +737,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sset_1extent_1none
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Sset_extent_none(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Sset_extent_none(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1none */
@@ -766,162 +757,131 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab
(JNIEnv *env, jclass clss, jlong space_id, jint op, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
{
- herr_t status = -1;
- jlong *startP, *strideP, *countP, *blockP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *strd;
- hsize_t *cnt;
- hsize_t *blk;
- int rank;
- int i;
- hsize_t *lp;
- jlong *jlp;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sselect_hyperslab: start is NULL");
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ hsize_t *lp = NULL;
+ jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jlong *jlp = NULL;
+ jsize start_rank, stride_rank, count_rank, block_rank;
+ int i;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == start)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: start is NULL");
+ if (NULL == count)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count is NULL");
+
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: start array length < 0");
+ }
+ if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count array length < 0");
+ }
+
+ if (start_rank != count_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: count and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sselect_hyperslab: start not pinned");
+
+ if (NULL == (strt = lp = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate start buffer");
+
+ jlp = (jlong *) startP;
+ for (i = 0; i < start_rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
} /* end if */
- else if (count == NULL) {
- h5nullArgument(env, "H5Sselect_hyperslab: count is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sselect_hyperslab: count not pinned");
+
+ if (NULL == (cnt = lp = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate count buffer");
+
+ jlp = (jlong *) countP;
+ for (i = 0; i < count_rank; i++) {
+ *lp = (hsize_t) *jlp;
+ lp++;
+ jlp++;
} /* end if */
+
+ if (NULL == stride) {
+ strideP = NULL;
+ strd = (hsize_t *) strideP;
+ }
else {
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- if (rank != ENVPTR->GetArrayLength(ENVPAR count)) {
- h5badArgument(env, "H5Sselect_hyperslab: count and start have different rank!");
- return -1;
- } /* end if */
+ if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: stride array length < 0");
+ }
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sselect_hyperslab: start not pinned");
- return -1;
- } /* end if */
- strt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sselect_hyperslab: start not converted to hsize_t");
- return -1;
- } /* end if */
+ if (stride_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: stride and start have different rank!");
- jlp = (jlong *) startP;
- for (i = 0; i < rank; i++) {
+ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sselect_hyperslab: stride not pinned");
+
+ if (NULL == (strd = lp = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate stride buffer");
+
+ jlp = (jlong *) strideP;
+ for (i = 0; i < stride_rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
} /* end if */
+ }
- countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy);
- if (countP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: count not pinned");
- return -1;
- } /* end if */
- cnt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (cnt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: count not converted to hsize_t");
- return -1;
- } /* end if */
+ if (NULL == block) {
+ blockP = NULL;
+ blk = (hsize_t *) blockP;
+ }
+ else {
+ if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: block array length < 0");
+ }
- jlp = (jlong *) countP;
- for (i = 0; i < rank; i++) {
+ if (block_rank != start_rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sselect_hyperslab: block and start have different rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sselect_hyperslab: block not pinned");
+
+ if (NULL == (blk = lp = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sselect_hyperslab: failed to allocate block buffer");
+
+ jlp = (jlong *) blockP;
+ for (i = 0; i < block_rank; i++) {
*lp = (hsize_t) *jlp;
lp++;
jlp++;
- } /* end if */
- if (stride == NULL) {
- strideP = NULL;
- strd = (hsize_t *) strideP;
- } /* end if */
- else {
- strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy);
- if (strideP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5badArgument(env, "H5Sselect_hyperslab: stride not pinned");
- return -1;
- } /* end if */
- strd = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strd == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sselect_hyperslab: stride not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *) strideP;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end if */
- } /* end if */
- if (block == NULL) {
- blockP = NULL;
- blk = (hsize_t *) blockP;
- } /* end if */
- else {
- blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy);
- if (blockP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- if (strd != NULL)
- free(strd);
-
- h5JNIFatalError(env, "H5Sselect_hyperslab: block not pinned");
- return -1;
- } /* end if */
- blk = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (blk == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- if (strd != NULL)
- free(strd);
-
- h5JNIFatalError(env, "H5Sget_simple_extent: block not converted to hsize_t");
- return -1;
- } /* end if */
- jlp = (jlong *) blockP;
- for (i = 0; i < rank; i++) {
- *lp = (hsize_t) *jlp;
- lp++;
- jlp++;
- } /* end for */
- } /* end else */
-
- status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd,
- (const hsize_t *) cnt, (const hsize_t *) blk);
-
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
+ } /* end for */
+ }
+
+ if ((status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd,
+ (const hsize_t *) cnt, (const hsize_t *) blk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (blk)
+ HDfree(blk);
+ if (blockP)
+ UNPIN_LONG_ARRAY(ENVONLY, block, blockP, JNI_ABORT);
+ if (strd)
+ HDfree(strd);
+ if (strideP)
+ UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, JNI_ABORT);
+ if (cnt)
HDfree(cnt);
- if (strideP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(strd);
- } /* end if */
- if (blockP != NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(blk);
- } /* end if */
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
+ if (countP)
+ UNPIN_LONG_ARRAY(ENVONLY, count, countP, JNI_ABORT);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, JNI_ABORT);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab */
@@ -935,12 +895,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Sclose
(JNIEnv *env, jclass clss, jlong space_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Sclose(space_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sclose(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Sclose */
@@ -955,10 +917,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks
{
hssize_t retVal = -1;
- retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks */
@@ -973,10 +937,12 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints
{
hssize_t retVal = -1;
- retVal = H5Sget_select_elem_npoints((hid_t) spaceid);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Sget_select_elem_npoints((hid_t) spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints */
@@ -989,58 +955,53 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
(JNIEnv *env, jclass clss, jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf)
{
- herr_t status = -1;
- jlong *bufP;
- jboolean isCopy;
- hsize_t *ba;
- int i;
- int rank;
- hsize_t st;
- hsize_t nb;
-
- st = (hsize_t) startblock;
- nb = (hsize_t) numblocks;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Sget_select_hyper_blocklist: buf is NULL");
- } /* end if */
- else {
- rank = H5Sget_simple_extent_ndims(spaceid);
- if (rank <= 0)
- rank = 1;
- if (ENVPTR->GetArrayLength(ENVPAR buf) < (numblocks * rank)) {
- h5badArgument(env, "H5Sget_select_hyper_blocklist: buf input array too small");
- } /* end if */
- else {
- bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned");
- } /* end if */
- else {
- ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
- if (ba == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t");
- } /* end if */
- else {
- status = H5Sget_select_hyper_blocklist((hid_t)spaceid, st, nb, (hsize_t *)ba);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- free(ba);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (numblocks * 2 * rank); i++) {
- bufP[i] = (jlong)ba[i];
- } /* end for */
- free(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ size_t i, buf_size;
+ jlong *bufP = NULL;
+ jsize buflen;
+ int rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buf is NULL");
+ if (numblocks < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: numblocks < 0");
+
+ if ((rank = H5Sget_simple_extent_ndims(spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (rank == 0)
+ rank = 1;
+
+ if ((buflen = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buf array length < 0");
+ }
+
+ if (buflen < (numblocks * rank))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: buffer input array too small");
+
+ PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_hyper_blocklist: buffer not pinned");
+
+ buf_size = (size_t) numblocks * (size_t) 2 * (size_t) rank * sizeof(hsize_t);
+ if (NULL == (ba = (hsize_t *) HDmalloc(buf_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_hyper_blocklist: failed to allocate block list buffer");
+
+ if ((status = H5Sget_select_hyper_blocklist((hid_t)spaceid, (hsize_t) startblock, (hsize_t) numblocks, (hsize_t *)ba)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (buf_size / sizeof(hsize_t)); i++) {
+ bufP[i] = (jlong) ba[i];
+ } /* end for */
+
+done:
+ if (ba)
+ HDfree(ba);
+ if (bufP)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist */
@@ -1054,53 +1015,49 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist
(JNIEnv *env, jclass clss, jlong spaceid, jlong startpoint, jlong numpoints, jlongArray buf)
{
- herr_t status = -1;
- jlong *bufP;
- jboolean isCopy;
- hsize_t *ba;
- int i;
- int rank;
-
- if (buf == NULL) {
- h5nullArgument(env, "H5Sget_select_elem_pointlist: buf is NULL");
- } /* end if */
- else {
- rank = H5Sget_simple_extent_ndims(spaceid);
- if (rank <= 0)
- rank = 1;
- if (ENVPTR->GetArrayLength(ENVPAR buf) < (numpoints * rank)) {
- h5badArgument(env, "H5Sget_select_elem_pointlist: buf input array too small");
- } /* end if */
- else {
- bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not pinned");
- } /* end if */
- else {
- ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t));
- if (ba == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not converted to hsize_t");
- } /* end if */
- else {
- status = H5Sget_select_elem_pointlist((hid_t) spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba);
-
- if (status < 0) {
- HDfree(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (numpoints * rank); i++) {
- bufP[i] = (jlong)ba[i];
- } /* end for */
- HDfree(ba);
- ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *ba = NULL;
+ jlong *bufP = NULL;
+ jsize buflen;
+ int i, rank;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buffer is NULL");
+
+ if ((rank = H5Sget_simple_extent_ndims(spaceid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (rank == 0)
+ rank = 1;
+
+ if ((buflen = ENVPTR->GetArrayLength(ENVONLY, buf)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buf array length < 0");
+ }
+
+ if (buflen < (numpoints * rank))
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: buffer input array too small");
+
+ PIN_LONG_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sget_select_elem_pointlist: buffer not pinned");
+
+ if (NULL == (ba = (hsize_t *) HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_elem_pointlist: failed to allocate point list buffer");
+
+ if ((status = H5Sget_select_elem_pointlist((hid_t)spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (numpoints * rank); i++) {
+ bufP[i] = (jlong) ba[i];
+ } /* end for */
+
+done:
+ if (ba)
+ HDfree(ba);
+ if (bufP)
+ UNPIN_LONG_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end if */
@@ -1114,70 +1071,53 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
(JNIEnv *env, jclass clss, jlong spaceid, jlongArray start, jlongArray end)
{
- herr_t status = -1;
- jlong *startP, *endP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *en;
- int rank;
- int i;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sget_select_bounds: start is NULL");
- } /* end if */
- else if (end == NULL) {
- h5nullArgument(env, "H5Sget_select_bounds: end is NULL");
- } /* end else if */
- else {
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sget_select_bounds: start not pinned");
- return -1;
- } /* end if */
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t");
- return -1;
- } /* end if */
+ jboolean isCopy;
+ hsize_t *strt = NULL;
+ hsize_t *en = NULL;
+ size_t i;
+ jlong *startP = NULL, *endP = NULL;
+ jsize rank;
+ herr_t status = FAIL;
- endP = ENVPTR->GetLongArrayElements(ENVPAR end, &isCopy);
- if (endP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- free(strt);
- h5JNIFatalError(env, "H5Sget_select_bounds: end not pinned");
- return -1;
- } /* end if */
- en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (en == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_simple_extent: dims not converted to hsize_t");
- return -1;
- } /* end if */
+ UNUSED(clss);
- status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en);
+ if (NULL == start)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start is NULL");
+ if (NULL == end)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: end is NULL");
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT);
- HDfree(strt);
- HDfree(en);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < rank; i++) {
- startP[i] = (jlong)strt[i];
- endP[i] = (jlong)en[i];
- } /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, 0);
- HDfree(strt);
- HDfree(en);
- } /* end else */
- } /* end else */
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_select_bounds: start not pinned");
+
+ if ((rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_select_bounds: start array length < 0");
+ }
+
+ if (NULL == (strt = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate start buffer");
+
+ PIN_LONG_ARRAY(ENVONLY, end, endP, &isCopy, "H5Sget_select_bounds: end not pinned");
+
+ if (NULL == (en = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_select_bounds: failed to allocate end buffer");
+
+ if ((status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) rank; i++) {
+ startP[i] = (jlong) strt[i];
+ endP[i] = (jlong) en[i];
+ } /* end for */
+
+done:
+ if (en)
+ HDfree(en);
+ if (endP)
+ UNPIN_LONG_ARRAY(ENVONLY, end, endP, (status < 0) ? JNI_ABORT : 0);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds */
@@ -1191,43 +1131,37 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_H5_H5Sencode
(JNIEnv *env, jclass cls, jlong obj_id)
{
- herr_t status = -1;
- unsigned char *bufPtr;
- size_t buf_size = 0;
- jbyteArray returnedArray = NULL;
-
- if (obj_id < 0) {
- h5badArgument(env, "H5Sencode: invalid argument");
- } /* end if */
- else {
- status = H5Sencode(obj_id, NULL, &buf_size);
+ unsigned char *bufPtr = NULL;
+ size_t buf_size = 0;
+ herr_t status = FAIL;
+ jbyteArray returnedArray = NULL;
- if (status < 0) {
- h5libraryError(env);
- } /* end else if */
- else if (buf_size == 0) {
- h5badArgument(env, "H5Sencode: buf_size = 0");
- } /* end if */
- else {
- bufPtr = (unsigned char*)HDcalloc((size_t) 1, buf_size);
- if (bufPtr == NULL) {
- h5outOfMemory(env, "H5Sencode: calloc failed");
- } /* end if */
- else {
- status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size);
-
- if (status < 0) {
- HDfree(bufPtr);
- h5libraryError(env);
- } /* end if */
- else {
- returnedArray = ENVPTR->NewByteArray(ENVPAR (jsize)buf_size);
- ENVPTR->SetByteArrayRegion(ENVPAR returnedArray, 0, (jsize)buf_size, (jbyte*) bufPtr);
- HDfree(bufPtr);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ UNUSED(cls);
+
+ if (obj_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: invalid object ID");
+
+ if ((status = H5Sencode(obj_id, NULL, &buf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (buf_size == 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sencode: buf_size = 0");
+
+ if (NULL == (bufPtr = (unsigned char *) HDcalloc((size_t) 1, buf_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sencode: failed to allocate encoding buffer");
+
+ if ((status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (returnedArray = ENVPTR->NewByteArray(ENVONLY, (jsize) buf_size)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetByteArrayRegion(ENVONLY, returnedArray, 0, (jsize) buf_size, (jbyte *) bufPtr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (bufPtr)
+ HDfree(bufPtr);
return returnedArray;
} /* end Java_hdf_hdf5lib_H5_H5Sencode */
@@ -1241,27 +1175,23 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Sdecode
(JNIEnv *env, jclass cls, jbyteArray buf)
{
- hid_t sid = -1;
- jbyte *bufP;
- jboolean isCopy;
+ jboolean isCopy;
+ jbyte *bufP = NULL;
+ hid_t sid = H5I_INVALID_HID;
- if (buf == NULL) {
- h5nullArgument(env, "H5Sdecode: buf is NULL");
- } /* end if */
- else {
- bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError( env, "H5Sdecode: buf not pinned");
- } /* end if */
- else {
- sid = H5Sdecode(bufP);
+ UNUSED(cls);
+
+ if (NULL == buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Sdecode: buffer is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Sdecode: buffer not pinned");
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, JNI_ABORT);
+ if ((sid = H5Sdecode(bufP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (sid < 0)
- h5libraryError(env);
- } /* end else if */
- } /* end else if */
+done:
+ if (bufP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, bufP, JNI_ABORT);
return (jlong)sid;
} /* end Java_hdf_hdf5lib_H5_H5Sdecode */
@@ -1277,12 +1207,14 @@ Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab
{
htri_t bval = JNI_FALSE;
- bval = H5Sis_regular_hyperslab((hid_t)obj_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(cls);
+ if ((bval = H5Sis_regular_hyperslab((hid_t)obj_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab */
@@ -1295,131 +1227,126 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab
(JNIEnv *env, jclass clss, jlong space_id, jlongArray start, jlongArray stride, jlongArray count, jlongArray block)
{
- herr_t status;
- jlong *startP, *strideP, *countP, *blockP;
- jboolean isCopy;
- hsize_t *strt;
- hsize_t *strd;
- hsize_t *cnt;
- hsize_t *blk;
- int rank;
- int i;
-
- if (start == NULL) {
- h5nullArgument(env, "H5Sget_regular_hyperslab: start is NULL");
- } /* end if */
- else if (count == NULL) {
- h5nullArgument(env, "H5Sget_regular_hyperslab: count is NULL");
- } /* end else if */
+ jboolean isCopy;
+ hsize_t *strt = NULL, *strd = NULL, *cnt = NULL, *blk = NULL;
+ jlong *startP = NULL, *strideP = NULL, *countP = NULL, *blockP = NULL;
+ jsize start_rank = -1, stride_rank = -1, count_rank = -1, block_rank = -1;
+ int i, rank = -1;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (space_id < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: invalid dataspace ID");
+
+ if ((rank = H5Sget_simple_extent_ndims(space_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == start) {
+ startP = NULL;
+ strt = (hsize_t *) startP;
+ }
else {
- rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
- if (rank != ENVPTR->GetArrayLength(ENVPAR count)) {
- h5badArgument(env, "H5Sget_regular_hyperslab: count and start have different rank!");
- return;
- } /* end if */
+ if ((start_rank = ENVPTR->GetArrayLength(ENVONLY, start)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start array length < 0");
+ }
- startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy);
- if (startP == NULL) {
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not pinned");
- return;
- } /* end if */
- strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not converted to hsize_t");
- return;
- } /* end if */
+ if (start_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: start rank doesn't match dataspace rank!");
- countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy);
- if (countP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not pinned");
- return;
- } /* end if */
- cnt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (cnt == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not converted to hsize_t");
- return;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, start, startP, &isCopy, "H5Sget_regular_hyperslab: start not pinned");
- strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy);
- if (strideP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5badArgument(env, "H5Sget_regular_hyperslab: stride not pinned");
- return;
- } /* end if */
- strd = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (strd == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: stride not converted to hsize_t");
- return;
- } /* end if */
+ if (NULL == (strt = (hsize_t *) HDmalloc((size_t)start_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate start buffer");
+ }
- blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy);
- if (blockP == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- HDfree(strd);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not pinned");
- return;
- } /* end if */
- blk = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
- if (blk == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(cnt);
- HDfree(strt);
- HDfree(strd);
- h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not converted to hsize_t");
- return;
- } /* end if */
+ if (NULL == stride) {
+ strideP = NULL;
+ strd = (hsize_t *) strideP;
+ }
+ else {
+ if ((stride_rank = ENVPTR->GetArrayLength(ENVONLY, stride)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride array length < 0");
+ }
- status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk);
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT);
- HDfree(strt);
- HDfree(cnt);
- HDfree(strd);
- HDfree(blk);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < (rank); i++) {
- startP[i] = (jlong)strt[i];
- countP[i] = (jlong)cnt[i];
- strideP[i] = (jlong)strd[i];
- blockP[i] = (jlong)blk[i];
- } /* end for */
- HDfree(strt);
- HDfree(cnt);
- HDfree(strd);
- HDfree(blk);
- ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, 0);
- } /* end else */
- } /* end else */
+ if (stride_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: stride rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, stride, strideP, &isCopy, "H5Sget_regular_hyperslab: stride not pinned");
+
+ if (NULL == (strd = (hsize_t *) HDmalloc((size_t)stride_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate stride buffer");
+ }
+
+ if (NULL == count) {
+ countP = NULL;
+ cnt = (hsize_t *) countP;
+ }
+ else {
+ if ((count_rank = ENVPTR->GetArrayLength(ENVONLY, count)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count array length < 0");
+ }
+
+ if (count_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: count rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, count, countP, &isCopy, "H5Sget_regular_hyperslab: count not pinned");
+
+ if (NULL == (cnt = (hsize_t *) HDmalloc((size_t)count_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate count buffer");
+ }
+
+ if (NULL == block) {
+ blockP = NULL;
+ blk = (hsize_t *) blockP;
+ }
+ else {
+ if ((block_rank = ENVPTR->GetArrayLength(ENVONLY, block)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block array length < 0");
+ }
+
+ if (block_rank != rank)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Sget_regular_hyperslab: block rank doesn't match dataspace rank!");
+
+ PIN_LONG_ARRAY(ENVONLY, block, blockP, &isCopy, "H5Sget_regular_hyperslab: block not pinned");
+
+ if (NULL == (blk = (hsize_t *) HDmalloc((size_t)block_rank * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Sget_regular_hyperslab: failed to allocate block buffer");
+ }
+
+ if ((status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < start_rank; i++) {
+ startP[i] = (jlong) strt[i];
+ countP[i] = (jlong) cnt[i];
+ strideP[i] = (jlong) strd[i];
+ blockP[i] = (jlong) blk[i];
+ } /* end for */
+
+done:
+ if (blk)
+ HDfree(blk);
+ if (blockP)
+ UNPIN_LONG_ARRAY(ENVONLY, block, blockP, (status < 0) ? JNI_ABORT : 0);
+ if (cnt)
+ HDfree(cnt);
+ if (countP)
+ UNPIN_LONG_ARRAY(ENVONLY, count, countP, (status < 0) ? JNI_ABORT : 0);
+ if (strd)
+ HDfree(strd);
+ if (strideP)
+ UNPIN_LONG_ARRAY(ENVONLY, stride, strideP, (status < 0) ? JNI_ABORT : 0);
+ if (strt)
+ HDfree(strt);
+ if (startP)
+ UNPIN_LONG_ARRAY(ENVONLY, start, startP, (status < 0) ? JNI_ABORT : 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab */
#ifdef __cplusplus
diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c
index 307f1a5..313ca8b 100644
--- a/java/src/jni/h5tImp.c
+++ b/java/src/jni/h5tImp.c
@@ -29,7 +29,10 @@ extern "C" {
#include "h5jni.h"
#include "h5tImp.h"
-extern JavaVM *jvm;
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
+/* extern JavaVM *jvm; */
/*
* Class: hdf_hdf5lib_H5
@@ -40,18 +43,22 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Topen2
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist)
{
- hid_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
+ hid_t status = H5I_INVALID_HID;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, tName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Topen2: datatype name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Topen2: datatype name not pinned");
+
+ if ((status = H5Topen2((hid_t)loc_id, datatypeName, (hid_t)access_plist)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
return (jlong)status;
} /* end Java_hdf_hdf5lib_H5__1H5Topen2 */
@@ -67,12 +74,14 @@ Java_hdf_hdf5lib_H5_H5Tcommitted
{
htri_t bval = JNI_FALSE;
- bval = H5Tcommitted(type_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Tcommitted(type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tcommitted */
@@ -85,12 +94,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tcreate
(JNIEnv *env, jclass clss, jint dclass, jlong size)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tcreate */
@@ -103,12 +114,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tcopy
(JNIEnv *env, jclass clss, jlong type_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tcopy((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tcopy((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tcopy */
@@ -123,12 +136,14 @@ Java_hdf_hdf5lib_H5_H5Tequal
{
htri_t bval = JNI_FALSE;
- bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tequal */
@@ -141,12 +156,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tlock
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tlock((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tlock((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tlock */
@@ -161,10 +178,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1class
{
H5T_class_t retVal = H5T_NO_CLASS;
- retVal = H5Tget_class((hid_t)type_id);
- if (retVal == H5T_NO_CLASS)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_NO_CLASS == (retVal = H5Tget_class((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1class */
@@ -179,10 +198,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1size
{
size_t retVal = 0;
- retVal = H5Tget_size((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_size((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1size*/
@@ -196,12 +217,14 @@ Java_hdf_hdf5lib_H5_H5Tset_1size
(JNIEnv *env, jclass clss, jlong type_id, jlong size)
{
size_t tsize = (size_t)size;
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_size((hid_t)type_id, tsize);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_size((hid_t)type_id, tsize)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end ifJava_hdf_hdf5lib_H5_H5Tset_1size */
@@ -216,10 +239,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1order
{
H5T_order_t retVal = H5T_ORDER_ERROR;
- retVal = H5Tget_order((hid_t)type_id);
- if (retVal == H5T_ORDER_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_ORDER_ERROR == (retVal = H5Tget_order((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1order */
@@ -232,12 +257,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1order
(JNIEnv *env, jclass clss, jlong type_id, jint order)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1order */
@@ -252,10 +279,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1precision
{
size_t retVal = 0;
- retVal = H5Tget_precision((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_precision((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision */
@@ -270,10 +299,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1precision_1long
{
size_t retVal = 0;
- retVal = H5Tget_precision((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if (!(retVal = H5Tget_precision((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision_1long */
@@ -286,12 +317,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1precision
(JNIEnv *env, jclass clss, jlong type_id, jlong precision)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_precision((hid_t)type_id, (size_t)precision);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_precision((hid_t)type_id, (size_t)precision)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1precision */
@@ -306,10 +339,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1offset
{
int retVal = -1;
- retVal = H5Tget_offset((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((retVal = H5Tget_offset((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1offset */
@@ -322,12 +357,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1offset
(JNIEnv *env, jclass clss, jlong type_id, jlong offset)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_offset((hid_t)type_id, (size_t)offset);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_offset((hid_t)type_id, (size_t)offset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1offset */
@@ -340,29 +377,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1pad
(JNIEnv *env, jclass clss, jlong type_id, jintArray pad)
{
- herr_t status = -1;
- jboolean isCopy;
- jint *P;
-
- if (pad == NULL) {
- h5nullArgument(env, "H5Tget_pad: pad is NULL");
- } /* end if */
- else {
- P = ENVPTR->GetIntArrayElements(ENVPAR pad, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Tget_pad: pad not pinned");
- } /* end if */
- else {
- status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jint *P = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == pad)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_pad: pad is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, pad, P, &isCopy, "H5Tget_pad: pad not pinned");
+
+ if ((status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (P)
+ UNPIN_INT_ARRAY(ENVONLY, pad, P, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1pad */
@@ -376,12 +407,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1pad
(JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1pad */
@@ -396,10 +429,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1sign
{
H5T_sign_t retVal = H5T_SGN_ERROR;
- retVal = H5Tget_sign((hid_t)type_id);
- if (retVal == H5T_SGN_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_SGN_ERROR == (retVal = H5Tget_sign((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1sign */
@@ -412,12 +447,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1sign
(JNIEnv *env, jclass clss, jlong type_id, jint sign)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1sign */
@@ -430,32 +467,31 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1fields_1int
(JNIEnv *env, jclass clss, jlong type_id, jintArray fields)
{
- herr_t status;
- jboolean isCopy;
- jint *P;
-
- if (fields == NULL) {
- h5nullArgument(env, "H5Tget_fields: fields is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) {
- h5badArgument(env, "H5Tget_fields: fields input array < order 5");
- } /* end else if */
- else {
- P = ENVPTR->GetIntArrayElements(ENVPAR fields, &isCopy);
- if (P == NULL) {
- h5JNIFatalError(env, "H5Tget_fields: fields not pinned");
- } /* end if */
- else {
- status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4]));
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jsize arrLen;
+ jint *P = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fields)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, fields)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields array length < 0");
+ }
+ if (arrLen < 5)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields_int: fields input array < order 5");
+
+ PIN_INT_ARRAY(ENVONLY, fields, P, &isCopy, "H5Tget_fields_int: fields not pinned");
+
+ if ((status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4]))) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (P)
+ UNPIN_INT_ARRAY(ENVONLY, fields, P, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields_1int */
@@ -469,56 +505,57 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1fields
(JNIEnv *env, jclass clss, jlong type_id, jlongArray fields)
{
- herr_t status;
- jboolean isCopy;
- jlong *fieldsArray;
-
- if (fields == NULL) {
- h5nullArgument(env, "H5Tget_fields: fields is NULL");
- } /* end if */
- else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) {
- h5badArgument(env, "H5Tget_fields: fields input array < order 5");
- } /* end else if */
- else {
- fieldsArray = ENVPTR->GetLongArrayElements(ENVPAR fields, &isCopy);
- if (fieldsArray == NULL) {
- h5JNIFatalError(env, "H5Tget_fields: fields not pinned");
- } /* end if */
- else {
- { /* direct cast (size_t *)variable fails on 32-bit environment */
- size_t spos_t = 0;
- size_t epos_t = 0;
- size_t esize_t = 0;
- size_t mpos_t = 0;
- size_t msize_t = 0;
- long long fields_temp = *(&fieldsArray[0]);
- spos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[1]);
- epos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[2]);
- esize_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[3]);
- mpos_t = (size_t)fields_temp;
- fields_temp = *(&fieldsArray[4]);
- msize_t = (size_t)fields_temp;
-
- status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t);
-
- *(&fieldsArray[0]) = (jlong)spos_t;
- *(&fieldsArray[1]) = (jlong)epos_t;
- *(&fieldsArray[2]) = (jlong)esize_t;
- *(&fieldsArray[3]) = (jlong)mpos_t;
- *(&fieldsArray[4]) = (jlong)msize_t;
- } /* end direct cast special handling */
-
- if (status < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jlong *fieldsArray = NULL;
+ jsize arrLen;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == fields)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields is NULL");
+
+ if ((arrLen = ENVPTR->GetArrayLength(ENVONLY, fields)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields array length < 0");
+ }
+ if (arrLen < 5)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_fields: fields input array < order 5");
+
+ PIN_LONG_ARRAY(ENVONLY, fields, fieldsArray, &isCopy, "H5Tget_fields: fields not pinned");
+
+ { /* Direct cast (size_t *)variable fails on 32-bit environment */
+ size_t spos_t = 0;
+ size_t epos_t = 0;
+ size_t esize_t = 0;
+ size_t mpos_t = 0;
+ size_t msize_t = 0;
+ long long fields_temp = *(&fieldsArray[0]);
+ spos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[1]);
+ epos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[2]);
+ esize_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[3]);
+ mpos_t = (size_t)fields_temp;
+ fields_temp = *(&fieldsArray[4]);
+ msize_t = (size_t)fields_temp;
+
+ if ((status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ *(&fieldsArray[0]) = (jlong)spos_t;
+ *(&fieldsArray[1]) = (jlong)epos_t;
+ *(&fieldsArray[2]) = (jlong)esize_t;
+ *(&fieldsArray[3]) = (jlong)mpos_t;
+ *(&fieldsArray[4]) = (jlong)msize_t;
+ } /* end direct cast special handling */
+
+done:
+ if (fieldsArray)
+ UNPIN_LONG_ARRAY(ENVONLY, fields, fieldsArray, (status < 0) ? JNI_ABORT : 0);
+
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields */
/*
@@ -531,8 +568,13 @@ Java_hdf_hdf5lib_H5_H5Tset_1fields
(JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos,
jlong esize, jlong mpos, jlong msize)
{
+ UNUSED(clss);
+
if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos, (size_t)msize) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1fields */
/*
@@ -546,10 +588,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1ebias
{
size_t retVal = 0;
- retVal = H5Tget_ebias((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if (!(retVal = H5Tget_ebias((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias */
@@ -564,10 +608,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long
{
size_t retVal = 0;
- retVal = H5Tget_ebias((hid_t)type_id);
- if (retVal == 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (!(retVal = H5Tget_ebias((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long */
@@ -580,12 +626,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1ebias
(JNIEnv *env, jclass clss, jlong type_id, jlong ebias)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1ebias */
@@ -600,10 +648,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1norm
{
H5T_norm_t retVal = H5T_NORM_ERROR;
- retVal = H5Tget_norm((hid_t)type_id);
- if (retVal == H5T_NORM_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_NORM_ERROR == (retVal = H5Tget_norm((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1norm */
@@ -616,12 +666,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1norm
(JNIEnv *env, jclass clss, jlong type_id, jint norm)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1norm */
@@ -636,10 +688,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1inpad
{
H5T_pad_t retVal = H5T_PAD_ERROR;
- retVal = H5Tget_inpad((hid_t)type_id );
- if (retVal == H5T_PAD_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+ if (H5T_PAD_ERROR == (retVal = H5Tget_inpad((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1inpad */
@@ -652,12 +706,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1inpad
(JNIEnv *env, jclass clss, jlong type_id, jint inpad)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1inpad */
@@ -672,10 +728,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1cset
{
H5T_cset_t retVal = H5T_CSET_ERROR;
- retVal = H5Tget_cset((hid_t)type_id);
- if (retVal == H5T_CSET_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_CSET_ERROR == (retVal = H5Tget_cset((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1cset */
@@ -688,12 +746,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1cset
(JNIEnv *env, jclass clss, jlong type_id, jint cset)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1cset */
@@ -708,10 +768,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1strpad
{
H5T_str_t retVal = H5T_STR_ERROR;
- retVal = H5Tget_strpad((hid_t)type_id);
- if (retVal == H5T_STR_ERROR)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5T_STR_ERROR == (retVal = H5Tget_strpad((hid_t)type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1strpad */
@@ -724,12 +786,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1strpad
(JNIEnv *env, jclass clss, jlong type_id, jint strpad)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1strpad */
@@ -744,10 +808,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1nmembers
{
int retVal = -1;
- retVal = H5Tget_nmembers((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tget_nmembers((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1nmembers */
@@ -760,17 +826,20 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1name
(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
- char *name;
- jstring str = NULL;
+ char *member_name = NULL;
+ jstring str = NULL;
+
+ UNUSED(clss);
- name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx);
- if (name != NULL) {
- str = ENVPTR->NewStringUTF(ENVPAR name);
- H5free_memory(name);
+ if (NULL == (member_name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if (str == NULL)
- h5JNIFatalError(env, "H5Tget_member_name: returned string not created");
- } /* end if */
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, member_name)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (member_name)
+ H5free_memory(member_name);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1name */
@@ -784,18 +853,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1index
(JNIEnv *env, jclass clss, jlong type_id, jstring field_name)
{
- const char *tName;
+ const char *datatypeName = NULL;
int index = -1;
- PIN_JAVA_STRING(field_name, tName);
- if (tName != NULL) {
- index = H5Tget_member_index((hid_t)type_id, tName);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(field_name, tName);
+ if (NULL == field_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_index: field name is NULL");
- if (index < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, field_name, datatypeName, NULL, "H5Tget_member_index: field name not pinned");
+
+ if ((index = H5Tget_member_index((hid_t)type_id, datatypeName)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, field_name, datatypeName);
return (jint)index;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1index */
@@ -809,12 +882,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1member_1type
(JNIEnv *env, jclass clss, jlong type_id, jint field_idx)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1member_1type */
@@ -827,6 +902,9 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1offset
(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
+ UNUSED(env);
+ UNUSED(clss);
+
return (jlong)H5Tget_member_offset((hid_t)type_id, (unsigned)memno);
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1offset */
@@ -839,12 +917,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1class
(JNIEnv *env, jclass clss, jlong type_id, jint memno)
{
- int retVal = -1;
+ H5T_class_t retVal = H5T_NO_CLASS;
+
+ UNUSED(clss);
- retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno);
- if (retVal < 0)
- h5libraryError(env);
+ if (H5T_NO_CLASS == (retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno)))
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1class */
@@ -857,18 +937,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tinsert
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset, jlong field_id)
{
- herr_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
long off = (long)offset;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name,tName);
- if (status < 0)
- h5libraryError(env);
- }
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tinsert: datatype name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tinsert: datatype name not pinned");
+
+ if ((status = H5Tinsert((hid_t)type_id, datatypeName, (size_t)off, field_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tinsert */
@@ -882,12 +967,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tpack
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- retVal = H5Tpack((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tpack((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Tpack */
@@ -900,12 +987,14 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5__1H5Tclose
(JNIEnv *env, jclass clss, jlong type_id)
{
- herr_t retVal = -1;
+ herr_t retVal = FAIL;
- retVal = H5Tclose((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ UNUSED(clss);
+ if ((retVal = H5Tclose((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tclose */
@@ -918,12 +1007,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tvlen_1create
(JNIEnv *env, jclass clss, jlong base_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tvlen_create((hid_t)base_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tvlen_create((hid_t)base_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tvlen_1create */
@@ -936,18 +1027,22 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tset_1tag
(JNIEnv *env, jclass clss, jlong type, jstring tag)
{
- herr_t status = -1;
- const char *tagP;
+ const char *tagBuf = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(tag, tagP);
- if (tagP != NULL) {
- status = H5Tset_tag((hid_t)type, tagP);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(tag,tagP);
+ if (NULL == tag)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tset_tag: tag is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, tag, tagBuf, NULL, "H5Tset_tag: tag buffer not pinned");
+
+ if ((status = H5Tset_tag((hid_t)type, tagBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (tagBuf)
+ UNPIN_JAVA_STRING(ENVONLY, tag, tagBuf);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tset_1tag */
@@ -961,17 +1056,20 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1tag
(JNIEnv *env, jclass clss, jlong type)
{
- jstring str = NULL;
- char *tag;
+ jstring str = NULL;
+ char *tag = NULL;
- tag = H5Tget_tag((hid_t)type);
- if (tag != NULL) {
- str = ENVPTR->NewStringUTF(ENVPAR tag);
- H5free_memory(tag);
+ UNUSED(clss);
+
+ if (NULL == (tag = H5Tget_tag((hid_t)type)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, tag)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (str == NULL)
- h5JNIFatalError(env, "H5Tget_tag: returned string not created");
- } /* end if */
+done:
+ if (tag)
+ H5free_memory(tag);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1tag */
@@ -985,12 +1083,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1super
(JNIEnv *env, jclass clss, jlong type_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tget_super((hid_t)type_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tget_super((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1super */
@@ -1003,12 +1103,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tenum_1create
(JNIEnv *env, jclass clss, jlong base_id)
{
- hid_t retVal = -1;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
- retVal = H5Tenum_create((hid_t)base_id);
- if (retVal < 0)
- h5libraryError(env);
+ if ((retVal = H5Tenum_create((hid_t)base_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tenum_1create */
@@ -1021,32 +1123,30 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL ) {
- h5nullArgument(env, "H5Tenum_insert: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tenum_insert: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_insert((hid_t)type_id, nameP, intP);
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *memberName = NULL;
+ jboolean isCopy;
+ jint *intBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert_int: member name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert_int: member name not pinned");
+
+ PIN_INT_ARRAY(ENVONLY, value, intBuf, &isCopy, "H5Tenum_insert_int: int buffer not pinned");
+
+ if ((status = H5Tenum_insert((hid_t)type_id, memberName, intBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (intBuf)
+ UNPIN_INT_ARRAY(ENVONLY, value, intBuf, (status < 0) ? JNI_ABORT : 0);
+ if (memberName)
+ UNPIN_JAVA_STRING(ENVONLY, name, memberName);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int */
@@ -1060,32 +1160,30 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1insert
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_insert: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tenum_insert: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_insert((hid_t)type_id, nameP, byteP);
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *memberName = NULL;
+ jboolean isCopy;
+ jbyte *memberBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_insert: member name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, memberName, NULL, "H5Tenum_insert: member name not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, memberBuf, &isCopy, "H5Tenum_insert: member buffer not pinned");
+
+ if ((status = H5Tenum_insert((hid_t)type_id, memberName, memberBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (memberBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, memberBuf, (status < 0) ? JNI_ABORT : 0);
+ if (memberName)
+ UNPIN_JAVA_STRING(ENVONLY, name, memberName);
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert */
/*
@@ -1098,51 +1196,39 @@ Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int
(JNIEnv *env, jclass clss, jlong type_id, jintArray value, jobjectArray name,
jint size)
{
- herr_t status = -1;
- jint *intP;
- char *nameP;
- jboolean isCopy;
- jstring str;
-
- if (size <= 0) {
- h5badArgument(env, "H5Tenum_nameof: name size < 0");
- } /* end if */
- else if (value == NULL) {
- h5nullArgument(env, "H5Tenum_nameof: value is NULL");
- } /* end if */
- else {
- nameP = (char*)HDmalloc(sizeof(char) * (size_t)size);
- if (nameP == NULL) {
- /* exception -- out of memory */
- h5outOfMemory(env, "H5Tenum_nameof: malloc name size");
- } /* end if */
- else {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy);
- if (intP == NULL) {
- HDfree(nameP);
- h5JNIFatalError(env, "H5Tenum_nameof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size);
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
-
- if (status < 0) {
- HDfree(nameP);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR nameP);
- HDfree(nameP);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Tenum_nameof: return array not created");
- } /* end if */
- else
- ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str;
+ jint *intP = NULL;
+ char *nameP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: value is NULL");
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof_int: name size < 0");
+
+ if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tenum_nameof_int: failed to allocate name buffer");
+
+ PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tenum_nameof_int: value not pinned");
+
+ if ((status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nameP[(size_t)size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, nameP)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, name, 0, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (intP)
+ UNPIN_INT_ARRAY(ENVONLY, value, intP, JNI_ABORT);
+ if (nameP)
+ HDfree(nameP);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int */
@@ -1156,49 +1242,36 @@ JNIEXPORT jstring JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1nameof
(JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size)
{
- herr_t status = -1;
- jbyte *byteP;
- char *nameP;
- jboolean isCopy;
- jstring str = NULL;
-
- if (size <= 0) {
- h5badArgument(env, "H5Tenum_nameof: name size < 0");
- } /* end if */
- else if (value == NULL ) {
- h5nullArgument(env, "H5Tenum_nameof: value is NULL");
- } /* end if */
- else {
- nameP = (char*)HDmalloc(sizeof(char) * (size_t)size);
- if (nameP == NULL) {
- h5outOfMemory(env, "H5Tenum_nameof: malloc name size");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy);
- if (byteP == NULL) {
- HDfree(nameP);
- h5JNIFatalError(env, "H5Tenum_nameof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size);
-
- /* free the buffer without copying back */
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
-
- if (status < 0) {
- HDfree(nameP);
- h5libraryError(env);
- } /* end if */
- else {
- str = ENVPTR->NewStringUTF(ENVPAR nameP);
- HDfree(nameP);
- if (str == NULL) {
- h5JNIFatalError(env, "H5Tenum_nameof: return array not created");
- } /* end if */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jstring str = NULL;
+ jbyte *byteP = NULL;
+ char *nameP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (size <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: name size < 0");
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_nameof: value is NULL");
+
+ if (NULL == (nameP = (char *) HDmalloc(sizeof(char) * (size_t)size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tenum_nameof: failed to allocate name buffer");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tenum_nameof: value not pinned");
+
+ if ((status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ nameP[(size_t)size - 1] = '\0';
+
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, nameP)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, JNI_ABORT);
+ if (nameP)
+ HDfree(nameP);
return str;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof */
@@ -1212,34 +1285,30 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_valueof: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tenum_valueof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_valueof((hid_t)type_id, nameP, intP);
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *enumValue = NULL;
+ jboolean isCopy;
+ jint *enumValueBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof_int: enum value name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof_int: enum value not pinned");
+
+ PIN_INT_ARRAY(ENVONLY, value, enumValueBuf, &isCopy, "H5Tenum_valueof_int: enum value buffer not pinned");
+
+ if ((status = H5Tenum_valueof((hid_t)type_id, enumValue, enumValueBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (enumValueBuf)
+ UNPIN_INT_ARRAY(ENVONLY, value, enumValueBuf, (status < 0) ? JNI_ABORT : 0);
+ if (enumValue)
+ UNPIN_JAVA_STRING(ENVONLY, name, enumValue);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int */
@@ -1253,34 +1322,30 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tenum_1valueof
(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- const char *nameP;
- jboolean isCopy2;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tenum_valueof: value is NULL");
- } /* end if */
- else {
- PIN_JAVA_STRING(name, nameP);
- if (nameP != NULL) {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tenum_valueof: value not pinned");
- } /* end if */
- else {
- status = H5Tenum_valueof((hid_t)type_id, nameP, byteP);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- UNPIN_JAVA_STRING(name, nameP);
- }
- } /* end else */
+ const char *enumValue = NULL;
+ jboolean isCopy;
+ jbyte *enumValueBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: value is NULL");
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tenum_valueof: enum value name is NULL");
+
+ PIN_JAVA_STRING(ENVONLY, name, enumValue, NULL, "H5Tenum_valueof: enum value not pinned");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, enumValueBuf, &isCopy, "H5Tenum_valueof: enum value buffer not pinned");
+
+ if ((status = H5Tenum_valueof((hid_t)type_id, enumValue, enumValueBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (enumValueBuf)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, enumValueBuf, (status < 0) ? JNI_ABORT : 0);
+ if (enumValue)
+ UNPIN_JAVA_STRING(ENVONLY, name, enumValue);
} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof */
/*
@@ -1292,30 +1357,23 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int
(JNIEnv *env, jclass clss, jlong type_id, jint membno, jintArray value)
{
- herr_t status = -1;
- jint *intP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5nullArgument(env, "H5Tget_member_value: value is NULL");
- } /* end if */
- else {
- intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy);
- if (intP == NULL) {
- h5JNIFatalError(env, "H5Tget_member_value: value not pinned");
- } /* end if */
- else {
- status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP);
-
-
- if (status < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jint *intP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_value: value is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, value, intP, &isCopy, "H5Tget_member_value: value not pinned");
+
+ if ((status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (intP)
+ UNPIN_INT_ARRAY(ENVONLY, value, intP, (status < 0) ? JNI_ABORT : 0);
return (jint)status;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int */
@@ -1329,29 +1387,23 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1member_1value
(JNIEnv *env, jclass clss, jlong type_id, jint membno, jbyteArray value)
{
- herr_t status = -1;
- jbyte *byteP;
- jboolean isCopy;
-
- if (value == NULL) {
- h5nullArgument( env, "H5Tget_member_value: value is NULL");
- } /* end if */
- else {
- byteP = ENVPTR->GetByteArrayElements(ENVPAR value,&isCopy);
- if (byteP == NULL) {
- h5JNIFatalError(env, "H5Tget_member_value: value not pinned");
- } /* end if */
- else {
- status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP);
-
- if (status < 0) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else
- ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *byteP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == value)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_member_value: value is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, value, byteP, &isCopy, "H5Tget_member_value: value not pinned");
+
+ if ((status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (byteP)
+ UNPIN_BYTE_ARRAY(ENVONLY, value, byteP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value */
/*
@@ -1365,10 +1417,12 @@ Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims
{
int ndims = -1;
- ndims = H5Tget_array_ndims((hid_t)type_id);
- if (ndims < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((ndims = H5Tget_array_ndims((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims */
@@ -1381,41 +1435,41 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1array_1dims
(JNIEnv *env, jclass clss, jlong type_id, jintArray dims, jintArray perms)
{
- int ndims = -1;
- int dlen;
- int i;
- jint *dimsP;
- hsize_t *cdims = NULL;
- jboolean isCopy;
-
- if (dims == NULL) {
- h5nullArgument( env, "H5Tget_array_dims: value is NULL");
- } /* end if */
- else {
- dimsP = ENVPTR->GetIntArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
-
- ndims = H5Tget_array_dims2((hid_t)type_id, cdims);
-
- if (ndims < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < dlen; i++) {
- dimsP[i] = (jint) cdims[i];
- } /* end for */
- ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, 0);
-
- if (cdims) HDfree(cdims);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jsize dlen;
+ jint *dimsP = NULL;
+ int ndims = -1;
+
+ UNUSED(clss);
+ UNUSED(perms);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tget_array_dims: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tget_array_dims: dims array length < 0");
+ }
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tget_array_dims: failed to allocate dimension buffer");
+
+ if ((ndims = H5Tget_array_dims2((hid_t)type_id, cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ dimsP[i] = (jint) cdims[i];
+ } /* end for */
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_INT_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0);
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims */
@@ -1431,12 +1485,14 @@ Java_hdf_hdf5lib_H5_H5Tis_1variable_1str
{
htri_t bval = JNI_FALSE;
- bval = H5Tis_variable_str((hid_t)type_id);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Tis_variable_str((hid_t)type_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tis_1variable_1str */
@@ -1449,13 +1505,14 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tget_1native_1type
(JNIEnv *env, jclass clss, jlong type_id, jint direction)
{
- hid_t native_tid = -1;
+ hid_t native_tid = H5I_INVALID_HID;
- native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction);
+ UNUSED(clss);
- if (native_tid < 0)
- h5libraryError(env);
+ if ((native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jlong)native_tid;
} /* end Java_hdf_hdf5lib_H5__1H5Tget_1native_1type */
@@ -1470,12 +1527,14 @@ Java_hdf_hdf5lib_H5_H5Tdetect_1class
{
htri_t bval = JNI_FALSE;
- bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class);
- if (bval > 0)
- bval = JNI_TRUE;
- else if (bval < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if ((bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ bval = (bval > 0) ? JNI_TRUE : JNI_FALSE;
+done:
return (jboolean)bval;
} /* end Java_hdf_hdf5lib_H5_H5Tdetect_1class */
@@ -1489,18 +1548,22 @@ Java_hdf_hdf5lib_H5_H5Tcommit
(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type,
jlong link_plist_id, jlong create_plist_id, jlong access_plist_id)
{
- herr_t status = -1;
- const char *tName;
+ const char *datatypeName = NULL;
+ herr_t status = FAIL;
- PIN_JAVA_STRING(name, tName);
- if (tName != NULL) {
- status = H5Tcommit2((hid_t)loc_id, tName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id);
+ UNUSED(clss);
- UNPIN_JAVA_STRING(name, tName);
+ if (NULL == name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tcommit: datatype name is NULL");
- if (status < 0)
- h5libraryError(env);
- }
+ PIN_JAVA_STRING(ENVONLY, name, datatypeName, NULL, "H5Tcommit: datatype name not pinned");
+
+ if ((status = H5Tcommit2((hid_t)loc_id, datatypeName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (datatypeName)
+ UNPIN_JAVA_STRING(ENVONLY, name, datatypeName);
} /* end Java_hdf_hdf5lib_H5_H5Tcommit */
/*
@@ -1512,45 +1575,45 @@ JNIEXPORT jlong JNICALL
Java_hdf_hdf5lib_H5__1H5Tarray_1create2
(JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims)
{
- hid_t retVal = -1;
- jlong *dimsP;
- int dlen;
- hsize_t *cdims = NULL;
- jboolean isCopy;
- int i;
-
- if (rank <= 0) {
- h5badArgument(env, "H5Tarray_create: rank is < 1");
- } /* end if */
- else if (dims == NULL) {
- h5nullArgument(env, "H5Tarray_create: dims is NULL");
- } /* end else if */
- else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError( env, "H5Tarray_create: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- if (dlen != rank) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- } /* end if */
- else {
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
- for (i = 0; i < dlen; i++) {
- cdims[i] = (hsize_t)dimsP[i];
- } /* end for */
-
- retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t*)cdims);
-
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
-
- HDfree(cdims);
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong *dimsP = NULL;
+ jsize dlen;
+ hid_t retVal = H5I_INVALID_HID;
+
+ UNUSED(clss);
+
+ if (rank <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: rank is < 1");
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tarray_create: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_create: dims array length < 0");
+ }
+
+ if (dlen != rank)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_create: dimension array length != array rank");
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_create: failed to allocate dimension buffer");
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ cdims[i] = (hsize_t)dimsP[i];
+ } /* end for */
+
+ if ((retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t *)cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (retVal < 0) ? JNI_ABORT : 0);
return (jlong)retVal;
} /* end Java_hdf_hdf5lib_H5__1H5Tarray_1create2 */
@@ -1564,44 +1627,40 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2
(JNIEnv *env, jclass clss, jlong type_id, jlongArray dims)
{
- int ndims = -1;
- int dlen;
- int i;
- jlong *dimsP;
- hsize_t *cdims=NULL;
- jboolean isCopy;
-
- if (dims == NULL) {
- h5nullArgument(env, "H5Tget_array_dims: value is NULL");
- } /* end if */
- else {
- dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims,&isCopy);
- if (dimsP == NULL) {
- h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned");
- } /* end if */
- else {
- dlen = ENVPTR->GetArrayLength(ENVPAR dims);
- cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t));
-
- ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims);
-
- if (ndims < 0) {
- if (cdims)
- free(cdims);
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
- h5libraryError(env);
- } /* end if */
- else {
- for (i = 0; i < dlen; i++) {
- dimsP[i] = (jlong) cdims[i];
- } /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0);
-
- if (cdims)
- HDfree(cdims);
- } /* end else */
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ hsize_t *cdims = NULL;
+ size_t i;
+ jlong *dimsP = NULL;
+ jsize dlen;
+ int ndims = -1;
+
+ UNUSED(clss);
+
+ if (NULL == dims)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: value is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, dims, dimsP, &isCopy, "H5Tarray_get_dims2: dimsP not pinned");
+
+ if ((dlen = ENVPTR->GetArrayLength(ENVONLY, dims)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tarray_get_dims2: dims array length < 0");
+ }
+
+ if (NULL == (cdims = (hsize_t *) HDmalloc((size_t)dlen * sizeof(hsize_t))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Tarray_get_dims2: failed to allocate dimension buffer");
+
+ if ((ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0; i < (size_t) dlen; i++) {
+ dimsP[i] = (jlong) cdims[i];
+ } /* end for */
+
+done:
+ if (cdims)
+ HDfree(cdims);
+ if (dimsP)
+ UNPIN_LONG_ARRAY(ENVONLY, dims, dimsP, (ndims < 0) ? JNI_ABORT : 0);
return (jint)ndims;
} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 */
@@ -1616,34 +1675,29 @@ Java_hdf_hdf5lib_H5_H5Tconvert
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts,
jbyteArray buf, jbyteArray background, jlong plist_id)
{
- herr_t status;
- jbyte *bufP;
- jbyte *bgP = NULL;
- jboolean isCopy;
-
- if (nelmts <= 0) {
- h5badArgument(env, "H5Tconvert: name nelmts < 0");
- } /* end if */
- else {
- bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy);
- if (bufP == NULL) {
- h5JNIFatalError(env, "H5Tconvert: value not pinned");
- } /* end if */
- else {
- if (background)
- bgP = ENVPTR->GetByteArrayElements(ENVPAR background, &isCopy);
-
- status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id) ;
-
- ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, 0);
-
- if (bgP)
- ENVPTR->ReleaseByteArrayElements(ENVPAR background, bgP, 0);
-
- if (status < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
+ jboolean isCopy;
+ jbyte *bufP = NULL;
+ jbyte *bgP = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ if (nelmts <= 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5Tconvert: nelmts < 0");
+
+ PIN_BYTE_ARRAY(ENVONLY, buf, bufP, &isCopy, "H5Tconvert: buffer not pinned");
+
+ if (background)
+ PIN_BYTE_ARRAY(ENVONLY, background, bgP, &isCopy, "H5Tconvert: background buffer not pinned");
+
+ if ((status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (bgP)
+ UNPIN_BYTE_ARRAY(ENVONLY, background, bgP, (status < 0) ? JNI_ABORT : 0);
+ if (bufP)
+ UNPIN_BYTE_ARRAY(ENVONLY, buf, bufP, (status < 0) ? JNI_ABORT : 0);
} /* end Java_hdf_hdf5lib_H5_H5Tconvert */
/*
@@ -1654,8 +1708,13 @@ Java_hdf_hdf5lib_H5_H5Tconvert
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Tflush(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Tflush((hid_t)loc_id) < 0)
- h5libraryError(env);
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return;
}
/*
@@ -1666,10 +1725,14 @@ Java_hdf_hdf5lib_H5_H5Tflush(JNIEnv *env, jclass clss, jlong loc_id)
JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5Trefresh(JNIEnv *env, jclass clss, jlong loc_id)
{
+ UNUSED(clss);
+
if (H5Trefresh((hid_t)loc_id) < 0)
- h5libraryError(env);
-}
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
+ return;
+}
#ifdef __cplusplus
diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c
index fd34ba1..5454dce 100644
--- a/java/src/jni/h5util.c
+++ b/java/src/jni/h5util.c
@@ -32,7 +32,11 @@ extern "C" {
hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
+/*
+ * Pointer to the JNI's Virtual Machine; used for callback functions.
+ */
JavaVM *jvm;
+
jobject copy_callback;
jobject close_callback;
jobject create_callback;
@@ -41,22 +45,22 @@ jobject get_callback;
jobject set_callback;
jobject delete_callback;
-H5E_auto2_t efunc;
-void *edata;
+H5E_auto2_t efunc;
+void *edata;
/********************/
/* Local Prototypes */
/********************/
-static int h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_obj);
-static int h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_obj);
+static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
static int h5str_is_zero(const void *_mem, size_t size);
static hid_t h5str_get_native_type(hid_t type);
static hid_t h5str_get_little_endian_type(hid_t type);
static hid_t h5str_get_big_endian_type(hid_t type);
static htri_t h5str_detect_vlen(hid_t tid);
static htri_t h5str_detect_vlen_str(hid_t tid);
-static int h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts);
+static int h5tools_dump_simple_data(JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts);
static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts);
static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id,
hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata);
@@ -78,9 +82,10 @@ h5str_array_free
return;
for (i = 0; i < len; i++) {
- if (*(strs + i))
- HDfree(*(strs + i));
+ if (strs[i])
+ HDfree(strs[i]);
} /* for (i=0; i<n; i++)*/
+
HDfree(strs);
} /* end h5str_array_free */
@@ -108,6 +113,9 @@ h5str_free
} /* end h5str_free */
/** reset the max size of the string */
+/*
+ * TODO: no error return. malloc can fail.
+ */
void
h5str_resize
(h5str_t *str, size_t new_len)
@@ -117,7 +125,9 @@ h5str_resize
if (!str || new_len <= 0 || str->max == new_len)
return;
- new_str = (char *)HDmalloc(new_len);
+ if (NULL == (new_str = (char *) HDmalloc(new_len)))
+ return;
+
if (new_len > str->max) /* increase memory */
HDstrcpy(new_str, str->s);
else
@@ -152,860 +162,1048 @@ h5str_append
return HDstrcat(str->s, cstr);
} /* end h5str_append */
-/** print value of a vlen data point into string.
- Return Value:
- On success, the total number of characters printed is returned.
- On error, a negative number is returned.
+/*
+ * Converts the given data point string into a real data point.
+ *
+ * Returns:
+ * SUCCESS: Length of string token processed
+ * FAILURE: 0
*/
size_t
-h5str_vlconvert
- (char *str, hid_t container, hid_t tid, hvl_t *ptr, int expand_data)
+h5str_convert
+ (JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset)
{
- unsigned char tmp_uchar = 0;
- char tmp_char = 0;
- unsigned short tmp_ushort = 0;
- short tmp_short = 0;
- unsigned int tmp_uint = 0;
- int tmp_int = 0;
- unsigned long tmp_ulong = 0;
- long tmp_long = 0;
- unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
- float tmp_float = 0.0;
- double tmp_double = 0.0;
- long double tmp_ldouble = 0.0;
- static char fmt_llong[8], fmt_ullong[8];
-
- hid_t mtid = -1;
- size_t offset;
- size_t nll;
- char *this_str;
- size_t this_strlen;
- int n;
- H5T_class_t tclass = H5Tget_class(tid);
- size_t size = H5Tget_size(tid);
- H5T_sign_t nsign = H5Tget_sign(tid);
- int bdata_print = 0;
-
- if (!str || !ptr)
- return 0;
-
- this_str = NULL;
- this_strlen = 0;
+ unsigned char *ucptr = NULL;
+ static char fmt_llong[8], fmt_ullong[8];
+ H5T_class_t tclass = H5T_NO_CLASS;
+ const char delimiter[] = " ," H5_COMPOUND_BEGIN_INDICATOR H5_COMPOUND_END_INDICATOR \
+ H5_ARRAY_BEGIN_INDICATOR H5_ARRAY_END_INDICATOR \
+ H5_VLEN_BEGIN_INDICATOR H5_VLEN_END_INDICATOR;
+ size_t typeSize = 0;
+ hid_t mtid = H5I_INVALID_HID;
+ char *this_str = NULL;
+ char *token;
+ char *cptr = NULL;
+ int n;
+ size_t retVal = 0;
+
+ if (!in_str)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: in_str is NULL");
+ if (!out_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_convert: out_buf is NULL");
+
+ this_str = *in_str;
+ cptr = &(((char *) out_buf)[out_buf_offset]);
+ ucptr = &(((unsigned char *) out_buf)[out_buf_offset]);
+
+ if (H5T_NO_CLASS == (tclass = H5Tget_class(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Build default formats for long long types */
+ if (!fmt_llong[0]) {
+ if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
+ if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: HDsprintf failure");
+ } /* end if */
switch (tclass) {
- case H5T_COMPOUND:
+ case H5T_FLOAT:
{
- unsigned i;
- n = H5Tget_nmembers(tid);
+ token = HDstrtok(this_str, delimiter);
+
+ switch (typeSize) {
+ case sizeof(float):
+ {
+ float tmp_float = 0.0;
- /* remove compound indicators */
- if (str[0] == ' ')
- str++;
- if (str[0] == '{')
- str++;
+ sscanf(token, "%f", &tmp_float);
+ HDmemcpy(cptr, &tmp_float, sizeof(float));
+ break;
+ }
- ptr->p = HDcalloc((size_t)1, size);
- ptr->len = size;
- for (i = 0; i < n; i++) {
- offset = H5Tget_member_offset(tid, i);
- mtid = H5Tget_member_type(tid, i);
- str += offset;
- h5str_convert(&str, container, mtid, ptr, 0, expand_data);
- /* remove compound indicators */
- if (str[0] == ',')
- str++;
- if (str[0] == ' ')
- str++;
- H5Tclose(mtid);
+ case sizeof(double):
+ {
+ double tmp_double = 0.0;
+
+ sscanf(token, "%lf", &tmp_double);
+ HDmemcpy(cptr, &tmp_double, sizeof(double));
+ break;
+ }
+#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case sizeof(long double):
+ {
+ long double tmp_ldouble = 0.0;
+
+ sscanf(token, "%Lf", &tmp_ldouble);
+ HDmemcpy(cptr, &tmp_ldouble, sizeof(long double));
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: floating-point datatype size didn't match any of expected sizes");
+ break;
}
- /* remove compound indicators */
- if (str[0] == '}')
- str++;
- if (str[0] == ' ')
- str++;
+
+ retVal = typeSize;
+
+ break;
}
- break;
- case H5T_ARRAY:
+
+ case H5T_STRING:
{
- int rank = 0;
- hsize_t i, dims[H5S_MAX_RANK], total_elmts;
+ size_t len = HDstrlen(this_str);
- /* remove array indicators */
- if (str[0] == '[')
- str++;
- if (str[0] == ' ')
- str++;
+ if (len > 0) {
+ HDstrncpy(cptr, this_str, typeSize);
+ cptr[typeSize - 1] = '\0';
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
- rank = H5Tget_array_ndims(tid);
+ retVal = typeSize;
+ }
+ else {
+ cptr = NULL;
+ }
- H5Tget_array_dims2(tid, dims);
+ break;
+ }
- total_elmts = 1;
- for (i = 0; i < rank; i++)
- total_elmts *= dims[i];
+ case H5T_INTEGER:
+ {
+ H5T_sign_t nsign = H5T_SGN_ERROR;
- ptr->p = HDcalloc((size_t)total_elmts, size);
- ptr->len = total_elmts;
- h5str_convert(&str, container, mtid, ptr, 0, expand_data);
- H5Tclose(mtid);
- /* remove array indicators */
- if (str[0] == ' ')
- str++;
- if (str[0] == ']')
- str++;
- if (str[0] == ' ')
- str++;
- }
- break;
- default:
- ptr->len = size;
- ptr->p = HDcalloc(1, size);
- this_strlen = h5str_convert(&str, container, tid, ptr, 0, expand_data);
- break;
- } /* end switch */
+ if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
- return this_strlen;
-} /* end h5str_vlconvert */
+ token = HDstrtok(this_str, delimiter);
-/** print value of a data point into string.
- Return Value:
- On success, the total number of characters printed is returned.
- On error, a negative number is returned.
- */
-size_t
-h5str_convert
- (char **str, hid_t container, hid_t tid, hvl_t *ptr, int ptroffset, int expand_data)
-{
- unsigned char tmp_uchar = 0;
- char tmp_char = 0;
- unsigned short tmp_ushort = 0;
- short tmp_short = 0;
- unsigned int tmp_uint = 0;
- int tmp_int = 0;
- unsigned long tmp_ulong = 0;
- long tmp_long = 0;
- unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
- float tmp_float = 0.0;
- double tmp_double = 0.0;
- long double tmp_ldouble = 0.0;
- static char fmt_llong[8], fmt_ullong[8];
- const char delimiter[] = " ,}]";
-
- char *token;
- hid_t mtid = -1;
- size_t offset;
- size_t nll;
- char *this_str = *str;
- size_t this_strlen;
- int n;
- char *cptr = ((char*) ((hvl_t *) ptr)->p) + ptroffset;
- unsigned char *ucptr = ((unsigned char*) ((hvl_t *) ptr)->p) + ptroffset;
- H5T_class_t tclass = H5Tget_class(tid);
- size_t size = H5Tget_size(tid);
- H5T_sign_t nsign = H5Tget_sign(tid);
- int bdata_print = 0;
-
- if (!str || !ptr)
- return 0;
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ signed char tmp_char = 0;
- /* Build default formats for long long types */
- if (!fmt_llong[0]) {
- sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
- } /* end if */
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%hhu", &tmp_uchar);
+ HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char));
+ }
+ else {
+ sscanf(token, "%hhd", &tmp_char);
+ HDmemcpy(cptr, &tmp_char, sizeof(char));
+ }
- this_strlen = HDstrlen(this_str);
+ break;
+ }
- switch (tclass) {
- case H5T_FLOAT:
- token = HDstrtok (this_str, delimiter);
- if (sizeof(float) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */
- tmp_float = 0;
- sscanf(token, "%f", &tmp_float);
- HDmemcpy(cptr, &tmp_float, sizeof(float));
- }
- else if (sizeof(double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */
- tmp_double = 0;
- sscanf(token, "%%lf", &tmp_double);
- HDmemcpy(cptr, &tmp_double, sizeof(double));
- }
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (sizeof(long double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */
- tmp_ldouble = 0;
- sscanf(token, "%Lf", &tmp_ldouble);
- HDmemcpy(cptr, &tmp_ldouble, sizeof(long double));
- }
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ short tmp_short = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%hu", &tmp_ushort);
+ HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
+ }
+ else {
+ sscanf(token, "%hd", &tmp_short);
+ HDmemcpy(&tmp_short, cptr, sizeof(short));
+ }
+
+ break;
+ }
+
+ case sizeof(int):
+ {
+ unsigned int tmp_uint = 0;
+ int tmp_int = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%u", &tmp_uint);
+ HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int));
+ }
+ else {
+ sscanf(token, "%d", &tmp_int);
+ HDmemcpy(cptr, &tmp_int, sizeof(int));
+ }
+
+ break;
+ }
+
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ long tmp_long = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, "%lu", &tmp_ulong);
+ HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long));
+ }
+ else {
+ sscanf(token, "%ld", &tmp_long);
+ HDmemcpy(cptr, &tmp_long, sizeof(long));
+ }
+
+ break;
+ }
#endif
- break;
- case H5T_STRING:
- {
- if (this_strlen > 0) {
- HDstrncpy(cptr, this_str, size);
- }
- else {
- cptr = NULL;
- }
- }
- break;
- case H5T_INTEGER:
- token = HDstrtok (this_str, delimiter);
- if (sizeof(char) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */
- tmp_uchar = 0;
- sscanf(token, "%hu", &tmp_uchar);
- HDmemcpy(cptr, &tmp_uchar, sizeof(unsigned char));
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */
- tmp_char = 0;
- sscanf(token, "%hd", &tmp_char);
- HDmemcpy(cptr, &tmp_char, sizeof(char));
- }
- }
- else if (sizeof(int) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UINT)) */
- tmp_uint = 0;
- sscanf(token, "%u", &tmp_uint);
- HDmemcpy(cptr, &tmp_uint, sizeof(unsigned int));
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_INT)) */
- tmp_int = 0;
- sscanf(token, "%d", &tmp_int);
- HDmemcpy(cptr, &tmp_int, sizeof(int));
- }
- }
- else if (sizeof(short) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */
- tmp_ushort = 0;
- sscanf(token, "%u", &tmp_ushort);
- HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */
- tmp_short = 0;
- sscanf(token, "%d", &tmp_short);
- HDmemcpy(&tmp_short, cptr, sizeof(short));
- }
- }
- else if (sizeof(long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */
- tmp_ulong = 0;
- sscanf(token, "%lu", &tmp_ulong);
- HDmemcpy(cptr, &tmp_ulong, sizeof(unsigned long));
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_LONG)) */
- tmp_long = 0;
- sscanf(token, "%ld", &tmp_long);
- HDmemcpy(cptr, &tmp_long, sizeof(long));
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ long long tmp_llong = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ sscanf(token, fmt_ullong, &tmp_ullong);
+ HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long));
+ }
+ else {
+ sscanf(token, fmt_llong, &tmp_llong);
+ HDmemcpy(cptr, &tmp_llong, sizeof(long long));
+ }
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: integer datatype size didn't match any of expected sizes");
+ break;
}
+
+ retVal = typeSize;
+
+ break;
}
- else if (sizeof(long long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */
- tmp_ullong = 0;
- sscanf(token, fmt_ullong, &tmp_ullong);
- HDmemcpy(cptr, &tmp_ullong, sizeof(unsigned long long));
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */
- tmp_llong = 0;
- sscanf(token, fmt_llong, &tmp_llong);
- HDmemcpy(cptr, &tmp_llong, sizeof(long long));
+
+ case H5T_COMPOUND:
+ {
+ unsigned i;
+ size_t member_offset;
+
+ if ((n = H5Tget_nmembers(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Skip whitespace and compound indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '{') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ for (i = 0; i < (unsigned) n; i++) {
+ member_offset = H5Tget_member_offset(tid, i);
+
+ if ((mtid = H5Tget_member_type(tid, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, member_offset)) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ goto done;
+ }
+
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
}
+
+ /* Skip whitespace and compound indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '}') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize * (size_t) n;
+
+ break;
}
- break;
- case H5T_COMPOUND:
- {
- unsigned i;
- n = H5Tget_nmembers(tid);
- /* remove compound indicators */
- if ((*str)[0] == ' ')
- (*str)++;
- if ((*str)[0] == '{')
- (*str)++;
-
- for (i = 0; i < n; i++) {
- offset = H5Tget_member_offset(tid, i);
- mtid = H5Tget_member_type(tid, i);
- h5str_convert(str, container, mtid, ptr, offset, expand_data);
- /* remove compound indicators */
- if ((*str)[0] == ',')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
- H5Tclose(mtid);
- }
- /* remove compound indicators */
- if ((*str)[0] == '}')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
- }
- break;
- case H5T_ENUM:
- {
- char enum_name[1024];
- void *value;
- if (sizeof(char) == size) {
- tmp_uchar = 0;
- value = &tmp_uchar;
- }
- else if (sizeof(short) == size) {
- tmp_ushort = 0;
- value = &tmp_ushort;
- }
- else if (sizeof(long) == size) {
- tmp_ulong = 0;
- value = &tmp_ulong;
- }
- else if (sizeof(long long) == size) {
- tmp_ullong = 0;
- value = &tmp_ullong;
- }
- else {
- tmp_uint = 0;
- value = &tmp_uint;
- }
- token = HDstrtok (this_str, delimiter);
- H5Tenum_valueof(tid, token, value);
- HDmemcpy(ucptr, value, size);
- }
- break;
- case H5T_REFERENCE:
+
/* TODO handle reference writing */
- cptr = NULL;
- break;
- case H5T_ARRAY:
- {
- int rank = 0;
- hsize_t i, dims[H5S_MAX_RANK], total_elmts;
- /* remove array indicators */
- if ((*str)[0] == '[')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
-
- mtid = H5Tget_super(tid);
- offset = H5Tget_size(mtid);
- rank = H5Tget_array_ndims(tid);
-
- H5Tget_array_dims2(tid, dims);
-
- total_elmts = 1;
- for (i = 0; i < rank; i++)
- total_elmts *= dims[i];
-
- cptr = HDcalloc((size_t)total_elmts, offset);
- for (i = 0; i < total_elmts; i++) {
- h5str_convert(str, container, mtid, cptr + (i*offset), offset, expand_data);
- /* remove array indicators */
- if ((*str)[0] == ',')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
- }
- H5Tclose(mtid);
- /* remove array indicators */
- if ((*str)[0] == ' ')
- (*str)++;
- if ((*str)[0] == ']')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
- }
- break;
- case H5T_VLEN:
+ case H5T_REFERENCE:
+ cptr = NULL;
+ break;
+
+ case H5T_ENUM:
{
- unsigned int i;
- mtid = H5Tget_super(tid);
- offset = H5Tget_size(mtid);
-
- /* remove vlen indicators */
- if ((*str)[0] == '{')
- (*str)++;
- cptr = HDcalloc(offset, sizeof(hvl_t));
- for (i = 0; (i*offset) < (int)size; i++) {
- h5str_convert(str, container, mtid, cptr + (i*offset), offset, expand_data);
- /* remove vlen indicators */
- if ((*str)[0] == ',')
- (*str)++;
- if ((*str)[0] == ' ')
- (*str)++;
- if ((*str)[0] == '}')
+ void *value;
+
+ token = HDstrtok(this_str, delimiter);
+
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ value = &tmp_uchar;
+ break;
+ }
+
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ value = &tmp_ushort;
+ break;
+ }
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ value = &tmp_ulong;
break;
+ }
+#endif
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ value = &tmp_ullong;
+ break;
+ }
+#endif
+
+ default:
+ {
+ unsigned int tmp_uint = 0;
+ value = &tmp_uint;
+ break;
+ }
}
- H5Tclose(mtid);
- /* remove vlen indicators */
- if ((*str)[0] == '}')
- (*str)++;
+
+ if (H5Tenum_valueof(tid, token, value) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ HDmemcpy(ucptr, value, typeSize);
+
+ retVal = typeSize;
+
+ break;
}
- break;
- default:
- {
- /* All other types get copied raw */
- HDmemcpy(ucptr, this_str, size);
- }
- break;
- } /* end switch */
+ case H5T_ARRAY:
+ {
+ hsize_t i, dims[H5S_MAX_RANK], total_elmts;
+ size_t baseTypeSize;
+ int rank = 0;
- return this_strlen;
-} /* end h5str_convert */
+ /* Skip whitespace and array indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '[') this_str++;
+ while (*this_str == ' ') this_str++;
-/** print value of a vlen data point into string.
- Return Value:
- On success, the total number of characters printed is returned.
- On error, a negative number is returned.
- */
-size_t
-h5str_vlsprintf
- (h5str_t *str, hid_t container, hid_t tid, hvl_t *ptr, int expand_data)
-{
- unsigned char tmp_uchar = 0;
- char tmp_char = 0;
- unsigned short tmp_ushort = 0;
- short tmp_short = 0;
- unsigned int tmp_uint = 0;
- int tmp_int = 0;
- unsigned long tmp_ulong = 0;
- long tmp_long = 0;
- unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
- float tmp_float = 0.0;
- double tmp_double = 0.0;
- long double tmp_ldouble = 0.0;
- static char fmt_llong[8], fmt_ullong[8];
-
- hid_t mtid = -1;
- size_t offset;
- size_t nll;
- char *this_str;
- size_t this_strlen;
- int n;
- H5T_class_t tclass = H5Tget_class(tid);
- size_t size = H5Tget_size(tid);
- H5T_sign_t nsign = H5Tget_sign(tid);
- int bdata_print = 0;
-
- if (!str || !ptr)
- return 0;
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* Build default formats for long long types */
- if (!fmt_llong[0]) {
- sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
- } /* end if */
+ if (!(baseTypeSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
- this_str = NULL;
- this_strlen = 0;
+ if ((rank = H5Tget_array_ndims(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- switch (tclass) {
- case H5T_COMPOUND:
- {
- unsigned i;
- n = H5Tget_nmembers(tid);
- h5str_append(str, " {");
+ if (H5Tget_array_dims2(tid, dims) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- for (i = 0; i < n; i++) {
- offset = H5Tget_member_offset(tid, i);
- mtid = H5Tget_member_type(tid, i);
- h5str_sprintf(str, container, mtid, ((char *) (ptr->p)) + offset, ptr->len, expand_data);
- if ((i + 1) < n)
- h5str_append(str, ", ");
- H5Tclose(mtid);
+ for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ total_elmts *= dims[i];
+
+ if (NULL == (cptr = (char *) HDcalloc((size_t)total_elmts, baseTypeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to allocate array buffer");
+
+ for (i = 0; i < total_elmts; i++) {
+ if (!(h5str_convert(ENVONLY, &this_str, container, mtid, out_buf, i * baseTypeSize))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ goto done;
+ }
+
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
}
- h5str_append(str, "} ");
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ /* Skip whitespace and array indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ']') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize * total_elmts;
+
+ break;
}
- break;
- case H5T_ARRAY:
+
+ case H5T_VLEN:
{
- int rank = 0;
- hsize_t i, dims[H5S_MAX_RANK], total_elmts;
- h5str_append(str, "[ ");
+ size_t i, baseTypeSize;
+ hvl_t *vl_buf = (hvl_t *) out_buf;
+ char cur_char;
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseTypeSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (vl_buf->p = HDmalloc(baseTypeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to allocate vlen buffer");
+ vl_buf->len = 1;
+
+ /* Skip whitespace and vlen indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == '(') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ cur_char = *this_str;
+ for (i = 0; cur_char != ')' && cur_char != '\0'; i++) {
+ if (i >= vl_buf->len) {
+ char *tmp_realloc;
+
+ if (NULL == (tmp_realloc = (char *) HDrealloc(vl_buf->p, vl_buf->len * 2 * baseTypeSize)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_convert: failed to reallocate vlen buffer");
+ vl_buf->len *= 2;
+ vl_buf->p = tmp_realloc;
+ }
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
- rank = H5Tget_array_ndims(tid);
+ if (!(h5str_convert(ENVONLY, &this_str, container, mtid, vl_buf->p, i * baseTypeSize))) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ vl_buf->len = i;
+ goto done;
+ }
- H5Tget_array_dims2(tid, dims);
+ /* Skip whitespace and commas */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ',') this_str++;
+ while (*this_str == ' ') this_str++;
+ }
- total_elmts = 1;
- for (i = 0; i < rank; i++)
- total_elmts *= dims[i];
+ vl_buf->len = i;
- h5str_sprintf(str, container, mtid, ((char *) (ptr->p)), ptr->len, expand_data);
- H5Tclose(mtid);
- h5str_append(str, " ] ");
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ /* Skip whitespace and vlen indicators */
+ while (*this_str == ' ') this_str++;
+ if (*this_str == ')') this_str++;
+ while (*this_str == ' ') this_str++;
+
+ retVal = typeSize;
+
+ break;
+ }
+
+ case H5T_NCLASSES:
+ case H5T_NO_CLASS:
+ {
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_convert: invalid datatype class");
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ {
+ /* All other types get copied raw */
+ HDmemcpy(ucptr, this_str, typeSize);
+
+ retVal = typeSize;
+
+ break;
}
- break;
- default:
- this_strlen = h5str_sprintf(str, container, tid, ((char *) (ptr->p)), ptr->len, expand_data);
- break;
} /* end switch */
- return this_strlen;
-} /* end h5str_vlsprintf */
+done:
+ if (mtid >= 0)
+ H5Tclose(mtid);
-/** print value of a data point into string.
- Return Value:
- On success, the total number of characters printed is returned.
- On error, a negative number is returned.
+ return retVal;
+} /* end h5str_convert */
+
+/*
+ * Prints the value of a data point into a string.
+ *
+ * Returns:
+ * SUCCESS: Total number of characters printed
+ * FAILURE: 0
*/
size_t
h5str_sprintf
- (h5str_t *str, hid_t container, hid_t tid, void *ptr, int ptr_len, int expand_data)
+ (JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data)
{
- unsigned char tmp_uchar = 0;
- char tmp_char = 0;
- unsigned short tmp_ushort = 0;
- short tmp_short = 0;
- unsigned int tmp_uint = 0;
- int tmp_int = 0;
- unsigned long tmp_ulong = 0;
- long tmp_long = 0;
- unsigned long long tmp_ullong = 0;
- long long tmp_llong = 0;
- float tmp_float = 0.0;
- double tmp_double = 0.0;
- long double tmp_ldouble = 0.0;
- static char fmt_llong[8], fmt_ullong[8];
-
- hid_t mtid = -1;
- size_t offset;
- size_t nll;
- char *this_str;
- size_t this_strlen;
- int n;
- char *cptr = (char*) (ptr);
- unsigned char *ucptr = (unsigned char*) (ptr);
- H5T_class_t tclass = H5Tget_class(tid);
- size_t size = H5Tget_size(tid);
- H5T_sign_t nsign = H5Tget_sign(tid);
- int bdata_print = 0;
-
- if (!str || !ptr)
- return 0;
+ unsigned char *ucptr = (unsigned char *) in_buf;
+ static char fmt_llong[8], fmt_ullong[8];
+ H5T_class_t tclass = H5T_NO_CLASS;
+ size_t typeSize = 0;
+ hid_t mtid = H5I_INVALID_HID;
+ char *cptr = (char *) in_buf;
+ char *this_str = NULL;
+ int n;
+ size_t retVal = 0;
+
+ if (!out_str)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: out_str is NULL");
+ if (!in_buf)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: in_buf is NULL");
+
+ if (H5T_NO_CLASS == (tclass = H5Tget_class(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(typeSize = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
/* Build default formats for long long types */
if (!fmt_llong[0]) {
- sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH);
- sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH);
+ if (HDsprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure");
+ if (HDsprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: sprintf failure");
} /* end if */
- this_str = NULL;
- this_strlen = 0;
-
switch (tclass) {
- case H5T_FLOAT:
- if (sizeof(float) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */
- HDmemcpy(&tmp_float, cptr, sizeof(float));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, "%g", tmp_float);
- }
- else if (sizeof(double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */
- HDmemcpy(&tmp_double, cptr, sizeof(double));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, "%g", tmp_double);
- }
-#if H5_SIZEOF_LONG_DOUBLE !=0
- else if (sizeof(long double) == size) {
- /* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */
- HDmemcpy(&tmp_ldouble, cptr, sizeof(long double));
- this_str = (char*)HDmalloc(27);
- sprintf(this_str, "%Lf", tmp_ldouble);
- }
-#endif
- break;
- case H5T_STRING:
- {
- char *tmp_str;
- size = 0;
+ case H5T_FLOAT:
+ {
+ switch (typeSize) {
+ case sizeof(float):
+ {
+ float tmp_float = 0.0;
- if (H5Tis_variable_str(tid)) {
- tmp_str = *(char**) ptr;
- if (tmp_str != NULL)
- size = HDstrlen(tmp_str);
- }
- else {
- tmp_str = cptr;
- }
+ HDmemcpy(&tmp_float, cptr, sizeof(float));
- /* Check for NULL pointer for string */
- if (tmp_str == NULL) {
- this_str = (char *)HDmalloc(5);
- HDstrncpy(this_str, "NULL", 4);
- }
- else {
- if (size > 0) {
- this_str = (char *)HDmalloc(size+1);
- HDstrncpy(this_str, tmp_str, size);
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%g", tmp_float) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+
+ case sizeof(double):
+ {
+ double tmp_double = 0.0;
+
+ HDmemcpy(&tmp_double, cptr, sizeof(double));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%g", tmp_double) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+#if H5_SIZEOF_LONG_DOUBLE != 0 && H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE
+ case sizeof(long double):
+ {
+ long double tmp_ldouble = 0.0;
+
+ HDmemcpy(&tmp_ldouble, cptr, sizeof(long double));
+
+ if (NULL == (this_str = (char *) HDmalloc(27)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%Lf", tmp_ldouble) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: floating-point datatype size didn't match any of expected sizes");
+ break;
}
+
+ break;
}
- }
- break;
- case H5T_INTEGER:
- if (sizeof(char) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */
- HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char));
- this_str = (char*)HDmalloc(7);
- sprintf(this_str, "%u", tmp_uchar);
+
+ case H5T_STRING:
+ {
+ htri_t is_variable;
+ char *tmp_str;
+
+ typeSize = 0;
+
+ if ((is_variable = H5Tis_variable_str(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (is_variable) {
+ if (NULL != (tmp_str = *(char **) in_buf))
+ typeSize = HDstrlen(tmp_str);
}
else {
- /* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */
- HDmemcpy(&tmp_char, cptr, sizeof(char));
- this_str = (char*)HDmalloc(7);
- sprintf(this_str, "%hhd", tmp_char);
+ tmp_str = cptr;
}
- }
- else if (sizeof(int) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_UINT)) */
- HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int));
- this_str = (char*)HDmalloc(14);
- sprintf(this_str, "%u", tmp_uint);
+
+ /* Check for NULL pointer for string */
+ if (!tmp_str) {
+ if (NULL == (this_str = (char *) HDmalloc(5)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ HDstrncpy(this_str, "NULL", 5);
}
else {
- /* if (H5Tequal(tid, H5T_NATIVE_INT)) */
- HDmemcpy(&tmp_int, cptr, sizeof(int));
- this_str = (char*)HDmalloc(14);
- sprintf(this_str, "%d", tmp_int);
+ if (typeSize > 0) {
+ if (NULL == (this_str = (char *) HDmalloc(typeSize + 1)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ HDstrncpy(this_str, tmp_str, typeSize);
+ this_str[typeSize] = '\0';
+ }
}
+
+ break;
}
- else if (sizeof(short) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */
- HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
- this_str = (char*)HDmalloc(9);
- sprintf(this_str, "%u", tmp_ushort);
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */
- HDmemcpy(&tmp_short, cptr, sizeof(short));
- this_str = (char*)HDmalloc(9);
- sprintf(this_str, "%d", tmp_short);
+
+ case H5T_INTEGER:
+ {
+ H5T_sign_t nsign = H5T_SGN_ERROR;
+
+ if (H5T_SGN_ERROR == (nsign = H5Tget_sign(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ switch (typeSize) {
+ case sizeof(char):
+ {
+ unsigned char tmp_uchar = 0;
+ char tmp_char = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_uchar, cptr, sizeof(unsigned char));
+
+ if (NULL == (this_str = (char *) HDmalloc(7)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%u", tmp_uchar) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_char, cptr, sizeof(char));
+
+ if (NULL == (this_str = (char *) HDmalloc(7)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%hhd", tmp_char) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+
+ case sizeof(short):
+ {
+ unsigned short tmp_ushort = 0;
+ short tmp_short = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ushort, cptr, sizeof(unsigned short));
+
+ if (NULL == (this_str = (char *) HDmalloc(9)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%u", tmp_ushort) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_short, cptr, sizeof(short));
+
+ if (NULL == (this_str = (char *) HDmalloc(9)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%d", tmp_short) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+
+ case sizeof(int):
+ {
+ unsigned int tmp_uint = 0;
+ int tmp_int = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_uint, cptr, sizeof(unsigned int));
+
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%u", tmp_uint) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_int, cptr, sizeof(int));
+
+ if (NULL == (this_str = (char *) HDmalloc(14)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%d", tmp_int) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#if H5_SIZEOF_LONG != H5_SIZEOF_INT
+ case sizeof(long):
+ {
+ unsigned long tmp_ulong = 0;
+ long tmp_long = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long));
+
+ if (NULL == (this_str = (char *) HDmalloc(23)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%lu", tmp_ulong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_long, cptr, sizeof(long));
+
+ if (NULL == (this_str = (char *) HDmalloc(23)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, "%ld", tmp_long) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#endif
+#if H5_SIZEOF_LONG_LONG != H5_SIZEOF_LONG
+ case sizeof(long long):
+ {
+ unsigned long long tmp_ullong = 0;
+ long long tmp_llong = 0;
+
+ if (H5T_SGN_NONE == nsign) {
+ HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, fmt_ullong, tmp_ullong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ HDmemcpy(&tmp_llong, cptr, sizeof(long long));
+
+ if (NULL == (this_str = (char *) HDmalloc(25)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (HDsprintf(this_str, fmt_llong, tmp_llong) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
+ }
+#endif
+
+ default:
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: integer datatype size didn't match any of expected sizes");
+ break;
}
+
+ break;
}
- else if (sizeof(long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */
- HDmemcpy(&tmp_ulong, cptr, sizeof(unsigned long));
- this_str = (char*)HDmalloc(23);
- sprintf(this_str, "%lu", tmp_ulong);
- }
- else {
- /* if (H5Tequal(tid, H5T_NATIVE_LONG)) */
- HDmemcpy(&tmp_long, cptr, sizeof(long));
- this_str = (char*)HDmalloc(23);
- sprintf(this_str, "%ld", tmp_long);
+
+ case H5T_COMPOUND:
+ {
+ unsigned i;
+ size_t offset;
+
+ if ((n = H5Tget_nmembers(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(out_str, H5_COMPOUND_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < (unsigned) n; i++) {
+ offset = H5Tget_member_offset(tid, i);
+
+ if ((mtid = H5Tget_member_type(tid, i)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &cptr[offset], in_buf_len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((i + 1) < (unsigned) n)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
}
+
+ if (!h5str_append(out_str, H5_COMPOUND_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
}
- else if (sizeof(long long) == size) {
- if(H5T_SGN_NONE == nsign) {
- /* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */
- HDmemcpy(&tmp_ullong, cptr, sizeof(unsigned long long));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, fmt_ullong, tmp_ullong);
+
+ case H5T_ENUM:
+ {
+ char enum_name[1024];
+
+ if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) {
+ if (!h5str_append(out_str, enum_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
else {
- /* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */
- HDmemcpy(&tmp_llong, cptr, sizeof(long long));
- this_str = (char*)HDmalloc(25);
- sprintf(this_str, fmt_llong, tmp_llong);
+ size_t i;
+
+ if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (1 == typeSize) {
+ if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ for (i = 0; i < typeSize; i++)
+ if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
}
+
+ break;
}
- break;
- case H5T_COMPOUND:
- {
- unsigned i;
- n = H5Tget_nmembers(tid);
- h5str_append(str, " {");
-
- for (i = 0; i < n; i++) {
- offset = H5Tget_member_offset(tid, i);
- mtid = H5Tget_member_type(tid, i);
- h5str_sprintf(str, container, mtid, cptr + offset, ptr_len, expand_data);
- if ((i + 1) < n)
- h5str_append(str, ", ");
- H5Tclose(mtid);
- }
- h5str_append(str, "} ");
- }
- break;
- case H5T_ENUM:
- {
- char enum_name[1024];
- if (H5Tenum_nameof(tid, cptr, enum_name, sizeof enum_name) >= 0) {
- h5str_append(str, enum_name);
- }
- else {
- size_t i;
- nll = H5Tget_size(tid);
- this_str = (char*)HDmalloc(4 * (nll + 1));
- if (1 == nll) {
- sprintf(this_str, "%#02x", ucptr[0]);
- }
- else {
- for (i = 0; i < (int)nll; i++)
- sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]);
+ case H5T_REFERENCE:
+ {
+ if (h5str_is_zero(cptr, typeSize)) {
+ if (!h5str_append(out_str, "NULL"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ break;
}
- }
- }
- break;
- case H5T_REFERENCE:
- if (h5str_is_zero(cptr, size)) {
- h5str_append(str, "NULL");
- }
- else {
- if (H5R_DSET_REG_REF_BUF_SIZE == size) {
- /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */
+
+ if (H5R_DSET_REG_REF_BUF_SIZE == typeSize) {
+ H5S_sel_type region_type = H5S_SEL_ERROR;
+ hid_t region_obj = H5I_INVALID_HID;
+ hid_t region = H5I_INVALID_HID;
+ char ref_name[1024];
+
/*
* Dataset region reference --
* show the type and the referenced object
*/
- char ref_name[1024];
- hid_t region_obj;
- hid_t region;
- H5S_sel_type region_type;
- /* get name of the dataset the region reference points to using H5Rget_name */
- region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, cptr);
- if (region_obj >= 0) {
- region = H5Rget_region(container, H5R_DATASET_REGION, cptr);
- if (region >= 0) {
- if(expand_data) {
- region_type = H5Sget_select_type(region);
- if(region_type==H5S_SEL_POINTS) {
- h5str_dump_region_points_data(str, region, region_obj);
- }
- else {
- h5str_dump_region_blocks_data(str, region, region_obj);
- }
- }
- else {
- if(H5Rget_name(region_obj, H5R_DATASET_REGION, cptr, (char*)ref_name, 1024) >= 0) {
- h5str_append(str, ref_name);
- }
-
- region_type = H5Sget_select_type(region);
-
- if(region_type==H5S_SEL_POINTS) {
- h5str_append(str, " REGION_TYPE POINT");
- h5str_dump_region_points(str, region, region_obj);
- }
- else {
- h5str_append(str, " REGION_TYPE BLOCK");
- h5str_dump_region_blocks(str, region, region_obj);
- }
- }
+ /* Get name of the dataset the region reference points to using H5Rget_name */
+ if ((region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, cptr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((region = H5Rget_region(container, H5R_DATASET_REGION, cptr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- H5Sclose(region);
+ if (expand_data) {
+ if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5S_SEL_POINTS == region_type) {
+ if (h5str_dump_region_points_data(ENVONLY, out_str, region, region_obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else {
+ if (h5str_dump_region_blocks_data(ENVONLY, out_str, region, region_obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
- H5Dclose(region_obj);
}
+ else {
+ if (H5Rget_name(region_obj, H5R_DATASET_REGION, cptr, (char *)ref_name, 1024) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(out_str, ref_name))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (H5S_SEL_ERROR == (region_type = H5Sget_select_type(region)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5S_SEL_POINTS == region_type) {
+ if (!h5str_append(out_str, " REGION_TYPE POINT"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (h5str_dump_region_points(ENVONLY, out_str, region, region_obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else {
+ if (!h5str_append(out_str, " REGION_TYPE BLOCK"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (h5str_dump_region_blocks(ENVONLY, out_str, region, region_obj) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ }
+
+ if (H5Sclose(region) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ region = H5I_INVALID_HID;
+
+ if (H5Dclose(region_obj) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ region_obj = H5I_INVALID_HID;
}
- else if (H5R_OBJ_REF_BUF_SIZE == size) {
- /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */
+ else if (H5R_OBJ_REF_BUF_SIZE == typeSize) {
+ H5O_info_t oi;
+ hid_t obj = H5I_INVALID_HID;
+
/*
* Object references -- show the type and OID of the referenced
* object.
*/
- H5O_info_t oi;
- hid_t obj;
- this_str = (char*)HDmalloc(64);
- obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr);
- H5Oget_info2(obj, &oi, H5O_INFO_ALL);
+ if (NULL == (this_str = (char *) HDmalloc(64)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if ((obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, cptr)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Oget_info2(obj, &oi, H5O_INFO_ALL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
/* Print object data and close object */
- sprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr);
- H5Oclose(obj);
+ if (HDsprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+
+ if (H5Oclose(obj) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ obj = H5I_INVALID_HID;
}
+
+ break;
}
- break;
- case H5T_ARRAY:
- {
- int rank = 0;
- hsize_t i, dims[H5S_MAX_RANK], total_elmts;
- h5str_append(str, "[ ");
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
- rank = H5Tget_array_ndims(tid);
+ case H5T_ARRAY:
+ {
+ hsize_t dims[H5S_MAX_RANK], i, total_elmts;
+ size_t baseSize;
+ int rank = 0;
+
+ if (!h5str_append(out_str, H5_ARRAY_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((rank = H5Tget_array_ndims(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- H5Tget_array_dims2(tid, dims);
+ if (H5Tget_array_dims2(tid, dims) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- total_elmts = 1;
- for (i = 0; i < rank; i++)
- total_elmts *= dims[i];
+ for (i = 0, total_elmts = 1; i < (hsize_t) rank; i++)
+ total_elmts *= dims[i];
+
+ for (i = 0; i < total_elmts; i++) {
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(cptr[i * baseSize]), in_buf_len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((i + 1) < total_elmts)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ if (!h5str_append(out_str, H5_ARRAY_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- for (i = 0; i < total_elmts; i++) {
- h5str_sprintf(str, container, mtid, cptr + i * size, ptr_len, expand_data);
- if ((i + 1) < total_elmts)
- h5str_append(str, ", ");
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
+
+ break;
}
- H5Tclose(mtid);
- h5str_append(str, " ] ");
- }
- break;
- case H5T_VLEN:
+
+ case H5T_VLEN:
{
- unsigned int i;
- mtid = H5Tget_super(tid);
- size = H5Tget_size(mtid);
-
- h5str_append(str, "{");
- for (i = 0; i < (int)ptr_len; i++) {
- h5str_sprintf(str, container, mtid, cptr + i * size, ptr_len, expand_data);
- if ((i + 1) < (int)ptr_len)
- h5str_append(str, ", ");
+ unsigned int i;
+ size_t baseSize;
+ hvl_t *vl_buf = (hvl_t *) in_buf;
+
+ if ((mtid = H5Tget_super(tid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(baseSize = H5Tget_size(mtid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(out_str, H5_VLEN_BEGIN_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ for (i = 0; i < (unsigned) vl_buf->len; i++) {
+ if (!h5str_sprintf(ENVONLY, out_str, container, mtid, &(((char *) vl_buf->p)[i * baseSize]), vl_buf->len, expand_data))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if ((i + 1) < (unsigned) vl_buf->len)
+ if (!h5str_append(out_str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
- H5Tclose(mtid);
- h5str_append(str, "}");
- }
- break;
- default:
- {
- /* All other types get printed as hexadecimal */
- size_t i;
- nll = H5Tget_size(tid);
- this_str = (char*)HDmalloc(4 * (nll + 1));
+ if (!h5str_append(out_str, H5_VLEN_END_INDICATOR))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (H5Tclose(mtid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ mtid = H5I_INVALID_HID;
- if (1 == nll) {
- sprintf(this_str, "%#02x", ucptr[0]);
+ break;
}
- else {
- for (i = 0; i < (int)nll; i++)
- sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]);
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_sprintf: invalid datatype class");
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ {
+ size_t i;
+
+ /* All other types get printed as hexadecimal */
+
+ if (NULL == (this_str = (char *) HDmalloc(4 * (typeSize + 1))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
+
+ if (1 == typeSize) {
+ if (HDsprintf(this_str, "%#02x", ucptr[0]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+ else {
+ for (i = 0; i < typeSize; i++)
+ if (HDsprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_sprintf: HDsprintf failure");
+ }
+
+ break;
}
}
- break;
- } /* end switch */
if (this_str) {
- h5str_append(str, this_str);
- this_strlen = HDstrlen(str->s);
+ if (!h5str_append(out_str, this_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
HDfree(this_str);
+ this_str = NULL;
} /* end if */
- return this_strlen;
+ retVal = HDstrlen(out_str->s);
+
+done:
+ if (mtid >= 0)
+ H5Tclose(mtid);
+
+ return retVal;
} /* end h5str_sprintf */
/*-------------------------------------------------------------------------
@@ -1020,113 +1218,115 @@ h5str_sprintf
*/
static int
h5str_print_region_data_blocks
- (hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
+ (JNIEnv *env, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t blkndx;
- hsize_t total_size[H5S_MAX_RANK];
- hsize_t numelem;
- hsize_t numindex;
- size_t jndx;
- unsigned indx;
- size_t type_size;
- int ret_value = SUCCEED;
- hid_t mem_space = -1;
- hid_t sid1 = -1;
- void *region_buf = NULL;
+ unsigned indx;
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t blkndx;
+ hsize_t total_size[H5S_MAX_RANK];
+ hsize_t numelem;
+ hsize_t numindex;
+ size_t jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ hid_t sid1 = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int ret_value = FAIL;
+
+ if (ndims < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_blocks: ndims < 0");
+ if (nblocks < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_blocks: nblocks < 0");
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) >= 0) {
+ if ((sid1 = H5Dget_space(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
-
- /* find the dimensions of each data space from the block coordinates */
- numelem = 1;
- for (jndx = 0; jndx < ndims; jndx++) {
- dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
- } /* end for */
-
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) {
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) {
- /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
- /* 1 2 n 1 2 n */
- if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- for (blkndx = 0; blkndx < nblocks; blkndx++) {
- for (indx = 0; indx < ndims; indx++) {
- start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2];
- count[indx] = dims1[indx];
- } /* end for */
-
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
- for (numindex = 0; numindex < numelem; numindex++) {
- h5str_sprintf(str, region_id, type_id, ((char*)region_buf + numindex * type_size), 0, 1);
-
- if (numindex + 1 < numelem)
- h5str_append(str, ", ");
- } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */
- } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */
- } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
-
- HDfree(count);
- } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
-
- HDfree(start);
- } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate dimension array buffer");
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
-
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
-
- if(H5Sclose(sid1) < 0)
- ret_value = -1;
- } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */
- else
- ret_value = -1;
+ /* Find the dimensions of each data space from the block coordinates */
+ for (jndx = 0, numelem = 1; jndx < (size_t) ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ } /* end for */
+
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!(type_size = H5Tget_size(type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate region buffer");
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab start buffer");
+
+ if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_blocks: failed to allocate hyperslab count buffer");
+
+ for (blkndx = 0; blkndx < (hsize_t) nblocks; blkndx++) {
+ for (indx = 0; indx < (unsigned) ndims; indx++) {
+ start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2];
+ count[indx] = dims1[indx];
+ } /* end for */
+
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (numindex = 0; numindex < numelem; numindex++) {
+ if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + numindex * type_size), 0, 1))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (numindex + 1 < numelem)
+ if (!h5str_append(str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+ ret_value = SUCCEED;
+
+done:
+ if (count)
+ HDfree(count);
+ if (start)
+ HDfree(start);
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
+ HDfree(dims1);
+ if (sid1 >= 0)
+ H5Sclose(sid1);
return ret_value;
} /* end h5str_print_region_data_blocks */
int
h5str_dump_region_blocks_data
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have blocks.
@@ -1135,50 +1335,56 @@ h5str_dump_region_blocks_data
nblocks = H5Sget_select_hyper_nblocks(region);
} H5E_END_TRY;
+ if (nblocks < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print block information */
- if (nblocks > 0) {
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_hyper_blocklist(region, (hsize_t) 0,
- (hsize_t) nblocks, ptdata);
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+ if (alloc_size == (hsize_t)((size_t) alloc_size)) {
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks_data: failed to allocate region block buffer");
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
+ if ((dtype = H5Dget_type(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_print_region_data_blocks(region_id, str, ndims, type_id, nblocks, ptdata);
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
+ if (h5str_print_region_data_blocks(ENVONLY, region_id, str, ndims, type_id, nblocks, ptdata) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- HDfree(ptdata);
- } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- } /* if (nblocks > 0) */
+ ret_value = SUCCEED;
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end h5str_dump_region_blocks_data */
static int
h5str_dump_region_blocks
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- char tmp_str[256];
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
+
+ UNUSED(region_id);
/*
* This function fails if the region does not have blocks.
@@ -1187,44 +1393,70 @@ h5str_dump_region_blocks
nblocks = H5Sget_select_hyper_nblocks(region);
} H5E_END_TRY;
+ if (nblocks < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print block information */
- if (nblocks > 0) {
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+ if (alloc_size == (hsize_t)((size_t) alloc_size)) {
int i;
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_hyper_blocklist(region, (hsize_t) 0,
- (hsize_t) nblocks, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: failed to allocate region block buffer");
- h5str_append(str, " {");
- for (i = 0; i < nblocks; i++) {
- int j;
+ if (H5Sget_select_hyper_blocklist(region, (hsize_t) 0, (hsize_t) nblocks, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_append(str, " ");
+ if (!h5str_append(str, " {"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- /* Start coordinates and opposite corner */
- for (j = 0; j < ndims; j++) {
- tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) ptdata[i * 2 * ndims + j]);
- h5str_append(str, tmp_str);
- }
+ for (i = 0; i < nblocks; i++) {
+ int j;
- for (j = 0; j < ndims; j++) {
- tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : ")-(",
- (unsigned long) ptdata[i * 2 * ndims + j + ndims]);
- h5str_append(str, tmp_str);
- }
- h5str_append(str, ") ");
+ if (!h5str_append(str, " "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ /* Start coordinates and opposite corner */
+ for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
+ (unsigned long) ptdata[i * 2 * ndims + j]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
- h5str_append(str, " }");
- HDfree(ptdata);
- } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
- } /* if (nblocks > 0) */
+ for (j = 0; j < ndims; j++) {
+ tmp_str[0] = '\0';
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : ")-(",
+ (unsigned long) ptdata[i * 2 * ndims + j + ndims]) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_blocks: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ if (!h5str_append(str, ") "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ tmp_str[0] = '\0';
+ }
+
+ if (!h5str_append(str, " }"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */
+
+ ret_value = SUCCEED;
+
+done:
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end h5str_dump_region_blocks */
@@ -1241,76 +1473,76 @@ h5str_dump_region_blocks
*/
static int
h5str_print_region_data_points
- (hid_t region_space, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
+ (JNIEnv *env, hid_t region_space, hid_t region_id, h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t total_size[H5S_MAX_RANK];
- size_t jndx;
- size_t type_size;
- int ret_value = SUCCEED;
- hid_t mem_space = -1;
- void *region_buf = NULL;
+ hsize_t *dims1 = NULL;
+ hsize_t total_size[H5S_MAX_RANK];
+ size_t jndx;
+ size_t type_size;
+ hid_t mem_space = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int ret_value = FAIL;
+
+ UNUSED(ptdata);
+
+ if (npoints < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_print_region_data_points: npoints < 0");
/* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate dimension array buffer");
- dims1[0] = (hsize_t)npoints;
+ dims1[0] = (hsize_t)npoints;
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) {
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if((type_size = H5Tget_size(type_id)) > 0) {
+ if (!(type_size = H5Tget_size(type_id)))
+ H5_LIBRARY_ERROR(ENVONLY);
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) {
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_print_region_data_points: failed to allocate region buffer");
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) {
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- for (jndx = 0; jndx < npoints; jndx++) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
+ for (jndx = 0; jndx < (size_t) npoints; jndx++) {
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_sprintf(str, region_id, type_id, ((char*)region_buf + jndx * type_size), 0, 1);
+ if (!h5str_sprintf(ENVONLY, str, region_id, type_id, ((char *)region_buf + jndx * type_size), 0, 1))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (jndx + 1 < npoints)
- h5str_append(str, ", ");
+ if (jndx + 1 < (size_t) npoints)
+ if (!h5str_append(str, ", "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */
- } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */
- else
- ret_value = -1;
+ ret_value = SUCCEED;
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
+done:
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
return ret_value;
} /* end h5str_print_region_data_points */
int
h5str_dump_region_points_data
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims = -1;
+ int ret_value = FAIL;
/*
* This function fails if the region does not have points.
@@ -1319,50 +1551,59 @@ h5str_dump_region_points_data
npoints = H5Sget_select_elem_npoints(region);
} H5E_END_TRY;
+ if (npoints < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print point information */
if (npoints > 0) {
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_elem_pointlist(region, (hsize_t) 0,
- (hsize_t) npoints, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points_data: failed to allocate region point data buffer");
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
+ if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- h5str_print_region_data_points(region, region_id,
- str, ndims, type_id, npoints, ptdata);
+ if ((dtype = H5Dget_type(region_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
-
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- HDfree(ptdata);
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (h5str_print_region_data_points(ENVONLY, region, region_id,
+ str, ndims, type_id, npoints, ptdata) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
}
}
+ ret_value = SUCCEED;
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
+
return ret_value;
} /* end h5str_dump_region_points_data */
static int
h5str_dump_region_points
- (h5str_t *str, hid_t region, hid_t region_id)
+ (JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
{
- int ret_value = 0;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- char tmp_str[256];
- hid_t dtype = -1;
- hid_t type_id = -1;
- int ndims = H5Sget_simple_extent_ndims(region);
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ char tmp_str[256];
+ int ndims = -1;
+ int ret_value = FAIL;
+
+ UNUSED(region_id);
/*
* This function fails if the region does not have points.
@@ -1371,37 +1612,59 @@ h5str_dump_region_points
npoints = H5Sget_select_elem_npoints(region);
} H5E_END_TRY;
+ if (npoints < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((ndims = H5Sget_simple_extent_ndims(region)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
/* Print point information */
if (npoints > 0) {
int i;
alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
if (alloc_size == (hsize_t)((size_t) alloc_size)) {
- ptdata = (hsize_t *)HDmalloc((size_t) alloc_size);
- H5Sget_select_elem_pointlist(region, (hsize_t) 0,
- (hsize_t) npoints, ptdata);
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t) alloc_size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: failed to allocate region point buffer");
+
+ if (H5Sget_select_elem_pointlist(region, (hsize_t) 0, (hsize_t) npoints, ptdata) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (!h5str_append(str, " {"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- h5str_append(str, " {");
for (i = 0; i < npoints; i++) {
int j;
- h5str_append(str, " ");
+ if (!h5str_append(str, " "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
for (j = 0; j < ndims; j++) {
tmp_str[0] = '\0';
- sprintf(tmp_str, "%s%lu", j ? "," : "(",
- (unsigned long) (ptdata[i * ndims + j]));
- h5str_append(str, tmp_str);
+
+ if (HDsprintf(tmp_str, "%s%lu", j ? "," : "(",
+ (unsigned long) (ptdata[i * ndims + j])) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_region_points: HDsprintf failure");
+
+ if (!h5str_append(str, tmp_str))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (j = 0; j < ndims; j++) */
- h5str_append(str, ") ");
+ if (!h5str_append(str, ") "))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end for (i = 0; i < npoints; i++) */
- h5str_append(str, " }");
- HDfree(ptdata);
+ if (!h5str_append(str, " }"))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
} /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */
} /* end if (npoints > 0) */
+ ret_value = SUCCEED;
+
+done:
+ if (ptdata)
+ HDfree(ptdata);
+
return ret_value;
} /* end h5str_dump_region_points */
@@ -1419,6 +1682,37 @@ h5str_is_zero
} /* end h5str_is_zero */
/*-------------------------------------------------------------------------
+ * Function: h5str_detect_vlen
+ *
+ * Purpose: Recursive check for any variable length data in given type.
+ *
+ * Return:
+ * 1 : type contains any variable length data
+ * 0 : type doesn't contain any variable length data
+ * Negative value: error occurred
+ *-------------------------------------------------------------------------
+ */
+static htri_t
+h5str_detect_vlen
+ (hid_t tid)
+{
+ htri_t ret = FAIL;
+
+ /* Recursively detect any vlen data values in type (compound, array ...) */
+ ret = H5Tdetect_class(tid, H5T_VLEN);
+ if ((ret == 1) || (ret < 0))
+ goto done;
+
+ /* Recursively detect any vlen string in type (compound, array ...) */
+ ret = h5str_detect_vlen_str(tid);
+ if ((ret == 1) || (ret < 0))
+ goto done;
+
+done:
+ return ret;
+} /* end h5str_detect_vlen */
+
+/*-------------------------------------------------------------------------
* Function: h5str_detect_vlen_str
*
* Purpose: Recursive check for variable length string of a datatype.
@@ -1459,12 +1753,10 @@ h5str_detect_vlen_str
unsigned i = 0;
int n = H5Tget_nmembers(tid);
- if(n < 0) {
- n = ret;
+ if (n < 0)
goto done;
- } /* end if */
- for(i = 0; i < n; i++) {
+ for(i = 0; i < (unsigned) n; i++) {
hid_t mtid = H5Tget_member_type(tid, i);
ret = h5str_detect_vlen_str(mtid);
@@ -1494,15 +1786,18 @@ static hid_t
h5str_get_native_type
(hid_t type)
{
- hid_t p_type;
H5T_class_t type_class;
+ hid_t p_type = H5I_INVALID_HID;
- type_class = H5Tget_class(type);
- if(type_class==H5T_BITFIELD)
- p_type=H5Tcopy(type);
+ if ((type_class = H5Tget_class(type)) < 0)
+ goto done;
+
+ if (type_class == H5T_BITFIELD)
+ p_type = H5Tcopy(type);
else
- p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT);
+ p_type = H5Tget_native_type(type, H5T_DIR_DEFAULT);
+done:
return(p_type);
} /* end h5str_get_native_type */
@@ -1520,73 +1815,89 @@ static hid_t
h5str_get_little_endian_type
(hid_t tid)
{
- hid_t p_type=-1;
H5T_class_t type_class;
- size_t size;
H5T_sign_t sign;
+ size_t size;
+ hid_t p_type = H5I_INVALID_HID;
- type_class = H5Tget_class(tid);
- size = H5Tget_size(tid);
- sign = H5Tget_sign(tid);
+ if ((type_class = H5Tget_class(tid)) < 0)
+ goto done;
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8LE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16LE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32LE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64LE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8LE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16LE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32LE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64LE);
- }
- break;
+ if (!(size = H5Tget_size(tid)))
+ goto done;
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64LE);
- break;
+ if ((sign = H5Tget_sign(tid)) < 0)
+ goto done;
- case H5T_BITFIELD:
- {
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8LE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16LE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32LE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64LE);
- }
- break;
+ switch ( type_class ) {
+ case H5T_INTEGER:
+ {
+ if ( size == 1 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I8LE);
+ else if ( size == 2 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I16LE);
+ else if ( size == 4 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I32LE);
+ else if ( size == 8 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I64LE);
+ else if ( size == 1 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U8LE);
+ else if ( size == 2 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U16LE);
+ else if ( size == 4 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U32LE);
+ else if ( size == 8 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U64LE);
+
+ break;
+ }
- case H5T_TIME:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
+ case H5T_FLOAT:
+ {
+ if ( size == 4 )
+ p_type = H5Tcopy(H5T_IEEE_F32LE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_IEEE_F64LE);
- default:
- break;
+ break;
+ }
+ case H5T_BITFIELD:
+ {
+ if ( size == 1 )
+ p_type = H5Tcopy(H5T_STD_B8LE);
+ else if ( size == 2 )
+ p_type = H5Tcopy(H5T_STD_B16LE);
+ else if ( size == 4 )
+ p_type = H5Tcopy(H5T_STD_B32LE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_STD_B64LE);
+
+ break;
+ }
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ goto done;
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ default:
+ break;
}
+done:
return(p_type);
} /* end h5str_get_little_endian_type */
@@ -1603,106 +1914,91 @@ static hid_t
h5str_get_big_endian_type
(hid_t tid)
{
- hid_t p_type=-1;
H5T_class_t type_class;
- size_t size;
H5T_sign_t sign;
+ size_t size;
+ hid_t p_type = H5I_INVALID_HID;
- type_class = H5Tget_class(tid);
- size = H5Tget_size(tid);
- sign = H5Tget_sign(tid);
-
- switch( type_class )
- {
- case H5T_INTEGER:
- {
- if ( size == 1 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I8BE);
- else if ( size == 2 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I16BE);
- else if ( size == 4 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I32BE);
- else if ( size == 8 && sign == H5T_SGN_2)
- p_type=H5Tcopy(H5T_STD_I64BE);
- else if ( size == 1 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U8BE);
- else if ( size == 2 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U16BE);
- else if ( size == 4 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U32BE);
- else if ( size == 8 && sign == H5T_SGN_NONE)
- p_type=H5Tcopy(H5T_STD_U64BE);
- }
- break;
-
- case H5T_FLOAT:
- if ( size == 4)
- p_type=H5Tcopy(H5T_IEEE_F32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_IEEE_F64BE);
- break;
+ if ((type_class = H5Tget_class(tid)) < 0)
+ goto done;
- case H5T_BITFIELD:
- {
- if ( size == 1)
- p_type=H5Tcopy(H5T_STD_B8BE);
- else if ( size == 2)
- p_type=H5Tcopy(H5T_STD_B16BE);
- else if ( size == 4)
- p_type=H5Tcopy(H5T_STD_B32BE);
- else if ( size == 8)
- p_type=H5Tcopy(H5T_STD_B64BE);
- }
- break;
+ if (!(size = H5Tget_size(tid)))
+ goto done;
- case H5T_TIME:
- case H5T_OPAQUE:
- case H5T_STRING:
- case H5T_COMPOUND:
- case H5T_REFERENCE:
- case H5T_ENUM:
- case H5T_VLEN:
- case H5T_ARRAY:
- break;
+ if ((sign = H5Tget_sign(tid)) < 0)
+ goto done;
- default:
- break;
+ switch ( type_class ) {
+ case H5T_INTEGER:
+ {
+ if ( size == 1 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I8BE);
+ else if ( size == 2 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I16BE);
+ else if ( size == 4 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I32BE);
+ else if ( size == 8 && sign == H5T_SGN_2 )
+ p_type = H5Tcopy(H5T_STD_I64BE);
+ else if ( size == 1 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U8BE);
+ else if ( size == 2 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U16BE);
+ else if ( size == 4 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U32BE);
+ else if ( size == 8 && sign == H5T_SGN_NONE )
+ p_type = H5Tcopy(H5T_STD_U64BE);
+
+ break;
+ }
- }
+ case H5T_FLOAT:
+ {
+ if ( size == 4 )
+ p_type = H5Tcopy(H5T_IEEE_F32BE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_IEEE_F64BE);
- return(p_type);
-} /* end h5str_get_big_endian_type */
+ break;
+ }
-/*-------------------------------------------------------------------------
- * Function: h5str_detect_vlen
- *
- * Purpose: Recursive check for any variable length data in given type.
- *
- * Return:
- * 1 : type conatains any variable length data
- * 0 : type doesn't contain any variable length data
- * Negative value: error occur
- *-------------------------------------------------------------------------
- */
-static htri_t
-h5str_detect_vlen
- (hid_t tid)
-{
- htri_t ret;
+ case H5T_BITFIELD:
+ {
+ if ( size == 1 )
+ p_type = H5Tcopy(H5T_STD_B8BE);
+ else if ( size == 2 )
+ p_type = H5Tcopy(H5T_STD_B16BE);
+ else if ( size == 4 )
+ p_type = H5Tcopy(H5T_STD_B32BE);
+ else if ( size == 8 )
+ p_type = H5Tcopy(H5T_STD_B64BE);
+
+ break;
+ }
- /* recursive detect any vlen data values in type (compound, array ...) */
- ret = H5Tdetect_class(tid, H5T_VLEN);
- if((ret == 1) || (ret < 0))
- goto done;
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ goto done;
+ break;
+ }
- /* recursive detect any vlen string in type (compound, array ...) */
- ret = h5str_detect_vlen_str(tid);
- if((ret == 1) || (ret < 0))
- goto done;
+ case H5T_TIME:
+ case H5T_OPAQUE:
+ case H5T_STRING:
+ case H5T_COMPOUND:
+ case H5T_REFERENCE:
+ case H5T_ENUM:
+ case H5T_VLEN:
+ case H5T_ARRAY:
+ break;
+
+ default:
+ break;
+ }
done:
- return ret;
-} /* end h5str_detect_vlen */
+ return(p_type);
+} /* end h5str_get_big_endian_type */
/*-------------------------------------------------------------------------
* Function: render_bin_output
@@ -1717,201 +2013,261 @@ static int
h5str_render_bin_output
(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts)
{
- int ret_value = 0;
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- hsize_t block_index;
- H5T_class_t type_class;
-
- if((size = H5Tget_size(tid)) > 0) {
-
- if((type_class = H5Tget_class(tid)) >= 0) {
-
- switch (type_class) {
- case H5T_INTEGER:
- case H5T_FLOAT:
- case H5T_ENUM:
- block_index = block_nelmts * size;
- while(block_index > 0) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
- size_t item_size = size; /* size of items in bytes */
-
- if(block_index > sizeof(size_t))
- bytes_in = sizeof(size_t);
- else
- bytes_in = (size_t)block_index;
+ unsigned char *mem = (unsigned char*)_mem;
+ H5T_class_t type_class;
+ hsize_t block_index;
+ size_t size; /* datum size */
+ int ret_value = 0;
+
+ if (!(size = H5Tget_size(tid))) {
+ ret_value = FAIL;
+ goto done;
+ }
- bytes_wrote = fwrite(mem, 1, bytes_in, stream);
+ if ((type_class = H5Tget_class(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- if(bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) {
- ret_value = -1;
- break;
- }
+ switch (type_class) {
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_ENUM:
+ {
+ block_index = block_nelmts * size;
+ while (block_index > 0) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ size_t bytes_wrote = 0; /* # of bytes written */
- block_index -= (hsize_t)bytes_wrote;
- mem = mem + bytes_wrote;
- }
+ if (block_index > sizeof(size_t))
+ bytes_in = sizeof(size_t);
+ else
+ bytes_in = (size_t)block_index;
+
+ bytes_wrote = fwrite(mem, 1, bytes_in, stream);
+
+ if (bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) {
+ ret_value = FAIL;
break;
- case H5T_STRING:
- {
- unsigned int i;
- H5T_str_t pad;
- char *s;
- unsigned char tempuchar;
+ }
+
+ block_index -= (hsize_t)bytes_wrote;
+ mem = mem + bytes_wrote;
+ }
- pad = H5Tget_strpad(tid);
+ break;
+ }
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
+ case H5T_STRING:
+ {
+ unsigned char tempuchar;
+ unsigned int i;
+ H5T_str_t pad;
+ char *s;
- if (H5Tis_variable_str(tid)) {
- s = *(char**) mem;
- if (s != NULL)
- size = HDstrlen(s);
- }
- else {
- s = (char *) mem;
- }
- for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
- HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
- if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) {
- ret_value = -1;
- break;
- }
- } /* i */
- if(ret_value < 0)
- break;
- } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
+ if ((pad = H5Tget_strpad(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char *)_mem) + block_index * size;
+
+ if (H5Tis_variable_str(tid)) {
+ s = *(char**) mem;
+ if (s != NULL)
+ size = HDstrlen(s);
}
- break;
- case H5T_COMPOUND:
- {
- unsigned j;
- hid_t memb;
- unsigned nmembs;
- size_t offset;
-
- nmembs = (unsigned)H5Tget_nmembers(tid);
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- for (j = 0; j < nmembs; j++) {
- offset = H5Tget_member_offset(tid, j);
- memb = H5Tget_member_type(tid, j);
-
- if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
- H5Tclose(memb);
- ret_value = -1;
- break;
- }
-
- H5Tclose(memb);
- }
- if(ret_value < 0)
- break;
- }
+ else {
+ s = (char *) mem;
}
- break;
- case H5T_ARRAY:
- {
- int k, ndims;
- hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
- hid_t memb;
-
- /* get the array's base datatype for each element */
- memb = H5Tget_super(tid);
- ndims = H5Tget_array_ndims(tid);
- H5Tget_array_dims2(tid, dims);
-
- /* calculate the number of array elements */
- for (k = 0, nelmts = 1; k < ndims; k++) {
- temp_nelmts = nelmts;
- temp_nelmts *= dims[k];
- nelmts = (size_t) temp_nelmts;
+ for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) {
+ HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char));
+ if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) {
+ ret_value = FAIL;
+ break;
}
+ } /* i */
+ if (ret_value < 0)
+ break;
+ } /* for (block_index = 0; block_index < block_nelmts; block_index++) */
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- /* dump the array element */
- if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) {
- ret_value = -1;
- break;
- }
+ break;
+ }
+
+ case H5T_COMPOUND:
+ {
+ unsigned j;
+ size_t offset;
+ hid_t memb = H5I_INVALID_HID;
+ int nmembs;
+
+ if ((nmembs = H5Tget_nmembers(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ for (j = 0; j < (unsigned) nmembs; j++) {
+ offset = H5Tget_member_offset(tid, j);
+ memb = H5Tget_member_type(tid, j);
+
+ if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) {
+ H5Tclose(memb);
+ ret_value = FAIL;
+ break;
}
+
H5Tclose(memb);
}
- break;
- case H5T_VLEN:
- {
- hsize_t nelmts;
- hid_t memb;
- /* get the VL sequences's base datatype for each element */
- memb = H5Tget_super(tid);
+ if (ret_value < 0)
+ break;
+ }
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- /* Get the number of sequence elements */
- nelmts = ((hvl_t *) mem)->len;
+ break;
+ }
- /* dump the array element */
- if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
- ret_value = -1;
- break;
- }
- }
- H5Tclose(memb);
+ case H5T_ARRAY:
+ {
+ hsize_t dims[H5S_MAX_RANK], temp_nelmts, nelmts;
+ hid_t memb;
+ int k, ndims;
+
+ /* Get the array's base datatype for each element */
+ if ((memb = H5Tget_super(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((ndims = H5Tget_array_ndims(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Tget_array_dims2(tid, dims) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Calculate the number of array elements */
+ for (k = 0, nelmts = 1; k < ndims; k++) {
+ temp_nelmts = nelmts;
+ temp_nelmts *= dims[k];
+ nelmts = (size_t) temp_nelmts;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ /* dump the array element */
+ if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) {
+ ret_value = FAIL;
+ break;
}
- break;
- case H5T_REFERENCE:
- {
- if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
- /* region data */
- hid_t region_id, region_space;
- H5S_sel_type region_type;
-
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem);
- if (region_id >= 0) {
- region_space = H5Rget_region(container, H5R_DATASET_REGION, mem);
- if (region_space >= 0) {
- region_type = H5Sget_select_type(region_space);
- if(region_type == H5S_SEL_POINTS)
- ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
- else
- ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
- H5Sclose(region_space);
- } /* end if (region_space >= 0) */
- H5Dclose(region_id);
- } /* end if (region_id >= 0) */
- if(ret_value < 0)
- break;
- }
+ }
+
+ H5Tclose(memb);
+
+ break;
+ }
+
+ case H5T_VLEN:
+ {
+ hsize_t nelmts;
+ hid_t memb;
+
+ /* Get the VL sequences's base datatype for each element */
+ if ((memb = H5Tget_super(tid)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ /* Get the number of sequence elements */
+ nelmts = ((hvl_t *) mem)->len;
+
+ /* dump the array element */
+ if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) {
+ ret_value = FAIL;
+ break;
+ }
+ }
+
+ H5Tclose(memb);
+
+ break;
+ }
+
+ case H5T_REFERENCE:
+ {
+ if (H5Tequal(tid, H5T_STD_REF_DSETREG)) {
+ H5S_sel_type region_type;
+ hid_t region_id, region_space;
+
+ /* Region data */
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+
+ if ((region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem)) < 0)
+ continue;
+
+ if ((region_space = H5Rget_region(container, H5R_DATASET_REGION, mem)) < 0) {
+ H5Dclose(region_id);
+ continue;
}
- else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
- ;
+
+ if ((region_type = H5Sget_select_type(region_space)) < 0) {
+ H5Sclose(region_space);
+ H5Dclose(region_id);
+ continue;
}
+
+ if (region_type == H5S_SEL_POINTS)
+ ret_value = render_bin_output_region_points(stream, region_space, region_id, container);
+ else
+ ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container);
+
+ H5Sclose(region_space);
+ H5Dclose(region_id);
+
+ if (ret_value < 0)
+ break;
}
- break;
- default:
- for (block_index = 0; block_index < block_nelmts; block_index++) {
- mem = ((unsigned char*)_mem) + block_index * size;
- if (size != fwrite(mem, sizeof(char), size, stream)) {
- ret_value = -1;
- break;
- }
- }
+ }
+ else if (H5Tequal(tid, H5T_STD_REF_OBJ)) {
+ ;
+ }
+
+ break;
+ }
+
+ case H5T_NO_CLASS:
+ case H5T_NCLASSES:
+ {
+ ret_value = FAIL;
+ goto done;
+ break;
+ }
+
+ case H5T_TIME:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ default:
+ for (block_index = 0; block_index < block_nelmts; block_index++) {
+ mem = ((unsigned char*)_mem) + block_index * size;
+ if (size != fwrite(mem, sizeof(char), size, stream)) {
+ ret_value = FAIL;
break;
+ }
}
- } /* end if((type_class = H5Tget_class(tid)) >= 0) */
- else
- ret_value = -1;
- } /* end if((size = H5Tget_size(tid)) > 0) */
- else
- ret_value = -1;
+ break;
+ }
+done:
return ret_value;
} /* end h5str_render_bin_output */
@@ -1930,96 +2286,107 @@ static int
render_bin_output_region_data_blocks
(FILE *stream, hid_t region_id, hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata)
{
- hsize_t *dims1 = NULL;
- hsize_t *start = NULL;
- hsize_t *count = NULL;
- hsize_t numelem;
- hsize_t total_size[H5S_MAX_RANK];
- int jndx;
- size_t type_size;
- hid_t mem_space = -1;
- void *region_buf = NULL;
- int blkndx;
- hid_t sid1 = -1;
- int ret_value = SUCCEED;
+ hsize_t *dims1 = NULL;
+ hsize_t *start = NULL;
+ hsize_t *count = NULL;
+ hsize_t numelem;
+ hsize_t total_size[H5S_MAX_RANK];
+ size_t type_size;
+ hid_t sid1 = H5I_INVALID_HID;
+ hid_t mem_space = H5I_INVALID_HID;
+ void *region_buf = NULL;
+ int blkndx;
+ int jndx;
+ int ret_value = SUCCEED;
/* Get the dataspace of the dataset */
- if((sid1 = H5Dget_space(region_id)) >= 0) {
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- /* find the dimensions of each data space from the block coordinates */
- numelem = 1;
- for (jndx = 0; jndx < ndims; jndx++) {
- dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
- numelem = dims1[jndx] * numelem;
- }
+ if ((sid1 = H5Dget_space(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- /* Create dataspace for reading buffer */
- if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) {
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) {
- /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
- /* 1 2 n 1 2 n */
- if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- for (blkndx = 0; blkndx < nblocks; blkndx++) {
- for (jndx = 0; jndx < ndims; jndx++) {
- start[jndx] = ptdata[jndx + blkndx * ndims * 2];
- count[jndx] = dims1[jndx];
- }
-
- if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) {
- ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, numelem);
- } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */
- else {
- ret_value = -1;
- break;
- }
- /* Render the region data element end */
- } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
-
- HDfree(count);
- } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(start);
- } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */
- else
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- if(H5Sclose(sid1) < 0)
- ret_value = -1;
- } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */
- else
- ret_value = -1;
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Find the dimensions of each data space from the block coordinates */
+ for (jndx = 0, numelem = 1; jndx < ndims; jndx++) {
+ dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1;
+ numelem = dims1[jndx] * numelem;
+ }
+
+ /* Create dataspace for reading buffer */
+ if ((mem_space = H5Screate_simple(ndims, dims1, NULL)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (!(type_size = H5Tget_size(type_id))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)numelem))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */
+ /* 1 2 n 1 2 n */
+ if (NULL == (start = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (count = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ for (blkndx = 0; blkndx < nblocks; blkndx++) {
+ for (jndx = 0; jndx < ndims; jndx++) {
+ start[jndx] = ptdata[jndx + blkndx * ndims * 2];
+ count[jndx] = dims1[jndx];
+ }
+
+ if (H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_simple_extent_dims(mem_space, total_size, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (h5str_render_bin_output(stream, container, type_id, (char *)region_buf, numelem) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Render the region data element end */
+ } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */
+
+done:
+ if (count)
+ HDfree(count);
+ if (start)
+ HDfree(start);
+ if (region_buf)
+ HDfree(region_buf);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (dims1)
+ HDfree(dims1);
+ if (sid1 >= 0)
+ H5Sclose(sid1);
return ret_value;
} /* end render_bin_output_region_data_blocks */
@@ -2039,50 +2406,62 @@ static int
render_bin_output_region_blocks
(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- int ret_value = SUCCEED;
- hssize_t nblocks;
- hsize_t alloc_size;
- hsize_t *ptdata = NULL;
- int ndims;
- hid_t dtype;
- hid_t type_id;
-
- if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) {
+ hssize_t nblocks;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
+
+ if ((nblocks = H5Sget_select_hyper_nblocks(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (nblocks > 0) {
/* Print block information */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) {
- alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
- if((ptdata = (hsize_t*)HDmalloc((size_t)alloc_size)) != NULL) {
- if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) >= 0) {
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
- ret_value = render_bin_output_region_data_blocks(stream, region_id, container, ndims,
- type_id, nblocks, ptdata);
-
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
+ if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) >= 0) */
- else
- ret_value = -1;
-
- HDfree(ptdata);
- } /* end if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) != NULL) */
- else
- ret_value = -1;
- } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */
- else
- ret_value = -1;
- } /* end if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) */
- else
- ret_value = -1;
+ alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]);
+
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((dtype = H5Dget_type(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (render_bin_output_region_data_blocks(stream, region_id, container,
+ ndims, type_id, nblocks, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+ }
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end render_bin_output_region_blocks */
@@ -2105,43 +2484,57 @@ render_bin_output_region_data_points
{
hsize_t *dims1 = NULL;
size_t type_size;
- hid_t mem_space = -1;
+ hid_t mem_space = H5I_INVALID_HID;
void *region_buf = NULL;
int ret_value = SUCCEED;
- if((type_size = H5Tget_size(type_id)) > 0) {
- if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) {
- /* Allocate space for the dimension array */
- if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) {
- dims1[0] = (hsize_t)npoints;
- if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) {
- if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) {
- if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) {
- ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, (hsize_t)npoints);
- } /* end if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */
- else
- ret_value = -1;
- } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */
- else
- ret_value = -1;
-
- HDfree(dims1);
- } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
- else
- ret_value = -1;
- HDfree(region_buf);
- } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
- else
- ret_value = -1;
-
- if(H5Sclose(mem_space) < 0)
- ret_value = -1;
- } /* end if((type_size = H5Tget_size(type_id)) > 0) */
- else
- ret_value = -1;
+ UNUSED(ptdata);
+
+ if (!(type_size = H5Tget_size(type_id))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (NULL == (region_buf = HDmalloc(type_size * (size_t)npoints))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ /* Allocate space for the dimension array */
+ if (NULL == (dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * (size_t)ndims))) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ dims1[0] = (hsize_t)npoints;
+
+ if ((mem_space = H5Screate_simple(1, dims1, NULL)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (H5Sget_simple_extent_dims(region_space, dims1, NULL) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (h5str_render_bin_output(stream, container, type_id, (char *)region_buf, (hsize_t)npoints) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+done:
+ if (dims1)
+ HDfree(dims1);
+ if (mem_space >= 0)
+ H5Sclose(mem_space);
+ if (region_buf)
+ HDfree(region_buf);
return ret_value;
} /* end render_bin_output_region_data_points */
@@ -2161,248 +2554,343 @@ static int
render_bin_output_region_points
(FILE *stream, hid_t region_space, hid_t region_id, hid_t container)
{
- int ret_value = SUCCEED;
- hssize_t npoints;
- hsize_t alloc_size;
- hsize_t *ptdata;
- int ndims;
- hid_t dtype;
- hid_t type_id;
-
- if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) {
+ hssize_t npoints;
+ hsize_t alloc_size;
+ hsize_t *ptdata = NULL;
+ hid_t dtype = H5I_INVALID_HID;
+ hid_t type_id = H5I_INVALID_HID;
+ int ndims;
+ int ret_value = SUCCEED;
+
+ if ((npoints = H5Sget_select_elem_npoints(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (npoints > 0) {
/* Allocate space for the dimension array */
- if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) {
- alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) {
- if(H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) >= 0) {
- if((dtype = H5Dget_type(region_id)) >= 0) {
- if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) {
- ret_value = render_bin_output_region_data_points(stream, region_space, region_id,
- container, ndims, type_id, npoints, ptdata);
-
- if(H5Tclose(type_id) < 0)
- ret_value = -1;
- } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */
- else
- ret_value = -1;
+ if ((ndims = H5Sget_simple_extent_ndims(region_space)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
- if(H5Tclose(dtype) < 0)
- ret_value = -1;
- } /* end if((dtype = H5Dget_type(region_id)) >= 0) */
- else
- ret_value = -1;
- } /* end if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) >= 0) */
- else
- ret_value = -1;
+ alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]);
- HDfree(ptdata);
- } /* end if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) */
- else
- ret_value = -1;
- } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */
- else
- ret_value = -1;
+ if (NULL == (ptdata = (hsize_t *) HDmalloc((size_t)alloc_size))) {
+ ret_value = FAIL;
+ goto done;
+ }
- } /* end if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) */
- else
- ret_value = -1;
+ if (H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((dtype = H5Dget_type(region_id)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if ((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+
+ if (render_bin_output_region_data_points(stream, region_space, region_id,
+ container, ndims, type_id, npoints, ptdata) < 0) {
+ ret_value = FAIL;
+ goto done;
+ }
+ }
+
+done:
+ if (type_id >= 0)
+ H5Tclose(type_id);
+ if (dtype >= 0)
+ H5Tclose(dtype);
+ if (ptdata)
+ HDfree(ptdata);
return ret_value;
} /* end render_bin_output_region_points */
int
h5str_dump_simple_dset
- (FILE *stream, hid_t dset, int binary_order)
+ (JNIEnv *env, FILE *stream, hid_t dset, int binary_order)
{
- int ret_value = SUCCEED;
- hid_t f_space = -1; /* file data space */
- hsize_t elmtno; /* counter */
- size_t i; /* counter */
- int ndims;
- int carry; /* counter carry value */
- hsize_t zero[8]; /* vector of zeros */
- hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ hsize_t elmtno; /* counter */
+ hsize_t zero[8]; /* vector of zeros */
+ hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/
+ size_t i; /* counter */
+ hid_t f_space = H5I_INVALID_HID; /* file data space */
+ int ndims;
+ int carry; /* counter carry value */
/* Print info */
- size_t p_type_nbytes; /* size of memory type */
- hsize_t p_nelmts; /* total selected elmts */
+ hsize_t p_nelmts; /* total selected elmts */
+ size_t p_type_nbytes; /* size of memory type */
/* Stripmine info */
- hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
- hsize_t sm_nbytes; /* bytes per stripmine */
- hsize_t sm_nelmts; /* elements per stripmine*/
- unsigned char *sm_buf = NULL; /* buffer for raw data */
- hid_t sm_space = -1; /* stripmine data space */
+ unsigned char *sm_buf = NULL; /* buffer for raw data */
+ hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */
+ hsize_t sm_nbytes; /* bytes per stripmine */
+ hsize_t sm_nelmts; /* elements per stripmine */
+ hid_t sm_space = H5I_INVALID_HID; /* stripmine data space */
/* Hyperslab info */
- hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
- hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
- hsize_t hs_nelmts; /* elements in request */
+ hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */
+ hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */
+ hsize_t hs_nelmts; /* elements in request */
/* VL data special information */
- unsigned int vl_data = 0; /* contains VL datatypes */
- hid_t p_type = -1;
- hid_t f_type = -1;
-
- if(dset < 0) return -1;
- f_type = H5Dget_type(dset);
- if (binary_order == 1)
- p_type = h5str_get_native_type(f_type);
- else if (binary_order == 2)
- p_type = h5str_get_little_endian_type(f_type);
- else if (binary_order == 3)
- p_type = h5str_get_big_endian_type(f_type);
- else
- p_type = H5Tcopy(f_type);
+ unsigned int vl_data = 0; /* contains VL datatypes */
+ hid_t p_type = H5I_INVALID_HID;
+ hid_t f_type = H5I_INVALID_HID;
- H5Tclose(f_type);
+ int ret_value = FAIL;
- if (p_type >= 0) {
- if((f_space = H5Dget_space(dset)) >= 0) {
- ndims = H5Sget_simple_extent_ndims(f_space);
+ if (dset < 0)
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "h5str_dump_simple_dset: dset ID < 0");
- if ((size_t)ndims <= (sizeof(sm_size)/sizeof(sm_size[0]))) {
- H5Sget_simple_extent_dims(f_space, total_size, NULL);
+ if ((f_type = H5Dget_type(dset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- /* calculate the number of elements we're going to print */
- p_nelmts = 1;
+ switch (binary_order) {
+ case 1:
+ {
+ if ((p_type = h5str_get_native_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (ndims > 0) {
- for (i = 0; i < ndims; i++)
- p_nelmts *= total_size[i];
- } /* end if */
+ break;
+ }
+
+ case 2:
+ {
+ if ((p_type = h5str_get_little_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
- if (p_nelmts > 0) {
- /* Check if we have VL data in the dataset's datatype */
- if (h5str_detect_vlen(p_type) != 0)
- vl_data = 1;
+ case 3:
+ {
+ if ((p_type = h5str_get_big_endian_type(f_type)) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ break;
+ }
+
+ default:
+ {
+ if ((p_type = H5Tcopy(f_type)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ break;
+ }
+ }
- /*
- * Determine the strip mine size and allocate a buffer. The strip mine is
- * a hyperslab whose size is manageable.
- */
- sm_nbytes = p_type_nbytes = H5Tget_size(p_type);
+ if ((f_space = H5Dget_space(dset)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ if ((ndims = H5Sget_simple_extent_ndims(f_space)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((size_t)ndims <= (sizeof(sm_size) / sizeof(sm_size[0]))) {
+ if (H5Sget_simple_extent_dims(f_space, total_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* Calculate the number of elements we're going to print */
+ p_nelmts = 1;
+
+ if (ndims > 0) {
+ for (i = 0; i < (size_t) ndims; i++)
+ p_nelmts *= total_size[i];
+ } /* end if */
+
+ if (p_nelmts > 0) {
+ /* Check if we have VL data in the dataset's datatype */
+ if (h5str_detect_vlen(p_type) != 0)
+ vl_data = 1;
+
+ /*
+ * Determine the strip mine size and allocate a buffer. The strip mine is
+ * a hyperslab whose size is manageable.
+ */
+ if (!(sm_nbytes = p_type_nbytes = H5Tget_size(p_type)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (ndims > 0) {
+ for (i = (size_t)ndims; i > 0; --i) {
+ hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ if ( size == 0 ) /* datum size > H5TOOLS_BUFSIZE */
+ size = 1;
+ sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size));
+ sm_nbytes *= sm_size[i - 1];
+ }
+ }
+
+ if (sm_nbytes > 0) {
+ if (NULL == (sm_buf = (unsigned char *) HDmalloc((size_t)sm_nbytes)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset: failed to allocate sm_buf");
+
+ sm_nelmts = sm_nbytes / p_type_nbytes;
+
+ if ((sm_space = H5Screate_simple(1, &sm_nelmts, NULL)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ /* The stripmine loop */
+ HDmemset(hs_offset, 0, sizeof hs_offset);
+ HDmemset(zero, 0, sizeof zero);
+
+ for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
+ /* Calculate the hyperslab size */
if (ndims > 0) {
- for (i = (size_t)ndims; i > 0; --i) {
- hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
- if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */
- size = 1;
- sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size));
- sm_nbytes *= sm_size[i - 1];
+ for (i = 0, hs_nelmts = 1; i < (size_t) ndims; i++) {
+ hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i]));
+ hs_nelmts *= hs_size[i];
}
+
+ if (H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
}
+ else {
+ if (H5Sselect_all(f_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(sm_nbytes > 0) {
- sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes);
-
- sm_nelmts = sm_nbytes / p_type_nbytes;
- sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
-
- /* The stripmine loop */
- HDmemset(hs_offset, 0, sizeof hs_offset);
- HDmemset(zero, 0, sizeof zero);
-
- for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
- /* Calculate the hyperslab size */
- if (ndims > 0) {
- for (i = 0, hs_nelmts = 1; i < ndims; i++) {
- hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i]));
- hs_nelmts *= hs_size[i];
- }
-
- H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL);
- H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL);
- }
- else {
- H5Sselect_all(f_space);
- H5Sselect_all(sm_space);
- hs_nelmts = 1;
- }
-
- /* Read the data */
- if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) {
-
- if (binary_order == 99)
- ret_value = h5tools_dump_simple_data(stream, dset, p_type, sm_buf, hs_nelmts);
- else
- ret_value = h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts);
-
- /* Reclaim any VL memory, if necessary */
- if (vl_data)
- H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf);
- }
- else {
- ret_value = -1;
- break;
- }
-
- if(ret_value < 0) break;
-
- /* Calculate the next hyperslab offset */
- for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) {
- hs_offset[i - 1] += hs_size[i - 1];
-
- if (hs_offset[i - 1] == total_size[i - 1])
- hs_offset[i - 1] = 0;
- else
- carry = 0;
- }
- }
+ if (H5Sselect_all(sm_space) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if(sm_buf)
- HDfree(sm_buf);
+ hs_nelmts = 1;
+ }
+
+ /* Read the data */
+ if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (binary_order == 99) {
+ if (h5tools_dump_simple_data(ENVONLY, stream, dset, p_type, sm_buf, hs_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+ else {
+ if (h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts) < 0)
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+ }
+
+ /* Reclaim any VL memory, if necessary */
+ if (vl_data) {
+ if (H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ }
+
+ /* Calculate the next hyperslab offset */
+ for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) {
+ hs_offset[i - 1] += hs_size[i - 1];
+
+ if (hs_offset[i - 1] == total_size[i - 1])
+ hs_offset[i - 1] = 0;
+ else
+ carry = 0;
}
- if(sm_space >= 0 && H5Sclose(sm_space) < 0)
- ret_value = -1;
}
}
- if(f_space >= 0 && H5Sclose(f_space) < 0)
- ret_value = -1;
- } /* end if((f_space = H5Dget_space(dset)) >= 0) */
- else
- ret_value = -1;
-
- if (p_type >= 0)
- H5Tclose(p_type);
+ }
}
+
+ ret_value = SUCCEED;
+
+done:
+ if (sm_space >= 0)
+ H5Sclose(sm_space);
+ if (sm_buf)
+ HDfree(sm_buf);
+ if (f_space >= 0)
+ H5Sclose(f_space);
+ if (p_type >= 0)
+ H5Tclose(p_type);
+ if (f_type >= 0)
+ H5Tclose(f_type);
+
return ret_value;
} /* end h5str_dump_simple_dset */
+htri_t
+H5Tdetect_variable_str(hid_t tid) {
+ htri_t ret_val = 0;
+
+ if (H5Tget_class(tid) == H5T_COMPOUND) {
+ unsigned i;
+ unsigned nm = (unsigned)H5Tget_nmembers(tid);
+ for(i = 0; i < nm; i++) {
+ htri_t status = 0;
+ hid_t mtid = 0;
+ if((mtid = H5Tget_member_type(tid, i)) < 0)
+ return FAIL; /* exit immediately on error */
+ if((status = H5Tdetect_variable_str(mtid)) < 0)
+ return status; /* exit immediately on error */
+ ret_val |= status;
+ H5Tclose (mtid);
+ } /* end for */
+ } /* end if */
+ else
+ ret_val = H5Tis_variable_str(tid);
+
+ return ret_val;
+} /* end H5Tdetect_variable_str */
+
static int
h5tools_dump_simple_data
- (FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
+ (JNIEnv *env, FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts)
{
- int ret_value = 0;
- int line_count;
- unsigned char *mem = (unsigned char*)_mem;
- size_t size; /* datum size */
- hsize_t i; /*element counter */
- h5str_t buffer; /*string into which to render */
-
- if((size = H5Tget_size(type)) > 0) {
- for (i = 0, line_count = 0; i < nelmts; i++, line_count++) {
- size_t bytes_in = 0; /* # of bytes to write */
- size_t bytes_wrote = 0; /* # of bytes written */
- void* memref = mem + i * size;
-
- /* Render the data element*/
- h5str_new(&buffer, 32 * size);
- bytes_in = h5str_sprintf(&buffer, container, type, memref, 0, 1);
- if(i > 0) {
- HDfprintf(stream, ", ");
- if (line_count >= H5TOOLS_TEXT_BLOCK) {
- line_count = 0;
- HDfprintf(stream, "\n");
- }
+ unsigned char *mem = (unsigned char *)_mem;
+ h5str_t buffer; /* string into which to render */
+ hsize_t i; /* element counter */
+ size_t size; /* datum size */
+ int line_count;
+ int ret_value = 0;
+
+ if (!(size = H5Tget_size(type)))
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ for (i = 0, line_count = 0; i < nelmts; i++, line_count++) {
+ size_t bytes_in = 0; /* # of bytes to write */
+ void *memref = mem + i * size;
+
+ /* Render the data element*/
+ h5str_new(&buffer, 32 * size);
+
+ if (!buffer.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: failed to allocate buffer");
+
+ if (!(bytes_in = h5str_sprintf(ENVONLY, &buffer, container, type, memref, 0, 1)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (i > 0) {
+ if (HDfprintf(stream, ", ") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+ if (line_count >= H5TOOLS_TEXT_BLOCK) {
+ line_count = 0;
+
+ if (HDfprintf(stream, "\n") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
}
- HDfprintf(stream, "%s", buffer.s);
- h5str_free(&buffer);
- } /* end for (i = 0; i < nelmts... */
- HDfprintf(stream, "\n");
- } /* end if((size = H5Tget_size(tid)) > 0) */
- else
- ret_value = -1;
+ }
+
+ if (HDfprintf(stream, "%s", buffer.s) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+ h5str_free(&buffer);
+ } /* end for (i = 0; i < nelmts... */
+
+ if (HDfprintf(stream, "\n") < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5tools_dump_simple_data: HDfprintf failure");
+
+done:
+ if (buffer.s)
+ h5str_free(&buffer);
return ret_value;
} /* end h5tools_dump_simple_data */
@@ -2421,53 +2909,68 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5AreadComplex
(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf)
{
- herr_t status = -1;
- int i;
- int n;
- char *rdata;
- size_t max_len = 0;
- size_t size;
- h5str_t h5str;
- hid_t p_type = -1;
- jstring jstr;
+ h5str_t h5str;
+ jstring jstr;
+ size_t size;
+ size_t i;
+ hid_t p_type = H5I_INVALID_HID;
+ jsize n;
+ char *readBuf = NULL;
+ herr_t status = FAIL;
+
+ UNUSED(clss);
+
+ HDmemset(&h5str, 0, sizeof(h5str_t));
+
+ if ((p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- p_type = H5Tget_native_type(mem_type_id, H5T_DIR_DEFAULT);
size = (((H5Tget_size(mem_type_id))>(H5Tget_size(p_type))) ? (H5Tget_size(mem_type_id)) : (H5Tget_size(p_type)));
- H5Tclose(p_type);
- n = ENVPTR->GetArrayLength(ENVPAR buf);
- rdata = (char *)HDmalloc((size_t)n * size);
- if (rdata == NULL) {
- h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read");
- } /* end if */
- else {
- status = H5Aread(attr_id, mem_type_id, rdata);
- if (status < 0) {
- h5JNIFatalError(env, "H5AreadComplex: failed to read data");
- } /* end if */
- else {
- HDmemset(&h5str, 0, sizeof(h5str_t));
- h5str_new(&h5str, 4 * size);
- if (h5str.s == NULL) {
- h5JNIFatalError(env, "H5AreadComplex: failed to allocate string buf");
- } /* end if */
- else {
- for (i = 0; i < n; i++) {
- h5str.s[0] = '\0';
- h5str_sprintf(&h5str, attr_id, mem_type_id, rdata + ((size_t)i * size), 0, 0);
- jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s);
- ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr);
- } /* end for */
- } /* end else */
- h5str_free(&h5str);
- } /* end else */
- HDfree(rdata);
- } /* end else */
+ if ((n = ENVPTR->GetArrayLength(ENVONLY, buf)) <= 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "H5AreadComplex: read buffer length <= 0");
+ }
+
+ if (NULL == (readBuf = (char *) HDmalloc((size_t)n * size)))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadComplex: failed to allocate read buffer");
+
+ if ((status = H5Aread(attr_id, mem_type_id, readBuf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ h5str_new(&h5str, 4 * size);
+
+ if (!h5str.s)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5AreadComplex: failed to allocate string buffer");
+
+ for (i = 0; i < (size_t) n; i++) {
+ h5str.s[0] = '\0';
+
+ if (!h5str_sprintf(ENVONLY, &h5str, attr_id, mem_type_id, readBuf + (i * size), 0, 0))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ if (NULL == (jstr = ENVPTR->NewStringUTF(ENVONLY, h5str.s)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, buf, (jsize) i, jstr);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, jstr);
+ } /* end for */
+
+done:
+ if (h5str.s)
+ h5str_free(&h5str);
+ if (readBuf)
+ HDfree(readBuf);
+ if (p_type >= 0)
+ H5Tclose(p_type);
+
return status;
}
/*
- * Copies the content of one dataset to another dataset
+ * Copies the content of one attribute to another attribute
* Class: hdf_hdf5lib_H5
* Method: H5Acopy
* Signature: (JJ)I
@@ -2476,62 +2979,51 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Acopy
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- jbyte *buf;
- herr_t retVal = -1;
- hid_t src_did = (hid_t)src_id;
- hid_t dst_did = (hid_t)dst_id;
- hid_t tid = -1;
- hid_t sid = -1;
- hsize_t total_size = 0;
-
-
- sid = H5Aget_space(src_did);
- if (sid < 0) {
- h5libraryError(env);
- } /* end if */
- else {
- tid = H5Aget_type(src_did);
- if (tid < 0) {
- H5Sclose(sid);
- h5libraryError(env);
- } /* end if */
- else {
- total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid);
+ hssize_t npoints;
+ hsize_t total_size = 0;
+ size_t type_size;
+ jbyte *buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
- H5Sclose(sid);
+ UNUSED(clss);
- buf = (jbyte *)HDmalloc( (size_t)total_size * sizeof(jbyte));
- if (buf == NULL) {
- H5Tclose(tid);
- h5outOfMemory( env, "H5Acopy: malloc failed");
- } /* end if */
- else {
- retVal = H5Aread(src_did, tid, buf);
- H5Tclose(tid);
+ if ((sid = H5Aget_space((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retVal < 0) {
- HDfree(buf);
- h5libraryError(env);
- } /* end if */
- else {
- tid = H5Aget_type(dst_did);
- if (tid < 0) {
- HDfree(buf);
- h5libraryError(env);
- } /* end if */
- else {
- retVal = H5Awrite(dst_did, tid, buf);
+ if ((tid = H5Aget_type((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- H5Tclose(tid);
- HDfree(buf);
+ if ((npoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(type_size = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (retVal < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
- } /* end else */
+ if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Acopy: failed to allocate buffer");
+
+ if ((retVal = H5Aread((hid_t)src_id, tid, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if (H5Tclose(tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ tid = H5I_INVALID_HID;
+
+ if ((tid = H5Aget_type((hid_t)dst_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((retVal = H5Awrite((hid_t)dst_id, tid, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (buf)
+ HDfree(buf);
+ if (tid >= 0)
+ H5Tclose(tid);
+ if (sid >= 0)
+ H5Sclose(sid);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Acopy */
@@ -2546,64 +3038,54 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Dcopy
(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id)
{
- jbyte *buf;
- herr_t retVal = -1;
- hid_t src_did = (hid_t)src_id;
- hid_t dst_did = (hid_t)dst_id;
- hid_t tid = -1;
- hid_t sid = -1;
- hsize_t total_size = 0, total_allocated_size;
-
- total_allocated_size = H5Dget_storage_size(src_did);
- if (total_allocated_size <=0)
- return 0; // nothing to write;
-
- sid = H5Dget_space(src_did);
- if (sid < 0) {
- h5libraryError(env);
- return -1;
- } /* end if */
+ hssize_t npoints;
+ hsize_t total_size = 0, total_allocated_size;
+ size_t type_size;
+ jbyte *buf = NULL;
+ hid_t tid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ herr_t retVal = FAIL;
- tid = H5Dget_type(src_did);
- if (tid < 0) {
- H5Sclose(sid);
- h5libraryError(env);
- return -1;
- } /* end if */
+ UNUSED(clss);
- total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid);
+ if (!(total_allocated_size = H5Dget_storage_size((hid_t)src_id)))
+ return 0; // nothing to write
- H5Sclose(sid);
+ if ((sid = H5Dget_space((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- buf = (jbyte*)HDmalloc((size_t)total_size * sizeof(jbyte));
- if (buf == NULL) {
- H5Tclose(tid);
- h5outOfMemory(env, "H5Dcopy: malloc failed");
- return -1;
- } /* end if */
+ if ((tid = H5Dget_type((hid_t)src_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- retVal = H5Dread(src_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- H5Tclose(tid);
+ if ((npoints = H5Sget_simple_extent_npoints(sid)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ if (!(type_size = H5Tget_size(tid)))
+ H5_LIBRARY_ERROR(ENVONLY);
+ total_size = (hsize_t)npoints * (hsize_t)type_size;
- if (retVal < 0) {
- HDfree(buf);
- h5libraryError(env);
- return (jint)retVal;
- } /* end if */
+ if (NULL == (buf = (jbyte *) HDmalloc((size_t)total_size * sizeof(jbyte))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Dcopy: failed to allocate buffer");
- tid = H5Dget_type(dst_did);
- if (tid < 0) {
- HDfree(buf);
- h5libraryError(env);
- return -1;
- } /* end if */
- retVal = H5Dwrite(dst_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf);
- H5Tclose(tid);
- HDfree(buf);
+ if ((retVal = H5Dread((hid_t)src_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (retVal < 0) {
- h5libraryError(env);
- } /* end if */
+ if (H5Tclose(tid) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+ tid = H5I_INVALID_HID;
+
+ if ((tid = H5Dget_type((hid_t)dst_id)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ if ((retVal = H5Dwrite((hid_t)dst_id, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ if (buf)
+ HDfree(buf);
+ if (tid >= 0)
+ H5Tclose(tid);
+ if (sid >= 0)
+ H5Sclose(sid);
return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Dcopy */
@@ -2613,7 +3095,7 @@ Java_hdf_hdf5lib_H5_H5Dcopy
//
//
// Add these methods so that we don't need to call H5Gget_objtype_by_idx
-// in a loop to get information for all the object in a group, which takes
+// in a loop to get information for all the objects in a group, which takes
// a lot of time to finish if the number of objects is more than 10,000
//
/////////////////////////////////////////////////////////////////////////////////
@@ -2648,152 +3130,103 @@ typedef struct info_all
* Method: H5Gget_obj_info_full
* Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I
*/
+/*
+ * NOTE: This is a dangerous call! The caller can supply any value they'd like
+ * for 'n' and if it exceeds the number of links in the group, we will most likely
+ * end up overwriting memory heap-tracking info.
+ */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
(JNIEnv *env, jclass clss, jlong loc_id, jstring group_name,
jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo,
jlongArray oRef, jint n, jint indx_type, jint indx_order)
{
- herr_t ret_val = -1;
- const char *gName = NULL;
- char **oName = NULL;
- jboolean isCopy;
- jstring str;
- jint *otarr;
- jint *ltarr;
- jlong *refP;
- jlong *fnoP;
- unsigned long *refs=NULL;
- unsigned long *fnos=NULL;
- hid_t gid = (hid_t)loc_id;
- int i;
- int indexType = indx_type;
- int indexOrder = indx_order;
-
- if (oType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: oType is NULL");
+ unsigned long *refs = NULL;
+ unsigned long *fnos = NULL;
+ const char *gName = NULL;
+ char **oName = NULL;
+ jboolean isCopy;
+ jstring str;
+ jint *otarr = NULL;
+ jint *ltarr = NULL;
+ jlong *refP = NULL;
+ jlong *fnoP = NULL;
+ hid_t gid = (hid_t)loc_id;
+ int i;
+ int indexType = indx_type;
+ int indexOrder = indx_order;
+ herr_t ret_val = FAIL;
+
+ UNUSED(clss);
+
+ if (NULL == oType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oType is NULL");
+ if (NULL == lType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: lType is NULL");
+ if (NULL == oRef)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: oRef is NULL");
+ if (NULL == fNo)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_full: fNo is NULL");
+
+ PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_full: oType not pinned");
+ PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_full: lType not pinned");
+ PIN_LONG_ARRAY(ENVONLY, oRef, refP, &isCopy, "H5Gget_obj_info_full: oRef not pinned");
+ PIN_LONG_ARRAY(ENVONLY, fNo, fnoP, &isCopy, "H5Gget_obj_info_full: fNo not pinned");
+
+ if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for object name");
+
+ if (NULL == (refs = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for ref. info");
+
+ if (NULL == (fnos = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: failed to allocate buffer for file number info");
+
+ if (group_name) {
+ PIN_JAVA_STRING(ENVONLY, group_name, gName, &isCopy, "H5Gget_obj_info_full: group_name not pinned");
+
+ if ((gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
}
- else if (lType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: lType is NULL");
- }
- else if (oRef == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: oRef is NULL");
- }
- else if (fNo == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_full: fNo is NULL");
- }
- else {
- otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy);
- if (otarr == NULL) {
- h5JNIFatalError(env, "H5Gget_obj_info_full: otype not pinned");
- return -1;
- } /* end if */
- ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy);
- if (ltarr == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: ltype not pinned");
- return -1;
- } /* end if */
- refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy);
- if (refP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: oRef not pinned");
- return -1;
- } /* end if */
- fnoP = ENVPTR->GetLongArrayElements(ENVPAR fNo, &isCopy);
- if (fnoP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: fNo not pinned");
- return -1;
- } /* end if */
- oName = (char **)HDcalloc((size_t)n, sizeof(*oName));
- if (!oName) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_full: oName not allocated");
- return -1;
- } /* end if */
- refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- if (!refs || !fnos) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- if (refs)
- HDfree(refs);
- if (fnos)
- HDfree(fnos);
- h5JNIFatalError(env, "H5Gget_obj_info_full: result arrays not allocated");
- return -1;
- } /* end if */
-
- if (group_name != NULL) {
- gid = -1;
- gName = ENVPTR->GetStringUTFChars(ENVPAR group_name, &isCopy);
- if (gName != NULL) {
- gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT);
-
- ENVPTR->ReleaseStringUTFChars(ENVPAR group_name, gName);
- } /* end if */
- if(gid < 0) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- HDfree(fnos);
- h5JNIFatalError(env, "H5Gget_obj_info_full: could not get group identifier");
- return -1;
- } /* end if */
- } /* end if */
+ if ((ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_full: retrieval of object info failed");
- ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder);
+ for (i = 0; i < n; i++) {
+ refP[i] = (jlong)refs[i];
+ fnoP[i] = (jlong)fnos[i];
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0);
+ if (oName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oName[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (group_name != NULL)
- H5Gclose(gid);
+ ENVPTR->SetObjectArrayElement(ENVONLY, objName, i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- HDfree(fnos);
- h5libraryError(env);
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
} /* end if */
- else {
- for (i=0; i<n; i++) {
- refP[i] = (jlong)refs[i];
- } /* end for */
- HDfree(refs);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, 0);
-
- for (i=0; i<n; i++) {
- fnoP[i] = (jlong)fnos[i];
- } /* end for */
- HDfree(fnos);
- ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, 0);
-
- for (i=0; i<n; i++) {
- if (*(oName+i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(oName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str);
- } /* end if */
- } /* for (i=0; i<n; i++)*/
- h5str_array_free(oName, (size_t)n);
- } /* end else */
- } /* end else */
+ }
+
+done:
+ if (gName) {
+ H5Gclose(gid);
+ UNPIN_JAVA_STRING(ENVONLY, group_name, gName);
+ }
+ if (fnos)
+ HDfree(fnos);
+ if (refs)
+ HDfree(refs);
+ if (oName)
+ h5str_array_free(oName, (size_t)n);
+ if (fnoP)
+ UNPIN_LONG_ARRAY(ENVONLY, fNo, fnoP, (ret_val < 0) ? JNI_ABORT : 0);
+ if (refP)
+ UNPIN_LONG_ARRAY(ENVONLY, oRef, refP, (ret_val < 0) ? JNI_ABORT : 0);
+ if (ltarr)
+ UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0);
+ if (otarr)
+ UNPIN_INT_ARRAY(ENVONLY, oType, otarr, (ret_val < 0) ? JNI_ABORT : 0);
+
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full */
@@ -2802,97 +3235,73 @@ Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full
* Method: H5Gget_obj_info_max
* Signature: (J[Ljava/lang/String;[I[I[JJI)I
*/
+/*
+ * NOTE: This is a dangerous call! The caller can supply any value they'd like
+ * for 'n' and if it exceeds the number of links reachable from the group, we
+ * will most likely end up overwriting memory heap-tracking info.
+ */
JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max
(JNIEnv *env, jclass clss, jlong loc_id, jobjectArray objName,
jintArray oType, jintArray lType, jlongArray oRef, jlong maxnum, jint n)
{
- herr_t ret_val = -1;
- char **oName=NULL;
- jboolean isCopy;
- jstring str;
- jint *otarr;
- jint *ltarr;
- jlong *refP;
- unsigned long *refs;
- int i;
-
- if (oType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: oType is NULL");
- } /* end if */
- else if (lType == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: lType is NULL");
- } /* end else if */
- else if (oRef == NULL) {
- h5nullArgument(env, "H5Gget_obj_info_max: oRef is NULL");
- } /* end else if */
- else {
- otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy);
- if (otarr == NULL) {
- h5JNIFatalError(env, "H5Gget_obj_info_max: otype not pinned");
- return -1;
- } /* end if */
+ unsigned long *refs = NULL;
+ jboolean isCopy;
+ jstring str;
+ jlong *refP = NULL;
+ char **oName = NULL;
+ jint *otarr = NULL;
+ jint *ltarr = NULL;
+ int i;
+ herr_t ret_val = FAIL;
- ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy);
- if (ltarr == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: ltype not pinned");
- return -1;
- } /* end if */
+ UNUSED(clss);
- refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy);
- if (refP == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: oRef not pinned");
- return -1;
- } /* end if */
+ if (NULL == oType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oType is NULL");
+ if (NULL == lType)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: lType is NULL");
+ if (NULL == oRef)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5Gget_obj_info_max: oRef is NULL");
- oName = (char **)HDcalloc((size_t)n, sizeof(*oName));
- if (!oName) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5JNIFatalError(env, "H5Gget_obj_info_max: oName not allocated");
- return -1;
- } /* end if */
- refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long));
- if (!refs) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- h5JNIFatalError(env, "H5Gget_obj_info_max: result array not allocated");
- return -1;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, oType, otarr, &isCopy, "H5Gget_obj_info_max: oType not pinned");
+ PIN_INT_ARRAY(ENVONLY, lType, ltarr, &isCopy, "H5Gget_obj_info_max: lType not pinned");
+ PIN_LONG_ARRAY(ENVONLY, oRef, refP, &isCopy, "H5Gget_obj_info_max: oRef not pinned");
- ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int*)otarr, (int*)ltarr, refs, maxnum );
- ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0);
+ if (NULL == (oName = (char **) HDcalloc((size_t)n, sizeof(*oName))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for object name");
- if (ret_val < 0) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT);
- h5str_array_free(oName, (size_t)n);
- HDfree(refs);
- h5libraryError(env);
- } /* end if */
- else {
- for (i=0; i<n; i++) {
- refP[i] = (jlong) refs[i];
- } /* end for */
- HDfree(refs);
- ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, 0);
-
- for (i=0; i<n; i++) {
- if (*(oName+i)) {
- str = ENVPTR->NewStringUTF(ENVPAR *(oName+i));
- ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str);
- }
- } /* for (i=0; i<n; i++)*/
+ if (NULL == (refs = (unsigned long *) HDcalloc((size_t)n, sizeof(unsigned long))))
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: failed to allocate buffer for ref. info");
- h5str_array_free(oName, (size_t)n);
- } /* end else */
- } /* end else */
+ if ((ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int *)otarr, (int *)ltarr, refs, maxnum)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "H5Gget_obj_info_max: retrieval of object info failed");
+
+ for (i = 0; i < n; i++) {
+ refP[i] = (jlong) refs[i];
+
+ if (oName[i]) {
+ if (NULL == (str = ENVPTR->NewStringUTF(ENVONLY, oName[i])))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->SetObjectArrayElement(ENVONLY, objName, i, (jobject)str);
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ ENVPTR->DeleteLocalRef(ENVONLY, str);
+ }
+ } /* end for */
+
+done:
+ if (refs)
+ HDfree(refs);
+ if (oName)
+ h5str_array_free(oName, (size_t)n);
+ if (refP)
+ UNPIN_LONG_ARRAY(ENVONLY, oRef, refP, (ret_val < 0) ? JNI_ABORT : 0);
+ if (ltarr)
+ UNPIN_INT_ARRAY(ENVONLY, lType, ltarr, (ret_val < 0) ? JNI_ABORT : 0);
+ if (otarr)
+ UNPIN_INT_ARRAY(ENVONLY, oType, otarr, (ret_val < 0) ? JNI_ABORT : 0);
return ret_val;
} /* end Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max */
@@ -2902,6 +3311,7 @@ H5Gget_obj_info_full
(hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder)
{
info_all_t info;
+
info.objname = objname;
info.otype = otype;
info.ltype = ltype;
@@ -2910,11 +3320,22 @@ H5Gget_obj_info_full
info.objno = objno;
info.count = 0;
- if(H5Literate(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) {
- /* iterate failed, try normal alphabetical order */
- if(H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0)
+ if (H5Literate(loc_id, (H5_index_t)indexType, (H5_iter_order_t)indexOrder, NULL, obj_info_all, (void *)&info) < 0) {
+ /*
+ * Reset info stats; most importantly, reset the count.
+ */
+ info.objname = objname;
+ info.otype = otype;
+ info.ltype = ltype;
+ info.idxnum = 0;
+ info.fno = fno;
+ info.objno = objno;
+ info.count = 0;
+
+ /* Iteration failed, try normal alphabetical order */
+ if (H5Literate(loc_id, H5_INDEX_NAME, H5_ITER_INC, NULL, obj_info_all, (void *)&info) < 0)
return -1;
- } /* end if */
+ }
return info.count;
} /* end H5Gget_obj_info_full */
@@ -2924,6 +3345,7 @@ H5Gget_obj_info_max
(hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *objno, long maxnum)
{
info_all_t info;
+
info.objname = objname;
info.otype = otype;
info.ltype = ltype;
@@ -2931,7 +3353,7 @@ H5Gget_obj_info_max
info.objno = objno;
info.count = 0;
- if(H5Lvisit(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0)
+ if (H5Lvisit(loc_id, H5_INDEX_NAME, H5_ITER_NATIVE, obj_info_max, (void *)&info) < 0)
return -1;
return info.count;
@@ -2941,75 +3363,87 @@ herr_t
obj_info_all
(hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data)
{
- int type = -1;
- hid_t oid = -1;
- herr_t retVal = -1;
- info_all_t *datainfo = (info_all_t*)op_data;
+ info_all_t *datainfo = (info_all_t *)op_data;
H5O_info_t object_info;
+ htri_t object_exists;
+ size_t str_len;
- retVal = H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT);
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
+ datainfo->objno[datainfo->count] = (unsigned long)-1;
- if (retVal < 0) {
- *(datainfo->otype+datainfo->count) = -1;
- *(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
- HDstrcpy(*(datainfo->objname+datainfo->count), name);
- *(datainfo->objno+datainfo->count) = (unsigned long)-1;
- } /* end if */
- else {
- *(datainfo->otype+datainfo->count) = object_info.type;
- *(datainfo->ltype+datainfo->count) = info->type;
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
- HDstrcpy(*(datainfo->objname+datainfo->count), name);
-
- *(datainfo->fno+datainfo->count) = object_info.fileno;
- *(datainfo->objno+datainfo->count) = (unsigned long)object_info.addr;
- /*
- if(info->type==H5L_TYPE_HARD)
- *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address;
- else
- *(datainfo->objno+datainfo->count) = info->u.val_size;
- */
- } /* end else */
+ str_len = HDstrlen(name);
+ if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ goto done;
+
+ HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
+ (datainfo->objname[datainfo->count])[str_len] = '\0';
+
+ if ((object_exists = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0)
+ goto done;
+
+ if (object_exists) {
+ if (H5Oget_info_by_name2(loc_id, name, &object_info, H5O_INFO_ALL, H5P_DEFAULT) < 0)
+ goto done;
+
+ datainfo->otype[datainfo->count] = object_info.type;
+ datainfo->ltype[datainfo->count] = info->type;
+ datainfo->fno[datainfo->count] = object_info.fileno;
+ datainfo->objno[datainfo->count] = (unsigned long)object_info.addr;
+ }
+ /*
+ if (info->type == H5L_TYPE_HARD)
+ datainfo->objno[datainfo->count] = (unsigned long)info->u.address;
+ else
+ datainfo->objno[datainfo->count] = info->u.val_size;
+ */
+
+done:
datainfo->count++;
- return 0;
+ return SUCCEED;
} /* end obj_info_all */
herr_t
obj_info_max
(hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data)
{
- int type = -1;
- herr_t retVal = 0;
- info_all_t *datainfo = (info_all_t*)op_data;
+ info_all_t *datainfo = (info_all_t *)op_data;
H5O_info_t object_info;
+ size_t str_len;
- retVal = H5Oget_info2(loc_id, &object_info, H5O_INFO_ALL);
- if (retVal < 0) {
- *(datainfo->otype+datainfo->count) = -1;
- *(datainfo->ltype+datainfo->count) = -1;
- *(datainfo->objname+datainfo->count) = NULL;
- *(datainfo->objno+datainfo->count) = (unsigned long)-1;
- return 1;
- } /* end if */
- else {
- *(datainfo->otype+datainfo->count) = object_info.type;
- *(datainfo->ltype+datainfo->count) = info->type;
- /* this will be freed by h5str_array_free(oName, n)*/
- *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
- strcpy(*(datainfo->objname+datainfo->count), name);
- if(info->type==H5L_TYPE_HARD)
- *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address;
- else
- *(datainfo->objno+datainfo->count) = info->u.val_size;
- } /* end else */
- datainfo->count++;
- if(datainfo->count < (int)datainfo->idxnum)
- return 0;
+ datainfo->otype[datainfo->count] = -1;
+ datainfo->ltype[datainfo->count] = -1;
+ datainfo->objname[datainfo->count] = NULL;
+ datainfo->objno[datainfo->count] = (unsigned long)-1;
+
+ /* This will be freed by h5str_array_free(oName, n) */
+ str_len = HDstrlen(name);
+ if (NULL == (datainfo->objname[datainfo->count] = (char *) HDmalloc(str_len + 1)))
+ goto done;
+
+ HDstrncpy(datainfo->objname[datainfo->count], name, str_len);
+ (datainfo->objname[datainfo->count])[str_len] = '\0';
+
+ if (H5Oget_info2(loc_id, &object_info, H5O_INFO_ALL) < 0)
+ goto done;
+
+ datainfo->otype[datainfo->count] = object_info.type;
+ datainfo->ltype[datainfo->count] = info->type;
+
+ if (info->type == H5L_TYPE_HARD)
+ datainfo->objno[datainfo->count] = (unsigned long)info->u.address;
else
+ datainfo->objno[datainfo->count] = info->u.val_size;
+
+done:
+ datainfo->count++;
+
+ if (datainfo->count >= (int)datainfo->idxnum)
return 1;
+ else
+ return SUCCEED;
} /* end obj_info_max */
/*
@@ -3021,68 +3455,62 @@ JNIEXPORT void JNICALL
Java_hdf_hdf5lib_H5_H5export_1dataset
(JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order)
{
- herr_t status = -1;
- herr_t ret_val = -1;
- hid_t file_id = -1;
- hid_t dataset_id = -1;
- FILE *stream;
- const char *file_export;
- const char *object_name;
- const char *fileName;
- jboolean isCopy2;
-
- if (file_export_name == NULL) {
- h5nullArgument(env, "HDF5Library_export_data: file_export_name is NULL");
- } /* end if */
- else if (object_path == NULL) {
- h5nullArgument(env, "HDF5Library_export_data: object_path is NULL");
- } /* end else if */
- else {
- PIN_JAVA_STRING(file_name, fileName);
- if (fileName != NULL) {
- file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT);
-
- UNPIN_JAVA_STRING(file_name, fileName);
-
- if (file_id < 0) {
- /* throw exception */
- h5libraryError(env);
- } /* end if */
- else {
- object_name = ENVPTR->GetStringUTFChars(ENVPAR object_path, &isCopy2);
- if (object_name == NULL) {
- h5JNIFatalError( env, "H5Dopen: object name not pinned");
- } /* end if */
- else {
- dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT);
+ const char *file_export = NULL;
+ const char *object_name = NULL;
+ const char *fileName = NULL;
+ jboolean isCopy;
+ herr_t ret_val = FAIL;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t dataset_id = H5I_INVALID_HID;
+ FILE *stream = NULL;
- ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name);
+ UNUSED(cls);
- if (dataset_id < 0) {
- H5Fclose(file_id);
- h5libraryError(env);
- } /* end if */
- else {
- file_export = ENVPTR->GetStringUTFChars(ENVPAR file_export_name, 0);
- stream = HDfopen(file_export, "w+");
- ENVPTR->ReleaseStringUTFChars(ENVPAR file_export_name, file_export);
+ if (NULL == file_export_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_export_name is NULL");
- ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order);
+ if (NULL == file_name)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: file_name is NULL");
- if (stream)
- HDfclose(stream);
+ if (NULL == object_path)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "H5export_dataset: object_path is NULL");
- H5Dclose(dataset_id);
+ PIN_JAVA_STRING(ENVONLY, file_name, fileName, NULL, "H5export_dataset: file name not pinned");
- H5Fclose(file_id);
+ if ((file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- if (ret_val < 0)
- h5libraryError(env);
- } /* end else */
- } /* end else */
- } /* end else */
- }
- } /* end else */
+ PIN_JAVA_STRING(ENVONLY, object_path, object_name, &isCopy, "H5export_dataset: object_path not pinned");
+
+ if ((dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+ PIN_JAVA_STRING(ENVONLY, file_export_name, file_export, NULL, "H5export_dataset: file_export name not pinned");
+
+ if (NULL == (stream = HDfopen(file_export, "w+")))
+ H5_JNI_FATAL_ERROR(ENVONLY, "HDfopen failed");
+
+ if ((ret_val = h5str_dump_simple_dset(ENVONLY, stream, dataset_id, binary_order)) < 0)
+ H5_JNI_FATAL_ERROR(ENVONLY, "h5str_dump_simple_dset failed");
+
+ if (stream) {
+ HDfclose(stream);
+ stream = NULL;
+ }
+
+done:
+ if (stream)
+ HDfclose(stream);
+ if (file_export)
+ UNPIN_JAVA_STRING(ENVONLY, file_export_name, file_export);
+ if (object_name)
+ UNPIN_JAVA_STRING(ENVONLY, object_path, object_name);
+ if (fileName)
+ UNPIN_JAVA_STRING(ENVONLY, file_name, fileName);
+ if (dataset_id >= 0)
+ H5Dclose(dataset_id);
+ if (file_id >= 0)
+ H5Fclose(file_id);
} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */
#ifdef __cplusplus
diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h
index 23bc424..e5f0d0b 100644
--- a/java/src/jni/h5util.h
+++ b/java/src/jni/h5util.h
@@ -35,18 +35,29 @@ typedef struct h5str_t {
size_t max; /* the allocated size of the string */
} h5str_t;
-extern void h5str_new (h5str_t *str, size_t len);
-extern void h5str_free (h5str_t *str);
-extern void h5str_resize (h5str_t *str, size_t new_len);
-extern char* h5str_append (h5str_t *str, const char* cstr);
-extern size_t h5str_vlsprintf(h5str_t *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
-extern size_t h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int ptrlen, int expand_data);
-extern size_t h5str_vlsconvert(char *str, hid_t container, hid_t tid, hvl_t *buf, int expand_data);
-extern size_t h5str_convert(char **str, hid_t container, hid_t tid, hvl_t *buf, int ptroffset, int expand_data);
+extern void h5str_new(h5str_t *str, size_t len);
+extern void h5str_free(h5str_t *str);
+extern void h5str_resize(h5str_t *str, size_t new_len);
+extern char* h5str_append(h5str_t *str, const char* cstr);
+extern size_t h5str_convert(JNIEnv *env, char **in_str, hid_t container, hid_t tid, void *out_buf, size_t out_buf_offset);
+extern size_t h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *in_buf, size_t in_buf_len, int expand_data);
extern void h5str_array_free(char **strs, size_t len);
-extern int h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order);
-extern int h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_obj);
-extern int h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_obj);
+extern int h5str_dump_simple_dset(JNIEnv *env, FILE *stream, hid_t dset, int binary_order);
+extern int h5str_dump_region_blocks_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+extern int h5str_dump_region_points_data(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
+
+extern htri_t H5Tdetect_variable_str(hid_t tid);
+
+/*
+ * Symbols used to format the output of h5str_sprintf and
+ * to interpret the input to h5str_convert.
+ */
+#define H5_COMPOUND_BEGIN_INDICATOR "{"
+#define H5_COMPOUND_END_INDICATOR "}"
+#define H5_ARRAY_BEGIN_INDICATOR "["
+#define H5_ARRAY_END_INDICATOR "]"
+#define H5_VLEN_BEGIN_INDICATOR "("
+#define H5_VLEN_END_INDICATOR ")"
/*
* Class: hdf_hdf5lib_H5
diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c
index a5e6cd8..a1c8517 100644
--- a/java/src/jni/h5zImp.c
+++ b/java/src/jni/h5zImp.c
@@ -36,12 +36,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Zunregister
(JNIEnv *env, jclass clss, jint filter)
{
- herr_t retValue = H5Zunregister((H5Z_filter_t)filter);
+ herr_t retVal = FAIL;
- if (retValue < 0)
- h5libraryError(env);
+ UNUSED(clss);
- return (jint)retValue;
+ if ((retVal = H5Zunregister((H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+
+done:
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Zunregister */
/*
@@ -53,12 +56,15 @@ JNIEXPORT jint JNICALL
Java_hdf_hdf5lib_H5_H5Zfilter_1avail
(JNIEnv *env, jclass clss, jint filter)
{
- herr_t retValue = H5Zfilter_avail((H5Z_filter_t)filter);
+ herr_t retVal = FAIL;
+
+ UNUSED(clss);
- if (retValue < 0)
- h5libraryError(env);
+ if ((retVal = H5Zfilter_avail((H5Z_filter_t)filter)) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
- return (jint)retValue;
+done:
+ return (jint)retVal;
} /* end Java_hdf_hdf5lib_H5_H5Zfilter_1avail */
/*
@@ -73,9 +79,12 @@ Java_hdf_hdf5lib_H5_H5Zget_1filter_1info
{
unsigned int flags = 0;
- if (H5Zget_filter_info ((H5Z_filter_t) filter, (unsigned *) &flags) < 0)
- h5libraryError(env);
+ UNUSED(clss);
+
+ if (H5Zget_filter_info((H5Z_filter_t) filter, (unsigned *) &flags) < 0)
+ H5_LIBRARY_ERROR(ENVONLY);
+done:
return (jint)flags;
} /* end Java_hdf_hdf5lib_H5_H5Zget_1filter_1info */
diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c
index 33f4953..947f843 100644
--- a/java/src/jni/nativeData.c
+++ b/java/src/jni/nativeData.c
@@ -50,54 +50,49 @@ JNIEXPORT jintArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jintArray rarray = NULL;
- int blen;
- jint *iarray;
- jboolean bb;
- char *bp;
- jint *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToInt: bdata is NULL?");
- } /* end if */
- else {
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToInt: pin failed");
- } /* end if */
- else {
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jint);
- rarray = ENVPTR->NewIntArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToInt" );
- return NULL;
- } /* end if */
-
- iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: pin iarray failed");
- return NULL;
- } /* end if */
-
- bp = (char *)barr;
- iap = iarray;
- for (ii = 0; ii < len; ii++) {
- *iap = *(jint *)bp;
- iap++;
- bp += sizeof(jint);
- } /* end for */
-
- ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0);
- } /* end else */
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- } /* end else */
+ jintArray rarray = NULL;
+ jboolean bb;
+ jbyte *barr = NULL;
+ jint *iarray = NULL;
+ jint *iap = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToInt: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToInt: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jint);
+
+ if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned");
+
+ bp = (char *)barr;
+ iap = iarray;
+ for (ii = 0; ii < len; ii++) {
+ *iap = *(jint *)bp;
+ iap++;
+ bp += sizeof(jint);
+ } /* end for */
+
+done:
+ if (iarray)
+ UNPIN_INT_ARRAY(ENVONLY, rarray, iarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
+
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B */
@@ -106,40 +101,34 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jfloatArray rarray;
- int blen;
- jfloat *farray;
- jboolean bb;
- char *bp;
- jfloat *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToFloat: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToFloat: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jfloat);
- rarray = ENVPTR->NewFloatArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToFloat" );
- return NULL;
- } /* end if */
- farray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb);
- if (farray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToFloat: pin farray failed");
- return NULL;
- } /* end if */
+ jfloatArray rarray;
+ jboolean bb;
+ jfloat *farray = NULL;
+ jfloat *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jfloat);
+
+ if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned");
bp = (char *)barr;
iap = farray;
@@ -149,8 +138,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B
bp += sizeof(jfloat);
} /* end for */
- ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,farray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (farray)
+ UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */
@@ -160,42 +152,34 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jshortArray rarray;
- int blen;
- jshort *sarray;
- jboolean bb;
- char *bp;
- jshort *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToShort: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToShort: pin failed");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jshort);
- rarray = ENVPTR->NewShortArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToShort" );
- return NULL;
- } /* end if */
-
- sarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb);
- if (sarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToShort: pin sarray failed");
- return NULL;
- } /* end if */
+ jshortArray rarray;
+ jboolean bb;
+ jshort *sarray = NULL;
+ jshort *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToShort: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToShort: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jshort);
+
+ if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned");
bp = (char *)barr;
iap = sarray;
@@ -205,53 +189,48 @@ Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B
bp += sizeof(jshort);
} /* end for */
- ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,sarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (sarray)
+ UNPIN_SHORT_ARRAY(ENVONLY, rarray, sarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B */
-
/* returns long [] */
JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jlongArray rarray;
- int blen;
- jlong *larray;
- jboolean bb;
- char *bp;
- jlong *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToLong: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToLong: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jlong);
- rarray = ENVPTR->NewLongArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToLong" );
- return NULL;
- } /* end if */
-
- larray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb);
- if (larray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToLong: pin larray failed");
- return NULL;
- } /* end if */
+ jlongArray rarray;
+ jboolean bb;
+ jlong *larray = NULL;
+ jlong *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jlong);
+
+ if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned");
bp = (char *)barr;
iap = larray;
@@ -260,53 +239,49 @@ Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B
iap++;
bp += sizeof(jlong);
} /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,larray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+
+done:
+ if (larray)
+ UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B */
-
/* returns double [] */
JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */
{
- jbyte *barr;
- jdoubleArray rarray;
- int blen;
- jdouble *darray;
- jboolean bb;
- char *bp;
- jdouble *iap;
- int ii;
- int len;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToDouble: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToDouble: pin failed");
- return NULL;
- } /* end if */
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
-
- len = blen/(int)sizeof(jdouble);
- rarray = ENVPTR->NewDoubleArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToDouble" );
- return NULL;
- } /* end if */
-
- darray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb);
- if (darray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToDouble: pin darray failed");
- return NULL;
- } /* end if */
+ jdoubleArray rarray;
+ jboolean bb;
+ jdouble *darray = NULL;
+ jdouble *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+ int len;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToDouble: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToDouble: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0");
+ }
+
+ len = blen / (int)sizeof(jdouble);
+
+ if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned");
bp = (char *)barr;
iap = darray;
@@ -316,59 +291,50 @@ Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B
bp += sizeof(jdouble);
} /* end for */
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,darray,0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (darray)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B */
-
/* returns int [] */
JNIEXPORT jintArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jintArray rarray;
- int blen;
- jint *iarray;
- jint *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToInt: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError(env, "byteToInt: pin failed");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jint))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: getLen failed");
- return NULL;
- } /* end if */
+ jintArray rarray;
+ jboolean bb;
+ jint *iarray = NULL;
+ jint *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToInt: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToInt: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToInt: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jint))) > blen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "byteToInt: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewIntArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToInt" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewIntArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError(env, "byteToInt: pin iarray failed");
- return NULL;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, rarray, iarray, &bb, "byteToInt: int array not pinned");
iap = iarray;
for (ii = 0; ii < len; ii++) {
@@ -377,8 +343,11 @@ Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B
bp += sizeof(jint);
} /* end for */
- ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (iarray)
+ UNPIN_INT_ARRAY(ENVONLY, rarray, iarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B */
@@ -388,57 +357,49 @@ JNIEXPORT jshortArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jshortArray rarray;
- int blen;
- jshort *iarray;
- jshort *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToShort: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToShort: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jshort))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToShort: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jshortArray rarray;
+ jboolean bb;
+ jshort *sarray = NULL;
+ jshort *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToShort: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToShort: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToShort: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jshort))) > blen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "byteToShort: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewShortArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToShort" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewShortArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToShort: getShort failed?");
- return NULL;
- } /* end if */
+ PIN_SHORT_ARRAY(ENVONLY, rarray, sarray, &bb, "byteToShort: short array not pinned");
- iap = iarray;
+ iap = sarray;
for (ii = 0; ii < len; ii++) {
*iap = *(jshort *)bp;
iap++;
bp += sizeof(jshort);
} /* end for */
- ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (sarray)
+ UNPIN_SHORT_ARRAY(ENVONLY, rarray, sarray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B */
@@ -448,57 +409,49 @@ JNIEXPORT jfloatArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jfloatArray rarray;
- int blen;
- jfloat *iarray;
- jfloat *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToFloat: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToFloat: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jfloat))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToFloat: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jfloatArray rarray;
+ jboolean bb;
+ jfloat *farray = NULL;
+ jfloat *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToFloat: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToFloat: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToFloat: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jfloat))) > blen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "byteToFloat: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewFloatArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToFloat" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewFloatArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToFloat: getFloat failed?");
- return NULL;
- } /* end if */
+ PIN_FLOAT_ARRAY(ENVONLY, rarray, farray, &bb, "byteToFloat: float array not pinned");
- iap = iarray;
+ iap = farray;
for (ii = 0; ii < len; ii++) {
*iap = *(jfloat *)bp;
iap++;
bp += sizeof(jfloat);
} /* end for */
- ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (farray)
+ UNPIN_FLOAT_ARRAY(ENVONLY, rarray, farray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */
@@ -508,58 +461,49 @@ JNIEXPORT jlongArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jlongArray rarray;
- int blen;
- jlong *iarray;
- jlong *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToLong: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToLong: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jlong))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToLong: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jlongArray rarray;
+ jboolean bb;
+ jlong *larray = NULL;
+ jlong *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToLong: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToLong: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToLong: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jlong))) > blen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "byteToLong: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewLongArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToLong" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewLongArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToLong: getLong failed?");
- return NULL;
- } /* end if */
+ PIN_LONG_ARRAY(ENVONLY, rarray, larray, &bb, "byteToLong: long array not pinned");
- iap = iarray;
+ iap = larray;
for (ii = 0; ii < len; ii++) {
-
*iap = *(jlong *)bp;
iap++;
bp += sizeof(jlong);
} /* end for */
- ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (larray)
+ UNPIN_LONG_ARRAY(ENVONLY, rarray, larray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */
@@ -569,57 +513,49 @@ JNIEXPORT jdoubleArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B
(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */
{
- char *bp;
- jbyte *barr;
- jdoubleArray rarray;
- int blen;
- jdouble *iarray;
- jdouble *iap;
- int ii;
- jboolean bb;
-
- if (bdata == NULL) {
- h5nullArgument( env, "byteToDouble: bdata is NULL?");
- return NULL;
- } /* end if */
- barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb);
- if (barr == NULL) {
- h5JNIFatalError( env, "byteToDouble: getByte failed?");
- return NULL;
- } /* end if */
-
- blen = ENVPTR->GetArrayLength(ENVPAR bdata);
- if ((start < 0) || ((int)(start + (len*(int)sizeof(jdouble))) > blen)) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5badArgument( env, "byteToDouble: start or len is out of bounds");
- return NULL;
- } /* end if */
+ jdoubleArray rarray;
+ jboolean bb;
+ jdouble *darray = NULL;
+ jdouble *iap = NULL;
+ jbyte *barr = NULL;
+ char *bp = NULL;
+ int blen;
+ int ii;
+
+ UNUSED(clss);
+
+ if (NULL == bdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "byteToDouble: byte array is NULL");
+
+ PIN_BYTE_ARRAY(ENVONLY, bdata, barr, &bb, "byteToDouble: byte array not pinned");
+
+ if ((blen = ENVPTR->GetArrayLength(ENVONLY, bdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "byteToDouble: bdata length < 0");
+ }
+
+ if ((start < 0) || ((int)(start + (len * (int)sizeof(jdouble))) > blen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "byteToDouble: start < 0 or len exceeded buffer length");
bp = (char *)barr + start;
- rarray = ENVPTR->NewDoubleArray(ENVPAR len);
- if (rarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5outOfMemory( env, "byteToDouble" );
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewDoubleArray(ENVONLY, len)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- iarray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb);
- if (iarray == NULL) {
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
- h5JNIFatalError( env, "byteToDouble: getDouble failed?");
- return NULL;
- } /* end if */
+ PIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, &bb, "byteToDouble: double array not pinned");
- iap = iarray;
+ iap = darray;
for (ii = 0; ii < len; ii++) {
*iap = *(jdouble *)bp;
iap++;
bp += sizeof(jdouble);
} /* end for */
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,iarray, 0);
- ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT);
+done:
+ if (darray)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, rarray, darray, rarray ? 0 : JNI_ABORT);
+ if (barr)
+ UNPIN_BYTE_ARRAY(ENVONLY, bdata, barr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B */
@@ -629,67 +565,59 @@ JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
(JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */
{
- jint *ip;
- jint *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ jint *ip = NULL;
+ jint *iarr = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
int ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "intToByte: idata is NULL?");
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == idata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "intToByte: int array is NULL");
- iarr = ENVPTR->GetIntArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "intToByte: getInt failed?");
- return NULL;
- } /* end if */
+ PIN_INT_ARRAY(ENVONLY, idata, iarr, &bb, "intToByte: int array not pinned");
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "intToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, idata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "intToByte: idata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "intToByte: start < 0 or len exceeded buffer length");
ip = iarr + start;
blen = ilen * (int)sizeof(jint);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "intToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "intToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "intToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (iarr)
+ UNPIN_INT_ARRAY(ENVONLY, idata, iarr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I */
@@ -697,68 +625,61 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
- (JNIEnv *env, jclass clss, jint start, jint len, jshortArray idata) /* IN: array of short */
+ (JNIEnv *env, jclass clss, jint start, jint len, jshortArray sdata) /* IN: array of short */
{
- jshort *ip;
- jshort *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jshort *ip = NULL;
+ jshort *sarr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
short ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "shortToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetShortArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "shortToByte: getShort failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "shortToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == sdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "shortToByte: short array is NULL");
+
+ PIN_SHORT_ARRAY(ENVONLY, sdata, sarr, &bb, "shortToByte: short array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, sdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "shortToByte: sdata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "shortToByte: start < 0 or len exceeded buffer length");
+
+ ip = sarr + start;
blen = ilen * (int)sizeof(jshort);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "shortToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "shortToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "shortToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jshort); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (sarr)
+ UNPIN_SHORT_ARRAY(ENVONLY, sdata, sarr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S */
@@ -766,68 +687,61 @@ Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
- (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray idata) /* IN: array of float */
+ (JNIEnv *env, jclass clss, jint start, jint len, jfloatArray fdata) /* IN: array of float */
{
- jfloat *ip;
- jfloat *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jfloat *ip = NULL;
+ jfloat *farr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
float ival;
char bytes[4];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "floatToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetFloatArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "floatToByte: getFloat failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "floatToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == fdata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "floatToByte: float array is NULL");
+
+ PIN_FLOAT_ARRAY(ENVONLY, fdata, farr, &bb, "floatToByte: float array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, fdata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "floatToByte: fdata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "floatToByte: start < 0 or len exceeded buffer length");
+
+ ip = farr + start;
blen = ilen * (int)sizeof(jfloat);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "floatToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "floatToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "floatToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jfloat); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (farr)
+ UNPIN_FLOAT_ARRAY(ENVONLY, fdata, farr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F */
@@ -835,178 +749,159 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D
- (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray idata) /* IN: array of double */
+ (JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray ddata) /* IN: array of double */
{
- jdouble *ip;
- jdouble *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jdouble *ip = NULL;
+ jdouble *darr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
double ival;
char bytes[8];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "doubleToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetDoubleArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "doubleToByte: getDouble failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "doubleToByte: start or len is out of bounds");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == ddata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "doubleToByte: double array is NULL");
+
+ PIN_DOUBLE_ARRAY(ENVONLY, ddata, darr, &bb, "doubleToByte: double array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, ddata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "doubleToByte: ddata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "doubleToByte: start < 0 or len exceeded buffer length");
+
+ ip = darr + start;
blen = ilen * (int)sizeof(jdouble);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "doubleToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "doubleToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "doubleToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jdouble); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (darr)
+ UNPIN_DOUBLE_ARRAY(ENVONLY, ddata, darr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J
- (JNIEnv *env, jclass clss, jint start, jint len, jlongArray idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jint start, jint len, jlongArray ldata) /* IN: array of long */
{
- jlong *ip;
- jlong *iarr;
- int ilen;
- jbyteArray rarray;
- int blen;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ii;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jlong *ip = NULL;
+ jlong *larr = NULL;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ilen;
+ int blen;
+ int ii;
+ int ij;
union things {
jlong ival;
char bytes[8];
} u;
- if (idata == NULL) {
- h5nullArgument( env, "longToByte: idata is NULL?");
- return NULL;
- } /* end if */
- iarr = ENVPTR->GetLongArrayElements(ENVPAR idata,&bb);
- if (iarr == NULL) {
- h5JNIFatalError( env, "longToByte: getLong failed?");
- return NULL;
- } /* end if */
-
- ilen = ENVPTR->GetArrayLength(ENVPAR idata);
- if ((start < 0) || (((start + len)) > ilen)) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5badArgument( env, "longToByte: start or len is out of bounds?\n");
- return NULL;
- } /* end if */
+ UNUSED(clss);
- ip = iarr + start;
+ if (NULL == ldata)
+ H5_NULL_ARGUMENT_ERROR(ENVONLY, "longToByte: long array is NULL");
+
+ PIN_LONG_ARRAY(ENVONLY, ldata, larr, &bb, "longToByte: long array not pinned");
+
+ if ((ilen = ENVPTR->GetArrayLength(ENVONLY, ldata)) < 0) {
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_TRUE);
+ H5_BAD_ARGUMENT_ERROR(ENVONLY, "longToByte: ldata length < 0");
+ }
+
+ if ((start < 0) || (((start + len)) > ilen))
+ H5_JNI_FATAL_ERROR(ENVONLY, "longToByte: start < 0 or len exceeded buffer length");
+
+ ip = larr + start;
blen = ilen * (int)sizeof(jlong);
- rarray = ENVPTR->NewByteArray(ENVPAR blen);
- if (rarray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5outOfMemory( env, "longToByte" );
- return NULL;
- } /* end if */
-
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
- h5JNIFatalError( env, "longToByte: getByte failed?");
- return NULL;
- } /* end if */
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, blen)))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "longToByte: byte array not pinned");
bap = barray;
for (ii = 0; ii < len; ii++) {
u.ival = *ip++;
- for (ij = 0; ij < sizeof(jlong); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
- ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, rarray ? 0 : JNI_ABORT);
+ if (larr)
+ UNPIN_LONG_ARRAY(ENVONLY, ldata, larr, JNI_ABORT);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_intToByte__I
(JNIEnv *env, jclass clss, jint idata) /* IN: int */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- int ij;
- jboolean bb;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
int ival;
char bytes[sizeof(int)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jint));
- if (rarray == NULL) {
- h5outOfMemory( env, "intToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jint))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "intToByte: getByte failed?");
- return NULL;
- } /* end if */
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "intToByte: byte array not pinned");
bap = barray;
u.ival = idata;
- for (ij = 0; ij < sizeof(jint); ij++) {
+ for (ij = 0; (size_t) ij < sizeof(jint); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__I */
@@ -1014,38 +909,35 @@ Java_hdf_hdf5lib_HDFNativeData_intToByte__I
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
- (JNIEnv *env, jclass clss, jfloat idata) /* IN: int */
+ (JNIEnv *env, jclass clss, jfloat fdata) /* IN: float */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
float ival;
char bytes[sizeof(float)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jfloat));
- if (rarray == NULL) {
- h5outOfMemory( env, "floatToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "floatToByte: getByte failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jfloat))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "floatToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jfloat); ij++) {
+ u.ival = fdata;
+ for (ij = 0; (size_t) ij < sizeof(jfloat); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__F */
@@ -1053,118 +945,107 @@ Java_hdf_hdf5lib_HDFNativeData_floatToByte__F
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_shortToByte__S
- (JNIEnv *env, jclass clss, jshort idata) /* IN: short */
+ (JNIEnv *env, jclass clss, jshort sdata) /* IN: short */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
short ival;
char bytes[sizeof(short)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jshort));
- if (rarray == NULL) {
- h5outOfMemory( env, "shortToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "shortToByte: getShort failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jshort))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "shortToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jshort); ij++) {
+ u.ival = sdata;
+ for (ij = 0; (size_t) ij < sizeof(jshort); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__S */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D
- (JNIEnv *env, jclass clss, jdouble idata) /* IN: double */
+ (JNIEnv *env, jclass clss, jdouble ddata) /* IN: double */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
double ival;
char bytes[sizeof(double)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jdouble));
- if (rarray == NULL) {
- h5outOfMemory( env, "doubleToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
+
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jdouble))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "doubleToByte: getDouble failed?");
- return NULL;
- } /* end if */
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "doubleToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jdouble); ij++) {
+ u.ival = ddata;
+ for (ij = 0; (size_t) ij < sizeof(jdouble); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D */
-
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_longToByte__J
- (JNIEnv *env, jclass clss, jlong idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jlong ldata) /* IN: long */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
jlong ival;
char bytes[sizeof(jlong)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jlong));
- if (rarray == NULL) {
- h5outOfMemory( env, "longToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "longToByte: getLong failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jlong))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "longToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jlong); ij++) {
+ u.ival = ldata;
+ for (ij = 0; (size_t) ij < sizeof(jlong); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__J */
@@ -1172,38 +1053,35 @@ Java_hdf_hdf5lib_HDFNativeData_longToByte__J
/* returns byte [] */
JNIEXPORT jbyteArray JNICALL
Java_hdf_hdf5lib_HDFNativeData_byteToByte__B
- (JNIEnv *env, jclass clss, jbyte idata) /* IN: array of long */
+ (JNIEnv *env, jclass clss, jbyte bdata) /* IN: byte */
{
- jbyteArray rarray;
- jbyte *barray;
- jbyte *bap;
- jboolean bb;
- int ij;
+ jbyteArray rarray;
+ jboolean bb;
+ jbyte *barray = NULL;
+ jbyte *bap = NULL;
+ int ij;
union things {
jbyte ival;
char bytes[sizeof(jbyte)];
} u;
- rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jbyte));
- if (rarray == NULL) {
- h5outOfMemory( env, "byteToByte" );
- return NULL;
- } /* end if */
+ UNUSED(clss);
- barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb);
- if (barray == NULL) {
- h5JNIFatalError( env, "byteToByte: getByte failed?");
- return NULL;
- } /* end if */
+ if (NULL == (rarray = ENVPTR->NewByteArray(ENVONLY, sizeof(jbyte))))
+ CHECK_JNI_EXCEPTION(ENVONLY, JNI_FALSE);
+
+ PIN_BYTE_ARRAY(ENVONLY, rarray, barray, &bb, "byteToByte: byte array not pinned");
bap = barray;
- u.ival = idata;
- for (ij = 0; ij < sizeof(jbyte); ij++) {
+ u.ival = bdata;
+ for (ij = 0; (size_t) ij < sizeof(jbyte); ij++) {
*bap = u.bytes[ij];
bap++;
} /* end for */
- ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0);
+done:
+ if (barray)
+ UNPIN_BYTE_ARRAY(ENVONLY, rarray, barray, 0);
return rarray;
} /* end Java_hdf_hdf5lib_HDFNativeData_byteToByte__B */
diff --git a/java/test/Makefile.in b/java/test/Makefile.in
index c30554a..06080ce 100644
--- a/java/test/Makefile.in
+++ b/java/test/Makefile.in
@@ -497,7 +497,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -531,6 +530,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1328,7 +1328,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/java/test/TestH5.java b/java/test/TestH5.java
index 8fe4a56..6122c14 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, 10, 4 };
+ int libversion[] = { 1, 10, 5 };
try {
H5.H5get_libversion(libversion);
@@ -177,6 +177,23 @@ public class TestH5 {
for (int i = 0; i < 2; i++)
assertFalse(libversion[i] == 0);
}
+
+ /**
+ * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}
+ * to ensure a null libversion parameter causes the function to
+ * fail.
+ */
+ @Test
+ public void testH5get_libversion_null_param() {
+ try {
+ H5.H5get_libversion(null);
+ }
+ catch (Throwable err) {
+ return;
+ }
+
+ fail("H5.H5get_libversion: succeeded with a null libversion parameter!");
+ }
/**
* Test method for
@@ -184,7 +201,7 @@ public class TestH5 {
*/
@Test
public void testH5check_version() {
- int majnum = 1, minnum = 10, relnum = 4;
+ int majnum = 1, minnum = 10, relnum = 5;
try {
H5.H5check_version(majnum, minnum, relnum);
diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java
index 406a1d3..1b5acfa 100644
--- a/java/test/TestH5Dplist.java
+++ b/java/test/TestH5Dplist.java
@@ -13,6 +13,7 @@
package test;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -211,4 +212,23 @@ public class TestH5Dplist {
assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99);
}
+ @Test
+ public void testH5P_dset_no_attrs_hint() {
+ boolean ret_val_id = true;
+
+ _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE);
+
+ try {
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertFalse("H5P_dset_no_attrs_hint", ret_val_id);
+ H5.H5Pset_dset_no_attrs_hint(H5dcpl_id, true);
+ ret_val_id = H5.H5Pget_dset_no_attrs_hint(H5dcpl_id);
+ assertTrue("H5P_dset_no_attrs_hint", ret_val_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5P_dset_no_attrs_hint: " + err);
+ }
+ }
+
}
diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java
index 59ff50e..1f4e658 100644
--- a/java/test/TestH5E.java
+++ b/java/test/TestH5E.java
@@ -38,7 +38,7 @@ import org.junit.rules.TestName;
public class TestH5E {
@Rule public TestName testname = new TestName();
- public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_CNT = 3;
public static final int ERRSTACK_MTY_CNT = 0;
long hdf_java_classid = -1;
diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java
index a3057c6..076d313 100644
--- a/java/test/TestH5Edefault.java
+++ b/java/test/TestH5Edefault.java
@@ -29,7 +29,7 @@ import org.junit.rules.TestName;
public class TestH5Edefault {
@Rule public TestName testname = new TestName();
- public static final int ERRSTACK_CNT = 4;
+ public static final int ERRSTACK_CNT = 3;
public static final int ERRSTACK_MTY_CNT = 0;
@Before
@@ -239,7 +239,7 @@ public class TestH5Edefault {
H5.H5Eget_class_name(-1);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Eget_class_name_invalid_classname() throws Throwable {
H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT);
}
diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java
index 11d6644..e72431b 100644
--- a/java/test/TestH5Fbasic.java
+++ b/java/test/TestH5Fbasic.java
@@ -14,6 +14,7 @@
package test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -315,4 +316,20 @@ public class TestH5Fbasic {
fail("H5.H5Freset_mdc_hit_rate_stats: " + err);
}
}
+
+ @Test
+ public void testH5F_dset_no_attrs_hint() {
+ boolean ret_val_id = true;
+ try {
+ ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid);
+ assertFalse("H5F_dset_no_attrs_hint", ret_val_id);
+ H5.H5Fset_dset_no_attrs_hint(H5fid, true);
+ ret_val_id = H5.H5Fget_dset_no_attrs_hint(H5fid);
+ assertTrue("H5F_dset_no_attrs_hint", ret_val_id);
+ }
+ catch (Throwable err) {
+ err.printStackTrace();
+ fail("H5F_dset_no_attrs_hint: " + err);
+ }
+ }
}
diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java
index fffded1..54a4579 100644
--- a/java/test/TestH5Fparams.java
+++ b/java/test/TestH5Fparams.java
@@ -22,10 +22,12 @@ import java.io.File;
import hdf.hdf5lib.H5;
import hdf.hdf5lib.HDF5Constants;
+import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
@@ -210,4 +212,42 @@ public class TestH5Fparams {
try {H5.H5Fclose(fid);} catch (Exception ex) {}
}
}
+
+ @Ignore//(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidlow() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, 5, HDF5Constants.H5F_LIBVER_LATEST);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
+
+ @Ignore//(expected = HDF5FunctionArgumentException.class)
+ public void testH5Fset_libver_bounds_invalidhigh() throws Throwable {
+ long fid = -1;
+
+ try {
+ try {
+ fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC,
+ HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT);
+ }
+ catch (Throwable err) {
+ fail("H5.H5Fcreate: " + err);
+ }
+ H5.H5Fset_libver_bounds(fid, HDF5Constants.H5F_LIBVER_V110, HDF5Constants.H5F_LIBVER_V110+1);
+ }
+ finally {
+ try {H5.H5Fclose(fid);} catch (Exception ex) {}
+ }
+ }
}
diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java
index 8b3c673..d340ee7 100644
--- a/java/test/TestH5Oparams.java
+++ b/java/test/TestH5Oparams.java
@@ -124,7 +124,7 @@ public class TestH5Oparams {
H5.H5Oset_comment(-1, "Bogus");
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Oget_comment_invalid() throws Throwable {
H5.H5Oget_comment(-1);
}
@@ -139,7 +139,7 @@ public class TestH5Oparams {
H5.H5Oset_comment_by_name(-1, null, null, -1);
}
- @Test(expected = IllegalArgumentException.class)
+ @Test(expected = HDF5LibraryException.class)
public void testH5Oget_comment_by_name_invalid() throws Throwable {
H5.H5Oget_comment_by_name(-1, "Bogus", -1);
}
diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java
index e6105d9..981f34e 100644
--- a/java/test/TestH5P.java
+++ b/java/test/TestH5P.java
@@ -25,6 +25,7 @@ import hdf.hdf5lib.HDF5Constants;
import hdf.hdf5lib.exceptions.HDF5Exception;
import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException;
import hdf.hdf5lib.exceptions.HDF5LibraryException;
+import hdf.hdf5lib.structs.H5F_info2_t;
import org.junit.After;
import org.junit.Before;
@@ -887,37 +888,12 @@ public class TestH5P {
}
@Test(expected = NullPointerException.class)
- public void testH5Pget_version_null() throws Throwable {
- H5.H5Pget_version(fcpl_id, null);
- }
-
- @Test
- public void testH5Pget_version() {
- int[] version_info = {255,255,255,255};
-
- try {
- _createH5File(fcpl_id, fapl_id);
- H5.H5Pget_version(fcpl_id, version_info);
- deleteH5file();
- }
- catch (Throwable err) {
- err.printStackTrace();
- fail("H5Pget_version: " + err);
- }
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
- }
-
- @Test(expected = NullPointerException.class)
public void testH5Pget_userblock_null() throws Throwable {
H5.H5Pget_userblock(fcpl_id, null);
}
@Test
public void testH5P_userblock() {
- int[] version_info = {255,255,255,255};
long[] size = {0};
try {
@@ -931,7 +907,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_userblock(fcpl_id, size);
deleteH5file();
}
@@ -939,10 +918,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_userblock: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("user block size: "+size[0], size[0] == 1024);
}
@@ -953,7 +928,6 @@ public class TestH5P {
@Test
public void testH5P_sizes() {
- int[] version_info = {255,255,255,255};
long[] size = {0,0};
try {
@@ -967,7 +941,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sizes(fcpl_id, size);
deleteH5file();
}
@@ -975,10 +952,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sizes: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("sizeof_addr size: "+size[0], size[0] == 4);
assertTrue("sizeof_size size: "+size[1], size[1] == 8);
}
@@ -990,7 +963,6 @@ public class TestH5P {
@Test
public void testH5P_sym_k() {
- int[] version_info = {255,255,255,255};
int[] size = {0,0};
try {
@@ -1004,7 +976,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 0);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_sym_k(fcpl_id, size);
deleteH5file();
}
@@ -1012,10 +987,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 0);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("symbol table tree rank: "+size[0], size[0] == 32);
assertTrue("symbol table node size: "+size[1], size[1] == 8);
}
@@ -1027,7 +998,6 @@ public class TestH5P {
@Test
public void testH5P_istore_k() {
- int[] version_info = {255,255,255,255};
int[] size = {0};
try {
@@ -1041,7 +1011,10 @@ public class TestH5P {
fcpl_id = H5.H5Fget_create_plist(H5fid);
/* Get the file's version information */
- H5.H5Pget_version(fcpl_id, version_info);
+ H5F_info2_t finfo = H5.H5Fget_info(H5fid);
+ assertTrue("super block version: "+finfo.super_version, finfo.super_version == 1);
+ assertTrue("free-space manager version: "+finfo.free_version, finfo.free_version == 0);
+ assertTrue("shared object header version: "+finfo.sohm_version, finfo.sohm_version == 0);
H5.H5Pget_istore_k(fcpl_id, size);
deleteH5file();
}
@@ -1049,10 +1022,6 @@ public class TestH5P {
err.printStackTrace();
fail("H5Pget_sym_k: " + err);
}
- assertTrue("super block version: "+version_info[0], version_info[0] == 1);
- assertTrue("global freelist version: "+version_info[1], version_info[1] == 0);
- assertTrue("symbol table version: "+version_info[2], version_info[2] == 0);
- assertTrue("shared object header version: "+version_info[3], version_info[3] == 0);
assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64);
}
diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java
index 3007495..2173647 100644
--- a/java/test/TestH5Sbasic.java
+++ b/java/test/TestH5Sbasic.java
@@ -49,7 +49,7 @@ public class TestH5Sbasic {
H5.H5Screate(-1);
}
- @Test(expected = HDF5LibraryException.class)
+ @Test(expected = IllegalArgumentException.class)
public void testH5Sget_simple_extent_type_invalid() throws Throwable {
H5.H5Sget_simple_extent_type(-1);
}
diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in
index 02d0147..b901782 100644
--- a/java/test/junit.sh.in
+++ b/java/test/junit.sh.in
@@ -324,7 +324,7 @@ TESTING JUnit-TestH5
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5.ext > JUnit-TestH5.out
@@ -345,7 +345,7 @@ TESTING JUnit-TestH5Eparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Eparams.ext > JUnit-TestH5Eparams.out
@@ -366,7 +366,7 @@ TESTING JUnit-TestH5Eregister
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Eregister.ext > JUnit-TestH5Eregister.out
@@ -387,7 +387,7 @@ TESTING JUnit-TestH5Fparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Fparams.ext > JUnit-TestH5Fparams.out
@@ -408,7 +408,7 @@ TESTING JUnit-TestH5Fbasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Fbasic.ext > JUnit-TestH5Fbasic.out
@@ -429,7 +429,7 @@ TESTING JUnit-TestH5F
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5F.ext > JUnit-TestH5F.out
@@ -450,7 +450,7 @@ TESTING JUnit-TestH5Fswmr
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Fswmr.ext > JUnit-TestH5Fswmr.out
@@ -471,7 +471,7 @@ TESTING JUnit-TestH5Gbasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Gbasic.ext > JUnit-TestH5Gbasic.out
@@ -492,7 +492,7 @@ TESTING JUnit-TestH5G
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5G.ext > JUnit-TestH5G.out
@@ -513,7 +513,7 @@ TESTING JUnit-TestH5Sbasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Sbasic.ext > JUnit-TestH5Sbasic.out
@@ -534,7 +534,7 @@ TESTING JUnit-TestH5S
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5S.ext > JUnit-TestH5S.out
@@ -555,7 +555,7 @@ TESTING JUnit-TestH5Tparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Tparams.ext > JUnit-TestH5Tparams.out
@@ -576,7 +576,7 @@ TESTING JUnit-TestH5Tbasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Tbasic.ext > JUnit-TestH5Tbasic.out
@@ -597,7 +597,7 @@ TESTING JUnit-TestH5T
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5T.ext > JUnit-TestH5T.out
@@ -618,7 +618,7 @@ TESTING JUnit-TestH5Dparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Dparams.ext > JUnit-TestH5Dparams.out
@@ -639,7 +639,7 @@ TESTING JUnit-TestH5D
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5D.ext > JUnit-TestH5D.out
@@ -660,7 +660,7 @@ TESTING JUnit-TestH5Dplist
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Dplist.ext > JUnit-TestH5Dplist.out
@@ -681,7 +681,7 @@ TESTING JUnit-TestH5Lparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Lparams.ext > JUnit-TestH5Lparams.out
@@ -702,7 +702,7 @@ TESTING JUnit-TestH5Lbasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Lbasic.ext > JUnit-TestH5Lbasic.out
@@ -723,7 +723,7 @@ TESTING JUnit-TestH5Lcreate
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Lcreate.ext > JUnit-TestH5Lcreate.out
@@ -744,7 +744,7 @@ TESTING JUnit-TestH5R
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5R.ext > JUnit-TestH5R.out
@@ -765,7 +765,7 @@ TESTING JUnit-TestH5P
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5P.ext > JUnit-TestH5P.out
@@ -786,7 +786,7 @@ TESTING JUnit-TestH5PData
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5PData.ext > JUnit-TestH5PData.out
@@ -807,7 +807,7 @@ TESTING JUnit-TestH5Pfapl
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Pfapl.ext > JUnit-TestH5Pfapl.out
@@ -828,7 +828,7 @@ TESTING JUnit-TestH5Pvirtual
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Pvirtual.ext > JUnit-TestH5Pvirtual.out
@@ -849,7 +849,7 @@ TESTING JUnit-TestH5Plist
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Plist.ext > JUnit-TestH5Plist.out
@@ -870,7 +870,7 @@ TESTING JUnit-TestH5A
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5A.ext > JUnit-TestH5A.out
@@ -891,7 +891,7 @@ TESTING JUnit-TestH5Oparams
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Oparams.ext > JUnit-TestH5Oparams.out
@@ -912,7 +912,7 @@ TESTING JUnit-TestH5Obasic
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Obasic.ext > JUnit-TestH5Obasic.out
@@ -933,7 +933,7 @@ TESTING JUnit-TestH5Ocreate
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Ocreate.ext > JUnit-TestH5Ocreate.out
@@ -954,7 +954,7 @@ TESTING JUnit-TestH5Ocopy
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Ocopy.ext > JUnit-TestH5Ocopy.out
@@ -975,7 +975,7 @@ TESTING JUnit-TestH5PL
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5PL.ext > JUnit-TestH5PL.out
@@ -996,7 +996,7 @@ TESTING JUnit-TestH5Z
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Z.ext > JUnit-TestH5Z.out
@@ -1019,7 +1019,7 @@ if test "X-$BUILD_MODE" = "X-production" ; then
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5E.ext > JUnit-TestH5E.out
@@ -1042,7 +1042,7 @@ if test "X-$BUILD_MODE" = "X-production" ; then
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Edefault.ext > JUnit-TestH5Edefault.out
@@ -1057,6 +1057,7 @@ if test "X-$BUILD_MODE" = "X-production" ; then
fi
fi
fi
+
if test $USE_FILTER_SZIP = "yes"; then
echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestH5Giterate"
TESTING JUnit-TestH5Giterate
@@ -1065,7 +1066,7 @@ if test $USE_FILTER_SZIP = "yes"; then
# Extract file name, line number, version and thread IDs because they may be different
sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \
-e 's/line [0-9]*/line (number)/' \
- -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \
+ -e 's/Time: [0-9]*[\.[0-9]*]*/Time: XXXX/' \
-e 's/v[1-9]*\.[0-9]*\./version (number)\./' \
-e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \
JUnit-TestH5Giterate.ext > JUnit-TestH5Giterate.out
diff --git a/java/test/testfiles/JUnit-TestH5.txt b/java/test/testfiles/JUnit-TestH5.txt
index 37c5b65..b282a91 100644
--- a/java/test/testfiles/JUnit-TestH5.txt
+++ b/java/test/testfiles/JUnit-TestH5.txt
@@ -1,4 +1,5 @@
JUnit version 4.11
+.testH5get_libversion_null_param
.testJ2C
.testIsSerializable
.testH5garbage_collect
@@ -11,5 +12,5 @@ JUnit version 4.11
Time: XXXX
-OK (9 tests)
+OK (10 tests)
diff --git a/java/test/testfiles/JUnit-TestH5Dplist.txt b/java/test/testfiles/JUnit-TestH5Dplist.txt
index 1dfbed1..64e924a 100644
--- a/java/test/testfiles/JUnit-TestH5Dplist.txt
+++ b/java/test/testfiles/JUnit-TestH5Dplist.txt
@@ -1,7 +1,8 @@
JUnit version 4.11
+.testH5P_dset_no_attrs_hint
.testH5Dset_extent
Time: XXXX
-OK (1 test)
+OK (2 tests)
diff --git a/java/test/testfiles/JUnit-TestH5Edefault.txt b/java/test/testfiles/JUnit-TestH5Edefault.txt
index 62497f9..b39dbef 100644
--- a/java/test/testfiles/JUnit-TestH5Edefault.txt
+++ b/java/test/testfiles/JUnit-TestH5Edefault.txt
@@ -36,25 +36,19 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Fopen(): unable to open file
major: File accessibilty
minor: Unable to open file
- #001: (file name) line (number) in H5F__open(): unable to open file
- major: File accessibilty
- minor: Unable to open file
- #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class
+ #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class
major: File accessibilty
minor: Can't get value
- #003: (file name) line (number) in H5FD_get_class(): can't find object for ID
+ #002: (file name) line (number) in H5FD_get_class(): can't find object for ID
major: Object atom
minor: Unable to find atom information (already closed?)
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Fopen(): unable to open file
major: File accessibilty
minor: Unable to open file
- #001: (file name) line (number) in H5F__open(): unable to open file
- major: File accessibilty
- minor: Unable to open file
- #002: (file name) line (number) in H5F_open(): unable to retrieve VFL class
+ #001: (file name) line (number) in H5F_open(): unable to retrieve VFL class
major: File accessibilty
minor: Can't get value
- #003: (file name) line (number) in H5FD_get_class(): can't find object for ID
+ #002: (file name) line (number) in H5FD_get_class(): can't find object for ID
major: Object atom
minor: Unable to find atom information (already closed?)
diff --git a/java/test/testfiles/JUnit-TestH5Fbasic.txt b/java/test/testfiles/JUnit-TestH5Fbasic.txt
index 467e2fb..56cc5c7 100644
--- a/java/test/testfiles/JUnit-TestH5Fbasic.txt
+++ b/java/test/testfiles/JUnit-TestH5Fbasic.txt
@@ -2,6 +2,7 @@ JUnit version 4.11
.testH5Fget_mdc_size
.testH5Fget_mdc_hit_rate
.testH5Fis_hdf5
+.testH5F_dset_no_attrs_hint
.testH5Fget_freespace
.testH5Fclose
.testH5Fget_filesize
@@ -17,5 +18,5 @@ JUnit version 4.11
Time: XXXX
-OK (15 tests)
+OK (16 tests)
diff --git a/java/test/testfiles/JUnit-TestH5P.txt b/java/test/testfiles/JUnit-TestH5P.txt
index c937ae2..01acadd 100644
--- a/java/test/testfiles/JUnit-TestH5P.txt
+++ b/java/test/testfiles/JUnit-TestH5P.txt
@@ -48,7 +48,6 @@ JUnit version 4.11
.testH5Pset_link_creation_order_invalidvalue
.testH5P_sym_k
.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist
-.testH5Pget_version_null
.testH5Pset_scaleoffset_Invalidscale_factor
.testH5Pget_elink_prefix_null
.testH5Pget_data_transform_IllegalSize
@@ -74,7 +73,6 @@ JUnit version 4.11
.testH5Pget_shared_mesg_index
.testH5Pset_link_phase_change
.testH5Pget_shared_mesg_nindexes
-.testH5Pget_version
.testH5Pset_elink_acc_flags_InvalidFlag1
.testH5Pset_elink_acc_flags_InvalidFlag2
.testH5Pget_link_phase_change_EqualsSet
@@ -87,5 +85,5 @@ JUnit version 4.11
Time: XXXX
-OK (85 tests)
+OK (83 tests)
diff --git a/release_docs/HISTORY-1_10.txt b/release_docs/HISTORY-1_10.txt
index 4344482..ad8beb2 100644
--- a/release_docs/HISTORY-1_10.txt
+++ b/release_docs/HISTORY-1_10.txt
@@ -3,6 +3,7 @@ HDF5 History
This file contains development history of the HDF5 1.10 branch
+06. Release Information for hdf5-1.10.4
05. Release Information for hdf5-1.10.3
04. Release Information for hdf5-1.10.2
03. Release Information for hdf5-1.10.1
@@ -11,6 +12,372 @@ This file contains development history of the HDF5 1.10 branch
[Search on the string '%%%%' for section breaks of each release.]
+%%%%1.10.4%%%%
+
+HDF5 version 1.10.4 released on 2018-10-05
+================================================================================
+
+
+INTRODUCTION
+
+This document describes the differences between this release and the previous
+HDF5 release. It contains information on the platforms tested and known
+problems in this release. For more details check the HISTORY*.txt files in the
+HDF5 source.
+
+Note that documentation in the links below will be updated at the time of each
+final release.
+
+Links to HDF5 documentation can be found on The HDF5 web page:
+
+ https://portal.hdfgroup.org/display/HDF5/HDF5
+
+The official HDF5 releases can be obtained from:
+
+ https://www.hdfgroup.org/downloads/hdf5/
+
+Changes from Release to Release and New Features in the HDF5-1.10.x release series
+can be found at:
+
+ https://portal.hdfgroup.org/display/HDF5/HDF5+Application+Developer%27s+Guide
+
+If you have any questions or comments, please send them to the HDF Help Desk:
+
+ help@hdfgroup.org
+
+
+CONTENTS
+
+- Bug Fixes since HDF5-1.10.3
+- Supported Platforms
+- Tested Configuration Features Summary
+- More Tested Platforms
+- Known Problems
+- CMake vs. Autotools installations
+
+
+New Features
+============
+
+ Configuration:
+ -------------
+ - Add toolchain and cross-compile support
+
+ Added info on using a toolchain file to INSTALL_CMAKE.txt. A
+ toolchain file is also used in cross-compiling, which requires
+ CMAKE_CROSSCOMPILING_EMULATOR to be set. To help with cross-compiling
+ the fortran configure process, the HDF5UseFortran.cmake file macros
+ were improved. Fixed a Fortran configure file issue that incorrectly
+ used #cmakedefine instead of #define.
+
+ (ADB - 2018/10/04, HDFFV-10594)
+
+ - Add warning flags for Intel compilers
+
+ Identified Intel compiler specific warnings flags that should be used
+ instead of GNU flags.
+
+ (ADB - 2018/10/04, TRILABS-21)
+
+ - Add default rpath to targets
+
+ Default rpaths should be set in shared executables and
+ libraries to allow the use of loading dependent libraries
+ without requiring LD_LIBRARY_PATH to be set. The default
+ path should be relative using @rpath on osx and $ORIGIN
+ on linux. Windows is not affected.
+
+ (ADB - 2018/09/26, HDFFV-10594)
+
+ Library:
+ --------
+ - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used.
+
+ Rather than always running H5detect and generating H5Tinit.c and
+ H5make_libsettings.c, supply a location for those files.
+
+ (ADB - 2018/09/18, HDFFV-10332)
+
+
+Bug Fixes since HDF5-1.10.3 release
+==================================
+
+ Library
+ -------
+ - Allow H5detect and H5make_libsettings to take a file as an argument.
+
+ Rather than only writing to stdout, add a command argument to name
+ the file that H5detect and H5make_libsettings will use for output.
+ Without an argument, stdout is still used, so backwards compatibility
+ is maintained.
+
+ (ADB - 2018/09/05, HDFFV-9059)
+
+ - A bug was discovered in the parallel library where an application
+ would hang if a collective read/write of a chunked dataset occurred
+ when collective metadata reads were enabled and some of the ranks
+ had no selection in the dataset's dataspace. The ranks which had no
+ selection in the dataset's dataspace called H5D__chunk_addrmap() to
+ retrieve the lowest chunk address in the dataset. This is because we
+ require reads/writes to be performed in strictly non-decreasing order
+ of chunk address in the file.
+
+ When the chunk index used was a version 1 or 2 B-tree, these
+ non-participating ranks would issue a collective MPI_Bcast() call
+ that the participating ranks would not issue, causing the hang. Since
+ the non-participating ranks are not actually reading/writing anything,
+ the H5D__chunk_addrmap() call can be safely removed and the address used
+ for the read/write can be set to an arbitrary number (0 was chosen).
+
+ (JTH - 2018/08/25, HDFFV-10501)
+
+ Java Library:
+ ----------------
+ - JNI native library dependencies
+
+ The build for the hdf5_java native library used the wrong
+ hdf5 target library for CMake builds. Correcting the hdf5_java
+ library to build with the shared hdf5 library required testing
+ paths to change also.
+
+ (ADB - 2018/08/31, HDFFV-10568)
+
+ - Java iterator callbacks
+
+ Change global callback object to a small stack structure in order
+ to fix a runtime crash. This crash was discovered when iterating
+ through a file with nested group members. The global variable
+ visit_callback is overwritten when recursion starts. When recursion
+ completes, visit_callback will be pointing to the wrong callback method.
+
+ (ADB - 2018/08/15, HDFFV-10536)
+
+ - Java HDFLibraryException class
+
+ Change parent class from Exception to RuntimeException.
+
+ (ADB - 2018/07/30, HDFFV-10534)
+
+ - JNI Read and Write
+
+ Refactored variable-length functions, H5DreadVL and H5AreadVL,
+ to correct dataset and attribute reads. New write functions,
+ H5DwriteVL and H5AwriteVL, are under construction.
+
+ (ADB - 2018/06/02, HDFFV-10519)
+
+
+Supported Platforms
+===================
+
+ Linux 2.6.32-696.16.1.el6.ppc64 gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
+ #1 SMP ppc64 GNU/Linux g++ (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
+ (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
+ IBM XL C/C++ V13.1
+ IBM XL Fortran V15.1
+
+ Linux 3.10.0-327.10.1.el7 GNU C (gcc), Fortran (gfortran), C++ (g++)
+ #1 SMP x86_64 GNU/Linux compilers:
+ (kituo/moohan) Version 4.8.5 20150623 (Red Hat 4.8.5-4)
+ Version 4.9.3, Version 5.2.0
+ Intel(R) C (icc), C++ (icpc), Fortran (icc)
+ compilers:
+ Version 17.0.0.098 Build 20160721
+ MPICH 3.1.4 compiled with GCC 4.9.3
+
+ SunOS 5.11 32- and 64-bit Sun C 5.12 SunOS_sparc
+ (emu) Sun Fortran 95 8.6 SunOS_sparc
+ Sun C++ 5.12 SunOS_sparc
+
+ 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)
+ Visual Studio 2015 w/ Intel Fortran 16 (cmake)
+ Visual Studio 2015 w/ Intel C, Fortran 2017 (cmake)
+ Visual Studio 2015 w/ MSMPI 8 (cmake)
+
+ Windows 10 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
+
+ Windows 10 x64 Visual Studio 2015 w/ Intel Fortran 18 (cmake)
+ Visual Studio 2017 w/ Intel Fortran 18 (cmake)
+
+ Mac OS X Yosemite 10.10.5 Apple clang/clang++ version 6.1 from Xcode 7.0
+ 64-bit gfortran GNU Fortran (GCC) 4.9.2
+ (osx1010dev/osx1010test) Intel icc/icpc/ifort version 15.0.3
+
+ Mac OS X El Capitan 10.11.6 Apple clang/clang++ version 7.3.0 from Xcode 7.3
+ 64-bit gfortran GNU Fortran (GCC) 5.2.0
+ (osx1011dev/osx1011test) Intel icc/icpc/ifort version 16.0.2
+
+ Mac OS Sierra 10.12.6 Apple LLVM version 8.1.0 (clang/clang++-802.0.42)
+ 64-bit gfortran GNU Fortran (GCC) 7.1.0
+ (kite) Intel icc/icpc/ifort version 17.0.2
+
+
+Tested Configuration Features Summary
+=====================================
+
+ In the tables below
+ y = tested
+ n = not tested in this release
+ C = Cluster
+ W = Workstation
+ x = not working in this release
+ dna = does not apply
+ ( ) = footnote appears below second table
+ <blank> = testing incomplete on this feature or platform
+
+Platform C F90/ F90 C++ zlib SZIP
+ parallel F2003 parallel
+Solaris2.11 32-bit n y/y n y y y
+Solaris2.11 64-bit n y/n n y y y
+Windows 7 y y/y n y y y
+Windows 7 x64 y y/y y y y y
+Windows 7 Cygwin n y/n n y y y
+Windows 7 x64 Cygwin n y/n n y y y
+Windows 10 y y/y n y y y
+Windows 10 x64 y y/y n y y y
+Mac OS X Mavericks 10.9.5 64-bit n y/y n y y y
+Mac OS X Yosemite 10.10.5 64-bit n y/y n y y y
+Mac OS X El Capitan 10.11.6 64-bit n y/y n y y y
+Mac OS Sierra 10.12.6 64-bit n y/y n y y y
+CentOS 7.2 Linux 3.10.0 x86_64 PGI n y/y n y y y
+CentOS 7.2 Linux 3.10.0 x86_64 GNU y y/y y y y y
+CentOS 7.2 Linux 3.10.0 x86_64 Intel n y/y n y y y
+Linux 2.6.32-573.18.1.el6.ppc64 n y/y n y y y
+
+
+Platform Shared Shared Shared Thread-
+ C libs F90 libs C++ libs safe
+Solaris2.11 32-bit y y y y
+Solaris2.11 64-bit y y y y
+Windows 7 y y y y
+Windows 7 x64 y y y y
+Windows 7 Cygwin n n n y
+Windows 7 x64 Cygwin n n n y
+Windows 10 y y y y
+Windows 10 x64 y y y y
+Mac OS X Mavericks 10.9.5 64-bit y n y y
+Mac OS X Yosemite 10.10.5 64-bit y n y y
+Mac OS X El Capitan 10.11.6 64-bit y n y y
+Mac OS Sierra 10.12.6 64-bit y n y y
+CentOS 7.2 Linux 3.10.0 x86_64 PGI y y y n
+CentOS 7.2 Linux 3.10.0 x86_64 GNU y y y y
+CentOS 7.2 Linux 3.10.0 x86_64 Intel y y y n
+Linux 2.6.32-573.18.1.el6.ppc64 y y y n
+
+Compiler versions for each platform are listed in the preceding
+"Supported Platforms" table.
+
+
+More Tested Platforms
+=====================
+The following platforms are not supported but have been tested for this release.
+
+ Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++)
+ #1 SMP x86_64 GNU/Linux compilers:
+ (mayll/platypus) Version 4.4.7 20120313
+ Version 4.9.3, 5.3.0, 6.2.0
+ PGI C, Fortran, C++ for 64-bit target on
+ x86-64;
+ Version 17.10-0
+ Intel(R) C (icc), C++ (icpc), Fortran (icc)
+ compilers:
+ Version 17.0.4.196 Build 20170411
+ MPICH 3.1.4 compiled with GCC 4.9.3
+
+ Linux 3.10.0-327.18.2.el7 GNU C (gcc) and C++ (g++) compilers
+ #1 SMP x86_64 GNU/Linux Version 4.8.5 20150623 (Red Hat 4.8.5-4)
+ (jelly) with NAG Fortran Compiler Release 6.1(Tozai)
+ GCC Version 7.1.0
+ OpenMPI 3.0.0-GCC-7.2.0-2.29,
+ 3.1.0-GCC-7.2.0-2.29
+ Intel(R) C (icc) and C++ (icpc) compilers
+ Version 17.0.0.098 Build 20160721
+ with NAG Fortran Compiler Release 6.1(Tozai)
+
+ Linux 3.10.0-327.10.1.el7 MPICH 3.2 compiled with GCC 5.3.0
+ #1 SMP x86_64 GNU/Linux
+ (moohan)
+
+ Linux 2.6.32-573.18.1.el6.ppc64 MPICH mpich 3.1.4 compiled with
+ #1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1
+ (ostrich) and IBM XL Fortran for Linux, V15.1
+
+ Debian 8.4 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1 x86_64 GNU/Linux
+ gcc, g++ (Debian 4.9.2-10) 4.9.2
+ GNU Fortran (Debian 4.9.2-10) 4.9.2
+ (cmake and autotools)
+
+ Fedora 24 4.7.2-201.fc24.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+ gcc, g++ (GCC) 6.1.1 20160621
+ (Red Hat 6.1.1-3)
+ GNU Fortran (GCC) 6.1.1 20160621
+ (Red Hat 6.1.1-3)
+ (cmake and autotools)
+
+ Ubuntu 16.04.1 4.4.0-38-generic #57-Ubuntu SMP x86_64 GNU/Linux
+ gcc, g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2)
+ 5.4.0 20160609
+ GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.2)
+ 5.4.0 20160609
+ (cmake and autotools)
+
+
+Known Problems
+==============
+
+ At present, metadata cache images may not be generated by parallel
+ applications. Parallel applications can read files with metadata cache
+ images, but since this is a collective operation, a deadlock is possible
+ if one or more processes do not participate.
+
+ Three tests fail with OpenMPI 3.0.0/GCC-7.2.0-2.29:
+ testphdf5 (ecdsetw, selnone, cchunk1, cchunk3, cchunk4, and actualio)
+ t_shapesame (sscontig2)
+ t_pflush1/fails on exit
+ The first two tests fail attempting collective writes.
+
+ Known problems in previous releases can be found in the HISTORY*.txt files
+ in the HDF5 source. Please report any new problems found to
+ help@hdfgroup.org.
+
+
+CMake vs. Autotools installations
+=================================
+While both build systems produce similar results, there are differences.
+Each system produces the same set of folders on linux (only CMake works
+on standard Windows); bin, include, lib and share. Autotools places the
+COPYING and RELEASE.txt file in the root folder, CMake places them in
+the share folder.
+
+The bin folder contains the tools and the build scripts. Additionally, CMake
+creates dynamic versions of the tools with the suffix "-shared". Autotools
+installs one set of tools depending on the "--enable-shared" configuration
+option.
+ build scripts
+ -------------
+ Autotools: h5c++, h5cc, h5fc
+ CMake: h5c++, h5cc, h5hlc++, h5hlcc
+
+The include folder holds the header files and the fortran mod files. CMake
+places the fortran mod files into separate shared and static subfolders,
+while Autotools places one set of mod files into the include folder. Because
+CMake produces a tools library, the header files for tools will appear in
+the include folder.
+
+The lib folder contains the library files, and CMake adds the pkgconfig
+subfolder with the hdf5*.pc files used by the bin/build scripts created by
+the CMake build. CMake separates the C interface code from the fortran code by
+creating C-stub libraries for each Fortran library. In addition, only CMake
+installs the tools library. The names of the szip libraries are different
+between the build systems.
+
+The share folder will have the most differences because CMake builds include
+a number of CMake specific files for support of CMake's find_package and support
+for the HDF5 Examples CMake project.
+
%%%%1.10.3%%%%
HDF5 version 1.10.3 released on 2018-08-21
diff --git a/release_docs/INSTALL b/release_docs/INSTALL
index 5c54698..5c54698 100755..100644
--- a/release_docs/INSTALL
+++ b/release_docs/INSTALL
diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt
index edd876a..5d76b58 100644
--- a/release_docs/INSTALL_CMake.txt
+++ b/release_docs/INSTALL_CMake.txt
@@ -635,13 +635,13 @@ HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver"
HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON
HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON
HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF
+HDF5_ENABLE_PREADWRITE "Use pread/pwrite in sec2/log/core VFDs in place of read/write (when available)" ON
HDF5_ENABLE_TRACE "Enable API tracing capability" OFF
HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF
HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON
HDF5_BUILD_GENERATORS "Build Test Generators" OFF
HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF
HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF
-HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF
HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF
HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF
HDF5_PACK_MACOSX_FRAMEWORK "Package the HDF5 Library in a Frameworks" OFF
diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt
index 74f494c..74f494c 100755..100644
--- a/release_docs/INSTALL_Cygwin.txt
+++ b/release_docs/INSTALL_Cygwin.txt
diff --git a/release_docs/INSTALL_parallel b/release_docs/INSTALL_parallel
index f32fffc..d3d7830 100755..100644
--- a/release_docs/INSTALL_parallel
+++ b/release_docs/INSTALL_parallel
@@ -102,7 +102,7 @@ qsub -I -q debug -l mppwidth=8
- configure HDF5:
RUNSERIAL="aprun -q -n 1" RUNPARALLEL="aprun -q -n 6" FC=ftn CC=cc /path/to/source/configure --enable-fortran --enable-parallel --disable-shared
- RUNSERIAL and RUNPARALLEL tells the library how it should launch programs that are part of the build procedure.
+ RUNSERIAL and RUNPARALLEL tell the library how it should launch programs that are part of the build procedure.
- Compile HDF5:
gmake
@@ -155,12 +155,16 @@ to run a parallel application on one processor and on many processors. If the
compiler is `mpicc' and the user hasn't specified values for RUNSERIAL and
RUNPARALLEL then configure chooses `mpiexec' from the same directory as `mpicc':
- RUNSERIAL: /usr/local/mpi/bin/mpiexec -np 1
- RUNPARALLEL: /usr/local/mpi/bin/mpiexec -np $${NPROCS:=6}
+ RUNSERIAL: mpiexec -n 1
+ RUNPARALLEL: mpiexec -n $${NPROCS:=6}
The `$${NPROCS:=6}' will be substituted with the value of the NPROCS
environment variable at the time `make check' is run (or the value 6).
+Note that some MPI implementations (e.g. OpenMPI 4.0) disallow oversubscribing
+nodes by default so you'll have to either set NPROCS equal to the number of
+processors available (or fewer) or redefine RUNPARALLEL with appropriate
+flag(s) (--oversubscribe in OpenMPI).
4. Parallel test suite
----------------------
diff --git a/release_docs/README_HDF5_CMake b/release_docs/README_HDF5_CMake
new file mode 100644
index 0000000..484710d
--- /dev/null
+++ b/release_docs/README_HDF5_CMake
@@ -0,0 +1,23 @@
+This tar file contains
+
+ build-unix.sh script to build HDF5 with CMake on unix machines
+ build-unix-hpc.sh script to build HDF5 with CMake on unix machines and run
+ tests with batch scripts (sbatch).
+ CTestScript.cmake
+ HDF5config.cmake CMake scripts for building HDF5
+ HDF5options.cmake
+ hdf5-1.10.5-pre1 HDF5 1.10.5-pre1 source
+ SZip.tar.gz source for building SZIP
+ ZLib.tar.gz source for building ZLIB
+
+For more information about building HDF5 with CMake, see USING_HDF5_CMake.txt in
+hdf5-1.10.5-pre1/release_docs, or
+https://portal.hdfgroup.org/display/support/Building+HDF5+with+CMake.
+
+For more information about building HDF5 with CMake on HPC machines, including
+cross compiling on Cray XC40, see README_HPC in hdf5-1.10.5-pre1/release_docs.
+
+
+
+
+
diff --git a/release_docs/README_HPC b/release_docs/README_HPC
new file mode 100644
index 0000000..67a5d6c
--- /dev/null
+++ b/release_docs/README_HPC
@@ -0,0 +1,206 @@
+************************************************************************
+* Using CMake to build and test HDF5 source on HPC machines *
+************************************************************************
+
+ Contents
+
+Section I: Prerequisites
+Section II: Obtain HDF5 source
+Section III: Using ctest command to build and test
+Section IV: Cross compiling
+Section V: Manual alternatives
+Section VI: Other cross compiling options
+
+************************************************************************
+
+========================================================================
+I. Prerequisites
+========================================================================
+ 1. Create a working directory that is accessible from the compute nodes for
+ running tests; the working directory should be in a scratch space or a
+ parallel file system space since testing will use this space. Building
+ from HDF5 source in a 'home' directory typically results in test
+ failures and should be avoided.
+
+ 2. Load modules for desired compilers, module for cmake version 3.10 or greater,
+ and set any needed environment variables for compilers (i.e., CC, FC, CXX).
+ Unload any problematic modules (i.e., craype-hugepages2M).
+
+========================================================================
+II. Obtain HDF5 source
+========================================================================
+Obtain HDF5 source code from the HDF5 repository using a git command or
+from a release tar file in a working directory:
+
+ git clone https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5.git
+ [-b branch] [source directory]
+
+If no branch is specified, then the 'develop' version will be checked out.
+If no source directory is specified, then the source will be located in the
+'hdf5' directory. The Cmake scripts expect the source to be in a directory
+named hdf5-<version string>, where 'version string' uses the format '1.xx.xx'.
+For example, for the current 'develop' version, the "hdf5" directory should
+be renamed "hdf5-1.11.4", or for the first hdf5_1_10_5 pre-release version,
+it should be renamed "hdf5-1.10.5-pre1".
+
+If the version number is not known a priori, the version string
+can be obtained by running bin/h5vers in the top level directory of the source clone, and
+the source directory renamed 'hdf5-<version string>'.
+
+Release or snapshot tar files may also be extracted and used.
+
+========================================================================
+III. Using ctest command to build and test
+========================================================================
+
+The ctest command [1]:
+
+ ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf5.log
+
+will configure, build, test and package HDF5 from the downloaded source
+after the setup steps outlined below are followed.
+
+CMake option variables are available to allow running test programs in batch
+scripts on compute nodes and to cross-compile for compute node hardware using
+a cross-compiling emulator. The setup steps will make default settings for
+parallel or serial only builds available to the CMake command.
+
+ 1. For the current 'develop' version the "hdf5" directory should be renamed
+ "hdf5-1.11.4".
+
+ 2. Three cmake script files need to be copied to the working directory, or
+ have symbolic links to them, created in the working directory:
+
+ hdf5-1.11.4/config/cmake/scripts/HDF5config.cmake
+ hdf5-1.11.4/config/cmake/scripts/CTestScript.cmake
+ hdf5-1.11.4/config/cmake/scripts/HDF5options.cmake
+
+ should be copied to the working directory.
+
+ 3. The resulting contents of the working directory are then:
+
+ CTestScript.cmake
+ HDF5config.cmake
+ HDF5options.cmake
+ hdf5-1.11.4
+
+ Additionally, when the ctest command runs [1], it will add a build directory
+ in the working directory.
+
+ 4. The following options (among others) can be added to the ctest
+ command [1], following '-S HDF5config.cmake,' and separated by ',':
+
+ HPC=sbatch (or 'bsub' or 'raybsub') indicates which type of batch
+ files to use for running tests. If omitted, test
+ will run on the local machine or login node.
+
+ KNL=true to cross-compile for KNL compute nodes on CrayXC40
+ (see section IV)
+
+ MPI=true enables parallel, disables c++, java, and threadsafe
+
+ LOCAL_BATCH_SCRIPT_ARGS="--account=<account#>" to supply user account
+ information for batch jobs
+
+ The HPC options will add BUILD_GENERATOR=Unix for the three HPC options.
+ An example ctest command for a parallel build on a system using sbatch is
+
+ ctest -S HDF5config.cmake,HPC=sbatch,MPI=true -C Release -V -O hdf5.log
+
+ Adding the option 'KNL=true' to the above list will compile for KNL nodes,
+ for example, on 'mutrino' and other CrayXC40 machines.
+
+ Changing -V to -VV will produce more logging information in HDF5.log.
+
+ More detailed CMake information can be found in the HDF5 source in
+ release_docs/INSTALL_CMake.txt.
+
+========================================================================
+IV. Cross-compiling
+========================================================================
+For cross-compiling on Cray, set environment variables CC=cc, FC=ftn
+and CXX=CC (for c++) after all compiler modules are loaded since switching
+compiler modules may unset or reset these variables.
+
+CMake provides options for cross-compiling. To cross-compile for KNL hardware
+on mutrino and other CrayXC40 machines, add HPC=sbatch,KNL=true to the
+ctest command line. This will set the following options from the
+config/cmake/scripts/HPC/sbatch-HDF5options.cmake file:
+
+ set (COMPILENODE_HWCOMPILE_MODULE "craype-haswell")
+ set (COMPUTENODE_HWCOMPILE_MODULE "craype-mic-knl")
+ set (LOCAL_BATCH_SCRIPT_NAME "knl_ctestS.sl")
+ set (LOCAL_BATCH_SCRIPT_PARALLEL_NAME "knl_ctestP.sl")
+ set (ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake")
+
+On the Cray XC40 the craype-haswell module is needed for configuring, and the
+craype-mic-knl module is needed for building to run on the KNL nodes. CMake
+with the above options will swap modules after configuring is complete,
+but before compiling programs for KNL.
+
+The sbatch script arguments for running jobs on KNL nodes may differ on CrayXC40
+machines other than mutrino. The batch scripts knl_ctestS.sl and knl_ctestP.sl
+have the correct arguments for mutrino: "#SBATCH -p knl -C quad,cache". For
+cori, another CrayXC40, that line is replaced by "#SBATCH -C knl,quad,cache".
+For cori (and other machines), the values in LOCAL_BATCH_SCRIPT_NAME and
+LOCAL_BATCH_SCRIPT_PARALLEL_NAME in the config/cmake/scripts/HPC/sbatch-HDF5options.cmake
+file can be replaced by cori_knl_ctestS.sl and cori_knl_ctestS.sl, or the lines
+can be edited in the batch files in hdf5-1.11.4/bin/batch.
+
+========================================================================
+V. Manual alternatives
+========================================================================
+If using ctest is undesirable, one can create a build directory and run the cmake
+configure command, for example
+
+"/projects/Mutrino/hpcsoft/cle6.0/common/cmake/3.10.2/bin/cmake"
+-C "<working directory>/hdf5-1.11.4/config/cmake/cacheinit.cmake"
+-DCMAKE_BUILD_TYPE:STRING=Release -DHDF5_BUILD_FORTRAN:BOOL=ON
+-DHDF5_BUILD_JAVA:BOOL=OFF
+-DCMAKE_INSTALL_PREFIX:PATH=<working directory>/HDF_Group/HDF5/1.11.4
+-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF
+-DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF
+-DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_ENABLE_THREADSAFE:BOOL=OFF
+-DHDF5_PACKAGE_EXTLIBS:BOOL=ON -DLOCAL_BATCH_TEST:BOOL=ON
+-DMPIEXEC_EXECUTABLE:STRING=srun -DMPIEXEC_NUMPROC_FLAG:STRING=-n
+-DMPIEXEC_MAX_NUMPROCS:STRING=6
+-DCMAKE_TOOLCHAIN_FILE:STRING=config/toolchain/crayle.cmake
+-DLOCAL_BATCH_SCRIPT_NAME:STRING=knl_ctestS.sl
+-DLOCAL_BATCH_SCRIPT_PARALLEL_NAME:STRING=knl_ctestP.sl -DSITE:STRING=mutrino
+-DBUILDNAME:STRING=par-knl_GCC493-SHARED-Linux-4.4.156-94.61.1.16335.0.PTF.1107299-default-x86_64
+"-GUnix Makefiles" "" "<working directory>/hdf5-1.11.4"
+
+followed by make and batch jobs to run tests.
+
+To cross-compile on CrayXC40, run the configure command with the craype-haswell
+module loaded, then switch to the craype-mic-knl module for the build process.
+
+Tests on machines using slurm can be run with
+
+"sbatch -p knl -C quad,cache ctestS.sl"
+
+or
+
+"sbatch -p knl -C quad,cache ctestP.sl"
+
+for parallel builds.
+
+Tests on machines using LSF will typically use "bsub ctestS.lsf", etc.
+
+========================================================================
+VI. Other cross compiling options
+========================================================================
+Settings for two other cross-compiling options are also in the config/toolchain
+files which do not seem to be necessary with the Cray PrgEnv-* modules
+
+1. HDF5_USE_PREGEN. This option, along with the HDF5_USE_PREGEN_DIR CMake
+ variable would allow the use of an appropriate H5Tinit.c file with type
+ information generated on a compute node to be used when cross compiling
+ for those compute nodes. The use of the variables in lines 110 and 111
+ of HDF5options.cmake file seem to preclude needing this option with the
+ available Cray modules and CMake option.
+
+2. HDF5_BATCH_H5DETECT and associated CMake variables. This option when
+ properly configured will run H5detect in a batch job on a compute node
+ at the beginning of the CMake build process. It was also found to be
+ unnecessary with the available Cray modules and CMake options.
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 7def78e..2192811 100755..100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -1,4 +1,4 @@
-HDF5 version 1.10.4 released on 2018-10-05
+HDF5 version 1.10.5 released on 2019-02-25
================================================================================
@@ -32,7 +32,9 @@ If you have any questions or comments, please send them to the HDF Help Desk:
CONTENTS
-- Bug Fixes since HDF5-1.10.3
+- New Features
+- Support for new platforms and languages
+- Bug Fixes since HDF5-1.10.4
- Supported Platforms
- Tested Configuration Features Summary
- More Tested Platforms
@@ -45,110 +47,441 @@ New Features
Configuration:
-------------
- - Add toolchain and cross-compile support
+ - Cross compile on mutrino and other Cray XC40 systems.
- Added info on using a toolchain file to INSTALL_CMAKE.txt. A
- toolchain file is also used in cross-compiling, which requires
- CMAKE_CROSSCOMPILING_EMULATOR to be set. To help with cross-compiling
- the fortran configure process, the HDF5UseFortran.cmake file macros
- were improved. Fixed a Fortran configure file issue that incorrectly
- used #cmakedefine instead of #define.
+ Added support for CMake options to use CrayLinuxEnvironment, craype-mic-knl
+ module for building with craype-haswell module for configuration, and
+ batch scripts in bin/batch for use with sbatch or bsub to run tests in
+ batch jobs on compute nodes. An instruction file README_HPC describing
+ the use of these options was added in release_docs.
- (ADB - 2018/10/04, HDFFV-10594)
+ (LRK - 2019/02/18, TRILABS-34)
- - Add warning flags for Intel compilers
+ - Rework CMake command files to fix MPI testing.
- Identified Intel compiler specific warnings flags that should be used
- instead of GNU flags.
+ Added setup fixture to remove any test generated files and added DEPENDS
+ to test properties to execute tests in order expected.
- (ADB - 2018/10/04, TRILABS-21)
+ (ADB - 2019/02/14, TRILABS-111)
- - Add default rpath to targets
+ - Disable SZIP or ZLIB options if TGZ files are not available.
- Default rpaths should be set in shared executables and
- libraries to allow the use of loading dependent libraries
- without requiring LD_LIBRARY_PATH to be set. The default
- path should be relative using @rpath on osx and $ORIGIN
- on linux. Windows is not affected.
+ Changed the TGZ option for SZip and ZLib to disable the options
+ if the source tar.gz files are not found.
+
+ (ADB - 2019/02/05, HDFFV-10697)
+
+ - Added a new option to enable/disable using pread/pwrite instead of
+ read/write in the sec2, log, and core VFDs.
+
+ This option is enabled by default when pread/pwrite are detected.
+
+ Autotools: --enable-preadwrite
+ CMake: HDF5_ENABLE_PREADWRITE
+
+ (DER - 2019/02/03, HDFFV-10696)
+
+ - Rework CMake versioning for OSX platforms.
+
+ Changed the current_version and compatibility_version flags from optional
+ with HDF5_BUILD_WITH_INSTALL_NAME to always setting the flags for OSX.
+
+ (ADB - 2019/01/22, HDFFV-10685)
+
+ - Rework CMake command files to eliminate developer CMP005 warning
+
+ Use variables without quotes in if () statements.
+
+ (ADB - 2019/01/18, TILABS-105)
+
+ - Rework CMake configure files to eliminate developer CMP0075 warning
+
+ Renamed varname to HDF5_REQUIRED_LIBRARIES as the contents were not
+ required for configuration. Also moved check includes calls to top of
+ files.
+
+ (ADB - 2019/01/03, HDFFV-10546)
+
+ - Keep stderr and stdout separate in tests
+
+ Changed test handling of output capture. Tests now keep the stderr
+ output separate from the stdout output. It is up to the test to decide
+ which output to check against a reference. Also added the option
+ to grep for a string in either output.
+
+ (ADB - 2018/12/12, HDFFV-10632)
+
+ - Incorrectly installed private header files were removed from
+ CMake installs.
+
+ The CMake build files incorrectly flagged the following header files
+ as public and installed them. They are private and will no longer be
+ installed.
+
+ HDF5 library private package files (H5Xpkg.h)
+ H5Edefin.h
+ H5Einit.h
+ H5Eterm.h
+ H5LTparse.h
+ h5diff.h
+ h5tools_dump.h
+ h5tools.h
+ h5tools_ref.h
+ h5tools_str.h
+ h5tools_utils.h
+ h5trav.h
+
+ (DER - 2018/10/26, HDFFV-10614, 10609)
+
+ - Autotools installs now install H5FDwindows.h
+
+ This is simply to align the installed header files between the
+ autotools and CMake. H5FDwindows.h has no functionality on
+ non-Windows systems.
+
+ (DER - 2018/10/26, HDFFV-10614)
- (ADB - 2018/09/26, HDFFV-10594)
Library:
--------
- - Allow pre-generated H5Tinit.c and H5make_libsettings.c to be used.
+ - The sec2, log, and core VFDs can now use pread/pwrite instead of
+ read/write.
+
+ pread and pwrite do not change the file offset, a feature that was
+ requested by a user working with a multi-threaded application.
+
+ The option to configure this feature is described above.
+
+ (DER - 2019/02/03, HDFFV-10696)
+
+ - Add ability to minimze dataset object headers.
+
+ Creation of many, very small datasets resulted in extensive file bloat
+ due to extra space in the dataset object headers -- this space is
+ allocated by default to allow for the insertion of a small number of
+ attributes within the object header and not require a continuation
+ block, an unnecessary provision in the target use case.
+
+ Inform the library to expect no attributes on created datasets, and to
+ allocate the least space possible for the object headers.
+ NOTE: A continuation block is created if attributes are added to a
+ 'minimized' dataset, which can reduce performance.
+ NOTE: Some extra space is allocated for attributes essential to the
+ correct behavior of the object header (store creation times, e.g.). This
+ does not violate the design principle, as the space is calculated and
+ allocated as needed at the time of dataset object header creation --
+ unused space is not generated.
+ New API calls:
+ H5Fget_dset_no_attrs_hint
+ H5Fset_dset_no_attrs_hint
+ H5Pget_dset_no_attrs_hint
+ H5Pset_dset_no_attrs_hint
+
+ (JOS - 2019/01/04, TRILAB-45)
+
+ - Added new chunk query functions
+
+ The following public functions were added to discover information about
+ the chunks in an HDF5 file.
+ herr_t H5Dget_num_chunks(dset_id, fspace_id, *nchunks)
+ herr_t H5Dget_chunk_info_by_coord(dset_id, *coord, *filter_mask, *addr, *size)
+ herr_t H5Dget_chunk_info(dset_id, fspace_id, index, *coord, *filter_mask, *addr, *size)
+
+ (BMR - 2018/11/07, HDFFV-10615)
+
+ - Several empty public header files where removed from the distribution
+
+ The following files were empty placeholders. They are for internal
+ packages that are unlikely to ever have public functionality and have
+ thus been removed.
+
+ H5Bpublic.h
+ H5B2public.h
+ H5FSpublic.h
+ H5HFpublic.h
+ H5HGpublic.h
+ H5HLpublic.h
+
+ They were only installed in CMake builds.
+
+ (DER - 2018/10/26, HDFFV-10614)
+
+
+ Parallel Library:
+ -----------------
+ - Changed the default behavior in parallel when reading the same dataset in its entirety
+ (i.e. H5S_ALL dataset selection) which is being read by all the processes collectively.
+ The dataset must be contiguous, less than 2GB, and of an atomic datatype.
+ The new behavior is the HDF5 library will use an MPI_Bcast to pass the data read from
+ the disk by the root process to the remain processes in the MPI communicator associated
+ with the HDF5 file.
+
+ (MSB - 2019/01/02, HDFFV-10652)
+
+ - All MPI-1 API calls have been replaced with MPI-2 equivalents.
+
+ This was done to better support OpenMPI, as default builds no longer
+ include MPI-1 support (as of OpenMPI 4.0).
+
+ (DER - 2018/12/30, HDFFV-10566)
+
+ Fortran Library:
+ ----------------
+ - Added wrappers for dataset object header minimization calls.
+ (see the note for TRILAB-45, above)
+
+ New API calls:
+
+ h5fget_dset_no_attrs_hint_f
+ h5fset_dset_no_attrs_hint_f
+ h5pget_dset_no_attrs_hint_f
+ h5pset_dset_no_attrs_hint_f
+
+ (DER - 2019/01/09, TRILAB-45)
+
+ - Added new Fortran derived type, c_h5o_info_t, which is interoperable with
+ C's h5o_info_t. This is needed for callback functions which
+ pass C's h5o_info_t data type definition.
+
+ (MSB, 2019/01/08, HDFFV-10443)
+
+ - Added new Fortran API, H5gmtime, which converts (C) 'time_t' structure
+ to Fortran DATE AND TIME storage format.
+
+ (MSB, 2019/01/08, HDFFV-10443)
+
+ - Added new Fortran 'fields' optional parameter to: h5ovisit_f, h5oget_info_by_name_f,
+ h5oget_info, h5oget_info_by_idx and h5ovisit_by_name_f.
+
+ (MSB, 2019/01/08, HDFFV-10443)
+
+ C++ Library:
+ ------------
+ - Added new function to the C++ interface
+
+ Added wrapper for H5Ovisit2:
+ H5Object::visit()
+
+ (BMR - 2019/02/14, HDFFV-10532)
+
+
+ Java Library:
+ ----------------
+ - Rewrote the JNI error handling to be much cleaner
- Rather than always running H5detect and generating H5Tinit.c and
- H5make_libsettings.c, supply a location for those files.
+ (JTH - 2019/02/12)
- (ADB - 2018/09/18, HDFFV-10332)
+ - Add new functions to java interface
+ Added wrappers for:
+ H5Fset_libver_bounds
+ H5Fget_dset_no_attrs_hint/H5Fset_dset_no_attrs_hint
+ H5Pget_dset_no_attrs_hint/H5Pset_dset_no_attrs_hint
-Bug Fixes since HDF5-1.10.3 release
+ (ADB - 2019/01/07, HDFFV-10664)
+
+ - Fix java unit tests when Time is a natural number
+
+ Time substitution in java/test/junit.sh.in doesn't
+ handle the case when Time is a natural number. Fixed
+ the regular expression.
+
+ (ADB - 2019/01/07, HDFFV-10674)
+
+ - Duplicate the data read/write functions of Datasets for Attributes.
+
+ Region references could not be displayed for attributes as they could
+ for datasets. Datasets had overloaded read and write functions for different
+ datatypes that were not available for attributes. After adding similar
+ functions, attribute region references work normally.
+
+ (ADB - 2018/12/12, HDFVIEW-4)
+
+
+ Tools:
+ ------
+ - The h5repart -family-to-sec2 argument was changed to -family-to-single
+
+ In order to better support other single-file VFDs which could work with
+ h5repart, the -family-to-sec2 argument was renamed to -family-to-single.
+ This is just a name change and the functionality of the argument has not
+ changed.
+
+ The -family-to-sec2 argument has been kept for backwards-compatibility.
+ This argument should be considered deprecated.
+
+ (DER - 2018/11/14, HDFFV-10633)
+
+
+Bug Fixes since HDF5-1.10.4 release
==================================
Library
-------
- - Allow H5detect and H5make_libsettings to take a file as an argument.
+ - Fix hangs with collective metadata reads during chunked dataset I/O
+
+ In the parallel library, it was discovered that when a particular
+ sequence of operations following a pattern of:
+
+ "write to chunked dataset" -> "flush file" -> "read from dataset"
+
+ occurred with collective metadata reads enabled, hangs could be
+ observed due to certain MPI ranks not participating in the collective
+ metadata reads.
+
+ To fix the issue, collective metadata reads are now disabled during
+ chunked dataset raw data I/O.
+
+ (JTH - 2019/02/11, HDFFV-10563, HDFFV-10688)
+
+ - Performance issue when closing an object
+
+ The slow down is due to the search of the "tag_list" to find
+ out the "corked" status of an object and "uncork" it if so.
+
+ Improve performance by skipping the search of the "tag_list"
+ if there are no "corked" objects when closing an object.
+
+ (VC - 2019/02/06)
+
+ - Uninitialized bytes from a type conversion buffer could be written
+ to disk in H5Dwrite calls where type conversion takes place
+ and the type conversion buffer was created by the HDF5 library.
+
+ When H5Dwrite is called and datatype conversion must be performed,
+ the library will create a temporary buffer for type conversion if
+ one is not provided by the user via H5Pset_buffer. This internal
+ buffer is allocated via malloc and contains uninitialized data. In
+ some datatype conversions (float to long double, possibly others),
+ some of this uninitialized data could be written to disk.
+
+ This was flagged by valgrind in the dtransform test and does not
+ appear to be a common occurrence (it is flagged in one test out
+ of the entire HDF5 test suite).
+
+ Switching to calloc fixed the problem.
+
+ (DER - 2019/02/03, HDFFV-10694)
+
+ - There was missing protection against division by zero reported to
+ The HDF Group as issue #CVE-2018-17434.
+
+ Protection against division by zero was added to address the issue
+ #CVE-2018-17434.
+
+ (BMR - 2019/01/29, HDFFV-10586)
+
+ - The issue CVE-2018-17437 was reported to The HDF Group
- Rather than only writing to stdout, add a command argument to name
- the file that H5detect and H5make_libsettings will use for output.
- Without an argument, stdout is still used, so backwards compatibility
- is maintained.
+ Although CVE-2018-17437 reported a memory leak, the actual issue
+ was invalid read. It was found that the attribute name length
+ in an attribute message was corrupted, which caused the buffer
+ pointer to be advanced too far and later caused an invalid read.
- (ADB - 2018/09/05, HDFFV-9059)
+ A check was added to detect when the attribute name or its length
+ was corrupted and report the potential of data corruption.
+
+ (BMR - 2019/01/29, HDFFV-10588)
+
+ - H5Ewalk did not stop when it was supposed to
+
+ H5Ewalk was supposed to stop when the callback function stopped
+ even though the errors in the stack were not all visited, but it
+ did not. This problem is now fixed.
+
+ (BMR - 2019/01/29, HDFFV-10684)
+
+ - Revert H5Oget_info* and H5Ovisit* functions
+
+ In 1.10.3 new H5Oget_info*2 and H5Ovisit*2 functions were
+ added for performance. Inadvertently, the original functions;
+ H5Oget_info,
+ H5Oget_info_by_name,
+ H5Oget_info_by_idx,
+ H5Ovisit,
+ H5Ovisit_by_name
+ were versioned to H5Oget_info*1 and H5Ovisit*1. This
+ broke the API compatibility for a maintenance release. The
+ original functions have been restored.
+
+ (ADB - 2019/01/24, HDFFV-10686)
+
+ - Fixed a potential invalid memory access and failure that could occur when
+ decoding an unknown object header message (from a future version of the
+ library).
+
+ (NAF - 2019/01/07)
+
+ - Deleting attributes in dense storage
+
+ The library aborts with "infinite loop closing library" after
+ attributes in dense storage are created and then deleted.
+
+ When deleting the attribute nodes from the name index v2 B-tree,
+ if an attribute is found in the intermediate B-tree nodes,
+ which may be merged/redistributed in the process, we need to
+ free the dynamically allocated spaces for the intermediate
+ decoded attribute.
+
+ (VC - 2018/12/26, HDFFV-10659)
+
+ - There was missing protection against division by zero reported to
+ The HDF Group as issue #CVE-2018-17233.
+
+ Protection against division by zero was added to address the issue
+ #CVE-2018-17233. In addition, several similar occurrences in the same
+ file were fixed as well.
+
+ (BMR - 2018/12/23, HDFFV-10577)
+
+ - Fixed an issue where the parallel filters tests would fail
+ if zlib was not available on the system. Until support can
+ be added in the tests for filters beyond gzip/zlib, the tests
+ will be skipped if zlib is not available.
+
+ (JTH - 2018/12/05)
- A bug was discovered in the parallel library where an application
- would hang if a collective read/write of a chunked dataset occurred
- when collective metadata reads were enabled and some of the ranks
- had no selection in the dataset's dataspace. The ranks which had no
- selection in the dataset's dataspace called H5D__chunk_addrmap() to
- retrieve the lowest chunk address in the dataset. This is because we
- require reads/writes to be performed in strictly non-decreasing order
- of chunk address in the file.
-
- When the chunk index used was a version 1 or 2 B-tree, these
- non-participating ranks would issue a collective MPI_Bcast() call
- that the participating ranks would not issue, causing the hang. Since
- the non-participating ranks are not actually reading/writing anything,
- the H5D__chunk_addrmap() call can be safely removed and the address used
- for the read/write can be set to an arbitrary number (0 was chosen).
-
- (JTH - 2018/08/25, HDFFV-10501)
+ would eventually consume all of the available MPI communicators
+ when continually writing to a compressed dataset in parallel. This
+ was due to internal copies of an HDF5 File Access Property List,
+ which each contained a copy of the MPI communicator, not being
+ closed at the end of each write operation. This problem was
+ exacerbated by larger numbers of processors.
+
+ (JTH - 2018/12/05, HDFFV-10629)
- Java Library:
- ----------------
- - JNI native library dependencies
-
- The build for the hdf5_java native library used the wrong
- hdf5 target library for CMake builds. Correcting the hdf5_java
- library to build with the shared hdf5 library required testing
- paths to change also.
- (ADB - 2018/08/31, HDFFV-10568)
+ Fortran
+ --------
+ - Fixed issue with Fortran not returning h5o_info_t field values
+ meta_size%attr%index_size and meta_size%attr%heap_size.
- - Java iterator callbacks
+ (MSB, 2019/01/08, HDFFV-10443)
- Change global callback object to a small stack structure in order
- to fix a runtime crash. This crash was discovered when iterating
- through a file with nested group members. The global variable
- visit_callback is overwritten when recursion starts. When recursion
- completes, visit_callback will be pointing to the wrong callback method.
+ - Added symbolic links libhdf5_hl_fortran.so to libhdf5hl_fortran.so and
+ libhdf5_hl_fortran.a to libhdf5hl_fortran.a in hdf5/lib directory for
+ autotools installs. These were added to match the name of the files
+ installed by cmake and the general pattern of hl lib files. We will
+ change the names of the installed lib files to the matching name in
+ the next major release.
- (ADB - 2018/08/15, HDFFV-10536)
+ (LRK - 2019/01/04, HDFFV-10596)
- - Java HDFLibraryException class
+ - Made Fortran specific subroutines PRIVATE in generic procedures.
- Change parent class from Exception to RuntimeException.
+ Affected generic procedures were functions in H5A, H5D, H5P, H5R and H5T.
- (ADB - 2018/07/30, HDFFV-10534)
+ (MSB, 2018/12/04, HDFFV-10511)
- - JNI Read and Write
- Refactored variable-length functions, H5DreadVL and H5AreadVL,
- to correct dataset and attribute reads. New write functions,
- H5DwriteVL and H5AwriteVL, are under construction.
+ Testing
+ -------
+ - Fixed a test failure in testpar/t_dset.c caused by
+ the test trying to use the parallel filters feature
+ on MPI-2 implementations.
- (ADB - 2018/06/02, HDFFV-10519)
+ (JTH, 2019/2/7)
Supported Platforms
@@ -175,10 +508,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)
@@ -194,9 +526,8 @@ Supported Platforms
64-bit gfortran GNU Fortran (GCC) 5.2.0
(osx1011dev/osx1011test) Intel icc/icpc/ifort version 16.0.2
- Mac OS Sierra 10.12.6 Apple LLVM version 8.1.0 (clang/clang++-802.0.42)
- 64-bit gfortran GNU Fortran (GCC) 7.1.0
- (kite) Intel icc/icpc/ifort version 17.0.2
+ MacOS High Sierra 10.13.6 Apple LLVM version 10.0.0 (clang/clang++-1000.10.44.4)
+ 64-bit gfortran GNU Fortran (GCC) 8.3.0
Tested Configuration Features Summary
@@ -222,10 +553,9 @@ Windows 7 Cygwin n y/n n y y y
Windows 7 x64 Cygwin n y/n n y y y
Windows 10 y y/y n y y y
Windows 10 x64 y y/y n y y y
-Mac OS X Mavericks 10.9.5 64-bit n y/y n y y y
Mac OS X Yosemite 10.10.5 64-bit n y/y n y y y
Mac OS X El Capitan 10.11.6 64-bit n y/y n y y y
-Mac OS Sierra 10.12.6 64-bit n y/y n y y y
+MacOS High Sierra 10.13.6 64-bit n y/y n y y y
CentOS 7.2 Linux 3.10.0 x86_64 PGI n y/y n y y y
CentOS 7.2 Linux 3.10.0 x86_64 GNU y y/y y y y y
CentOS 7.2 Linux 3.10.0 x86_64 Intel n y/y n y y y
@@ -242,10 +572,9 @@ Windows 7 Cygwin n n n y
Windows 7 x64 Cygwin n n n y
Windows 10 y y y y
Windows 10 x64 y y y y
-Mac OS X Mavericks 10.9.5 64-bit y n y y
-Mac OS X Yosemite 10.10.5 64-bit y n y y
-Mac OS X El Capitan 10.11.6 64-bit y n y y
-Mac OS Sierra 10.12.6 64-bit y n y y
+Mac OS X Yosemite 10.10.5 64-bit y y y y
+Mac OS X El Capitan 10.11.6 64-bit y y y y
+MacOS High Sierra 10.13.6 64-bit y y y y
CentOS 7.2 Linux 3.10.0 x86_64 PGI y y y n
CentOS 7.2 Linux 3.10.0 x86_64 GNU y y y y
CentOS 7.2 Linux 3.10.0 x86_64 Intel y y y n
@@ -257,7 +586,7 @@ Compiler versions for each platform are listed in the preceding
More Tested Platforms
=====================
-The following platforms are not supported but have been tested for this release.
+The following configurations are not supported but have been tested for this release.
Linux 2.6.32-573.22.1.el6 GNU C (gcc), Fortran (gfortran), C++ (g++)
#1 SMP x86_64 GNU/Linux compilers:
@@ -275,8 +604,9 @@ The following platforms are not supported but have been tested for this release.
#1 SMP x86_64 GNU/Linux Version 4.8.5 20150623 (Red Hat 4.8.5-4)
(jelly) with NAG Fortran Compiler Release 6.1(Tozai)
GCC Version 7.1.0
- OpenMPI 3.0.0-GCC-7.2.0-2.29,
- 3.1.0-GCC-7.2.0-2.29
+ MPICH 3.2-GCC-4.9.3
+ MPICH 3.2.1-GCC-7.2.0-2.29
+ OpenMPI 2.1.5-GCC-7.2.0-2.29
Intel(R) C (icc) and C++ (icpc) compilers
Version 17.0.0.098 Build 20160721
with NAG Fortran Compiler Release 6.1(Tozai)
@@ -285,29 +615,15 @@ The following platforms are not supported but have been tested for this release.
#1 SMP x86_64 GNU/Linux
(moohan)
- Linux 2.6.32-573.18.1.el6.ppc64 MPICH mpich 3.1.4 compiled with
- #1 SMP ppc64 GNU/Linux IBM XL C/C++ for Linux, V13.1
- (ostrich) and IBM XL Fortran for Linux, V15.1
-
- Debian 8.4 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1 x86_64 GNU/Linux
- gcc, g++ (Debian 4.9.2-10) 4.9.2
- GNU Fortran (Debian 4.9.2-10) 4.9.2
- (cmake and autotools)
-
- Fedora 24 4.7.2-201.fc24.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
- gcc, g++ (GCC) 6.1.1 20160621
- (Red Hat 6.1.1-3)
- GNU Fortran (GCC) 6.1.1 20160621
- (Red Hat 6.1.1-3)
- (cmake and autotools)
-
- Ubuntu 16.04.1 4.4.0-38-generic #57-Ubuntu SMP x86_64 GNU/Linux
- gcc, g++ (Ubuntu 5.4.0-6ubuntu1~16.04.2)
- 5.4.0 20160609
- GNU Fortran (Ubuntu 5.4.0-6ubuntu1~16.04.2)
- 5.4.0 20160609
+ Fedora 29 4.20.10-200.fc29.x86_64 #1 SMP x86_64 x86_64 x86_64 GNU/Linux
+ gcc, g++ (GCC) 8.2.1 20181215
+ (Red Hat 8.2.1-6)
+ GNU Fortran (GCC) 8.2.1 20181215
+ (Red Hat 8.2.1-6)
(cmake and autotools)
+ Windows 7 x64 Visual Studio 2008
+
Known Problems
==============
@@ -323,6 +639,27 @@ Known Problems
t_pflush1/fails on exit
The first two tests fail attempting collective writes.
+ CPP ptable test fails on VS2017 with Intel compiler, JIRA issue: HDFFV-10628.
+ This test will pass with VS2015 with Intel compiler.
+
+ Older MPI libraries such as OpenMPI 2.0.1 and MPICH 2.1.5 were tested
+ while attempting to resolve the Jira issue: HDFFV-10540.
+ The known problems of reading or writing > 2GBs when using MPI-2 was
+ partially resolved with the MPICH library. The proposed support recognizes
+ IO operations > 2GB and if the datatype is not a derived type, the library
+ breaks the IO into chunks which can be input or output with the existing
+ MPI 2 limitations, i.e. size reporting and function API size/count
+ arguments are restricted to be 32 bit integers. For derived types larger
+ than 2GB, MPICH 2.1.5 fails while attempting to read or write data.
+ OpenMPI in contrast, implements MPI-3 APIs even in the older releases
+ and thus does not suffer from the 32 bit size limitation described here.
+ OpenMPI releases prior to v3.1.3 appear to have other datatype issues however,
+ e.g. within a single parallel test (testphdf5) the subtests (cdsetr, eidsetr)
+ report data verfication errors before eventually aborting.
+ The most recent versions of OpenMPI (v3.1.3 or newer) have evidently
+ resolved these isses and parallel HDF5 testing does not currently report
+ errors though occasional hangs have been observed.
+
Known problems in previous releases can be found in the HISTORY*.txt files
in the HDF5 source. Please report any new problems found to
help@hdfgroup.org.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 3370c99..01434ba 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,7 +32,6 @@ set (H5A_SOURCES
)
set (H5A_HDRS
- ${HDF5_SRC_DIR}/H5Apkg.h
${HDF5_SRC_DIR}/H5Apublic.h
)
IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" )
@@ -40,13 +39,11 @@ IDE_GENERATED_PROPERTIES ("H5A" "${H5A_HDRS}" "${H5A_SOURCES}" )
set (H5AC_SOURCES
${HDF5_SRC_DIR}/H5AC.c
${HDF5_SRC_DIR}/H5ACdbg.c
- ${HDF5_SRC_DIR}/H5AClog.c
${HDF5_SRC_DIR}/H5ACmpio.c
${HDF5_SRC_DIR}/H5ACproxy_entry.c
)
set (H5AC_HDRS
- ${HDF5_SRC_DIR}/H5ACpkg.h
${HDF5_SRC_DIR}/H5ACpublic.h
)
IDE_GENERATED_PROPERTIES ("H5AC" "${H5AC_HDRS}" "${H5AC_SOURCES}" )
@@ -57,8 +54,6 @@ set (H5B_SOURCES
${HDF5_SRC_DIR}/H5Bdbg.c
)
set (H5B_HDRS
- ${HDF5_SRC_DIR}/H5Bpkg.h
- ${HDF5_SRC_DIR}/H5Bpublic.h
)
IDE_GENERATED_PROPERTIES ("H5B" "${H5B_HDRS}" "${H5B_SOURCES}" )
@@ -75,8 +70,6 @@ set (H5B2_SOURCES
${HDF5_SRC_DIR}/H5B2test.c
)
set (H5B2_HDRS
- ${HDF5_SRC_DIR}/H5B2pkg.h
- ${HDF5_SRC_DIR}/H5B2public.h
)
IDE_GENERATED_PROPERTIES ("H5B2" "${H5B2_HDRS}" "${H5B2_SOURCES}" )
@@ -87,6 +80,8 @@ set (H5C_SOURCES
${HDF5_SRC_DIR}/H5Cepoch.c
${HDF5_SRC_DIR}/H5Cimage.c
${HDF5_SRC_DIR}/H5Clog.c
+ ${HDF5_SRC_DIR}/H5Clog_json.c
+ ${HDF5_SRC_DIR}/H5Clog_trace.c
${HDF5_SRC_DIR}/H5Cmpio.c
${HDF5_SRC_DIR}/H5Cprefetched.c
${HDF5_SRC_DIR}/H5Cquery.c
@@ -94,7 +89,6 @@ set (H5C_SOURCES
${HDF5_SRC_DIR}/H5Ctest.c
)
set (H5C_HDRS
- ${HDF5_SRC_DIR}/H5Cpkg.h
${HDF5_SRC_DIR}/H5Cpublic.h
)
IDE_GENERATED_PROPERTIES ("H5C" "${H5C_HDRS}" "${H5C_SOURCES}" )
@@ -143,7 +137,6 @@ set (H5D_SOURCES
)
set (H5D_HDRS
- ${HDF5_SRC_DIR}/H5Dpkg.h
${HDF5_SRC_DIR}/H5Dpublic.h
)
IDE_GENERATED_PROPERTIES ("H5D" "${H5D_HDRS}" "${H5D_SOURCES}" )
@@ -155,12 +148,8 @@ set (H5E_SOURCES
)
set (H5E_HDRS
- #${HDF5_SRC_DIR}/H5Edefin.h
- #${HDF5_SRC_DIR}/H5Einit.h
- ${HDF5_SRC_DIR}/H5Epkg.h
- #${HDF5_SRC_DIR}/H5Epubgen.h
+ ${HDF5_SRC_DIR}/H5Epubgen.h
${HDF5_SRC_DIR}/H5Epublic.h
- #${HDF5_SRC_DIR}/H5Eterm.h
)
IDE_GENERATED_PROPERTIES ("H5E" "${H5E_HDRS}" "${H5E_SOURCES}" )
@@ -179,7 +168,6 @@ set (H5EA_SOURCES
${HDF5_SRC_DIR}/H5EAtest.c
)
set (H5EA_HDRS
- ${HDF5_SRC_DIR}/H5EApkg.h
)
IDE_GENERATED_PROPERTIES ("H5EA" "${H5EA_HDRS}" "${H5EA_SOURCES}" )
@@ -205,7 +193,6 @@ set (H5F_SOURCES
)
set (H5F_HDRS
- ${HDF5_SRC_DIR}/H5Fpkg.h
${HDF5_SRC_DIR}/H5Fpublic.h
)
IDE_GENERATED_PROPERTIES ("H5F" "${H5F_HDRS}" "${H5F_SOURCES}" )
@@ -223,7 +210,6 @@ set (H5FA_SOURCES
${HDF5_SRC_DIR}/H5FAtest.c
)
set (H5FA_HDRS
- ${HDF5_SRC_DIR}/H5FApkg.h
)
IDE_GENERATED_PROPERTIES ("H5FA" "${H5FA_HDRS}" "${H5FA_SOURCES}" )
@@ -253,7 +239,6 @@ set (H5FD_HDRS
${HDF5_SRC_DIR}/H5FDmpi.h
${HDF5_SRC_DIR}/H5FDmpio.h
${HDF5_SRC_DIR}/H5FDmulti.h
- ${HDF5_SRC_DIR}/H5FDpkg.h
${HDF5_SRC_DIR}/H5FDpublic.h
${HDF5_SRC_DIR}/H5FDsec2.h
${HDF5_SRC_DIR}/H5FDstdio.h
@@ -289,8 +274,6 @@ set (H5FS_SOURCES
)
set (H5FS_HDRS
- ${HDF5_SRC_DIR}/H5FSpkg.h
- ${HDF5_SRC_DIR}/H5FSpublic.h
)
IDE_GENERATED_PROPERTIES ("H5FS" "${H5FS_HDRS}" "${H5FS_SOURCES}" )
@@ -316,7 +299,6 @@ set (H5G_SOURCES
)
set (H5G_HDRS
- ${HDF5_SRC_DIR}/H5Gpkg.h
${HDF5_SRC_DIR}/H5Gpublic.h
)
IDE_GENERATED_PROPERTIES ("H5G" "${H5G_HDRS}" "${H5G_SOURCES}" )
@@ -341,8 +323,6 @@ set (H5HF_SOURCES
)
set (H5HF_HDRS
- ${HDF5_SRC_DIR}/H5HFpkg.h
- ${HDF5_SRC_DIR}/H5HFpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HF" "${H5HF_HDRS}" "${H5HF_SOURCES}" )
@@ -354,8 +334,6 @@ set (H5HG_SOURCES
)
set (H5HG_HDRS
- ${HDF5_SRC_DIR}/H5HGpkg.h
- ${HDF5_SRC_DIR}/H5HGpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HG" "${H5HG_HDRS}" "${H5HG_SOURCES}" )
@@ -369,8 +347,6 @@ set (H5HL_SOURCES
)
set (H5HL_HDRS
- ${HDF5_SRC_DIR}/H5HLpkg.h
- ${HDF5_SRC_DIR}/H5HLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5HL" "${H5HL_HDRS}" "${H5HL_SOURCES}" )
@@ -388,7 +364,6 @@ set (H5I_SOURCES
${HDF5_SRC_DIR}/H5Itest.c
)
set (H5I_HDRS
- ${HDF5_SRC_DIR}/H5Ipkg.h
${HDF5_SRC_DIR}/H5Ipublic.h
)
IDE_GENERATED_PROPERTIES ("H5I" "${H5I_HDRS}" "${H5I_SOURCES}" )
@@ -399,7 +374,6 @@ set (H5L_SOURCES
${HDF5_SRC_DIR}/H5Lexternal.c
)
set (H5L_HDRS
- ${HDF5_SRC_DIR}/H5Lpkg.h
${HDF5_SRC_DIR}/H5Lpublic.h
)
IDE_GENERATED_PROPERTIES ("H5L" "${H5L_HDRS}" "${H5L_SOURCES}" )
@@ -432,7 +406,6 @@ set (H5MP_SOURCES
)
set (H5MP_HDRS
- ${HDF5_SRC_DIR}/H5MPpkg.h
)
IDE_GENERATED_PROPERTIES ("H5MP" "${H5MP_HDRS}" "${H5MP_SOURCES}" )
@@ -477,9 +450,7 @@ set (H5O_SOURCES
)
set (H5O_HDRS
- ${HDF5_SRC_DIR}/H5Opkg.h
${HDF5_SRC_DIR}/H5Opublic.h
- ${HDF5_SRC_DIR}/H5Oshared.h
)
IDE_GENERATED_PROPERTIES ("H5O" "${H5O_HDRS}" "${H5O_SOURCES}" )
@@ -505,7 +476,6 @@ set (H5P_SOURCES
)
set (H5P_HDRS
- ${HDF5_SRC_DIR}/H5Ppkg.h
${HDF5_SRC_DIR}/H5Ppublic.h
)
IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" )
@@ -515,7 +485,6 @@ set (H5PB_SOURCES
)
set (H5PB_HDRS
- ${HDF5_SRC_DIR}/H5PBpkg.h
)
IDE_GENERATED_PROPERTIES ("H5PB" "${H5PB_HDRS}" "${H5PB_SOURCES}" )
@@ -528,7 +497,6 @@ set (H5PL_SOURCES
set (H5PL_HDRS
${HDF5_SRC_DIR}/H5PLextern.h
- ${HDF5_SRC_DIR}/H5PLpkg.h
${HDF5_SRC_DIR}/H5PLpublic.h
)
IDE_GENERATED_PROPERTIES ("H5PL" "${H5PL_HDRS}" "${H5PL_SOURCES}" )
@@ -540,7 +508,6 @@ set (H5R_SOURCES
${HDF5_SRC_DIR}/H5Rint.c
)
set (H5R_HDRS
- ${HDF5_SRC_DIR}/H5Rpkg.h
${HDF5_SRC_DIR}/H5Rpublic.h
)
IDE_GENERATED_PROPERTIES ("H5R" "${H5R_HDRS}" "${H5R_SOURCES}" )
@@ -567,7 +534,6 @@ set (H5S_SOURCES
)
set (H5S_HDRS
- ${HDF5_SRC_DIR}/H5Spkg.h
${HDF5_SRC_DIR}/H5Spublic.h
)
IDE_GENERATED_PROPERTIES ("H5S" "${H5S_HDRS}" "${H5S_SOURCES}" )
@@ -590,7 +556,6 @@ set (H5SM_SOURCES
)
set (H5SM_HDRS
- ${HDF5_SRC_DIR}/H5SMpkg.h
)
IDE_GENERATED_PROPERTIES ("H5SM" "${H5SM_HDRS}" "${H5SM_SOURCES}" )
@@ -630,7 +595,6 @@ set (H5T_SOURCES
)
set (H5T_HDRS
- ${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tpublic.h
)
IDE_GENERATED_PROPERTIES ("H5T" "${H5T_HDRS}" "${H5T_SOURCES}" )
@@ -685,7 +649,6 @@ endif ()
set (H5Z_HDRS
- ${HDF5_SRC_DIR}/H5Zpkg.h
${HDF5_SRC_DIR}/H5Zpublic.h
)
IDE_GENERATED_PROPERTIES ("H5Z" "${H5Z_HDRS}" "${H5Z_SOURCES}" )
@@ -772,49 +735,124 @@ set (H5_PUBLIC_HEADERS
set (H5_PRIVATE_HEADERS
${HDF5_SRC_DIR}/H5private.h
+
+ ${HDF5_SRC_DIR}/H5Apkg.h
${HDF5_SRC_DIR}/H5Aprivate.h
+
+ ${HDF5_SRC_DIR}/H5ACpkg.h
${HDF5_SRC_DIR}/H5ACprivate.h
- ${HDF5_SRC_DIR}/H5B2private.h
+
+ ${HDF5_SRC_DIR}/H5Bpkg.h
${HDF5_SRC_DIR}/H5Bprivate.h
+
+ ${HDF5_SRC_DIR}/H5B2pkg.h
+ ${HDF5_SRC_DIR}/H5B2private.h
+
+ ${HDF5_SRC_DIR}/H5Clog.h
+ ${HDF5_SRC_DIR}/H5Cpkg.h
${HDF5_SRC_DIR}/H5Cprivate.h
+
${HDF5_SRC_DIR}/H5CSprivate.h
+
${HDF5_SRC_DIR}/H5CXprivate.h
+
+ ${HDF5_SRC_DIR}/H5Dpkg.h
${HDF5_SRC_DIR}/H5Dprivate.h
+
+ ${HDF5_SRC_DIR}/H5Edefin.h
+ ${HDF5_SRC_DIR}/H5Einit.h
+ ${HDF5_SRC_DIR}/H5Epkg.h
${HDF5_SRC_DIR}/H5Eprivate.h
+ ${HDF5_SRC_DIR}/H5Eterm.h
+
+ ${HDF5_SRC_DIR}/H5EApkg.h
${HDF5_SRC_DIR}/H5EAprivate.h
+
+ ${HDF5_SRC_DIR}/H5Fpkg.h
+ ${HDF5_SRC_DIR}/H5Fprivate.h
+
+ ${HDF5_SRC_DIR}/H5FApkg.h
${HDF5_SRC_DIR}/H5FAprivate.h
+
+ ${HDF5_SRC_DIR}/H5FDpkg.h
${HDF5_SRC_DIR}/H5FDprivate.h
- ${HDF5_SRC_DIR}/H5Fprivate.h
+
${HDF5_SRC_DIR}/H5FLprivate.h
+
${HDF5_SRC_DIR}/H5FOprivate.h
- ${HDF5_SRC_DIR}/H5MFprivate.h
- ${HDF5_SRC_DIR}/H5MMprivate.h
- ${HDF5_SRC_DIR}/H5Cprivate.h
+
+ ${HDF5_SRC_DIR}/H5FSpkg.h
${HDF5_SRC_DIR}/H5FSprivate.h
+
+ ${HDF5_SRC_DIR}/H5Gpkg.h
${HDF5_SRC_DIR}/H5Gprivate.h
+
+ ${HDF5_SRC_DIR}/H5HFpkg.h
${HDF5_SRC_DIR}/H5HFprivate.h
+
+ ${HDF5_SRC_DIR}/H5HGpkg.h
${HDF5_SRC_DIR}/H5HGprivate.h
+
+ ${HDF5_SRC_DIR}/H5HLpkg.h
${HDF5_SRC_DIR}/H5HLprivate.h
+
${HDF5_SRC_DIR}/H5HPprivate.h
+
+ ${HDF5_SRC_DIR}/H5Ipkg.h
${HDF5_SRC_DIR}/H5Iprivate.h
+
+ ${HDF5_SRC_DIR}/H5Lpkg.h
${HDF5_SRC_DIR}/H5Lprivate.h
+
+ ${HDF5_SRC_DIR}/H5MFprivate.h
+
+ ${HDF5_SRC_DIR}/H5MMprivate.h
+
+ ${HDF5_SRC_DIR}/H5MPpkg.h
${HDF5_SRC_DIR}/H5MPprivate.h
+
+ ${HDF5_SRC_DIR}/H5Opkg.h
${HDF5_SRC_DIR}/H5Oprivate.h
+ ${HDF5_SRC_DIR}/H5Oshared.h
+
+ ${HDF5_SRC_DIR}/H5Ppkg.h
${HDF5_SRC_DIR}/H5Pprivate.h
+
${HDF5_SRC_DIR}/H5PBprivate.h
+ ${HDF5_SRC_DIR}/H5PBpkg.h
+
+ ${HDF5_SRC_DIR}/H5PLpkg.h
${HDF5_SRC_DIR}/H5PLprivate.h
- ${HDF5_SRC_DIR}/H5UCprivate.h
+
+ ${HDF5_SRC_DIR}/H5Rpkg.h
${HDF5_SRC_DIR}/H5Rprivate.h
+
${HDF5_SRC_DIR}/H5RSprivate.h
+
+ ${HDF5_SRC_DIR}/H5Spkg.h
+ ${HDF5_SRC_DIR}/H5Sprivate.h
+
${HDF5_SRC_DIR}/H5SLprivate.h
+
+ ${HDF5_SRC_DIR}/H5SMpkg.h
${HDF5_SRC_DIR}/H5SMprivate.h
- ${HDF5_SRC_DIR}/H5Sprivate.h
+
${HDF5_SRC_DIR}/H5STprivate.h
+
+ ${HDF5_SRC_DIR}/H5Tpkg.h
${HDF5_SRC_DIR}/H5Tprivate.h
+
${HDF5_SRC_DIR}/H5TSprivate.h
+
+ ${HDF5_SRC_DIR}/H5UCprivate.h
+
${HDF5_SRC_DIR}/H5VMprivate.h
+
${HDF5_SRC_DIR}/H5WBprivate.h
+
+ ${HDF5_SRC_DIR}/H5Zpkg.h
${HDF5_SRC_DIR}/H5Zprivate.h
+
${HDF5_SRC_DIR}/H5win32defs.h
)
@@ -827,6 +865,12 @@ set (H5_GENERATED_HEADERS
${HDF5_SRC_DIR}/H5overflow.h
)
+set (H5_PUBLIC_GENERATED_HEADERS
+ ${HDF5_SRC_DIR}/H5Epubgen.h
+ ${HDF5_SRC_DIR}/H5version.h
+ ${HDF5_SRC_DIR}/H5overflow.h
+)
+
option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON)
if (HDF5_GENERATE_HEADERS)
set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE)
@@ -853,7 +897,6 @@ endif ()
# Setup the H5detect utility which generates H5Tinit with platform
# specific type checks inside
#-----------------------------------------------------------------------------
-option (HDF5_USE_PREGEN "Use pre-generated Files" OFF)
if (HDF5_USE_PREGEN)
set (HDF5_GENERATED_SOURCE_DIR ${HDF5_USE_PREGEN_DIR})
else ()
@@ -864,6 +907,27 @@ if (BUILD_SHARED_LIBS)
file (MAKE_DIRECTORY "${HDF5_BINARY_DIR}/shared")
endif ()
+if (LOCAL_BATCH_TEST)
+ if (LOCAL_BATCH_SCRIPT_COMMAND STREQUAL "raybsub")
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_COMMAND}
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_COMMAND} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+ if (LOCAL_BATCH_SCRIPT_NAME)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_NAME}.in.cmake
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_NAME} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+ if (LOCAL_BATCH_SCRIPT_PARALLEL_NAME)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME}.in.cmake
+ ${HDF5_BINARY_DIR}/${LOCAL_BATCH_SCRIPT_PARALLEL_NAME} ESCAPE_QUOTES @ONLY
+ )
+ endif ()
+endif ()
+
if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
add_executable (H5detect ${HDF5_SRC_DIR}/H5detect.c)
target_include_directories(H5detect PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
@@ -871,37 +935,85 @@ if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c)
TARGET_C_PROPERTIES (H5detect STATIC)
target_link_libraries (H5detect
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib>
- INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0">
+ PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
- add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
- ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
- DEPENDS H5detect
- WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
- )
- if (BUILD_SHARED_LIBS)
- if (NOT EXISTS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c)
+ if (HDF5_BATCH_H5DETECT)
+ configure_file (
+ ${HDF5_SOURCE_DIR}/bin/batch/${HDF5_BATCH_H5DETECT_SCRIPT}.in.cmake
+ ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT} ESCAPE_QUOTES @ONLY
+ )
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ COMMAND ${HDF5_BATCH_CMD}
+ ARGS ${HDF5_BINARY_DIR}/${HDF5_BATCH_H5DETECT_SCRIPT}
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E echo "Executed batch command to create H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ DEPENDS H5detect
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ add_custom_target (gen_H5Tinit
+ COMMAND ${CMAKE_COMMAND} -P ${HDF5_SOURCE_DIR}/config/cmake/wait_H5Tinit.cmake
+ )
+ if (BUILD_SHARED_LIBS)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
- ARGS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
- DEPENDS H5detect
- WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}/shared
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ DEPENDS gen_H5Tinit ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit_created
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
+ endif ()
+ else ()
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5detect>
+ ARGS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ DEPENDS H5detect
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
+ if (BUILD_SHARED_LIBS)
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
- else ()
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
endif ()
-else ()
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c PROPERTIES GENERATED TRUE)
+else ()
+ add_custom_command (
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
+ )
if (BUILD_SHARED_LIBS)
add_custom_command (
- OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c
+ OUTPUT ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_if_different "${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c" "${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1
DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c
+ WORKING_DIRECTORY ${HDF5_GENERATED_SOURCE_DIR}
)
set_source_files_properties (${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c PROPERTIES GENERATED TRUE)
endif ()
@@ -913,24 +1025,32 @@ target_compile_definitions(H5make_libsettings PUBLIC ${HDF_EXTRA_C_FLAGS} ${HDF_
TARGET_C_PROPERTIES (H5make_libsettings STATIC)
target_link_libraries (H5make_libsettings
PRIVATE "$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_LIBRARIES}>" $<$<PLATFORM_ID:Windows>:ws2_32.lib>
- INTERFACE $<$<PLATFORM_ID:Emscripten>:"-O0">
+ PRIVATE $<$<PLATFORM_ID:Emscripten>:"-O0">
)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/H5lib_settings.c
+ ${HDF5_BINARY_DIR}/gen_SRCS.stamp2
COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings>
ARGS ${HDF5_BINARY_DIR}/H5lib_settings.c
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2
DEPENDS H5make_libsettings
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
+set_source_files_properties (${HDF5_BINARY_DIR}/H5lib_settings.c PROPERTIES GENERATED TRUE)
if (BUILD_SHARED_LIBS)
add_custom_command (
OUTPUT ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
- COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR}$<TARGET_FILE:H5make_libsettings>
- ARGS ${HDF5_BINARY_DIR}/shared/H5lib_settings.c
- DEPENDS H5make_libsettings
+ ${HDF5_BINARY_DIR}/shared/shared_gen_SRCS.stamp2
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E copy_if_different "${HDF5_BINARY_DIR}/H5lib_settings.c" "${HDF5_BINARY_DIR}/shared/H5lib_settings.c"
+ COMMAND ${CMAKE_COMMAND}
+ ARGS -E touch ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2
+ DEPENDS ${HDF5_BINARY_DIR}/H5lib_settings.c
WORKING_DIRECTORY ${HDF5_BINARY_DIR}
)
+ set_source_files_properties (${HDF5_BINARY_DIR}/shared/H5lib_settings.c PROPERTIES GENERATED TRUE)
endif ()
## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z"
@@ -941,6 +1061,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF)
# Add H5Tinit source to build - generated by H5detect/CMake at configure time
#-----------------------------------------------------------------------------
set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c)
+add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2)
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}
@@ -964,11 +1085,13 @@ 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 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/shared/shared_gen_SRCS.stamp2)
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}
@@ -994,6 +1117,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 ()
@@ -1005,7 +1129,7 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT)
install (
FILES
${H5_PUBLIC_HEADERS}
- ${H5_GENERATED_HEADERS}
+ ${H5_PUBLIC_GENERATED_HEADERS}
${HDF5_BINARY_DIR}/H5pubconf.h
DESTINATION
${HDF5_INSTALL_INCLUDE_DIR}
diff --git a/src/H5.c b/src/H5.c
index 1b13fea..5e342ff 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -138,7 +138,7 @@ H5_init_library(void)
if (mpi_initialized && !mpi_finalized) {
int key_val;
- if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_NULL_COPY_FN,
+ if(MPI_SUCCESS != (mpi_code = MPI_Comm_create_keyval(MPI_COMM_NULL_COPY_FN,
(MPI_Comm_delete_attr_function *)H5_mpi_delete_cb,
&key_val, NULL)))
HMPI_GOTO_ERROR(FAIL, "MPI_Comm_create_keyval failed", mpi_code)
diff --git a/src/H5A.c b/src/H5A.c
index 8e64eda..a0408c3 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -1133,7 +1133,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Call private attribute rename routine */
- if(H5A__rename(&loc, old_name, new_name) < 0)
+ if(H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
@@ -1379,7 +1379,7 @@ H5Adelete(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
/* Delete the attribute from the location */
- if(H5A__delete(&loc, name) < 0)
+ if(H5O__attr_remove(loc.oloc, name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -1563,7 +1563,7 @@ H5Aexists(hid_t obj_id, const char *attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
/* Check if the attribute exists */
- if((ret_value = H5A__exists(&loc, attr_name)) < 0)
+ if((ret_value = H5O__attr_exists(loc.oloc, attr_name)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
diff --git a/src/H5AC.c b/src/H5AC.c
index 989ee10..6714bed 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -30,22 +30,24 @@
/****************/
#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+#define H5C_FRIEND /* Suppress error about including H5Cpkg */
+#define H5F_FRIEND /* Suppress error about including H5Fpkg */
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cprivate.h" /* Cache */
-#include "H5CXprivate.h" /* API Contexts */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5Fpkg.h" /* Files */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Iprivate.h" /* IDs */
-#include "H5Pprivate.h" /* Property lists */
-#include "H5SLprivate.h" /* Skip Lists */
+#include "H5private.h" /* Generic Functions */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Cpkg.h" /* Cache */
+#include "H5CXprivate.h" /* API Contexts */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5Fpkg.h" /* Files */
+#include "H5FDprivate.h" /* File drivers */
+#include "H5Iprivate.h" /* IDs */
+#include "H5Pprivate.h" /* Property lists */
+#include "H5SLprivate.h" /* Skip Lists */
/****************/
@@ -128,7 +130,7 @@ static const H5AC_class_t *const H5AC_class_s[] = {
H5AC_DRVRINFO, /* (26) driver info block (supplements superblock) */
H5AC_EPOCH_MARKER, /* (27) epoch marker - always internal to cache */
H5AC_PROXY_ENTRY, /* (28) cache entry proxy */
- H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
+ H5AC_PREFETCHED_ENTRY /* (29) prefetched entry - always internal to cache */
};
@@ -178,13 +180,16 @@ H5AC__init_package(void)
#ifdef H5_HAVE_PARALLEL
/* check whether to enable strict collective function calling
- sanity checks using MPI barriers */
+ * sanity checks using MPI barriers
+ */
{
const char *s; /* String for environment variables */
s = HDgetenv("H5_COLL_API_SANITY_CHECK");
- if(s && HDisdigit(*s))
- H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0);
+ if(s && HDisdigit(*s)) {
+ long env_val = HDstrtol(s, NULL, 0);
+ H5_coll_api_sanity_check_g = (0 == env_val) ? FALSE : TRUE;
+ }
}
#endif /* H5_HAVE_PARALLEL */
@@ -403,15 +408,13 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "H5C_set_prefix() failed")
#endif /* H5_HAVE_PARALLEL */
- /* Turn on metadata cache logging, if being used */
- if(H5F_USE_MDC_LOGGING(f)) {
- if(H5C_set_up_logging(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTINIT, FAIL, "mdc logging setup failed")
-
- /* Write the log header regardless of current logging status */
- if(H5AC__write_create_cache_log_msg(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
- } /* end if */
+ /* Turn on metadata cache logging, if being used
+ * This will be JSON until we create a special API call. Trace output
+ * is generated when logging is controlled by the struct.
+ */
+ if(H5F_USE_MDC_LOGGING(f))
+ if(H5C_log_set_up(f->shared->cache, H5F_MDC_LOG_LOCATION(f), H5C_LOG_STYLE_JSON, H5F_START_MDC_LOG_ON_ACCESS(f)) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
/* Set the cache parameters */
if(H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
@@ -431,6 +434,11 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "auto resize configuration failed")
done:
+ /* If currently logging, generate a message */
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_create_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
#ifdef H5_HAVE_PARALLEL
/* if there is a failure, try to tidy up the auxiliary structure */
if(ret_value < 0) {
@@ -469,6 +477,8 @@ done:
herr_t
H5AC_dest(H5F_t *f)
{
+ hbool_t log_enabled; /* TRUE if logging was set up */
+ hbool_t curr_logging; /* TRUE if currently logging */
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
@@ -486,18 +496,16 @@ H5AC_dest(H5F_t *f)
H5AC_stats(f);
#endif /* H5AC_DUMP_STATS_ON_CLOSE */
-#if H5AC__TRACE_FILE_ENABLED
- if(H5AC__close_trace_file(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed")
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- if(H5F_USE_MDC_LOGGING(f)) {
- /* Write the log footer regardless of current logging status */
- if(H5AC__write_destroy_cache_log_msg(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
- if(H5C_tear_down_logging(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "mdc logging tear-down failed")
- } /* end if */
+ /* Check if log messages are being emitted */
+ if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to get logging status")
+ if(log_enabled && curr_logging)
+ if(H5C_log_write_destroy_cache_msg(f->shared->cache) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+ /* Tear down logging */
+ if(log_enabled)
+ if(H5C_log_tear_down(f->shared->cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
#ifdef H5_HAVE_PARALLEL
/* destroying the cache, so clear all collective entries */
@@ -565,8 +573,6 @@ done:
herr_t
H5AC_evict(H5F_t *f)
{
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -576,10 +582,6 @@ H5AC_evict(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Evict all entries in the cache except the pinned superblock entry */
if(H5C_evict(f) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "can't evict cache")
@@ -587,9 +589,9 @@ H5AC_evict(H5F_t *f)
done:
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_evict_cache_log_msg(f->shared->cache, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_evict_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_evict() */
@@ -613,12 +615,6 @@ herr_t
H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -631,36 +627,14 @@ H5AC_expunge_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
HDassert(type->serialize);
HDassert(H5F_addr_defined(addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
-{
- H5AC_t * cache_ptr = f->shared->cache;
-
- /* For the expunge entry call, only the addr, and type id are really
- * necessary in the trace file. Write the return value to catch occult
- * errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id));
-}
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
if(H5C_expunge_entry(f, type, addr, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_expunge_entry() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_expunge_entry_log_msg(f->shared->cache, addr, type->id, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_expunge_entry_msg(f->shared->cache, addr, type->id, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_expunge_entry() */
@@ -689,12 +663,6 @@ done:
herr_t
H5AC_flush(H5F_t *f)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -704,18 +672,6 @@ H5AC_flush(H5F_t *f)
HDassert(f->shared);
HDassert(f->shared->cache);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the flush, only the flags are really necessary in the trace file.
- * Write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s", FUNC);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
/* flushing the cache, so clear all collective entries */
if(H5C_clear_coll_entries(f->shared->cache, FALSE) < 0)
@@ -732,15 +688,10 @@ H5AC_flush(H5F_t *f)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush cache")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_flush_cache_log_msg(f->shared->cache, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_flush_cache_msg(f->shared->cache, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_flush() */
@@ -873,13 +824,6 @@ herr_t
H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
unsigned int flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- size_t trace_entry_size = 0;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -893,26 +837,9 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert(H5F_addr_defined(addr));
HDassert(thing);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the insert, only the addr, size, type id and flags are really
- * necessary in the trace file. Write the result to catch occult
- * errors.
- *
- * Note that some data is not available right now -- put what we can
- * in the trace buffer now, and fill in the rest at the end.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr, type->id,
- flags);
-#endif /* H5AC__TRACE_FILE_ENABLED */
+ HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "no write intent on file")
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
@@ -923,12 +850,6 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
if(H5C_insert_entry(f, type, addr, thing, flags) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5C_insert_entry() failed")
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- /* make note of the entry size */
- trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -947,14 +868,10 @@ H5AC_insert_entry(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_insert_entry_log_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_insert_entry_msg(f->shared->cache, addr, type->id, flags, ((H5C_cache_entry_t *)thing)->size, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_insert_entry() */
@@ -1011,12 +928,6 @@ done:
herr_t
H5AC_mark_entry_dirty(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1030,19 +941,6 @@ H5AC_mark_entry_dirty(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark pinned or protected entry dirty call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -1059,15 +957,10 @@ H5AC_mark_entry_dirty(void *thing)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't mark pinned or protected entry dirty")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_dirty_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_entry_dirty_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_dirty() */
@@ -1076,7 +969,7 @@ done:
/*-------------------------------------------------------------------------
* Function: H5AC_mark_entry_clean
*
- * Purpose: Mark a pinned entry as dirty. The target
+ * Purpose: Mark a pinned entry as clean. The target
* entry MUST be pinned.
*
* Return: Non-negative on success/Negative on failure
@@ -1089,12 +982,6 @@ done:
herr_t
H5AC_mark_entry_clean(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1104,23 +991,9 @@ H5AC_mark_entry_clean(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark pinned or protected entry clean call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
#ifdef H5_HAVE_PARALLEL
{
H5AC_aux_t *aux_ptr;
@@ -1137,15 +1010,10 @@ H5AC_mark_entry_clean(void *thing)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKCLEAN, FAIL, "can't mark pinned or protected entry clean")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_clean_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_entry_clean_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_clean() */
@@ -1167,12 +1035,6 @@ done:
herr_t
H5AC_mark_entry_unserialized(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1186,32 +1048,14 @@ H5AC_mark_entry_unserialized(void *thing)
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark entry unserialized call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry_ptr->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
if(H5C_mark_entry_unserialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKUNSERIALIZED, FAIL, "can't mark entry unserialized")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_unserialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_unserialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_unserialized() */
@@ -1233,12 +1077,6 @@ done:
herr_t
H5AC_mark_entry_serialized(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1248,36 +1086,17 @@ H5AC_mark_entry_serialized(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the mark entry serializedn call, only the addr
- * is really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
if(H5C_mark_entry_serialized(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKSERIALIZED, FAIL, "can't mark entry serialized")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_mark_serialized_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_mark_serialized_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_mark_entry_serialized() */
@@ -1300,15 +1119,9 @@ done:
herr_t
H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t *aux_ptr;
#endif /* H5_HAVE_PARALLEL */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1321,20 +1134,6 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
HDassert(H5F_addr_defined(new_addr));
HDassert(H5F_addr_ne(old_addr, new_addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the move call, only the old addr and new addr are really
- * necessary in the trace file. Include the type id so we don't have to
- * look it up. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx 0x%lx %d", FUNC, (unsigned long)old_addr,
- (unsigned long)new_addr, (int)(type->id));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#ifdef H5_HAVE_PARALLEL
/* Log moving the entry */
if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache)))
@@ -1353,15 +1152,10 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_move_entry_log_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_move_entry_msg(f->shared->cache, old_addr, new_addr, type->id, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_move_entry() */
@@ -1383,12 +1177,6 @@ done:
herr_t
H5AC_pin_protected_entry(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1398,37 +1186,19 @@ H5AC_pin_protected_entry(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the pin protected entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Pin entry */
if(H5C_pin_protected_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTPIN, FAIL, "can't pin entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_pin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_pin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_pin_protected_entry() */
@@ -1488,12 +1258,6 @@ done:
herr_t
H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1504,35 +1268,19 @@ H5AC_create_flush_dependency(void * parent_thing, void * child_thing)
HDassert(parent_thing);
HDassert(child_thing);
-#if H5AC__TRACE_FILE_ENABLED
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing)))
- sprintf(trace, "%s %lx %lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)parent_thing)->addr),
- (unsigned long)(((H5C_cache_entry_t *)child_thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)parent_thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Create the flush dependency */
if(H5C_create_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTDEPEND, FAIL, "H5C_create_flush_dependency() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_create_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_create_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_create_flush_dependency() */
@@ -1566,14 +1314,7 @@ void *
H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- size_t trace_entry_size = 0;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
void * thing = NULL; /* Pointer to native data structure for entry */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
void * ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1586,10 +1327,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
HDassert(type->serialize);
HDassert(H5F_addr_defined(addr));
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "unable to get logging status")
-
/* Check for unexpected flags -- H5C__FLUSH_COLLECTIVELY_FLAG
* only permitted in the parallel case.
*/
@@ -1606,16 +1343,6 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
if((0 == (H5F_INTENT(f) & H5F_ACC_RDWR)) && (0 == (flags & H5C__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "no write intent on file")
-#if H5AC__TRACE_FILE_ENABLED
- /* For the protect call, only the addr, size, type id, and flags are
- * necessary in the trace file. Also indicate whether the call was
- * successful to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d 0x%x", FUNC, (unsigned long)addr,
- (int)(type->id), flags);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
#if H5AC_DO_TAGGING_SANITY_CHECKS
if(!H5C_get_ignore_tags(f->shared->cache) && H5AC__verify_tag(type) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Bad tag value")
@@ -1624,28 +1351,18 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *udata,
if(NULL == (thing = H5C_protect(f, type, addr, udata, flags)))
HGOTO_ERROR(H5E_CACHE, H5E_CANTPROTECT, NULL, "H5C_protect() failed")
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- /* Make note of the entry size */
- trace_entry_size = ((H5C_cache_entry_t *)thing)->size;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* Set return value */
ret_value = thing;
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d %d\n", trace, (int)trace_entry_size, (int)(ret_value != NULL));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging) {
+ {
herr_t fake_ret_value = (NULL == ret_value) ? FAIL : SUCCEED;
- if(H5AC__write_protect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, flags, fake_ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, NULL, "unable to emit log message")
- } /* end if */
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_protect_entry_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, fake_ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, NULL, "unable to emit log message")
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_protect() */
@@ -1666,12 +1383,6 @@ done:
herr_t
H5AC_resize_entry(void *thing, size_t new_size)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1681,25 +1392,10 @@ H5AC_resize_entry(void *thing, size_t new_size)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the resize pinned entry call, only the addr, and new_size are
- * really necessary in the trace file. Write the result to catch
- * occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx %d", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr),
- (int)new_size);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Resize the entry */
if(H5C_resize_entry(thing, new_size) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTRESIZE, FAIL, "can't resize entry")
@@ -1716,15 +1412,10 @@ H5AC_resize_entry(void *thing, size_t new_size)
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_resize_entry_log_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_resize_entry_msg(cache_ptr, entry_ptr, new_size, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_resize_entry() */
@@ -1746,12 +1437,6 @@ done:
herr_t
H5AC_unpin_entry(void *thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1761,37 +1446,19 @@ H5AC_unpin_entry(void *thing)
/* Sanity check */
HDassert(thing);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the unpin entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(thing)))
- sprintf(trace, "%s 0x%lx", FUNC,
- (unsigned long)(((H5C_cache_entry_t *)thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Unpin the entry */
if(H5C_unpin_entry(thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPIN, FAIL, "can't unpin entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_unpin_entry_log_msg(cache_ptr, entry_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_unpin_entry_msg(cache_ptr, entry_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unpin_entry() */
@@ -1812,12 +1479,6 @@ done:
herr_t
H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5AC_info_t *entry_ptr = NULL; /* Pointer to the cache entry */
H5C_t *cache_ptr = NULL; /* Pointer to the entry's associated metadata cache */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1828,35 +1489,19 @@ H5AC_destroy_flush_dependency(void * parent_thing, void * child_thing)
HDassert(parent_thing);
HDassert(child_thing);
-#if H5AC__TRACE_FILE_ENABLED
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(parent_thing)))
- sprintf(trace, "%s %llx %llx", FUNC,
- (unsigned long long)(((H5C_cache_entry_t *)parent_thing)->addr),
- (unsigned long long)(((H5C_cache_entry_t *)child_thing)->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
entry_ptr = (H5AC_info_t *)parent_thing;
cache_ptr = entry_ptr->cache_ptr;
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
/* Destroy the flush dependency */
if(H5C_destroy_flush_dependency(parent_thing, child_thing) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTUNDEPEND, FAIL, "H5C_destroy_flush_dependency() failed")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_destroy_fd_log_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_destroy_fd_msg(cache_ptr, (H5AC_info_t *)parent_thing, (H5AC_info_t *)child_thing, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_destroy_flush_dependency() */
@@ -1904,17 +1549,11 @@ herr_t
H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
unsigned flags)
{
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
hbool_t dirtied;
hbool_t deleted;
#ifdef H5_HAVE_PARALLEL
H5AC_aux_t * aux_ptr = NULL;
#endif /* H5_HAVE_PARALLEL */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1931,19 +1570,6 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
HDassert( ((H5AC_info_t *)thing)->addr == addr );
HDassert( ((H5AC_info_t *)thing)->type == type );
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(f->shared->cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* For the unprotect call, only the addr, type id, flags, and possible
- * new size are really necessary in the trace file. Write the return
- * value to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- sprintf(trace, "%s 0x%lx %d", FUNC, (unsigned long)addr, (int)(type->id));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
dirtied = (hbool_t)(((flags & H5AC__DIRTIED_FLAG) == H5AC__DIRTIED_FLAG) ||
(((H5AC_info_t *)thing)->dirtied));
deleted = (hbool_t)((flags & H5C__DELETED_FLAG) == H5C__DELETED_FLAG);
@@ -1984,15 +1610,10 @@ H5AC_unprotect(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing,
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr != NULL)
- HDfprintf(trace_file_ptr, "%s 0x%x %d\n", trace, (unsigned)flags, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_unprotect_entry_log_msg(f->shared->cache, (H5AC_info_t *)thing, type->id, flags, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(f->shared->cache->log_info->logging)
+ if(H5C_log_write_unprotect_entry_msg(f->shared->cache, addr, type->id, flags, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_unprotect() */
@@ -2191,12 +1812,6 @@ done:
herr_t
H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config_ptr)
{
-#if H5AC__TRACE_FILE_ENABLED
- H5AC_cache_config_t trace_config = H5AC__DEFAULT_CACHE_CONFIG;
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
H5C_auto_size_ctl_t internal_config;
herr_t ret_value = SUCCEED; /* Return value */
@@ -2205,18 +1820,6 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
/* Sanity checks */
HDassert(cache_ptr);
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache_ptr, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
-#if H5AC__TRACE_FILE_ENABLED
- /* Make note of the new configuration. Don't look up the trace file
- * pointer, as that may change before we use it.
- */
- if(config_ptr != NULL)
- trace_config = *config_ptr;
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
if(cache_ptr == NULL)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad cache_ptr on entry")
#ifdef H5_HAVE_PARALLEL
@@ -2233,23 +1836,25 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
if(H5AC_validate_config(config_ptr) != SUCCEED)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Bad cache configuration")
- if(config_ptr->open_trace_file) {
- FILE * file_ptr;
-
- if(NULL == (file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed")
-
- if((!(config_ptr->close_trace_file)) && (file_ptr != NULL))
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "Trace file already open")
- } /* end if */
-
- /* Close & reopen trace file, if requested */
+ /* If the cache config struct is being used to control logging, perform
+ * the open/close operations. Note that this is the only place where the
+ * struct-based control opens and closes the log files so we also have
+ * to write start/stop messages.
+ */
+ /* close */
if(config_ptr->close_trace_file)
- if(H5AC__close_trace_file(cache_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC__close_trace_file() failed")
- if(config_ptr->open_trace_file)
- if(H5AC__open_trace_file(cache_ptr, config_ptr->trace_file_name) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "H5AC__open_trace_file() failed")
+ if(H5C_log_tear_down((H5C_t *)cache_ptr) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging tear-down failed")
+
+ /* open */
+ if(config_ptr->open_trace_file) {
+ /* Turn on metadata cache logging.
+ * This will be trace output until we create a special API call. JSON
+ * output is generated when logging is controlled by the H5P calls.
+ */
+ if(H5C_log_set_up((H5C_t *)cache_ptr, config_ptr->trace_file_name, H5C_LOG_STYLE_TRACE, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "mdc logging setup failed")
+ }
/* Convert external configuration to internal representation */
if(H5AC__ext_config_2_int_config(config_ptr, &internal_config) < 0)
@@ -2275,52 +1880,10 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config
#endif /* H5_HAVE_PARALLEL */
done:
-#if H5AC__TRACE_FILE_ENABLED
- /* For the set cache auto resize config call, only the contents
- * of the config is necessary in the trace file. Write the return
- * value to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HDfprintf(trace_file_ptr,
- "%s %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
- "H5AC_set_cache_auto_resize_config",
- trace_config.version,
- (int)(trace_config.rpt_fcn_enabled),
- (int)(trace_config.open_trace_file),
- (int)(trace_config.close_trace_file),
- trace_config.trace_file_name,
- (int)(trace_config.evictions_enabled),
- (int)(trace_config.set_initial_size),
- (int)(trace_config.initial_size),
- trace_config.min_clean_fraction,
- (int)(trace_config.max_size),
- (int)(trace_config.min_size),
- trace_config.epoch_length,
- (int)(trace_config.incr_mode),
- trace_config.lower_hr_threshold,
- trace_config.increment,
- (int)(trace_config.flash_incr_mode),
- trace_config.flash_multiple,
- trace_config.flash_threshold,
- (int)(trace_config.apply_max_increment),
- (int)(trace_config.max_increment),
- (int)(trace_config.decr_mode),
- trace_config.upper_hr_threshold,
- trace_config.decrement,
- (int)(trace_config.apply_max_decrement),
- (int)(trace_config.max_decrement),
- trace_config.epochs_before_eviction,
- (int)(trace_config.apply_empty_reserve),
- trace_config.empty_reserve,
- trace_config.dirty_bytes_threshold,
- trace_config.metadata_write_strategy,
- (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_set_cache_config_log_msg(cache_ptr, config_ptr, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache_ptr->log_info->logging)
+ if(H5C_log_write_set_cache_config_msg(cache_ptr, config_ptr, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_set_cache_auto_resize_config() */
@@ -2366,12 +1929,12 @@ H5AC_validate_config(H5AC_cache_config_t *config_ptr)
if(config_ptr->open_trace_file) {
size_t name_len;
- /* Can't really test the trace_file_name field without trying to
- * open the file, so we will content ourselves with a couple of
- * sanity checks on the length of the file name.
- */
- name_len = HDstrlen(config_ptr->trace_file_name);
- if(name_len == 0)
+ /* Can't really test the trace_file_name field without trying to
+ * open the file, so we will content ourselves with a couple of
+ * sanity checks on the length of the file name.
+ */
+ name_len = HDstrlen(config_ptr->trace_file_name);
+ if(name_len == 0)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty")
else if(name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name too long")
@@ -2840,8 +2403,18 @@ H5AC_cork(H5F_t *f, haddr_t obj_addr, unsigned action, hbool_t *corked)
HDassert(H5F_addr_defined(obj_addr));
HDassert(action == H5AC__SET_CORK || action == H5AC__UNCORK || action == H5AC__GET_CORKED);
- if(action == H5AC__GET_CORKED)
- HDassert(corked);
+ /* Skip the search on "tag_list" when there are no "corked" objects.
+ * This is done to mitigate the slow down when closing objects.
+ * Re-visit this optimization when we optimize tag info management
+ * in the future.
+ */
+ if(action == H5AC__GET_CORKED) {
+ HDassert(corked);
+ if(H5C_get_num_objs_corked(f->shared->cache) == 0) {
+ *corked = FALSE;
+ HGOTO_DONE(SUCCEED)
+ }
+ }
if(H5C_cork(f->shared->cache, obj_addr, action, corked) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Cannot perform the cork action")
@@ -3061,12 +2634,6 @@ H5AC_remove_entry(void *_entry)
{
H5AC_info_t *entry = (H5AC_info_t *)_entry; /* Entry to remove */
H5C_t *cache = NULL; /* Pointer to the entry's associated metadata cache */
-#if H5AC__TRACE_FILE_ENABLED
- char trace[128] = "";
- FILE * trace_file_ptr = NULL;
-#endif /* H5AC__TRACE_FILE_ENABLED */
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -3076,32 +2643,15 @@ H5AC_remove_entry(void *_entry)
cache = entry->cache_ptr;
HDassert(cache);
-#if H5AC__TRACE_FILE_ENABLED
- /* For the remove entry call, only the addr is really necessary
- * in the trace file. Also write the result to catch occult errors.
- */
- if(NULL != (trace_file_ptr = H5C_get_trace_file_ptr_from_entry(entry)))
- sprintf(trace, "%s 0x%lx", FUNC, (unsigned long)(entry->addr));
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "unable to get logging status")
-
/* Remove the entry from the cache*/
if(H5C_remove_entry(entry) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTREMOVE, FAIL, "can't remove entry")
done:
-#if H5AC__TRACE_FILE_ENABLED
- if(trace_file_ptr)
- HDfprintf(trace_file_ptr, "%s %d\n", trace, (int)ret_value);
-#endif /* H5AC__TRACE_FILE_ENABLED */
-
/* If currently logging, generate a message */
- if(curr_logging)
- if(H5AC__write_remove_entry_log_msg(cache, entry, ret_value) < 0)
- HDONE_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to emit log message")
+ if(cache->log_info->logging)
+ if(H5C_log_write_remove_entry_msg(cache, entry, ret_value) < 0)
+ HDONE_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
FUNC_LEAVE_NOAPI(ret_value)
} /* H5AC_remove_entry() */
diff --git a/src/H5ACdbg.c b/src/H5ACdbg.c
index c6d71a8..1235206 100644
--- a/src/H5ACdbg.c
+++ b/src/H5ACdbg.c
@@ -136,121 +136,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5AC__close_trace_file()
- *
- * Purpose: If a trace file is open, stop logging calls to the cache,
- * and close the file.
- *
- * Note that the function does nothing if there is no trace
- * file.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 6/2/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__close_trace_file(H5AC_t *cache_ptr)
-{
- FILE * trace_file_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- if(cache_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL cache_ptr on entry.")
-
- if(NULL == (trace_file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_get_trace_file_ptr() failed.")
-
- if(trace_file_ptr != NULL) {
- if(H5C_set_trace_file_ptr(cache_ptr, NULL) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.")
-
- if(HDfclose(trace_file_ptr) != 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close metadata cache trace file")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__close_trace_file() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__open_trace_file()
- *
- * Purpose: Open a trace file, and start logging calls to the cache.
- *
- * This logging is done at the H5C level, and will only take
- * place if H5C_TRACE_FILE_ENABLED (defined in H5Cprivate.h)
- * is TRUE.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 6/1/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name)
-{
- char file_name[H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 2];
- FILE * file_ptr;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE
-
- HDassert(cache_ptr);
-
- /* Check args */
- if(cache_ptr == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "cache_ptr NULL on entry.")
- if(trace_file_name == NULL)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "NULL trace_file_name on entry.")
- if(HDstrlen(trace_file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN)
- HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "trace file name too long.")
- if(NULL != (file_ptr = H5C_get_trace_file_ptr(cache_ptr)))
- HGOTO_ERROR(H5E_CACHE, H5E_FILEOPEN, FAIL, "trace file already open.")
-
-#ifdef H5_HAVE_PARALLEL
-{
- H5AC_aux_t * aux_ptr;
-
- aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr);
- if(aux_ptr == NULL)
- sprintf(file_name, "%s", trace_file_name);
- else {
- if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr->magic.")
-
- sprintf(file_name, "%s.%d", trace_file_name, aux_ptr->mpi_rank);
- } /* end else */
-
- if(HDstrlen(file_name) > H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "cooked trace file name too long.")
-}
-#else /* H5_HAVE_PARALLEL */
- HDsnprintf(file_name, (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + H5C__PREFIX_LEN + 1),
- "%s", trace_file_name);
-#endif /* H5_HAVE_PARALLEL */
-
- if((file_ptr = HDfopen(file_name, "w")) == NULL)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "trace file open failed.")
-
- HDfprintf(file_ptr, "### HDF5 metadata cache trace file version 1 ###\n");
-
- if(H5C_set_trace_file_ptr(cache_ptr, file_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5C_set_trace_file_ptr() failed.")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__open_trace_file() */
-
-
-/*-------------------------------------------------------------------------
*
* Function: H5AC_get_entry_ptr_from_addr()
*
diff --git a/src/H5AClog.c b/src/H5AClog.c
deleted file mode 100644
index 51a2050..0000000
--- a/src/H5AClog.c
+++ /dev/null
@@ -1,1105 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5AClog.c
- *
- * Purpose: Functions for metadata cache logging in JSON format
- *
- *-------------------------------------------------------------------------
- */
-
-/****************/
-/* Module Setup */
-/****************/
-#include "H5ACmodule.h" /* This source code file is part of the H5AC module */
-
-/***********/
-/* Headers */
-/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5ACpkg.h" /* Metadata cache */
-#include "H5Cprivate.h" /* Cache */
-#include "H5Eprivate.h" /* Error handling */
-
-
-/****************/
-/* Local Macros */
-/****************/
-
-#define MSG_SIZE 128
-
-
-/******************/
-/* Local Typedefs */
-/******************/
-
-
-/********************/
-/* Package Typedefs */
-/********************/
-
-
-/********************/
-/* Local Prototypes */
-/********************/
-
-
-/*********************/
-/* Package Variables */
-/*********************/
-
-
-/*****************************/
-/* Library Private Variables */
-/*****************************/
-
-
-/*******************/
-/* Local Variables */
-/*******************/
-
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_create_cache_log_msg
- *
- * Purpose: Write a log message for cache creation.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_create_cache_log_msg(H5AC_t *cache)
-{
- char msg[MSG_SIZE];
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
- /* Since we're about to override the current logging flag,
- * check the "log enabled" flag to see if we didn't get here
- * by mistake.
- */
- if(!log_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write opening log message when logging is disabled")
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\n\
-\"create_time\":%lld,\n\
-\"messages\":\n\
-[\n\
-"
- , (long long)HDtime(NULL));
-
- /* Have to temporarily enable logging, if it isn't currently */
- if(!curr_logging)
- if(H5C_start_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
- /* Stop logging, if it wasn't started originally */
- if(!curr_logging)
- if(H5C_stop_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_create_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_destroy_cache_log_msg
- *
- * Purpose: Write a log message for cache destruction.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_destroy_cache_log_msg(H5AC_t *cache)
-{
- char msg[MSG_SIZE];
- hbool_t log_enabled; /* TRUE if logging was set up */
- hbool_t curr_logging; /* TRUE if currently logging */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Check if log messages are being emitted */
- if(H5C_get_logging_status(cache, &log_enabled, &curr_logging) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to get logging status")
-
- /* Since we're about to override the current logging flag,
- * check the "log enabled" flag to see if we didn't get here
- * by mistake.
- */
- if(!log_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "attempt to write closing log message when logging is disabled")
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-],\n\
-\"close_time\":%lld,\n\
-}\n\
-"
- , (long long)HDtime(NULL));
-
- /* Have to temporarily enable logging, if it isn't currently */
- if(!curr_logging)
- if(H5C_start_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
- /* Stop logging, if it wasn't started originally */
- if(!curr_logging)
- if(H5C_stop_logging(cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_destroy_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_evict_cache_log_msg
- *
- * Purpose: Write a log message for eviction of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_evict_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"evict\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_evict_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_expunge_entry_log_msg
- *
- * Purpose: Write a log message for expunge of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_expunge_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"expunge\",\
-\"address\":0x%lx,\
-\"type_id\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
-
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_expunge_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_flush_cache_log_msg
- *
- * Purpose: Write a log message for cache flushes.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_flush_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"flush\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_flush_cache_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_insert_entry_log_msg
- *
- * Purpose: Write a log message for insertion of cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_insert_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- unsigned flags,
- size_t size,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"insert\",\
-\"address\":0x%lx,\
-\"flags\":0x%x,\
-\"type_id\":%d,\
-\"size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)address, flags, type_id,
- (int)size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_insert_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_dirty_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as dirty.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"dirty\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_dirty_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_clean_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as clean.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Saturday, July 23, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE]; /* Log message buffer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"clean\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_clean_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_unserialized_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as unserialized.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, December 22, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unserialized\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_unserialized_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_mark_serialize_entry_log_msg
- *
- * Purpose: Write a log message for marking cache entries as serialize.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * Thursday, December 22, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE]; /* Log message buffer */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"serialized\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_mark_serialized_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_move_entry_log_msg
- *
- * Purpose: Write a log message for moving a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_move_entry_log_msg(const H5AC_t *cache,
- haddr_t old_addr,
- haddr_t new_addr,
- int type_id,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"move\",\
-\"old_address\":0x%lx,\
-\"new_address\":0x%lx,\
-\"type_id\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)old_addr,
- (unsigned long)new_addr, type_id, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_move_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_pin_entry_log_msg
- *
- * Purpose: Write a log message for pinning a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_pin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"pin\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_pin_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_create_fd_log_msg
- *
- * Purpose: Write a log message for creating a flush dependency between
- * two cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_create_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(parent);
- HDassert(child);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"create_fd\",\
-\"parent_addr\":0x%lx,\
-\"child_addr\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_create_fd_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_protect_entry_log_msg
- *
- * Purpose: Write a log message for protecting a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_protect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- unsigned flags,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- char rw_s[16];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- if(H5AC__READ_ONLY_FLAG == flags)
- HDstrcpy(rw_s, "READ");
- else
- HDstrcpy(rw_s, "WRITE");
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"protect\",\
-\"address\":0x%lx,\
-\"readwrite\":\"%s\",\
-\"size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- rw_s, (int)entry->size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_protect_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_resize_entry_log_msg
- *
- * Purpose: Write a log message for resizing a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_resize_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- size_t new_size,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"resize\",\
-\"address\":0x%lx,\
-\"new_size\":%d,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)new_size, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_resize_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_unpin_entry_log_msg
- *
- * Purpose: Write a log message for unpinning a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_unpin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unpin\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_unpin_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_destroy_fd_log_msg
- *
- * Purpose: Write a log message for destroying a flush dependency
- * between two cache entries.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_destroy_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(parent);
- HDassert(child);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"destroy_fd\",\
-\"parent_addr\":0x%lx,\
-\"child_addr\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)parent->addr,
- (unsigned long)child->addr, (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_destroy_fd_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_unprotect_entry_log_msg
- *
- * Purpose: Write a log message for unprotecting a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- int type_id,
- unsigned flags,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"unprotect\",\
-\"address\":0x%lx,\
-\"id\":%d,\
-\"flags\":%x,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- type_id, flags, (int)fxn_ret_value);
-
- HDsnprintf(msg, MSG_SIZE, " ");
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_unprotect_entry_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_set_cache_config_log_msg
- *
- * Purpose: Write a log message for setting the cache configuration.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_set_cache_config_log_msg(const H5AC_t *cache,
- const H5AC_cache_config_t *config,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(config);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"set_config\",\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (int)fxn_ret_value);
-
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_set_cache_config_log_msg() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5AC__write_remove_entry_log_msg
- *
- * Purpose: Write a log message for removing a cache entry.
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * September 17, 2016
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5AC__write_remove_entry_log_msg(const H5AC_t *cache, const H5AC_info_t *entry,
- herr_t fxn_ret_value)
-{
- char msg[MSG_SIZE];
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* Sanity checks */
- HDassert(cache);
- HDassert(entry);
-
- /* Create the log message string */
- HDsnprintf(msg, MSG_SIZE,
-"\
-{\
-\"timestamp\":%lld,\
-\"action\":\"remove\",\
-\"address\":0x%lx,\
-\"returned\":%d\
-},\n\
-"
- , (long long)HDtime(NULL), (unsigned long)entry->addr,
- (int)fxn_ret_value);
-
- /* Write the log message to the file */
- if(H5C_write_log_message(cache, msg) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "unable to emit log message")
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5AC__write_remove_entry_log_msg() */
-
diff --git a/src/H5ACpkg.h b/src/H5ACpkg.h
index 9bf84bf..8997382 100644
--- a/src/H5ACpkg.h
+++ b/src/H5ACpkg.h
@@ -433,74 +433,5 @@ H5_DLL herr_t H5AC__set_write_done_callback(H5C_t * cache_ptr,
void (* write_done)(void));
#endif /* H5_HAVE_PARALLEL */
-/* Trace file routines */
-H5_DLL herr_t H5AC__close_trace_file(H5AC_t *cache_ptr);
-H5_DLL herr_t H5AC__open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name);
-
-/* Cache logging routines */
-H5_DLL herr_t H5AC__write_create_cache_log_msg(H5AC_t *cache);
-H5_DLL herr_t H5AC__write_destroy_cache_log_msg(H5AC_t *cache);
-H5_DLL herr_t H5AC__write_evict_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_expunge_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_flush_cache_log_msg(const H5AC_t *cache,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_insert_entry_log_msg(const H5AC_t *cache,
- haddr_t address,
- int type_id,
- unsigned flags,
- size_t size,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_dirty_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_clean_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_unserialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_mark_serialized_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry, herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_move_entry_log_msg(const H5AC_t *cache,
- haddr_t old_addr,
- haddr_t new_addr,
- int type_id,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_pin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_create_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_protect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- unsigned flags,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_resize_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- size_t new_size,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_unpin_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_destroy_fd_log_msg(const H5AC_t *cache,
- const H5AC_info_t *parent,
- const H5AC_info_t *child,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_unprotect_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- int type_id,
- unsigned flags,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_set_cache_config_log_msg(const H5AC_t *cache,
- const H5AC_cache_config_t *config,
- herr_t fxn_ret_value);
-H5_DLL herr_t H5AC__write_remove_entry_log_msg(const H5AC_t *cache,
- const H5AC_info_t *entry,
- herr_t fxn_ret_value);
-
#endif /* _H5ACpkg_H */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 99cc0e9..7d2d4ad 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -35,12 +35,6 @@
#include "H5Pprivate.h" /* Property lists */
#include "H5SLprivate.h" /* Skip lists */
-#ifdef H5_METADATA_TRACE_FILE
-#define H5AC__TRACE_FILE_ENABLED 1
-#else /* H5_METADATA_TRACE_FILE */
-#define H5AC__TRACE_FILE_ENABLED 0
-#endif /* H5_METADATA_TRACE_FILE */
-
/* Global metadata tag values */
#define H5AC__INVALID_TAG (haddr_t)0
#define H5AC__IGNORE_TAG (haddr_t)1
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 3701022..40a7a9a 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -302,20 +302,51 @@ static herr_t
H5A__dense_fnd_cb(const H5A_t *attr, hbool_t *took_ownership, void *_user_attr)
{
H5A_t const **user_attr = (H5A_t const **)_user_attr; /* User data from v2 B-tree attribute lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/*
* Check arguments.
*/
HDassert(attr);
HDassert(user_attr);
+ HDassert(took_ownership);
+ /*
+ * If there is an attribute already stored in "user_attr",
+ * we need to free the dynamially allocated spaces for the
+ * attribute, otherwise we got infinite loop closing library due to
+ * outstanding allocation. (HDFFV-10659)
+ *
+ * This callback is used by H5A__dense_remove() to close/free the
+ * attribute stored in "user_attr" (via H5O__msg_free_real()) after
+ * the attribute node is deleted from the name index v2 B-tree.
+ * The issue is:
+ * When deleting the attribute node from the B-tree,
+ * if the attribute is found in the intermediate B-tree nodes,
+ * which may be merged/redistributed, we need to free the dynamically
+ * allocated spaces for the intermediate decoded attribute.
+ */
+ if(*user_attr != NULL) {
+ H5A_t *old_attr = *user_attr;
+ if(old_attr->shared) {
+ /* Free any dynamically allocated items */
+ if(H5A__free(old_attr) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't release attribute info")
+
+ /* Destroy shared attribute struct */
+ old_attr->shared = H5FL_FREE(H5A_shared_t, old_attr->shared);
+ } /* end if */
+
+ old_attr = H5FL_FREE(H5A_t, old_attr);
+ } /* end if */
/* Take over attribute ownership */
*user_attr = attr;
*took_ownership = TRUE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__dense_fnd_cb() */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 9b592b0..99c1c0c 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -340,7 +340,7 @@ H5Aget_num_attrs(hid_t loc_id)
} /*lint !e788 All appropriate cases are covered */
/* Look up the # of attributes for the object */
- if((ret_value = H5A__get_num_attrs(loc)) < 0)
+ if((ret_value = H5O__attr_count(loc)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 55560c7..807c67e 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -87,8 +87,6 @@ typedef struct {
/* Local Prototypes */
/********************/
-static H5A_t *H5A__create_common(const H5G_loc_t *loc, const char *name,
- const H5T_t *type, const H5S_t *space, hid_t acpl_id);
static herr_t H5A__open_common(const H5G_loc_t *loc, H5A_t *attr);
static herr_t H5A__compact_build_table_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/,
unsigned sequence, unsigned *oh_flags_ptr, void *_udata/*in,out*/);
@@ -127,7 +125,7 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
/*-------------------------------------------------------------------------
- * Function: H5A__create_common
+ * Function: H5A__create
*
* Purpose: This is the guts of creating an attribute.
*
@@ -138,8 +136,8 @@ H5FL_SEQ_DEFINE(H5A_t_ptr);
*
*-------------------------------------------------------------------------
*/
-static H5A_t *
-H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
+H5A_t *
+H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
const H5S_t *space, hid_t acpl_id)
{
H5A_t *attr = NULL; /* Attribute created */
@@ -148,7 +146,7 @@ H5A__create_common(const H5G_loc_t *loc, const char *name, const H5T_t *type,
htri_t exists; /* Whether attribute exists */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_STATIC_TAG(loc->oloc->addr)
+ FUNC_ENTER_PACKAGE_TAG(loc->oloc->addr)
/* Check args */
HDassert(loc);
@@ -285,45 +283,6 @@ done:
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* H5A__create_common() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5A__create
- *
- * Purpose: Entry point for creating attribute on an object
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Attribute structure on success, NULL on Failure.
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5A_t *
-H5A__create(const H5G_loc_t *loc, const char *name, const H5T_t *type,
- const H5S_t *space, hid_t acpl_id)
-{
- H5A_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check args */
- HDassert(loc);
- HDassert(name);
- HDassert(type);
- HDassert(space);
-
- /* Go do the real work for attaching the attribute to the object */
- if(NULL == (ret_value = H5A__create_common(loc, name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCREATE, NULL, "unable to create attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* H5A__create() */
@@ -350,7 +309,7 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -368,8 +327,8 @@ H5A__create_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
loc_found = TRUE;
/* Go do the real work for attaching the attribute to the object */
- if(NULL == (attr = H5A__create_common(&obj_loc, attr_name, type, space, acpl_id)))
- HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
+ if(NULL == (attr = H5A__create(&obj_loc, attr_name, type, space, acpl_id)))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, NULL, "unable to create attribute")
/* Set return value */
ret_value = attr;
@@ -384,7 +343,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__create_by_name() */
@@ -450,10 +409,6 @@ done:
*
* Purpose: Open an attribute in an object header
*
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
@@ -467,7 +422,7 @@ H5A__open(const H5G_loc_t *loc, const char *attr_name)
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -490,7 +445,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open() */
@@ -517,7 +472,7 @@ H5A__open_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -554,7 +509,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_idx() */
@@ -580,7 +535,7 @@ H5A__open_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_n
H5A_t *attr = NULL; /* Attribute from object header */
H5A_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* check args */
HDassert(loc);
@@ -618,7 +573,7 @@ done:
if(attr && H5A__close(attr) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, NULL, "can't close attribute")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__open_by_name() */
@@ -652,7 +607,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)
size_t buf_size; /* desired buffer size */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
HDassert(attr);
HDassert(mem_type);
@@ -721,7 +676,7 @@ done:
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__read() */
@@ -756,7 +711,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
size_t buf_size; /* desired buffer size */
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL_TAG(attr->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(attr->oloc.addr)
HDassert(attr);
HDassert(mem_type);
@@ -835,7 +790,7 @@ done:
if(bkg_buf)
bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5A__write() */
@@ -939,7 +894,7 @@ H5A__get_type(H5A_t *attr)
H5T_t *dt = NULL;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(attr);
@@ -970,7 +925,7 @@ done:
if(H5I_INVALID_HID == ret_value && dt && (H5T_close(dt) < 0))
HDONE_ERROR(H5E_ATTR, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release datatype")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__get_type() */
@@ -1192,7 +1147,7 @@ H5A__close_cb(H5A_t *attr)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(attr);
@@ -1203,7 +1158,7 @@ H5A__close_cb(H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTCLOSEOBJ, FAIL, "problem closing attribute")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5A__close_cb() */
@@ -1355,39 +1310,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__exists
- *
- * Purpose: Private version of H5Aexists
- *
- * Note: This routine is needed so that there's a non-API routine for
- * detecting attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: TRUE/FALSE
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5A__exists(const H5G_loc_t *loc, const char *name)
-{
- htri_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check if the attribute exists */
- if((ret_value = H5O__attr_exists(loc->oloc, name)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__exists() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A__exists_by_name
*
* Purpose: Private version of H5Aexists_by_name
@@ -1409,7 +1331,7 @@ H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name)
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -1430,7 +1352,7 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__exists_by_name() */
@@ -2599,39 +2521,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5A__rename
- *
- * Purpose: Private version of H5Arename
- *
- * Note: This routine is needed so that there's a non-API routine for
- * renaming attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5A__rename(const H5G_loc_t *loc, const char *old_name, const char *new_name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Call object header attribute rename routine */
- if(H5O__attr_rename(loc->oloc, old_name, new_name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__rename() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A__rename_by_name
*
* Purpose: Private version of H5Arename_by_name
@@ -2654,7 +2543,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -2675,44 +2564,9 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__rename_by_name() */
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-
-/*-------------------------------------------------------------------------
- * Function: H5A__get_num_attrs
- *
- * Purpose: Private version of deprecated H5Aget_num_attrs
- *
- * Note: This routine is needed so that there's a non-API routine for
- * querying the attribute count that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-int
-H5A__get_num_attrs(const H5O_loc_t *loc)
-{
- int ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Look up the # of attributes for the object */
- if((ret_value = H5O__attr_count(loc)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__get_num_attrs() */
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
/*-------------------------------------------------------------------------
* Function: H5A__iterate_common
@@ -2755,10 +2609,6 @@ H5A__iterate_common(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
*
* Purpose: Private version of H5Aiterate2
*
- * Note: This routine is needed so that there's a non-API routine for
- * iterating over attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -2774,7 +2624,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
H5A_attr_iter_op_t attr_op; /* Attribute operator */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP2;
@@ -2785,7 +2635,7 @@ H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate() */
#ifndef H5_NO_DEPRECATED_SYMBOLS
@@ -2811,7 +2661,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
hsize_t idx; /* Index of attribute to start iterating at */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Build attribute operator info */
attr_op.op_type = H5A_ATTR_OP_APP;
@@ -2829,7 +2679,7 @@ H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op,
*attr_num = (unsigned)idx;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_old() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -2839,10 +2689,6 @@ done:
*
* Purpose: Private version of H5Aiterate_by_name
*
- * Note: This routine is needed so that there's a non-API routine for
- * iterating over attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -2863,7 +2709,7 @@ H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_
H5A_attr_iter_op_t attr_op; /* Attribute operator */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -2896,44 +2742,11 @@ done:
else if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__iterate_by_name() */
/*-------------------------------------------------------------------------
- * Function: H5A__delete
- *
- * Purpose: Private version of H5Adelete
- *
- * Note: This routine is needed so that there's a non-API routine for
- * deleting attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 6, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5A__delete(const H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Call object header attribute delete attribute routine */
- if(H5O__attr_remove(loc->oloc, name) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5A__delete() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5A__delete_by_name
*
* Purpose: Private version of H5Adelete_by_name
@@ -2955,7 +2768,7 @@ H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -2976,7 +2789,7 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_name() */
@@ -3003,7 +2816,7 @@ H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_ty
hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -3024,6 +2837,6 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_ATTR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5A__delete_by_idx() */
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index af16b55..0bb6d8f 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -200,13 +200,8 @@ H5_DLL herr_t H5A__close(H5A_t *attr);
H5_DLL herr_t H5A__close_cb(H5A_t *attr);
H5_DLL htri_t H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo);
H5_DLL herr_t H5A__set_version(const H5F_t *f, H5A_t *attr);
-H5_DLL herr_t H5A__rename(const H5G_loc_t *loc, const char *old_name,
- const char *new_name);
H5_DLL herr_t H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_name,
const char *new_attr_name);
-#ifndef H5_NO_DEPRECATED_SYMBOLS
-H5_DLL int H5A__get_num_attrs(const H5O_loc_t *loc);
-#endif /* H5_NO_DEPRECATED_SYMBOLS */
H5_DLL herr_t H5A__iterate(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx, H5A_operator2_t op, void *op_data);
H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name,
@@ -216,12 +211,10 @@ H5_DLL herr_t H5A__iterate_by_name(const H5G_loc_t *loc, const char *obj_name,
H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num,
H5A_operator1_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5A__delete(const H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name,
const char *attr_name);
H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL htri_t H5A__exists(const H5G_loc_t *loc, const char *name);
H5_DLL htri_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name);
H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
diff --git a/src/H5B2private.h b/src/H5B2private.h
index 83a5272..0b64381 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -25,9 +25,6 @@
#ifndef _H5B2private_H
#define _H5B2private_H
-/* Include package's public header */
-#include "H5B2public.h"
-
/* Private headers needed by this file */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Fprivate.h" /* File access */
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index e203b87..5aa3628 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -27,7 +27,6 @@
#ifndef _H5Bprivate_H
#define _H5Bprivate_H
-#include "H5Bpublic.h" /*API prototypes */
/* Private headers needed by this file */
#include "H5private.h" /* Generic Functions */
diff --git a/src/H5C.c b/src/H5C.c
index c4d4eed..288f3db 100644
--- a/src/H5C.c
+++ b/src/H5C.c
@@ -282,13 +282,8 @@ H5C_create(size_t max_cache_size,
cache_ptr->flush_in_progress = FALSE;
- cache_ptr->logging_enabled = FALSE;
-
- cache_ptr->currently_logging = FALSE;
-
- cache_ptr->log_file_ptr = NULL;
-
- cache_ptr->trace_file_ptr = NULL;
+ if(NULL == (cache_ptr->log_info = (H5C_log_info_t *)H5MM_calloc(sizeof(H5C_log_info_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed")
cache_ptr->aux_ptr = aux_ptr;
@@ -332,6 +327,7 @@ H5C_create(size_t max_cache_size,
/* Tagging Field Initializations */
cache_ptr->ignore_tags = FALSE;
+ cache_ptr->num_objs_corked = 0;
cache_ptr->slist_changed = FALSE;
cache_ptr->slist_len = 0;
@@ -493,6 +489,9 @@ done:
if(cache_ptr->tag_list != NULL)
H5SL_close(cache_ptr->tag_list);
+ if(cache_ptr->log_info != NULL)
+ H5MM_xfree(cache_ptr->log_info);
+
cache_ptr->magic = 0;
cache_ptr = H5FL_FREE(H5C_t, cache_ptr);
} /* end if */
@@ -865,6 +864,9 @@ H5C_dest(H5F_t * f)
cache_ptr->tag_list = NULL;
} /* end if */
+ if(cache_ptr->log_info != NULL)
+ H5MM_xfree(cache_ptr->log_info);
+
#ifndef NDEBUG
#if H5C_DO_SANITY_CHECKS
if(cache_ptr->get_entry_ptr_from_addr_counter > 0)
@@ -1481,31 +1483,17 @@ H5C_insert_entry(H5F_t * f,
H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr)
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
-
- /* If not explicitly disabled, get the cmdr setting from the API context */
- if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read)
- coll_access = H5CX_get_coll_metadata_read();
- } /* end if */
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ coll_access = H5CX_get_coll_metadata_read();
entry_ptr->coll_access = coll_access;
if(coll_access) {
H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL)
/* Make sure the size of the collective entries in the cache remain in check */
- if(H5P_USER_TRUE == f->coll_md_read) {
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) {
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
- } /* end if */
- } /* end if */
- else {
- if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) {
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
- } /* end if */
- } /* end else */
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries")
} /* end if */
#endif
@@ -2241,13 +2229,8 @@ H5C_protect(H5F_t * f,
ring = H5CX_get_ring();
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE);
-
- /* If not explicitly disabled, get the cmdr setting from the API context */
- if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read)
- coll_access = H5CX_get_coll_metadata_read();
- } /* end if */
+ if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI))
+ coll_access = H5CX_get_coll_metadata_read();
#endif /* H5_HAVE_PARALLEL */
/* first check to see if the target is in cache */
@@ -2284,7 +2267,7 @@ H5C_protect(H5F_t * f,
the entry in their cache still have to participate in the
bcast. */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access) {
+ if(coll_access) {
if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) {
MPI_Comm comm; /* File MPI Communicator */
int mpi_code; /* MPI error code */
@@ -2599,21 +2582,11 @@ H5C_protect(H5F_t * f,
} /* end if */
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) {
- /* Make sure the size of the collective entries in the cache remain in check */
- if(coll_access) {
- if(H5P_USER_TRUE == f->coll_md_read) {
- if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
- } /* end if */
- else {
- if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100)
- if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
- } /* end else */
- } /* end if */
- } /* end if */
+ /* Make sure the size of the collective entries in the cache remain in check */
+ if(coll_access)
+ if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100)
+ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries")
#endif /* H5_HAVE_PARALLEL */
done:
@@ -7731,6 +7704,8 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = TRUE;
+ cache_ptr->num_objs_corked++;
+
} /* end if */
else {
/* Sanity check */
@@ -7742,6 +7717,7 @@ H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked)
/* Set the corked status for the entire object */
tag_info->corked = FALSE;
+ cache_ptr->num_objs_corked--;
/* Remove the tag info from the tag list, if there's no more entries with this tag */
if(0 == tag_info->entry_cnt) {
diff --git a/src/H5CX.c b/src/H5CX.c
index f809d1c..6b5e510 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -198,6 +198,7 @@ typedef struct H5CX_t {
MPI_Datatype btype; /* MPI datatype for buffer, when using collective I/O */
MPI_Datatype ftype; /* MPI datatype for file, when using collective I/O */
hbool_t mpi_file_flushing; /* Whether an MPI-opened file is being flushed */
+ hbool_t rank0_bcast; /* Whether a dataset meets read-with-rank0-and-bcast requirements */
#endif /* H5_HAVE_PARALLEL */
/* Cached DXPL properties */
@@ -261,6 +262,8 @@ typedef struct H5CX_t {
hbool_t mpio_coll_chunk_multi_ratio_coll_set; /* Whether instrumented "collective chunk multi ratio coll" value is set */
int mpio_coll_chunk_multi_ratio_ind; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
hbool_t mpio_coll_chunk_multi_ratio_ind_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
+ hbool_t mpio_coll_rank0_bcast; /* Instrumented "collective chunk multi ratio ind" value (H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME) */
+ hbool_t mpio_coll_rank0_bcast_set; /* Whether instrumented "collective chunk multi ratio ind" value is set */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
@@ -804,8 +807,8 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
#ifdef H5_HAVE_PARALLEL
/* If this routine is not guaranteed to be collective (i.e. it doesn't
- * modify the structural metadata in a file), check if we should use
- * a collective metadata read.
+ * modify the structural metadata in a file), check if the application
+ * specified a collective metadata read for just this operation.
*/
if(!is_collective) {
H5P_genplist_t *plist; /* Property list pointer */
@@ -1106,6 +1109,32 @@ H5CX_get_mpi_file_flushing(void)
FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
} /* end H5CX_get_mpi_file_flushing() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_get_mpio_rank0_bcast
+ *
+ * Purpose: Retrieves if the dataset meets read-with-rank0-and-bcast requirements for the current API call context.
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: M. Breitenfeld
+ * December 31, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5CX_get_mpio_rank0_bcast(void)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(head && *head);
+
+ FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast)
+} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -2037,6 +2066,34 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
FUNC_LEAVE_NOAPI_VOID
} /* end H5CX_set_mpi_file_flushing() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_set_mpio_rank0_bcast
+ *
+ * Purpose: Sets the "dataset meets read-with-rank0-and-bcast requirements" flag for the current API call context.
+ *
+ * Return: <none>
+ *
+ * Programmer: M. Breitenfeld
+ * December 31, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity checks */
+ HDassert(head && *head);
+
+ (*head)->ctx.rank0_bcast = rank0_bcast;
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5CX_set_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -2448,6 +2505,40 @@ H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_in
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_test_set_mpio_coll_chunk_multi_ratio_ind() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5CX_test_set_mpio_coll_rank0_bcast
+ *
+ * Purpose: Sets the instrumented "read-with-rank0-bcast" flag for the current API call context.
+ *
+ * Note: Only sets value if property set in DXPL
+ *
+ * Return: Non-negative on success / Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * January 2, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast)
+{
+ H5CX_node_t **head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI_NOINIT
+
+ /* Sanity checks */
+ HDassert(head && *head);
+ HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT ||
+ (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
+
+ H5CX_TEST_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast)
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5CX_test_set_mpio_coll_rank0_bcast() */
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
@@ -2488,6 +2579,7 @@ H5CX__pop_common(void)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_LINK_NUM_FALSE_NAME, mpio_coll_chunk_link_num_false)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME, mpio_coll_chunk_multi_ratio_coll)
H5CX_SET_PROP(H5D_XFER_COLL_CHUNK_MULTI_RATIO_IND_NAME, mpio_coll_chunk_multi_ratio_ind)
+ H5CX_SET_PROP(H5D_XFER_COLL_RANK0_BCAST_NAME, mpio_coll_rank0_bcast)
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h
index 44a4067..a091292 100644
--- a/src/H5CXprivate.h
+++ b/src/H5CXprivate.h
@@ -73,6 +73,7 @@ H5_DLL H5AC_ring_t H5CX_get_ring(void);
H5_DLL hbool_t H5CX_get_coll_metadata_read(void);
H5_DLL herr_t H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype);
H5_DLL hbool_t H5CX_get_mpi_file_flushing(void);
+H5_DLL hbool_t H5CX_get_mpio_rank0_bcast(void);
#endif /* H5_HAVE_PARALLEL */
/* "Getter" routines for DXPL properties cached in API context */
@@ -108,6 +109,7 @@ H5_DLL void H5CX_set_coll_metadata_read(hbool_t cmdr);
H5_DLL herr_t H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype);
H5_DLL herr_t H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt);
H5_DLL void H5CX_set_mpi_file_flushing(hbool_t flushing);
+H5_DLL void H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_PARALLEL */
/* "Setter" routines for DXPL properties cached in API context */
@@ -133,6 +135,7 @@ H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_li
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false);
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll);
H5_DLL herr_t H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind);
+H5_DLL herr_t H5CX_test_set_mpio_coll_rank0_bcast(hbool_t rank0_bcast);
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Cdbg.c b/src/H5Cdbg.c
index 08c70d9..1f55e86 100644
--- a/src/H5Cdbg.c
+++ b/src/H5Cdbg.c
@@ -476,42 +476,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5C_set_trace_file_ptr
- *
- * Purpose: Set the trace_file_ptr field for the cache.
- *
- * This field must either be NULL (which turns of trace
- * file logging), or be a pointer to an open file to which
- * trace file data is to be written.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: John Mainzer
- * 1/20/06
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5C_set_trace_file_ptr(H5C_t * cache_ptr, FILE * trace_file_ptr)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- /* This would normally be an assert, but we need to use an HGOTO_ERROR
- * call to shut up the compiler.
- */
- if((NULL == cache_ptr) || (cache_ptr->magic != H5C__H5C_T_MAGIC))
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr")
-
- cache_ptr->trace_file_ptr = trace_file_ptr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_set_trace_file_ptr() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_stats
*
* Purpose: Prints statistics about the cache.
diff --git a/src/H5Cimage.c b/src/H5Cimage.c
index 26b6506..298a2dd 100644
--- a/src/H5Cimage.c
+++ b/src/H5Cimage.c
@@ -1065,9 +1065,9 @@ H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr)
H5C__UPDATE_STATS_FOR_CACHE_IMAGE_READ(cache_ptr)
#ifdef H5_HAVE_PARALLEL
- if ( aux_ptr ) {
+ if ( aux_ptr ) {
- /* Broadcast cache image */
+ /* Broadcast cache image */
if ( MPI_SUCCESS !=
(mpi_result = MPI_Bcast(cache_ptr->image_buffer,
(int)cache_ptr->image_len, MPI_BYTE,
diff --git a/src/H5Clog.c b/src/H5Clog.c
index 3353619..cf9b7e8 100644
--- a/src/H5Clog.c
+++ b/src/H5Clog.c
@@ -13,11 +13,9 @@
/*-------------------------------------------------------------------------
*
- * Created: H5Clog.c
- * May 30 2016
- * Quincey Koziol
+ * Created: H5Clog.c
*
- * Purpose: Functions for generic cache logging in JSON format
+ * Purpose: Functions for metadata cache logging
*
*-------------------------------------------------------------------------
*/
@@ -30,14 +28,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#ifdef H5_HAVE_PARALLEL
-#define H5AC_FRIEND /*suppress error about including H5ACpkg */
-#include "H5ACpkg.h" /* Metadata cache */
-#endif /* H5_HAVE_PARALLEL */
-#include "H5Cpkg.h" /* Metadata cache */
-#include "H5Eprivate.h" /* Error handling */
-#include "H5MMprivate.h" /* Memory management */
+#include "H5private.h" /* Generic Functions */
+#define H5AC_FRIEND /* Suppress error about including H5ACpkg */
+#include "H5ACpkg.h" /* Metadata cache */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
/****************/
@@ -77,133 +73,109 @@
/*-------------------------------------------------------------------------
- * Function: H5C_set_up_logging
+ * Function: H5C_log_set_up
*
* Purpose: Setup for metadata cache logging.
*
- * Metadata logging is enabled and disabled at two levels. This
- * function and the associated tear_down function open and close
- * the log file. the start_ and stop_logging functions are then
- * used to switch logging on/off. Optionally, logging can begin
- * as soon as the log file is opened (set via the start_immediately
- * parameter to this function).
- *
- * The log functionality is split between the H5C and H5AC
- * packages. Log state and direct log manipulation resides in
- * H5C. Log messages are generated in H5AC and sent to
- * the H5C_write_log_message function.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[],
- hbool_t start_immediately)
+H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately)
{
-#ifdef H5_HAVE_PARALLEL
- H5AC_aux_t *aux_ptr = NULL;
-#endif /*H5_HAVE_PARALLEL*/
- char *file_name = NULL;
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ int mpi_rank = -1; /* -1 indicates serial (no MPI rank) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already set up")
- if(NULL == log_location)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log location not allowed")
-
- /* Possibly fix up the log file name.
- * The extra 39 characters are for adding the rank to the file name
- * under parallel HDF5. 39 characters allows > 2^127 processes which
- * should be enough for anybody.
- *
- * allocation size = <path length> + dot + <rank # length> + \0
- */
- n_chars = HDstrlen(log_location) + 1 + 39 + 1;
- if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+ HDassert(cache);
+ HDassert(log_location);
+ /* Check logging flags */
+ if(cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging already set up")
+
+ /* Get the rank when MPI is in use. Logging clients will usually
+ * use that to create per-process logs.
+ */
#ifdef H5_HAVE_PARALLEL
- /* Add the rank to the log file name when MPI is in use */
- aux_ptr = (H5AC_aux_t *)(cache_ptr->aux_ptr);
-
- if(NULL == aux_ptr)
- HDsnprintf(file_name, n_chars, "%s", log_location);
- else {
- if(aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr->magic")
- HDsnprintf(file_name, n_chars, "%s.%d", log_location, aux_ptr->mpi_rank);
- } /* end else */
-#else /* H5_HAVE_PARALLEL */
- HDsnprintf(file_name, n_chars, "%s", log_location);
-#endif /* H5_HAVE_PARALLEL */
-
- /* Open log file */
- if(NULL == (cache_ptr->log_file_ptr = HDfopen(file_name, "w")))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "can't create mdc log file")
+ if(NULL != cache->aux_ptr)
+ mpi_rank = ((H5AC_aux_t *)(cache->aux_ptr))->mpi_rank;
+#endif /*H5_HAVE_PARALLEL*/
+
+ /* Set up logging */
+ if(H5C_LOG_STYLE_JSON == style) {
+ if(H5C_log_json_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up json logging")
+ }
+ else if(H5C_LOG_STYLE_TRACE == style) {
+ if(H5C_log_trace_set_up(cache->log_info, log_location, mpi_rank) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to set up trace logging")
+ }
+ else
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unknown logging style")
/* Set logging flags */
- cache_ptr->logging_enabled = TRUE;
- cache_ptr->currently_logging = start_immediately;
+ cache->log_info->enabled = TRUE;
+
+ /* Start logging if requested */
+ if(start_immediately)
+ if(H5C_start_logging(cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to start logging")
done:
- if(file_name)
- file_name = (char *)H5MM_xfree(file_name);
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_set_up_logging() */
+} /* H5C_log_set_up() */
/*-------------------------------------------------------------------------
- * Function: H5C_tear_down_logging
+ * Function: H5C_log_tear_down
*
* Purpose: Tear-down for metadata cache logging.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_tear_down_logging(H5C_t *cache_ptr)
+H5C_log_tear_down(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
+ HDassert(cache);
- /* Unset logging flags */
- cache_ptr->logging_enabled = FALSE;
- cache_ptr->currently_logging = FALSE;
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
- /* Close log file */
- if(EOF == HDfclose(cache_ptr->log_file_ptr))
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "problem closing mdc log file")
- cache_ptr->log_file_ptr = NULL;
+ /* Stop logging if that's going on */
+ if(cache->log_info->logging)
+ if(H5C_stop_logging(cache) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to stop logging")
+
+ /* Tear down logging */
+ if(cache->log_info->cls->tear_down_logging)
+ if(cache->log_info->cls->tear_down_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific tear down call failed")
+
+ /* Unset logging flags */
+ cache->log_info->enabled = FALSE;
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_tear_down_logging() */
+} /* H5C_log_tear_down() */
/*-------------------------------------------------------------------------
@@ -211,37 +183,39 @@ H5C_tear_down_logging(H5C_t *cache_ptr)
*
* Purpose: Start logging metadata cache operations.
*
- * TODO: Add a function that dumps the current state of the
- * metadata cache.
+ * Return: SUCCEED/FAIL
*
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_start_logging(H5C_t *cache_ptr)
+H5C_start_logging(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
- if(cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging already in progress")
+ HDassert(cache);
+
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
+
+ /* Start logging */
+ if(cache->log_info->cls->start_logging)
+ if(cache->log_info->cls->start_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific start call failed")
/* Set logging flags */
- cache_ptr->currently_logging = TRUE;
+ cache->log_info->logging = TRUE;
- /* TODO - Dump cache state */
+ /* Write a log message */
+ if(cache->log_info->cls->write_start_log_msg)
+ if(cache->log_info->cls->write_start_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write start call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -253,32 +227,41 @@ H5C_start_logging(H5C_t *cache_ptr)
*
* Purpose: Stop logging metadata cache operations.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_stop_logging(H5C_t *cache_ptr)
+H5C_stop_logging(H5C_t *cache)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->logging_enabled)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not enabled")
- if(FALSE == cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "logging not in progress")
+ HDassert(cache);
+
+ /* Check logging flags */
+ if(FALSE == cache->log_info->enabled)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not enabled")
+ if(FALSE == cache->log_info->logging)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "logging not in progress")
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_stop_log_msg)
+ if(cache->log_info->cls->write_stop_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write stop call failed")
+
+ /* Stop logging */
+ if(cache->log_info->cls->stop_logging)
+ if(cache->log_info->cls->stop_logging(cache->log_info) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific stop call failed")
/* Set logging flags */
- cache_ptr->currently_logging = FALSE;
+ cache->log_info->logging = FALSE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -289,80 +272,705 @@ H5C_stop_logging(H5C_t *cache_ptr)
* Function: H5C_get_logging_status
*
* Purpose: Determines if the cache is actively logging (via the OUT
- * parameter).
+ * parameters).
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled,
+H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled,
/*OUT*/ hbool_t *is_currently_logging)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Sanity checks */
+ HDassert(cache);
+ HDassert(is_enabled);
+ HDassert(is_currently_logging);
+
+ /* Get logging flags */
+ *is_enabled = cache->log_info->enabled;
+ *is_currently_logging = cache->log_info->logging;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5C_get_logging_status() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_create_cache_msg
+ *
+ * Purpose: Write a log message for cache creation.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(NULL == is_enabled)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(NULL == is_currently_logging)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
-
- *is_enabled = cache_ptr->logging_enabled;
- *is_currently_logging = cache_ptr->currently_logging;
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_create_cache_log_msg)
+ if(cache->log_info->cls->write_create_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write create cache call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_get_logging_status() */
+} /* H5C_log_write_create_cache_msg() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_destroy_cache_msg
+ *
+ * Purpose: Write a log message for cache destruction.
+ *
+ * NOTE: This can't print out the H5AC call return value, since we
+ * won't know that until the cache is destroyed and at that
+ * point we no longer have pointers to the logging information.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_destroy_cache_msg(H5C_t *cache)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_destroy_cache_log_msg)
+ if(cache->log_info->cls->write_destroy_cache_log_msg(cache->log_info->udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write destroy cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_destroy_cache_msg() */
/*-------------------------------------------------------------------------
- * Function: H5C_write_log_message
+ * Function: H5C_log_write_evict_cache_msg
*
- * Purpose: Write a message to the log file and flush the file.
- * The message string is neither modified nor freed.
+ * Purpose: Write a log message for eviction of cache entries.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: SUCCEED/FAIL
*
- * Programmer: Dana Robinson
- * Sunday, March 16, 2014
+ * Programmer: Dana Robinson
+ * Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
-H5C_write_log_message(const H5C_t *cache_ptr, const char message[])
+H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
{
- size_t n_chars;
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_evict_cache_log_msg)
+ if(cache->log_info->cls->write_evict_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write evict cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_evict_cache_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_expunge_entry_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
- if(NULL == cache_ptr)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache_ptr == NULL")
- if(H5C__H5C_T_MAGIC != cache_ptr->magic)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cache magic value incorrect")
- if(FALSE == cache_ptr->currently_logging)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "not currently logging")
- if(NULL == message)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL log message not allowed")
-
- /* Write the log message and flush */
- n_chars = HDstrlen(message);
- if((int)n_chars != HDfprintf(cache_ptr->log_file_ptr, message))
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error writing log message")
- if(EOF == HDfflush(cache_ptr->log_file_ptr))
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error flushing log message")
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_expunge_entry_log_msg)
+ if(cache->log_info->cls->write_expunge_entry_log_msg(cache->log_info->udata, address, type_id, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific write expunge entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_expunge_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_flush_cache_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_flush_cache_log_msg)
+ if(cache->log_info->cls->write_flush_cache_log_msg(cache->log_info->udata, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific flush cache call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_flush_cache_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_insert_entry_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_insert_entry_log_msg)
+ if(cache->log_info->cls->write_insert_entry_log_msg(cache->log_info->udata, address, type_id, flags, size, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific insert entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_insert_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_entry_dirty_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_entry_dirty_log_msg)
+ if(cache->log_info->cls->write_mark_entry_dirty_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark dirty entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_entry_dirty_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_entry_clean_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_entry_clean_log_msg)
+ if(cache->log_info->cls->write_mark_entry_clean_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark clean entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_entry_clean_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_unserialized_entry_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_unserialized_entry_log_msg)
+ if(cache->log_info->cls->write_mark_unserialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark unserialized entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_unserialized_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_mark_serialized_entry_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_mark_serialized_entry_log_msg)
+ if(cache->log_info->cls->write_mark_serialized_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific mark serialized entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_mark_serialized_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_move_entry_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_move_entry_log_msg)
+ if(cache->log_info->cls->write_move_entry_log_msg(cache->log_info->udata, old_addr, new_addr, type_id, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific move entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_move_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_pin_entry_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_pin_entry_log_msg)
+ if(cache->log_info->cls->write_pin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific pin entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_pin_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_create_fd_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(parent);
+ HDassert(child);
+ if(cache->log_info->cls->write_create_fd_log_msg)
+ if(cache->log_info->cls->write_create_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific create fd call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_create_fd_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_protect_entry_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_protect_entry_log_msg)
+ if(cache->log_info->cls->write_protect_entry_log_msg(cache->log_info->udata, entry, type_id, flags, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific protect entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_protect_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_resize_entry_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_resize_entry_log_msg)
+ if(cache->log_info->cls->write_resize_entry_log_msg(cache->log_info->udata, entry, new_size, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific resize entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_resize_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_unpin_entry_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_unpin_entry_log_msg)
+ if(cache->log_info->cls->write_unpin_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unpin entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_unpin_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_destroy_fd_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(parent);
+ HDassert(child);
+ if(cache->log_info->cls->write_destroy_fd_log_msg)
+ if(cache->log_info->cls->write_destroy_fd_log_msg(cache->log_info->udata, parent, child, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific destroy fd call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_destroy_fd_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_unprotect_entry_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ if(cache->log_info->cls->write_unprotect_entry_log_msg)
+ if(cache->log_info->cls->write_unprotect_entry_log_msg(cache->log_info->udata, address, type_id, flags, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific unprotect entry call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_unprotect_entry_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_set_cache_config_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(config);
+ if(cache->log_info->cls->write_set_cache_config_log_msg)
+ if(cache->log_info->cls->write_set_cache_config_log_msg(cache->log_info->udata, config, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific set cache config call failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_write_set_cache_config_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_write_remove_entry_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(cache);
+
+ /* Write a log message */
+ HDassert(entry);
+ if(cache->log_info->cls->write_remove_entry_log_msg)
+ if(cache->log_info->cls->write_remove_entry_log_msg(cache->log_info->udata, entry, fxn_ret_value) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "log-specific remove entry call failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5C_write_log_message() */
+} /* H5C_log_write_remove_entry_msg() */
diff --git a/src/H5Clog.h b/src/H5Clog.h
new file mode 100644
index 0000000..0235c4a
--- /dev/null
+++ b/src/H5Clog.h
@@ -0,0 +1,114 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Cache logging header file
+ */
+
+#ifndef _H5Clog_H
+#define _H5Clog_H
+
+/* Get package's private header */
+#include "H5Cprivate.h" /* Cache */
+
+/**************************/
+/* Package Private Macros */
+/**************************/
+
+/****************************/
+/* Package Private Typedefs */
+/****************************/
+
+/* Forward declaration for class struct */
+typedef struct H5C_log_info_t H5C_log_info_t;
+
+/* Class for generating logging messages */
+typedef struct H5C_log_class_t {
+ const char *name; /* String for debugging */
+
+ /* Callbacks for writing log messages */
+ herr_t (*tear_down_logging)(H5C_log_info_t *log_info);
+ herr_t (*start_logging)(H5C_log_info_t *log_info);
+ herr_t (*stop_logging)(H5C_log_info_t *log_info);
+ herr_t (*write_start_log_msg)(void *udata);
+ herr_t (*write_stop_log_msg)(void *udata);
+ herr_t (*write_create_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_destroy_cache_log_msg)(void *udata);
+ herr_t (*write_evict_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_expunge_entry_log_msg)(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+ herr_t (*write_flush_cache_log_msg)(void *udata, herr_t fxn_ret_value);
+ herr_t (*write_insert_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_dirty_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_entry_clean_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_unserialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_mark_serialized_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_move_entry_log_msg)(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+ herr_t (*write_pin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_create_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_protect_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_resize_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+ herr_t (*write_unpin_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+ herr_t (*write_destroy_fd_log_msg)(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+ herr_t (*write_unprotect_entry_log_msg)(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+ herr_t (*write_set_cache_config_log_msg)(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+ herr_t (*write_remove_entry_log_msg)(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+} H5C_log_class_t;
+
+/* Logging information */
+struct H5C_log_info_t {
+ hbool_t enabled; /* Was the logging set up? */
+ hbool_t logging; /* Are we currently logging? */
+ H5C_log_class_t *cls; /* Callbacks for writing log messages */
+ void *udata; /* Log-specific data */
+};
+
+
+/*****************************/
+/* Package Private Variables */
+/*****************************/
+
+
+/******************************/
+/* Package Private Prototypes */
+/******************************/
+H5_DLL herr_t H5C_log_set_up(H5C_t *cache, const char log_location[], H5C_log_style_t style, hbool_t start_immediately);
+H5_DLL herr_t H5C_log_tear_down(H5C_t *cache);
+
+H5_DLL herr_t H5C_log_write_create_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_destroy_cache_msg(H5C_t *cache);
+H5_DLL herr_t H5C_log_write_evict_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_expunge_entry_msg(H5C_t *cache, haddr_t address, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_flush_cache_msg(H5C_t *cache, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_insert_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_dirty_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_entry_clean_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_unserialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_mark_serialized_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_move_entry_msg(H5C_t *cache, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_pin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_create_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_protect_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_resize_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unpin_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_destroy_fd_msg(H5C_t *cache, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_unprotect_entry_msg(H5C_t *cache, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_set_cache_config_msg(H5C_t *cache, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+H5_DLL herr_t H5C_log_write_remove_entry_msg(H5C_t *cache, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+/* Logging-specific setup functions */
+H5_DLL herr_t H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
+H5_DLL herr_t H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank);
+
+#endif /* _H5Clog_H */
+
diff --git a/src/H5Clog_json.c b/src/H5Clog_json.c
new file mode 100644
index 0000000..dd9e9b2
--- /dev/null
+++ b/src/H5Clog_json.c
@@ -0,0 +1,1364 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Clog_json.c
+ *
+ * Purpose: Cache log implementation that emits JSON-formatted log
+ * entries for consumption by new-fangled data analysis tools.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Max log message size */
+#define H5C_MAX_JSON_LOG_MSG_SIZE 1024
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+typedef struct H5C_log_json_udata_t {
+ FILE *outfile;
+ char *message;
+} H5C_log_json_udata_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Internal message handling calls */
+static herr_t H5C__json_write_log_message(H5C_log_json_udata_t *json_udata);
+
+/* Log message callbacks */
+static herr_t H5C__json_tear_down_logging(H5C_log_info_t *log_info);
+static herr_t H5C__json_write_start_log_msg(void *udata);
+static herr_t H5C__json_write_stop_log_msg(void *udata);
+static herr_t H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_destroy_cache_log_msg(void *udata);
+static herr_t H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Note that there's no cache set up call since that's the
+ * place where this struct is wired into the cache.
+ */
+static H5C_log_class_t H5C_json_log_class_g = {
+ "json",
+ H5C__json_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ H5C__json_write_start_log_msg,
+ H5C__json_write_stop_log_msg,
+ H5C__json_write_create_cache_log_msg,
+ H5C__json_write_destroy_cache_log_msg,
+ H5C__json_write_evict_cache_log_msg,
+ H5C__json_write_expunge_entry_log_msg,
+ H5C__json_write_flush_cache_log_msg,
+ H5C__json_write_insert_entry_log_msg,
+ H5C__json_write_mark_entry_dirty_log_msg,
+ H5C__json_write_mark_entry_clean_log_msg,
+ H5C__json_write_mark_unserialized_entry_log_msg,
+ H5C__json_write_mark_serialized_entry_log_msg,
+ H5C__json_write_move_entry_log_msg,
+ H5C__json_write_pin_entry_log_msg,
+ H5C__json_write_create_fd_log_msg,
+ H5C__json_write_protect_entry_log_msg,
+ H5C__json_write_resize_entry_log_msg,
+ H5C__json_write_unpin_entry_log_msg,
+ H5C__json_write_destroy_fd_log_msg,
+ H5C__json_write_unprotect_entry_log_msg,
+ H5C__json_write_set_cache_config_log_msg,
+ H5C__json_write_remove_entry_log_msg
+};
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_log_message
+ *
+ * Purpose: Write a message to the log file and flush the file.
+ * The message string is neither modified nor freed.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
+{
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->outfile);
+ HDassert(json_udata->message);
+
+ /* Write the log message and flush */
+ n_chars = HDstrlen(json_udata->message);
+ if((int)n_chars != HDfprintf(json_udata->outfile, json_udata->message))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
+ HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_log_message() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_json_set_up
+ *
+ * Purpose: Setup for metadata cache logging.
+ *
+ * Metadata logging is enabled and disabled at two levels. This
+ * function and the associated tear_down function open and close
+ * the log file. the start_ and stop_logging functions are then
+ * used to switch logging on/off. Optionally, logging can begin
+ * as soon as the log file is opened (set via the start_immediately
+ * parameter to this function).
+ *
+ * The log functionality is split between the H5C and H5AC
+ * packages. Log state and direct log manipulation resides in
+ * H5C. Log messages are generated in H5AC and sent to
+ * the H5C__json_write_log_message function.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
+{
+ H5C_log_json_udata_t *json_udata = NULL;
+ char *file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(log_info);
+ HDassert(log_location);
+
+ /* Set up the class struct */
+ log_info->cls = &H5C_json_log_class_g;
+
+ /* Allocate memory for the JSON-specific data */
+ if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ json_udata = (H5C_log_json_udata_t *)(log_info->udata);
+
+ /* Allocate memory for the message buffer */
+ if(NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Possibly fix up the log file name.
+ * The extra 39 characters are for adding the rank to the file name
+ * under parallel HDF5. 39 characters allows > 2^127 processes which
+ * should be enough for anybody.
+ *
+ * allocation size = "RANK_" + <rank # length> + dot + <path length> + \0
+ */
+ n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1;
+ if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+
+ /* Add the rank to the log file name when MPI is in use */
+ if(-1 == mpi_rank)
+ HDsnprintf(file_name, n_chars, "%s", log_location);
+ else
+ HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
+
+ /* Open log file and set it to be unbuffered */
+ if(NULL == (json_udata->outfile = HDfopen(file_name, "w")))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
+ HDsetbuf(json_udata->outfile, NULL);
+
+ done:
+ if(file_name)
+ H5MM_xfree(file_name);
+
+ /* Free and reset the log info struct on errors */
+ if(FAIL == ret_value) {
+ /* Free */
+ if(json_udata && json_udata->message)
+ H5MM_xfree(json_udata->message);
+ if(json_udata)
+ H5MM_xfree(json_udata);
+
+ /* Reset */
+ log_info->udata = NULL;
+ log_info->cls = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_json_set_up() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_tear_down_logging
+ *
+ * Purpose: Tear-down for metadata cache logging.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_tear_down_logging(H5C_log_info_t *log_info)
+{
+ H5C_log_json_udata_t *json_udata = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(log_info);
+
+ /* Alias */
+ json_udata = (H5C_log_json_udata_t *)(log_info->udata);
+
+ /* Free the message buffer */
+ H5MM_xfree(json_udata->message);
+
+ /* Close log file */
+ if(EOF == HDfclose(json_udata->outfile))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
+ json_udata->outfile = NULL;
+
+ /* Fre the udata */
+ H5MM_xfree(json_udata);
+
+ /* Reset the log class info and udata */
+ log_info->cls = NULL;
+ log_info->udata = NULL;
+
+ done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_tear_down_logging() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_start_log_msg
+ *
+ * Purpose: Write a log message when logging starts.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_start_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string (opens the JSON array) */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\n\
+\"HDF5 metadata cache log messages\" : [\n\
+{\
+\"timestamp\":%lld,\
+\"action\":\"logging start\"\
+},\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_start_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_stop_log_msg
+ *
+ * Purpose: Write a log message when logging ends.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_stop_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string (closes the JSON array) */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"logging stop\"\
+}\n\
+]}\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_stop_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_create_cache_log_msg
+ *
+ * Purpose: Write a log message for cache creation.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"create\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_create_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_destroy_cache_log_msg
+ *
+ * Purpose: Write a log message for cache destruction.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_destroy_cache_log_msg(void *udata)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"destroy\"\
+},\n\
+"
+ , (long long)HDtime(NULL));
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_destroy_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_evict_cache_log_msg
+ *
+ * Purpose: Write a log message for eviction of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"evict\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_evict_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_expunge_entry_log_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"expunge\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
+
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_expunge_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_flush_cache_log_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"flush\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_flush_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_insert_entry_log_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"insert\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"flags\":0x%x,\
+\"size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address, type_id, flags,
+ (int)size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_insert_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_entry_dirty_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"dirty\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_entry_dirty_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_entry_clean_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"clean\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_entry_clean_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_unserialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_unserialized_entry_log_msg(void *udata,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unserialized\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_unserialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_mark_serialize_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"serialized\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_mark_serialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_move_entry_log_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"move\",\
+\"old_address\":0x%lx,\
+\"new_address\":0x%lx,\
+\"type_id\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)old_addr,
+ (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_move_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_pin_entry_log_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"pin\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_pin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_create_fd_log_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"create_fd\",\
+\"parent_addr\":0x%lx,\
+\"child_addr\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)parent->addr,
+ (unsigned long)child->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_create_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_protect_entry_log_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ char rw_s[16];
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ if(H5C__READ_ONLY_FLAG == flags)
+ HDstrcpy(rw_s, "READ");
+ else
+ HDstrcpy(rw_s, "WRITE");
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"protect\",\
+\"address\":0x%lx,\
+\"type_id\":%d,\
+\"readwrite\":\"%s\",\
+\"size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ type_id, rw_s, (int)entry->size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_protect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_resize_entry_log_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"resize\",\
+\"address\":0x%lx,\
+\"new_size\":%d,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)new_size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_resize_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_unpin_entry_log_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unpin\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_unpin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_destroy_fd_log_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"destroy_fd\",\
+\"parent_addr\":0x%lx,\
+\"child_addr\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)parent->addr,
+ (unsigned long)child->addr, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_destroy_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_unprotect_entry_log_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"unprotect\",\
+\"address\":0x%lx,\
+\"id\":%d,\
+\"flags\":%x,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)address,
+ type_id, flags, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_unprotect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_set_cache_config_log_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(config);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"set_config\",\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (int)fxn_ret_value);
+
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_set_cache_config_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__json_write_remove_entry_log_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(json_udata);
+ HDassert(json_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE,
+"\
+{\
+\"timestamp\":%lld,\
+\"action\":\"remove\",\
+\"address\":0x%lx,\
+\"returned\":%d\
+},\n\
+"
+ , (long long)HDtime(NULL), (unsigned long)entry->addr,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__json_write_log_message(json_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__json_write_remove_entry_log_msg() */
+
diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c
new file mode 100644
index 0000000..7c1305c
--- /dev/null
+++ b/src/H5Clog_trace.c
@@ -0,0 +1,1007 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5Clog_trace.c
+ *
+ * Purpose: Cache log implementation that emits trace entries intended
+ * for consumption by a future 'cache replay' feature.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+#include "H5Cmodule.h" /* This source code file is part of the H5C module */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Cpkg.h" /* Cache */
+#include "H5Clog.h" /* Cache logging */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5MMprivate.h" /* Memory management */
+
+
+/****************/
+/* Local Macros */
+/****************/
+
+/* Max log message size */
+#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048
+
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+typedef struct H5C_log_trace_udata_t {
+ FILE *outfile;
+ char *message;
+} H5C_log_trace_udata_t;
+
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/* Internal message handling calls */
+static herr_t H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata);
+
+/* Log message callbacks */
+static herr_t H5C__trace_tear_down_logging(H5C_log_info_t *log_info);
+static herr_t H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent, const H5C_cache_entry_t *child, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config, herr_t fxn_ret_value);
+static herr_t H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value);
+
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* Note that there's no cache set up call since that's the
+ * place where this struct is wired into the cache.
+ */
+static H5C_log_class_t H5C_trace_log_class_g = {
+ "trace",
+ H5C__trace_tear_down_logging,
+ NULL, /* start logging */
+ NULL, /* stop logging */
+ NULL, /* write start message */
+ NULL, /* write stop message */
+ NULL, /* write create cache message */
+ NULL, /* write destroy cache message */
+ NULL, /* write evict cache message */
+ H5C__trace_write_expunge_entry_log_msg,
+ H5C__trace_write_flush_cache_log_msg,
+ H5C__trace_write_insert_entry_log_msg,
+ H5C__trace_write_mark_entry_dirty_log_msg,
+ H5C__trace_write_mark_entry_clean_log_msg,
+ H5C__trace_write_mark_unserialized_entry_log_msg,
+ H5C__trace_write_mark_serialized_entry_log_msg,
+ H5C__trace_write_move_entry_log_msg,
+ H5C__trace_write_pin_entry_log_msg,
+ H5C__trace_write_create_fd_log_msg,
+ H5C__trace_write_protect_entry_log_msg,
+ H5C__trace_write_resize_entry_log_msg,
+ H5C__trace_write_unpin_entry_log_msg,
+ H5C__trace_write_destroy_fd_log_msg,
+ H5C__trace_write_unprotect_entry_log_msg,
+ H5C__trace_write_set_cache_config_log_msg,
+ H5C__trace_write_remove_entry_log_msg
+};
+
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_log_message
+ *
+ * Purpose: Write a message to the log file and flush the file.
+ * The message string is neither modified nor freed.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
+{
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->outfile);
+ HDassert(trace_udata->message);
+
+ /* Write the log message and flush */
+ n_chars = HDstrlen(trace_udata->message);
+ if((int)n_chars != HDfprintf(trace_udata->outfile, trace_udata->message))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
+ HDmemset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_log_message() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C_log_trace_set_up
+ *
+ * Purpose: Setup for metadata cache logging.
+ *
+ * Metadata logging is enabled and disabled at two levels. This
+ * function and the associated tear_down function open and close
+ * the log file. the start_ and stop_logging functions are then
+ * used to switch logging on/off. Optionally, logging can begin
+ * as soon as the log file is opened (set via the start_immediately
+ * parameter to this function).
+ *
+ * The log functionality is split between the H5C and H5AC
+ * packages. Log state and direct log manipulation resides in
+ * H5C. Log messages are generated in H5AC and sent to
+ * the H5C__trace_write_log_message function.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5C_log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
+{
+ H5C_log_trace_udata_t *trace_udata = NULL;
+ char *file_name = NULL;
+ size_t n_chars;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity checks */
+ HDassert(log_info);
+ HDassert(log_location);
+
+ /* Set up the class struct */
+ log_info->cls = &H5C_trace_log_class_g;
+
+ /* Allocate memory for the JSON-specific data */
+ if(NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_trace_udata_t))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+ trace_udata = (H5C_log_trace_udata_t *)(log_info->udata);
+
+ /* Allocate memory for the message buffer */
+ if(NULL == (trace_udata->message = (char *)H5MM_calloc(H5C_MAX_TRACE_LOG_MSG_SIZE * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
+
+ /* Possibly fix up the log file name.
+ * The extra 39 characters are for adding the rank to the file name
+ * under parallel HDF5. 39 characters allows > 2^127 processes which
+ * should be enough for anybody.
+ *
+ * allocation size = <path length> + dot + <rank # length> + \0
+ */
+ n_chars = HDstrlen(log_location) + 1 + 39 + 1;
+ if(NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "can't allocate memory for mdc log file name manipulation")
+
+ /* Add the rank to the log file name when MPI is in use */
+ if(-1 == mpi_rank)
+ HDsnprintf(file_name, n_chars, "%s", log_location);
+ else
+ HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);
+
+ /* Open log file and set it to be unbuffered */
+ if(NULL == (trace_udata->outfile = HDfopen(file_name, "w")))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
+ HDsetbuf(trace_udata->outfile, NULL);
+
+ /* Write the header */
+ HDfprintf(trace_udata->outfile, "### HDF5 metadata cache trace file version 1 ###\n");
+
+ done:
+ if(file_name)
+ H5MM_xfree(file_name);
+
+ /* Free and reset the log info struct on errors */
+ if(FAIL == ret_value) {
+ /* Free */
+ if(trace_udata && trace_udata->message)
+ H5MM_xfree(trace_udata->message);
+ if(trace_udata)
+ H5MM_xfree(trace_udata);
+
+ /* Reset */
+ log_info->udata = NULL;
+ log_info->cls = NULL;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C_log_trace_set_up() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_tear_down_logging
+ *
+ * Purpose: Tear-down for metadata cache logging.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_tear_down_logging(H5C_log_info_t *log_info)
+{
+ H5C_log_trace_udata_t *trace_udata = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(log_info);
+
+ /* Alias */
+ trace_udata = (H5C_log_trace_udata_t *)(log_info->udata);
+
+ /* Free the message buffer */
+ H5MM_xfree(trace_udata->message);
+
+ /* Close log file */
+ if(EOF == HDfclose(trace_udata->outfile))
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
+ trace_udata->outfile = NULL;
+
+ /* Fre the udata */
+ H5MM_xfree(trace_udata);
+
+ /* Reset the log class info and udata */
+ log_info->cls = NULL;
+ log_info->udata = NULL;
+
+ done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_tear_down_logging() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_expunge_entry_log_msg
+ *
+ * Purpose: Write a log message for expunge of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n",
+ (unsigned long)address, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_expunge_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_flush_cache_log_msg
+ *
+ * Purpose: Write a log message for cache flushes.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n",
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_flush_cache_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_insert_entry_log_msg
+ *
+ * Purpose: Write a log message for insertion of cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, size_t size, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n",
+ (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_insert_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_entry_dirty_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as dirty.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_entry_dirty_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_entry_clean_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as clean.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_entry_clean_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_unserialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as unserialized.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_unserialized_entry_log_msg(void *udata,
+ const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_unserialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_mark_serialized_entry_log_msg
+ *
+ * Purpose: Write a log message for marking cache entries as serialize.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_mark_serialized_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_move_entry_log_msg
+ *
+ * Purpose: Write a log message for moving a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr,
+ int type_id, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n",
+ (unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_move_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_pin_entry_log_msg
+ *
+ * Purpose: Write a log message for pinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_pin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_create_fd_log_msg
+ *
+ * Purpose: Write a log message for creating a flush dependency between
+ * two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_create_flush_dependency 0x%lx 0x%lx %d\n",
+ (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_create_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_protect_entry_log_msg
+ *
+ * Purpose: Write a log message for protecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n",
+ (unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_protect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_resize_entry_log_msg
+ *
+ * Purpose: Write a log message for resizing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ size_t new_size, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n",
+ (unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_resize_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_unpin_entry_log_msg
+ *
+ * Purpose: Write a log message for unpinning a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_unpin_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_destroy_fd_log_msg
+ *
+ * Purpose: Write a log message for destroying a flush dependency
+ * between two cache entries.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
+ const H5C_cache_entry_t *child, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(parent);
+ HDassert(child);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n",
+ (unsigned long)(parent->addr), (unsigned long)(child->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_destroy_fd_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_unprotect_entry_log_msg
+ *
+ * Purpose: Write a log message for unprotecting a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address,
+ int type_id, unsigned flags, herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
+ (unsigned long)(address), type_id, flags, (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_unprotect_entry_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_set_cache_config_log_msg
+ *
+ * Purpose: Write a log message for setting the cache configuration.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(config);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
+ "H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f %d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
+ config->version,
+ (int)(config->rpt_fcn_enabled),
+ (int)(config->open_trace_file),
+ (int)(config->close_trace_file),
+ config->trace_file_name,
+ (int)(config->evictions_enabled),
+ (int)(config->set_initial_size),
+ (int)(config->initial_size),
+ config->min_clean_fraction,
+ (int)(config->max_size),
+ (int)(config->min_size),
+ config->epoch_length,
+ (int)(config->incr_mode),
+ config->lower_hr_threshold,
+ config->increment,
+ (int)(config->flash_incr_mode),
+ config->flash_multiple,
+ config->flash_threshold,
+ (int)(config->apply_max_increment),
+ (int)(config->max_increment),
+ (int)(config->decr_mode),
+ config->upper_hr_threshold,
+ config->decrement,
+ (int)(config->apply_max_decrement),
+ (int)(config->max_decrement),
+ config->epochs_before_eviction,
+ (int)(config->apply_empty_reserve),
+ config->empty_reserve,
+ config->dirty_bytes_threshold,
+ config->metadata_write_strategy,
+ (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_set_cache_config_log_msg() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5C__trace_write_remove_entry_log_msg
+ *
+ * Purpose: Write a log message for removing a cache entry.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Dana Robinson
+ * Fall 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
+ herr_t fxn_ret_value)
+{
+ H5C_log_trace_udata_t *trace_udata = (H5C_log_trace_udata_t *)(udata);
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity checks */
+ HDassert(trace_udata);
+ HDassert(trace_udata->message);
+ HDassert(entry);
+
+ /* Create the log message string */
+ HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n",
+ (unsigned long)(entry->addr), (int)fxn_ret_value);
+
+ /* Write the log message to the file */
+ if(H5C__trace_write_log_message(trace_udata) < 0)
+ HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5C__trace_write_remove_entry_log_msg() */
+
diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h
index 98d7a01..9156c0d 100644
--- a/src/H5Cpkg.h
+++ b/src/H5Cpkg.h
@@ -37,6 +37,7 @@
#include "H5Cprivate.h"
/* Other private headers needed by this file */
+#include "H5Clog.h" /* Cache logging */
#include "H5SLprivate.h" /* Skip lists */
/**************************/
@@ -3497,40 +3498,8 @@ typedef struct H5C_tag_info_t {
* flush_in_progress: Boolean flag indicating whether a flush is in
* progress.
*
- * trace_file_ptr: File pointer pointing to the trace file, which is used
- * to record cache operations for use in simulations and design
- * studies. This field will usually be NULL, indicating that
- * no trace file should be recorded.
- *
- * Since much of the code supporting the parallel metadata
- * cache is in H5AC, we don't write the trace file from
- * H5C. Instead, H5AC reads the trace_file_ptr as needed.
- *
- * When we get to using H5C in other places, we may add
- * code to write trace file data at the H5C level as well.
- *
- * logging_enabled: Boolean flag indicating whether cache logging
- * which is used to record cache operations for use in
- * debugging and performance analysis. When this flag is set
- * to TRUE, it means that the log file is open and ready to
- * receive log entries. It does NOT mean that cache operations
- * are currently being recorded. That is controlled by the
- * currently_logging flag (below).
- *
- * Since much of the code supporting the parallel metadata
- * cache is in H5AC, we don't write the trace file from
- * H5C. Instead, H5AC reads the trace_file_ptr as needed.
- *
- * When we get to using H5C in other places, we may add
- * code to write trace file data at the H5C level as well.
- *
- * currently_logging: Boolean flag that indicates if cache operations are
- * currently being logged. This flag is flipped by the
- * H5Fstart/stop_mdc_logging functions.
- *
- * log_file_ptr: File pointer pointing to the log file. The I/O functions
- * in stdio.h are used to write to the log file regardless of
- * the VFD selected.
+ * log_info: Information used by the MDC logging functionality.
+ * Described in H5Clog.h.
*
* aux_ptr: Pointer to void used to allow wrapper code to associate
* its data with an instance of H5C_t. The H5C cache code
@@ -3854,6 +3823,13 @@ typedef struct H5C_tag_info_t {
*
* ignore_tags: Boolean flag to disable tag validation during entry insertion.
*
+ * num_objs_corked: Unsigned integer field containing the number of objects
+ * that are "corked". The "corked" status of an object is
+ * found by searching the "tag_list". This field is added
+ * for optimization so that the skip list search on "tag_list"
+ * can be skipped if this field is zero, i.e. no "corked"
+ * objects.
+ *
* When a cache entry is protected, it must be removed from the LRU
* list(s) as it cannot be either flushed or evicted until it is unprotected.
* The following fields are used to implement the protected list (pl).
@@ -4676,10 +4652,7 @@ typedef struct H5C_tag_info_t {
struct H5C_t {
uint32_t magic;
hbool_t flush_in_progress;
- FILE * trace_file_ptr;
- hbool_t logging_enabled;
- hbool_t currently_logging;
- FILE * log_file_ptr;
+ H5C_log_info_t *log_info;
void * aux_ptr;
int32_t max_type_id;
const H5C_class_t * const *class_table_ptr;
@@ -4727,6 +4700,7 @@ struct H5C_t {
/* Fields for maintaining list of tagged entries */
H5SL_t * tag_list;
hbool_t ignore_tags;
+ uint32_t num_objs_corked;
/* Fields for tracking protected entries */
uint32_t pl_len;
diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h
index 38a86ee..d4ed6fc 100644
--- a/src/H5Cprivate.h
+++ b/src/H5Cprivate.h
@@ -2219,6 +2219,12 @@ typedef struct H5C_cache_image_ctl_t {
unsigned flags;
} H5C_cache_image_ctl_t;
+/* The cache logging output style */
+typedef enum H5C_log_style_t {
+ H5C_LOG_STYLE_JSON,
+ H5C_LOG_STYLE_TRACE
+} H5C_log_style_t;
+
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
@@ -2227,13 +2233,6 @@ H5_DLL H5C_t *H5C_create(size_t max_cache_size, size_t min_clean_size,
int max_type_id, const H5C_class_t * const *class_table_ptr,
H5C_write_permitted_func_t check_write_permitted, hbool_t write_permitted,
H5C_log_flush_func_t log_flush, void *aux_ptr);
-H5_DLL herr_t H5C_set_up_logging(H5C_t *cache_ptr, const char log_location[], hbool_t start_immediately);
-H5_DLL herr_t H5C_tear_down_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_start_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_stop_logging(H5C_t *cache_ptr);
-H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache_ptr, /*OUT*/ hbool_t *is_enabled,
- /*OUT*/ hbool_t *is_currently_logging);
-H5_DLL herr_t H5C_write_log_message(const H5C_t *cache_ptr, const char message[]);
H5_DLL void H5C_def_auto_resize_rpt_fcn(H5C_t *cache_ptr, int32_t version,
double hit_rate, enum H5C_resize_status status,
size_t old_max_cache_size, size_t new_max_cache_size,
@@ -2267,8 +2266,6 @@ H5_DLL herr_t H5C_get_entry_status(const H5F_t *f, haddr_t addr,
hbool_t *image_up_to_date_ptr);
H5_DLL herr_t H5C_get_evictions_enabled(const H5C_t *cache_ptr, hbool_t *evictions_enabled_ptr);
H5_DLL void * H5C_get_aux_ptr(const H5C_t *cache_ptr);
-H5_DLL FILE *H5C_get_trace_file_ptr(const H5C_t *cache_ptr);
-H5_DLL FILE *H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr);
H5_DLL herr_t H5C_image_stats(H5C_t * cache_ptr, hbool_t print_header);
H5_DLL herr_t H5C_insert_entry(H5F_t *f, const H5C_class_t *type, haddr_t addr,
void *thing, unsigned int flags);
@@ -2292,7 +2289,6 @@ H5_DLL herr_t H5C_set_cache_image_config(const H5F_t *f, H5C_t *cache_ptr,
H5C_cache_image_ctl_t *config_ptr);
H5_DLL herr_t H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled);
H5_DLL herr_t H5C_set_prefix(H5C_t *cache_ptr, char *prefix);
-H5_DLL herr_t H5C_set_trace_file_ptr(H5C_t *cache_ptr, FILE *trace_file_ptr);
H5_DLL herr_t H5C_stats(H5C_t *cache_ptr, const char *cache_name,
hbool_t display_detailed_stats);
H5_DLL void H5C_stats__reset(H5C_t *cache_ptr);
@@ -2305,6 +2301,7 @@ H5_DLL herr_t H5C_validate_resize_config(H5C_auto_size_ctl_t *config_ptr,
unsigned int tests);
H5_DLL herr_t H5C_ignore_tags(H5C_t *cache_ptr);
H5_DLL hbool_t H5C_get_ignore_tags(const H5C_t *cache_ptr);
+H5_DLL uint32_t H5C_get_num_objs_corked(const H5C_t *cache_ptr);
H5_DLL herr_t H5C_retag_entries(H5C_t * cache_ptr, haddr_t src_tag, haddr_t dest_tag);
H5_DLL herr_t H5C_cork(H5C_t *cache_ptr, haddr_t obj_addr, unsigned action, hbool_t *corked);
H5_DLL herr_t H5C_get_entry_ring(const H5F_t *f, haddr_t addr, H5C_ring_t *ring);
@@ -2316,6 +2313,11 @@ H5_DLL herr_t H5C_cache_image_status(H5F_t * f, hbool_t *load_ci_ptr,
H5_DLL hbool_t H5C_cache_image_pending(const H5C_t *cache_ptr);
H5_DLL herr_t H5C_get_mdc_image_info(H5C_t *cache_ptr, haddr_t *image_addr, hsize_t *image_len);
+/* Logging functions */
+H5_DLL herr_t H5C_start_logging(H5C_t *cache);
+H5_DLL herr_t H5C_stop_logging(H5C_t *cache);
+H5_DLL herr_t H5C_get_logging_status(const H5C_t *cache, /*OUT*/ hbool_t *is_enabled, /*OUT*/ hbool_t *is_currently_logging);
+
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr,
unsigned num_candidates, haddr_t *candidates_list_ptr, int mpi_rank,
diff --git a/src/H5Cquery.c b/src/H5Cquery.c
index 6c927b0..68258a6 100644
--- a/src/H5Cquery.c
+++ b/src/H5Cquery.c
@@ -351,64 +351,6 @@ H5C_get_aux_ptr(const H5C_t *cache_ptr)
/*-------------------------------------------------------------------------
- * Function: H5C_get_trace_file_ptr
- *
- * Purpose: Get the trace_file_ptr field from the cache.
- *
- * This field will either be NULL (which indicates that trace
- * file logging is turned off), or contain a pointer to the
- * open file to which trace file data is to be written.
- *
- * Return: Non-NULL trace file pointer (can't fail)
- *
- * Programmer: John Mainzer
- * 1/20/06
- *
- *-------------------------------------------------------------------------
- */
-FILE *
-H5C_get_trace_file_ptr(const H5C_t *cache_ptr)
-{
- FUNC_ENTER_NOAPI_NOERR
-
- /* Check arguments */
- HDassert(cache_ptr);
- HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
-
- FUNC_LEAVE_NOAPI(cache_ptr->trace_file_ptr)
-} /* H5C_get_trace_file_ptr() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5C_get_trace_file_ptr_from_entry
- *
- * Purpose: Get the trace_file_ptr field from the cache, via an entry.
- *
- * This field will either be NULL (which indicates that trace
- * file logging is turned off), or contain a pointer to the
- * open file to which trace file data is to be written.
- *
- * Return: Non-NULL trace file pointer (can't fail)
- *
- * Programmer: Quincey Koziol
- * 6/9/08
- *
- *-------------------------------------------------------------------------
- */
-FILE *
-H5C_get_trace_file_ptr_from_entry(const H5C_cache_entry_t *entry_ptr)
-{
- FUNC_ENTER_NOAPI_NOERR
-
- /* Sanity checks */
- HDassert(entry_ptr);
- HDassert(entry_ptr->cache_ptr);
-
- FUNC_LEAVE_NOAPI(H5C_get_trace_file_ptr(entry_ptr->cache_ptr))
-} /* H5C_get_trace_file_ptr_from_entry() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5C_get_entry_ring
*
* Purpose: Given a file address, retrieve the ring for an entry at that
diff --git a/src/H5Ctag.c b/src/H5Ctag.c
index 66aedd9..d1ede0f 100644
--- a/src/H5Ctag.c
+++ b/src/H5Ctag.c
@@ -175,6 +175,32 @@ H5C_get_ignore_tags(const H5C_t *cache_ptr)
/*-------------------------------------------------------------------------
*
+ * Function: H5C_get_num_objs_corked
+ *
+ * Purpose: Retrieve the 'num_objs_corked' field for the cache
+ *
+ * Return: 'num_objs_corked' value (can't fail)
+ *
+ * Programmer: Vailin Choi; Feb 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+uint32_t
+H5C_get_num_objs_corked(const H5C_t *cache_ptr)
+{
+ FUNC_ENTER_NOAPI_NOERR
+
+ /* Sanity checks */
+ HDassert(cache_ptr);
+ HDassert(cache_ptr->magic == H5C__H5C_T_MAGIC);
+
+ /* Return value for num_objs_corked */
+ FUNC_LEAVE_NOAPI(cache_ptr->num_objs_corked)
+} /* H5C_get_num_objs_corked */
+
+
+/*-------------------------------------------------------------------------
+ *
* Function: H5C__tag_entry
*
* Purpose: Tags an entry with the provided tag (contained in the API context).
diff --git a/src/H5D.c b/src/H5D.c
index 61ccb5a..c02959a 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -220,8 +220,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id,
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* build and open the new dataset */
- if(NULL == (dset = H5D__create_anon(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
+ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id)))
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset")
/* Register the new dataset to get an ID for it */
if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0)
@@ -481,8 +481,8 @@ H5Dget_create_plist(hid_t dset_id)
if(NULL == (dataset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataset")
- if((ret_value = H5D__get_create_plist(dataset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist")
+ if((ret_value = H5D_get_create_plist(dataset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "Can't get creation plist")
done:
FUNC_LEAVE_API(ret_value)
@@ -1130,3 +1130,153 @@ done:
FUNC_LEAVE_API(ret_value);
} /* H5Dget_chunk_storage_size() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dget_num_chunks
+ *
+ * Purpose: Retrieves the number of chunks that have nonempty intersection
+ * with a specified selection.
+ *
+ * Note: Currently, this function only gets the number of all written
+ * chunks, regardless the dataspace.
+ *
+ * Parameters:
+ * hid_t dset_id; IN: Chunked dataset ID
+ * hid_t fspace_id; IN: File dataspace ID
+ * hsize_t *nchunks; OUT:: Number of non-empty chunks
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Binh-Minh Ribler
+ * August 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks)
+{
+ H5D_t *dset = NULL;
+ const H5S_t *space; /* Dataspace for dataset */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ii*h", dset_id, fspace_id, nchunks);
+
+ /* Check arguments */
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(fspace_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ if(NULL == nchunks)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Get the number of written chunks */
+ if(H5D__get_num_chunks(dset, space, nchunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error getting number of chunks")
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* H5Dget_num_chunks() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dget_chunk_info
+ *
+ * Purpose: Retrieves information about a chunk specified by its index.
+ *
+ * Parameters:
+ * hid_t dset_id; IN: Chunked dataset ID
+ * hid_t fspace_id; IN: File dataspace ID
+ * hsize_t chk_idx; IN: Index of allocated/written chunk
+ * hsize_t *offset OUT: Offset coordinates of the chunk
+ * unsigned *filter_mask OUT: Filter mask
+ * haddr_t *addr OUT: Address of the chunk
+ * hsize_t *size OUT: Size of the chunk
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Binh-Minh Ribler
+ * August 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+{
+ H5D_t *dset = NULL;
+ const H5S_t *space; /* Dataspace for dataset */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "iih*h*Iu*a*h", dset_id, fspace_id, chk_idx, offset, filter_mask,
+ addr, size);
+
+ /* Check arguments */
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset ID")
+ if(NULL == (space = (const H5S_t *)H5I_object_verify(fspace_id, H5I_DATASPACE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace ID")
+ if(NULL == offset && NULL == filter_mask && NULL == addr && NULL == size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument")
+
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function to get the chunk info given the chunk's index */
+ if(H5D__get_chunk_info(dset, space, chk_idx, offset, filter_mask, addr, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info")
+
+done:
+ FUNC_LEAVE_API(ret_value);
+} /* H5Dget_chunk_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Dget_chunk_info_by_coord
+ *
+ * Purpose: Retrieves information about a chunk specified by its offset
+ * coordinates.
+ *
+ * Parameters:
+ * hid_t dset_id IN: Chunked dataset ID
+ * hsize_t *offset IN: Offset coordinates of the chunk
+ * unsigned *filter_mask OUT: Filter mask
+ * haddr_t *addr OUT: Address of the chunk
+ * hsize_t *size OUT: Size of the chunk
+ *
+ * Return: Non-negative on success, negative on failure
+ *
+ * Programmer: Binh-Minh Ribler
+ * August 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+{
+ H5D_t *dset = NULL;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "i*h*Iu*a*h", dset_id, offset, filter_mask, addr, size);
+
+ /* Check arguments */
+ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset")
+ if(NULL == offset)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ if(NULL == filter_mask && NULL == addr && NULL == size)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments, must have at least one non-null output argument")
+
+ if(H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Internal function to get the chunk info */
+ if (H5D__get_chunk_info_by_coord(dset, offset, filter_mask, addr, size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't get chunk info")
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Dget_chunk_info_by_coord() */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index c3f4a95..553d75c 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -216,6 +216,18 @@ typedef struct H5D_chunk_readvv_ud_t {
const H5D_t *dset; /* Dataset to operate on */
} H5D_chunk_readvv_ud_t;
+/* Typedef for chunk info iterator callback */
+typedef struct H5D_chunk_info_iter_ud_t {
+ hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset of the chunk */
+ hsize_t ndims; /* Number of dimensions in the dataset */
+ uint32_t nbytes; /* Size of stored data in the chunk */
+ unsigned filter_mask; /* Excluded filters */
+ haddr_t chunk_addr; /* Address of the chunk in file */
+ hsize_t chunk_idx; /* Chunk index, where the iteration needs to stop */
+ hsize_t curr_idx; /* Current index, where the iteration is */
+ hbool_t found; /* Whether the chunk was found */
+} H5D_chunk_info_iter_ud_t;
+
/* Callback info for file selection iteration */
typedef struct H5D_chunk_file_iter_ud_t {
H5D_chunk_map_t *fm; /* File->memory chunk mapping info */
@@ -252,6 +264,12 @@ static herr_t H5D__chunk_flush(H5D_t *dset);
static herr_t H5D__chunk_io_term(const H5D_chunk_map_t *fm);
static herr_t H5D__chunk_dest(H5D_t *dset);
+/* Chunk query operation callbacks */
+static int H5D__get_num_chunks_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
+static int H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
+static int H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata);
+
+
/* "Nonexistent" layout operation callback */
static ssize_t
H5D__nonexistent_readvv(const H5D_io_info_t *io_info,
@@ -495,7 +513,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
@@ -565,7 +583,7 @@ H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t* filters,
*filters = udata.filter_mask;
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_direct_read() */
@@ -590,7 +608,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
H5D_chunk_ud_t udata; /* User data for querying chunk info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset && H5D_CHUNKED == layout->type);
@@ -663,7 +681,7 @@ H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset, hsize_t *storage
*storage_size = dset->shared->layout.u.chunk.size;
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* H5D__get_chunk_storage_size */
@@ -695,6 +713,9 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims,
/* Compute the # of chunks in dataset dimensions */
for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) {
+ /* Sanity check */
+ HDassert(layout->dim[u] > 0);
+
/* Round up to the next integer # of chunks, to accommodate partial chunks */
layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u];
if(H5S_UNLIMITED == max_dims[u])
@@ -949,7 +970,10 @@ H5D__chunk_init(H5F_t *f, const H5D_t *dset, hid_t dapl_id)
/* Initial scaled dimension sizes */
if(dset->shared->layout.u.chunk.dim[u] == 0)
HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
- rdcc->scaled_dims[u] = dset->shared->curr_dims[u] / dset->shared->layout.u.chunk.dim[u];
+
+ /* Round up to the next integer # of chunks, to accommodate partial chunks */
+ rdcc->scaled_dims[u] = (dset->shared->curr_dims[u] + dset->shared->layout.u.chunk.dim[u] - 1) /
+ dset->shared->layout.u.chunk.dim[u];
if( !(scaled_power2up = H5VM_power2up(rdcc->scaled_dims[u])) )
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get the next power of 2")
@@ -1489,6 +1513,9 @@ H5D__create_chunk_map_single(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set chunk location & hyperslab size */
for(u = 0; u < fm->f_ndims; u++) {
+ /* Validate this chunk dimension */
+ if(fm->layout->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
HDassert(sel_start[u] == sel_end[u]);
chunk_info->scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
coords[u] = chunk_info->scaled[u] * fm->layout->u.chunk.dim[u];
@@ -1575,6 +1602,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t
/* Set initial chunk location & hyperslab size */
for(u = 0; u < fm->f_ndims; u++) {
+ /* Validate this chunk dimension */
+ if(fm->layout->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", u)
scaled[u] = start_scaled[u] = sel_start[u] / fm->layout->u.chunk.dim[u];
coords[u] = start_coords[u] = scaled[u] * fm->layout->u.chunk.dim[u];
end[u] = (coords[u] + fm->chunk_dim[u]) - 1;
@@ -2797,6 +2827,7 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
hsize_t val; /* Intermediate value */
unsigned ndims = shared->ndims; /* Rank of dataset */
unsigned ret = 0; /* Value to return */
+ unsigned u; /* Local index variable */
FUNC_ENTER_STATIC_NOERR
@@ -2807,17 +2838,11 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
/* If the fastest changing dimension doesn't have enough entropy, use
* other dimensions too
*/
- if(ndims > 1 && shared->cache.chunk.scaled_dims[ndims - 1] <= shared->cache.chunk.nslots) {
- unsigned u; /* Local index variable */
-
- val = scaled[0];
- for(u = 1; u < ndims; u++) {
- val <<= shared->cache.chunk.scaled_encode_bits[u];
- val ^= scaled[u];
- } /* end for */
- } /* end if */
- else
- val = scaled[ndims - 1];
+ val = scaled[0];
+ for(u = 1; u < ndims; u++) {
+ val <<= shared->cache.chunk.scaled_encode_bits[u];
+ val ^= scaled[u];
+ } /* end for */
/* Modulo value against the number of array slots */
ret = (unsigned)(val % shared->cache.chunk.nslots);
@@ -2905,9 +2930,6 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
/* Check for cached information */
if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) {
H5D_chk_idx_info_t idx_info; /* Chunked index info */
-#ifdef H5_HAVE_PARALLEL
- H5P_coll_md_read_flag_t temp_cmr; /* Temp value to hold the coll metadata read setting */
-#endif /* H5_HAVE_PARALLEL */
/* Compose chunked index info struct */
idx_info.f = dset->oloc.file;
@@ -2916,25 +2938,18 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled,
idx_info.storage = &dset->shared->layout.storage.u.chunk;
#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
- /* disable collective metadata read for chunk indexes
- as it is highly unlikely that users would read the
- same chunks from all processes. MSC - might turn on
- for root node? */
- temp_cmr = H5F_COLL_MD_READ(idx_info.f);
- H5F_set_coll_md_read(idx_info.f, H5P_FORCE_FALSE);
- } /* end if */
+ /* Disable collective metadata read for chunk indexes as it is
+ * highly unlikely that users would read the same chunks from all
+ * processes.
+ */
+ if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
+ H5CX_set_coll_metadata_read(FALSE);
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address")
-#ifdef H5_HAVE_PARALLEL
- if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
- H5F_set_coll_md_read(idx_info.f, temp_cmr);
-#endif /* H5_HAVE_PARALLEL */
-
/*
* Cache the information retrieved.
*
@@ -4041,6 +4056,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_
* assume here that all elements of space_dim are > 0. This is checked at
* the top of this function. */
for(op_dim=0; op_dim<space_ndims; op_dim++) {
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim];
max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim];
@@ -4484,13 +4502,17 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Start off with this dimension marked as not needing to be modified */
new_full_dim[op_dim] = FALSE;
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
+
/* Calculate offset of first previously incomplete chunk in this
* dimension */
- old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
+ old_edge_chunk_sc[op_dim] = (old_dim[op_dim] / chunk_dim[op_dim]);
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
- max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
+ max_edge_chunk_sc[op_dim] = MIN((old_dim[op_dim] - 1) / chunk_dim[op_dim],
MAX((space_dim[op_dim] / chunk_dim[op_dim]), 1) - 1);
/* Check for old_dim aligned with chunk boundary in this dimension, if
@@ -4501,7 +4523,7 @@ H5D__chunk_update_old_edge_chunks(H5D_t *dset, hsize_t old_dim[])
/* Check if the dataspace expanded enough to cause the old edge chunks
* in this dimension to become full */
- if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
+ if((space_dim[op_dim]/chunk_dim[op_dim]) >= (old_edge_chunk_sc[op_dim] + 1))
new_full_dim[op_dim] = TRUE;
} /* end for */
@@ -4626,6 +4648,8 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
HGOTO_ERROR(H5E_INTERNAL, H5E_MPI, FAIL, "Can't retrieve MPI size")
/* Distribute evenly the number of blocks between processes. */
+ if(mpi_size == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "Resulted in division by zero")
num_blocks = chunk_info->num_io / mpi_size; /* value should be the same on all procs */
/* after evenly distributing the blocks between processes, are
@@ -5066,6 +5090,10 @@ H5D__chunk_prune_by_extent(H5D_t *dset, const hsize_t *old_dim)
HDmemset(min_mod_chunk_sc, 0, sizeof(min_mod_chunk_sc));
HDmemset(max_mod_chunk_sc, 0, sizeof(max_mod_chunk_sc));
for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) {
+ /* Validate this chunk dimension */
+ if(chunk_dim[op_dim] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "chunk size must be > 0, dim = %u ", op_dim)
+
/* Calculate the largest offset of chunks that might need to be
* modified in this dimension */
max_mod_chunk_sc[op_dim] = (old_dim[op_dim] - 1) / chunk_dim[op_dim];
@@ -5721,9 +5749,12 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
/* (background buffer has already been zeroed out, if not expanding) */
if(udata->cpy_info->expand_ref) {
size_t ref_count;
+ size_t dt_size;
/* Determine # of reference elements to copy */
- ref_count = nbytes / H5T_get_size(udata->dt_src);
+ if((dt_size = H5T_get_size(udata->dt_src)) == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "size must not be 0")
+ ref_count = nbytes / dt_size;
/* Copy the reference elements */
if(H5O_copy_expand_ref(udata->file_src, buf, udata->idx_info_dst->f, bkg, ref_count, H5T_get_ref_type(udata->dt_src), udata->cpy_info) < 0)
@@ -6726,3 +6757,374 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_format_convert() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_num_chunks_cb
+ *
+ * Purpose: Callback function that increments the number of written
+ * chunks in the dataset.
+ *
+ * Note: Currently, this function only gets the number of all written
+ * chunks, regardless the dataspace.
+ *
+ * Return: H5_ITER_CONT
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__get_num_chunks_cb(const H5D_chunk_rec_t H5_ATTR_UNUSED *chunk_rec, void *_udata)
+{
+ hsize_t *num_chunks = (hsize_t *)_udata;
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ HDassert(num_chunks);
+
+ (*num_chunks)++;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__get_num_chunks_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_num_chunks
+ *
+ * Purpose: Gets the number of written chunks in a dataset.
+ *
+ * Note: Currently, this function only gets the number of all written
+ * chunks, regardless the dataspace.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__get_num_chunks(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t *nchunks)
+{
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ hsize_t num_chunks = 0; /* Number of written chunks */
+ H5D_rdcc_ent_t *ent; /* Cache entry */
+ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+
+ HDassert(dset);
+ HDassert(dset->shared);
+ HDassert(space);
+ HDassert(nchunks);
+
+ /* Get the raw data chunk cache */
+ rdcc = &(dset->shared->cache.chunk);
+ HDassert(rdcc);
+
+ /* Search for cached chunks that haven't been written out */
+ for(ent = rdcc->head; ent; ent = ent->next)
+ /* Flush the chunk out to disk, to make certain the size is correct later */
+ if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
+
+ /* Compose chunked index info struct */
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.storage = &dset->shared->layout.storage.u.chunk;
+
+ /* If the dataset is not written, number of chunks will be 0 */
+ if(!H5F_addr_defined(idx_info.storage->idx_addr)) {
+ *nchunks = 0;
+ HGOTO_DONE(SUCCEED);
+ }
+ else {
+ /* Iterate over the allocated chunks */
+ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_num_chunks_cb, &num_chunks) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
+ *nchunks = num_chunks;
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__get_num_chunks() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_chunk_info_cb
+ *
+ * Purpose: Get the chunk info of the desired chunk, given by its index.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ * Failure: Negative (H5_ITER_ERROR)
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__get_chunk_info_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
+{
+ H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
+ hsize_t ii = 0; /* Dimension index */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(chunk_rec);
+ HDassert(chunk_info);
+
+ /* If this is the desired chunk, retrieve its info and stop iterating */
+ if (chunk_info->curr_idx == chunk_info->chunk_idx) {
+ chunk_info->filter_mask = chunk_rec->filter_mask;
+ chunk_info->chunk_addr = chunk_rec->chunk_addr;
+ chunk_info->nbytes = chunk_rec->nbytes;
+ for (ii = 0; ii < chunk_info->ndims; ii++)
+ chunk_info->scaled[ii] = chunk_rec->scaled[ii];
+ chunk_info->found = TRUE;
+
+ /* Stop iterating */
+ ret_value = H5_ITER_STOP;
+ }
+ /* Iterate the next chunk */
+ else
+ chunk_info->curr_idx++;
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__get_chunk_info_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_chunk_info
+ *
+ * Purpose: Iterate over the chunks in the dataset to get the info
+ * of the desired chunk.
+ *
+ * Note: Currently, this function only gets the number of all written
+ * chunks, regardless the dataspace.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__get_chunk_info(const H5D_t *dset, const H5S_t H5_ATTR_UNUSED *space, hsize_t index, hsize_t *offset, unsigned *filter_mask, haddr_t *addr, hsize_t *size)
+{
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_info_iter_ud_t udata; /* User data for callback */
+ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
+ H5D_rdcc_ent_t *ent; /* Cache entry index */
+ hsize_t ii = 0; /* Dimension index */
+ herr_t ret_value = SUCCEED;/* Return value */
+
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+
+ HDassert(dset);
+ HDassert(dset->shared);
+ HDassert(space);
+
+ /* Get the raw data chunk cache */
+ rdcc = &(dset->shared->cache.chunk);
+ HDassert(rdcc);
+
+ /* Search for cached chunks that haven't been written out */
+ for(ent = rdcc->head; ent; ent = ent->next)
+ /* Flush the chunk out to disk, to make certain the size is correct later */
+ if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
+
+ /* Compose chunked index info struct */
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.storage = &dset->shared->layout.storage.u.chunk;
+
+ /* Set addr & size for when dset is not written or queried chunk is not found */
+ if (addr)
+ *addr = HADDR_UNDEF;
+ if (size)
+ *size = 0;
+
+ /* If the dataset is not written, return without error */
+ if(!H5F_addr_defined(idx_info.storage->idx_addr))
+ HGOTO_DONE(SUCCEED);
+
+ /* Initialize before iteration */
+ udata.chunk_idx = index;
+ udata.curr_idx = 0;
+ udata.ndims = dset->shared->ndims;
+ udata.nbytes = 0;
+ udata.filter_mask = 0;
+ udata.chunk_addr = HADDR_UNDEF;
+ udata.found = FALSE;
+
+ /* Iterate over the allocated chunks */
+ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve allocated chunk information from index")
+
+ /* Obtain requested info if the chunk is found */
+ if (udata.found) {
+ if (filter_mask)
+ *filter_mask = udata.filter_mask;
+ if (addr)
+ *addr = udata.chunk_addr;
+ if (size)
+ *size = udata.nbytes;
+ if (offset)
+ for (ii = 0; ii < udata.ndims; ii++)
+ offset[ii] = udata.scaled[ii] * dset->shared->layout.u.chunk.dim[ii];
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__get_chunk_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_chunk_info_by_coord_cb
+ *
+ * Purpose: Get the chunk info of the desired chunk, given its offset
+ * coordinates.
+ *
+ * Return: Success: H5_ITER_CONT or H5_ITER_STOP
+ * Failure: Negative (H5_ITER_ERROR)
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5D__get_chunk_info_by_coord_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
+{
+ hsize_t ii;
+ H5D_chunk_info_iter_ud_t *chunk_info = (H5D_chunk_info_iter_ud_t *)_udata;
+ hbool_t different = FALSE; /* TRUE when a scaled value pair mismatch */
+ int ret_value = H5_ITER_CONT; /* Callback return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Check args */
+ HDassert(chunk_rec);
+ HDassert(chunk_info);
+
+ /* Going through the scaled, stop when a mismatch is found */
+ for (ii = 0; ii < chunk_info->ndims && !different; ii++)
+ if (chunk_info->scaled[ii] != chunk_rec->scaled[ii])
+ different = TRUE;
+
+ /* Same scaled coords means the chunk is found, copy the chunk info */
+ if (!different) {
+ chunk_info->nbytes = chunk_rec->nbytes;
+ chunk_info->filter_mask = chunk_rec->filter_mask;
+ chunk_info->chunk_addr = chunk_rec->chunk_addr;
+ chunk_info->found = TRUE;
+
+ /* Stop iterating */
+ ret_value = H5_ITER_STOP;
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5D__get_chunk_info_by_coord_cb() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__get_chunk_info_by_coord
+ *
+ * Purpose: Iterate over the chunks in the dataset to get the info
+ * of the desired chunk, given by its offset coordinates.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Binh-Minh Ribler
+ * September 2018 (HDFFV-10615)
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *offset, unsigned* filter_mask, haddr_t *addr, hsize_t *size)
+{
+ const H5O_layout_t *layout = NULL; /* Dataset layout */
+ const H5D_rdcc_t *rdcc = NULL; /* Raw data chunk cache */
+ H5D_rdcc_ent_t *ent; /* Cache entry index */
+ H5D_chk_idx_info_t idx_info; /* Chunked index info */
+ H5D_chunk_info_iter_ud_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
+
+ /* Check args */
+ HDassert(dset);
+ HDassert(dset->shared);
+ HDassert(offset);
+
+ /* Get dataset layout and raw data chunk cache */
+ layout = &(dset->shared->layout);
+ rdcc = &(dset->shared->cache.chunk);
+ HDassert(layout);
+ HDassert(rdcc);
+ HDassert(H5D_CHUNKED == layout->type);
+
+ /* Search for cached chunks that haven't been written out */
+ for(ent = rdcc->head; ent; ent = ent->next)
+ /* Flush the chunk out to disk, to make certain the size is correct later */
+ if(H5D__chunk_flush_entry(dset, ent, FALSE) < 0)
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer")
+
+ /* Compose chunked index info struct */
+ idx_info.f = dset->oloc.file;
+ idx_info.pline = &dset->shared->dcpl_cache.pline;
+ idx_info.layout = &dset->shared->layout.u.chunk;
+ idx_info.storage = &dset->shared->layout.storage.u.chunk;
+
+ /* Set addr & size for when dset is not written or queried chunk is not found */
+ if (addr)
+ *addr = HADDR_UNDEF;
+ if (size)
+ *size = 0;
+
+ /* If the dataset is not written, return without errors */
+ if(!H5F_addr_defined(idx_info.storage->idx_addr)) {
+ HGOTO_DONE(SUCCEED);
+ }
+
+ /* Calculate the scaled of this chunk */
+ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, udata.scaled);
+ udata.scaled[dset->shared->ndims] = 0;
+
+ /* Initialize before iteration */
+ udata.ndims = dset->shared->ndims;
+ udata.nbytes = 0;
+ udata.filter_mask = 0;
+ udata.chunk_addr = HADDR_UNDEF;
+ udata.found = FALSE;
+
+ /* Iterate over the allocated chunks to find the requested chunk */
+ if((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__get_chunk_info_by_coord_cb, &udata) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to retrieve information of the chunk by its scaled coordinates")
+
+ /* If the chunk is found, return the filter mask and chunk address/size */
+ if (udata.found) {
+ if (filter_mask)
+ *filter_mask = udata.filter_mask;
+ if (addr)
+ *addr = udata.chunk_addr;
+ if (size)
+ *size = udata.nbytes;
+ }
+done:
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
+} /* end H5D__get_chunk_info_by_coord() */
+
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 3ba38c4..ea4245b 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -25,6 +25,7 @@
#include "H5Dpkg.h" /* Datasets */
#include "H5CXprivate.h" /* API Contexts */
#include "H5Eprivate.h" /* Error handling */
+#include "H5Fprivate.h" /* Files */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5Iprivate.h" /* IDs */
@@ -58,9 +59,11 @@ static herr_t H5D__build_file_prefix(const H5D_t *dset, hid_t dapl_id,
static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id);
static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite,
hsize_t old_dim[]);
-static herr_t H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size);
static herr_t H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id);
static herr_t H5D__close_cb(H5D_t *dataset);
+static herr_t H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize);
+static herr_t H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc);
+static size_t H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr);
/*********************/
/* Package Variables */
@@ -299,7 +302,7 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
H5D_obj_create_t dcrt_info; /* Information for dataset creation */
H5D_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -330,52 +333,11 @@ H5D__create_named(const H5G_loc_t *loc, const char *name, hid_t type_id,
ret_value = (H5D_t *)ocrt_info.new_obj;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__create_named() */
/*-------------------------------------------------------------------------
- * Function: H5D__create_anon
- *
- * Purpose: Internal routine to create a new anonymous dataset.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating datasets that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new dataset object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 9, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5D_t *
-H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id,
- hid_t dapl_id)
-{
- H5D_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(file);
- HDassert(type_id != H5P_DEFAULT);
- HDassert(space);
- HDassert(dcpl_id != H5P_DEFAULT);
- HDassert(dapl_id != H5P_DEFAULT);
-
- /* Build and open the dataset */
- if(NULL == (ret_value = H5D__create(file, type_id, space, dcpl_id, dapl_id)))
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to create dataset")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__create_anon() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D__get_space_status
*
* Purpose: Returns the status of dataspace allocation.
@@ -390,7 +352,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(dset);
@@ -423,7 +385,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
HGOTO_ERROR(H5E_DATASET, H5E_OVERFLOW, FAIL, "size of dataset's storage overflowed")
/* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size_real(dset, &space_allocated) < 0)
+ if(H5D__get_storage_size(dset, &space_allocated) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
/* Decide on how much of the space is allocated */
@@ -444,7 +406,7 @@ H5D__get_space_status(const H5D_t *dset, H5D_space_status_t *allocation)
} /* end else */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space_status() */
@@ -662,6 +624,211 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5D__use_minimized_dset_headers
+ *
+ * Purpose: Compartmentalize check for file- or dcpl-set values indicating
+ * to create a "minimized" dataset object header.
+ * Upon success, write resulting value to out pointer `minimize`.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__use_minimized_dset_headers(H5F_t *file, H5D_t *dset, hbool_t *minimize)
+{
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(minimize);
+
+ plist = H5P_object_verify(dset->shared->dcpl_id, H5P_DATASET_CREATE);
+ if(NULL == plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "problem getting dcpl")
+ if(H5P_get(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, minimize) == FAIL)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get minimize value from dcpl")
+
+ if(FALSE == *minimize)
+ *minimize = H5F_get_min_dset_ohdr(file);
+
+done:
+ if(FAIL == ret_value)
+ *minimize = FALSE;
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__use_minimized_dset_headers */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__calculate_minimium_header_size
+ *
+ * Purpose: Calculate the size required for the minimized object header.
+ *
+ * Return: Success: Positive value > 0
+ * Failure: 0
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static size_t
+H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr)
+{
+ H5T_t *type = NULL;
+ H5O_fill_t *fill_prop = NULL;
+ hbool_t use_at_least_v18 = FALSE;
+ const char continuation[1] = ""; /* requred for work-around */
+ size_t get_value = 0;
+ size_t ret_value = 0;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(ohdr);
+
+ type = dset->shared->type;
+ fill_prop = &(dset->shared->dcpl_cache.fill);
+ use_at_least_v18 = (H5F_LOW_BOUND(file) >= H5F_LIBVER_V18);
+
+ /* Datatype message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_DTYPE_ID, type, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "Can't get size of datatype message")
+ ret_value += get_value;
+
+ /* Shared Dataspace message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_SDSPACE_ID, dset->shared->space, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataspace message")
+ ret_value += get_value;
+
+ /* "Layout" message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_LAYOUT_ID, &dset->shared->layout, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of layout message")
+ ret_value += get_value;
+
+ /* Fill Value message size */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_NEW_ID, fill_prop, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value message")
+ ret_value += get_value;
+
+ /* "Continuation" message size */
+ /* message pointer "continuation" is unused by raw get function, however,
+ * a null pointer would be intercepted by an assert in H5O_msg_size_oh().
+ */
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_CONT_ID, continuation, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of continuation message")
+ ret_value += get_value;
+
+ /* Fill Value (backwards compatability) message size */
+ if(fill_prop->buf && !use_at_least_v18) {
+ H5O_fill_t old_fill_prop; /* Copy for writing "old" fill value */
+
+ /* Shallow copy the fill value property */
+ /* guards against shared component modification */
+ HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop));
+
+ if (H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property")
+
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_FILL_ID, &old_fill_prop, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of fill value (backwards compat) message")
+ ret_value += get_value;
+ }
+
+ /* Filter/Pipeline message size */
+ if(H5D_CHUNKED == dset->shared->layout.type) {
+ H5O_pline_t *pline = &dset->shared->dcpl_cache.pline;
+ if(pline->nused > 0) {
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_PLINE_ID, pline, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of filter message")
+ ret_value += get_value;
+ }
+ }
+
+ /* External File Link message size */
+ if(dset->shared->dcpl_cache.efl.nused > 0) {
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_EFL_ID, &dset->shared->dcpl_cache.efl, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of external file link message")
+ ret_value += get_value;
+ }
+
+ /* Modification Time message size */
+ if(H5O_HDR_STORE_TIMES & H5O_OH_GET_FLAGS(ohdr)) {
+ HDassert(H5O_OH_GET_VERSION(ohdr) >= 1); /* 1 :: H5O_VERSION_1 (H5Opkg.h) */
+
+ if(H5O_OH_GET_VERSION(ohdr) == 1) {
+ /* v1 object headers store modification time as a message */
+ time_t mtime;
+ get_value = H5O_msg_size_oh(file, ohdr, H5O_MTIME_NEW_ID, &mtime, 0);
+ if (get_value == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of modification time message")
+ ret_value += get_value;
+ }
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__calculate_minimum_header_size */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__prepare_minimized_oh
+ *
+ * Purpose: Create an object header (H5O_t) allocated with the smallest
+ * possible size.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 16 August 2018
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5D__prepare_minimized_oh(H5F_t *file, H5D_t *dset, H5O_loc_t *oloc)
+{
+ H5O_t *oh = NULL;
+ size_t ohdr_size = 0;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_STATIC
+
+ HDassert(file);
+ HDassert(dset);
+ HDassert(oloc);
+
+ oh = H5O__create_ohdr(file, dset->shared->dcpl_id);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't instantiate object header")
+
+ ohdr_size = H5D__calculate_minimum_header_size(file, dset, oh);
+ if (ohdr_size == 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "computed header size is invalid")
+
+ /* Special allocation of space for compact datsets is handled by the call here. */
+ if(H5O__apply_ohdr(file, oh, dset->shared->dcpl_id, ohdr_size, (size_t)1, oloc) == FAIL)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "can't apply object header to file")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+} /* H5D__prepare_minimized_oh */
+
+
+/*-------------------------------------------------------------------------
* Function: H5D__update_oh_info
*
* Purpose: Create and fill object header for dataset
@@ -683,6 +850,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */
hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */
hbool_t use_at_least_v18; /* Flag indicating to use at least v18 format versions */
+ hbool_t use_minimized_header = FALSE; /* Flag to use minimized dataset object headers */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -751,13 +919,24 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set fill value info")
} /* end if */
- /* Add the dataset's raw data size to the size of the header, if the raw data will be stored as compact */
- if(layout->type == H5D_COMPACT)
- ohdr_size += layout->storage.u.compact.size;
+ if(H5D__use_minimized_dset_headers(file, dset, &use_minimized_header) == FAIL)
+ HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get minimize settings")
+
+ if(TRUE == use_minimized_header) {
+ if(H5D__prepare_minimized_oh(file, dset, oloc) == FAIL)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create minimized dataset object header")
+ } else {
+ /* Add the dataset's raw data size to the size of the header, if the
+ * raw data will be stored as compact
+ */
+ if(H5D_COMPACT == layout->type)
+ ohdr_size += layout->storage.u.compact.size;
+
+ /* Create an object header for the dataset */
+ if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
+ } /* if using default/minimized object headers */
- /* Create an object header for the dataset */
- if(H5O_create(file, ohdr_size, (size_t)1, dset->shared->dcpl_id, oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset object header")
HDassert(file == dset->oloc.file);
/* Pin the object header */
@@ -1189,7 +1368,7 @@ H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id)
hbool_t loc_found = FALSE; /* Location at 'name' found */
H5D_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(loc);
@@ -1223,7 +1402,7 @@ done:
if(loc_found && H5G_loc_free(&dset_loc) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__open_name() */
@@ -1617,7 +1796,7 @@ H5D__close_cb(H5D_t *dataset)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* check args */
HDassert(dataset && dataset->oloc.file && dataset->shared);
@@ -1628,7 +1807,7 @@ H5D__close_cb(H5D_t *dataset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close dataset");
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__close_cb() */
@@ -2262,7 +2441,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size_real
+ * Function: H5D__get_storage_size
*
* Purpose: Determines how much space has been reserved to store the raw
* data of a dataset.
@@ -2270,8 +2449,8 @@ done:
* Return: Non-negative on success, negative on failure
*-------------------------------------------------------------------------
*/
-static herr_t
-H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size)
+herr_t
+H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2313,35 +2492,6 @@ H5D__get_storage_size_real(const H5D_t *dset, hsize_t *storage_size)
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
-} /* end H5D__get_storage_size_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5D__get_storage_size
- *
- * Purpose: Determines how much space has been reserved to store the raw
- * data of a dataset.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating attributes that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Non-negative on success, negative on failure
- *-------------------------------------------------------------------------
- */
-herr_t
-H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Difficult to error check, since the error value is 0 and 0 is a valid value... :-/ */
- if(H5D__get_storage_size_real(dset, storage_size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5D__get_storage_size() */
@@ -2586,7 +2736,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
unsigned dim_idx; /* Dimension index */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dset->oloc.addr)
/* Check args */
HDassert(dset);
@@ -2747,7 +2897,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size)
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__set_extent() */
@@ -2833,7 +2983,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(dset);
@@ -2848,7 +2998,7 @@ H5D__flush(H5D_t *dset, hid_t dset_id)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset and object flush callback")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__flush() */
@@ -2873,7 +3023,7 @@ H5D__format_convert(H5D_t *dataset)
hbool_t add_new_layout = FALSE; /* Indicate that the new layout message is added */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* Check args */
HDassert(dataset);
@@ -2999,7 +3149,7 @@ done:
if(newlayout != NULL)
newlayout = (H5O_layout_t *)H5MM_xfree(newlayout);
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__format_convert() */
@@ -3126,44 +3276,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5D__get_create_plist
- *
- * Purpose: Internal routine to retrieve a dataset's creation property list.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: ID for a copy of the dataset creation property
- * list. The property list ID should be released
- * by calling H5Pclose().
- *
- * Failure: FAIL
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5D__get_create_plist(const H5D_t *dset)
-{
- hid_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(dset);
-
- /* Retrieve the DCPL */
- if((ret_value = H5D_get_create_plist(dset)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataset's creation property list")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5D__get_create_plist() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5D_get_create_plist
*
* Purpose: Private function for H5Dget_create_plist
@@ -3422,7 +3534,7 @@ H5D__get_space(const H5D_t *dset)
H5S_t *space = NULL;
hid_t ret_value = H5I_INVALID_HID;
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* If the layout is virtual, update the extent */
if(dset->shared->layout.type == H5D_VIRTUAL)
@@ -3443,7 +3555,7 @@ done:
if(H5S_close(space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__get_space() */
@@ -3508,7 +3620,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset)
hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(dset);
@@ -3536,6 +3648,6 @@ done:
if(H5D__virtual_release_source_dset_files(head) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't release VDS source files held open")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__refresh() */
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 5fea91f..8abcd81 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -449,7 +449,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL_TAG(dataset->oloc.addr)
+ FUNC_ENTER_PACKAGE_TAG(dataset->oloc.addr)
/* check args */
HDassert(dataset && dataset->oloc.file);
@@ -616,7 +616,7 @@ done:
if(H5S_close(projected_mem_space) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down projected memory dataspace")
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__read() */
@@ -685,22 +685,12 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space,
/* Various MPI based checks */
#ifdef H5_HAVE_PARALLEL
- if H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI) {
- /* If MPI based VFD is used, no VL datatype support yet. */
- /* This is because they use the global heap in the file and we don't */
- /* support parallel access of that yet */
- if(H5T_detect_class(type_info.mem_type, H5T_VLEN, FALSE) > 0)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL datatypes yet")
-
- /* If MPI based VFD is used, no VL datatype support yet. */
+ if(H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_HAS_MPI)) {
+ /* If MPI based VFD is used, no VL or region reference datatype support yet. */
/* This is because they use the global heap in the file and we don't */
/* support parallel access of that yet */
- /* We should really use H5T_detect_class() here, but it will be difficult
- * to detect the type of the reference if it is nested... -QAK
- */
- if(H5T_get_class(type_info.mem_type, TRUE) == H5T_REFERENCE &&
- H5T_get_ref_type(type_info.mem_type) == H5R_DATASET_REGION)
- HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing region reference datatypes yet")
+ if(H5T_is_vl_storage(type_info.mem_type) > 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "Parallel IO does not support writing VL or region reference datatypes yet")
} /* end if */
else {
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
@@ -1070,16 +1060,13 @@ H5D__typeinfo_init(const H5D_t *dset, hid_t mem_type_id, hbool_t do_write,
if(type_info->request_nelmts == 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "temporary buffer max size is too small")
- /*
- * Get a temporary buffer for type conversion unless the app has already
+ /* Get a temporary buffer for type conversion unless the app has already
* supplied one through the xfer properties. Instead of allocating a
- * buffer which is the exact size, we allocate the target size. The
- * malloc() is usually less resource-intensive if we allocate/free the
- * same size over and over.
+ * buffer which is the exact size, we allocate the target size.
*/
if(NULL == (type_info->tconv_buf = (uint8_t *)tconv_buf)) {
/* Allocate temporary buffer */
- if(NULL == (type_info->tconv_buf = H5FL_BLK_MALLOC(type_conv, target_size)))
+ if(NULL == (type_info->tconv_buf = H5FL_BLK_CALLOC(type_conv, target_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion")
type_info->tconv_buf_allocated = TRUE;
} /* end if */
@@ -1182,15 +1169,19 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
hbool_t local_error_message_previously_written = FALSE;
hbool_t global_error_message_previously_written = FALSE;
size_t index;
- char local_no_collective_cause_string[256] = "";
- char global_no_collective_cause_string[256] = "";
+ size_t cause_strings_len;
+ char local_no_collective_cause_string[512] = "";
+ char global_no_collective_cause_string[512] = "";
const char *cause_strings[] = { "independent I/O was requested",
"datatype conversions were required",
"data transforms needed to be applied",
"optimized MPI types flag wasn't set",
"one of the dataspaces was neither simple nor scalar",
"dataset was not contiguous or chunked",
- "parallel writes to filtered datasets are disabled" };
+ "parallel writes to filtered datasets are disabled",
+ "an error occurred while checking if collective I/O was possible" };
+
+ cause_strings_len = sizeof(cause_strings) / sizeof(cause_strings[0]);
if(H5CX_get_mpio_local_no_coll_cause(&local_no_collective_cause) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get local no collective cause value")
@@ -1199,7 +1190,7 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset,
/* Append each of the "reason for breaking collective I/O" error messages to the
* local and global no collective cause strings */
- for (cause = 1, index = 0; cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE; cause <<= 1, index++) {
+ for (cause = 1, index = 0; (cause < H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE) && (index < cause_strings_len); cause <<= 1, index++) {
size_t cause_strlen = HDstrlen(cause_strings[index]);
if (cause & local_no_collective_cause) {
diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c
index a669593..6803b60 100644
--- a/src/H5Dmpio.c
+++ b/src/H5Dmpio.c
@@ -37,7 +37,6 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
-#include "H5FDmpi.h" /* MPI-based file drivers */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
@@ -83,16 +82,25 @@
/* Macros to represent the regularity of the selection for multiple chunk IO case. */
#define H5D_CHUNK_SELECT_REG 1
-
/******************/
/* Local Typedefs */
/******************/
/* Combine chunk address and chunk info into a struct for better performance. */
typedef struct H5D_chunk_addr_info_t {
- haddr_t chunk_addr;
- H5D_chunk_info_t chunk_info;
+ haddr_t chunk_addr;
+ H5D_chunk_info_t chunk_info;
} H5D_chunk_addr_info_t;
+/* Rank 0 Bcast values */
+typedef enum H5D_mpio_no_rank0_bcast_cause_t {
+ H5D_MPIO_RANK0_BCAST = 0x00,
+ H5D_MPIO_RANK0_NOT_H5S_ALL = 0x01,
+ H5D_MPIO_RANK0_NOT_CONTIGUOUS = 0x02,
+ H5D_MPIO_RANK0_NOT_FIXED_SIZE = 0x04,
+ H5D_MPIO_RANK0_GREATER_THAN_2GB = 0x08
+} H5D_mpio_no_rank0_bcast_cause_t;
+
+
/*
* Information about a single chunk when performing collective filtered I/O. All
* of the fields of one of these structs are initialized at the start of collective
@@ -281,8 +289,10 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
const H5S_t *mem_space, const H5D_type_info_t *type_info)
{
H5FD_mpio_xfer_t io_xfer_mode; /* MPI I/O transfer mode */
- unsigned local_cause = 0; /* Local reason(s) for breaking collective mode */
- unsigned global_cause = 0; /* Global reason(s) for breaking collective mode */
+ unsigned local_cause[2] = {0,0}; /* [0] Local reason(s) for breaking collective mode */
+ /* [1] Flag if dataset is both: H5S_ALL and small */
+ unsigned global_cause[2] = {0,0}; /* Global reason(s) for breaking collective mode */
+ htri_t is_vl_storage; /* Whether the dataset's datatype is stored in a variable-length form */
htri_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -296,36 +306,37 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
/* For independent I/O, get out quickly and don't try to form consensus */
if(H5CX_get_io_xfer_mode(&io_xfer_mode) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode")
+ /* Set error flag, but keep going */
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
if(io_xfer_mode == H5FD_MPIO_INDEPENDENT)
- local_cause |= H5D_MPIO_SET_INDEPENDENT;
+ local_cause[0] |= H5D_MPIO_SET_INDEPENDENT;
/* Optimized MPI types flag must be set */
/* (based on 'HDF5_MPI_OPT_TYPES' environment variable) */
if(!H5FD_mpi_opt_types_g)
- local_cause |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
+ local_cause[0] |= H5D_MPIO_MPI_OPT_TYPES_ENV_VAR_DISABLED;
/* Don't allow collective operations if datatype conversions need to happen */
if(!type_info->is_conv_noop)
- local_cause |= H5D_MPIO_DATATYPE_CONVERSION;
+ local_cause[0] |= H5D_MPIO_DATATYPE_CONVERSION;
/* Don't allow collective operations if data transform operations should occur */
if(!type_info->is_xform_noop)
- local_cause |= H5D_MPIO_DATA_TRANSFORMS;
+ local_cause[0] |= H5D_MPIO_DATA_TRANSFORMS;
/* Check whether these are both simple or scalar dataspaces */
if(!((H5S_SIMPLE == H5S_GET_EXTENT_TYPE(mem_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(mem_space))
&& (H5S_SIMPLE == H5S_GET_EXTENT_TYPE(file_space) || H5S_SCALAR == H5S_GET_EXTENT_TYPE(file_space))))
- local_cause |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES;
+ local_cause[0] |= H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES;
/* Dataset storage must be contiguous or chunked */
if(!(io_info->dset->shared->layout.type == H5D_CONTIGUOUS ||
io_info->dset->shared->layout.type == H5D_CHUNKED))
- local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
+ local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
/* check if external-file storage is used */
if(io_info->dset->shared->dcpl_cache.efl.nused > 0)
- local_cause |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
+ local_cause[0] |= H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET;
/* The handling of memory space is different for chunking and contiguous
* storage. For contiguous storage, mem_space and file_space won't change
@@ -340,31 +351,84 @@ H5D__mpio_opt_possible(const H5D_io_info_t *io_info, const H5S_t *file_space,
* is less than 3. The functions needed (MPI_Mprobe and MPI_Imrecv) will
* not be available.
*/
- if (io_info->op_type == H5D_IO_OP_WRITE &&
- io_info->dset->shared->layout.type == H5D_CHUNKED &&
- io_info->dset->shared->dcpl_cache.pline.nused > 0)
- local_cause |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
+ if(io_info->op_type == H5D_IO_OP_WRITE &&
+ io_info->dset->shared->layout.type == H5D_CHUNKED &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0)
+ local_cause[0] |= H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED;
#endif
+ /* Check if we are able to do a MPI_Bcast of the data from one rank
+ * instead of having all the processes involved in the collective I/O call.
+ */
+
+ /* Check to see if the process is reading the entire dataset */
+ if(H5S_GET_SELECT_TYPE(file_space) != H5S_SEL_ALL)
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_H5S_ALL;
+ /* Only perform this optimization for contigous datasets, currently */
+ else if(H5D_CONTIGUOUS != io_info->dset->shared->layout.type)
+ /* Flag to do a MPI_Bcast of the data from one proc instead of
+ * having all the processes involved in the collective I/O.
+ */
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_CONTIGUOUS;
+ else if((is_vl_storage = H5T_is_vl_storage(type_info->dset_type)) < 0)
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else if(is_vl_storage)
+ local_cause[1] |= H5D_MPIO_RANK0_NOT_FIXED_SIZE;
+ else {
+ size_t type_size; /* Size of dataset's datatype */
+
+ /* Retrieve the size of the dataset's datatype */
+ if(0 == (type_size = H5T_GET_SIZE(type_info->dset_type)))
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else {
+ hssize_t snelmts; /* [Signed] # of elements in dataset's dataspace */
+
+ /* Retrieve the size of the dataset's datatype */
+ if((snelmts = H5S_GET_EXTENT_NPOINTS(file_space)) < 0)
+ local_cause[0] |= H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE;
+ else {
+ hsize_t dset_size;
+
+ /* Determine dataset size */
+ dset_size = ((hsize_t)snelmts) * type_size;
+
+ /* If the size of the dataset is less than 2GB then do an MPI_Bcast
+ * of the data from one process instead of having all the processes
+ * involved in the collective I/O.
+ */
+ if(dset_size > ((hsize_t)(2.0F * H5_GB) - 1))
+ local_cause[1] |= H5D_MPIO_RANK0_GREATER_THAN_2GB;
+ } /* end else */
+ } /* end else */
+ } /* end else */
+
/* Check for independent I/O */
- if(local_cause & H5D_MPIO_SET_INDEPENDENT)
- global_cause = local_cause;
+ if(local_cause[0] & H5D_MPIO_SET_INDEPENDENT)
+ global_cause[0] = local_cause[0];
else {
int mpi_code; /* MPI error code */
/* Form consensus opinion among all processes about whether to perform
* collective I/O
*/
- if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 1, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Allreduce(&local_cause, &global_cause, 2, MPI_UNSIGNED, MPI_BOR, io_info->comm)))
HMPI_GOTO_ERROR(FAIL, "MPI_Allreduce failed", mpi_code)
} /* end else */
/* Set the local & global values of no-collective-cause in the API context */
- H5CX_set_mpio_local_no_coll_cause(local_cause);
- H5CX_set_mpio_global_no_coll_cause(global_cause);
+ H5CX_set_mpio_local_no_coll_cause(local_cause[0]);
+ H5CX_set_mpio_global_no_coll_cause(global_cause[0]);
+
+ /* Set read-with-rank0-and-bcast flag if possible */
+ if(global_cause[0] == 0 && global_cause[1] == 0) {
+ H5CX_set_mpio_rank0_bcast(TRUE);
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ H5CX_test_set_mpio_coll_rank0_bcast(TRUE);
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+ } /* end if */
/* Set the return value, based on the global cause */
- ret_value = global_cause > 0 ? FALSE : TRUE;
+ ret_value = global_cause[0] > 0 ? FALSE : TRUE;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -736,6 +800,10 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf
HDassert(type_info);
HDassert(fm);
+ /* Disable collective metadata reads for chunked dataset I/O operations
+ * in order to prevent potential hangs */
+ H5CX_set_coll_metadata_read(FALSE);
+
/* Check the optional property list for the collective chunk IO optimization option */
if(H5CX_get_mpio_chunk_opt_mode(&chunk_opt_mode) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "couldn't get chunk optimization option")
@@ -2249,7 +2317,7 @@ if(H5DEBUG(D))
/* Broadcasting the MPI_IO option info. and chunk address info. */
if(MPI_SUCCESS != (mpi_code = MPI_Bcast(total_chunk_addr_array, (int)(sizeof(haddr_t) * fm->layout->u.chunk.nchunks), MPI_BYTE, (int)0, io_info->comm)))
- HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code)
} /* end if */
/* Start at first node in chunk skip list */
@@ -2901,6 +2969,8 @@ done:
H5MM_free(num_assigned_chunks_array);
if (shared_chunks_info_array)
H5MM_free(shared_chunks_info_array);
+ if (H5Pclose(fapl_id) < 0)
+ HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "couldn't close FAPL")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_redistribute_shared_chunks() */
@@ -3074,8 +3144,8 @@ H5D__filtered_collective_chunk_entry_io(H5D_filtered_collective_io_info_t *chunk
chunk_entry->chunk_states.new_chunk.length = chunk_entry->chunk_states.chunk_current.length;
/* Currently, these chunk reads are done independently and will likely
- * cause issues with collective metadata reads enabled. In the future,
- * this should be refactored to use collective chunk reads - JTH */
+ * cause issues with collective metadata reads enabled. In the future,
+ * this should be refactored to use collective chunk reads - JTH */
/* Get the original state of parallel I/O transfer mode */
if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
diff --git a/src/H5Dnone.c b/src/H5Dnone.c
index be421b6..09e781e 100644
--- a/src/H5Dnone.c
+++ b/src/H5Dnone.c
@@ -242,7 +242,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
unsigned u; /* Local index variable */
int curr_dim; /* Current rank */
hsize_t idx; /* Array index of chunk */
- int ret_value = -1; /* Return value */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC_NOERR
@@ -266,7 +266,7 @@ H5D__none_idx_iterate(const H5D_chk_idx_info_t *idx_info,
HDassert(ndims > 0);
/* Iterate over all the chunks in the dataset's dataspace */
- for(u = 0; u < idx_info->layout->nchunks; u++) {
+ for(u = 0; u < idx_info->layout->nchunks && ret_value == H5_ITER_CONT; u++) {
/* Calculate the index of this chunk */
idx = H5VM_array_offset_pre(ndims, idx_info->layout->max_down_chunks, chunk_rec.scaled);
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index b887b87..da74d11 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -555,8 +555,6 @@ H5_DLL H5D_t *H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space,
H5_DLL H5D_t *H5D__create_named(const H5G_loc_t *loc, const char *name,
hid_t type_id, const H5S_t *space, hid_t lcpl_id, hid_t dcpl_id,
hid_t dapl_id);
-H5_DLL H5D_t *H5D__create_anon(H5F_t *file, hid_t type_id, const H5S_t *space,
- hid_t dcpl_id, hid_t dapl_id);
H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id);
H5_DLL hid_t H5D__get_space(const H5D_t *dset);
H5_DLL hid_t H5D__get_type(const H5D_t *dset);
@@ -566,6 +564,9 @@ H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t
H5_DLL herr_t H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size);
H5_DLL herr_t H5D__get_chunk_storage_size(H5D_t *dset, const hsize_t *offset,
hsize_t *storage_size);
+H5_DLL herr_t H5D__get_num_chunks(const H5D_t *dset, const H5S_t *space, hsize_t *nchunks);
+H5_DLL herr_t H5D__get_chunk_info(const H5D_t *dset, const H5S_t *space, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *offset, hsize_t *size);
+H5_DLL herr_t H5D__get_chunk_info_by_coord(const H5D_t *dset, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5D__get_offset(const H5D_t *dset);
H5_DLL void *H5D__vlen_get_buf_size_alloc(size_t size, void *info);
H5_DLL herr_t H5D__vlen_get_buf_size(void *elem, hid_t type_id, unsigned ndim,
@@ -575,7 +576,6 @@ H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size);
H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
-H5_DLL hid_t H5D__get_create_plist(const H5D_t *dset);
H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags);
H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h
index cbee0de..00e1e28 100644
--- a/src/H5Dprivate.h
+++ b/src/H5Dprivate.h
@@ -45,6 +45,7 @@
#define H5D_CRT_FILL_VALUE_NAME "fill_value" /* Fill value */
#define H5D_CRT_ALLOC_TIME_STATE_NAME "alloc_time_state" /* Space allocation time state */
#define H5D_CRT_EXT_FILE_LIST_NAME "efl" /* External file list */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_NAME "dset_oh_minimize" /* Minimize dataset object header */
/* ======== Dataset access property names ======== */
#define H5D_ACS_DATA_CACHE_NUM_SLOTS_NAME "rdcc_nslots" /* Size of raw data chunk cache(slots) */
@@ -94,7 +95,13 @@
/* Definitions for all collective chunk instrumentation properties */
#define H5D_XFER_COLL_CHUNK_SIZE sizeof(unsigned)
#define H5D_XFER_COLL_CHUNK_DEF 1
-#define H5D_XFER_COLL_CHUNK_FIX 0
+
+/* General collective I/O instrumentation properties */
+#define H5D_XFER_COLL_RANK0_BCAST_NAME "coll_rank0_bcast"
+
+/* Definitions for general collective I/O instrumentation properties */
+#define H5D_XFER_COLL_RANK0_BCAST_SIZE sizeof(hbool_t)
+#define H5D_XFER_COLL_RANK0_BCAST_DEF FALSE
#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
/* Default temporary buffer size */
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index a1ccda0..2dcbeae 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -141,6 +141,9 @@ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_bytes);
+H5_DLL herr_t H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks);
+H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
+H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx, hsize_t *coord, unsigned *filter_mask, haddr_t *addr, hsize_t *size);
H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, void *buf/*out*/);
diff --git a/src/H5E.c b/src/H5E.c
index eecf6e7..84e4b1a 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -1481,7 +1481,7 @@ done:
*
* Purpose: Prints the error stack in some default way. This is just a
* convenience function for H5Ewalk() with a function that
- * prints error messages. Users are encouraged to write there
+ * prints error messages. Users are encouraged to write their
* own more specific error handlers.
*
* Return: Non-negative on success/Negative on failure
@@ -1563,8 +1563,8 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi
/* Walk the error stack */
op.vers = 2;
op.u.func2 = stack_func;
- if(H5E_walk(estack, direction, &op, client_data) < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if((ret_value = H5E_walk(estack, direction, &op, client_data)) < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5EA.c b/src/H5EA.c
index 9ceb144..0b340a7 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -986,23 +986,27 @@ END_FUNC(PRIV) /* end H5EA_delete() */
* Purpose: Iterate over the elements of an extensible array
* (copied and modified from FA_iterate() in H5FA.c)
*
- * Return: SUCCEED/FAIL
+ * Return: H5_ITER_CONT/H5_ITER_ERROR
*
* Programmer: Vailin Choi; Feb 2015
*
+ * Modification:
+ * Prototype changed (HDFFV-10661)
+ * - herr_t to int
+ * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
+ * December 24, 2018 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
+int, H5_ITER_CONT, H5_ITER_ERROR,
H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
/* Local variables */
uint8_t *elmt = NULL;
hsize_t u;
+ int cb_ret = H5_ITER_CONT; /* Return value from callback */
- /*
- * Check arguments.
- */
+ /* Check arguments */
HDassert(ea);
HDassert(op);
HDassert(udata);
@@ -1012,9 +1016,7 @@ H5EA_iterate(H5EA_t *ea, H5EA_operator_t op, void *udata))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element")
/* Iterate over all elements in array */
- for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) {
- int cb_ret; /* Return value from callback */
-
+ for(u = 0; u < ea->hdr->stats.stored.max_idx_set && cb_ret == H5_ITER_CONT; u++) {
/* Get array element */
if(H5EA_get(ea, u, elmt) < 0)
H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
diff --git a/src/H5Edefin.h b/src/H5Edefin.h
index a09db35..1e1730e 100644
--- a/src/H5Edefin.h
+++ b/src/H5Edefin.h
@@ -179,7 +179,8 @@ hid_t H5E_CANTRESIZE_g = FAIL; /* Unable to resize a metadata cache ent
hid_t H5E_CANTDEPEND_g = FAIL; /* Unable to create a flush dependency */
hid_t H5E_CANTUNDEPEND_g = FAIL; /* Unable to destroy a flush dependency */
hid_t H5E_CANTNOTIFY_g = FAIL; /* Unable to notify object about action */
-hid_t H5E_LOGFAIL_g = FAIL; /* Failure in the cache logging framework */
+hid_t H5E_LOGGING_g = FAIL; /* Failure in the cache logging framework */
+hid_t H5E_LOGFAIL_g = FAIL; /* old H5E_LOGGING_g (maintained for binary compatibility) */
hid_t H5E_CANTCORK_g = FAIL; /* Unable to cork an object */
hid_t H5E_CANTUNCORK_g = FAIL; /* Unable to uncork an object */
diff --git a/src/H5Einit.h b/src/H5Einit.h
index ead5f67..713b2fb 100644
--- a/src/H5Einit.h
+++ b/src/H5Einit.h
@@ -697,9 +697,14 @@ if((msg = H5E_create_msg(cls, H5E_MINOR, "Unable to notify object about action")
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_CANTNOTIFY_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
-assert(H5E_LOGFAIL_g==(-1));
+assert(H5E_LOGGING_g==(-1));
if((msg = H5E_create_msg(cls, H5E_MINOR, "Failure in the cache logging framework"))==NULL)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
+if((H5E_LOGGING_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
+assert(H5E_LOGFAIL_g==(-1));
+if((msg = H5E_create_msg(cls, H5E_MINOR, "old H5E_LOGGING_g (maintained for binary compatibility)"))==NULL)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "error message initialization failed")
if((H5E_LOGFAIL_g = H5I_register(H5I_ERROR_MSG, msg, FALSE))<0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTREGISTER, FAIL, "can't register error message")
assert(H5E_CANTCORK_g==(-1));
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 15953af..ff2a860 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -419,13 +419,13 @@ done:
/*-------------------------------------------------------------------------
* Function: H5E_print
*
- * Purpose: Private function to print the error stack in some default
+ * Purpose: Private function to print the error stack in some default
* way. This is just a convenience function for H5Ewalk() and
* H5Ewalk2() with a function that prints error messages.
- * Users are encouraged to write there own more specific error
+ * Users are encouraged to write their own more specific error
* handlers.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Robb Matzke
* Friday, February 27, 1998
@@ -510,9 +510,8 @@ herr_t
H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op,
void *client_data)
{
- int i; /* Local index variable */
- herr_t status; /* Status from callback function */
- herr_t ret_value = SUCCEED; /* Return value */
+ int i; /* Local index variable */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -530,9 +529,8 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op
if(op->u.func1) {
H5E_error1_t old_err;
- status = SUCCEED;
if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++) {
+ for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) {
/* Point to each error record on the stack and pass it to callback function.*/
old_err.maj_num = estack->slot[i].maj_num;
old_err.min_num = estack->slot[i].min_num;
@@ -541,12 +539,12 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op
old_err.desc = estack->slot[i].desc;
old_err.line = estack->slot[i].line;
- status = (op->u.func1)(i, &old_err, client_data);
+ ret_value = (op->u.func1)(i, &old_err, client_data);
} /* end for */
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--) {
+ for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) {
/* Point to each error record on the stack and pass it to callback function.*/
old_err.maj_num = estack->slot[i].maj_num;
old_err.min_num = estack->slot[i].min_num;
@@ -555,12 +553,12 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op
old_err.desc = estack->slot[i].desc;
old_err.line = estack->slot[i].line;
- status = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
+ ret_value = (op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
} /* end for */
} /* end else */
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if(ret_value < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
#else /* H5_NO_DEPRECATED_SYMBOLS */
HDassert(0 && "version 1 error stack walk without deprecated symbols!");
@@ -569,19 +567,18 @@ H5E_walk(const H5E_t *estack, H5E_direction_t direction, const H5E_walk_op_t *op
else {
HDassert(op->vers == 2);
if(op->u.func2) {
- status = SUCCEED;
if(H5E_WALK_UPWARD == direction) {
- for(i = 0; i < (int)estack->nused && status >= 0; i++)
- status = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
+ for(i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++)
+ ret_value = (op->u.func2)((unsigned)i, estack->slot + i, client_data);
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
- for(i = (int)(estack->nused - 1); i >= 0 && status >= 0; i--)
- status = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
+ for(i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--)
+ ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)), estack->slot + i, client_data);
} /* end else */
- if(status < 0)
- HGOTO_ERROR(H5E_ERROR, H5E_CANTLIST, FAIL, "can't walk error stack")
+ if(ret_value < 0)
+ HERROR(H5E_ERROR, H5E_CANTLIST, "can't walk error stack");
} /* end if */
} /* end else */
diff --git a/src/H5Epubgen.h b/src/H5Epubgen.h
index 7a907c7..7d167b5 100644
--- a/src/H5Epubgen.h
+++ b/src/H5Epubgen.h
@@ -292,6 +292,7 @@ H5_DLLVAR hid_t H5E_NOIDS_g; /* Out of IDs for group */
#define H5E_CANTDEPEND (H5OPEN H5E_CANTDEPEND_g)
#define H5E_CANTUNDEPEND (H5OPEN H5E_CANTUNDEPEND_g)
#define H5E_CANTNOTIFY (H5OPEN H5E_CANTNOTIFY_g)
+#define H5E_LOGGING (H5OPEN H5E_LOGGING_g)
#define H5E_LOGFAIL (H5OPEN H5E_LOGFAIL_g)
#define H5E_CANTCORK (H5OPEN H5E_CANTCORK_g)
#define H5E_CANTUNCORK (H5OPEN H5E_CANTUNCORK_g)
@@ -319,7 +320,8 @@ H5_DLLVAR hid_t H5E_CANTRESIZE_g; /* Unable to resize a metadata cache entry
H5_DLLVAR hid_t H5E_CANTDEPEND_g; /* Unable to create a flush dependency */
H5_DLLVAR hid_t H5E_CANTUNDEPEND_g; /* Unable to destroy a flush dependency */
H5_DLLVAR hid_t H5E_CANTNOTIFY_g; /* Unable to notify object about action */
-H5_DLLVAR hid_t H5E_LOGFAIL_g; /* Failure in the cache logging framework */
+H5_DLLVAR hid_t H5E_LOGGING_g; /* Failure in the cache logging framework */
+H5_DLLVAR hid_t H5E_LOGFAIL_g; /* old H5E_LOGGING_g (maintained for binary compatibility) */
H5_DLLVAR hid_t H5E_CANTCORK_g; /* Unable to cork an object */
H5_DLLVAR hid_t H5E_CANTUNCORK_g; /* Unable to uncork an object */
diff --git a/src/H5Eterm.h b/src/H5Eterm.h
index 6012657..0cdfccf 100644
--- a/src/H5Eterm.h
+++ b/src/H5Eterm.h
@@ -181,6 +181,7 @@ H5E_CANTRESIZE_g=
H5E_CANTDEPEND_g=
H5E_CANTUNDEPEND_g=
H5E_CANTNOTIFY_g=
+H5E_LOGGING_g=
H5E_LOGFAIL_g=
H5E_CANTCORK_g=
H5E_CANTUNCORK_g=
diff --git a/src/H5F.c b/src/H5F.c
index 01fd7db..69d3e79 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -440,7 +440,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
flags |= H5F_ACC_RDWR | H5F_ACC_CREAT;
/* Create a new file or truncate an existing file. */
- if (NULL == (new_file = H5F__create(filename, flags, fcpl_id, fapl_id)))
+ if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file")
/* Get an atom for the file */
@@ -505,7 +505,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Open the file */
- if(NULL == (new_file = H5F__open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
+ if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id)))
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file")
/* Get an atom for the file */
@@ -621,15 +621,22 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
* to be flushed.
*/
if(H5F_ACC_RDWR & H5F_INTENT(f)) {
- hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */
+ hid_t fapl_id = H5P_DEFAULT; /* FAPL to use */
/* Verify access property list and set up collective metadata if appropriate */
if(H5CX_set_apl(&fapl_id, H5P_CLS_FACC, object_id, TRUE) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Flush the file */
- if(H5F__flush(f, scope) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
+ /* Flush other files, depending on scope */
+ if(H5F_SCOPE_GLOBAL == scope) {
+ /* Call the flush routine for mounted file hierarchies */
+ if(H5F_flush_mounts(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
+ } /* end if */
+ else
+ /* Call the flush routine, for this file */
+ if(H5F__flush(f) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
} /* end if */
done:
@@ -796,9 +803,9 @@ H5Fget_freespace(hid_t file_id)
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
- /* Get the free space in the file */
- if(H5F__get_freespace(file, &tot_space) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+ /* Go get the actual amount of free space in the file */
+ if(H5MF_get_freespace(file, &tot_space, NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space for file")
ret_value = (hssize_t)tot_space;
@@ -1273,7 +1280,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0")
/* Get the free-space section information in the file */
- if((ret_value = H5F__get_free_sections(file, type, nsects, sect_info)) < 0)
+ if((ret_value = H5MF_get_free_sections(file, type, nsects, sect_info)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
done:
@@ -1375,7 +1382,7 @@ H5Fstart_mdc_logging(hid_t file_id)
/* Call mdc logging function */
if(H5C_start_logging(file->shared->cache) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to start mdc logging")
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging")
done:
FUNC_LEAVE_API(ret_value)
@@ -1407,7 +1414,7 @@ H5Fstop_mdc_logging(hid_t file_id)
/* Call mdc logging function */
if(H5C_stop_logging(file->shared->cache) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to stop mdc logging")
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging")
done:
FUNC_LEAVE_API(ret_value)
@@ -1438,9 +1445,9 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled,
if(NULL == (file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
- /* Call mdc logging function */
+ /* Call MDC logging function */
if(H5C_get_logging_status(file->shared->cache, is_enabled, is_currently_logging) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_LOGFAIL, FAIL, "unable to get logging status")
+ HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
done:
FUNC_LEAVE_API(ret_value)
@@ -1713,3 +1720,87 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fincrement_filesize() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Get the file-level setting to create minimized dataset object headers.
+ * Result is stored at pointer `minimize`.
+ *
+ * Return:
+ *
+ * Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer:
+ *
+ * Jacob Smith
+ * 15 August 2018
+ *
+ * Changes: None.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize)
+{
+ H5F_t *file = NULL; /* File object for file ID */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", file_id, minimize);
+
+ if(NULL == minimize)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")
+
+ file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+ if(NULL == file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ *minimize = H5F_GET_MIN_DSET_OHDR(file);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Fget_dset_no_attrs_hint */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fset_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Set the file-level setting to create minimized dataset object headers.
+ *
+ * Return:
+ *
+ * Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer:
+ *
+ * Jacob Smith
+ * 15 August 2018
+ *
+ * Changes: None.
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize)
+{
+ H5F_t *file = NULL; /* File object for file ID */
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", file_id, minimize);
+
+ file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE);
+ if(NULL == file)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+
+ H5F_SET_MIN_DSET_OHDR(file, minimize);
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Fset_dset_no_attrs_hint */
diff --git a/src/H5FA.c b/src/H5FA.c
index 61aaa53..e579e4f 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -685,20 +685,26 @@ END_FUNC(PRIV) /* end H5FA_delete() */
* Note: This is not very efficient, we should be iterating directly
* over the fixed array's direct block [pages].
*
- * Return: SUCCEED/FAIL
+ * Return: H5_ITER_CONT/H5_ITER_ERROR
*
* Programmer: Vailin Choi
* Thursday, April 30, 2009
*
+ * Modification:
+ * Prototype changed (HDFFV-10661)
+ * - herr_t to int
+ * - SUCCEED/FAIL to H5_ITER_CONT/H5_ITER_ERROR
+ * December 24, 2018 -BMR
*-------------------------------------------------------------------------
*/
BEGIN_FUNC(PRIV, ERR,
-herr_t, SUCCEED, FAIL,
+int, H5_ITER_CONT, H5_ITER_ERROR,
H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
/* Local variables */
uint8_t *elmt = NULL;
hsize_t u;
+ int cb_ret = H5_ITER_CONT; /* Return value from callback */
/*
* Check arguments.
@@ -712,9 +718,7 @@ H5FA_iterate(H5FA_t *fa, H5FA_operator_t op, void *udata))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array element")
/* Iterate over all elements in array */
- for(u = 0; u < fa->hdr->stats.nelmts; u++) {
- int cb_ret; /* Return value from callback */
-
+ for(u = 0; u < fa->hdr->stats.nelmts && cb_ret == H5_ITER_CONT; u++) {
/* Get array element */
if(H5FA_get(fa, u, elmt) < 0)
H5E_THROW(H5E_CANTGET, "unable to delete fixed array")
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 2ab04dc..395107e 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -343,14 +343,17 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
HDassert(file);
- /* Write to backing store */
- if((off_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET))
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
+ if((HDoff_t)addr != HDlseek(file->fd, (off_t)addr, SEEK_SET))
HGOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "error seeking in backing store")
+#endif /* H5_HAVE_PREADWRITE */
while (size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -361,15 +364,21 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, ptr, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write to backing store failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), ptr, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
@@ -745,6 +754,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
while(size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)0;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -755,15 +765,21 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, mem, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, mem, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', file->mem = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), file->mem, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
HDassert(bytes_read >= 0);
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 7c2297a..74df95c 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -117,7 +117,7 @@ typedef struct H5FD_log_t {
* Whether to eliminate the family driver info and convert this file to
* a single file
*/
- hbool_t fam_to_sec2;
+ hbool_t fam_to_single;
/* Fields for tracking I/O operations */
unsigned char *nread; /* Number of reads from a file location */
@@ -635,13 +635,13 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
/* Check for non-default FAPL */
if(H5P_FILE_ACCESS_DEFAULT != fapl_id) {
/* This step is for h5repart tool only. If user wants to change file driver from
- * family to sec2 while using h5repart, this private property should be set so that
- * in the later step, the library can ignore the family driver information saved
- * in the superblock.
+ * family to one that uses single files (sec2, etc.) while using h5repart, this
+ * private property should be set so that in the later step, the library can ignore
+ * the family driver information saved in the superblock.
*/
- if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0)
- if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2")
+ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0)
+ if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single")
} /* end if */
/* Set return value */
@@ -900,7 +900,7 @@ H5FD_log_query(const H5FD_t *_file, unsigned long *flags /* out */)
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */
/* Check for flags that are set by h5repart */
- if(file && file->fam_to_sec2)
+ if(file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */
} /* end if */
@@ -1189,7 +1189,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
} /* end if */
} /* end if */
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pread) */
if(addr != file->pos || OP_READ != file->op) {
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags & H5FD_LOG_TIME_SEEK)
@@ -1232,6 +1233,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/*
* Read data, being careful of interrupted system calls, partial results,
@@ -1245,6 +1247,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1255,18 +1258,24 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, buf, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if(file->fa.flags & H5FD_LOG_LOC_READ)
HDfprintf(file->logfp, "Error! Reading: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
if(0 == bytes_read) {
@@ -1396,7 +1405,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
file->nwrite[tmp_addr++]++;
} /* end if */
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
if(addr != file->pos || OP_WRITE != file->op) {
#ifdef H5_HAVE_GETTIMEOFDAY
if(file->fa.flags & H5FD_LOG_TIME_SEEK)
@@ -1439,6 +1449,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
#endif /* H5_HAVE_GETTIMEOFDAY */
} /* end if */
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/*
* Write the data, being careful of interrupted system calls and partial
@@ -1452,6 +1463,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -1462,18 +1474,24 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
if(file->fa.flags & H5FD_LOG_LOC_WRITE)
HDfprintf(file->logfp, "Error! Writing: %10a-%10a (%10Zu bytes)\n", orig_addr, (orig_addr + orig_size) - 1, orig_size);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 87f8b6a..efbdafe 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -1414,32 +1414,35 @@ static herr_t
H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
hid_t H5_ATTR_UNUSED dxpl_id, haddr_t addr, size_t size, void *buf/*out*/)
{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
- MPI_Offset mpi_off;
- MPI_Status mpi_stat; /* Status from I/O operation */
- int mpi_code; /* mpi return code */
- MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
- int size_i; /* Integer copy of 'size' to read */
+ H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
+ MPI_Offset mpi_off;
+ MPI_Status mpi_stat; /* Status from I/O operation */
+ int mpi_code; /* mpi return code */
+ MPI_Datatype buf_type = MPI_BYTE; /* MPI description of the selection in memory */
+ int size_i; /* Integer copy of 'size' to read */
#if MPI_VERSION >= 3
- MPI_Count bytes_read; /* Number of bytes read in */
- MPI_Count type_size; /* MPI datatype used for I/O's size */
- MPI_Count io_size; /* Actual number of bytes requested */
- MPI_Count n;
+ MPI_Count bytes_read = 0; /* Number of bytes read in */
+ MPI_Count type_size; /* MPI datatype used for I/O's size */
+ MPI_Count io_size; /* Actual number of bytes requested */
+ MPI_Count n;
#else
- int bytes_read; /* Number of bytes read in */
- int type_size; /* MPI datatype used for I/O's size */
- int io_size; /* Actual number of bytes requested */
- int n;
+ int bytes_read = 0; /* Number of bytes read in */
+ int type_size; /* MPI datatype used for I/O's size */
+ int io_size; /* Actual number of bytes requested */
+ int n;
#endif
- hbool_t use_view_this_time = FALSE;
- herr_t ret_value = SUCCEED;
+ hbool_t use_view_this_time = FALSE;
+ hbool_t rank0_bcast = FALSE; /* If read-with-rank0-and-bcast flag was used */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Entering H5FD_mpio_read\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Entering\n", FUNC);
#endif
+
+ /* Sanity checks */
HDassert(file);
HDassert(H5FD_MPIO==file->pub.driver_id);
HDassert(buf);
@@ -1448,21 +1451,20 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
HDmemset(&mpi_stat,0,sizeof(MPI_Status));
/* some numeric conversions */
- if (H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/)<0)
+ if(H5FD_mpi_haddr_to_MPIOff(addr, &mpi_off/*out*/) < 0)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from haddr to MPI off")
size_i = (int)size;
- if ((hsize_t)size_i != size)
+ if((hsize_t)size_i != size)
HGOTO_ERROR(H5E_INTERNAL, H5E_BADRANGE, FAIL, "can't convert from size to size_i")
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'r'])
- fprintf(stdout, "in H5FD_mpio_read mpi_off=%ld size_i=%d\n",
- (long)mpi_off, size_i );
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: mpi_off = %ld size_i = %d\n", FUNC, (long)mpi_off, size_i);
#endif
/* Only look for MPI views for raw data transfers */
if(type == H5FD_MEM_DRAW) {
- H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
+ H5FD_mpio_xfer_t xfer_mode; /* I/O transfer mode */
/* Get the transfer mode from the API context */
if(H5CX_get_io_xfer_mode(&xfer_mode) < 0)
@@ -1474,8 +1476,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
* us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which
* could mean "use MPI_BYTE" by convention).
*/
- if(xfer_mode==H5FD_MPIO_COLLECTIVE) {
- MPI_Datatype file_type;
+ if(xfer_mode == H5FD_MPIO_COLLECTIVE) {
+ MPI_Datatype file_type;
/* Remember that views are used */
use_view_this_time = TRUE;
@@ -1502,8 +1504,8 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
H5FD_mpio_collective_opt_t coll_opt_mode;
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: using MPIO collective mode\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: using MPIO collective mode\n", FUNC);
#endif
/* Get the collective_opt property to check whether the application wants to do IO individually. */
if(H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0)
@@ -1511,16 +1513,33 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
if(coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) {
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: doing MPI collective IO\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing MPI collective IO\n", FUNC);
#endif
- if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
- HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
+ /* Check whether we should read from rank 0 and broadcast to other ranks */
+ if(H5CX_get_mpio_rank0_bcast()) {
+#ifdef H5FDmpio_DEBUG
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing read-rank0-and-MPI_Bcast\n", FUNC);
+#endif
+ /* Indicate path we've taken */
+ rank0_bcast = TRUE;
+
+ /* Read on rank 0 Bcast to other ranks */
+ if(file->mpi_rank == 0)
+ if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
+ if(MPI_SUCCESS != (mpi_code = MPI_Bcast(buf, size_i, buf_type, 0, file->comm)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", mpi_code)
+ } /* end if */
+ else
+ if(MPI_SUCCESS != (mpi_code = MPI_File_read_at_all(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
+ HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at_all failed", mpi_code)
} /* end if */
else {
#ifdef H5FDmpio_DEBUG
- if(H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "H5FD_mpio_read: doing MPI independent IO\n");
+ if(H5FD_mpio_Debug[(int)'r'])
+ HDfprintf(stdout, "%s: doing MPI independent IO\n", FUNC);
#endif
if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
@@ -1532,44 +1551,57 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type,
*/
if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, H5FD_mpi_native_g, file->info)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code)
- } else {
+ } /* end if */
+ else
if(MPI_SUCCESS != (mpi_code = MPI_File_read_at(file->f, mpi_off, buf, size_i, buf_type, &mpi_stat)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_read_at failed", mpi_code)
- }
- /* How many bytes were actually read? */
+ /* Only retrieve bytes read if this rank _actually_ participated in I/O */
+ if(!rank0_bcast || (rank0_bcast && file->mpi_rank == 0) ) {
+ /* How many bytes were actually read? */
#if MPI_VERSION >= 3
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Get_elements_x(&mpi_stat, buf_type, &bytes_read)))
#else
- if (MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Get_elements(&mpi_stat, MPI_BYTE, &bytes_read)))
#endif
- HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ HMPI_GOTO_ERROR(FAIL, "MPI_Get_elements failed", mpi_code)
+ } /* end if */
+
+ /* If the rank0-bcast feature was used, broadcast the # of bytes read to
+ * other ranks, which didn't perform any I/O.
+ */
+ /* NOTE: This could be optimized further to be combined with the broadcast
+ * of the data. (QAK - 2019/1/2)
+ */
+ if(rank0_bcast)
+ if(MPI_SUCCESS != MPI_Bcast(&bytes_read, 1, MPI_LONG_LONG, 0, file->comm))
+ HMPI_GOTO_ERROR(FAIL, "MPI_Bcast failed", 0)
/* Get the type's size */
#if MPI_VERSION >= 3
- if (MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_size_x(buf_type, &type_size)))
#else
- if (MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
+ if(MPI_SUCCESS != (mpi_code = MPI_Type_size(buf_type, &type_size)))
#endif
HMPI_GOTO_ERROR(FAIL, "MPI_Type_size failed", mpi_code)
/* Compute the actual number of bytes requested */
- io_size=type_size*size_i;
+ io_size = type_size * size_i;
/* Check for read failure */
- if (bytes_read<0 || bytes_read>io_size)
+ if(bytes_read < 0 || bytes_read > io_size)
HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed")
/*
* This gives us zeroes beyond end of physical MPI file.
*/
- if ((n=(io_size-bytes_read)) > 0)
+ if((n = (io_size - bytes_read)) > 0)
HDmemset((char*)buf+bytes_read, 0, (size_t)n);
done:
#ifdef H5FDmpio_DEBUG
- if (H5FD_mpio_Debug[(int)'t'])
- fprintf(stdout, "Leaving H5FD_mpio_read\n" );
+ if(H5FD_mpio_Debug[(int)'t'])
+ HDfprintf(stdout, "%s: Leaving\n", FUNC);
#endif
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 32aff0f..54f5a95 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -94,7 +94,7 @@ typedef struct H5FD_sec2_t {
* Whether to eliminate the family driver info and convert this file to
* a single file.
*/
- hbool_t fam_to_sec2;
+ hbool_t fam_to_single;
} H5FD_sec2_t;
@@ -386,13 +386,13 @@ H5FD_sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
HGOTO_ERROR(H5E_VFL, H5E_BADTYPE, NULL, "not a file access property list")
/* This step is for h5repart tool only. If user wants to change file driver from
- * family to sec2 while using h5repart, this private property should be set so that
- * in the later step, the library can ignore the family driver information saved
- * in the superblock.
+ * family to one that uses single files (sec2, etc.) while using h5repart, this
+ * private property should be set so that in the later step, the library can ignore
+ * the family driver information saved in the superblock.
*/
- if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SEC2_NAME) > 0)
- if(H5P_get(plist, H5F_ACS_FAMILY_TO_SEC2_NAME, &file->fam_to_sec2) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to sec2")
+ if(H5P_exist_plist(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME) > 0)
+ if(H5P_get(plist, H5F_ACS_FAMILY_TO_SINGLE_NAME, &file->fam_to_single) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of changing family to single")
} /* end if */
/* Set return value */
@@ -532,7 +532,7 @@ H5FD_sec2_query(const H5FD_t *_file, unsigned long *flags /* out */)
*flags |= H5FD_FEAT_DEFAULT_VFD_COMPATIBLE; /* VFD creates a file which can be opened with the default VFD */
/* Check for flags that are set by h5repart */
- if(file && file->fam_to_sec2)
+ if(file && file->fam_to_single)
*flags |= H5FD_FEAT_IGNORE_DRVRINFO; /* Ignore the driver info when file is opened (which eliminates it) */
} /* end if */
@@ -682,11 +682,13 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu", (unsigned long long)addr)
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pread) */
if(addr != file->pos || OP_READ != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/* Read data, being careful of interrupted system calls, partial results,
* and the end of the file.
@@ -694,7 +696,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
while(size > 0) {
h5_posix_io_t bytes_in = 0; /* # of bytes to read */
- h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to read more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -705,15 +708,21 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_read = HDpread(file->fd, buf, bytes_in, offset);
+ offset += bytes_read;
+#else
bytes_read = HDread(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_read && EINTR == errno);
if(-1 == bytes_read) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, bytes actually read = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_read, (unsigned long long)offset);
} /* end if */
if(0 == bytes_read) {
@@ -777,11 +786,13 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
if(REGION_OVERFLOW(addr, size))
HGOTO_ERROR(H5E_ARGS, H5E_OVERFLOW, FAIL, "addr overflow, addr = %llu, size = %llu", (unsigned long long)addr, (unsigned long long)size)
- /* Seek to the correct location */
+#ifndef H5_HAVE_PREADWRITE
+ /* Seek to the correct location (if we don't have pwrite) */
if(addr != file->pos || OP_WRITE != file->op) {
if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0)
HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position")
} /* end if */
+#endif /* H5_HAVE_PREADWRITE */
/* Write the data, being careful of interrupted system calls and partial
* results
@@ -790,6 +801,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
h5_posix_io_t bytes_in = 0; /* # of bytes to write */
h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */
+ HDoff_t offset = (HDoff_t)addr;
/* Trying to write more bytes than the return type can handle is
* undefined behavior in POSIX.
@@ -800,15 +812,21 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
bytes_in = (h5_posix_io_t)size;
do {
+#ifdef H5_HAVE_PREADWRITE
+ bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset);
+ offset += bytes_wrote;
+#else
bytes_wrote = HDwrite(file->fd, buf, bytes_in);
+#endif /* H5_HAVE_PREADWRITE */
} while(-1 == bytes_wrote && EINTR == errno);
if(-1 == bytes_wrote) { /* error */
int myerrno = errno;
time_t mytime = HDtime(NULL);
- HDoff_t myoffset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
- HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)myoffset);
+ offset = HDlseek(file->fd, (HDoff_t)0, SEEK_CUR);
+
+ HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = %llu, bytes actually written = %llu, offset = %llu", HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf, (unsigned long long)size, (unsigned long long)bytes_in, (unsigned long long)bytes_wrote, (unsigned long long)offset);
} /* end if */
HDassert(bytes_wrote > 0);
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index de1b4c1..31fc63c 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -25,9 +25,6 @@
#ifndef _H5FSprivate_H
#define _H5FSprivate_H
-/* Include package's public header */
-#include "H5FSpublic.h"
-
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
#include "H5FLprivate.h" /* Free Lists */
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 07bb644..a394071 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -481,7 +481,7 @@ H5F__efc_release(H5F_efc_t *efc)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(efc);
@@ -491,7 +491,7 @@ H5F__efc_release(H5F_efc_t *efc)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't remove entry from external file cache")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_efc_release() */
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 031f37c..253ec3c 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -483,6 +483,30 @@ done:
} /* end H5F_get_objects_cb() */
+/*-------------------------------------------------------------------------
+ * Function: H5F_set_min_dset_ohdr
+ *
+ * Purpose: Set the crt_dset_ohdr_flag field with a new value.
+ *
+ * Return: SUCCEED/FAIL
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize)
+{
+ /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ /* Sanity check */
+ HDassert(f);
+ HDassert(f->shared);
+
+ f->shared->crt_dset_min_ohdr_flag = minimize;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5F_set_min_dset_ohdr() */
+
+
/*--------------------------------------------------------------------------
* Function: H5F__build_name
*
@@ -795,7 +819,7 @@ H5F__is_hdf5(const char *name)
haddr_t sig_addr; /* Addess of hdf5 file signature */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Open the file at the virtual file layer */
if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF)))
@@ -812,7 +836,7 @@ done:
if(H5FD_close(file) < 0 && ret_value >= 0)
HDONE_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__is_hdf5() */
@@ -1333,78 +1357,6 @@ H5F__dest(H5F_t *f, hbool_t flush)
/*-------------------------------------------------------------------------
- * Function: H5F__create
- *
- * Purpose: Internal routine to create a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new file object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5F_t *
-H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
-{
- H5F_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(filename);
-
- /* Create a new file or truncate an existing file. */
- if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__create() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__open
- *
- * Purpose: Internal routine to open a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * opening files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new file object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5F_t *
-H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
-{
- H5F_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(filename);
-
- /* Open the file */
- if(NULL == (ret_value = H5F_open(filename, flags, fcpl_id, fapl_id)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5F__open() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_open
*
* Purpose: Opens (or creates) a file. This function understands the
@@ -1926,7 +1878,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
/*-------------------------------------------------------------------------
- * Function: H5F__flush_real
+ * Function: H5F__flush
*
* Purpose: Flushes cached data.
*
@@ -1934,7 +1886,7 @@ H5F__flush_phase2(H5F_t *f, hbool_t closing)
*-------------------------------------------------------------------------
*/
herr_t
-H5F__flush_real(H5F_t *f)
+H5F__flush(H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1954,49 +1906,6 @@ H5F__flush_real(H5F_t *f)
HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush file data")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__flush_real() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5F__flush
- *
- * Purpose: Internal routine to flush a file.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * flushing files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * December 13, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__flush(H5F_t *f, H5F_scope_t scope)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Flush other files, depending on scope */
- if(H5F_SCOPE_GLOBAL == scope) {
- /* Call the flush routine for mounted file hierarchies */
- if(H5F_flush_mounts(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
- } /* end if */
- else
- /* Call the flush routine, for this file */
- if(H5F__flush_real(f) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
} /* end H5F__flush() */
@@ -2005,10 +1914,6 @@ done:
*
* Purpose: Internal routine to close a file.
*
- * Note: This routine is needed so that there's a non-API routine for
- * closing files that can set up VOL / SWMR info
- * (which need a DXPL).
- *
* Return: Non-negative on success / Negative on failure
*
* Programmer: Quincey Koziol
@@ -2022,7 +1927,7 @@ H5F__close(hid_t file_id)
H5F_t *f; /* File pointer */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Flush file if this is the last reference to this id and we have write
* intent, unless it will be flushed by the "shared" file being closed.
@@ -2037,7 +1942,7 @@ H5F__close(hid_t file_id)
if((nref = H5I_get_ref(file_id, FALSE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get ID ref count")
if(nref == 1)
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
@@ -2047,7 +1952,7 @@ H5F__close(hid_t file_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "decrementing file ID failed")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__close() */
@@ -2073,7 +1978,7 @@ H5F__close_cb(H5F_t *f)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -2105,7 +2010,7 @@ H5F__close_cb(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__close_cb() */
@@ -2780,7 +2685,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(f);
@@ -2808,7 +2713,7 @@ H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high)
*
* QAK - April, 2018
*/
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Set the new bounds */
@@ -2822,45 +2727,10 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F__get_freespace
- *
- * Purpose: Private version of H5Fget_freespace
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: SUCCEED
- * Failure: FAIL
- *-------------------------------------------------------------------------
- */
-herr_t
-H5F__get_freespace(H5F_t *f, hsize_t *tot_space)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Go get the actual amount of free space in the file */
- if(H5MF_get_freespace(f, tot_space, NULL) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5F__get_freespace() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F__get_file_image
*
* Purpose: Private version of H5Fget_file_image
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Bytes copied / number of bytes needed.
* Failure: negative value
*-------------------------------------------------------------------------
@@ -2872,7 +2742,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
haddr_t eoa; /* End of file address */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
if(!file || !file->shared || !file->shared->lf)
@@ -2959,7 +2829,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_file_image() */
@@ -2968,9 +2838,6 @@ done:
*
* Purpose: Private version of H5Fget_info
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: SUCCEED
* Failure: FAIL
*-------------------------------------------------------------------------
@@ -2980,7 +2847,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3009,7 +2876,7 @@ H5F__get_info(H5F_t *f, H5F_info2_t *finfo)
finfo->free.version = HDF5_FREESPACE_VERSION;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_info() */
@@ -3098,39 +2965,6 @@ H5F_set_retries(H5F_t *f)
/*-------------------------------------------------------------------------
- * Function: H5F__get_free_sections
- *
- * Purpose: Private version of H5Fget_free_sections
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: non-negative, the total # of free space sections
- * Failure: negative
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects,
- H5F_sect_info_t *sect_info)
-{
- ssize_t ret_value = -1; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(f);
- HDassert(f->shared);
-
- /* Go get the actual amount of free space in the file */
- if((ret_value = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get free space sections for file")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5F__get_free_sections() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5F_object_flush_cb
*
* Purpose: To invoke the callback function for object flush that is set
@@ -3426,9 +3260,6 @@ done:
* set up flush dependency/proxy even for file opened without
* SWMR to resolve issues with opened objects.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: SUCCEED
* Failure: FAIL
*-------------------------------------------------------------------------
@@ -3448,7 +3279,7 @@ H5F__start_swmr_write(H5F_t *f)
hbool_t setup = FALSE; /* Boolean flag to indicate whether SWMR setting is enabled */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3481,7 +3312,7 @@ H5F__start_swmr_write(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush superblock extension")
/* Flush data buffers */
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush f's cached information")
/* Get the # of opened named datatypes and attributes */
@@ -3617,7 +3448,7 @@ done:
if(obj_paths)
H5MM_xfree(obj_paths);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__start_swmr_write() */
@@ -3626,9 +3457,6 @@ done:
*
* Purpose: Private version of H5Fformat_convert
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: SUCCEED
* Failure: FAIL
*-------------------------------------------------------------------------
@@ -3639,7 +3467,7 @@ H5F__format_convert(H5F_t *f)
hbool_t mark_dirty = FALSE; /* Whether to mark the file's superblock dirty */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(f);
@@ -3682,6 +3510,6 @@ H5F__format_convert(H5F_t *f)
HGOTO_ERROR(H5E_FILE, H5E_CANTMARKDIRTY, FAIL, "unable to mark superblock as dirty")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__format_convert() */
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index 4cd1edf..b04bd3a 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -112,7 +112,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
H5G_loc_t root_loc; /* Group location of root of file to mount */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(loc);
HDassert(name && *name);
@@ -240,7 +240,7 @@ done:
}
}
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__mount() */
@@ -277,7 +277,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
int child_idx; /* Index of child in parent's mtab */
herr_t ret_value = SUCCEED; /*return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(loc);
HDassert(name && *name);
@@ -390,7 +390,7 @@ done:
if(mp_loc_setup)
H5G_loc_free(&mp_loc);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F__unmount() */
@@ -651,7 +651,7 @@ H5F_flush_mounts_recurse(H5F_t *f)
nerrors++;
/* Call the "real" flush routine, for this file */
- if(H5F__flush_real(f) < 0)
+ if(H5F__flush(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file's cached information")
/* Check flush errors for children - errors are already on the stack */
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 2ab41de..663f84e 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -29,12 +29,10 @@
/* Get package's private header */
#include "H5Fprivate.h"
-/* Other public headers needed by this file */
-#include "H5Bpublic.h" /* B-tree header, for H5B_NUM_BTREE_ID */
-
/* Other private headers needed by this file */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
+#include "H5Bprivate.h" /* B-trees */
#include "H5FLprivate.h" /* Free Lists */
#include "H5FOprivate.h" /* File objects */
#include "H5FSprivate.h" /* File free space */
@@ -353,6 +351,7 @@ struct H5F_file_t {
/* Object flush info */
H5F_object_flush_t object_flush; /* Information for object flush callback */
+ hbool_t crt_dset_min_ohdr_flag; /* flag to create minimized dataset object headers */
};
/*
@@ -396,16 +395,11 @@ H5FL_EXTERN(H5F_file_t);
/* General routines */
H5_DLL H5F_t *H5F__new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
-H5_DLL H5F_t *H5F__create(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
-H5_DLL H5F_t *H5F__open(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
-H5_DLL herr_t H5F__flush(H5F_t *f, H5F_scope_t scope);
-H5_DLL herr_t H5F__flush_real(H5F_t *f);
+H5_DLL herr_t H5F__flush(H5F_t *f);
H5_DLL htri_t H5F__is_hdf5(const char *name);
H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr);
-H5_DLL herr_t H5F__get_freespace(H5F_t *f, hsize_t *tot_space);
H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
-H5_DLL ssize_t H5F__get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info);
H5_DLL herr_t H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info);
H5_DLL herr_t H5F__format_convert(H5F_t *f);
H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 700cb89..0c2f5f2 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -331,6 +331,8 @@ typedef struct H5F_t H5F_t;
#define H5F_POINT_OF_NO_RETURN(F) ((F)->shared->fs.point_of_no_return)
#define H5F_FIRST_ALLOC_DEALLOC(F) ((F)->shared->first_alloc_dealloc)
#define H5F_EOA_PRE_FSM_FSALLOC(F) ((F)->shared->eoa_pre_fsm_fsalloc)
+#define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag)
+#define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V))
#else /* H5F_MODULE */
#define H5F_LOW_BOUND(F) (H5F_get_low_bound(F))
#define H5F_HIGH_BOUND(F) (H5F_get_high_bound(F))
@@ -388,6 +390,8 @@ typedef struct H5F_t H5F_t;
#define H5F_POINT_OF_NO_RETURN(F) (H5F_get_point_of_no_return(F))
#define H5F_FIRST_ALLOC_DEALLOC(F) (H5F_get_first_alloc_dealloc(F))
#define H5F_EOA_PRE_FSM_FSALLOC(F) (H5F_get_eoa_pre_fsm_fsalloc(F))
+#define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F))
+#define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V)))
#endif /* H5F_MODULE */
@@ -482,7 +486,7 @@ typedef struct H5F_t H5F_t;
#define H5F_ACS_CLOSE_DEGREE_NAME "close_degree" /* File close degree */
#define H5F_ACS_FAMILY_OFFSET_NAME "family_offset" /* Offset position in file for family file driver */
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize" /* New member size of family driver. (private property only used by h5repart) */
-#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2" /* Whether to convert family to sec2 driver. (private property only used by h5repart) */
+#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single" /* Whether to convert family to a single-file driver. (private property only used by h5repart) */
#define H5F_ACS_MULTI_TYPE_NAME "multi_type" /* Data type in multi file driver */
#define H5F_ACS_LIBVER_LOW_BOUND_NAME "libver_low_bound" /* 'low' bound of library format versions */
#define H5F_ACS_LIBVER_HIGH_BOUND_NAME "libver_high_bound" /* 'high' bound of library format versions */
@@ -741,6 +745,8 @@ H5_DLL hsize_t H5F_get_pgend_meta_thres(const H5F_t *f);
H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f);
H5_DLL hbool_t H5F_get_first_alloc_dealloc(const H5F_t *f);
H5_DLL haddr_t H5F_get_eoa_pre_fsm_fsalloc(const H5F_t *f);
+H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f);
+H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 73c59f5..8a475d1 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -233,7 +233,7 @@ H5_DLL herr_t H5Fflush(hid_t object_id, H5F_scope_t scope);
H5_DLL herr_t H5Fclose(hid_t file_id);
H5_DLL hid_t H5Fget_create_plist(hid_t file_id);
H5_DLL hid_t H5Fget_access_plist(hid_t file_id);
-H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned * intent);
+H5_DLL herr_t H5Fget_intent(hid_t file_id, unsigned *intent);
H5_DLL ssize_t H5Fget_obj_count(hid_t file_id, unsigned types);
H5_DLL ssize_t H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *obj_id_list);
H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void **file_handle);
@@ -273,6 +273,8 @@ H5_DLL herr_t H5Freset_page_buffering_stats(hid_t file_id);
H5_DLL herr_t H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2],
unsigned hits[2], unsigned misses[2], unsigned evictions[2], unsigned bypasses[2]);
H5_DLL herr_t H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr, hsize_t *image_size);
+H5_DLL herr_t H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize);
+H5_DLL herr_t H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize);
#ifdef H5_HAVE_PARALLEL
H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
diff --git a/src/H5Fquery.c b/src/H5Fquery.c
index be24072..e02e402 100644
--- a/src/H5Fquery.c
+++ b/src/H5Fquery.c
@@ -514,6 +514,25 @@ H5F_sym_leaf_k(const H5F_t *f)
/*-------------------------------------------------------------------------
+ * Function: H5F_get_min_dset_ohdr
+ *
+ * Purpose: Get the setting flag for minimized dataset object headers
+ *
+ * Return: TRUE/FALSE as set in file
+ *-------------------------------------------------------------------------
+ */
+hbool_t
+H5F_get_min_dset_ohdr(const H5F_t *f)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+
+ HDassert(f);
+
+ FUNC_LEAVE_NOAPI(f->shared->crt_dset_min_ohdr_flag)
+} /* end H5F_get_min_dset_ohdr */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_Kvalue
*
* Purpose: Replaced a macro to retrieve a B-tree key value for a certain
diff --git a/src/H5G.c b/src/H5G.c
index fa065fa..cbf3a8e 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -400,10 +400,10 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id)
HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache));
/* Create the new group & get its ID */
- if(NULL == (grp = H5G__create_anon(loc.oloc->file, &gcrt_info)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, H5I_INVALID_HID, "unable to create group")
+ if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info)))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, H5I_INVALID_HID, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
+ HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register group")
done:
/* Release the group's object header, if it was created */
@@ -509,10 +509,11 @@ H5Gget_create_plist(hid_t group_id)
/* Check args */
if(NULL == (group = (H5G_t *)H5I_object_verify(group_id, H5I_GROUP)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group")
- if((ret_value = H5G__get_create_plist(group)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
+ /* Retrieve the GCPL */
+ if((ret_value = H5G_get_create_plist(group)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
done:
FUNC_LEAVE_API(ret_value)
@@ -554,7 +555,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
/* Retrieve the group's information */
- if(H5G__get_info(&loc, grp_info/*out*/) < 0)
+ if(H5G__obj_info(loc.oloc, grp_info) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
done:
@@ -722,9 +723,9 @@ H5Gflush(hid_t group_id)
if(H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Flush group's metadata to file */
- if(H5G__flush(grp, group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
+ /* Flush metadata to file */
+ if(H5O_flush_common(&grp->oloc, group_id) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
done:
FUNC_LEAVE_API(ret_value)
@@ -761,7 +762,7 @@ H5Grefresh(hid_t group_id)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Call private function to refresh group object */
- if((H5G__refresh(grp, group_id)) < 0)
+ if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index f6c6d8f..57bbcd9 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -76,24 +76,11 @@ static herr_t H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
hid_t new_loc_id, const char *new_name, hid_t lcpl_id);
static herr_t H5G__move(hid_t src_loc_id, const char *src_name,
hid_t dst_loc_id, const char *dst_name, hid_t lcpl_id);
-static herr_t H5G__unlink(H5G_loc_t *loc, const char *name);
-static herr_t H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size,
- char *buf/*out*/);
-static herr_t H5G__set_comment(const H5G_loc_t *loc, const char *name,
- const char *comment);
-static int H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf,
- size_t bufsize);
-static herr_t H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk,
- const H5G_link_iterate_t *lnk_op, void *op_data);
-static herr_t H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info);
static herr_t H5G__get_objinfo_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
static herr_t H5G__get_objinfo(const H5G_loc_t *loc, const char *name,
hbool_t follow_link, H5G_stat_t *statbuf/*out*/);
-static ssize_t H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size);
static H5G_obj_t H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
@@ -197,9 +184,9 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
/* Check if we need to create a non-standard GCPL */
if(size_hint > 0) {
@@ -238,7 +225,7 @@ H5Gcreate1(hid_t loc_id, const char *name, size_t size_hint)
if(NULL == (grp = H5G__create_named(&loc, name, H5P_LINK_CREATE_DEFAULT, tmp_gcpl)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group")
if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTREGISTER, FAIL, "unable to register group")
done:
if(tmp_gcpl > 0 && tmp_gcpl != H5P_GROUP_CREATE_DEFAULT)
@@ -321,9 +308,9 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Check arguments */
if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(cur_loc_id) < 0)
@@ -357,9 +344,9 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
/* Check arguments */
if(!cur_name || !*cur_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no current name specified")
if(!new_name || !*new_name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(cur_loc_id) < 0)
@@ -393,7 +380,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
H5G_loc_t new_loc; /* Information about new link's group */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Create the appropriate kind of link */
if(type == H5L_TYPE_HARD) {
@@ -441,7 +428,7 @@ H5G__link(hid_t cur_loc_id, const char *cur_name, H5G_link_t type,
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "Not a valid link type")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__link() */
@@ -531,7 +518,7 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
H5G_loc_t dst_loc, *dst_loc_p; /* Group info for destination location */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
if(src_loc_id != H5L_SAME_LOC && H5G_loc(src_loc_id, &src_loc) < 0)
@@ -553,10 +540,10 @@ H5G__move(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
/* Move the link */
if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTMOVE, FAIL, "unable to move link")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__move() */
@@ -578,16 +565,16 @@ H5Gunlink(hid_t loc_id, const char *name)
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__unlink(&loc, name) < 0)
+ /* Call H5L routine... */
+ if(H5L_delete(&loc, name) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -596,37 +583,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__unlink
- *
- * Purpose: Internal version of H5Gunlink.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__unlink(H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call H5L routine... */
- if(H5L_delete(loc, name) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__unlink() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_linkval
*
* Purpose: Retrieve's a soft link's data. The new API is
@@ -645,53 +601,21 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/)
/* Check arguments */
if(H5G_loc(loc_id, &loc))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__get_linkval(&loc, name, size, buf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_linkval() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__get_linkval
- *
- * Purpose: Internal version of H5Gget_linkval.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__get_linkval(const H5G_loc_t *loc, const char *name, size_t size,
- char *buf/*out*/)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
/* Call the link routine which provides this capability */
- if(H5L_get_val(loc, name, buf, size) < 0)
+ if(H5L_get_val(&loc, name, buf, size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_linkval() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_linkval() */
/*-------------------------------------------------------------------------
@@ -721,17 +645,17 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
H5TRACE3("e", "i*s*s", loc_id, name, comment);
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if(H5G__set_comment(&loc, name, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
+ /* Call the common routine which provides this capability */
+ if(H5G_loc_set_comment(&loc, name, comment) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
FUNC_LEAVE_API(ret_value)
@@ -739,37 +663,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__set_comment
- *
- * Purpose: Internal version of H5Gset_comment.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__set_comment(const H5G_loc_t *loc, const char *name, const char *comment)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call the common routine which provides this capability */
- if(H5G_loc_set_comment(loc, name, comment) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__set_comment() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_comment
*
* Purpose: Return at most BUFSIZE characters of the comment for the
@@ -802,19 +695,19 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf)
H5TRACE4("Is", "i*sz*s", loc_id, name, bufsize, buf);
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
if(bufsize > 0 && !buf)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified")
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- /* Call internal routine */
- if((ret_value = H5G__get_comment(&loc, name, buf, bufsize)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
+ /* Call the common routine which provides this capability */
+ if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
done:
FUNC_LEAVE_API(ret_value)
@@ -822,38 +715,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_comment
- *
- * Purpose: Internal version of H5Gget_comment.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static int
-H5G__get_comment(const H5G_loc_t *loc, const char *name, char *buf,
- size_t bufsize)
-{
- int ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call the common routine which provides this capability */
- if((ret_value = (int)H5G_loc_get_comment(loc, name, buf, bufsize)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get comment value")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_comment() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Giterate
*
* Purpose: Iterates over the entries of a group. The LOC_ID and NAME
@@ -905,8 +766,8 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op,
lnk_op.op_type = H5G_LINK_OP_OLD;
lnk_op.op_func.op_old = op;
- /* Call private function. */
- if((ret_value = H5G__iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
+ /* Call the common routine which provides this capability */
+ if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
/* Set the index we stopped at */
@@ -919,39 +780,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__iterate
- *
- * Purpose: Internal version of H5Giterate.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__iterate(hid_t loc_id, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, hsize_t *last_lnk,
- const H5G_link_iterate_t *lnk_op, void *op_data)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Call the common routine which provides this capability */
- if((ret_value = H5G_iterate(loc_id, name, idx_type, order, idx, last_lnk, lnk_op, op_data)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__iterate() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_num_objs
*
* Purpose: Returns the number of objects in the group. It iterates
@@ -970,22 +798,27 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs)
{
- H5G_loc_t loc; /* Location of object */
- H5G_info_t grp_info; /* Group information */
- herr_t ret_value = SUCCEED;
+ H5G_loc_t loc; /* Location of object */
+ H5G_info_t grp_info; /* Group information */
+ H5O_type_t obj_type; /* Type of object at location */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", loc_id, num_objs);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ if(H5O_obj_type(loc.oloc, &obj_type) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
+ if(obj_type != H5O_TYPE_GROUP)
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
if(!num_objs)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
- /* Call the internal routine */
- if(H5G__get_num_objs(loc.oloc, &grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine")
+ /* Retrieve information about the group */
+ if(H5G__obj_info(loc.oloc, &grp_info) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects")
/* Set the number of objects [sic: links] in the group */
*num_objs = grp_info.nlinks;
@@ -996,44 +829,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_num_objs
- *
- * Purpose: Internal version of H5Gget_num_objs.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5G__get_num_objs(const H5O_loc_t *oloc, H5G_info_t *grp_info)
-{
- H5O_type_t obj_type; /* Type of object at location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
- if(obj_type != H5O_TYPE_GROUP)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
-
- /* Retrieve information about the group */
- if(H5G__obj_info(oloc, grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine # of objects")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_num_objs() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Gget_objinfo
*
* Purpose: Returns information about an object. If FOLLOW_LINK is
@@ -1062,13 +857,13 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link,
/* Check arguments */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location")
if(!name || !*name)
- HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
+ HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no name specified")
/* Get info */
if(H5G__get_objinfo(&loc, name, follow_link, statbuf) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
done:
FUNC_LEAVE_API(ret_value)
@@ -1177,7 +972,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
H5G_trav_goi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(loc);
@@ -1220,7 +1015,7 @@ H5G__get_objinfo(const H5G_loc_t *loc, const char *name, hbool_t follow_link,
} /* end if */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_objinfo() */
@@ -1250,62 +1045,28 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size)
{
- H5G_loc_t loc; /* Object location */
- ssize_t ret_value;
+ H5G_loc_t loc; /* Object location */
+ H5O_type_t obj_type; /* Type of object at location */
+ ssize_t ret_value;
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ih*sz", loc_id, idx, name, size);
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
-
- /* Call internal function */
- if((ret_value = H5G__get_objname_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* end H5Gget_objname_by_idx() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__get_objname_by_idx
- *
- * Purpose: Internal version of H5Gget_objname_by_idx.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Non-negative on success / Negative on failure
- *
- * Programmer: Quincey Koziol
- * Saturday, December 23, 2017
- *
- *-------------------------------------------------------------------------
- */
-static ssize_t
-H5G__get_objname_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size)
-{
- H5O_type_t obj_type; /* Type of object at location */
- ssize_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(H5O_obj_type(oloc, &obj_type) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a location ID")
+ if(H5O_obj_type(loc.oloc, &obj_type) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type")
if(obj_type != H5O_TYPE_GROUP)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "not a group")
/* Call common routine */
- if((ret_value = H5G_obj_get_name_by_idx(oloc, idx_type, order, idx, name, size)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
+ if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object name")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_objname_by_idx() */
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Gget_objname_by_idx() */
/*-------------------------------------------------------------------------
@@ -1334,11 +1095,11 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
/* Check args */
if(H5G_loc(loc_id, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID")
/* Call internal function*/
if(H5G_UNKNOWN == (ret_value = H5G__obj_get_type_by_idx(loc.oloc, idx)))
- HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
+ HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type")
done:
FUNC_LEAVE_API(ret_value)
@@ -1368,7 +1129,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
H5O_type_t obj_type; /* Type of object at location */
H5G_obj_t ret_value = H5G_UNKNOWN; /* Return value */
- FUNC_ENTER_STATIC_VOL_TAG(oloc->addr)
+ FUNC_ENTER_STATIC_TAG(oloc->addr)
/* Sanity check */
HDassert(oloc);
@@ -1401,7 +1162,7 @@ H5G__obj_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx)
} /* end else */
done:
- FUNC_LEAVE_NOAPI_VOL_TAG(ret_value)
+ FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5G__obj_get_type_by_idx() */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5Gint.c b/src/H5Gint.c
index 3b5de44..8fd7514 100644
--- a/src/H5Gint.c
+++ b/src/H5Gint.c
@@ -134,7 +134,7 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id,
H5G_obj_create_t gcrt_info; /* Information for group creation */
H5G_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -161,48 +161,11 @@ H5G__create_named(const H5G_loc_t *loc, const char *name, hid_t lcpl_id,
ret_value = (H5G_t *)ocrt_info.new_obj;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__create_named() */
/*-------------------------------------------------------------------------
- * Function: H5G__create_anon
- *
- * Purpose: Internal routine to create a new anonymous group.
- *
- * Note: This routine is needed so that there's a non-API routine for
- * creating groups that can set up VOL / SWMR info
- * (which need a DXPL).
- *
- * Return: Success: Non-NULL, pointer to new group object.
- * Failure: NULL
- *
- * Programmer: Quincey Koziol
- * December 17, 2017
- *
- *-------------------------------------------------------------------------
- */
-H5G_t *
-H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info)
-{
- H5G_t *ret_value = NULL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(file);
- HDassert(gcrt_info);
-
- /* Create the new group & get its ID */
- if(NULL == (ret_value = H5G__create(file, gcrt_info)))
- HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "unable to create group")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__create_anon() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G__create
*
* Purpose: Creates a new empty group with the specified name. The name
@@ -302,7 +265,7 @@ H5G__open_name(const H5G_loc_t *loc, const char *name)
H5O_type_t obj_type; /* Type of object at location */
H5G_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(loc);
@@ -336,7 +299,7 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__open_name() */
@@ -502,7 +465,7 @@ H5G__close_cb(H5G_t *grp)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(grp && grp->shared);
@@ -513,7 +476,7 @@ H5G__close_cb(H5G_t *grp)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "problem closing group")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__close_cb() */
@@ -1239,44 +1202,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_create_plist
- *
- * Purpose: Internal routine to retrieve a group's creation property list.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: ID for a copy of the group creation property
- * list. The property list ID should be released
- * by calling H5Pclose().
- *
- * Failure: H5I_INVALID_HID
- *
- * Programmer: Quincey Koziol
- * December 17, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5G__get_create_plist(const H5G_t *grp)
-{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(grp);
-
- /* Retrieve the GCPL */
- if((ret_value = H5G_get_create_plist(grp)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_create_plist() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_get_create_plist
*
* Purpose: Private function for H5Gget_create_plist
@@ -1372,51 +1297,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G__get_info
- *
- * Purpose: Internal routine to retrieve the info for a group.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(grp_info);
-
- /* Retrieve the group's information */
- if(H5G__obj_info(loc->oloc, grp_info) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5G__get_info() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G__get_info_by_name
*
* Purpose: Internal routine to retrieve the info for a group, by name.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 18, 2017
@@ -1432,7 +1317,7 @@ H5G__get_info_by_name(const H5G_loc_t *loc, const char *name, H5G_info_t *grp_in
hbool_t loc_found = FALSE; /* Location at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -1457,7 +1342,7 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_info_by_name() */
@@ -1466,11 +1351,7 @@ done:
*
* Purpose: Internal routine to retrieve the info for a group, by index.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* December 18, 2017
@@ -1487,7 +1368,7 @@ H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
hbool_t loc_found = FALSE; /* Location at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -1512,76 +1393,6 @@ done:
if(loc_found && H5G_loc_free(&grp_loc) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__get_info_by_idx() */
-
-/*-------------------------------------------------------------------------
- * Function: H5G__flush
- *
- * Purpose: Internal routine to flushes a group to disk.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__flush(H5G_t *grp, hid_t group_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(grp);
-
- /* Flush metadata to file */
- if(H5O_flush_common(&grp->oloc, group_id) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group and object flush callback")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5G__flush */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5G__refresh
- *
- * Purpose: Internal routine to refresh a group.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G__refresh(H5G_t *grp, hid_t group_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Sanity check */
- HDassert(grp);
-
- /* Call private function to refresh group object */
- if((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5G__refresh */
-
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index f0a9aea..b89777d 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -331,16 +331,11 @@ H5FL_EXTERN(H5G_shared_t);
H5_DLL H5G_t *H5G__create(H5F_t *file, H5G_obj_create_t *gcrt_info);
H5_DLL H5G_t *H5G__create_named(const H5G_loc_t *loc, const char *name,
hid_t lcpl_id, hid_t gcpl_id);
-H5_DLL H5G_t *H5G__create_anon(H5F_t *file, H5G_obj_create_t *gcrt_info);
H5_DLL H5G_t *H5G__open_name(const H5G_loc_t *loc, const char *name);
-H5_DLL hid_t H5G__get_create_plist(const H5G_t *grp);
-H5_DLL herr_t H5G__get_info(const H5G_loc_t *loc, H5G_info_t *grp_info);
H5_DLL herr_t H5G__get_info_by_name(const H5G_loc_t *loc, const char *name,
H5G_info_t *grp_info);
H5_DLL herr_t H5G__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5G_info_t *grp_info);
-H5_DLL herr_t H5G__flush(H5G_t *grp, hid_t group_id);
-H5_DLL herr_t H5G__refresh(H5G_t *grp, hid_t group_id);
H5_DLL herr_t H5G__close_cb(H5G_t *grp);
/*
diff --git a/src/H5HFprivate.h b/src/H5HFprivate.h
index 5086afb..6bd4e46 100644
--- a/src/H5HFprivate.h
+++ b/src/H5HFprivate.h
@@ -25,9 +25,6 @@
#ifndef _H5HFprivate_H
#define _H5HFprivate_H
-/* Include package's public header */
-#include "H5HFpublic.h"
-
/* Private headers needed by this file */
#include "H5Fprivate.h" /* File access */
#include "H5Oprivate.h" /* Object headers */
diff --git a/src/H5HFpublic.h b/src/H5HFpublic.h
deleted file mode 100644
index 82cfc21..0000000
--- a/src/H5HFpublic.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Copyright by The HDF Group. *
- * Copyright by the Board of Trustees of the University of Illinois. *
- * 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. *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-/*-------------------------------------------------------------------------
- *
- * Created: H5HFpublic.h
- * Feb 24 2006
- * Quincey Koziol <koziol@ncsa.uiuc.edu>
- *
- * Purpose: Public declarations for the fractal heap package.
- *
- *-------------------------------------------------------------------------
- */
-
-#ifndef _H5HFpublic_H
-#define _H5HFpublic_H
-
-/* Public headers needed by this file */
-#include "H5public.h"
-
-/*****************/
-/* Public Macros */
-/*****************/
-
-/*******************/
-/* Public Typedefs */
-/*******************/
-
-/**********************************/
-/* Public API Function Prototypes */
-/**********************************/
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* _H5HFpublic_H */
-
diff --git a/src/H5HG.c b/src/H5HG.c
index 53f1b2a..29cd90f 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -785,7 +785,13 @@ H5HG_remove (H5F_t *f, H5HG_t *hobj)
HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to protect global heap")
HDassert(hobj->idx < heap->nused);
- HDassert(heap->obj[hobj->idx].begin);
+ /* When the application selects the same location to rewrite the VL element by using H5Sselect_elements,
+ * it can happen that the entry has been removed by first rewrite. Here we simply skip the removal of
+ * the entry and let the second rewrite happen (see HDFFV-10635). In the future, it'd be nice to handle
+ * this situation in H5T_conv_vlen in H5Tconv.c instead of this level (HDFFV-10648). */
+ if(heap->obj[hobj->idx].nrefs == 0 && heap->obj[hobj->idx].size == 0 && !heap->obj[hobj->idx].begin)
+ HGOTO_DONE(ret_value)
+
obj_start = heap->obj[hobj->idx].begin;
/* Include object header size */
need = H5HG_ALIGN(heap->obj[hobj->idx].size) + H5HG_SIZEOF_OBJHDR(f);
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index a7d7a80..1c609e2 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -18,9 +18,6 @@
#ifndef _H5HGprivate_H
#define _H5HGprivate_H
-/* Include package's public header */
-#include "H5HGpublic.h"
-
/* Private headers needed by this file. */
#include "H5Fprivate.h" /* File access */
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index 4001ef1..7a53b25 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -24,9 +24,6 @@
#ifndef _H5HLprivate_H
#define _H5HLprivate_H
-/* Include package's public header */
-#include "H5HLpublic.h"
-
/* Private headers needed by this file. */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
diff --git a/src/H5I.c b/src/H5I.c
index 4df7b7e..097aad3 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -26,28 +26,22 @@
*/
#include "H5Imodule.h" /* This source code file is part of the H5I module */
+#define H5T_FRIEND /* Suppress error about including H5Tpkg */
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5CXprivate.h" /* API Contexts */
+#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5FLprivate.h" /* Free Lists */
+#include "H5Gprivate.h" /* Groups */
#include "H5Ipkg.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
#include "H5SLprivate.h" /* Skip Lists */
+#include "H5Tpkg.h" /* Datatypes */
-/* Define this to compile in support for dumping ID information */
-/* #define H5I_DEBUG_OUTPUT */
-#ifndef H5I_DEBUG_OUTPUT
-#include "H5Gprivate.h" /* Groups */
-#else /* H5I_DEBUG_OUTPUT */
-#define H5G_FRIEND /* Suppress error about including H5Gpkg */
-#include "H5Gpkg.h" /* Groups */
-#include "H5Dprivate.h" /* Datasets */
-#include "H5Tprivate.h" /* Datatypes */
-#endif /* H5I_DEBUG_OUTPUT */
/* Local Macros */
@@ -128,11 +122,8 @@ static int H5I__inc_type_ref(H5I_type_t type);
static int H5I__get_type_ref(H5I_type_t type);
static int H5I__search_cb(void *obj, hid_t id, void *_udata);
static H5I_id_info_t *H5I__find_id(hid_t id);
-static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size);
-#ifdef H5I_DEBUG_OUTPUT
static int H5I__debug_cb(void *_item, void *_key, void *_udata);
-static herr_t H5I__debug(H5I_type_t type);
-#endif /* H5I_DEBUG_OUTPUT */
+static int H5I__id_dump_cb(void *_item, void *_key, void *_udata);
/*-------------------------------------------------------------------------
@@ -2021,8 +2012,8 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size)
if(H5G_loc(id, &loc) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location")
- /* Call internal routine to retrieve object's name */
- if((ret_value = H5I__get_name(&loc, name, size)) < 0)
+ /* Retrieve object's name */
+ if((ret_value = H5G_get_name(&loc, name, size, NULL)) < 0)
HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
done:
@@ -2031,41 +2022,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5I__get_name
- *
- * Purpose: Internal routine to retrieve the name for an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: The length of the name
- * Failure: -1
- *
- * Programmer: Quincey Koziol
- * January 9, 2018
- *
- *-------------------------------------------------------------------------
- */
-static ssize_t
-H5I__get_name(const H5G_loc_t *loc, char *name, size_t size)
-{
- ssize_t ret_value = -1; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
-
- /* Retrieve object's name */
- if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0)
- HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5I__get_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5Iget_file_id
*
* Purpose: The public version of H5I_get_file_id(), obtains the file
@@ -2145,10 +2101,9 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5I_get_file_id() */
-#ifdef H5I_DEBUG_OUTPUT
/*-------------------------------------------------------------------------
- * Function: H5I__debug_cb
+ * Function: H5I__id_dump_cb
*
* Purpose: Dump the contents of an ID to stderr for debugging.
*
@@ -2157,7 +2112,7 @@ done:
*-------------------------------------------------------------------------
*/
static int
-H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
+H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
{
H5I_id_info_t *item = (H5I_id_info_t *)_item; /* Pointer to the ID node */
H5I_type_t type = *(H5I_type_t *)_udata; /* User data */
@@ -2170,7 +2125,7 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
HDfprintf(stderr, " obj = 0x%08lx\n", (unsigned long)(item->obj_ptr));
/* Get the group location, so we get get the name */
- switch (type) {
+ switch(type) {
case H5I_GROUP:
{
path = H5G_nameof((H5G_t*)item->obj_ptr);
@@ -2201,9 +2156,9 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_NTYPES:
default:
break; /* Other types of IDs are not stored in files */
- }
+ } /* end switch */
- if (path) {
+ if(path) {
if (path->user_path_r)
HDfprintf(stderr, " user_path = %s\n", H5RS_get_str(path->user_path_r));
if (path->full_path_r)
@@ -2211,11 +2166,11 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
}
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
-} /* end H5I__debug_cb() */
+} /* end H5I__id_dump_cb() */
/*-------------------------------------------------------------------------
- * Function: H5I__debug
+ * Function: H5I_dump_ids_for_type
*
* Purpose: Dump the contents of a type to stderr for debugging.
*
@@ -2223,27 +2178,33 @@ H5I__debug_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
*
*-------------------------------------------------------------------------
*/
-static herr_t
-H5I__debug(H5I_type_t type)
+herr_t
+H5I_dump_ids_for_type(H5I_type_t type)
{
- H5I_id_type_t *type_ptr;
+ H5I_id_type_t *type_ptr = NULL;
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_NOAPI_NOERR
HDfprintf(stderr, "Dumping ID type %d\n", (int)type);
type_ptr = H5I_id_type_list_g[type];
- /* Header */
- HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
- HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
- HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
- HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
+ if(type_ptr) {
- /* List */
- HDfprintf(stderr, " List:\n");
- H5SL_iterate(type_ptr->ids, H5I__debug_cb, &type);
+ /* Header */
+ HDfprintf(stderr, " init_count = %u\n", type_ptr->init_count);
+ HDfprintf(stderr, " reserved = %u\n", type_ptr->cls->reserved);
+ HDfprintf(stderr, " id_count = %llu\n", (unsigned long long)type_ptr->id_count);
+ HDfprintf(stderr, " nextid = %llu\n", (unsigned long long)type_ptr->nextid);
+
+ /* List */
+ if(type_ptr->id_count > 0) {
+ HDfprintf(stderr, " List:\n");
+ H5SL_iterate(type_ptr->ids, H5I__id_dump_cb, &type);
+ }
+ }
+ else
+ HDfprintf(stderr, "Global type info/tracking pointer for that type is NULL\n");
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* end H5I__debug() */
-#endif /* H5I_DEBUG_OUTPUT */
+} /* end H5I_dump_ids_for_type() */
diff --git a/src/H5Iprivate.h b/src/H5Iprivate.h
index 3bfde93..25a0572 100644
--- a/src/H5Iprivate.h
+++ b/src/H5Iprivate.h
@@ -82,5 +82,8 @@ H5_DLL int H5I_dec_app_ref(hid_t id);
H5_DLL int H5I_dec_app_ref_always_close(hid_t id);
H5_DLL int H5I_dec_type_ref(H5I_type_t type);
+/* Debugging functions */
+H5_DLL herr_t H5I_dump_ids_for_type(H5I_type_t type);
+
#endif /* _H5Iprivate_H */
diff --git a/src/H5L.c b/src/H5L.c
index b26a8c4..6967812 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -102,16 +102,10 @@ static herr_t H5L__link_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L__create_real(const H5G_loc_t *link_loc, const char *link_name,
H5G_name_t *obj_path, H5F_t *obj_file, H5O_link_t *lnk, H5O_obj_create_t *ocrt_info,
hid_t lcpl_id);
-static herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name,
- const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id);
-static herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id);
static herr_t H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size);
static herr_t H5L__get_val_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__get_val(const H5G_loc_t *loc, const char *name,
- void *buf/*out*/, size_t size);
static herr_t H5L__get_val_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -121,7 +115,6 @@ static herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name,
static herr_t H5L__delete_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__delete(const H5G_loc_t *loc, const char *name);
static herr_t H5L__delete_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -133,8 +126,6 @@ static herr_t H5L__move_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
static herr_t H5L__move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name,
- H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -145,8 +136,6 @@ static htri_t H5L__exists(const H5G_loc_t *loc, const char *name);
static herr_t H5L__get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
-static herr_t H5L__get_info(const H5G_loc_t *loc, const char *name,
- H5L_info_t *linfo/*out*/);
static herr_t H5L__get_info_by_idx_cb(H5G_loc_t *grp_loc/*in*/, const char *name,
const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/,
H5G_own_loc_t *own_loc/*out*/);
@@ -162,10 +151,6 @@ static ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name
static herr_t H5L__iterate(hid_t grp_id, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p,
H5L_iterate_t op, void *op_data);
-static herr_t H5L__visit(hid_t grp_id, const char *group_name,
- H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op,
- void *op_data);
-
/*********************/
/* Package Variables */
@@ -338,8 +323,8 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
dst_loc_p = src_loc_p;
/* Move the link */
- if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -400,8 +385,8 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id,
dst_loc_p = src_loc_p;
/* Copy the link */
- if(H5L__move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
+ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
done:
FUNC_LEAVE_API(ret_value)
@@ -451,8 +436,8 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id,
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Create the link */
- if(H5L__create_soft(link_target, &link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -516,8 +501,8 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.")
/* Create the link */
- if(H5L__create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
+ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
@@ -617,8 +602,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Unlink */
- if(H5L__delete(&loc, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ if(H5L_delete(&loc, name) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -670,7 +655,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
/* Delete the link */
if(H5L__delete_by_idx(&loc, group_name, idx_type, order, n) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
FUNC_LEAVE_API(ret_value)
@@ -717,8 +702,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size,
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the link value */
- if(H5L__get_val(&loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
+ if(H5L_get_val(&loc, name, buf, size) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
@@ -854,8 +839,8 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/,
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the link information */
- if(H5L__get_info(&loc, name, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+ if(H5L_get_info(&loc, name, linfo) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -904,7 +889,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name,
/* Get the link information */
if(H5L__get_info_by_idx(&loc, group_name, idx_type, order, n, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1087,7 +1072,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name,
/* Get the link information */
if((ret_value = H5L__get_name_by_idx(&loc, group_name, idx_type, order, n, name, size)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link name")
done:
FUNC_LEAVE_API(ret_value)
@@ -1135,7 +1120,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
/* Iterate over the links */
if((ret_value = H5L__iterate(grp_id, ".", idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1191,7 +1176,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name,
/* Iterate over the links */
if((ret_value = H5L__iterate(loc_id, group_name, idx_type, order, idx_p, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1248,8 +1233,8 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
/* Call internal routine */
- if((ret_value = H5L__visit(grp_id, ".", idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1309,8 +1294,8 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call internal routine */
- if((ret_value = H5L__visit(loc_id, group_name, idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
+ if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data)) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
FUNC_LEAVE_API(ret_value)
@@ -1895,45 +1880,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__create_hard
- *
- * Purpose: Internal routine to create a hard link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name,
- const H5G_loc_t *link_loc, const char *link_name, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(cur_loc);
- HDassert(cur_name);
- HDassert(link_loc);
- HDassert(link_name);
-
- /* Create the link */
- if(H5L_create_hard(cur_loc, cur_name, link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__create_hard() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L_create_soft
*
* Purpose: Creates a soft link from LINK_NAME to TARGET_PATH.
@@ -1982,44 +1928,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__create_soft
- *
- * Purpose: Internal routine to create a soft link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__create_soft(const char *target_path, const H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(target_path);
- HDassert(link_loc);
- HDassert(link_name);
-
- /* Create the link */
- if(H5L_create_soft(target_path, link_loc, link_name, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__create_soft() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__create_ud
*
* Purpose: Creates a user-defined link. See H5Lcreate_ud for
@@ -2039,7 +1947,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name,
H5O_link_t lnk; /* Link to insert */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(type >= H5L_TYPE_UD_MIN && type <= H5L_TYPE_MAX);
@@ -2073,7 +1981,7 @@ done:
/* Free the link's udata buffer if it's been allocated */
H5MM_xfree(lnk.u.ud.udata);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__create_ud() */
@@ -2216,42 +2124,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_val
- *
- * Purpose: Internal routine to query a link value
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf/*out*/, size_t size)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Get the link value */
- if(H5L_get_val(loc, name, buf, size) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_val() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__get_val_by_idx_cb
*
* Purpose: Callback for retrieving a link's value according to an
@@ -2308,9 +2180,6 @@ done:
* Purpose: Internal routine to query a link value according to the
* index within a group
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -2326,7 +2195,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5L_trav_gvbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -2344,7 +2213,7 @@ H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get link info for index: %llu", (unsigned long long)n)
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__get_val_by_idx() */
@@ -2439,42 +2308,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__delete
- *
- * Purpose: Internal routine to delete a link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__delete(const H5G_loc_t *loc, const char *name)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Delete the link */
- if(H5L_delete(loc, name) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link: %s", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__delete() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__delete_by_idx_cb
*
* Purpose: Callback for removing a link according to an index's order.
@@ -2519,9 +2352,6 @@ done:
* Purpose: Internal routine to delete a link according to its index
* within a group.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -2537,7 +2367,7 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
H5L_trav_rmbi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -2553,8 +2383,8 @@ H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "link doesn't exist")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__delete() */
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5L__delete_by_idx() */
/*-------------------------------------------------------------------------
@@ -2864,45 +2694,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__move
- *
- * Purpose: Internal routine to move / copy a link
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 25, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__move(const H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc,
- const char *dst_name, hbool_t copy_flag, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(src_loc);
- HDassert(src_name);
- HDassert(dst_loc);
- HDassert(dst_name);
-
- /* Move the link */
- if(H5L_move(src_loc, src_name, dst_loc, dst_name, copy_flag, lcpl_id) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__move() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__exists_final_cb
*
* Purpose: Callback for checking whether a link exists, as the final
@@ -3083,7 +2874,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name)
H5L_trav_le_t udata; /* User data for traversal */
htri_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* A path of "/" will always exist in a file */
if(0 == HDstrcmp(name, "/"))
@@ -3098,7 +2889,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name)
ret_value = (htri_t)udata.exists;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5L__exists() */
@@ -3173,42 +2964,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5L__get_info
- *
- * Purpose: Internal routine to retrieve link info
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 27, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linfo/*out*/)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Get the link information */
- if(H5L_get_info(loc, name, linfo) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info for: '%s'", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__get_info() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__get_info_by_idx_cb
*
* Purpose: Callback for retrieving a link's metadata according to an
@@ -3265,9 +3020,6 @@ done:
* Purpose: Internal routine to retrieve link info according to an
* index's order.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -3283,7 +3035,7 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type
H5L_trav_gibi_t udata; /* User data for callback */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -3298,10 +3050,10 @@ H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type
/* Traverse the group hierarchy to locate the object to get info about */
if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_info_by_idx_cb, &udata) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__get_info_by_idx() */
@@ -3351,9 +3103,6 @@ done:
* Purpose: Internal routine to retrieve link name according to an
* index's order.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -3370,7 +3119,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
H5L_trav_gnbi_t udata; /* User data for callback */
ssize_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -3392,7 +3141,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name,
ret_value = udata.name_len;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__get_name_by_idx() */
@@ -3401,9 +3150,6 @@ done:
*
* Purpose: Internal routine to iterate over links
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -3421,7 +3167,7 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
hsize_t idx; /* Internal location to hold index */
herr_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(group_name);
@@ -3444,48 +3190,11 @@ H5L__iterate(hid_t grp_id, const char *group_name, H5_index_t idx_type,
*idx_p = last_lnk;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5L__iterate() */
/*-------------------------------------------------------------------------
- * Function: H5L__visit
- *
- * Purpose: Internal routine to visit links
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5L__visit(hid_t grp_id, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, H5L_iterate_t op, void *op_data)
-{
- herr_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check arguments */
- HDassert(group_name);
- HDassert(op);
-
- /* Call internal group visitation routine */
- if((ret_value = H5G_visit(grp_id, group_name, idx_type, order, op, op_data)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5L__visit() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5L__link_copy_file
*
* Purpose: Copy a link and the object it points to from one file to
diff --git a/src/H5O.c b/src/H5O.c
index 9b832f1..aa175eb 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -73,11 +73,11 @@
/* Local Variables */
/*******************/
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oopen
+ * Function: H5Oopen
*
- * Purpose: Opens an object within an HDF5 file.
+ * Purpose: Opens an object within an HDF5 file.
*
* This function opens an object in the same way that H5Gopen2,
* H5Topen2, and H5Dopen2 do. However, H5Oopen doesn't require
@@ -88,18 +88,18 @@
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: An open object identifier
+ * Failure: Negative
*
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: James Laird
+ * July 14 2006
*
*-------------------------------------------------------------------------
*/
hid_t
H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
hid_t ret_value = FAIL;
FUNC_ENTER_API(FAIL)
@@ -116,18 +116,18 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info")
/* Open the object */
- if((ret_value = H5O__open_name(&loc, name)) < 0)
+ if((ret_value = H5O_open_name(&loc, name, TRUE)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oopen() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oopen_by_idx
+ * Function: H5Oopen_by_idx
*
- * Purpose: Opens an object within an HDF5 file, according to the offset
+ * Purpose: Opens an object within an HDF5 file, according to the offset
* within an index.
*
* This function opens an object in the same way that H5Gopen,
@@ -139,11 +139,11 @@ done:
* The opened object should be closed again with H5Oclose
* or H5Gclose, H5Tclose, or H5Dclose.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: An open object identifier
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * November 20 2006
+ * Programmer: Quincey Koziol
+ * November 20 2006
*
*-------------------------------------------------------------------------
*/
@@ -151,7 +151,7 @@ hid_t
H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
hid_t ret_value = FAIL;
FUNC_ENTER_API(FAIL)
@@ -179,11 +179,11 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oopen_by_idx() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oopen_by_addr
+ * Function: H5Oopen_by_addr
*
- * Purpose: Warning! This function is EXTREMELY DANGEROUS!
+ * Purpose: Warning! This function is EXTREMELY DANGEROUS!
* Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA,
* and other VERY BAD THINGS!
*
@@ -207,19 +207,19 @@ done:
* HDF5 file, and HDF5's file drivers will transparently
* map this to an address on disk for the filesystem.
*
- * Return: Success: An open object identifier
- * Failure: Negative
+ * Return: Success: An open object identifier
+ * Failure: Negative
*
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: James Laird
+ * July 14 2006
*
*-------------------------------------------------------------------------
*/
hid_t
H5Oopen_by_addr(hid_t loc_id, haddr_t addr)
{
- H5G_loc_t loc; /* Location within file */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5G_loc_t loc; /* Location within file */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("i", "ia", loc_id, addr);
@@ -238,24 +238,24 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oopen_by_addr() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Olink
+ * Function: H5Olink
*
- * Purpose: Creates a hard link from NEW_NAME to the object specified
- * by OBJ_ID using properties defined in the Link Creation
+ * Purpose: Creates a hard link from NEW_NAME to the object specified
+ * by OBJ_ID using properties defined in the Link Creation
* Property List LCPL.
*
- * This function should be used to link objects that have just
+ * This function should be used to link objects that have just
* been created.
*
- * NEW_NAME is interpreted relative to
- * NEW_LOC_ID, which is either a file ID or a
- * group ID.
+ * NEW_NAME is interpreted relative to
+ * NEW_LOC_ID, which is either a file ID or a
+ * group ID.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: James Laird
+ * Programmer: James Laird
* Tuesday, December 13, 2005
*
*-------------------------------------------------------------------------
@@ -264,8 +264,8 @@ herr_t
H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
hid_t lapl_id)
{
- H5G_loc_t new_loc; /* Location of group to link from */
- H5G_loc_t obj_loc; /* Location of object to link to */
+ H5G_loc_t new_loc; /* Location of group to link from */
+ H5G_loc_t obj_loc; /* Location of object to link to */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -292,19 +292,19 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Create a link to the object */
- if(H5O__create_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ /* Link to the object */
+ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Olink() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oincr_refcount
+ * Function: H5Oincr_refcount
*
- * Purpose: Warning! This function is EXTREMELY DANGEROUS!
+ * Purpose: Warning! This function is EXTREMELY DANGEROUS!
* Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA,
* and other VERY BAD THINGS!
*
@@ -313,19 +313,19 @@ done:
* that references an object by address is created. When the
* link is deleted, H5Odecr_refcount should be used.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: James Laird
+ * July 14 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -339,18 +339,18 @@ H5Oincr_refcount(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's refcount */
- if(H5O__link(oloc, 1) < 0)
+ if(H5O_link(oloc, 1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5O_incr_refcount() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Odecr_refcount
+ * Function: H5Odecr_refcount
*
- * Purpose: Warning! This function is EXTREMELY DANGEROUS!
+ * Purpose: Warning! This function is EXTREMELY DANGEROUS!
* Improper use can lead to FILE CORRUPTION, INACCESSIBLE DATA,
* and other VERY BAD THINGS!
*
@@ -359,19 +359,19 @@ done:
* that reference an object by address are deleted, and only
* after H5Oincr_refcount has already been used.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: James Laird
+ * July 14 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5Odecr_refcount(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -385,31 +385,31 @@ H5Odecr_refcount(hid_t object_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Change the object's refcount */
- if(H5O__link(oloc, -1) < 0)
+ if(H5O_link(oloc, -1) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Odecr_refcount() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oexists_by_name
+ * Function: H5Oexists_by_name
*
- * Purpose: Determine if a linked-to object exists
+ * Purpose: Determine if a linked-to object exists
*
- * Return: Success: TRUE/FALSE
- * Failure: Negative
+ * Return: Success: TRUE/FALSE
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * February 2 2010
+ * Programmer: Quincey Koziol
+ * February 2 2010
*
*-------------------------------------------------------------------------
*/
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location info */
+ H5G_loc_t loc; /* Location info */
htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -426,14 +426,14 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Check if the object exists */
- if((ret_value = H5O__exists_by_name(&loc, name)) < 0)
+ if((ret_value = H5G_loc_exists(&loc, name)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oexists_by_name() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Oget_info2
*
@@ -467,14 +467,14 @@ H5Oget_info2(hid_t loc_id, H5O_info_t *oinfo, unsigned fields)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid fields")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, fields) < 0)
+ if(H5G_loc_info(&loc, ".", oinfo/*out*/, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info2() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Oget_info_by_name2
*
@@ -494,7 +494,7 @@ herr_t
H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
unsigned fields, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -515,14 +515,14 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info_t *oinfo,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, fields) < 0)
+ if(H5G_loc_info(&loc, name, oinfo/*out*/, fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info_by_name2() */
-
+
/*-------------------------------------------------------------------------
* Function: H5Oget_info_by_idx2
*
@@ -531,10 +531,10 @@ done:
*
* NOTE: Add a parameter "fields" to indicate selection of object info.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 26 2006
*
*-------------------------------------------------------------------------
@@ -543,7 +543,7 @@ herr_t
H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields, hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -576,28 +576,28 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_info_by_idx2() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment
+ * Function: H5Oset_comment
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * August 30 2007
+ * Programmer: Quincey Koziol
+ * August 30 2007
*
*-------------------------------------------------------------------------
*/
herr_t
H5Oset_comment(hid_t obj_id, const char *comment)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -612,28 +612,28 @@ H5Oset_comment(hid_t obj_id, const char *comment)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* (Re)set the object's comment */
- if(H5O__set_comment_by_name(&loc, ".", comment) < 0)
+ if(H5G_loc_set_comment(&loc, ".", comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oset_comment() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oset_comment_by_name
+ * Function: H5Oset_comment_by_name
*
* Purpose: Gives the specified object a comment. The COMMENT string
- * should be a null terminated string. An object can have only
- * one comment at a time. Passing NULL for the COMMENT argument
- * will remove the comment property from the object.
+ * should be a null terminated string. An object can have only
+ * one comment at a time. Passing NULL for the COMMENT argument
+ * will remove the comment property from the object.
*
- * Note: Deprecated in favor of using attributes on objects
+ * Note: Deprecated in favor of using attributes on objects
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
- * Programmer: Quincey Koziol
- * August 30 2007
+ * Programmer: Quincey Koziol
+ * August 30 2007
*
*-------------------------------------------------------------------------
*/
@@ -641,7 +641,7 @@ herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -658,34 +658,34 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment,
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* (Re)set the object's comment */
- if(H5O__set_comment_by_name(&loc, name, comment) < 0)
+ if(H5G_loc_set_comment(&loc, name, comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oset_comment_by_name() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment
+ * Function: H5Oget_comment
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * August 30 2007
+ * Programmer: Quincey Koziol
+ * August 30 2007
*
*-------------------------------------------------------------------------
*/
ssize_t
H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -696,27 +696,27 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
/* Retrieve the object's comment */
- if((ret_value = H5O__get_comment_by_name(&loc, ".", comment/*out*/, bufsize)) < 0)
+ if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oget_comment_by_name
+ * Function: H5Oget_comment_by_name
*
- * Purpose: Retrieve comment for an object.
+ * Purpose: Retrieve comment for an object.
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
+ * Return: Success: Number of bytes in the comment excluding the
+ * null terminator. Zero if the object has no
+ * comment.
*
- * Failure: Negative
+ * Failure: Negative
*
- * Programmer: Quincey Koziol
- * August 30 2007
+ * Programmer: Quincey Koziol
+ * August 30 2007
*
*-------------------------------------------------------------------------
*/
@@ -724,7 +724,7 @@ ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t bufsize,
hid_t lapl_id)
{
- H5G_loc_t loc; /* Location of group */
+ H5G_loc_t loc; /* Location of group */
ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
@@ -741,18 +741,18 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the object's comment */
- if((ret_value = H5O__get_comment_by_name(&loc, name, comment/*out*/, bufsize)) < 0)
+ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object: '%s'", name)
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment_by_name() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Ovisit2
+ * Function: H5Ovisit2
*
- * Purpose: Recursively visit an object and all the objects reachable
+ * Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
* linked to from that group will be visited. Links within
* each group are visited according to the order within the
@@ -772,14 +772,14 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
* Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * library, or the negative value returned by one
+ * of the operators.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 25 2007
*
*-------------------------------------------------------------------------
@@ -811,9 +811,9 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit2() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Ovisit_by_name2
+ * Function: H5Ovisit_by_name2
*
* Purpose: Recursively visit an object and all the objects reachable
* from it. If the starting object is a group, all the objects
@@ -835,14 +835,14 @@ done:
* object info to be retrieved to the callback "op".
*
* Return: Success: The return value of the first operator that
- * returns non-zero, or zero if all members were
- * processed with no operator returning non-zero.
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
*
- * Failure: Negative if something goes wrong within the
- * library, or the negative value returned by one
- * of the operators.
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
*
- * Programmer: Quincey Koziol
+ * Programmer: Quincey Koziol
* November 24 2007
*
*-------------------------------------------------------------------------
@@ -881,22 +881,22 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit_by_name2() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oclose
+ * Function: H5Oclose
*
- * Purpose: Close an open file object.
+ * Purpose: Close an open file object.
*
* This is the companion to H5Oopen. It is used to close any
* open object in an HDF5 file (but not IDs are that not file
* objects, such as property lists and dataspaces). It has
* the same effect as calling H5Gclose, H5Dclose, or H5Tclose.
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: James Laird
- * July 14 2006
+ * Programmer: James Laird
+ * July 14 2006
*
*-------------------------------------------------------------------------
*/
@@ -941,26 +941,26 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oclose() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Odisable_mdc_flushes
+ * Function: H5Odisable_mdc_flushes
*
- * Purpose: To "cork" an object:
- * --keep dirty entries associated with the object in the metadata cache
+ * Purpose: To "cork" an object:
+ * --keep dirty entries associated with the object in the metadata cache
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * January 2014
+ * Programmer: Vailin Choi
+ * January 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Odisable_mdc_flushes(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -976,27 +976,27 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Odisable_mdc_flushes() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oenable_mdc_flushes
+ * Function: H5Oenable_mdc_flushes
*
- * Purpose: To "uncork" an object
- * --release keeping dirty entries associated with the object
- * in the metadata cache
+ * Purpose: To "uncork" an object
+ * --release keeping dirty entries associated with the object
+ * in the metadata cache
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * January 2014
+ * Programmer: Vailin Choi
+ * January 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Oenable_mdc_flushes(hid_t object_id)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -1013,28 +1013,28 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Oenable_mdc_flushes() */
-
+
/*-------------------------------------------------------------------------
- * Function: H5Oare_mdc_flushes_disabled
+ * Function: H5Oare_mdc_flushes_disabled
*
- * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled":
- * TRUE if mdc flushes for the object is disabled
- * FALSE if mdc flushes for the object is not disabled
- * Return error if the parameter "are_disabled" is not supplied
+ * Purpose: Retrieve the object's "cork" status in the parameter "are_disabled":
+ * TRUE if mdc flushes for the object is disabled
+ * FALSE if mdc flushes for the object is not disabled
+ * Return error if the parameter "are_disabled" is not supplied
*
- * Return: Success: Non-negative
- * Failure: Negative
+ * Return: Success: Non-negative
+ * Failure: Negative
*
- * Programmer: Vailin Choi
- * January 2014
+ * Programmer: Vailin Choi
+ * January 2014
*
*-------------------------------------------------------------------------
*/
herr_t
H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* Object location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*b", object_id, are_disabled);
@@ -1055,3 +1055,267 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5Oare_mdc_flushes_disabled() */
+/* Future function prototypes to be deprecated in next major version
+ * see HDFFV-10552
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info
+ *
+ * Purpose: Retrieve information about an object.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info(hid_t loc_id, H5O_info_t *oinfo)
+{
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*x", loc_id, oinfo);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_name
+ *
+ * Purpose: Retrieve information about an object.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location of group */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE4("e", "i*s*xi", loc_id, name, oinfo, lapl_id);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!name || !*name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Retrieve the object's information */
+ if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_name() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Oget_info_by_idx
+ *
+ * Purpose: Retrieve information about an object, according to the order
+ * of an index.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * November 26 2006
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, hid_t lapl_id)
+{
+ H5G_loc_t loc; /* Location of group */
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
+ hbool_t loc_found = FALSE; /* Entry at 'name' found */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*sIiIoh*xi", loc_id, group_name, idx_type, order, n, oinfo,
+ lapl_id);
+
+ /* Check args */
+ if(H5G_loc(loc_id, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location")
+ if(!group_name || !*group_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified")
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!oinfo)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Retrieve the object's information */
+ if(H5O__get_info_by_idx(&loc, group_name, idx_type, order, n, oinfo, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+
+done:
+ /* Release the object location */
+ if(loc_found && H5G_loc_free(&obj_loc) < 0)
+ HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Oget_info_by_idx() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ovisit
+ *
+ * Purpose: Recursively visit an object and all the objects reachable
+ * from it. If the starting object is a group, all the objects
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 25 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data)
+{
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE5("e", "iIiIox*x", obj_id, idx_type, order, op, op_data);
+
+ /* Check args */
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+
+ /* Call internal object visitation routine */
+ if((ret_value = H5O__visit(obj_id, ".", idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Ovisit_by_name
+ *
+ * Purpose: Recursively visit an object and all the objects reachable
+ * from it. If the starting object is a group, all the objects
+ * linked to from that group will be visited. Links within
+ * each group are visited according to the order within the
+ * specified index (unless the specified index does not exist for
+ * a particular group, then the "name" index is used).
+ *
+ * NOTE: Soft links and user-defined links are ignored during
+ * this operation.
+ *
+ * NOTE: Each _object_ reachable from the initial group will only
+ * be visited once. If multiple hard links point to the same
+ * object, the first link to the object's path (according to the
+ * iteration index and iteration order given) will be used to in
+ * the callback about the object.
+ *
+ * Return: Success: The return value of the first operator that
+ * returns non-zero, or zero if all members were
+ * processed with no operator returning non-zero.
+ *
+ * Failure: Negative if something goes wrong within the
+ * library, or the negative value returned by one
+ * of the operators.
+ *
+ * Programmer: Quincey Koziol
+ * November 24 2007
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id)
+{
+ herr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "i*sIiIox*xi", loc_id, obj_name, idx_type, order, op, op_data,
+ lapl_id);
+
+ /* Check args */
+ if(!obj_name || !*obj_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name")
+ if(idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified")
+ if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ if(!op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified")
+
+ /* Verify access property list and set up collective metadata if appropriate */
+ if(H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Call internal object visitation routine */
+ if((ret_value = H5O__visit(loc_id, obj_name, idx_type, order, op, op_data, H5O_INFO_ALL)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Ovisit_by_name() */
+
+/* Future function prototypes to be deprecated in next major version
+ * see HDFFV-10552
+#endif (* H5_NO_DEPRECATED_SYMBOLS *)
+ */
+
diff --git a/src/H5Oattr.c b/src/H5Oattr.c
index a62a3a3..1957554 100644
--- a/src/H5Oattr.c
+++ b/src/H5Oattr.c
@@ -177,6 +177,11 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
/* Decode and store the name */
if(NULL == (attr->shared->name = H5MM_strdup((const char *)p)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
+
+ /* Make an attempt to detect corrupted name or name length - HDFFV-10588 */
+ if(name_len != (HDstrlen(attr->shared->name) + 1))
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length")
+
if(attr->shared->version < H5O_ATTR_VERSION_2)
p += H5O_ALIGN_OLD(name_len); /* advance the memory pointer */
else
diff --git a/src/H5Obogus.c b/src/H5Obogus.c
index 92fd218..f10268e 100644
--- a/src/H5Obogus.c
+++ b/src/H5Obogus.c
@@ -49,7 +49,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{
H5O_BOGUS_VALID_ID, /*message id number */
"bogus valid", /*message name for debugging */
0, /*native message size */
- 0, /* messages are sharable? */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
H5O_bogus_encode, /*encode message */
NULL, /*copy the native value */
@@ -73,7 +73,7 @@ const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{
H5O_BOGUS_INVALID_ID, /*message id number */
"bogus invalid", /*message name for debugging */
0, /*native message size */
- 0, /* messages are sharable? */
+ H5O_SHARE_IS_SHARABLE, /* messages are sharable? */
H5O__bogus_decode, /*decode message */
H5O__bogus_encode, /*encode message */
NULL, /*copy the native value */
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 59e1705..d63ceb1 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -1390,7 +1390,8 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
/* Message size */
UINT16DECODE(chunk_image, mesg_size);
- HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size));
+ if(mesg_size != H5O_ALIGN_OH(oh, mesg_size))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message not aligned")
/* Message flags */
flags = *chunk_image++;
@@ -1402,10 +1403,9 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
if((flags & H5O_MSG_FLAG_WAS_UNKNOWN) && !(flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "bad flag combination for message")
- if((flags & H5O_MSG_FLAG_SHAREABLE)
- && H5O_msg_class_g[id]
- && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unsharable class flagged as sharable")
+ /* Delay checking the "shareable" flag until we've made sure id
+ * references a valid message class that this version of the library
+ * knows about */
/* Reserved bytes/creation index */
if(oh->version == H5O_VERSION_1)
@@ -1517,9 +1517,17 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
mesgs_modified = TRUE;
} /* end if */
} /* end if */
- else
+ else {
+ /* Check for message of unshareable class marked as "shareable"
+ */
+ if((flags & H5O_MSG_FLAG_SHAREABLE)
+ && H5O_msg_class_g[id]
+ && !(H5O_msg_class_g[id]->share_flags & H5O_SHARE_IS_SHARABLE))
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "message of unshareable class flagged as shareable")
+
/* Set message class for "known" messages */
mesg->type = H5O_msg_class_g[id];
+ } /* end else */
/* Do some inspection/interpretation of new messages from this chunk */
/* (detect continuation messages, ref. count messages, etc.) */
@@ -1619,7 +1627,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
done:
if(ret_value < 0 && udata->cont_msg_info->msgs) {
- udata->cont_msg_info->msgs = (H5O_chunk_t *)H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs);
+ udata->cont_msg_info->msgs = H5FL_SEQ_FREE(H5O_cont_t, udata->cont_msg_info->msgs);
udata->cont_msg_info->alloc_nmsgs = 0;
}
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 2e628f4..b57eaf6 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -242,9 +242,6 @@ done:
*
* Purpose: Internal routine to copy an object
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -265,7 +262,7 @@ H5O__copy(const H5G_loc_t *loc, const char *src_name, H5G_loc_t *dst_loc,
hbool_t obj_open = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check arguments */
HDassert(loc);
@@ -322,7 +319,7 @@ done:
if(obj_open && H5O_close(&src_oloc, NULL) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CLOSEERROR, FAIL, "unable to release object header")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__copy() */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 2600ea3..33ed787 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -71,7 +71,7 @@
/*******************/
-/* Future function prototypes to be deprecated in next major version
+/* Compatibility function prototypes to replace non-versioned function for use by macro in next version
* see HDFFV-10552
#ifndef H5_NO_DEPRECATED_SYMBOLS
*/
@@ -102,8 +102,8 @@ H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object")
+ if(H5G_loc_info(&loc, ".", oinfo/*out*/, H5O_INFO_ALL) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
done:
FUNC_LEAVE_API(ret_value)
@@ -142,7 +142,7 @@ H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t la
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
/* Retrieve the object's information */
- if(H5O__get_info_by_name(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0)
+ if(H5G_loc_info(&loc, name, oinfo/*out*/, H5O_INFO_ALL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name)
done:
@@ -330,7 +330,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Ovisit_by_name1() */
-/* Future function prototypes to be deprecated in next major version
+/* Compatibility function prototypes to replace non-versioned function for use by macro in next version
* see HDFFV-10552
#endif (* H5_NO_DEPRECATED_SYMBOLS *)
*/
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index e8e077e..d8c9530 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -49,7 +49,6 @@ static herr_t H5O__flush(hid_t obj_id);
static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag);
static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc,
H5G_loc_t *obj_loc);
-static herr_t H5O__refresh(hid_t obj_id);
/*************/
@@ -133,9 +132,6 @@ done:
*
* Purpose: Internal routine to flush an object
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -152,7 +148,7 @@ H5O__flush(hid_t obj_id)
const H5O_obj_class_t *obj_class; /* Class of object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Check args */
if(NULL == (oloc = H5O_get_loc(obj_id)))
@@ -175,7 +171,7 @@ H5O__flush(hid_t obj_id)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object and object flush callback")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__flush() */
@@ -235,17 +231,22 @@ done:
herr_t
H5Orefresh(hid_t oid)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5O_loc_t *oloc; /* object location */
+ herr_t ret_value = SUCCEED; /* return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", oid);
+ /* Check args */
+ if(NULL == (oloc = H5O_get_loc(oid)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
+
/* Set up collective metadata if appropriate */
if(H5CX_set_loc(oid) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call internal routine */
- if(H5O__refresh(oid) < 0)
+ if(H5O_refresh_metadata(oid, *oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
done:
@@ -460,40 +461,3 @@ done:
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata_reopen() */
-
-/*-------------------------------------------------------------------------
- * Function: H5O__refresh
- *
- * Purpose: Internal routine to refresh an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 29, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5O__refresh(hid_t obj_id)
-{
- H5O_loc_t *oloc; /* Object location */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Check args */
- if(NULL == (oloc = H5O_get_loc(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an object")
-
- /* Private function */
- if(H5O_refresh_metadata(obj_id, *oloc) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__refresh() */
-
diff --git a/src/H5Oint.c b/src/H5Oint.c
index 2752a25..09e6bb8 100644
--- a/src/H5Oint.c
+++ b/src/H5Oint.c
@@ -126,12 +126,7 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = {
H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */
H5O_MSG_FSINFO, /*0x0017 Free-space manager info */
H5O_MSG_MDCI, /*0x0018 Metadata cache image */
- H5O_MSG_UNKNOWN, /*0x0019 Placeholder for unknown message */
-#ifdef H5O_ENABLE_BOGUS
- H5O_MSG_BOGUS_INVALID, /*0x001A "Bogus invalid" (for testing) */
-#else /* H5O_ENABLE_BOGUS */
- NULL, /*0x001A "Bogus invalid" (for testing) */
-#endif /* H5O_ENABLE_BOGUS */
+ H5O_MSG_UNKNOWN /*0x0019 Placeholder for unknown message */
};
/* Format version bounds for object header */
@@ -285,52 +280,137 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
{
H5P_genplist_t *oc_plist; /* Object creation property list */
H5O_t *oh = NULL; /* Object header created */
+ herr_t ret_value = SUCCEED; /* return value */
haddr_t oh_addr; /* Address of initial object header */
size_t oh_size; /* Size of initial object header */
- uint8_t oh_flags; /* Object header's initial status flags */
- unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting object header into cache */
- hbool_t store_msg_crt_idx; /* Whether to always store message creation indices for this file */
- herr_t ret_value = SUCCEED; /* return value */
+ uint8_t oh_flags; /* Object header's initial status flags */
+ unsigned insert_flags = H5AC__NO_FLAGS_SET; /* Flags for inserting objec t header into cache */
+ hbool_t store_msg_crt_idx; /* Whether to always store message crea tion indices for this file */
FUNC_ENTER_NOAPI(FAIL)
- /* check args */
HDassert(f);
HDassert(loc);
HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+ /* create object header in freelist
+ * header version is set internally
+ */
+ oh = H5O__create_ohdr(f, ocpl_id);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't instantiate object header")
+
+ /* apply object header information to file
+ */
+ if(H5O__apply_ohdr(f, oh, ocpl_id, size_hint, initial_rc, loc) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "Can't apply object header to file")
+
+done:
+ if((FAIL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5O_create() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__create_ohdr
+ *
+ * Purpose: Create the object header, set version and flags.
+ *
+ * Return: Success: Pointer to the newly-crated header object.
+ * Failure: NULL
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+H5O_t *
+H5O__create_ohdr(H5F_t *f, hid_t ocpl_id)
+{
+ H5P_genplist_t *oc_plist;
+ H5O_t *oh = NULL; /* Object header in Freelist */
+ uint8_t oh_flags; /* Initial status flags */
+ H5O_t *ret_value = NULL;
+
+ FUNC_ENTER_NOAPI(NULL)
+
+ HDassert(f);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
/* Check for invalid access request */
if(0 == (H5F_INTENT(f) & H5F_ACC_RDWR))
- HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "no write intent on file")
+ HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file")
/* Make certain we allocate at least a reasonable size for the object header */
- size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
+ oh = H5FL_CALLOC(H5O_t);
+ if(NULL == oh)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- /* Get the property list */
- if(NULL == (oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id)))
- HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, NULL, "not a property list")
/* Get any object header status flags set by properties */
if(H5P_get(oc_plist, H5O_CRT_OHDR_FLAGS_NAME, &oh_flags) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object header flags")
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get object header flags")
- /* Allocate the object header and zero out header fields */
- if(NULL == (oh = H5FL_CALLOC(H5O_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
+ if(H5O_set_version(f, oh, oh_flags, H5F_STORE_MSG_CRT_IDX(f)) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, NULL, "can't set version of object header")
- /* Initialize file-specific information for object header */
- store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f);
+ oh->flags = oh_flags;
- if(H5O_set_version(f, oh, oh_flags, store_msg_crt_idx) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set version of objecdt header")
+ ret_value = oh;
+
+done:
+ if((NULL == ret_value) && (NULL != oh) && (H5O__free(oh) < 0))
+ HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, NULL, "can't delete object header")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5O__create_ohdr() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5O__apply_ohdr
+ *
+ * Purpose: Initialize and set the object header in the file.
+ * Record some information at `loc_out`.
+ *
+ * Return: Success: SUCCEED (0) (non-negative value)
+ * Failure: FAIL (-1) (negative value)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out)
+{
+ haddr_t oh_addr;
+ size_t oh_size;
+ H5P_genplist_t *oc_plist = NULL;
+ unsigned insert_flags = H5AC__NO_FLAGS_SET;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(f);
+ HDassert(loc_out);
+ HDassert(oh);
+ HDassert(TRUE == H5P_isa_class(ocpl_id, H5P_OBJECT_CREATE));
+
+ /* Allocate at least a reasonable size for the object header */
+ size_hint = H5O_ALIGN_F(f, MAX(H5O_MIN_SIZE, size_hint));
oh->sizeof_size = H5F_SIZEOF_SIZE(f);
oh->sizeof_addr = H5F_SIZEOF_ADDR(f);
- oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE);
+ oh->swmr_write = !!(H5F_INTENT(f) & H5F_ACC_SWMR_WRITE); /* strange casting for proper type */
#ifdef H5O_ENABLE_BAD_MESG_COUNT
/* Check whether the "bad message count" property is set */
if(H5P_exist_plist(oc_plist, H5O_BAD_MESG_COUNT_NAME) > 0) {
- /* Retrieve bad message count flag */
+ /* Get bad message count flag from property list */
if(H5P_get(oc_plist, H5O_BAD_MESG_COUNT_NAME, &oh->store_bad_mesg_count) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get bad message count flag")
}
@@ -341,12 +421,14 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
/* Create virtual entry, for use as proxy */
if(NULL == (oh->proxy = H5AC_proxy_entry_create()))
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create object header proxy")
- }
- else
+ } else {
oh->proxy = NULL;
+ }
/* Set initial status flags */
- oh->flags = oh_flags;
+ oc_plist = (H5P_genplist_t *)H5I_object(ocpl_id);
+ if(NULL == oc_plist)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a property list")
/* Initialize version-specific fields */
if(oh->version > H5O_VERSION_1) {
@@ -356,10 +438,7 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
else
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- /* Make certain attribute creation order tracking is enabled if
- * attributes can be shared in this file.
- */
- if(store_msg_crt_idx)
+ if(H5F_STORE_MSG_CRT_IDX(f)) /* flag to record message creation indices */
oh->flags |= H5O_HDR_ATTR_CRT_ORDER_TRACKED;
/* Retrieve attribute storage phase change values from property list */
@@ -383,11 +462,10 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
oh->flags |= H5O_HDR_CHUNK0_4;
else if(size_hint > 255)
oh->flags |= H5O_HDR_CHUNK0_2;
- } /* end if */
- else {
+ } else {
/* Reset unused time fields */
oh->atime = oh->mtime = oh->ctime = oh->btime = 0;
- } /* end else */
+ } /* end if/else header version > 1 */
/* Compute total size of initial object header */
/* (i.e. object header prefix and first chunk) */
@@ -452,20 +530,16 @@ H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc, hid_t ocpl_id,
H5_END_TAG
/* Set up object location */
- loc->file = f;
- loc->addr = oh_addr;
+ loc_out->file = f;
+ loc_out->addr = oh_addr;
/* Open it */
- if(H5O_open(loc) < 0)
+ if(H5O_open(loc_out) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object header")
done:
- if(ret_value < 0 && oh)
- if(H5O__free(oh) < 0)
- HDONE_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to destroy object header data")
-
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5O_create() */
+} /* end H5O__apply_ohdr() */
/*-------------------------------------------------------------------------
@@ -565,49 +639,10 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__open_name
- *
- * Purpose: Internal routine to open an object by name
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-hid_t
-H5O__open_name(const H5G_loc_t *loc, const char *name)
-{
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name);
-
- /* Open the object */
- if((ret_value = H5O_open_name(loc, name, TRUE)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__open_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O__open_by_idx
*
* Purpose: Internal routine to open an object by index within group
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -626,7 +661,7 @@ H5O__open_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
hbool_t loc_found = FALSE; /* Entry at 'name' found */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -651,7 +686,7 @@ done:
if(H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, H5I_INVALID_HID, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__open_by_idx() */
@@ -660,9 +695,6 @@ done:
*
* Purpose: Internal routine to open an object by its address
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
* Return: Success: Non-negative
* Failure: Negative
*
@@ -679,7 +711,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
H5O_loc_t obj_oloc; /* Opened object object location */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -697,7 +729,7 @@ H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__open_by_addr() */
@@ -739,44 +771,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__create_link
- *
- * Purpose: Internal routine to create a link from a group to an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__create_link(const H5G_loc_t *new_loc, const char *new_name,
- H5G_loc_t *obj_loc, hid_t lcpl_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(new_loc);
- HDassert(new_name && *new_name);
- HDassert(obj_loc);
-
- /* Link to the object */
- if(H5L_link(new_loc, new_name, obj_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__create_link() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_close
*
* Purpose: Closes an object header that was previously open.
@@ -1004,41 +998,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__link
- *
- * Purpose: Internal routine to change the refcount for an object
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__link(const H5O_loc_t *oloc, int adjust)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(oloc);
-
- /* Change the object's refcount */
- if(H5O_link(oloc, adjust) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__link() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_protect
*
* Purpose: Wrapper around H5AC_protect for use during a H5O_protect->
@@ -2051,42 +2010,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__exists_by_name
- *
- * Purpose: Internal routine to check if an object exists
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5O__exists_by_name(const H5G_loc_t *loc, const char *name)
-{
- htri_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Check if the object exists */
- if((ret_value = H5G_loc_exists(loc, name)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__exists_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_get_hdr_info
*
* Purpose: Retrieve the object header information for an object
@@ -2342,52 +2265,11 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5O__get_info_by_name
- *
- * Purpose: Internal routine to retrieve an object's info
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Note: Add a parameter "fields" to indicate selection of object info.
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__get_info_by_name(const H5G_loc_t *loc, const char *name, H5O_info_t *oinfo, unsigned fields)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
- HDassert(oinfo);
-
- /* Retrieve the object's information */
- if(H5G_loc_info(loc, name, oinfo/*out*/, fields) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__get_info_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O__get_info_by_idx
*
* Purpose: Internal routine to retrieve an object's info according to
* an index within a group.
*
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
*
* Note: Add a parameter "fields" to indicate selection of object info.
*
@@ -2409,7 +2291,7 @@ H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
hbool_t loc_found = FALSE; /* Entry at 'name' found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
@@ -2435,85 +2317,11 @@ done:
if(loc_found && H5G_loc_free(&obj_loc) < 0)
HDONE_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__get_info_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5O__set_comment_by_name
- *
- * Purpose: Internal routine to set an object's "comment"
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name,
- const char *comment)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* (Re)set the object's comment */
- if(H5G_loc_set_comment(loc, name, comment) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__set_comment_by_name() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5O__get_comment_by_name
- *
- * Purpose: Internal routine to retrieve an object's "comment"
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 28, 2017
- *
- *-------------------------------------------------------------------------
- */
-ssize_t
-H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name,
- char *comment, size_t bufsize)
-{
- ssize_t ret_value = FAIL; /* Return value */
-
- FUNC_ENTER_PACKAGE_VOL
-
- /* Check arguments */
- HDassert(loc);
- HDassert(name && *name);
-
- /* Retrieve the object's comment */
- if((ret_value = H5G_loc_get_comment(loc, name, comment/*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* end H5O__get_comment_by_name() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5O_get_create_plist
*
* Purpose: Retrieve the object creation properties for an object
@@ -2686,6 +2494,63 @@ H5O_get_oh_addr(const H5O_t *oh)
/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_flags
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_flags(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ FUNC_LEAVE_NOAPI(oh->flags); /* flags can be 0 */
+} /* H5O_get_oh_flags() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_mtime
+ *
+ * Purpose: Retrieve an object's modification time. Assumes that the
+ * caller has verified that accessing this variable is appropriate
+ * to the header in question.
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+time_t
+H5O_get_oh_mtime(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->mtime);
+ FUNC_LEAVE_NOAPI(oh->mtime);
+} /* H5O_get_oh_mtime() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5O_get_oh_version
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 17
+ *
+ *-------------------------------------------------------------------------
+ */
+uint8_t
+H5O_get_oh_version(const H5O_t *oh)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOERR
+ HDassert(oh);
+ HDassert(oh->version);
+ FUNC_LEAVE_NOAPI(oh->version);
+} /* H5O_get_oh_version() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5O_get_rc_and_type
*
* Purpose: Retrieve an object's reference count and type
@@ -2893,7 +2758,7 @@ H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
hid_t obj_id = (-1); /* ID of object */
herr_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Portably initialize user data struct to zeros */
HDmemset(&udata, 0, sizeof(udata));
@@ -2981,7 +2846,7 @@ done:
if(udata.visited)
H5SL_destroy(udata.visited, H5O__free_visit_visited, NULL);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O__visit() */
diff --git a/src/H5Olayout.c b/src/H5Olayout.c
index c880435..d0c7f3e 100644
--- a/src/H5Olayout.c
+++ b/src/H5Olayout.c
@@ -243,9 +243,15 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh,
H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr));
/* Chunk dimensions */
- for(u = 0; u < mesg->u.chunk.ndims; u++)
+ for(u = 0; u < mesg->u.chunk.ndims; u++) {
UINT32DECODE(p, mesg->u.chunk.dim[u]);
+ /* Just in case that something goes very wrong, such as file corruption. */
+ if(mesg->u.chunk.dim[u] == 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, NULL, "chunk dimension must be positive: mesg->u.chunk.dim[%u] = %u",
+ u, mesg->u.chunk.dim[u])
+ } /* end for */
+
/* Compute chunk size */
for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++)
mesg->u.chunk.size *= mesg->u.chunk.dim[u];
diff --git a/src/H5Omessage.c b/src/H5Omessage.c
index e156dcd..b38d74e 100644
--- a/src/H5Omessage.c
+++ b/src/H5Omessage.c
@@ -1598,16 +1598,23 @@ H5O_msg_is_shared(unsigned type_id, const void *mesg)
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Check args */
- HDassert(type_id < NELMTS(H5O_msg_class_g));
- type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
- HDassert(type);
- HDassert(mesg);
-
- /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
- if(type->share_flags & H5O_SHARE_IS_SHARABLE)
- ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
- else
+#ifdef H5O_ENABLE_BOGUS
+ if(type_id >= NELMTS(H5O_msg_class_g))
ret_value = FALSE;
+ else
+#endif /* H5O_ENABLE_BOGUS */
+ {
+ HDassert(type_id < NELMTS(H5O_msg_class_g));
+ type = H5O_msg_class_g[type_id]; /* map the type ID to the actual type object */
+ HDassert(type);
+ HDassert(mesg);
+
+ /* If messages in a class aren't sharable, then obviously this message isn't shared! :-) */
+ if(type->share_flags & H5O_SHARE_IS_SHARABLE)
+ ret_value = H5O_IS_STORED_SHARED(((const H5O_shared_t *)mesg)->type);
+ else
+ ret_value = FALSE;
+ } /* end block/else */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5O_msg_is_shared() */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 616f96b..a3cc27f 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -29,7 +29,7 @@
#define H5O_NMESGS 8 /*initial number of messages */
#define H5O_NCHUNKS 2 /*initial number of chunks */
#define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */
-#define H5O_MSG_TYPES 27 /* # of types of messages */
+#define H5O_MSG_TYPES 26 /* # of types of messages */
#define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */
/* Versions of object header structure */
@@ -555,25 +555,14 @@ H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATASET[1];
H5_DLLVAR const H5O_obj_class_t H5O_OBJ_DATATYPE[1];
/* Package-local function prototypes */
-H5_DLL hid_t H5O__open_name(const H5G_loc_t *loc, const char *name);
H5_DLL hid_t H5O__open_by_idx(const H5G_loc_t *loc, const char *name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
H5_DLL hid_t H5O__open_by_addr(const H5G_loc_t *loc, haddr_t addr);
H5_DLL hid_t H5O__open_by_loc(const H5G_loc_t *obj_loc, hbool_t app_ref);
-H5_DLL herr_t H5O__create_link(const H5G_loc_t *new_loc, const char *new_name,
- H5G_loc_t *obj_loc, hid_t lcpl_id);
H5_DLL const H5O_obj_class_t *H5O__obj_class(const H5O_loc_t *loc);
H5_DLL int H5O__link_oh(H5F_t *f, int adjust, H5O_t *oh, hbool_t *deleted);
-H5_DLL herr_t H5O__link(const H5O_loc_t *loc, int adjust);
-H5_DLL htri_t H5O__exists_by_name(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5O__get_info_by_name(const H5G_loc_t *loc, const char *name,
- H5O_info_t *oinfo, unsigned fields);
H5_DLL herr_t H5O__get_info_by_idx(const H5G_loc_t *loc, const char *group_name,
H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo, unsigned fields);
-H5_DLL herr_t H5O__set_comment_by_name(const H5G_loc_t *loc, const char *name,
- const char *comment);
-H5_DLL ssize_t H5O__get_comment_by_name(const H5G_loc_t *loc, const char *name,
- char *comment, size_t bufsize);
H5_DLL herr_t H5O__visit(hid_t loc_id, const char *obj_name, H5_index_t idx_type,
H5_iter_order_t order, H5O_iterate_t op, void *op_data, unsigned fields);
H5_DLL herr_t H5O__inc_rc(H5O_t *oh);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index 10063d5..34683fe 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -120,8 +120,14 @@ typedef struct H5O_mesg_t H5O_mesg_t;
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5O_MODULE
#define H5O_OH_GET_ADDR(O) ((O)->chunk[0].addr)
+#define H5O_OH_GET_VERSION ((O)->version)
+#define H5O_OH_GET_FLAGS(O) ((O)->flags)
+#define H5O_OH_GET_MTIME(O) ((O)->mtime)
#else /* H5O_MODULE */
#define H5O_OH_GET_ADDR(O) (H5O_get_oh_addr(O))
+#define H5O_OH_GET_VERSION(O) (H5O_get_oh_version(O))
+#define H5O_OH_GET_FLAGS(O) (H5O_get_oh_flags(O))
+#define H5O_OH_GET_MTIME(O) (H5O_get_oh_mtime(O))
#endif /* H5O_MODULE */
/* Set the fields in a shared message structure */
@@ -220,11 +226,11 @@ typedef struct H5O_copy_t {
* Note: Must increment H5O_MSG_TYPES in H5Opkg.h and update H5O_msg_class_g
* in H5O.c when creating a new message type. Also bump the value of
* H5O_BOGUS_INVALID_ID, below, to be one greater than the value of
- * H5O_UNKNOWN_ID.
+ * H5O_UNKNOWN_ID, and re-run gen_bogus.c.
*
* (this should never exist in a file)
*/
-#define H5O_BOGUS_INVALID_ID 0x001A /* "Bogus invalid" Message. */
+#define H5O_BOGUS_INVALID_ID 0x001a /* "Bogus invalid" Message. */
/* Shared object message types.
* Shared objects can be committed, in which case the shared message contains
@@ -644,6 +650,7 @@ typedef struct H5O_layout_t {
*/
#define H5O_BOGUS_VALUE 0xdeadbeef
typedef struct H5O_bogus_t {
+ H5O_shared_t sh_loc; /* Shared message info (must be first) */
unsigned u; /* Hold the bogus info */
} H5O_bogus_t;
#endif /* H5O_ENABLE_BOGUS */
@@ -865,6 +872,9 @@ struct H5P_genplist_t;
H5_DLL herr_t H5O_init(void);
H5_DLL herr_t H5O_create(H5F_t *f, size_t size_hint, size_t initial_rc,
hid_t ocpl_id, H5O_loc_t *loc/*out*/);
+H5_DLL H5O_t *H5O__create_ohdr(H5F_t *f, hid_t ocpl_id);
+H5_DLL herr_t H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id,
+ size_t size_hint, size_t initial_rc, H5O_loc_t *loc_out);
H5_DLL herr_t H5O_open(H5O_loc_t *loc);
H5_DLL herr_t H5O_close(H5O_loc_t *loc, hbool_t *file_closed/*out*/);
H5_DLL int H5O_link(const H5O_loc_t *loc, int adjust);
@@ -888,6 +898,9 @@ H5_DLL hid_t H5O_open_name(const H5G_loc_t *loc, const char *name, hbool_t app_r
H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hsize_t *nlinks);
H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc);
H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh);
+H5_DLL uint8_t H5O_get_oh_flags(const H5O_t *oh);
+H5_DLL time_t H5O_get_oh_mtime(const H5O_t *oh);
+H5_DLL uint8_t H5O_get_oh_version(const H5O_t *oh);
H5_DLL herr_t H5O_get_rc_and_type(const H5O_loc_t *oloc, unsigned *rc, H5O_type_t *otype);
H5_DLL H5AC_proxy_entry_t *H5O_get_proxy(const H5O_t *oh);
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 3a34fd2..cbccc7a 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -198,6 +198,20 @@ H5_DLL herr_t H5Oenable_mdc_flushes(hid_t object_id);
H5_DLL herr_t H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled);
/* Future function prototypes to be deprecated in next version */
+H5_DLL herr_t H5Oget_info(hid_t loc_id, H5O_info_t *oinfo);
+H5_DLL herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo,
+ hid_t lapl_id);
+H5_DLL herr_t H5Oget_info_by_idx(hid_t loc_id, const char *group_name,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n, H5O_info_t *oinfo,
+ hid_t lapl_id);
+
+H5_DLL herr_t H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order,
+ H5O_iterate_t op, void *op_data);
+H5_DLL herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name,
+ H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op,
+ void *op_data, hid_t lapl_id);
+
+/* Compatibility function prototypes to replace non-versioned function for use by macro in next version */
H5_DLL herr_t H5Oget_info1(hid_t loc_id, H5O_info_t *oinfo);
H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info_t *oinfo,
hid_t lapl_id);
diff --git a/src/H5PL.c b/src/H5PL.c
index fc42554..8f6ec36 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -62,8 +62,8 @@
* Purpose: Control the loading of dynamic plugin types.
*
* The plugin_control_mask parameter is a bitfield that controls
- * whether certain classes of plugins (e.g.: filters,
- * VOL drivers) will be loaded by the library.
+ * whether certain classes of plugins (e.g.: filters)
+ * will be loaded by the library.
*
* plugin bit = 0, will prevent the use of that dynamic plugin type.
* plugin bit = 1, will allow the use of that dynamic plugin type.
@@ -101,8 +101,7 @@ done:
* Function: H5PLget_loading_state
*
* Purpose: Get the bitmask that controls whether certain classes
- * of plugins (e.g.: filters, VOL drivers) will be loaded
- * by the library.
+ * of plugins (e.g.: filters) will be loaded by the library.
*
* Zero if all plugin types are disabled
* Negative if all plugin types are enabled
diff --git a/src/H5PLint.c b/src/H5PLint.c
index b190746..8b649d2 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -66,7 +66,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/*******************/
/* Bitmask that controls whether classes of plugins
- * (e.g.: filters, VOL drivers) can be loaded.
+ * (e.g.: filters) can be loaded.
*/
static unsigned int H5PL_plugin_control_mask_g = H5PL_ALL_PLUGIN;
diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c
index d995b1e..6211b5b 100644
--- a/src/H5Pdcpl.c
+++ b/src/H5Pdcpl.c
@@ -119,6 +119,11 @@
#define H5D_CRT_EXT_FILE_LIST_COPY H5P__dcrt_ext_file_list_copy
#define H5D_CRT_EXT_FILE_LIST_CMP H5P__dcrt_ext_file_list_cmp
#define H5D_CRT_EXT_FILE_LIST_CLOSE H5P__dcrt_ext_file_list_close
+/* Definitions for dataset object header minimization */
+#define H5D_CRT_MIN_DSET_HDR_SIZE_SIZE sizeof(hbool_t)
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEF FALSE
+#define H5D_CRT_MIN_DSET_HDR_SIZE_ENC H5P__encode_hbool_t
+#define H5D_CRT_MIN_DSET_HDR_SIZE_DEC H5P__decode_hbool_t
/******************/
@@ -211,6 +216,7 @@ static const H5O_layout_t H5D_def_layout_g = H5D_CRT_LAYOUT_DEF; /* Defau
static const H5O_fill_t H5D_def_fill_g = H5D_CRT_FILL_VALUE_DEF; /* Default fill value */
static const unsigned H5D_def_alloc_time_state_g = H5D_CRT_ALLOC_TIME_STATE_DEF; /* Default allocation time state */
static const H5O_efl_t H5D_def_efl_g = H5D_CRT_EXT_FILE_LIST_DEF; /* Default external file list */
+static const unsigned H5O_ohdr_min_g = H5D_CRT_MIN_DSET_HDR_SIZE_DEF; /* Default object header minimization */
/* Defaults for each type of layout */
#ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER
@@ -270,6 +276,12 @@ H5P__dcrt_reg_prop(H5P_genclass_t *pclass)
H5D_CRT_EXT_FILE_LIST_DEL, H5D_CRT_EXT_FILE_LIST_COPY, H5D_CRT_EXT_FILE_LIST_CMP, H5D_CRT_EXT_FILE_LIST_CLOSE) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the object header minimization property */
+ if(H5P_register_real(pclass, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, H5D_CRT_MIN_DSET_HDR_SIZE_SIZE, &H5O_ohdr_min_g,
+ NULL, NULL, NULL, H5D_CRT_MIN_DSET_HDR_SIZE_ENC, H5D_CRT_MIN_DSET_HDR_SIZE_DEC,
+ NULL, NULL, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5P__dcrt_reg_prop() */
@@ -3754,3 +3766,95 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_fill_time() */
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pget_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Access the flag for whether or not datasets created by the given dcpl
+ * will be created with a "minimized" object header.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 14
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize)
+{
+ hbool_t setting = FALSE;
+ H5P_genplist_t *plist = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", dcpl_id, minimize);
+
+ if(NULL == minimize)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "receiving pointer cannot be NULL")
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if(NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &setting) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get dset oh minimize flag value")
+
+ *minimize = setting;
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pget_dset_no_attrs_hint() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: H5Pset_dset_no_attrs_hint
+ *
+ * Purpose:
+ *
+ * Set the dcpl to minimize (or explicitly to not minimized) dataset object
+ * headers upon creation.
+ *
+ * Return:
+ *
+ * Failure: Negative value (FAIL)
+ * Success: Non-negative value (SUCCEED)
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 14
+ *
+ * Modifications: None.
+ *
+ *-----------------------------------------------------------------------------
+ */
+herr_t
+H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize)
+{
+ H5P_genplist_t *plist = NULL;
+ hbool_t prev_set = FALSE;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "ib", dcpl_id, minimize);
+
+ plist = H5P_object_verify(dcpl_id, H5P_DATASET_CREATE);
+ if(NULL == plist)
+ HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID")
+
+ if(H5P_peek(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &prev_set) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get extant dset oh minimize flag value")
+
+ if(H5P_poke(plist, H5D_CRT_MIN_DSET_HDR_SIZE_NAME, &minimize) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't get dset oh minimize flag value")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5Pset_dset_no_attrs_hint() */
+
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index dcfe89f..1c97589 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -2017,6 +2017,7 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mpio_actual_io_mode() */
+
/*-------------------------------------------------------------------------
* Function: H5Pget_mpio_no_collective_cause
*
@@ -2053,8 +2054,6 @@ H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_ca
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Pget_mpio_no_collective_cause() */
-
-
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index c94fda1..e5a0a63 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -131,10 +131,11 @@
* property only used by h5repart */
#define H5F_ACS_FAMILY_NEWSIZE_SIZE sizeof(hsize_t)
#define H5F_ACS_FAMILY_NEWSIZE_DEF 0
-/* Definition for whether to convert family to sec2 driver. It's private
- * property only used by h5repart */
-#define H5F_ACS_FAMILY_TO_SEC2_SIZE sizeof(hbool_t)
-#define H5F_ACS_FAMILY_TO_SEC2_DEF FALSE
+/* Definition for whether to convert family to a single-file driver.
+ * It's a private property only used by h5repart.
+ */
+#define H5F_ACS_FAMILY_TO_SINGLE_SIZE sizeof(hbool_t)
+#define H5F_ACS_FAMILY_TO_SINGLE_DEF FALSE
/* Definition for data type in multi file driver */
#define H5F_ACS_MULTI_TYPE_SIZE sizeof(H5FD_mem_t)
#define H5F_ACS_MULTI_TYPE_DEF H5FD_MEM_DEFAULT
@@ -368,7 +369,7 @@ static const unsigned H5F_def_gc_ref_g = H5F_ACS_GARBG_COLCT_REF_DEF;
static const H5F_close_degree_t H5F_def_close_degree_g = H5F_CLOSE_DEGREE_DEF; /* Default file close degree */
static const hsize_t H5F_def_family_offset_g = H5F_ACS_FAMILY_OFFSET_DEF; /* Default offset for family VFD */
static const hsize_t H5F_def_family_newsize_g = H5F_ACS_FAMILY_NEWSIZE_DEF; /* Default size of new files for family VFD */
-static const hbool_t H5F_def_family_to_sec2_g = H5F_ACS_FAMILY_TO_SEC2_DEF; /* Default ?? for family VFD */
+static const hbool_t H5F_def_family_to_single_g = H5F_ACS_FAMILY_TO_SINGLE_DEF; /* Default ?? for family VFD */
static const H5FD_mem_t H5F_def_mem_type_g = H5F_ACS_MULTI_TYPE_DEF; /* Default file space type for multi VFD */
static const H5F_libver_t H5F_def_libver_low_bound_g = H5F_ACS_LIBVER_LOW_BOUND_DEF; /* Default setting for "low" bound of format version */
@@ -503,9 +504,9 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
- /* Register the private property of whether convert family to sec2 driver. It's used by h5repart only. */
+ /* Register the private property of whether convert family to a single-file driver. It's used by h5repart only. */
/* (Note: this property should not have an encode/decode callback -QAK) */
- if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SEC2_NAME, H5F_ACS_FAMILY_TO_SEC2_SIZE, &H5F_def_family_to_sec2_g,
+ if(H5P_register_real(pclass, H5F_ACS_FAMILY_TO_SINGLE_NAME, H5F_ACS_FAMILY_TO_SINGLE_SIZE, &H5F_def_family_to_single_g,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 9f7fdab..5d6dea8 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -165,7 +165,8 @@ typedef enum H5D_mpio_no_collective_cause_t {
H5D_MPIO_NOT_SIMPLE_OR_SCALAR_DATASPACES = 0x10,
H5D_MPIO_NOT_CONTIGUOUS_OR_CHUNKED_DATASET = 0x20,
H5D_MPIO_PARALLEL_FILTERED_WRITES_DISABLED = 0x40,
- H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x80
+ H5D_MPIO_ERROR_WHILE_CHECKING_COLLECTIVE_POSSIBLE = 0x80,
+ H5D_MPIO_NO_COLLECTIVE_MAX_CAUSE = 0x100
} H5D_mpio_no_collective_cause_t;
/********************/
@@ -407,6 +408,8 @@ H5_DLL herr_t H5Pget_alloc_time(hid_t plist_id, H5D_alloc_time_t
H5_DLL herr_t H5Pset_fill_time(hid_t plist_id, H5D_fill_time_t fill_time);
H5_DLL herr_t H5Pget_fill_time(hid_t plist_id, H5D_fill_time_t
*fill_time/*out*/);
+H5_DLL herr_t H5Pget_dset_no_attrs_hint(hid_t dcpl_id, hbool_t *minimize);
+H5_DLL herr_t H5Pset_dset_no_attrs_hint(hid_t dcpl_id, hbool_t minimize);
/* Dataset access property list (DAPL) routines */
H5_DLL herr_t H5Pset_chunk_cache(hid_t dapl_id, size_t rdcc_nslots,
diff --git a/src/H5RS.c b/src/H5RS.c
index 0a3fff0..ae500c5 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -137,7 +137,7 @@ done:
REVISION LOG
--------------------------------------------------------------------------*/
H5RS_str_t *
-H5RS_wrap(char *s)
+H5RS_wrap(const char *s)
{
H5RS_str_t *ret_value; /* Return value */
@@ -148,7 +148,7 @@ H5RS_wrap(char *s)
HGOTO_ERROR(H5E_RS, H5E_NOSPACE, NULL, "memory allocation failed")
/* Set the internal fields */
- ret_value->s = s;
+ ret_value->s = (char *)s;
ret_value->wrapped = 1;
ret_value->n = 1;
diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h
index f69624a..1d26a18 100644
--- a/src/H5RSprivate.h
+++ b/src/H5RSprivate.h
@@ -44,7 +44,7 @@ typedef struct H5RS_str_t H5RS_str_t;
/* Private routines */
/********************/
H5_DLL H5RS_str_t *H5RS_create(const char *s);
-H5_DLL H5RS_str_t *H5RS_wrap(char *s);
+H5_DLL H5RS_str_t *H5RS_wrap(const char *s);
H5_DLL H5RS_str_t *H5RS_own(char *s);
H5_DLL herr_t H5RS_decr(H5RS_str_t *rs);
H5_DLL herr_t H5RS_incr(H5RS_str_t *rs);
diff --git a/src/H5Rint.c b/src/H5Rint.c
index 12b4878..1465ee1 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -230,7 +230,7 @@ H5R__create(void *_ref, H5G_loc_t *loc, const char *name, H5R_type_t ref_type,
hbool_t obj_found = FALSE; /* Object location found */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(loc);
@@ -335,7 +335,7 @@ done:
if (obj_found)
H5G_loc_free(&obj_loc);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__create() */
@@ -381,7 +381,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
H5O_type_t obj_type; /* Type of object */
hid_t ret_value = H5I_INVALID_HID; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(ref_type > H5R_BADTYPE && ref_type < H5R_MAXTYPE);
@@ -504,7 +504,7 @@ H5R__dereference(H5F_t *file, hid_t oapl_id, H5R_type_t ref_type,
} /* end switch */
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__dereference() */
@@ -538,7 +538,7 @@ H5R__get_region(H5F_t *file, const void *_ref)
uint8_t *buf = NULL; /* Buffer to store serialized selection in */
H5S_t *ret_value; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(_ref);
HDassert(file);
@@ -573,7 +573,7 @@ done:
if(buf)
H5MM_xfree(buf);
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_region() */
@@ -607,7 +607,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref,
unsigned rc; /* Reference count of object */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
HDassert(file);
HDassert(_ref);
@@ -662,7 +662,7 @@ H5R__get_obj_type(H5F_t *file, H5R_type_t ref_type, const void *_ref,
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_obj_type() */
@@ -701,7 +701,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref,
H5O_loc_t oloc; /* Object location describing object for reference */
ssize_t ret_value = -1; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(f);
@@ -763,6 +763,6 @@ done:
if (file_id > 0 && H5I_dec_ref(file_id) < 0)
HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__get_name() */
diff --git a/src/H5Smpio.c b/src/H5Smpio.c
index 2bd275a..935d279 100644
--- a/src/H5Smpio.c
+++ b/src/H5Smpio.c
@@ -879,7 +879,14 @@ H5S_mpio_hyper_type(const H5S_t *space, size_t elmt_size,
HMPI_GOTO_ERROR(FAIL, "MPI_Type_contiguous failed", mpi_code)
}
- MPI_Type_extent (inner_type, &inner_extent);
+ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+ * so we're using the MPI-2 version even though we don't need the lb
+ * value.
+ */
+ {
+ MPI_Aint unused_lb_arg;
+ MPI_Type_get_extent(inner_type, &unused_lb_arg, &inner_extent);
+ }
stride_in_bytes = inner_extent * (MPI_Aint)d[i].strid;
/* If the element count is larger than what a 32 bit integer can hold,
@@ -1500,7 +1507,14 @@ static herr_t H5S_mpio_create_large_type (hsize_t num_elements,
}
}
- MPI_Type_extent (old_type, &old_extent);
+ /* As of version 4.0, OpenMPI now turns off MPI-1 API calls by default,
+ * so we're using the MPI-2 version even though we don't need the lb
+ * value.
+ */
+ {
+ MPI_Aint unused_lb_arg;
+ MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
+ }
/* Set up the arguments for MPI_Type_struct constructor */
type[0] = outer_type;
diff --git a/src/H5T.c b/src/H5T.c
index ea9897b..023a65f 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -301,8 +301,8 @@ static herr_t H5T__unregister(H5T_pers_t pers, const char *name, H5T_t *src,
static htri_t H5T__compiler_conv(H5T_t *src, H5T_t *dst);
static herr_t H5T__set_size(H5T_t *dt, size_t size);
static herr_t H5T__close_cb(H5T_t *dt);
-static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst,
- const char *name, H5T_conv_func_t *conv);
+static H5T_path_t *H5T__path_find_real(const H5T_t *src, const H5T_t *dst, const char *name, H5T_conv_func_t *conv);
+static hbool_t H5T__detect_reg_ref(const H5T_t *dt);
/*****************************/
@@ -3714,7 +3714,7 @@ H5T__close_cb(H5T_t *dt)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* check args */
HDassert(dt && dt->shared);
@@ -3724,7 +3724,7 @@ H5T__close_cb(H5T_t *dt)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCLOSEOBJ, FAIL, "can't close datatype");
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__close_cb() */
@@ -5517,6 +5517,111 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5T_detect_reg_ref
+ *
+ * Purpose: Check whether a datatype contains (or is) a region reference
+ * datatype.
+ *
+ * Return: TRUE (1) or FALSE (0) on success
+ * (Can't fail)
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 5, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+static hbool_t
+H5T__detect_reg_ref(const H5T_t *dt)
+{
+ unsigned u; /* Local index variable */
+ hbool_t ret_value = FALSE; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Sanity checks */
+ HDassert(dt);
+
+ /* Check if this datatype is a region reference */
+ if(H5T_REFERENCE == dt->shared->type && H5R_DATASET_REGION == dt->shared->u.atomic.u.r.rtype)
+ HGOTO_DONE(TRUE);
+
+ /* Check for types that might have the correct type as a component */
+ switch(dt->shared->type) {
+ case H5T_COMPOUND:
+ /* Iterate over all the compound datatype's fields */
+ for(u = 0; u < dt->shared->u.compnd.nmembs; u++)
+ /* Recurse on field's datatype */
+ if(H5T__detect_reg_ref(dt->shared->u.compnd.memb[u].type))
+ HGOTO_DONE(TRUE);
+ break;
+
+ case H5T_ARRAY:
+ case H5T_VLEN:
+ case H5T_ENUM:
+ HGOTO_DONE(H5T__detect_reg_ref(dt->shared->parent));
+ break;
+
+ case H5T_NO_CLASS:
+ case H5T_INTEGER:
+ case H5T_FLOAT:
+ case H5T_TIME:
+ case H5T_STRING:
+ case H5T_BITFIELD:
+ case H5T_OPAQUE:
+ case H5T_REFERENCE:
+ case H5T_NCLASSES:
+ default:
+ break;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T__detect_reg_ref() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_is_vl_storage
+ *
+ * Purpose: Check if a datatype will be stored in a variable-length form.
+ *
+ * Notes: Currently, only variable-length string & sequences and region
+ * references are stored in a variable-length form.
+ *
+ * Return:
+ * One of two values on success:
+ * TRUE - If the datatype will be stored in a variable-length form
+ * FALSE - If the datatype will NOT be stored in a variable-length form
+ * <0 is returned on failure
+ *
+ * Programmer: Quincey Koziol
+ * Saturday, January 5, 2019
+ *
+ *-------------------------------------------------------------------------
+ */
+htri_t
+H5T_is_vl_storage(const H5T_t *dt)
+{
+ htri_t ret_value = FALSE;
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(dt);
+
+ /* VL and region reference datatypes are stored in variable-length form */
+ if(H5T_detect_class(dt, H5T_VLEN, FALSE))
+ ret_value = TRUE;
+ else if(H5T_detect_class(dt, H5T_REFERENCE, FALSE))
+ ret_value = H5T__detect_reg_ref(dt);
+ else
+ ret_value = FALSE;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_is_vl_storage() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5T_upgrade_version_cb
*
* Purpose: H5T__visit callback to Upgrade the version of a datatype
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 1719f8f..649bd2e 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -59,8 +59,6 @@
static herr_t H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id);
static hid_t H5T__get_create_plist(const H5T_t *type);
static H5T_t *H5T__open_oid(const H5G_loc_t *loc);
-static herr_t H5T__flush(H5T_t *dt, hid_t type_id);
-static herr_t H5T__refresh(H5T_t *dt, hid_t type_id);
/*********************/
@@ -165,7 +163,7 @@ H5T__commit_named(const H5G_loc_t *loc, const char *name, H5T_t *dt,
H5T_state_t old_state; /* The state of the datatype before H5T__commit. */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity checks */
HDassert(loc);
@@ -219,7 +217,7 @@ done:
} /* end if */
} /* end if */
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__commit_named() */
@@ -296,7 +294,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id)
H5O_loc_t *oloc; /* Object location for datatype */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(file);
@@ -318,7 +316,7 @@ H5T__commit_anon(H5F_t *file, H5T_t *type, hid_t tcpl_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object")
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* H5T__commit_anon() */
@@ -667,8 +665,8 @@ H5Tflush(hid_t type_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Flush metadata for named datatype */
- if(H5T__flush(dt, type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+ if(H5O_flush_common(&dt->oloc, type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback")
done:
FUNC_LEAVE_API(ret_value)
@@ -707,7 +705,7 @@ H5Trefresh(hid_t type_id)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
/* Call private function to refresh datatype object */
- if((H5T__refresh(dt, type_id)) < 0)
+ if((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
done:
@@ -742,7 +740,7 @@ H5T__get_create_plist(const H5T_t *type)
hid_t new_tcpl_id = FAIL; /* New datatype creation property list */
hid_t ret_value = FAIL; /* Return value */
- FUNC_ENTER_STATIC_VOL
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(type);
@@ -770,7 +768,7 @@ done:
if(H5I_dec_app_ref(new_tcpl_id) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to close temporary object")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__get_create_plist() */
@@ -798,7 +796,7 @@ H5T__open_name(const H5G_loc_t *loc, const char *name)
hbool_t obj_found = FALSE; /* Object at 'name' found */
H5T_t *ret_value = NULL; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
/* Sanity check */
HDassert(loc);
@@ -836,7 +834,7 @@ done:
if(H5G_loc_free(&type_loc) < 0)
HDONE_ERROR(H5E_DATATYPE, H5E_CANTRELEASE, NULL, "can't free location")
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__open_name() */
@@ -1040,73 +1038,3 @@ H5T_update_shared(H5T_t *dt)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5T_update_shared() */
-
-/*-------------------------------------------------------------------------
- * Function: H5T__flush
- *
- * Purpose: Internal routine to flushes a named datatype to disk.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5T__flush(H5T_t *dt, hid_t type_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Sanity check */
- HDassert(dt);
-
- /* To flush metadata and invoke flush callback if there is */
- if(H5O_flush_common(&dt->oloc, type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype and object flush callback")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5T__flush */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5T__refresh
- *
- * Purpose: Internal routine to refresh a named datatype.
- *
- * Note: This routine is needed so that there's a non-API routine
- * that can set up VOL / SWMR info (which need a DXPL).
- *
- * Return: Success: Non-negative
- * Failure: Negative
- *
- * Programmer: Quincey Koziol
- * December 18, 2017
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5T__refresh(H5T_t *dt, hid_t type_id)
-{
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_STATIC_VOL
-
- /* Sanity check */
- HDassert(dt);
-
- /* Call private function to refresh datatype object */
- if((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
-
-done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
-} /* H5T__refresh */
-
diff --git a/src/H5Torder.c b/src/H5Torder.c
index 877316d..462b732 100644
--- a/src/H5Torder.c
+++ b/src/H5Torder.c
@@ -100,11 +100,11 @@ H5Tget_order(hid_t type_id)
/* Check args */
if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, H5T_ORDER_ERROR, "not a datatype")
/* Get order */
if(H5T_ORDER_ERROR == (ret_value = H5T_get_order(dt)))
- HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "cant't get order for specified datatype")
+ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, H5T_ORDER_ERROR, "can't get order for specified datatype")
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 89cdcfd..aff3f6d 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -138,6 +138,7 @@ H5_DLL herr_t H5T_set_version(H5F_t *f, H5T_t *dt);
H5_DLL herr_t H5T_patch_file(H5T_t *dt, H5F_t *f);
H5_DLL herr_t H5T_patch_vlen_file(H5T_t *dt, H5F_t *f);
H5_DLL htri_t H5T_is_variable_str(const H5T_t *dt);
+H5_DLL htri_t H5T_is_vl_storage(const H5T_t *dt);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
diff --git a/src/H5VM.c b/src/H5VM.c
index 4c0b837..452d378 100644
--- a/src/H5VM.c
+++ b/src/H5VM.c
@@ -1548,7 +1548,7 @@ done:
*
* Purpose: Given source and destination buffers in memory (SRC & DST)
* copy sequences of from the source buffer into the destination
- * buffer. Each set of sequnces has an array of lengths, an
+ * buffer. Each set of sequences has an array of lengths, an
* array of offsets, the maximum number of sequences and the
* current sequence to start at in the sequence.
*
diff --git a/src/H5Z.c b/src/H5Z.c
index f68fbce..baea0d1 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -387,9 +387,9 @@ H5Z__unregister(H5Z_filter_t filter_id)
H5Z_object_t object; /* Object to pass to callbacks */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE_VOL
+ FUNC_ENTER_PACKAGE
- HDassert(filter_id>=0 && filter_id<=H5Z_FILTER_MAX);
+ HDassert(filter_id >= 0 && filter_id <= H5Z_FILTER_MAX);
/* Is the filter already registered? */
for (filter_index = 0; filter_index < H5Z_table_used_g; filter_index++)
@@ -434,7 +434,7 @@ H5Z__unregister(H5Z_filter_t filter_id)
H5Z_table_used_g--;
done:
- FUNC_LEAVE_NOAPI_VOL(ret_value)
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5Z__unregister() */
@@ -603,7 +603,7 @@ H5Z__flush_file_cb(void *obj_ptr, hid_t H5_ATTR_UNUSED obj_id, void *key)
/* Sanity check for collectively calling H5Zunregister, if requested */
/* (Sanity check assumes that a barrier on one file's comm
* is sufficient (i.e. that there aren't different comms for
- * different files). -QAK, 2018/02/14
+ * different files). -QAK, 2018/02/14)
*/
if(H5_coll_api_sanity_check_g && !object->sanity_checked) {
MPI_Comm mpi_comm; /* File's communicator */
diff --git a/src/H5config.h.in b/src/H5config.h.in
index ce444ed..738e94e 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -15,6 +15,10 @@
/* Define if dev_t is a scalar */
#undef DEV_T_IS_SCALAR
+/* Define if your system is IBM ppc64le and cannot convert some long double
+ values correctly. */
+#undef DISABLE_SOME_LDOUBLE_CONV
+
/* Define to dummy `main' function (if any) required to link to the Fortran
libraries. */
#undef FC_DUMMY_MAIN
@@ -238,6 +242,9 @@
/* Define if we have parallel support */
#undef HAVE_PARALLEL
+/* Define if both pread and pwrite exist. */
+#undef HAVE_PREADWRITE
+
/* Define to 1 if you have the <pthread.h> header file. */
#undef HAVE_PTHREAD_H
@@ -428,9 +435,6 @@
/* Define to enable internal memory allocation sanity checking. */
#undef MEMORY_ALLOC_SANITY_CHECK
-/* Define if the metadata trace file code is to be compiled in */
-#undef METADATA_TRACE_FILE
-
/* Define if we can violate pointer alignment restrictions */
#undef NO_ALIGNMENT_RESTRICTIONS
@@ -542,6 +546,9 @@
/* The size of `ssize_t', as computed by sizeof. */
#undef SIZEOF_SSIZE_T
+/* The size of `time_t', as computed by sizeof. */
+#undef SIZEOF_TIME_T
+
/* The size of `uint16_t', as computed by sizeof. */
#undef SIZEOF_UINT16_T
diff --git a/src/H5err.txt b/src/H5err.txt
index 19374cd..aa172e8 100644
--- a/src/H5err.txt
+++ b/src/H5err.txt
@@ -180,7 +180,8 @@ MINOR, CACHE, H5E_CANTRESIZE, Unable to resize a metadata cache entry
MINOR, CACHE, H5E_CANTDEPEND, Unable to create a flush dependency
MINOR, CACHE, H5E_CANTUNDEPEND, Unable to destroy a flush dependency
MINOR, CACHE, H5E_CANTNOTIFY, Unable to notify object about action
-MINOR, CACHE, H5E_LOGFAIL, Failure in the cache logging framework
+MINOR, CACHE, H5E_LOGGING, Failure in the cache logging framework
+MINOR, CACHE, H5E_LOGFAIL, old H5E_LOGGING_g (maintained for binary compatibility)
MINOR, CACHE, H5E_CANTCORK, Unable to cork an object
MINOR, CACHE, H5E_CANTUNCORK, Unable to uncork an object
diff --git a/src/H5private.h b/src/H5private.h
index 8974e46..4f5323a 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -1148,6 +1148,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDpowf
#define HDpowf(X,Y) powf(X,Y)
#endif /* HDpowf */
+#ifndef HDpread
+ #define HDpread(F,B,C,O) pread(F,B,C,O)
+#endif /* HDpread */
#ifndef HDprintf
#define HDprintf(...) HDfprintf(stdout, __VA_ARGS__)
#endif /* HDprintf */
@@ -1160,6 +1163,9 @@ typedef off_t h5_stat_size_t;
#ifndef HDputs
#define HDputs(S) puts(S)
#endif /* HDputs */
+#ifndef HDpwrite
+ #define HDpwrite(F,B,C,O) pwrite(F,B,C,O)
+#endif /* HDpwrite */
#ifndef HDqsort
#define HDqsort(M,N,Z,F) qsort(M,N,Z,F)
#endif /* HDqsort*/
@@ -2199,12 +2205,6 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use this macro for all package-level functions that are VOL entry-points */
-#define FUNC_ENTER_PACKAGE_VOL { \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/* Use this macro for package-level functions which propgate errors, but don't issue them */
#define FUNC_ENTER_PACKAGE_NOERR { \
FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
@@ -2221,29 +2221,12 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use the following macro as replacement for the FUNC_ENTER_PACKAGE
- * macro when the function needs to set up a metadata tag and is also a
- * VOL entry-point. */
-#define FUNC_ENTER_PACKAGE_VOL_TAG(tag) { \
- haddr_t prev_tag = HADDR_UNDEF; \
- \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5AC_tag(tag, &prev_tag); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/* Use this macro for all "normal" staticly-scoped functions */
#define FUNC_ENTER_STATIC { \
FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use this macro for all "normal" staticly-scoped functions that are VOL entry-points */
-#define FUNC_ENTER_STATIC_VOL { \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */
#define FUNC_ENTER_STATIC_NOERR { \
FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \
@@ -2266,17 +2249,6 @@ H5_DLL herr_t H5CX_pop(void);
H5_PUSH_FUNC \
if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-/* Use the following macro as replacement for the FUNC_ENTER_STATIC
- * macro when the function needs to set up a metadata tag and is a VOL
- * entry-point. */
-#define FUNC_ENTER_STATIC_VOL_TAG(tag) { \
- haddr_t prev_tag = HADDR_UNDEF; \
- \
- FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \
- H5AC_tag(tag, &prev_tag); \
- H5_PUSH_FUNC \
- if(H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) {
-
/*-------------------------------------------------------------------------
* Purpose: Register function exit for code profiling. This should be
@@ -2331,13 +2303,6 @@ H5_DLL herr_t H5CX_pop(void);
return(ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-#define FUNC_LEAVE_NOAPI_VOL(ret_value) \
- ; \
- } /*end scope from end of FUNC_ENTER*/ \
- H5_POP_FUNC \
- return(ret_value); \
-} /*end scope from beginning of FUNC_ENTER*/
-
#define FUNC_LEAVE_NOAPI_VOID \
; \
} /*end scope from end of FUNC_ENTER*/ \
@@ -2365,15 +2330,6 @@ H5_DLL herr_t H5CX_pop(void);
return(ret_value); \
} /*end scope from beginning of FUNC_ENTER*/
-/* Use this macro when exiting a VOL entry-point function that set up a metadata tag */
-#define FUNC_LEAVE_NOAPI_VOL_TAG(ret_value) \
- ; \
- } /*end scope from end of FUNC_ENTER*/ \
- H5AC_tag(prev_tag, NULL); \
- H5_POP_FUNC \
- return(ret_value); \
-} /*end scope from beginning of FUNC_ENTER*/
-
/****************************************/
/* Revisions to FUNC_ENTER/LEAVE Macros */
diff --git a/src/H5public.h b/src/H5public.h
index 83966de..a25bed9 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -93,10 +93,10 @@ extern "C" {
/* Version numbers */
#define H5_VERS_MAJOR 1 /* For major interface/format changes */
#define H5_VERS_MINOR 10 /* For minor interface/format changes */
-#define H5_VERS_RELEASE 4 /* For tweaks, bug-fixes, or development */
+#define H5_VERS_RELEASE 5 /* For tweaks, bug-fixes, or development */
#define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */
/* Empty string for real releases. */
-#define H5_VERS_INFO "HDF5 library version: 1.10.4" /* Full version string */
+#define H5_VERS_INFO "HDF5 library version: 1.10.5" /* Full version string */
#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \
H5_VERS_RELEASE)
diff --git a/src/H5vers.txt b/src/H5vers.txt
index 914c30e..0303bf5 100644
--- a/src/H5vers.txt
+++ b/src/H5vers.txt
@@ -56,11 +56,6 @@ FUNCTION: H5Ewalk; H5E_walk, H5E_error; v10, v18
FUNCTION: H5Fget_info; H5F_info; v18, v110
FUNCTION: H5Gcreate; ; v10, v18
FUNCTION: H5Gopen; ; v10, v18
-FUNCTION: H5Oget_info; ; v18, v112
-FUNCTION: H5Oget_info_by_name; ; v18, v112
-FUNCTION: H5Oget_info_by_idx; ; v18, v112
-FUNCTION: H5Ovisit; ; v18, v112
-FUNCTION: H5Ovisit_by_name; ; v18, v112
FUNCTION: H5Pget_filter; ; v10, v18
FUNCTION: H5Pget_filter_by_id; ; v16, v18
FUNCTION: H5Pinsert; ; v14, v18
diff --git a/src/H5version.h b/src/H5version.h
index ef59285..34f961e 100644
--- a/src/H5version.h
+++ b/src/H5version.h
@@ -209,26 +209,6 @@
#define H5Gopen_vers 2
#endif /* !defined(H5Gopen_vers) */
-#if !defined(H5Oget_info_vers)
- #define H5Oget_info_vers 1
-#endif /* !defined(H5Oget_info_vers) */
-
-#if !defined(H5Oget_info_by_idx_vers)
- #define H5Oget_info_by_idx_vers 1
-#endif /* !defined(H5Oget_info_by_idx_vers) */
-
-#if !defined(H5Oget_info_by_name_vers)
- #define H5Oget_info_by_name_vers 1
-#endif /* !defined(H5Oget_info_by_name_vers) */
-
-#if !defined(H5Ovisit_vers)
- #define H5Ovisit_vers 1
-#endif /* !defined(H5Ovisit_vers) */
-
-#if !defined(H5Ovisit_by_name_vers)
- #define H5Ovisit_by_name_vers 1
-#endif /* !defined(H5Ovisit_by_name_vers) */
-
#if !defined(H5Pget_filter_vers)
#define H5Pget_filter_vers 2
#endif /* !defined(H5Pget_filter_vers) */
@@ -341,26 +321,6 @@
#define H5Gopen_vers 2
#endif /* !defined(H5Gopen_vers) */
-#if !defined(H5Oget_info_vers)
- #define H5Oget_info_vers 1
-#endif /* !defined(H5Oget_info_vers) */
-
-#if !defined(H5Oget_info_by_idx_vers)
- #define H5Oget_info_by_idx_vers 1
-#endif /* !defined(H5Oget_info_by_idx_vers) */
-
-#if !defined(H5Oget_info_by_name_vers)
- #define H5Oget_info_by_name_vers 1
-#endif /* !defined(H5Oget_info_by_name_vers) */
-
-#if !defined(H5Ovisit_vers)
- #define H5Ovisit_vers 1
-#endif /* !defined(H5Ovisit_vers) */
-
-#if !defined(H5Ovisit_by_name_vers)
- #define H5Ovisit_by_name_vers 1
-#endif /* !defined(H5Ovisit_by_name_vers) */
-
#if !defined(H5Pget_filter_vers)
#define H5Pget_filter_vers 2
#endif /* !defined(H5Pget_filter_vers) */
@@ -577,61 +537,6 @@
#error "H5Gopen_vers set to invalid value"
#endif /* H5Gopen_vers */
-#if !defined(H5Oget_info_vers) || H5Oget_info_vers == 2
- #ifndef H5Oget_info_vers
- #define H5Oget_info_vers 2
- #endif /* H5Oget_info_vers */
- #define H5Oget_info H5Oget_info2
-#elif H5Oget_info_vers == 1
- #define H5Oget_info H5Oget_info1
-#else /* H5Oget_info_vers */
- #error "H5Oget_info_vers set to invalid value"
-#endif /* H5Oget_info_vers */
-
-#if !defined(H5Oget_info_by_idx_vers) || H5Oget_info_by_idx_vers == 2
- #ifndef H5Oget_info_by_idx_vers
- #define H5Oget_info_by_idx_vers 2
- #endif /* H5Oget_info_by_idx_vers */
- #define H5Oget_info_by_idx H5Oget_info_by_idx2
-#elif H5Oget_info_by_idx_vers == 1
- #define H5Oget_info_by_idx H5Oget_info_by_idx1
-#else /* H5Oget_info_by_idx_vers */
- #error "H5Oget_info_by_idx_vers set to invalid value"
-#endif /* H5Oget_info_by_idx_vers */
-
-#if !defined(H5Oget_info_by_name_vers) || H5Oget_info_by_name_vers == 2
- #ifndef H5Oget_info_by_name_vers
- #define H5Oget_info_by_name_vers 2
- #endif /* H5Oget_info_by_name_vers */
- #define H5Oget_info_by_name H5Oget_info_by_name2
-#elif H5Oget_info_by_name_vers == 1
- #define H5Oget_info_by_name H5Oget_info_by_name1
-#else /* H5Oget_info_by_name_vers */
- #error "H5Oget_info_by_name_vers set to invalid value"
-#endif /* H5Oget_info_by_name_vers */
-
-#if !defined(H5Ovisit_vers) || H5Ovisit_vers == 2
- #ifndef H5Ovisit_vers
- #define H5Ovisit_vers 2
- #endif /* H5Ovisit_vers */
- #define H5Ovisit H5Ovisit2
-#elif H5Ovisit_vers == 1
- #define H5Ovisit H5Ovisit1
-#else /* H5Ovisit_vers */
- #error "H5Ovisit_vers set to invalid value"
-#endif /* H5Ovisit_vers */
-
-#if !defined(H5Ovisit_by_name_vers) || H5Ovisit_by_name_vers == 2
- #ifndef H5Ovisit_by_name_vers
- #define H5Ovisit_by_name_vers 2
- #endif /* H5Ovisit_by_name_vers */
- #define H5Ovisit_by_name H5Ovisit_by_name2
-#elif H5Ovisit_by_name_vers == 1
- #define H5Ovisit_by_name H5Ovisit_by_name1
-#else /* H5Ovisit_by_name_vers */
- #error "H5Ovisit_by_name_vers set to invalid value"
-#endif /* H5Ovisit_by_name_vers */
-
#if !defined(H5Pget_filter_vers) || H5Pget_filter_vers == 2
#ifndef H5Pget_filter_vers
#define H5Pget_filter_vers 2
diff --git a/src/Makefile.am b/src/Makefile.am
index a0defad..10ef8c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,12 +40,12 @@ DISTCLEANFILES=H5pubconf.h
# library sources
libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \
H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c H5Atest.c \
- H5AC.c H5ACdbg.c H5AClog.c H5ACproxy_entry.c \
+ H5AC.c H5ACdbg.c H5ACproxy_entry.c \
H5B.c H5Bcache.c H5Bdbg.c \
H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2internal.c \
H5B2leaf.c H5B2stat.c H5B2test.c \
- H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Cprefetched.c \
- H5Cquery.c H5Ctag.c H5Ctest.c \
+ H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Clog_json.c H5Clog_trace.c \
+ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \
H5CS.c \
H5CX.c \
H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
@@ -134,7 +134,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Epubgen.h H5Epublic.h H5Fpublic.h \
H5FDpublic.h H5FDcore.h H5FDdirect.h \
H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
- H5FDmulti.h H5FDsec2.h H5FDstdio.h \
+ H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
diff --git a/src/Makefile.in b/src/Makefile.in
index 7d80019..d640fc5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -175,35 +175,35 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_la_LIBADD =
am__libhdf5_la_SOURCES_DIST = H5.c H5checksum.c H5dbg.c H5system.c \
H5timer.c H5trace.c H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c \
- H5Aint.c H5Atest.c H5AC.c H5ACdbg.c H5AClog.c \
- H5ACproxy_entry.c H5B.c H5Bcache.c H5Bdbg.c H5B2.c H5B2cache.c \
- H5B2dbg.c H5B2hdr.c H5B2int.c H5B2internal.c H5B2leaf.c \
- H5B2stat.c H5B2test.c H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c \
- H5Clog.c H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c H5CS.c \
- H5CX.c H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c \
- H5Dcontig.c H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c \
- H5Dfarray.c H5Dfill.c H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c \
- H5Doh.c H5Dscatgath.c H5Dselect.c H5Dsingle.c H5Dtest.c \
- H5Dvirtual.c H5E.c H5Edeprec.c H5Eint.c H5EA.c H5EAcache.c \
- H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c H5EAiblock.c \
- H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c H5F.c H5Faccum.c \
- H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c \
- H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c H5Fsuper.c \
- H5Fsuper_cache.c H5Ftest.c H5FA.c H5FAcache.c H5FAdbg.c \
- H5FAdblock.c H5FAdblkpage.c H5FAhdr.c H5FAint.c H5FAstat.c \
- H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c H5FDint.c H5FDlog.c \
- H5FDmulti.c H5FDsec2.c H5FDspace.c H5FDstdio.c H5FDtest.c \
- H5FL.c H5FO.c H5FS.c H5FScache.c H5FSdbg.c H5FSint.c \
- H5FSsection.c H5FSstat.c H5FStest.c H5G.c H5Gbtree2.c \
- H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c H5Gent.c \
- H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c H5Gobj.c \
- H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c H5HF.c \
- H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c H5HFdtable.c \
- H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c H5HFman.c \
- H5HFsection.c H5HFspace.c H5HFstat.c H5HFtest.c H5HFtiny.c \
- H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HL.c H5HLcache.c \
- H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c H5HP.c H5I.c \
- H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c H5MF.c \
+ H5Aint.c H5Atest.c H5AC.c H5ACdbg.c H5ACproxy_entry.c H5B.c \
+ H5Bcache.c H5Bdbg.c H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c \
+ H5B2int.c H5B2internal.c H5B2leaf.c H5B2stat.c H5B2test.c \
+ H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Clog_json.c \
+ H5Clog_trace.c H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c \
+ H5CS.c H5CX.c H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c \
+ H5Dcompact.c H5Dcontig.c H5Ddbg.c H5Ddeprec.c H5Dearray.c \
+ H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c H5Dio.c H5Dlayout.c \
+ H5Dnone.c H5Doh.c H5Dscatgath.c H5Dselect.c H5Dsingle.c \
+ H5Dtest.c H5Dvirtual.c H5E.c H5Edeprec.c H5Eint.c H5EA.c \
+ H5EAcache.c H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c \
+ H5EAiblock.c H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c \
+ H5F.c H5Faccum.c H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c \
+ H5Ffake.c H5Fint.c H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c \
+ H5Fspace.c H5Fsuper.c H5Fsuper_cache.c H5Ftest.c H5FA.c \
+ H5FAcache.c H5FAdbg.c H5FAdblock.c H5FAdblkpage.c H5FAhdr.c \
+ H5FAint.c H5FAstat.c H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c \
+ H5FDint.c H5FDlog.c H5FDmulti.c H5FDsec2.c H5FDspace.c \
+ H5FDstdio.c H5FDtest.c H5FL.c H5FO.c H5FS.c H5FScache.c \
+ H5FSdbg.c H5FSint.c H5FSsection.c H5FSstat.c H5FStest.c H5G.c \
+ H5Gbtree2.c H5Gcache.c H5Gcompact.c H5Gdense.c H5Gdeprec.c \
+ H5Gent.c H5Gint.c H5Glink.c H5Gloc.c H5Gname.c H5Gnode.c \
+ H5Gobj.c H5Goh.c H5Groot.c H5Gstab.c H5Gtest.c H5Gtraverse.c \
+ H5HF.c H5HFbtree2.c H5HFcache.c H5HFdbg.c H5HFdblock.c \
+ H5HFdtable.c H5HFhdr.c H5HFhuge.c H5HFiblock.c H5HFiter.c \
+ H5HFman.c H5HFsection.c H5HFspace.c H5HFstat.c H5HFtest.c \
+ H5HFtiny.c H5HG.c H5HGcache.c H5HGdbg.c H5HGquery.c H5HL.c \
+ H5HLcache.c H5HLdbg.c H5HLint.c H5HLprfx.c H5HLdblk.c H5HP.c \
+ H5I.c H5Itest.c H5L.c H5Lexternal.c H5lib_settings.c H5MF.c \
H5MFaggr.c H5MFdbg.c H5MFsection.c H5MM.c H5MP.c H5MPtest.c \
H5O.c H5Odeprec.c H5Oainfo.c H5Oalloc.c H5Oattr.c \
H5Oattribute.c H5Obogus.c H5Obtreek.c H5Ocache.c \
@@ -236,62 +236,63 @@ am__libhdf5_la_SOURCES_DIST = H5.c H5checksum.c H5dbg.c H5system.c \
am_libhdf5_la_OBJECTS = H5.lo H5checksum.lo H5dbg.lo H5system.lo \
H5timer.lo H5trace.lo H5A.lo H5Abtree2.lo H5Adense.lo \
H5Adeprec.lo H5Aint.lo H5Atest.lo H5AC.lo H5ACdbg.lo \
- H5AClog.lo H5ACproxy_entry.lo H5B.lo H5Bcache.lo H5Bdbg.lo \
- H5B2.lo H5B2cache.lo H5B2dbg.lo H5B2hdr.lo H5B2int.lo \
- H5B2internal.lo H5B2leaf.lo H5B2stat.lo H5B2test.lo H5C.lo \
- H5Cdbg.lo H5Cepoch.lo H5Cimage.lo H5Clog.lo H5Cprefetched.lo \
- H5Cquery.lo H5Ctag.lo H5Ctest.lo H5CS.lo H5CX.lo H5D.lo \
- H5Dbtree.lo H5Dbtree2.lo H5Dchunk.lo H5Dcompact.lo \
- H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo H5Dearray.lo H5Defl.lo \
- H5Dfarray.lo H5Dfill.lo H5Dint.lo H5Dio.lo H5Dlayout.lo \
- H5Dnone.lo H5Doh.lo H5Dscatgath.lo H5Dselect.lo H5Dsingle.lo \
- H5Dtest.lo H5Dvirtual.lo H5E.lo H5Edeprec.lo H5Eint.lo H5EA.lo \
- H5EAcache.lo H5EAdbg.lo H5EAdblkpage.lo H5EAdblock.lo \
- H5EAhdr.lo H5EAiblock.lo H5EAint.lo H5EAsblock.lo H5EAstat.lo \
- H5EAtest.lo H5F.lo H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo \
- H5Fdeprec.lo H5Fefc.lo H5Ffake.lo H5Fint.lo H5Fio.lo \
- H5Fmount.lo H5Fquery.lo H5Fsfile.lo H5Fspace.lo H5Fsuper.lo \
- H5Fsuper_cache.lo H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo \
- H5FAdblock.lo H5FAdblkpage.lo H5FAhdr.lo H5FAint.lo \
- H5FAstat.lo H5FAtest.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
- H5FDint.lo H5FDlog.lo H5FDmulti.lo H5FDsec2.lo H5FDspace.lo \
- H5FDstdio.lo H5FDtest.lo H5FL.lo H5FO.lo H5FS.lo H5FScache.lo \
- H5FSdbg.lo H5FSint.lo H5FSsection.lo H5FSstat.lo H5FStest.lo \
- H5G.lo H5Gbtree2.lo H5Gcache.lo H5Gcompact.lo H5Gdense.lo \
- H5Gdeprec.lo H5Gent.lo H5Gint.lo H5Glink.lo H5Gloc.lo \
- H5Gname.lo H5Gnode.lo H5Gobj.lo H5Goh.lo H5Groot.lo H5Gstab.lo \
- H5Gtest.lo H5Gtraverse.lo H5HF.lo H5HFbtree2.lo H5HFcache.lo \
- H5HFdbg.lo H5HFdblock.lo H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo \
- H5HFiblock.lo H5HFiter.lo H5HFman.lo H5HFsection.lo \
- H5HFspace.lo H5HFstat.lo H5HFtest.lo H5HFtiny.lo H5HG.lo \
- H5HGcache.lo H5HGdbg.lo H5HGquery.lo H5HL.lo H5HLcache.lo \
- H5HLdbg.lo H5HLint.lo H5HLprfx.lo H5HLdblk.lo H5HP.lo H5I.lo \
- H5Itest.lo H5L.lo H5Lexternal.lo H5lib_settings.lo H5MF.lo \
- H5MFaggr.lo H5MFdbg.lo H5MFsection.lo H5MM.lo H5MP.lo \
- H5MPtest.lo H5O.lo H5Odeprec.lo H5Oainfo.lo H5Oalloc.lo \
- H5Oattr.lo H5Oattribute.lo H5Obogus.lo H5Obtreek.lo \
- H5Ocache.lo H5Ocache_image.lo H5Ochunk.lo H5Ocont.lo \
- H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo H5Oefl.lo \
- H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo H5Oint.lo \
- H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo H5Omtime.lo \
- H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo H5Osdspace.lo \
- H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Otest.lo H5Ounknown.lo \
- H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo H5Pdeprec.lo \
- H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo H5Pfmpl.lo \
- H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo H5Pocpl.lo \
- H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PB.lo H5PL.lo \
- H5PLint.lo H5PLpath.lo H5PLplugin_cache.lo H5R.lo H5Rint.lo \
- H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo H5Sdbg.lo \
- H5Shyper.lo H5Snone.lo H5Spoint.lo H5Sselect.lo H5Stest.lo \
- H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo H5SMmessage.lo \
- H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo H5Tbit.lo H5Tcommit.lo \
- H5Tcompound.lo H5Tconv.lo H5Tcset.lo H5Tdbg.lo H5Tdeprec.lo \
- H5Tenum.lo H5Tfields.lo H5Tfixed.lo H5Tfloat.lo H5Tinit.lo \
- H5Tnative.lo H5Toffset.lo H5Toh.lo H5Topaque.lo H5Torder.lo \
- H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo H5Tvisit.lo H5Tvlen.lo \
- H5TS.lo H5VM.lo H5WB.lo H5Z.lo H5Zdeflate.lo H5Zfletcher32.lo \
- H5Znbit.lo H5Zshuffle.lo H5Zscaleoffset.lo H5Zszip.lo \
- H5Ztrans.lo $(am__objects_1) $(am__objects_2)
+ H5ACproxy_entry.lo H5B.lo H5Bcache.lo H5Bdbg.lo H5B2.lo \
+ H5B2cache.lo H5B2dbg.lo H5B2hdr.lo H5B2int.lo H5B2internal.lo \
+ H5B2leaf.lo H5B2stat.lo H5B2test.lo H5C.lo H5Cdbg.lo \
+ H5Cepoch.lo H5Cimage.lo H5Clog.lo H5Clog_json.lo \
+ H5Clog_trace.lo H5Cprefetched.lo H5Cquery.lo H5Ctag.lo \
+ H5Ctest.lo H5CS.lo H5CX.lo H5D.lo H5Dbtree.lo H5Dbtree2.lo \
+ H5Dchunk.lo H5Dcompact.lo H5Dcontig.lo H5Ddbg.lo H5Ddeprec.lo \
+ H5Dearray.lo H5Defl.lo H5Dfarray.lo H5Dfill.lo H5Dint.lo \
+ H5Dio.lo H5Dlayout.lo H5Dnone.lo H5Doh.lo H5Dscatgath.lo \
+ H5Dselect.lo H5Dsingle.lo H5Dtest.lo H5Dvirtual.lo H5E.lo \
+ H5Edeprec.lo H5Eint.lo H5EA.lo H5EAcache.lo H5EAdbg.lo \
+ H5EAdblkpage.lo H5EAdblock.lo H5EAhdr.lo H5EAiblock.lo \
+ H5EAint.lo H5EAsblock.lo H5EAstat.lo H5EAtest.lo H5F.lo \
+ H5Faccum.lo H5Fcwfs.lo H5Fdbg.lo H5Fdeprec.lo H5Fefc.lo \
+ H5Ffake.lo H5Fint.lo H5Fio.lo H5Fmount.lo H5Fquery.lo \
+ H5Fsfile.lo H5Fspace.lo H5Fsuper.lo H5Fsuper_cache.lo \
+ H5Ftest.lo H5FA.lo H5FAcache.lo H5FAdbg.lo H5FAdblock.lo \
+ H5FAdblkpage.lo H5FAhdr.lo H5FAint.lo H5FAstat.lo H5FAtest.lo \
+ H5FD.lo H5FDcore.lo H5FDfamily.lo H5FDint.lo H5FDlog.lo \
+ H5FDmulti.lo H5FDsec2.lo H5FDspace.lo H5FDstdio.lo H5FDtest.lo \
+ H5FL.lo H5FO.lo H5FS.lo H5FScache.lo H5FSdbg.lo H5FSint.lo \
+ H5FSsection.lo H5FSstat.lo H5FStest.lo H5G.lo H5Gbtree2.lo \
+ H5Gcache.lo H5Gcompact.lo H5Gdense.lo H5Gdeprec.lo H5Gent.lo \
+ H5Gint.lo H5Glink.lo H5Gloc.lo H5Gname.lo H5Gnode.lo H5Gobj.lo \
+ H5Goh.lo H5Groot.lo H5Gstab.lo H5Gtest.lo H5Gtraverse.lo \
+ H5HF.lo H5HFbtree2.lo H5HFcache.lo H5HFdbg.lo H5HFdblock.lo \
+ H5HFdtable.lo H5HFhdr.lo H5HFhuge.lo H5HFiblock.lo H5HFiter.lo \
+ H5HFman.lo H5HFsection.lo H5HFspace.lo H5HFstat.lo H5HFtest.lo \
+ H5HFtiny.lo H5HG.lo H5HGcache.lo H5HGdbg.lo H5HGquery.lo \
+ H5HL.lo H5HLcache.lo H5HLdbg.lo H5HLint.lo H5HLprfx.lo \
+ H5HLdblk.lo H5HP.lo H5I.lo H5Itest.lo H5L.lo H5Lexternal.lo \
+ H5lib_settings.lo H5MF.lo H5MFaggr.lo H5MFdbg.lo \
+ H5MFsection.lo H5MM.lo H5MP.lo H5MPtest.lo H5O.lo H5Odeprec.lo \
+ H5Oainfo.lo H5Oalloc.lo H5Oattr.lo H5Oattribute.lo H5Obogus.lo \
+ H5Obtreek.lo H5Ocache.lo H5Ocache_image.lo H5Ochunk.lo \
+ H5Ocont.lo H5Ocopy.lo H5Odbg.lo H5Odrvinfo.lo H5Odtype.lo \
+ H5Oefl.lo H5Ofill.lo H5Oflush.lo H5Ofsinfo.lo H5Oginfo.lo \
+ H5Oint.lo H5Olayout.lo H5Olinfo.lo H5Olink.lo H5Omessage.lo \
+ H5Omtime.lo H5Oname.lo H5Onull.lo H5Opline.lo H5Orefcount.lo \
+ H5Osdspace.lo H5Oshared.lo H5Oshmesg.lo H5Ostab.lo H5Otest.lo \
+ H5Ounknown.lo H5P.lo H5Pacpl.lo H5Pdapl.lo H5Pdcpl.lo \
+ H5Pdeprec.lo H5Pdxpl.lo H5Pencdec.lo H5Pfapl.lo H5Pfcpl.lo \
+ H5Pfmpl.lo H5Pgcpl.lo H5Pint.lo H5Plapl.lo H5Plcpl.lo \
+ H5Pocpl.lo H5Pocpypl.lo H5Pstrcpl.lo H5Ptest.lo H5PB.lo \
+ H5PL.lo H5PLint.lo H5PLpath.lo H5PLplugin_cache.lo H5R.lo \
+ H5Rint.lo H5Rdeprec.lo H5UC.lo H5RS.lo H5S.lo H5Sall.lo \
+ H5Sdbg.lo H5Shyper.lo H5Snone.lo H5Spoint.lo H5Sselect.lo \
+ H5Stest.lo H5SL.lo H5SM.lo H5SMbtree2.lo H5SMcache.lo \
+ H5SMmessage.lo H5SMtest.lo H5ST.lo H5T.lo H5Tarray.lo \
+ H5Tbit.lo H5Tcommit.lo H5Tcompound.lo H5Tconv.lo H5Tcset.lo \
+ H5Tdbg.lo H5Tdeprec.lo H5Tenum.lo H5Tfields.lo H5Tfixed.lo \
+ H5Tfloat.lo H5Tinit.lo H5Tnative.lo H5Toffset.lo H5Toh.lo \
+ H5Topaque.lo H5Torder.lo H5Tpad.lo H5Tprecis.lo H5Tstrpad.lo \
+ H5Tvisit.lo H5Tvlen.lo H5TS.lo H5VM.lo H5WB.lo H5Z.lo \
+ H5Zdeflate.lo H5Zfletcher32.lo H5Znbit.lo H5Zshuffle.lo \
+ H5Zscaleoffset.lo H5Zszip.lo H5Ztrans.lo $(am__objects_1) \
+ $(am__objects_2)
libhdf5_la_OBJECTS = $(am_libhdf5_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -690,7 +691,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -724,6 +724,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -868,29 +869,29 @@ TRACE = perl $(top_srcdir)/bin/trace
# .chklog files are output from those tests.
# *.clog and *.clog2 are from the MPE option.
CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2
-LT_VERS_INTERFACE = 103
+LT_VERS_INTERFACE = 104
LT_VERS_REVISION = 0
-LT_VERS_AGE = 0
-LT_CXX_VERS_INTERFACE = 103
+LT_VERS_AGE = 1
+LT_CXX_VERS_INTERFACE = 104
LT_CXX_VERS_REVISION = 0
-LT_CXX_VERS_AGE = 0
-LT_F_VERS_INTERFACE = 101
-LT_F_VERS_REVISION = 2
-LT_F_VERS_AGE = 1
+LT_CXX_VERS_AGE = 1
+LT_F_VERS_INTERFACE = 102
+LT_F_VERS_REVISION = 0
+LT_F_VERS_AGE = 0
LT_HL_VERS_INTERFACE = 101
-LT_HL_VERS_REVISION = 1
+LT_HL_VERS_REVISION = 2
LT_HL_VERS_AGE = 1
LT_HL_CXX_VERS_INTERFACE = 101
-LT_HL_CXX_VERS_REVISION = 2
+LT_HL_CXX_VERS_REVISION = 3
LT_HL_CXX_VERS_AGE = 1
LT_HL_F_VERS_INTERFACE = 100
-LT_HL_F_VERS_REVISION = 3
+LT_HL_F_VERS_REVISION = 4
LT_HL_F_VERS_AGE = 0
-LT_JAVA_VERS_INTERFACE = 103
+LT_JAVA_VERS_INTERFACE = 104
LT_JAVA_VERS_REVISION = 0
-LT_JAVA_VERS_AGE = 3
+LT_JAVA_VERS_AGE = 4
LT_TOOLS_VERS_INTERFACE = 101
-LT_TOOLS_VERS_REVISION = 1
+LT_TOOLS_VERS_REVISION = 2
LT_TOOLS_VERS_AGE = 1
# Our main target, the HDF5 library
@@ -907,20 +908,20 @@ DISTCLEANFILES = H5pubconf.h
# library sources
libhdf5_la_SOURCES = H5.c H5checksum.c H5dbg.c H5system.c H5timer.c \
H5trace.c H5A.c H5Abtree2.c H5Adense.c H5Adeprec.c H5Aint.c \
- H5Atest.c H5AC.c H5ACdbg.c H5AClog.c H5ACproxy_entry.c H5B.c \
- H5Bcache.c H5Bdbg.c H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c \
- H5B2int.c H5B2internal.c H5B2leaf.c H5B2stat.c H5B2test.c \
- H5C.c H5Cdbg.c H5Cepoch.c H5Cimage.c H5Clog.c H5Cprefetched.c \
- H5Cquery.c H5Ctag.c H5Ctest.c H5CS.c H5CX.c H5D.c H5Dbtree.c \
- H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \
- H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c \
- H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c H5Doh.c H5Dscatgath.c \
- H5Dselect.c H5Dsingle.c H5Dtest.c H5Dvirtual.c H5E.c \
- H5Edeprec.c H5Eint.c H5EA.c H5EAcache.c H5EAdbg.c \
- H5EAdblkpage.c H5EAdblock.c H5EAhdr.c H5EAiblock.c H5EAint.c \
- H5EAsblock.c H5EAstat.c H5EAtest.c H5F.c H5Faccum.c H5Fcwfs.c \
- H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c H5Fio.c \
- H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c H5Fsuper.c \
+ H5Atest.c H5AC.c H5ACdbg.c H5ACproxy_entry.c H5B.c H5Bcache.c \
+ H5Bdbg.c H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c \
+ H5B2internal.c H5B2leaf.c H5B2stat.c H5B2test.c H5C.c H5Cdbg.c \
+ H5Cepoch.c H5Cimage.c H5Clog.c H5Clog_json.c H5Clog_trace.c \
+ H5Cprefetched.c H5Cquery.c H5Ctag.c H5Ctest.c H5CS.c H5CX.c \
+ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c \
+ H5Dcontig.c H5Ddbg.c H5Ddeprec.c H5Dearray.c H5Defl.c \
+ H5Dfarray.c H5Dfill.c H5Dint.c H5Dio.c H5Dlayout.c H5Dnone.c \
+ H5Doh.c H5Dscatgath.c H5Dselect.c H5Dsingle.c H5Dtest.c \
+ H5Dvirtual.c H5E.c H5Edeprec.c H5Eint.c H5EA.c H5EAcache.c \
+ H5EAdbg.c H5EAdblkpage.c H5EAdblock.c H5EAhdr.c H5EAiblock.c \
+ H5EAint.c H5EAsblock.c H5EAstat.c H5EAtest.c H5F.c H5Faccum.c \
+ H5Fcwfs.c H5Fdbg.c H5Fdeprec.c H5Fefc.c H5Ffake.c H5Fint.c \
+ H5Fio.c H5Fmount.c H5Fquery.c H5Fsfile.c H5Fspace.c H5Fsuper.c \
H5Fsuper_cache.c H5Ftest.c H5FA.c H5FAcache.c H5FAdbg.c \
H5FAdblock.c H5FAdblkpage.c H5FAhdr.c H5FAint.c H5FAstat.c \
H5FAtest.c H5FD.c H5FDcore.c H5FDfamily.c H5FDint.c H5FDlog.c \
@@ -968,7 +969,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Epubgen.h H5Epublic.h H5Fpublic.h \
H5FDpublic.h H5FDcore.h H5FDdirect.h \
H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \
- H5FDmulti.h H5FDsec2.h H5FDstdio.h \
+ H5FDmulti.h H5FDsec2.h H5FDstdio.h H5FDwindows.h \
H5Gpublic.h H5Ipublic.h H5Lpublic.h \
H5MMpublic.h H5Opublic.h H5Ppublic.h \
H5PLextern.h H5PLpublic.h \
@@ -1118,7 +1119,6 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5A.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AC.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ACdbg.Plo@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5AClog.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ACmpio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5ACproxy_entry.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Abtree2.Plo@am__quote@
@@ -1145,6 +1145,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cepoch.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cimage.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Clog.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Clog_json.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Clog_trace.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cmpio.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cprefetched.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Cquery.Plo@am__quote@
@@ -2119,7 +2121,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 531cd00..9d0e29f 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -82,7 +82,6 @@ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
API tracing: @TRACE_API@
Using memory checker: @USINGMEMCHECKER@
Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
- Metadata trace file: @METADATATRACEFILE@
Function stack tracing: @CODESTACK@
Strict file format checks: @STRICT_FORMAT_CHECKS@
Optimization instrumentation: @INSTRUMENT_LIBRARY@
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index c8119fe..fa303ed 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")
@@ -127,6 +128,7 @@ endif ()
"${CMAKE_BINARY_DIR}/filter_plugin_dir2/$<TARGET_FILE_NAME:${HDF5_TEST_PLUGIN_TARGET}>"
)
endforeach ()
+endif ()
#################################################################################
# Test program sources
@@ -197,6 +199,7 @@ set (H5_TESTS
page_buffer
dtypes
dsets
+ chunk_info
cmpd_dset
filter_fail
extend
@@ -339,6 +342,7 @@ set (H5_CHECK_TESTS
atomic_reader
links_env
filenotclosed
+ del_many_dense_attrs
flushrefresh
)
diff --git a/test/CMakeTests.cmake b/test/CMakeTests.cmake
index 8838c34..a8dd647 100644
--- a/test/CMakeTests.cmake
+++ b/test/CMakeTests.cmake
@@ -171,6 +171,7 @@ set (HDF5_REFERENCE_TEST_FILES
le_data.h5
le_extlink1.h5
le_extlink2.h5
+ corrupted_name_len.h5
mergemsg.h5
multi_file_v16-r.h5
multi_file_v16-s.h5
@@ -230,47 +231,31 @@ add_test (NAME H5TEST-clear-testhdf5-objects
)
set_tests_properties (H5TEST-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP clear_testhdf5)
-if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5TEST-testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select)
- set_tests_properties (H5TEST-testhdf5-base PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
- )
- add_test (NAME H5TEST-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap)
- set_tests_properties (H5TEST-testhdf5-heap PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
- )
- add_test (NAME H5TEST-testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file)
- set_tests_properties (H5TEST-testhdf5-file PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
- )
- add_test (NAME H5TEST-testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select)
- set_tests_properties (H5TEST-testhdf5-select PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
- )
-else ()
- add_test (NAME H5TEST-testhdf5 COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=testhdf5.txt"
- #-D "TEST_REFERENCE=testhdf5.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5TEST-testhdf5 PROPERTIES
- FIXTURES_REQUIRED clear_testhdf5
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
- WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
- )
+add_test (NAME H5TEST-testhdf5-base COMMAND $<TARGET_FILE:testhdf5> -x heap -x file -x select)
+set_tests_properties (H5TEST-testhdf5-base PROPERTIES
+ FIXTURES_REQUIRED clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+add_test (NAME H5TEST-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5> -o heap)
+set_tests_properties (H5TEST-testhdf5-heap PROPERTIES
+ FIXTURES_REQUIRED clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+add_test (NAME H5TEST-testhdf5-file COMMAND $<TARGET_FILE:testhdf5> -o file)
+set_tests_properties (H5TEST-testhdf5-file PROPERTIES
+ FIXTURES_REQUIRED clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+add_test (NAME H5TEST-testhdf5-select COMMAND $<TARGET_FILE:testhdf5> -o select)
+set_tests_properties (H5TEST-testhdf5-select PROPERTIES
+ FIXTURES_REQUIRED clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+if (NOT HDF5_ENABLE_USING_MEMCHECKER)
if (BUILD_SHARED_LIBS)
add_test (NAME H5TEST-shared-clear-testhdf5-objects
COMMAND ${CMAKE_COMMAND}
@@ -297,19 +282,28 @@ else ()
${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
set_tests_properties (H5TEST-shared-clear-testhdf5-objects PROPERTIES FIXTURES_SETUP shared_clear_testhdf5)
- add_test (NAME H5TEST-shared-testhdf5 COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:testhdf5-shared>"
- -D "TEST_ARGS:STRING="
- -D "TEST_EXPECT=0"
- -D "TEST_SKIP_COMPARE=TRUE"
- -D "TEST_OUTPUT=testhdf5.txt"
- #-D "TEST_REFERENCE=testhdf5.out"
- -D "TEST_FOLDER=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ add_test (NAME H5TEST-shared-testhdf5-base COMMAND $<TARGET_FILE:testhdf5-shared> -x heap -x file -x select)
+ set_tests_properties (H5TEST-shared-testhdf5-base PROPERTIES
+ FIXTURES_REQUIRED shared_clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
- set_tests_properties (H5TEST-shared-testhdf5 PROPERTIES
+ add_test (NAME H5TEST-shared-testhdf5-heap COMMAND $<TARGET_FILE:testhdf5-shared> -o heap)
+ set_tests_properties (H5TEST-shared-testhdf5-heap PROPERTIES
FIXTURES_REQUIRED shared_clear_testhdf5
- ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+ add_test (NAME H5TEST-shared-testhdf5-file COMMAND $<TARGET_FILE:testhdf5-shared> -o file)
+ set_tests_properties (H5TEST-shared-testhdf5-file PROPERTIES
+ FIXTURES_REQUIRED shared_clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
+ )
+ add_test (NAME H5TEST-shared-testhdf5-select COMMAND $<TARGET_FILE:testhdf5-shared> -o select)
+ set_tests_properties (H5TEST-shared-testhdf5-select PROPERTIES
+ FIXTURES_REQUIRED shared_clear_testhdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
endif ()
@@ -359,6 +353,9 @@ set (test_CLEANFILES
lheap.h5
fheap.h5
ohdr.h5
+ ohdr_min_a.h5
+ ohdr_min_b.h5
+ min_dset_ohdr_testfile.h5
stab.h5
extern_*.h5
extern_*.raw
@@ -517,6 +514,7 @@ set (test_CLEANFILES
flushrefresh_VERIFICATION_CHECKPOINT2
flushrefresh_VERIFICATION_DONE
filenotclosed.h5
+ del_many_dense_attrs.h5
atomic_data
accum_swmr_big.h5
ohdr_swmr.h5
@@ -581,10 +579,10 @@ foreach (test ${H5_TESTS})
endif ()
endforeach ()
-set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT 1800)
-set_tests_properties (H5TEST-big PROPERTIES TIMEOUT 1800)
-set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT 1800)
-set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT 1800)
+set_tests_properties (H5TEST-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+set_tests_properties (H5TEST-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+set_tests_properties (H5TEST-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+set_tests_properties (H5TEST-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
if (BUILD_SHARED_LIBS)
# Remove any output file left over from previous test run
@@ -623,10 +621,10 @@ if (BUILD_SHARED_LIBS)
endif ()
endforeach ()
- set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT 1800)
- set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT 1800)
- set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT 1800)
- set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT 1800)
+ set_tests_properties (H5TEST-shared-fheap PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+ set_tests_properties (H5TEST-shared-big PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+ set_tests_properties (H5TEST-shared-btree2 PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
+ set_tests_properties (H5TEST-shared-objcopy PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
#-- Adding test for cache
@@ -658,9 +656,10 @@ if (NOT CYGWIN)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
- set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT 1800)
+ set_tests_properties (H5TEST-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
+if (TEST_CACHE_IMAGE)
#-- Adding test for cache_image
add_test (
NAME H5TEST-clear-cache_image-objects
@@ -677,6 +676,7 @@ set_tests_properties (H5TEST-cache_image PROPERTIES
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
+endif ()
if (BUILD_SHARED_LIBS)
#-- Adding test for cache
@@ -708,7 +708,7 @@ if (BUILD_SHARED_LIBS)
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST-shared
)
- set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT 1800)
+ set_tests_properties (H5TEST-shared-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
endif ()
@@ -792,6 +792,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
# atomic_reader
# links_env
# filenotclosed
+# del_many_dense_attrs
# flushrefresh
##############################################################################
# autotools script tests
@@ -799,7 +800,7 @@ set_tests_properties (H5TEST-tcheck_version-release PROPERTIES
# NOT CONVERTED accum_swmr_reader is used by accum.c.
# NOT CONVERTED atomic_writer and atomic_reader are standalone programs.
# links_env is used by testlinks_env.sh
-# filenotclosed is used by test_filenotclosed.sh
+# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
# NOT CONVERTED flushrefresh is used by testflushrefresh.sh.
# NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
# NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh.
@@ -826,6 +827,23 @@ set_tests_properties (H5TEST-filenotclosed PROPERTIES
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
)
+#-- Adding test for del_many_dense_attrs
+add_test (
+ NAME H5TEST-clear-del_many_dense_attrs-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ del_many_dense_attrs.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+set_tests_properties (H5TEST-clear-del_many_dense_attrs-objects PROPERTIES FIXTURES_SETUP del_many_dense_attrs_clear_objects)
+add_test (NAME H5TEST-del_many_dense_attrs COMMAND $<TARGET_FILE:del_many_dense_attrs>)
+set_tests_properties (H5TEST-del_many_dense_attrs PROPERTIES
+ FIXTURES_REQUIRED del_many_dense_attrs_clear_objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/H5TEST"
+ WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/H5TEST
+)
+
#-- Adding test for err_compat
if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
add_test (NAME H5TEST-clear-err_compat-objects
@@ -842,6 +860,7 @@ if (HDF5_ENABLE_DEPRECATED_SYMBOLS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=err_compat.txt"
-D "TEST_REFERENCE=err_compat_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
@@ -876,6 +895,7 @@ else ()
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=error_test.txt"
-D "TEST_REFERENCE=error_test_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST"
@@ -942,6 +962,7 @@ if (BUILD_SHARED_LIBS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=err_compat.txt"
-D "TEST_REFERENCE=err_compat_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
@@ -976,6 +997,7 @@ if (BUILD_SHARED_LIBS)
-D "TEST_ARGS:STRING="
-D "TEST_EXPECT=0"
-D "TEST_MASK_ERROR=true"
+ -D "ERROR_APPEND=1"
-D "TEST_OUTPUT=error_test.txt"
-D "TEST_REFERENCE=error_test_1"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/H5TEST-shared"
@@ -1029,42 +1051,44 @@ 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)
endif()
if (ENABLE_EXTENDED_TESTS)
- ##############################################################################
- ### S W M R T E S T S
- ##############################################################################
- # testflushrefresh.sh: flushrefresh
- # test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
- # testswmr.sh: swmr*
- # testvdsswmr.sh: vds_swmr*
+##############################################################################
+### S W M R T E S T S
+##############################################################################
+# testflushrefresh.sh: flushrefresh
+# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
+# testswmr.sh: swmr*
+# testvdsswmr.sh: vds_swmr*
# add_test (NAME H5Test-swmr_check_compat_vfd COMMAND $<TARGET_FILE:swmr_check_compat_vfd>)
diff --git a/test/CMakeVFDTests.cmake b/test/CMakeVFDTests.cmake
index be02110..569f215 100644
--- a/test/CMakeVFDTests.cmake
+++ b/test/CMakeVFDTests.cmake
@@ -92,6 +92,7 @@ endif ()
set (H5_VFD_SKIP_TESTS
cache
+ cache_image
accum
fheap
big
@@ -111,32 +112,48 @@ endif ()
if ("${vfdtest}" STREQUAL "flush1" OR "${vfdtest}" STREQUAL "flush2")
if ("${vfdname}" STREQUAL "multi" OR "${vfdname}" STREQUAL "split")
if (NOT BUILD_SHARED_LIBS AND NOT ${HDF_CFG_NAME} MATCHES "Debug")
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${vfdtest}.out
+ ${vfdname}/${vfdname}-${vfdtest}.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
if (BUILD_SHARED_LIBS)
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
+ )
add_test (NAME VFD-${vfdname}-${test}-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
)
@@ -152,64 +169,96 @@ endif ()
endif ()
endif ()
else ()
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${vfdtest}.out
+ ${vfdname}/${vfdname}-${vfdtest}.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
if (BUILD_SHARED_LIBS)
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
+ )
add_test (NAME VFD-${vfdname}-${test}-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
)
endif ()
endif ()
else ()
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${vfdtest}.out
+ ${vfdname}/${vfdname}-${vfdtest}.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
if (BUILD_SHARED_LIBS AND NOT "${vfdtest}" STREQUAL "cache")
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
)
@@ -218,32 +267,48 @@ endif ()
endmacro ()
macro (DO_VFD_TEST vfdtest vfdname resultcode)
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-${vfdtest}.out
+ ${vfdname}/${vfdname}-${vfdtest}.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest} PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
if (BUILD_SHARED_LIBS)
+ add_test (
+ NAME VFD-${vfdname}-${vfdtest}-shared-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out
+ ${vfdname}-shared/${vfdname}-${vfdtest}-shared.out.err
+ )
add_test (NAME VFD-${vfdname}-${vfdtest}-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:${vfdtest}-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared"
+ -D "TEST_OUTPUT=${vfdname}-${vfdtest}-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-${vfdtest}-shared PROPERTIES
+ DEPENDS VFD-${vfdname}-${vfdtest}-shared-clear-objects
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
)
@@ -263,48 +328,64 @@ endif ()
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES DEPENDS VFD-${vfdname}-flush1)
set_tests_properties (VFD-${vfdname}-flush1 PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2 PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT 1800)
+ set_tests_properties (VFD-${vfdname}-istore PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
if (NOT CYGWIN)
- set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT 1800)
+ set_tests_properties (VFD-${vfdname}-cache PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
if (BUILD_SHARED_LIBS)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES DEPENDS VFD-${vfdname}-flush1-shared)
set_tests_properties (VFD-${vfdname}-flush1-shared PROPERTIES TIMEOUT 10)
set_tests_properties (VFD-${vfdname}-flush2-shared PROPERTIES TIMEOUT 10)
- set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT 1800)
+ set_tests_properties (VFD-${vfdname}-istore-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
if (NOT CYGWIN AND NOT WIN32)
- set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT 1800)
+ set_tests_properties (VFD-${vfdname}-cache-shared PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
endif ()
endif ()
if (HDF5_TEST_FHEAP_VFD)
+ add_test (
+ NAME VFD-${vfdname}-fheap-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}/${vfdname}-fheap.out
+ ${vfdname}/${vfdname}-fheap.out.err
+ )
add_test (NAME VFD-${vfdname}-fheap
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:fheap>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-fheap"
+ -D "TEST_OUTPUT=${vfdname}-fheap.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-fheap PROPERTIES
- TIMEOUT 1800
+ DEPENDS VFD-${vfdname}-fheap-clear-objects
+ TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname};HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}
)
if (BUILD_SHARED_LIBS)
+ add_test (
+ NAME VFD-${vfdname}-fheap-shared-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-fheap-shared.out
+ ${vfdname}-shared/${vfdname}-fheap-shared.out.err
+ )
add_test (NAME VFD-${vfdname}-fheap-shared
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=$<TARGET_FILE:fheap-shared>"
-D "TEST_ARGS:STRING="
-D "TEST_VFD:STRING=${vfdname}"
-D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${vfdname}-fheap-shared"
+ -D "TEST_OUTPUT=${vfdname}-fheap-shared.out"
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}-shared"
-P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
)
set_tests_properties (VFD-${vfdname}-fheap-shared PROPERTIES
- TIMEOUT 1800
+ DEPENDS VFD-${vfdname}-fheap-shared-clear-objects
+ TIMEOUT ${CTEST_VERY_LONG_TIMEOUT}
ENVIRONMENT "srcdir=${HDF5_TEST_BINARY_DIR}/${vfdname}-shared;HDF5TestExpress=${HDF_TEST_EXPRESS}"
WORKING_DIRECTORY ${HDF5_TEST_BINARY_DIR}/${vfdname}-shared
)
diff --git a/test/Makefile.am b/test/Makefile.am
index d4db6d0..c4fb876 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -29,12 +29,13 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_builddir)/src
# testflushrefresh.sh: flushrefresh
# testswmr.sh: swmr*
# testvdsswmr.sh: vds_swmr*
-# test_filenotclosed.sh: filenotclosed.c
+# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c
# test_filter_plugin.sh: filter_plugin.c
# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
-TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filenotclosed.sh\
- testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh
-SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) filenotclosed$(EXEEXT) \
+TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh \
+ testswmr.sh testvdsswmr.sh testflushrefresh.sh test_usecases.sh testabort_fail.sh
+SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) links_env$(EXEEXT) \
+ filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \
flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \
swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \
swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \
@@ -55,8 +56,8 @@ TEST_PROG= testhdf5 \
cache cache_api cache_image cache_tagging lheap ohdr stab gheap \
evict_on_close farray earray btree2 fheap \
pool accum hyperslab istore bittests dt_arith page_buffer \
- dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \
- objcopy links unlink twriteorder big mtime fillval mount \
+ dtypes dsets chunk_info cmpd_dset filter_fail extend direct_chunk \
+ external efc objcopy links unlink twriteorder big mtime fillval mount \
flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \
enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \
reserved cross_read freespace mf vds file_image unregister \
@@ -68,7 +69,7 @@ TEST_PROG= testhdf5 \
# accum_swmr_reader is used by accum.c.
# atomic_writer and atomic_reader are standalone programs.
# links_env is used by testlinks_env.sh
-# filenotclosed is used by test_filenotclosed.sh
+# filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
# flushrefresh is used by testflushrefresh.sh.
# use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
# swmr_* files (besides swmr.c) are used by testswmr.sh.
@@ -78,7 +79,8 @@ TEST_PROG= testhdf5 \
# and this lets automake keep all its test programs in one place.
check_PROGRAMS=$(TEST_PROG) error_test err_compat tcheck_version \
testmeta accum_swmr_reader atomic_writer atomic_reader \
- links_env filenotclosed flushrefresh use_append_chunk use_append_mchunks use_disable_mdc_flushes \
+ links_env filenotclosed del_many_dense_attrs flushrefresh \
+ use_append_chunk use_append_mchunks use_disable_mdc_flushes \
swmr_generator swmr_start_write swmr_reader swmr_writer swmr_remove_reader \
swmr_remove_writer swmr_addrem_writer swmr_sparse_reader swmr_sparse_writer \
swmr_check_compat_vfd vds_swmr_gen vds_swmr_reader vds_swmr_writer
@@ -165,6 +167,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse
extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \
sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \
stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \
+ ohdr_min_a.h5 ohdr_min_b.h5 min_dset_ohdr_testfile.h5 \
dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \
big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \
@@ -208,6 +211,6 @@ use_disable_mdc_flushes_SOURCES=use_disable_mdc_flushes.c
# Temporary files.
DISTCLEANFILES=testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \
- testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh
+ testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh
include $(top_srcdir)/config/conclude.am
diff --git a/test/Makefile.in b/test/Makefile.in
index 7e6bde1..198d4ab 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -110,16 +110,16 @@ check_PROGRAMS = $(am__EXEEXT_1) error_test$(EXEEXT) \
err_compat$(EXEEXT) tcheck_version$(EXEEXT) testmeta$(EXEEXT) \
accum_swmr_reader$(EXEEXT) atomic_writer$(EXEEXT) \
atomic_reader$(EXEEXT) links_env$(EXEEXT) \
- filenotclosed$(EXEEXT) flushrefresh$(EXEEXT) \
- use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) \
- use_disable_mdc_flushes$(EXEEXT) swmr_generator$(EXEEXT) \
- swmr_start_write$(EXEEXT) swmr_reader$(EXEEXT) \
- swmr_writer$(EXEEXT) swmr_remove_reader$(EXEEXT) \
- swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \
- swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) \
- swmr_check_compat_vfd$(EXEEXT) vds_swmr_gen$(EXEEXT) \
- vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) \
- $(am__EXEEXT_2)
+ filenotclosed$(EXEEXT) del_many_dense_attrs$(EXEEXT) \
+ flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) \
+ use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \
+ swmr_generator$(EXEEXT) swmr_start_write$(EXEEXT) \
+ swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \
+ swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) \
+ swmr_addrem_writer$(EXEEXT) swmr_sparse_reader$(EXEEXT) \
+ swmr_sparse_writer$(EXEEXT) swmr_check_compat_vfd$(EXEEXT) \
+ vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) \
+ vds_swmr_writer$(EXEEXT) $(am__EXEEXT_2)
@HAVE_SHARED_CONDITIONAL_TRUE@am__append_3 = filter_plugin
@BUILD_ALL_CONDITIONAL_TRUE@noinst_PROGRAMS = $(am__EXEEXT_3)
@DIRECT_VFD_CONDITIONAL_TRUE@am__append_4 = direct
@@ -150,9 +150,9 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/H5config.h \
$(top_builddir)/fortran/src/H5config_f.inc
-CONFIG_CLEAN_FILES = H5srcdir_str.h testcheck_version.sh testerror.sh \
- testflushrefresh.sh testlibinfo.sh testlinks_env.sh \
- testswmr.sh testvdsswmr.sh test_filenotclosed.sh \
+CONFIG_CLEAN_FILES = H5srcdir_str.h testabort_fail.sh \
+ testcheck_version.sh testerror.sh testflushrefresh.sh \
+ testlibinfo.sh testlinks_env.sh testswmr.sh testvdsswmr.sh \
test_filter_plugin.sh test_usecases.sh
CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
@@ -220,11 +220,11 @@ am__EXEEXT_1 = testhdf5$(EXEEXT) cache$(EXEEXT) cache_api$(EXEEXT) \
btree2$(EXEEXT) fheap$(EXEEXT) pool$(EXEEXT) accum$(EXEEXT) \
hyperslab$(EXEEXT) istore$(EXEEXT) bittests$(EXEEXT) \
dt_arith$(EXEEXT) page_buffer$(EXEEXT) dtypes$(EXEEXT) \
- dsets$(EXEEXT) cmpd_dset$(EXEEXT) filter_fail$(EXEEXT) \
- extend$(EXEEXT) direct_chunk$(EXEEXT) external$(EXEEXT) \
- efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) unlink$(EXEEXT) \
- twriteorder$(EXEEXT) big$(EXEEXT) mtime$(EXEEXT) \
- fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
+ dsets$(EXEEXT) chunk_info$(EXEEXT) cmpd_dset$(EXEEXT) \
+ filter_fail$(EXEEXT) extend$(EXEEXT) direct_chunk$(EXEEXT) \
+ external$(EXEEXT) efc$(EXEEXT) objcopy$(EXEEXT) links$(EXEEXT) \
+ unlink$(EXEEXT) twriteorder$(EXEEXT) big$(EXEEXT) \
+ mtime$(EXEEXT) fillval$(EXEEXT) mount$(EXEEXT) flush1$(EXEEXT) \
flush2$(EXEEXT) app_ref$(EXEEXT) enum$(EXEEXT) \
set_extent$(EXEEXT) ttsafe$(EXEEXT) enc_dec_plist$(EXEEXT) \
enc_dec_plist_cross_platform$(EXEEXT) getname$(EXEEXT) \
@@ -297,6 +297,10 @@ cache_tagging_SOURCES = cache_tagging.c
cache_tagging_OBJECTS = cache_tagging.$(OBJEXT)
cache_tagging_LDADD = $(LDADD)
cache_tagging_DEPENDENCIES = libh5test.la $(LIBHDF5)
+chunk_info_SOURCES = chunk_info.c
+chunk_info_OBJECTS = chunk_info.$(OBJEXT)
+chunk_info_LDADD = $(LDADD)
+chunk_info_DEPENDENCIES = libh5test.la $(LIBHDF5)
cmpd_dset_SOURCES = cmpd_dset.c
cmpd_dset_OBJECTS = cmpd_dset.$(OBJEXT)
cmpd_dset_LDADD = $(LDADD)
@@ -313,6 +317,10 @@ dangle_SOURCES = dangle.c
dangle_OBJECTS = dangle.$(OBJEXT)
dangle_LDADD = $(LDADD)
dangle_DEPENDENCIES = libh5test.la $(LIBHDF5)
+del_many_dense_attrs_SOURCES = del_many_dense_attrs.c
+del_many_dense_attrs_OBJECTS = del_many_dense_attrs.$(OBJEXT)
+del_many_dense_attrs_LDADD = $(LDADD)
+del_many_dense_attrs_DEPENDENCIES = libh5test.la $(LIBHDF5)
direct_chunk_SOURCES = direct_chunk.c
direct_chunk_OBJECTS = direct_chunk.$(OBJEXT)
direct_chunk_LDADD = $(LDADD)
@@ -733,17 +741,18 @@ SOURCES = $(libfilter_plugin1_dsets_la_SOURCES) \
accum.c accum_swmr_reader.c app_ref.c atomic_reader.c \
atomic_writer.c big.c bittests.c btree2.c cache.c cache_api.c \
$(cache_image_SOURCES) cache_logging.c cache_tagging.c \
- cmpd_dset.c cork.c cross_read.c dangle.c direct_chunk.c \
- dsets.c dt_arith.c dtransform.c dtypes.c earray.c efc.c \
- enc_dec_plist.c enc_dec_plist_cross_platform.c enum.c \
- err_compat.c error_test.c evict_on_close.c extend.c external.c \
- farray.c fheap.c file_image.c filenotclosed.c fillval.c \
- filter_fail.c filter_plugin.c flush1.c flush2.c flushrefresh.c \
- freespace.c gen_bad_offset.c gen_bad_ohdr.c gen_bogus.c \
- gen_bounds.c gen_cross.c gen_deflate.c gen_file_image.c \
- gen_filespace.c gen_filters.c gen_new_array.c gen_new_fill.c \
- gen_new_group.c gen_new_mtime.c gen_new_super.c \
- gen_noencoder.c gen_nullspace.c gen_plist.c gen_sizes_lheap.c \
+ chunk_info.c cmpd_dset.c cork.c cross_read.c dangle.c \
+ del_many_dense_attrs.c direct_chunk.c dsets.c dt_arith.c \
+ dtransform.c dtypes.c earray.c efc.c enc_dec_plist.c \
+ enc_dec_plist_cross_platform.c enum.c err_compat.c \
+ error_test.c evict_on_close.c extend.c external.c farray.c \
+ fheap.c file_image.c filenotclosed.c fillval.c filter_fail.c \
+ filter_plugin.c flush1.c flush2.c flushrefresh.c freespace.c \
+ gen_bad_offset.c gen_bad_ohdr.c gen_bogus.c gen_bounds.c \
+ gen_cross.c gen_deflate.c gen_file_image.c gen_filespace.c \
+ gen_filters.c gen_new_array.c gen_new_fill.c gen_new_group.c \
+ gen_new_mtime.c gen_new_super.c gen_noencoder.c \
+ gen_nullspace.c gen_plist.c gen_sizes_lheap.c \
gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \
istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \
ntypes.c objcopy.c ohdr.c page_buffer.c pool.c reserved.c \
@@ -763,16 +772,17 @@ DIST_SOURCES = $(am__libfilter_plugin1_dsets_la_SOURCES_DIST) \
$(libh5test_la_SOURCES) accum.c accum_swmr_reader.c app_ref.c \
atomic_reader.c atomic_writer.c big.c bittests.c btree2.c \
cache.c cache_api.c $(cache_image_SOURCES) cache_logging.c \
- cache_tagging.c cmpd_dset.c cork.c cross_read.c dangle.c \
- direct_chunk.c dsets.c dt_arith.c dtransform.c dtypes.c \
- earray.c efc.c enc_dec_plist.c enc_dec_plist_cross_platform.c \
- enum.c err_compat.c error_test.c evict_on_close.c extend.c \
- external.c farray.c fheap.c file_image.c filenotclosed.c \
- fillval.c filter_fail.c filter_plugin.c flush1.c flush2.c \
- flushrefresh.c freespace.c gen_bad_offset.c gen_bad_ohdr.c \
- gen_bogus.c gen_bounds.c gen_cross.c gen_deflate.c \
- gen_file_image.c gen_filespace.c gen_filters.c gen_new_array.c \
- gen_new_fill.c gen_new_group.c gen_new_mtime.c gen_new_super.c \
+ cache_tagging.c chunk_info.c cmpd_dset.c cork.c cross_read.c \
+ dangle.c del_many_dense_attrs.c direct_chunk.c dsets.c \
+ dt_arith.c dtransform.c dtypes.c earray.c efc.c \
+ enc_dec_plist.c enc_dec_plist_cross_platform.c enum.c \
+ err_compat.c error_test.c evict_on_close.c extend.c external.c \
+ farray.c fheap.c file_image.c filenotclosed.c fillval.c \
+ filter_fail.c filter_plugin.c flush1.c flush2.c flushrefresh.c \
+ freespace.c gen_bad_offset.c gen_bad_ohdr.c gen_bogus.c \
+ gen_bounds.c gen_cross.c gen_deflate.c gen_file_image.c \
+ gen_filespace.c gen_filters.c gen_new_array.c gen_new_fill.c \
+ gen_new_group.c gen_new_mtime.c gen_new_super.c \
gen_noencoder.c gen_nullspace.c gen_plist.c gen_sizes_lheap.c \
gen_specmetaread.c gen_udlinks.c getname.c gheap.c hyperslab.c \
istore.c lheap.c links.c links_env.c mf.c mount.c mtime.c \
@@ -1013,9 +1023,8 @@ TEST_LOGS = $(am__test_logs2:.sh.log=.log)
SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/bin/test-driver
SH_LOG_COMPILE = $(SH_LOG_COMPILER) $(AM_SH_LOG_FLAGS) $(SH_LOG_FLAGS)
am__DIST_COMMON = $(srcdir)/H5srcdir_str.h.in $(srcdir)/Makefile.in \
- $(srcdir)/test_filenotclosed.sh.in \
$(srcdir)/test_filter_plugin.sh.in \
- $(srcdir)/test_usecases.sh.in \
+ $(srcdir)/test_usecases.sh.in $(srcdir)/testabort_fail.sh.in \
$(srcdir)/testcheck_version.sh.in $(srcdir)/testerror.sh.in \
$(srcdir)/testflushrefresh.sh.in $(srcdir)/testlibinfo.sh.in \
$(srcdir)/testlinks_env.sh.in $(srcdir)/testswmr.sh.in \
@@ -1164,7 +1173,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -1198,6 +1206,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1358,10 +1367,12 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 accum.h5 \
dls_01_strings.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 \
links*.h5 sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 \
fheap.h5 ohdr.h5 stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw \
- gheap[0-4].h5 dt_arith[1-2] links.h5 links[0-6]*.h5 \
- extlinks[0-15].h5 tmp big.data big[0-9][0-9][0-9][0-9][0-9].h5 \
- stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 \
- tattr.h5 tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
+ gheap[0-4].h5 ohdr_min_a.h5 ohdr_min_b.h5 \
+ min_dset_ohdr_testfile.h5 dt_arith[1-2] links.h5 \
+ links[0-6]*.h5 extlinks[0-15].h5 tmp big.data \
+ big[0-9][0-9][0-9][0-9][0-9].h5 stdio.h5 sec2.h5 \
+ dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \
+ tselect.h5 mtime.h5 unlink.h5 unicode.h5 coord.h5 \
fillval_[0-9].h5 fillval.raw mount_[0-9].h5 testmeta.h5 \
ttime.h5 trefer[1-3].h5 tvltypes.h5 tvlstr.h5 tvlstr2.h5 \
twriteorder.dat flush.h5 flush-swmr.h5 noflush.h5 \
@@ -1400,24 +1411,24 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 accum.h5 \
# testflushrefresh.sh: flushrefresh
# testswmr.sh: swmr*
# testvdsswmr.sh: vds_swmr*
-# test_filenotclosed.sh: filenotclosed.c
+# testabort_fail.sh: filenotclosed.c and del_many_dense_attrs.c
# test_filter_plugin.sh: filter_plugin.c
# test_usecases.sh: use_append_chunk, use_append_mchunks, use_disable_mdc_flushes
TEST_SCRIPT = testerror.sh testlibinfo.sh testcheck_version.sh \
- testlinks_env.sh test_filenotclosed.sh testswmr.sh \
- testvdsswmr.sh testflushrefresh.sh test_usecases.sh \
+ testlinks_env.sh testswmr.sh testvdsswmr.sh \
+ testflushrefresh.sh test_usecases.sh testabort_fail.sh \
$(am__append_1)
SCRIPT_DEPEND = error_test$(EXEEXT) err_compat$(EXEEXT) \
links_env$(EXEEXT) filenotclosed$(EXEEXT) \
- flushrefresh$(EXEEXT) use_append_chunk$(EXEEXT) \
- use_append_mchunks$(EXEEXT) use_disable_mdc_flushes$(EXEEXT) \
- swmr_generator$(EXEEXT) swmr_reader$(EXEEXT) \
- swmr_writer$(EXEEXT) swmr_remove_reader$(EXEEXT) \
- swmr_remove_writer$(EXEEXT) swmr_addrem_writer$(EXEEXT) \
- swmr_sparse_reader$(EXEEXT) swmr_sparse_writer$(EXEEXT) \
- swmr_start_write$(EXEEXT) vds_swmr_gen$(EXEEXT) \
- vds_swmr_reader$(EXEEXT) vds_swmr_writer$(EXEEXT) \
- $(am__append_2)
+ del_many_dense_attrs$(EXEEXT) flushrefresh$(EXEEXT) \
+ use_append_chunk$(EXEEXT) use_append_mchunks$(EXEEXT) \
+ use_disable_mdc_flushes$(EXEEXT) swmr_generator$(EXEEXT) \
+ swmr_reader$(EXEEXT) swmr_writer$(EXEEXT) \
+ swmr_remove_reader$(EXEEXT) swmr_remove_writer$(EXEEXT) \
+ swmr_addrem_writer$(EXEEXT) swmr_sparse_reader$(EXEEXT) \
+ swmr_sparse_writer$(EXEEXT) swmr_start_write$(EXEEXT) \
+ vds_swmr_gen$(EXEEXT) vds_swmr_reader$(EXEEXT) \
+ vds_swmr_writer$(EXEEXT) $(am__append_2)
check_SCRIPTS = $(TEST_SCRIPT)
# These are our main targets. They should be listed in the order to be
@@ -1428,8 +1439,8 @@ TEST_PROG = testhdf5 \
cache cache_api cache_image cache_tagging lheap ohdr stab gheap \
evict_on_close farray earray btree2 fheap \
pool accum hyperslab istore bittests dt_arith page_buffer \
- dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \
- objcopy links unlink twriteorder big mtime fillval mount \
+ dtypes dsets chunk_info cmpd_dset filter_fail extend direct_chunk \
+ external efc objcopy links unlink twriteorder big mtime fillval mount \
flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \
enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \
reserved cross_read freespace mf vds file_image unregister \
@@ -1487,7 +1498,7 @@ use_disable_mdc_flushes_SOURCES = use_disable_mdc_flushes.c
# Temporary files.
DISTCLEANFILES = testerror.sh testlibinfo.sh testcheck_version.sh testlinks_env.sh test_filter_plugin.sh \
- testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh test_filenotclosed.sh
+ testswmr.sh testvdsswmr.sh test_usecases.sh testflushrefresh.sh testabort_fail.sh
# Automake needs to be taught how to build lib, progs and tests targets.
@@ -1546,6 +1557,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
H5srcdir_str.h: $(top_builddir)/config.status $(srcdir)/H5srcdir_str.h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+testabort_fail.sh: $(top_builddir)/config.status $(srcdir)/testabort_fail.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testcheck_version.sh: $(top_builddir)/config.status $(srcdir)/testcheck_version.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testerror.sh: $(top_builddir)/config.status $(srcdir)/testerror.sh.in
@@ -1560,8 +1573,6 @@ testswmr.sh: $(top_builddir)/config.status $(srcdir)/testswmr.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
testvdsswmr.sh: $(top_builddir)/config.status $(srcdir)/testvdsswmr.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-test_filenotclosed.sh: $(top_builddir)/config.status $(srcdir)/test_filenotclosed.sh.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
test_filter_plugin.sh: $(top_builddir)/config.status $(srcdir)/test_filter_plugin.sh.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
test_usecases.sh: $(top_builddir)/config.status $(srcdir)/test_usecases.sh.in
@@ -1663,6 +1674,10 @@ cache_tagging$(EXEEXT): $(cache_tagging_OBJECTS) $(cache_tagging_DEPENDENCIES) $
@rm -f cache_tagging$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(cache_tagging_OBJECTS) $(cache_tagging_LDADD) $(LIBS)
+chunk_info$(EXEEXT): $(chunk_info_OBJECTS) $(chunk_info_DEPENDENCIES) $(EXTRA_chunk_info_DEPENDENCIES)
+ @rm -f chunk_info$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(chunk_info_OBJECTS) $(chunk_info_LDADD) $(LIBS)
+
cmpd_dset$(EXEEXT): $(cmpd_dset_OBJECTS) $(cmpd_dset_DEPENDENCIES) $(EXTRA_cmpd_dset_DEPENDENCIES)
@rm -f cmpd_dset$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(cmpd_dset_OBJECTS) $(cmpd_dset_LDADD) $(LIBS)
@@ -1679,6 +1694,10 @@ dangle$(EXEEXT): $(dangle_OBJECTS) $(dangle_DEPENDENCIES) $(EXTRA_dangle_DEPENDE
@rm -f dangle$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(dangle_OBJECTS) $(dangle_LDADD) $(LIBS)
+del_many_dense_attrs$(EXEEXT): $(del_many_dense_attrs_OBJECTS) $(del_many_dense_attrs_DEPENDENCIES) $(EXTRA_del_many_dense_attrs_DEPENDENCIES)
+ @rm -f del_many_dense_attrs$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(del_many_dense_attrs_OBJECTS) $(del_many_dense_attrs_LDADD) $(LIBS)
+
direct_chunk$(EXEEXT): $(direct_chunk_OBJECTS) $(direct_chunk_DEPENDENCIES) $(EXTRA_direct_chunk_DEPENDENCIES)
@rm -f direct_chunk$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(direct_chunk_OBJECTS) $(direct_chunk_LDADD) $(LIBS)
@@ -2063,10 +2082,12 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_image.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_logging.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache_tagging.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/chunk_info.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cork.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cross_read.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/del_many_dense_attrs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct_chunk.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsets.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dt_arith.Po@am__quote@
@@ -2569,6 +2590,13 @@ dsets.log: dsets$(EXEEXT)
--log-file $$b.log --trs-file $$b.trs \
$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
"$$tst" $(AM_TESTS_FD_REDIRECT)
+chunk_info.log: chunk_info$(EXEEXT)
+ @p='chunk_info$(EXEEXT)'; \
+ b='chunk_info'; \
+ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
+ --log-file $$b.log --trs-file $$b.trs \
+ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
+ "$$tst" $(AM_TESTS_FD_REDIRECT)
cmpd_dset.log: cmpd_dset$(EXEEXT)
@p='cmpd_dset$(EXEEXT)'; \
b='cmpd_dset'; \
@@ -3228,7 +3256,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/test/ShellTests.cmake b/test/ShellTests.cmake
index 58dc85d..98f3daf 100644
--- a/test/ShellTests.cmake
+++ b/test/ShellTests.cmake
@@ -171,6 +171,7 @@ if (UNIX)
# atomic_writer
# atomic_reader
# filenotclosed
+ # del_many_dense_attrs
# flushrefresh
##############################################################################
# autotools script tests
@@ -178,7 +179,7 @@ if (UNIX)
# NOT CONVERTED accum_swmr_reader is used by accum.c.
# NOT CONVERTED atomic_writer and atomic_reader are standalone programs.
# links_env is used by testlinks_env.sh
- # filenotclosed is used by test_filenotclosed.sh
+ # filenotclosed and del_many_dense_attrs are used by testabort_fail.sh
# NOT CONVERTED flushrefresh is used by testflushrefresh.sh.
# NOT CONVERTED use_append_chunk, use_append_mchunks and use_disable_mdc_flushes are used by test_usecases.sh
# NOT CONVERTED swmr_* files (besides swmr.c) are used by testswmr.sh.
diff --git a/test/chunk_info.c b/test/chunk_info.c
index e3006cc..866fd68 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -15,23 +15,1532 @@
* Programmer: Pedro Vicente <pvn@hdfgroup.edu>
* April 7, 2008
*
- * Purpose: Tests the H5Dget_chunk_info API function
- * This program writes a 4x4 dataset by iterating on 2x2 chunks
- * at a time
+ * Purpose: Tests chunk query API functions
+ *
+ * Modification:
+ * Many tests were added for HDFFV-10615. -BMR, October 2018
+ *
+ * Test structure:
+ * main()
+ * test_get_chunk_info_highest18()
+ * test_get_chunk_info_110()
+ * test_chunk_info_single_chunk()
+ * test_chunk_info_implicit()
+ * test_chunk_info_fixed_array()
+ * test_chunk_info_extensible_array()
+ * test_chunk_info_version2_btrees()
+ *
*/
+#define H5D_FRIEND
+#define H5D_TESTING /* to use H5D__ functions */
+#include "H5Dpkg.h"
+#include "testhdf5.h"
-#include "h5test.h"
+/* Test file names */
+const char *FILENAME[] = {
+ "tchunk_info_18",
+ "tchunk_info_110",
+ "chunk_info",
+ NULL
+};
-#define PRINT_DATA
-#define H5FILE_NAME "chunk_info.h5"
+/* From original test */
#define DATASETNAME "2d"
-#define RANK 2
+/* Parameters for testing chunk querying */
+#define RANK 2
+#define FILENAME_BUF_SIZE 1024
+#define DSET_SIMPLE_CHUNKED "Chunked Dataset"
+#define DSET_EMPTY "Empty Dataset"
+#define DSET_EMPTY_ALLOC "Empty Dataset with ALLOC_TIME_EARLY"
+#define DSET_SINGLE_CHUNK "Single Chunk Index Dataset"
+#define DSET_IMPLICIT_INDEX "Implicit Index Dataset"
+#define DSET_FIXED_ARR_INDEX "Fixed Array Index Dataset"
+#define DSET_EXT_ARR_INDEX "Extensible Array Index Dataset"
+#define DSET_V2_BTREE_INDEX "Version 2 B-Tree Index Dataset"
+#define NX 24
+#define NY 16
+#define CHUNK_NX 6
+#define CHUNK_NY 4
+#define SINGLE_CHUNK_SIZE (NX*NY*sizeof(int))
+#define CHUNK_SIZE 96
+#define NUM_CHUNKS 16
+#define NUM_CHUNKS_WRITTEN 4
+
+/* Artifact of original file, maybe removed */
+/* #define PRINT_DATA */
+
+/* Utility function to initialize arguments */
+void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size);
+
+/*-------------------------------------------------------------------------
+ * Function: read_each_chunk (helper function)
+ *
+ * Purpose: Reads the chunk specified by its offset and verifies that
+ * it contains the same data as what was written. This function
+ * is used in test_get_chunk_info.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Date: September 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+//EIP - May be this function should take a pointer to an array of chunk dimensions
+//EIP and its size, so it is not restricted to 2 dims only?
+static herr_t read_each_chunk(hid_t dset_id, hsize_t offset1, hsize_t offset2, void *direct_buf)
+{
+ int read_buf[CHUNK_NX][CHUNK_NY];
+ hsize_t offset[2] = {offset1, offset2};
+ unsigned read_flt_msk = 0;
+ herr_t ret; /* Return value */
+
+ HDmemset(&read_buf, 0, sizeof(read_buf));
+
+ /* Read the chunk specified by its offset */
+ ret = H5Dread_chunk(dset_id, H5P_DEFAULT, offset, &read_flt_msk, read_buf);
+ if(ret < 0) return(FAIL);
+
+ /* Verify that read chunk is the same as the corresponding written one */
+ if(HDmemcmp(direct_buf, read_buf, CHUNK_NX*CHUNK_NY) != 0)
+ {
+ HDfprintf(stderr, "Read chunk differs from written chunk at offset (%d,%d)\n", offset1, offset2);
+ return(FAIL);
+ }
+
+ return(SUCCEED);
+}
+
+/*-------------------------------------------------------------------------
+ * Function: reinit_vars (helper function)
+ *
+ * Purpose: Helper function to wipe out variables for the next use,
+ * used in test_get_chunk_info.
+ *
+ * Return: Won't fail
+ *
+ * Date: September 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+void reinit_vars(unsigned *read_flt_msk, haddr_t *addr, hsize_t *size)
+{
+ if(read_flt_msk)
+ *read_flt_msk = 0;
+ if(addr)
+ *addr = 0;
+ if(size)
+ *size = 0;
+}
-int main( void )
+/*-------------------------------------------------------------------------
+ * Function: test_get_chunk_info_highest18
+ *
+ * Purpose: Test getting various chunk information
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Description:
+ * This function tests the new API functions added for EED-343:
+ * H5Dget_num_chunks, H5Dget_chunk_info, and
+ * H5Dget_chunk_info_by_coord for high bound up to 1.8.
+ *
+ * Date: September 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_get_chunk_info_highest18(hid_t fapl)
{
+ char filename[FILENAME_BUF_SIZE];
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ int fillvalue = -1; /* Fill value */
+ int aggression = 9; /* Compression aggression setting */
+ H5F_libver_t low, high; /* File format bounds */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING("getting chunk information in file with version prior to 1.10");
+
+ /* Create the file */
+ h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
+
+ /* Set high bound to V18 to test chunked dataset that use B-tree v1
+ structures to index chunks */
+ high = H5F_LIBVER_V18;
+
+ /* Low bound can be anything below 1.10, which was when the new chunk storage
+ was introduced */
+ low = H5F_LIBVER_EARLIEST;
+
+ /* Set version bounds for creating the file */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ TEST_ERROR
+
+ chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl);
+ if(chunkfile < 0)
+ TEST_ERROR
+
+ /* Create the file and memory dataspaces */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Set dset creation properties with chunking, compression, and fillvalue */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0) TEST_ERROR
+
+#ifdef H5_HAVE_FILTER_DEFLATE
+ if(H5Pset_deflate(cparms, (unsigned)aggression) < 0) TEST_ERROR
+#endif /* end H5_HAVE_FILTER_DEFLATE */
+
+ /* Set fill value */
+ if(H5Pset_fill_value(cparms, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_SIMPLE_CHUNKED, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Indicate skipping the compression filter */
+ filter_mask = 0x00000001;
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ if(H5Fflush(dset, H5F_SCOPE_LOCAL) < 0)
+ goto error;
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_SIMPLE_CHUNKED, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Read the entire dataset back */
+ ret = H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf);
+ if(ret < 0) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned addr and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Close the first dataset */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Create an empty dataset and close it */
+ dset = H5Dcreate2(chunkfile, DSET_EMPTY, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Reopen the empty dataset to verify the chunk query functions on it */
+ if((dset = H5Dopen2(chunkfile, DSET_EMPTY, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Verify that the number of chunks is 0 */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Attempt to get info of a chunk from an empty dataset, verify the
+ returned address and size */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Attempt to get info of a chunk given its coords from an empty dataset,
+ verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ ret = H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /************************************************************************
+ * Test empty dataset with H5P_ALLOC_TIME_EARLY *
+ ************************************************************************/
+
+ /* Set space allocation to early so that chunk query functions will
+ retrieve chunk information even though the dataset is empty */
+ if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
+
+ /* Create an empty dataset and close it */
+ dset = H5Dcreate2(chunkfile, DSET_EMPTY_ALLOC, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Reopen the empty dataset to verify the chunk query functions on it */
+ if((dset = H5Dopen2(chunkfile, DSET_EMPTY_ALLOC, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Verify that the number of chunks is NUM_CHUNKS */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Attempt to get info of a chunk from an empty dataset, verify the
+ returned address and size */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ index = 10;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ ret = H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size);
+ if(ret < 0) TEST_ERROR
+
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ /* Attempt to get info of a chunk given its coords from an empty dataset,
+ verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF and size not 0 */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size == 0) TEST_ERROR
+
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* Close/release resources. */
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Pclose(cparms) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_get_chunk_info_highest18() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_single_chunk
+ *
+ * Purpose: Test getting various chunk information when Single Chunk
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_single_chunk(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {NX, NY}; /* Chunk dimensions */
+ int in_buf[NX][NY]; /* Input buffer */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int i, j;
+
+ TESTING(" Single Chunk index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_SINGLE_CHUNK, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_SINGLE)
+ FAIL_PUTS_ERROR("should be using Single Chunk index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions on a single empty
+ chunk */
+ if((dset = H5Dopen2(chunkfile, DSET_SINGLE_CHUNK, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for the single chunk */
+ for(i = 0; i < NX; i++)
+ for(j = 0; j < NY; j++)
+ in_buf[i][j] = (i*j);
+
+ /* Write the chunk */
+ if(H5Dwrite(dset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, in_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify that one chunk had been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 1) TEST_ERROR
+
+ /* Get and verify info of the first and only chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != SINGLE_CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,0) */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if (read_flt_msk != filter_mask) TEST_ERROR
+ if (size != SINGLE_CHUNK_SIZE) TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_single_chunk() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_implicit
+ *
+ * Purpose: Test getting various chunk information when Implicit
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_implicit(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Implicit index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ if(H5Pset_alloc_time(cparms, H5D_ALLOC_TIME_EARLY) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_IMPLICIT_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_NONE) /* Implicit: No Index */
+ FAIL_PUTS_ERROR("should be using Implicit index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_IMPLICIT_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+
+ /* All chunks because of H5D_ALLOC_TIME_EARLY */
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+
+ /* Should still be all chunks, because of H5D_ALLOC_TIME_EARLY */
+ if(nchunks != NUM_CHUNKS) TEST_ERROR
+
+ /* Read the entire dataset back */
+ if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 0) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 4) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 4) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ /* Because of H5P_ALLOC_TIME_EARLY, addr cannot be HADDR_UNDEF */
+ if(addr == HADDR_UNDEF) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_implicit() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_fixed_array
+ *
+ * Purpose: Test getting various chunk information when Fixed Array
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_fixed_array(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Fixed Array index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, NULL)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_FIXED_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_FARRAY)
+ FAIL_PUTS_ERROR("should be using Fixed Array index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_FIXED_ARR_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Read the entire dataset back */
+ if(H5Dread(dset, H5T_NATIVE_INT, dspace, dspace, H5P_DEFAULT, out_buf) < 0)
+ TEST_ERROR
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_fixed_array() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_extensible_array
+ *
+ * Purpose: Test getting various chunk information when Extensible Array
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_extensible_array(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, NY}; /* One unlimited dimension */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Extensible Array index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_EXT_ARR_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_EARRAY)
+ FAIL_PUTS_ERROR("should be using Extensible Array index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_EXT_ARR_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_extensible_array() */
+
+/*-------------------------------------------------------------------------
+ * Function: test_chunk_info_version2_btrees
+ *
+ * Purpose: Test getting various chunk information when Version 2 B-trees
+ * index type is used
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Date: November 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_chunk_info_version2_btrees(char *filename, hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ hid_t dspace = -1; /* Dataspace ID */
+ hid_t dset = -1; /* Dataset ID */
+ hid_t cparms = -1; /* Creation plist */
+ hsize_t dims[2] = {NX, NY};/* Dataset dimensions */
+ hsize_t chunk_dims[2] = {CHUNK_NX, CHUNK_NY}; /* Chunk dimensions */
+ hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED}; /* Two unlimited dims */
+ int direct_buf[NUM_CHUNKS][CHUNK_NX][CHUNK_NY];/* Data in chunks */
+ int out_buf[NX][NY]; /* Buffer to read data in */
+ size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int); /* Buffer size of a chk */
+ unsigned filter_mask = 0; /* Filter mask */
+ unsigned read_flt_msk = 0; /* Filter mask after direct read */
+ H5D_chunk_index_t idx_type; /* Dataset chunk index type */
+ hsize_t offset[2]; /* Offset coordinates of a chunk */
+ hsize_t out_offset[2] = {0, 0}; /* Buffer to get offset coordinates */
+ hsize_t size = 0; /* Size of an allocated/written chunk */
+ hsize_t nchunks = 0; /* Number of chunks */
+ haddr_t addr = 0; /* Address of an allocated/written chunk */
+ hsize_t index = 0; /* Index of a chunk */
+ int n; /* Used on buffer, to avoid conversion warning */
+ hsize_t i, j;
+ herr_t ret;
+
+ TESTING(" Version 2 B-trees index");
+
+ /* Open the file for reading/writing */
+ if((chunkfile = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((dspace = H5Screate_simple(RANK, dims, maxdims)) < 0)
+ TEST_ERROR
+
+ /* Enable chunking */
+ if((cparms = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ TEST_ERROR
+
+ if(H5Pset_chunk(cparms, RANK, chunk_dims) < 0)
+ TEST_ERROR
+
+ /* Create a new dataset using cparms creation properties */
+ dset = H5Dcreate2(chunkfile, DSET_V2_BTREE_INDEX, H5T_NATIVE_INT, dspace, H5P_DEFAULT, cparms, H5P_DEFAULT);
+ if(dset < 0) TEST_ERROR
+
+ /* Ensure we're using the correct chunk indexing scheme */
+ if(H5D__layout_idx_type_test(dset, &idx_type) < 0)
+ TEST_ERROR
+ if(idx_type != H5D_CHUNK_IDX_BT2)
+ FAIL_PUTS_ERROR("should be using Version 2 B-tree index type");
+
+ /* Close the dataset then... */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+
+ /* ...open it again to test the chunk query functions */
+ if((dset = H5Dopen2(chunkfile, DSET_V2_BTREE_INDEX, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Get the number of chunks and verify that no chunk has been written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != 0) TEST_ERROR
+
+ /* Initialize the array of chunk data for all NUM_CHUNKS chunks */
+ for(n = 0; n < NUM_CHUNKS; n++)
+ for(i = 0; i < CHUNK_NX; i++)
+ for(j = 0; j < CHUNK_NY; j++)
+ direct_buf[n][i][j] = n + 1;
+
+ /* Write only NUM_CHUNKS_WRITTEN chunks at the following logical coords:
+ (0,2) (0,3) (1,2) (1,3) */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ {
+ offset[0] = i * CHUNK_NX;
+ offset[1] = j * CHUNK_NY;
+ ret = H5Dwrite_chunk(dset, H5P_DEFAULT, filter_mask, offset, buf_size, (void*)direct_buf[n]);
+ if(ret < 0) TEST_ERROR
+ }
+
+ /* Get and verify the number of chunks written */
+ if(H5Dget_num_chunks(dset, dspace, &nchunks) < 0) TEST_ERROR
+ if(nchunks != NUM_CHUNKS_WRITTEN) TEST_ERROR
+
+ /* Get and verify info of the first chunk */
+ index = 0;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the second chunk */
+ index = 1;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 0 || out_offset[1] != 12) TEST_ERROR
+
+ /* Get and verify info of the third chunk */
+ index = 2;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 8) TEST_ERROR
+
+ /* Get and verify info of the last chunk */
+ index = 3;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+ if(out_offset[0] != 6 || out_offset[1] != 12) TEST_ERROR
+
+ /* Attempt to get info of empty chunk and verify the returned address and size */
+ index = 5;
+ reinit_vars(&read_flt_msk, &addr, &size);
+ out_offset[0] = out_offset[1] = 0;
+ if(H5Dget_chunk_info(dset, dspace, index, out_offset, &read_flt_msk, &addr, &size) < 0)
+ TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (0,2) */
+ offset[0] = 0;
+ offset[1] = 2 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Get info of the chunk at logical coordinates (1,3) */
+ offset[0] = 1 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(read_flt_msk != filter_mask) TEST_ERROR
+ if(size != CHUNK_SIZE) TEST_ERROR
+
+ /* Attempt to get info of empty chunks, verify the returned address and size */
+ offset[0] = 0;
+ offset[1] = 0;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ offset[0] = 3 * CHUNK_NX;
+ offset[1] = 3 * CHUNK_NY;
+ if(H5Dget_chunk_info_by_coord(dset, offset, &read_flt_msk, &addr, &size) < 0) TEST_ERROR
+ if(addr != HADDR_UNDEF) TEST_ERROR
+ if(size != 0) TEST_ERROR
+
+ /* Read each chunk and verify the values */
+ n = 0;
+ for (i = 0; i < 2; i++)
+ for (j = 2; j < 4; j++, n++)
+ if(read_each_chunk(dset, i*CHUNK_NX, j*CHUNK_NY, (void*)direct_buf[n]) < 0)
+ TEST_ERROR
+
+ /* Release resourse */
+ if(H5Dclose(dset) < 0) TEST_ERROR
+ if(H5Sclose(dspace) < 0) TEST_ERROR
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Dclose(dset);
+ H5Sclose(dspace);
+ H5Pclose(cparms);
+ H5Fclose(chunkfile);
+ } H5E_END_TRY;
+
+ H5_FAILED();
+ return FAIL;
+} /* test_chunk_info_version2_btrees() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_get_chunk_info_110
+ *
+ * Purpose: Test getting various chunk information in version 1.10.
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Note: Note that the dataspace argument in these new functions are
+ * currently not used. The functionality involved the dataspace
+ * will be implemented in the next version.
+ *
+ * Description:
+ * This function tests the new API functions added for EED-343:
+ * H5Dget_num_chunks, H5Dget_chunk_info, and H5Dget_chunk_info_by_coord
+ * for high bound beyond 1.8.
+ *
+ * Date: October 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+test_get_chunk_info_110(hid_t fapl)
+{
+ hid_t chunkfile = -1; /* File ID */
+ char filename[FILENAME_BUF_SIZE];
+ H5F_libver_t low, high; /* File format bounds */
+
+ TESTING("getting chunk information in file with versions 1.10");
+ HDprintf("\n"); /* to list sub-tests */
+
+ /* Create the file */
+ h5_fixname(FILENAME[1], fapl, filename, sizeof filename);
+ chunkfile = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ if(chunkfile < 0) TEST_ERROR
+
+ /* Close the file, individual tests will re-open the file with different
+ libvers via the fapl */
+ if(H5Fclose(chunkfile) < 0) TEST_ERROR
+
+ /* Set high bound to the current latest version */
+ high = H5F_LIBVER_LATEST;
+
+ /* Test getting info of chunked datasets in version combo up to 1.10 */
+ for (low = H5F_LIBVER_V110; low <= H5F_LIBVER_LATEST; low++) {
+ /* Set version bounds for creating file */
+ if(H5Pset_libver_bounds(fapl, low, high) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Single Chunk index type is used */
+ if(test_chunk_info_single_chunk(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Implicit index type is used */
+ if(test_chunk_info_implicit(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Fixed Array index type is used */
+ if(test_chunk_info_fixed_array(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Extensible Array index type is used */
+ if(test_chunk_info_extensible_array(filename, fapl) < 0)
+ TEST_ERROR
+
+ /* Test getting chunk info when Version 2 B-trees index type is used */
+ if(test_chunk_info_version2_btrees(filename, fapl) < 0)
+ TEST_ERROR
+ } /* for low libver bound */
+
+ return SUCCEED;
+
+error:
+ H5_FAILED();
+ return FAIL;
+} /* test_get_chunk_info_110() */
+
+/*-------------------------------------------------------------------------
+ * Function: create_4x4_dset
+ *
+ * Purpose: Tests functions related to chunk information
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Description:
+ * The code in this create_4x4_dset function was originally written by
+ * Pedro in main() that writes a 4x4 dataset by iterating on
+ * 2x2 chunks at a time, with the intention of making a frame
+ * work to test H5Dget_chunk_info, which was not in the library,
+ * until now. For the work in HDFFV-10615, the test function
+ * test_get_chunk_info was added to test the new query chunk
+ * API functions: H5Dget_num_chunk, H5Dget_chunk_info, and
+ * H5Dget_chunk_info_by_coord. This code can be used at a
+ * later time, so it is kept here.
+ * -BMR, November 5, 2018
+ *
+ * Programmer: Pedro Vicente <pvn@hdfgroup.edu>
+ * April 7, 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+create_4x4_dset(hid_t fapl)
+{
hid_t fid; /* file ID */
hid_t did; /* dataset ID */
hid_t f_sid; /* file space ID */
@@ -43,19 +1552,21 @@ int main( void )
int chunk_data[2][2] = { {1, 1}, {1, 1} };
int buf[4][4];
int fillvalue = 0;
- int i, j, ii, jj;
+ char filename[FILENAME_BUF_SIZE];
+ hsize_t i, j;
/* create a new file using default properties. */
- if ((fid = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR;
+ h5_fixname(FILENAME[2], fapl, filename, sizeof filename);
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+
/* create the file space */
- if ((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR;
+ if((f_sid = H5Screate_simple(RANK, dims, dims)) < 0) TEST_ERROR
+
/* create the memory space with chunk dimensions */
- if ((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR;
+ if((m_sid = H5Screate_simple(RANK, chunk_dims, chunk_dims)) < 0) TEST_ERROR
start[0] = 0;
start[1] = 0;
- if (H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
-
- TESTING("chunk info");
+ if(H5Sselect_hyperslab(m_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR
/*-------------------------------------------------------------------------
* create a dataset
@@ -63,13 +1574,13 @@ int main( void )
*/
/* modify dataset creation properties, i.e. enable chunking. */
- if ((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR;
- if (H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR;
- if (H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR;
+ if((pid = H5Pcreate (H5P_DATASET_CREATE)) < 0) TEST_ERROR
+ if(H5Pset_chunk(pid, RANK, chunk_dims) < 0) TEST_ERROR
+ if(H5Pset_fill_value(pid, H5T_NATIVE_INT, &fillvalue) < 0) TEST_ERROR
/* create a new dataset */
- if((did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT)) < 0) TEST_ERROR;
-
+ did = H5Dcreate2(fid , DATASETNAME, H5T_NATIVE_INT, f_sid, H5P_DEFAULT, pid, H5P_DEFAULT);
+ if(did < 0) TEST_ERROR
/*-------------------------------------------------------------------------
* write the dataset in 2x2 chunks
@@ -77,25 +1588,20 @@ int main( void )
*/
/* iterate in dim 0 */
- for (j = 0; j < chunk_dims[0]; j++)
- {
-
+ for (j = 0; j < chunk_dims[0]; j++) {
/* reset start in dim 1 */
start[1] = 0;
/* iterate in dim 1 */
- for (i = 0; i < chunk_dims[1]; i++)
- {
-
+ for (i = 0; i < chunk_dims[1]; i++) {
/* select file hyperslab to save a 2x2 chunk */
- if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR;
+ if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, chunk_dims, NULL) < 0) TEST_ERROR
/* write the data to the hyperslab. */
- if (H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR;
+ if(H5Dwrite(did, H5T_NATIVE_INT, m_sid, f_sid, H5P_DEFAULT, chunk_data) < 0) TEST_ERROR
/* read back and display complete dataset 4x4 */
- if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR;
-
+ if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf) < 0) TEST_ERROR
#if defined (PRINT_DATA)
printf("\n");
@@ -105,46 +1611,91 @@ int main( void )
printf("\n");
}
#endif
-
-
/* increment start in dim 1 */
start[1] += 2;
-
-
}
-
/* increment start in dim 0 */
start[0] += 2;
}
-
-
/*-------------------------------------------------------------------------
* close
*-------------------------------------------------------------------------
*/
+ if(H5Dclose(did) < 0) TEST_ERROR
+ if(H5Sclose(f_sid) < 0) TEST_ERROR
+ if(H5Sclose(m_sid) < 0) TEST_ERROR
+ if(H5Pclose(pid) < 0) TEST_ERROR
+ if(H5Fclose(fid) < 0) TEST_ERROR
- if (H5Dclose(did) < 0) TEST_ERROR
- if (H5Sclose(f_sid) < 0) TEST_ERROR
- if (H5Sclose(m_sid) < 0) TEST_ERROR
- if (H5Pclose(pid) < 0) TEST_ERROR
- if (H5Fclose(fid) < 0) TEST_ERROR
+ return SUCCEED;
- PASSED();
+error:
+ H5Dclose(did);
+ H5Sclose(f_sid);
+ H5Sclose(m_sid);
+ H5Pclose(pid);
+ H5Fclose(fid);
+
+ return FAIL;
+} /* end create_4x4_dset */
- puts("All chunk info tests passed.");
- return 0;
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Tests functions related to chunk information
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Binh-Minh Ribler
+ * November 5, 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fapl = -1; /* File access property list */
+ int nerrors = 0; /* Number of errors so far */
+ h5_reset();
+
+ /* Create a copy of file access property list */
+ if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) TEST_ERROR
+
+ /* Tests getting chunk information of version 1.8 and prior */
+ nerrors += test_get_chunk_info_highest18(fapl) < 0 ? 1 : 0;
+
+ /* Tests getting chunk information of version 1.10 */
+ nerrors += test_get_chunk_info_110(fapl) < 0 ? 1 : 0;
+
+ /* Create a 4x4 dataset (using the existing code to avoid compilation
+ warnings for now) */
+ nerrors += create_4x4_dset(fapl) < 0 ? 1 : 0;
+
+ if(nerrors)
+ goto error;
+
+ HDprintf("All chunk query tests passed.\n");
+
+ h5_cleanup(FILENAME, fapl);
+
+ return SUCCEED;
error:
- H5Dclose( did );
- H5Sclose( f_sid );
- H5Sclose( m_sid );
- H5Pclose( pid );
- H5Fclose( fid );
- H5_FAILED();
- return 1;
+ nerrors = MAX(1, nerrors);
+ HDprintf("***** %d QUERY CHUNK INFO TEST%s FAILED! *****\n",
+ nerrors, 1 == nerrors ? "" : "S");
+ return FAIL;
}
+/****************************************************************************
+ Additional tests to be added:
+- create/write to a dataset, do the query before closing the dataset
+- do the query when extending the dataset (shrink or expand)
+- verify that invalid input parameters are handled properly
+- do the query on a non-chunked dataset...
+- test for filter or non-filter
-
+****************************************************************************/
diff --git a/test/cork.c b/test/cork.c
index dceaf5a..240be77 100644
--- a/test/cork.c
+++ b/test/cork.c
@@ -286,19 +286,19 @@ static unsigned
verify_obj_dset_cork(hbool_t swmr)
{
/* Variable Declarations */
- hid_t fid = -1; /* File ID */
+ hid_t fid = -1; /* File ID */
hid_t fapl = -1; /* File access property list */
hid_t aid = -1; /* Attribute ID */
hid_t sid = -1, sid2 = -1; /* Dataspace IDs */
hid_t did = -1, did2 = -1; /* Dataset IDs */
hid_t oid = -1; /* Object ID */
- hid_t dcpl2; /* Dataset creation property list */
+ hid_t dcpl2; /* Dataset creation property list */
int i = 0; /* Local index variable */
- hsize_t dim[1] = {100}; /* Dataset dimension size */
+ hsize_t dim[1] = {100}; /* Dataset dimension size */
hsize_t chunk_dim[1] = {7}; /* Dataset chunk dimension size */
H5O_info_t oinfo, oinfo2; /* Object metadata information */
char attrname[500]; /* Name of attribute */
- unsigned flags; /* File access flags */
+ unsigned flags; /* File access flags */
if(swmr) {
TESTING("cork status for dataset objects with attributes (SWMR)");
@@ -341,7 +341,7 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Attach and write to an attribute to the dataset: DSET */
- if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ if((aid = H5Acreate2(did, ATTR, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
/* Verify cork status of the dataset: DSET */
@@ -380,11 +380,11 @@ verify_obj_dset_cork(hbool_t swmr)
TEST_ERROR
/* Attach 8 attributes to the dataset */
- for(i = 0;i < 8; i++) {
- sprintf(attrname, "attr %d", i);
- if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_UINT, sid2, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ for(i = 0; i < 8; i++) {
+ HDsprintf(attrname, "attr %d", i);
+ if((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
TEST_ERROR
- if(H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0)
+ if(H5Awrite(aid, H5T_NATIVE_INT, &i) < 0)
TEST_ERROR
if(H5Aclose(aid) < 0)
TEST_ERROR
diff --git a/test/corrupted_name_len.h5 b/test/corrupted_name_len.h5
new file mode 100644
index 0000000..b5980b7
--- /dev/null
+++ b/test/corrupted_name_len.h5
Binary files differ
diff --git a/test/del_many_dense_attrs.c b/test/del_many_dense_attrs.c
new file mode 100644
index 0000000..d88045c
--- /dev/null
+++ b/test/del_many_dense_attrs.c
@@ -0,0 +1,203 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * 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. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: Test to verify that the infinite loop closing library/abort failure
+ * is fixed when the application creates and removes dense attributes
+ * (See HDFFV-10659).
+ */
+
+
+#include "h5test.h"
+
+/* The test file name */
+const char *FILENAME[] = {
+ "del_many_dense_attrs",
+ NULL
+};
+
+#define ATTR_COUNT 64 /* The number of attributes */
+
+/*-------------------------------------------------------------------------
+ * Function: catch_signal
+ *
+ * Purpose: The signal handler to catch the SIGABRT signal.
+ *
+ * Return: No return
+ *
+ * Programmer: Vailin Choi
+ *
+ *-------------------------------------------------------------------------
+ */
+static void catch_signal(int H5_ATTR_UNUSED signo)
+{
+ HDexit(1);
+} /* catch_signal() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: main
+ *
+ * Purpose: Test to verify that the infinite loop closing library/abort failure
+ * is fixed when the application creates and removes dense attributes
+ * (See HDFFV-10659).
+ *
+ * Return: Success: exit(EXIT_SUCCESS)
+ * Failure: exit(EXIT_FAILURE)
+ *
+ * Programmer: Vailin Choi; Dec 2018
+ *
+ *-------------------------------------------------------------------------
+ */
+int
+main(void)
+{
+ hid_t fid = -1; /* HDF5 File ID */
+ hid_t gid = -1; /* Group ID */
+ hid_t sid = -1; /* Dataspace ID */
+ hid_t aid = -1; /* Attribute ID */
+ hid_t tid = -1; /* Datatype ID */
+ hid_t fapl = -1; /* File access property lists */
+ hid_t gcpl = -1; /* Group creation property list */
+ char aname[50]; /* Name of attribute */
+ char *basename="attr"; /* Name prefix for attribute */
+ char filename[100]; /* File name */
+ int i; /* Local index variable */
+
+ /* Testing setup */
+ h5_reset();
+
+ /* To exit from the file for SIGABRT signal */
+ if(HDsignal(SIGABRT, catch_signal) == SIG_ERR)
+ TEST_ERROR
+
+ fapl = h5_fileaccess();
+ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename));
+
+ /* Set to latest format */
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ TEST_ERROR
+
+ /* Create the file */
+ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
+ TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ /* Re-open the file */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Create the group creation property list */
+ if((gcpl = H5Pcreate(H5P_GROUP_CREATE)) < 0)
+ TEST_ERROR
+
+ /* Set to use dense storage for all attributes on the group */
+ if(H5Pset_attr_phase_change(gcpl, 0, 0) < 0)
+ TEST_ERROR
+
+ /* Create the group in the file */
+ if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, gcpl, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Create dataspace */
+ if((sid = H5Screate(H5S_SCALAR)) < 0)
+ TEST_ERROR
+
+ /* Get a copy of the datatype */
+ if((tid = H5Tcopy(H5T_NATIVE_FLOAT)) < 0)
+ TEST_ERROR
+
+ /* Create attributes in the group */
+ for(i = ATTR_COUNT; i >= 0; i--) {
+ /* Set up the attribute name */
+ HDsprintf(aname, "%s%d", basename, i);
+
+ /* Create the attribute */
+ if((aid = H5Acreate2(gid, aname, tid, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Write to the attribute */
+ if(H5Awrite(aid, tid, &i) < 0)
+ TEST_ERROR
+
+ /* Close the attribute */
+ if(H5Aclose(aid) < 0)
+ TEST_ERROR
+ }
+
+ /* Close the datatype */
+ if(H5Tclose(tid) < 0)
+ TEST_ERROR
+
+ /* Close the dataspace */
+ if(H5Sclose(sid) < 0)
+ TEST_ERROR
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ TEST_ERROR
+
+ /* Close the group creation property list */
+ if(H5Pclose(gcpl) < 0)
+ TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ /* Re-open the file */
+ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0)
+ TEST_ERROR
+
+ /* Open the group */
+ if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0)
+ TEST_ERROR
+
+ /* Delete the attributes */
+ for (i = 0; i <= ATTR_COUNT; i++) {
+ /* Set up the attribute name */
+ HDsprintf(aname, "%s%d", basename, i);
+
+ /* Delete the attribute */
+ if(H5Adelete(gid, aname) < 0)
+ TEST_ERROR
+ } /* end for */
+
+ /* Close the group */
+ if(H5Gclose(gid) < 0)
+ TEST_ERROR
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0)
+ TEST_ERROR
+
+ h5_cleanup(FILENAME, fapl);
+
+ return(EXIT_SUCCESS);
+
+error:
+ H5E_BEGIN_TRY {
+ H5Gclose(gid);
+ H5Sclose(sid);
+ H5Tclose(tid);
+ H5Aclose(aid);
+ H5Fclose(fid);
+ H5Pclose(gcpl);
+ H5Pclose(fapl);
+ } H5E_END_TRY
+
+ return EXIT_FAILURE;
+}
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 2ef38ea..1c5862d 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -13,7 +13,7 @@
#include "h5test.h"
-#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
+#if defined(H5_HAVE_ZLIB_H) && !defined(H5_ZLIB_HEADER)
# define H5_ZLIB_HEADER "zlib.h"
#endif
#if defined(H5_ZLIB_HEADER)
@@ -46,10 +46,10 @@
#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s))*H5_DOUBLE(1.001))+H5_DOUBLE(12.0))
/* Temporary filter IDs used for testing */
-#define H5Z_FILTER_BOGUS1 305
-#define H5Z_FILTER_BOGUS2 306
-#define ADD_ON 7
-#define FACTOR 3
+#define H5Z_FILTER_BOGUS1 305
+#define H5Z_FILTER_BOGUS2 306
+#define ADD_ON 7
+#define FACTOR 3
/* Constants for the overwrite test */
#define OVERWRITE_NDIMS 3
@@ -75,33 +75,33 @@ static size_t filter_bogus2(unsigned int flags, size_t cd_nelmts,
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS1[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS1, /* Filter id number */
+ H5Z_FILTER_BOGUS1, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "bogus1", /* Filter name for debugging */
+ "bogus1", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus1, /* The actual filter function */
+ filter_bogus1, /* The actual filter function */
}};
const H5Z_class2_t H5Z_BOGUS2[1] = {{
H5Z_CLASS_T_VERS, /* H5Z_class_t version */
- H5Z_FILTER_BOGUS2, /* Filter id number */
+ H5Z_FILTER_BOGUS2, /* Filter id number */
1, 1, /* Encoding and decoding enabled */
- "bogus2", /* Filter name for debugging */
+ "bogus2", /* Filter name for debugging */
NULL, /* The "can apply" callback */
NULL, /* The "set local" callback */
- filter_bogus2, /* The actual filter function */
+ filter_bogus2, /* The actual filter function */
}};
/*-------------------------------------------------------------------------
- * Function: test_direct_chunk_write
+ * Function: test_direct_chunk_write
*
- * Purpose: Test the basic functionality of H5Dwrite_chunk
+ * Purpose: Test the basic functionality of H5Dwrite_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -113,7 +113,7 @@ test_direct_chunk_write (hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
@@ -128,11 +128,11 @@ test_direct_chunk_write (hid_t file)
size_t buf_size = CHUNK_NX*CHUNK_NY*sizeof(int);
const Bytef *z_src = (const Bytef*)(direct_buf);
- Bytef *z_dst = NULL; /*destination buffer */
- uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
- uLong z_src_nbytes = (uLong)buf_size;
+ Bytef *z_dst = NULL; /*destination buffer */
+ uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(buf_size);
+ uLong z_src_nbytes = (uLong)buf_size;
int aggression = 9; /* Compression aggression setting */
- void *outbuf = NULL; /* Pointer to new buffer */
+ void *outbuf = NULL; /* Pointer to new buffer */
hsize_t start[2]; /* Start of hyperslab */
hsize_t stride[2]; /* Stride of hyperslab */
@@ -167,29 +167,29 @@ test_direct_chunk_write (hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME1, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
/* Initialize the dataset */
for(i = n = 0; i < NX; i++)
for(j = 0; j < NY; j++)
- data[i][j] = n++;
+ data[i][j] = n++;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
goto error;
/*
* Write the data for the dataset. It should stay in the chunk cache.
- * It will be evicted from the cache by the H5Dwrite_chunk calls.
+ * It will be evicted from the cache by the H5Dwrite_chunk calls.
*/
if((status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
- dxpl, data)) < 0)
+ dxpl, data)) < 0)
goto error;
/* Initialize data for one chunk */
for(i = n = 0; i < CHUNK_NX; i++)
for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = n++;
+ direct_buf[i][j] = n++;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
@@ -210,8 +210,8 @@ test_direct_chunk_write (hid_t file)
goto error;
}
- /* Write the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Write the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
for(i=0; i<NX/CHUNK_NX; i++) {
for(j=0; j<NY/CHUNK_NY; j++) {
status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, z_dst_nbytes, outbuf);
@@ -224,7 +224,7 @@ test_direct_chunk_write (hid_t file)
if(outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -253,7 +253,7 @@ test_direct_chunk_write (hid_t file)
if(direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
+ HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
goto error;
}
}
@@ -262,7 +262,7 @@ test_direct_chunk_write (hid_t file)
/* Reinitialize different data for one chunk */
for(i = 0; i < CHUNK_NX; i++)
for(j = 0; j < CHUNK_NY; j++)
- direct_buf[i][j] = i + j;
+ direct_buf[i][j] = i + j;
/* Allocate output (compressed) buffer */
outbuf = HDmalloc(z_dst_nbytes);
@@ -283,8 +283,8 @@ test_direct_chunk_write (hid_t file)
goto error;
}
- /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
- * dataset, using the direct writing function. */
+ /* Rewrite the compressed chunk data repeatedly to cover all the chunks in the
+ * dataset, using the direct writing function. */
offset[0] = offset[1] = 0;
for(i=0; i<NX/CHUNK_NX; i++) {
for(j=0; j<NY/CHUNK_NY; j++) {
@@ -298,7 +298,7 @@ test_direct_chunk_write (hid_t file)
if(outbuf)
HDfree(outbuf);
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -317,7 +317,7 @@ test_direct_chunk_write (hid_t file)
if(direct_buf[i][j] != check_chunk[i][j]) {
HDprintf(" 2. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
- HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
+ HDprintf(" direct_buf=%d, check_chunk=%d\n", direct_buf[i][j], check_chunk[i][j]);
goto error;
}
}
@@ -331,7 +331,7 @@ test_direct_chunk_write (hid_t file)
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
-
+
PASSED();
return 0;
@@ -459,15 +459,15 @@ error:
} /* end test_direct_chunk_overwrite_data() */
/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write1
+ * Function: test_skip_compress_write1
*
- * Purpose: Test skipping compression filter when it is the only filter
+ * Purpose: Test skipping compression filter when it is the only filter
* for the dataset
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -528,7 +528,7 @@ test_skip_compress_write1(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME2, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -636,13 +636,13 @@ error:
} /* test_skip_compress_write1() */
/*-------------------------------------------------------------------------
- * Function: filter_bogus1
+ * Function: filter_bogus1
*
- * Purpose: A bogus filter that adds ADD_ON to the original value
+ * Purpose: A bogus filter that adds ADD_ON to the original value
*
- * Return: Success: Data chunk size
+ * Return: Success: Data chunk size
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -674,13 +674,13 @@ filter_bogus1(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
} /* filter_bogus1() */
/*-------------------------------------------------------------------------
- * Function: filter_bogus2
+ * Function: filter_bogus2
*
- * Purpose: A bogus filter that multiplies the original value by FACTOR.
+ * Purpose: A bogus filter that multiplies the original value by FACTOR.
*
- * Return: Success: Data chunk size
+ * Return: Success: Data chunk size
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*-------------------------------------------------------------------------
*/
@@ -711,15 +711,15 @@ filter_bogus2(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
} /* filter_bogus2() */
/*-------------------------------------------------------------------------
- * Function: test_skip_compress_write2
+ * Function: test_skip_compress_write2
*
- * Purpose: Test skipping compression filter when there are three filters
+ * Purpose: Test skipping compression filter when there are three filters
* for the dataset
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -797,7 +797,7 @@ test_skip_compress_write2(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME3, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -907,14 +907,14 @@ error:
} /* test_skip_compress_write2() */
/*-------------------------------------------------------------------------
- * Function: test_data_conv
+ * Function: test_data_conv
*
- * Purpose: Test data conversion
+ * Purpose: Test data conversion
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -932,13 +932,13 @@ test_data_conv(hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t maxdims[2] = {H5S_UNLIMITED, H5S_UNLIMITED};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
int i, j, n;
- const hsize_t four = 4;
- hid_t st=-1, dt=-1;
+ const hsize_t four = 4;
+ hid_t st=-1, dt=-1;
hid_t array_dt;
unsigned filter_mask = 0;
@@ -1002,7 +1002,7 @@ test_data_conv(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME4, st, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -1022,7 +1022,7 @@ test_data_conv(hid_t file)
}
}
- /* write the chunk data to dataset, using the direct writing function.
+ /* write the chunk data to dataset, using the direct writing function.
* There should be no data conversion involved. */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
@@ -1030,7 +1030,7 @@ test_data_conv(hid_t file)
if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) < 0)
goto error;
- if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
+ if(H5Fflush(dataset, H5F_SCOPE_LOCAL) < 0)
goto error;
if(H5Dclose(dataset) < 0)
@@ -1057,10 +1057,10 @@ test_data_conv(hid_t file)
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
(direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
HDprintf(" dst={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
+ (read_chunk[i][j]).a, (read_chunk[i][j]).b, (read_chunk[i][j]).c[0], (read_chunk[i][j]).c[1],
(read_chunk[i][j]).c[2], (read_chunk[i][j]).c[3], (read_chunk[i][j]).d, (read_chunk[i][j]).e);
goto error;
@@ -1094,10 +1094,10 @@ test_data_conv(hid_t file)
HDprintf(" 1. Read different values than written.");
HDprintf(" At index %d,%d\n", i, j);
HDprintf(" src={a=%d, b=%d, c=[%d,%d,%d,%d], d=%d, e=%d\n",
- (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
+ (direct_buf[i][j]).a, (direct_buf[i][j]).b, (direct_buf[i][j]).c[0], (direct_buf[i][j]).c[1],
(direct_buf[i][j]).c[2], (direct_buf[i][j]).c[3], (direct_buf[i][j]).d, (direct_buf[i][j]).e);
HDprintf(" dst={a=%d, c=[%d,%d,%d,%d], e=%d\n",
- (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
+ (check_chunk[i][j]).a, (check_chunk[i][j]).c[0], (check_chunk[i][j]).c[1], (check_chunk[i][j]).c[2],
(check_chunk[i][j]).c[3], (check_chunk[i][j]).e);
goto error;
@@ -1135,14 +1135,14 @@ error:
} /* test_data_conv() */
/*-------------------------------------------------------------------------
- * Function: test_invalid_parameters
+ * Function: test_invalid_parameters
*
* Purpose: Test invalid parameters for H5Dwrite_chunk and H5Dread_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -1153,7 +1153,7 @@ test_invalid_parameters(hid_t file)
hid_t dataspace = -1, dataset = -1;
hid_t mem_space = -1;
hid_t cparms = -1, dxpl = -1;
- hsize_t dims[2] = {NX, NY};
+ hsize_t dims[2] = {NX, NY};
hsize_t chunk_dims[2] ={CHUNK_NX, CHUNK_NY};
herr_t status;
int i, j, n;
@@ -1187,7 +1187,7 @@ test_invalid_parameters(hid_t file)
* Create a new contiguous dataset to verify H5Dwrite_chunk/H5Dread_chunk doesn't work
*/
if((dataset = H5Dcreate2(file, DATASETNAME5, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
if((dxpl = H5Pcreate(H5P_DATASET_XFER)) < 0)
@@ -1236,10 +1236,10 @@ test_invalid_parameters(hid_t file)
* creation properties.
*/
if((dataset = H5Dcreate2(file, DATASETNAME6, H5T_NATIVE_INT, dataspace, H5P_DEFAULT,
- cparms, H5P_DEFAULT)) < 0)
+ cparms, H5P_DEFAULT)) < 0)
goto error;
- /* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */
+ /* Check invalid dataset ID for H5Dwrite_chunk and H5Dread_chunk */
H5E_BEGIN_TRY {
if((status = H5Dwrite_chunk((hid_t)-1, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
@@ -1301,7 +1301,7 @@ test_invalid_parameters(hid_t file)
/* Check invalid buffer size for H5Dwrite_chunk only */
offset[0] = CHUNK_NX;
offset[1] = CHUNK_NY;
- buf_size = 0;
+ buf_size = 0;
H5E_BEGIN_TRY {
if((status = H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, buf_size, direct_buf)) != FAIL)
goto error;
@@ -1329,7 +1329,7 @@ test_invalid_parameters(hid_t file)
H5Sclose(dataspace);
H5Pclose(cparms);
H5Pclose(dxpl);
-
+
PASSED();
return 0;
@@ -1635,7 +1635,7 @@ test_direct_chunk_read_cache (hid_t file, hbool_t flush)
goto error;
if(read_buf_size == 0)
goto error;
-
+
/* Read the compressed chunk back using the direct read function. */
if((status = H5Dread_chunk(dataset, dxpl, offset, &filter_mask, outbuf)) < 0)
goto error;
@@ -1910,10 +1910,10 @@ test_read_unallocated_chunk (hid_t file)
goto error;
/* Write a single chunk to intialize the chunk storage */
- HDmemset(&chunk_dims, 0, sizeof(chunk_dims));
+ HDmemset(direct_buf, 0, CHUNK_NX * CHUNK_NY * sizeof(int));
offset[0] = 0; offset[1] = 0;
- if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, &chunk_dims) < 0)
+ if(H5Dwrite_chunk(dataset, dxpl, filter_mask, offset, chunk_nbytes, direct_buf) < 0)
goto error;
/* Attempt to read each chunk in the dataset. Chunks are not allocated,
@@ -1986,7 +1986,7 @@ error:
* this jira issue:
* Create a file with the latest format and a chunked dataset
* with one single chunk. The library will use single chunk
- * index for the dataset.
+ * index for the dataset.
* Verify that the data read is the same as the written data.
*
* Return: Success: 0
@@ -2106,15 +2106,15 @@ error:
} /* test_single_chunk_latest() */
/*-------------------------------------------------------------------------
- * Function: Main function
+ * Function: Main function
*
- * Purpose: Test direct chunk write function H5Dwrite_chunk and
+ * Purpose: Test direct chunk write function H5Dwrite_chunk and
* chunk direct read function H5Dread_chunk
*
- * Return: Success: 0
- * Failure: 1
+ * Return: Success: 0
+ * Failure: 1
*
- * Programmer: Raymond Lu
+ * Programmer: Raymond Lu
* 30 November 2012
*
*-------------------------------------------------------------------------
@@ -2134,7 +2134,7 @@ int main( void )
#ifdef H5_HAVE_FILTER_DEFLATE
nerrors += test_direct_chunk_write(file_id);
#endif /* H5_HAVE_FILTER_DEFLATE */
- nerrors += test_direct_chunk_overwrite_data(file_id);
+ nerrors += test_direct_chunk_overwrite_data(file_id);
nerrors += test_skip_compress_write1(file_id);
nerrors += test_skip_compress_write2(file_id);
nerrors += test_data_conv(file_id);
diff --git a/test/dsets.c b/test/dsets.c
index d23f438..9562ec9 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -87,6 +87,8 @@ const char *FILENAME[] = {
NULL
};
+#define OHMIN_FILENAME_A "ohdr_min_a"
+
#define FILENAME_BUF_SIZE 1024
#define KB 1024
@@ -268,6 +270,13 @@ const char *FILENAME[] = {
#define STORAGE_SIZE_CHUNK_DIM1 5
#define STORAGE_SIZE_CHUNK_DIM2 5
+/* Parameters for testing version bounds */
+#define VDS_FNAME1 "virtual_file1"
+#define VDS_FNAME2 "virtual_file2"
+#define SRC_FNAME "source_file"
+#define SRC_DSET "src_dset"
+#define V_DSET "v_dset"
+
/* Shared global arrays */
#define DSET_DIM1 100
#define DSET_DIM2 200
@@ -339,7 +348,7 @@ filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts,
count_nbytes_written += nbytes;
return nbytes;
-}
+} /* end filter_count() */
/*-------------------------------------------------------------------------
@@ -486,7 +495,7 @@ test_create(hid_t file)
error:
return -1;
-}
+} /* end test_create() */
/*-------------------------------------------------------------------------
@@ -622,7 +631,7 @@ error:
if(tconv_buf)
HDfree(tconv_buf);
return -1;
-}
+} /* end test_simple_io() */
/*-------------------------------------------------------------------------
@@ -728,7 +737,7 @@ error:
if(f > 0)
HDclose(f);
return -1;
-}
+} /* end test_userblock_offset() */
/*-------------------------------------------------------------------------
@@ -921,7 +930,7 @@ test_compact_io(hid_t fapl)
} H5E_END_TRY;
return -1;
-}
+} /* end test_compact_io() */
/*-------------------------------------------------------------------------
@@ -1336,7 +1345,7 @@ test_conv_buffer(hid_t fid)
error:
return -1;
-}
+} /* end test_conv_buffer() */
/*-------------------------------------------------------------------------
@@ -1420,7 +1429,7 @@ error:
} H5E_END_TRY;
return -1;
-}
+} /* end test_tconv() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_BOGUS[1] = {{
@@ -1453,7 +1462,7 @@ can_apply_bogus(hid_t H5_ATTR_UNUSED dcpl_id, hid_t type_id, hid_t H5_ATTR_UNUSE
return 1;
else
return -1;
-}
+} /* end can_apply_bogus() */
/*-------------------------------------------------------------------------
@@ -1471,7 +1480,7 @@ filter_bogus(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts,
size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
return nbytes;
-}
+} /* end filter_bogus() */
/*-------------------------------------------------------------------------
@@ -1571,7 +1580,7 @@ filter_bogus2(unsigned int flags, size_t cd_nelmts,
/* Filter is "no op" */
else
return(nbytes);
-}
+} /* end filter_bogus2() */
/*-------------------------------------------------------------------------
@@ -1589,7 +1598,7 @@ filter_bogus3(unsigned int H5_ATTR_UNUSED flags, size_t H5_ATTR_UNUSED cd_nelmts
size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf)
{
return 0;
-}
+} /* end filter_bogus3() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CORRUPT[1] = {{
@@ -1678,7 +1687,7 @@ filter_cb_cont(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
return H5Z_CB_CONT;
else
return H5Z_CB_FAIL;
-}
+} /* end filter_cb_cont() */
/*-------------------------------------------------------------------------
@@ -1697,7 +1706,7 @@ filter_cb_fail(H5Z_filter_t filter, void H5_ATTR_UNUSED *buf, size_t H5_ATTR_UNU
return H5Z_CB_FAIL;
else
return H5Z_CB_CONT;
-}
+} /* end filter_cb_fail() */
/*-------------------------------------------------------------------------
@@ -2046,7 +2055,7 @@ error:
if(tconv_buf)
HDfree (tconv_buf);
return -1;
-}
+} /* end test_filter_internal() */
/*-------------------------------------------------------------------------
* Function: test_filter_noencoder
@@ -2164,7 +2173,7 @@ error:
H5Fclose(file_id);
return -1;
-}
+} /* end test_filter_noencoder() */
#endif /* H5_HAVE_FILTER_SZIP */
/*-------------------------------------------------------------------------
@@ -2234,7 +2243,7 @@ test_get_filter_info(void)
error:
return -1;
-}
+} /* end test_get_filter_info() */
/*-------------------------------------------------------------------------
* Function: test_filters
@@ -2509,7 +2518,7 @@ H5_ATTR_UNUSED
error:
return -1;
-}
+} /* end test_filters() */
/*-------------------------------------------------------------------------
@@ -2849,7 +2858,7 @@ test_onebyte_shuffle(hid_t file)
error:
return -1;
-}
+} /* end test_onebyte_shuffle() */
/*-------------------------------------------------------------------------
@@ -2967,7 +2976,7 @@ test_nbit_int(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_int() */
/*-------------------------------------------------------------------------
@@ -3085,7 +3094,7 @@ test_nbit_float(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_float() */
/*-------------------------------------------------------------------------
@@ -3217,7 +3226,7 @@ test_nbit_double(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_double() */
/*-------------------------------------------------------------------------
@@ -3344,7 +3353,7 @@ test_nbit_array(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_array() */
/*-------------------------------------------------------------------------
@@ -3561,7 +3570,7 @@ test_nbit_compound(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_compound() */
/*-------------------------------------------------------------------------
@@ -3906,7 +3915,7 @@ out:
error:
return -1;
-}
+} /* end test_nbit_compound_2() */
/*-------------------------------------------------------------------------
@@ -4086,7 +4095,7 @@ test_nbit_compound_3(hid_t file)
error:
return -1;
-}
+} /* end test_nbit_compound_3() */
/*-------------------------------------------------------------------------
@@ -4253,7 +4262,7 @@ test_nbit_int_size(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_nbit_int_size() */
/*-------------------------------------------------------------------------
@@ -4450,7 +4459,7 @@ test_nbit_flt_size(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_nbit_flt_size() */
/*-------------------------------------------------------------------------
* Function: test_scaleoffset_int
@@ -4561,7 +4570,7 @@ test_scaleoffset_int(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_int() */
/*-------------------------------------------------------------------------
@@ -4689,7 +4698,7 @@ test_scaleoffset_int_2(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_int_2() */
/*-------------------------------------------------------------------------
@@ -4802,7 +4811,7 @@ test_scaleoffset_float(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_float() */
/*-------------------------------------------------------------------------
@@ -4931,7 +4940,7 @@ test_scaleoffset_float_2(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_float_2() */
/*-------------------------------------------------------------------------
@@ -5044,7 +5053,7 @@ test_scaleoffset_double(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_double() */
/*-------------------------------------------------------------------------
@@ -5174,7 +5183,7 @@ test_scaleoffset_double_2(hid_t file)
return 0;
error:
return -1;
-}
+} /* end test_scaleoffset_double_2() */
/*-------------------------------------------------------------------------
@@ -5241,7 +5250,7 @@ test_multiopen (hid_t file)
H5Pclose(dcpl);
} H5E_END_TRY;
return -1;
-}
+} /* end test_multiopen () */
/*-------------------------------------------------------------------------
@@ -5337,7 +5346,7 @@ test_types(hid_t file)
H5Dclose(dset);
} H5E_END_TRY;
return -1;
-}
+} /* end test_types() */
/* This message derives from H5Z */
const H5Z_class2_t H5Z_CAN_APPLY_TEST[1] = {{
@@ -6576,7 +6585,7 @@ error:
HDfree(buf);
} H5E_END_TRY;
return -1;
-}
+} /* end auxread_fdata() */
/*-------------------------------------------------------------------------
@@ -10027,7 +10036,7 @@ error:
H5Fclose(fid);
} H5E_END_TRY;
return -1;
-} /* test_idx_compatible */
+} /* end test_idx_compatible() */
/*-------------------------------------------------------------------------
*
@@ -10167,7 +10176,7 @@ error:
H5Fclose(fid);
} H5E_END_TRY;
return -1;
-} /* test_unfiltered_edge_chunks */
+} /* end test_unfiltered_edge_chunks() */
/*-------------------------------------------------------------------------
@@ -10864,7 +10873,7 @@ error:
H5Sclose(msid);
} H5E_END_TRY;
return -1;
-} /* test_farray_hdr_fd() */
+} /* end test_farray_hdr_fd() */
/*-------------------------------------------------------------------------
@@ -10984,7 +10993,7 @@ error:
H5Sclose(msid);
} H5E_END_TRY;
return -1;
-} /* test_bt2_hdr_fd() */
+} /* end test_bt2_hdr_fd() */
/*-------------------------------------------------------------------------
@@ -12182,7 +12191,7 @@ scatter_error_cb_fail(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
*src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]);
return FAIL;
-}
+} /* end scatter_error_cb_fail() */
static herr_t
scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
@@ -12200,7 +12209,7 @@ scatter_error_cb_null(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
*src_buf_bytes_used = nelmts * sizeof(scatter_info->src_buf[0]);
return SUCCEED;
-}
+} /* end scatter_error_cb_null() */
static herr_t
scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*/,
@@ -12211,7 +12220,7 @@ scatter_error_cb_unalign(void **src_buf/*out*/, size_t *src_buf_bytes_used/*out*
*src_buf_bytes_used = *(size_t *)_src_buf_bytes_used;
return SUCCEED;
-}
+} /* end scatter_error_cb_unalign() */
static herr_t
test_scatter_error(void)
@@ -12374,7 +12383,7 @@ gather_error_cb_fail(const void H5_ATTR_UNUSED *dst_buf,
size_t H5_ATTR_UNUSED dst_buf_bytes_used, void H5_ATTR_UNUSED *op_data)
{
return FAIL;
-}
+} /* end gather_error_cb_fail() */
static herr_t
test_gather_error(void)
@@ -12587,7 +12596,8 @@ static herr_t dls_01_read_stuff( hid_t fid );
static herr_t dls_01_main( void );
static herr_t
-dls_01_setup_file( hid_t fid ) {
+dls_01_setup_file( hid_t fid )
+{
int status = 0;
hid_t sid = 0, did = 0, tid = 0, dcpl = 0;
@@ -12632,10 +12642,11 @@ error:
return -1;
-} /* dls_01_setup_file */
+} /* end dls_01_setup_file() */
static herr_t
-dls_01_write_data( hid_t fid, char* buffer ) {
+dls_01_write_data( hid_t fid, char* buffer )
+{
int status = 0;
hid_t did = 0, tid = 0;
@@ -12668,10 +12679,11 @@ error:
return -1;
-} /* dls_01_write_data */
+} /* end dls_01_write_data() */
static herr_t
-dls_01_read_stuff( hid_t fid ) {
+dls_01_read_stuff( hid_t fid )
+{
int status = 0;
hid_t did = 0;
@@ -12692,10 +12704,11 @@ error:
return -1;
-} /* dls_01_read_stuff() */
+} /* end dls_01_read_stuff() */
static herr_t
-dls_01_main( void ) {
+dls_01_main( void )
+{
char filename[512];
int status = 0;
@@ -12761,7 +12774,7 @@ error:
return -1;
-} /* dls_01_main() */
+} /* end dls_01_main() */
/*-------------------------------------------------------------------------
* Function: test_compact_open_close_dirty
@@ -12879,7 +12892,7 @@ error:
H5Fclose(fid);
} H5E_END_TRY;
return -1;
-} /* test_compact_open_close_dirty() */
+} /* end test_compact_open_close_dirty() */
/*-------------------------------------------------------------------------
@@ -12888,8 +12901,8 @@ error:
* Purpose: Tests various format versions.
* (Currently, only virtual dataset feature)
*
- * Return: Success: 0
- * Failure: -1
+ * Return: Success: SUCCEED
+ * Failure: FAIL
* Description:
* This function attempts to create a virtual dataset in all
* valid combinations of low/high library format bounds. Creation
@@ -12898,13 +12911,8 @@ error:
*
*-------------------------------------------------------------------------
*/
-#define VDS_FNAME1 "virtual_file1"
-#define VDS_FNAME2 "virtual_file2"
-#define SRC_FNAME "source_file"
-#define SRC_DSET "src_dset"
-#define V_DSET "v_dset"
static herr_t
-test_versionbounds()
+test_versionbounds(void)
{
hid_t fapl = -1;
hid_t srcfile = -1; /* Files with source dsets */
@@ -13018,7 +13026,7 @@ test_versionbounds()
TEST_ERROR
dcpl = -1;
PASSED();
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
@@ -13031,8 +13039,126 @@ test_versionbounds()
H5Fclose(srcfile);
H5Fclose(vfile);
} H5E_END_TRY;
- return -1;
-} /* test_versionbounds() */
+ return FAIL;
+} /* end test_versionbounds() */
+
+
+/*-----------------------------------------------------------------------------
+ * Function: test_object_header_minimization_dcpl
+ *
+ * Purpose: Test the "datset object header minimization" property as part of
+ * the DCPL.
+ *
+ * Return: Success/pass: 0
+ * Failure/error: -1
+ *
+ * Programmer: Jacob Smith
+ * 2018 August 15
+ *
+ * Changes: None.
+ *-----------------------------------------------------------------------------
+ */
+static herr_t
+test_object_header_minimization_dcpl(hid_t fapl_id)
+{
+ hid_t dcpl_id = -1;
+ hid_t file_id = -1;
+ char filename[FILENAME_BUF_SIZE] = "";
+ hbool_t minimize = FALSE;
+ herr_t ret;
+
+ TESTING("dcpl flags to minimize dataset object header");
+
+ /*********/
+ /* SETUP */
+ /*********/
+
+ if(NULL == h5_fixname(OHMIN_FILENAME_A, fapl_id, filename, sizeof(filename)))
+ TEST_ERROR
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if (file_id == H5I_INVALID_HID)
+ TEST_ERROR
+
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ if (dcpl_id == H5I_INVALID_HID)
+ TEST_ERROR
+
+ /*********/
+ /* TESTS */
+ /*********/
+
+ /* default value (not set explicitly)
+ */
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
+ if (FALSE != minimize)
+ TEST_ERROR
+
+ /* FALSE-set value
+ */
+ if (H5Pset_dset_no_attrs_hint(dcpl_id, FALSE) == FAIL)
+ TEST_ERROR
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
+ if (FALSE != minimize)
+ TEST_ERROR
+
+ /* TRUE-set value
+ */
+ if (H5Pset_dset_no_attrs_hint(dcpl_id, TRUE) == FAIL)
+ TEST_ERROR
+ if (H5Pget_dset_no_attrs_hint(dcpl_id, &minimize) == FAIL)
+ TEST_ERROR
+ if (TRUE != minimize)
+ TEST_ERROR
+
+ /* error cases
+ */
+ H5E_BEGIN_TRY {
+ ret = H5Pget_dset_no_attrs_hint(-1, &minimize);
+ } H5E_END_TRY;
+ if (ret == SUCCEED)
+ TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ ret = H5Pset_dset_no_attrs_hint(-1, FALSE);
+ } H5E_END_TRY;
+ if (ret == SUCCEED)
+ TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ ret = H5Pset_dset_no_attrs_hint(-1, TRUE);
+ } H5E_END_TRY;
+ if (ret == SUCCEED)
+ TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ ret = H5Pget_dset_no_attrs_hint(dcpl_id, NULL);
+ } H5E_END_TRY;
+ if (ret == SUCCEED)
+ TEST_ERROR
+
+ /************/
+ /* TEARDOWN */
+ /************/
+
+ if (H5Fclose(file_id) == FAIL)
+ TEST_ERROR
+
+ if (H5Pclose(dcpl_id) == FAIL)
+ TEST_ERROR
+
+ PASSED();
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ H5Pclose(dcpl_id);
+ H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* end test_object_header_minimization_dcpl() */
/*-------------------------------------------------------------------------
@@ -13056,6 +13182,7 @@ main(void)
hid_t fcpl = -1, fcpl2 = -1;
unsigned new_format;
unsigned paged;
+ unsigned minimized_ohdr;
int mdc_nelmts;
size_t rdcc_nelmts;
size_t rdcc_nbytes;
@@ -13111,113 +13238,122 @@ main(void)
if(!contig_addr_vfd && paged)
continue;
- /* Test with old & new format groups */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl, my_fcpl;
-
- /* Set the FAPL for the type of format */
- if(new_format) {
- my_fapl = fapl2;
- if(paged) {
- my_fcpl = fcpl2;
- puts("\nTesting with new file format and paged aggregation");
- } else {
- my_fcpl = fcpl;
- puts("\nTesting with new file format and non-paged aggregation");
- }
- } /* end if */
- else {
- my_fapl = fapl;
- if(paged) {
- my_fcpl = fcpl2;
- puts("Testing with old file format and paged aggregation:");
- } else {
- my_fcpl = fcpl;
- puts("Testing with old file format and non-paged aggregation:");
- }
- } /* end else */
+ for(minimized_ohdr = FALSE; minimized_ohdr <= TRUE; minimized_ohdr++) {
+
+ /* Test with old & new format groups */
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl, my_fcpl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ my_fapl = fapl2;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("\nTesting with new file format and paged aggregation");
+ } else {
+ my_fcpl = fcpl;
+ puts("\nTesting with new file format and non-paged aggregation");
+ }
+ } /* end if */
+ else {
+ my_fapl = fapl;
+ if(paged) {
+ my_fcpl = fcpl2;
+ puts("Testing with old file format and paged aggregation:");
+ } else {
+ my_fcpl = fcpl;
+ puts("Testing with old file format and non-paged aggregation:");
+ }
+ } /* end else */
- /* Create the file for this test */
- if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
- goto error;
+ /* Create the file for this test */
+ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, my_fcpl, my_fapl)) < 0)
+ goto error;
- /* Cause the library to emit initial messages */
- if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
- if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
- goto error;
- if(H5Gclose(grp) < 0)
- goto error;
+ if (TRUE == minimized_ohdr) {
+ if (0 > H5Fset_dset_no_attrs_hint(file, TRUE))
+ goto error;
+ puts("(minimized dataset object headers with file setting)");
+ }
- nerrors += (test_create(file) < 0 ? 1 : 0);
- nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
- nerrors += (test_tconv(file) < 0 ? 1 : 0);
- nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
- nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
- nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
- nerrors += (test_multiopen (file) < 0 ? 1 : 0);
- nerrors += (test_types(file) < 0 ? 1 : 0);
- nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
- nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply(file) < 0 ? 1 : 0);
- nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
- nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
- nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
- nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
- nerrors += (test_filters_endianess() < 0 ? 1 : 0);
- nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
- nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
- nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
+ /* Cause the library to emit initial messages */
+ if((grp = H5Gcreate2(file, "emit diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Oset_comment(grp, "Causes diagnostic messages to be emitted") < 0)
+ goto error;
+ if(H5Gclose(grp) < 0)
+ goto error;
+
+ nerrors += (test_create(file) < 0 ? 1 : 0);
+ nerrors += (test_simple_io(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_io(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_max_compact(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_compact_open_close_dirty(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_conv_buffer(file) < 0 ? 1 : 0);
+ nerrors += (test_tconv(file) < 0 ? 1 : 0);
+ nerrors += (test_filters(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_onebyte_shuffle(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_float(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_double(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_array(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_2(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_compound_3(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_int_size(file) < 0 ? 1 : 0);
+ nerrors += (test_nbit_flt_size(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_int_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_float_2(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double(file) < 0 ? 1 : 0);
+ nerrors += (test_scaleoffset_double_2(file) < 0 ? 1 : 0);
+ nerrors += (test_multiopen (file) < 0 ? 1 : 0);
+ nerrors += (test_types(file) < 0 ? 1 : 0);
+ nerrors += (test_userblock_offset(envval, my_fapl, new_format) < 0 ? 1 : 0);
+ nerrors += (test_missing_filter(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply(file) < 0 ? 1 : 0);
+ nerrors += (test_can_apply2(file) < 0 ? 1 : 0);
+ nerrors += (test_set_local(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_can_apply_szip(file) < 0 ? 1 : 0);
+ nerrors += (test_compare_dcpl(file) < 0 ? 1 : 0);
+ nerrors += (test_copy_dcpl(file, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_filter_delete(file) < 0 ? 1 : 0);
+ nerrors += (test_filters_endianess() < 0 ? 1 : 0);
+ nerrors += (test_zero_dims(file) < 0 ? 1 : 0);
+ nerrors += (test_missing_chunk(file) < 0 ? 1 : 0);
+ nerrors += (test_random_chunks(my_fapl) < 0 ? 1 : 0);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += (test_deprec(file) < 0 ? 1 : 0);
+ nerrors += (test_deprec(file) < 0 ? 1 : 0);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_idx_compatible() < 0 ? 1 : 0);
- nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
- nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
-
- nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
- nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
-
- if(H5Fclose(file) < 0)
- goto error;
- } /* end for new_format */
+ nerrors += (test_huge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_reopen_chunk_fast(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_fast_bug1(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_idx_compatible() < 0 ? 1 : 0);
+ nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_single_chunk(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_storage_size(my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_power2up(my_fapl) < 0 ? 1 : 0);
+
+ nerrors += (test_swmr_non_latest(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_earray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_farray_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+ nerrors += (test_bt2_hdr_fd(envval, my_fapl) < 0 ? 1 : 0);
+
+ if(H5Fclose(file) < 0)
+ goto error;
+ } /* end for new_format */
+ } /* end for minimized_ohdr */
} /* end for paged */
/* Close property lists */
@@ -13232,7 +13368,9 @@ main(void)
nerrors += (test_gather_error() < 0 ? 1 : 0);
/* Tests version bounds using its own file */
- nerrors += (test_versionbounds() < 0 ? 1 : 0);
+ nerrors += (test_versionbounds() < 0 ? 1 : 0);
+
+ nerrors += (test_object_header_minimization_dcpl(fapl) < 0 ? 1 : 0);
/* Run misc tests */
nerrors += dls_01_main();
@@ -13249,12 +13387,12 @@ main(void)
#endif /* H5_HAVE_FILTER_SZIP */
h5_cleanup(FILENAME, fapl);
- return 0;
+ return EXIT_SUCCESS;
error:
nerrors = MAX(1, nerrors);
printf("***** %d DATASET TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
- return 1;
-}
+ return EXIT_FAILURE;
+} /* end main() */
diff --git a/test/dt_arith.c b/test/dt_arith.c
index c7f2986..2729ba1 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -4883,7 +4883,24 @@ run_fp_tests(const char *name)
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
+#else
+ {
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s denormalized %s -> %s conversions",
+ name, "long double", "float");
+ printf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+ }
+#endif
+
nerrors += test_conv_flt_1(name, TEST_DENORM, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
#endif
@@ -4893,8 +4910,24 @@ run_fp_tests(const char *name)
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_FLOAT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_DOUBLE, H5T_NATIVE_LDOUBLE);
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_FLOAT);
nerrors += test_conv_flt_1(name, TEST_SPECIAL, H5T_NATIVE_LDOUBLE, H5T_NATIVE_DOUBLE);
+#else
+ {
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, "long double", "float or double");
+ printf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+ }
+#endif
#endif
done:
@@ -4963,7 +4996,7 @@ run_int_fp_conv(const char *name)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_INT, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_UINT, H5T_NATIVE_LDOUBLE);
#if H5_SIZEOF_LONG!=H5_SIZEOF_INT
-#ifndef H5_LONG_TO_LDOUBLE_SPECIAL
+#if !defined(H5_LONG_TO_LDOUBLE_SPECIAL) && !defined(H5_DISABLE_SOME_LDOUBLE_CONV)
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_LONG, H5T_NATIVE_LDOUBLE);
nerrors += test_conv_int_fp(name, TEST_NORMAL, H5T_NATIVE_ULONG, H5T_NATIVE_LDOUBLE);
#else
@@ -5077,16 +5110,46 @@ run_fp_int_conv(const char *name)
#endif
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+ if(test_values != TEST_SPECIAL) {
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+ } else {
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UCHAR);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_SHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_USHORT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_INT);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_UINT);
+#else
+ char str[256]; /*string */
+
+ HDsnprintf(str, sizeof(str), "Testing %s special %s -> %s conversions",
+ name, "long double", "signed and unsigned char, short, int, long");
+ printf("%-70s", str);
+ SKIPPED();
+#if H5_SIZEOF_LONG_DOUBLE!=0
+ HDputs(" Test skipped due to the conversion problem on IBM ppc64le cpu.");
+#else
+ HDputs(" Test skipped due to disabled long double.");
+#endif
+#endif
+ }
#if H5_SIZEOF_LONG!=H5_SIZEOF_INT && H5_SIZEOF_LONG_DOUBLE!=0
#ifndef H5_LDOUBLE_TO_LONG_SPECIAL
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
- nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+ if(test_values != TEST_SPECIAL && test_values != TEST_NORMAL) {
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+ } else {
+#ifndef H5_DISABLE_SOME_LDOUBLE_CONV
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_LONG);
+ nerrors += test_conv_int_fp(name, test_values, H5T_NATIVE_LDOUBLE, H5T_NATIVE_ULONG);
+#endif
+ }
#else
{
char str[256]; /*string */
diff --git a/test/enc_dec_plist.c b/test/enc_dec_plist.c
index 36db2d0..cee38f3 100644
--- a/test/enc_dec_plist.c
+++ b/test/enc_dec_plist.c
@@ -146,6 +146,9 @@ main(void)
if((H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill)) < 0)
FAIL_STACK_ERROR
+ if((H5Pset_dset_no_attrs_hint(dcpl, FALSE)) < 0)
+ FAIL_STACK_ERROR
+
max_size[0] = 100;
if((H5Pset_external(dcpl, "ext1.data", (off_t)0,
(hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
diff --git a/test/gen_bogus.c b/test/gen_bogus.c
index ec29eb9..237b024 100644
--- a/test/gen_bogus.c
+++ b/test/gen_bogus.c
@@ -89,6 +89,14 @@ generate_datasets(hid_t loc_id, unsigned bogus_id)
if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
if(H5Dclose(did) < 0) goto error;
+ /* Set "shareable" message flag for bogus message */
+ bogus_flags = H5O_MSG_FLAG_SHAREABLE;
+ if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error;
+
+ /* Create fourth dataset, with "shareable" message flag */
+ if((did = H5Dcreate2(loc_id, "Dataset5", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error;
+ if(H5Dclose(did) < 0) goto error;
+
/* Close dataset creation property list */
if(H5Pclose(dcpl) < 0) goto error;
diff --git a/test/gen_plist.c b/test/gen_plist.c
index 62693bd..d8096e3 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -125,6 +125,9 @@ main(void)
if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0)
assert(ret > 0);
+ if((ret = H5Pset_dset_no_attrs_hint(dcpl1, FALSE)) < 0)
+ assert(ret > 0);
+
max_size[0] = 100;
if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0,
(hsize_t)(max_size[0] * sizeof(int)/4))) < 0)
diff --git a/test/h5test.c b/test/h5test.c
index 687f594..62eb6bf 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -643,7 +643,7 @@ h5_fixname_real(const char *base_name, hid_t fapl, const char *_suffix,
printf("*** Hint ***\n"
"You can use environment variable HDF5_PARAPREFIX to "
"run parallel test files in a\n"
- "different directory or to add file type prefix. E.g.,\n"
+ "different directory or to add file type prefix. e.g.,\n"
" HDF5_PARAPREFIX=pfs:/PFS/user/me\n"
" export HDF5_PARAPREFIX\n"
"*** End of Hint ***\n");
@@ -1854,6 +1854,42 @@ static herr_t dummy_vfd_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UN
static herr_t dummy_vfd_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr, size_t size, const void *buf);
static herr_t dummy_vfd_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUSED fapl_id, haddr_t H5_ATTR_UNUSED addr, size_t H5_ATTR_UNUSED size, const void H5_ATTR_UNUSED *buf) { return FAIL; }
+/* Dummy VFD with the minimum parameters to make a VFD that can be registered */
+static const H5FD_class_t H5FD_dummy_g = {
+ "dummy", /* name */
+ 1, /* maxaddr */
+ H5F_CLOSE_WEAK, /* fc_degree */
+ NULL, /* terminate */
+ NULL, /* sb_size */
+ NULL, /* sb_encode */
+ NULL, /* sb_decode */
+ 0, /* fapl_size */
+ NULL, /* fapl_get */
+ NULL, /* fapl_copy */
+ NULL, /* fapl_free */
+ 0, /* dxpl_size */
+ NULL, /* dxpl_copy */
+ NULL, /* dxpl_free */
+ dummy_vfd_open, /* open */
+ dummy_vfd_close, /* close */
+ NULL, /* cmp */
+ NULL, /* query */
+ NULL, /* get_type_map */
+ NULL, /* alloc */
+ NULL, /* free */
+ dummy_vfd_get_eoa, /* get_eoa */
+ dummy_vfd_set_eoa, /* set_eoa */
+ dummy_vfd_get_eof, /* get_eof */
+ NULL, /* get_handle */
+ dummy_vfd_read, /* read */
+ dummy_vfd_write, /* write */
+ NULL, /* flush */
+ NULL, /* truncate */
+ NULL, /* lock */
+ NULL, /* unlock */
+ H5FD_FLMAP_DICHOTOMY /* fl_map */
+};
+
/*-------------------------------------------------------------------------
* Function: h5_get_dummy_vfd_class()
@@ -1881,21 +1917,11 @@ h5_get_dummy_vfd_class(void)
H5FD_class_t *vfd_class = NULL; /* Dummy VFD that will be returned */
/* Create the class and initialize everything to zero/NULL */
- if(NULL == (vfd_class = (H5FD_class_t *)HDcalloc((size_t)1, sizeof(H5FD_class_t))))
+ if(NULL == (vfd_class = (H5FD_class_t *)HDmalloc(sizeof(H5FD_class_t))))
TEST_ERROR;
- /* Fill in the minimum parameters to make a VFD that
- * can be registered.
- */
- vfd_class->name = "dummy";
- vfd_class->maxaddr = 1;
- vfd_class->open = dummy_vfd_open;
- vfd_class->close = dummy_vfd_close;
- vfd_class->get_eoa = dummy_vfd_get_eoa;
- vfd_class->set_eoa = dummy_vfd_set_eoa;
- vfd_class->get_eof = dummy_vfd_get_eof;
- vfd_class->read = dummy_vfd_read;
- vfd_class->write = dummy_vfd_write;
+ /* Copy the dummy VFD */
+ HDmemcpy(vfd_class, &H5FD_dummy_g, sizeof(H5FD_class_t));
return vfd_class;
diff --git a/test/links.c b/test/links.c
index fb2c75a..63b125f 100644
--- a/test/links.c
+++ b/test/links.c
@@ -315,6 +315,8 @@ typedef struct {
const obj_visit_t *info; /* Pointer to the object visit structure to use */
} ovisit_ud_t;
+static hid_t dcpl_g; /* for [un]minimized dataset object headers */
+
/*-------------------------------------------------------------------------
@@ -377,7 +379,7 @@ mklinks(hid_t fapl, hbool_t new_format)
if(H5Gclose(grp) < 0) TEST_ERROR
/* Create a dataset */
- if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((d1 = H5Dcreate2(file, "d1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(d1) < 0) TEST_ERROR
/* Create a hard link */
@@ -451,8 +453,8 @@ new_links(hid_t fapl, hbool_t new_format)
if((grp2_b = H5Gcreate2(file_b, "grp2", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create datasets */
- if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset1 = H5Dcreate2(file_a, "dataset1", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset2 = H5Dcreate2(grp1_a, "dataset2", H5T_NATIVE_INT, scalar, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
/* Create links within a file. Both of source and destination use
* H5L_SAME_LOC. Both hard and soft links should fail. */
@@ -545,7 +547,7 @@ cklinks(hid_t fapl, hbool_t new_format)
if(H5Oget_info_by_name2(file, "grp1/hard", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
- printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
@@ -580,7 +582,7 @@ cklinks(hid_t fapl, hbool_t new_format)
if(H5Oget_info_by_name2(file, "grp1/soft", &oinfo2, H5O_INFO_BASIC, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5O_TYPE_DATASET != oinfo2.type) {
H5_FAILED();
- printf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
+ HDprintf(" %d: Unexpected object type should have been a dataset\n", __LINE__);
TEST_ERROR
} /* end if */
if(H5F_addr_ne(oinfo1.addr, oinfo2.addr)) {
@@ -609,12 +611,12 @@ cklinks(hid_t fapl, hbool_t new_format)
if(H5Lget_info(file, "grp1/dangle", &linfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if(H5L_TYPE_SOFT != linfo2.type) {
H5_FAILED();
- printf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
+ HDprintf(" %d: Unexpected object type should have been a symbolic link\n", __LINE__);
TEST_ERROR
} /* end if */
if(H5Lget_val(file, "grp1/dangle", linkval, sizeof linkval, H5P_DEFAULT) < 0) {
H5_FAILED();
- printf(" %d: Can't retrieve link value\n", __LINE__);
+ HDprintf(" %d: Can't retrieve link value\n", __LINE__);
TEST_ERROR
} /* end if */
if(HDstrcmp(linkval, "foobar")) {
@@ -1014,7 +1016,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if((space_id=H5Screate_simple(2 ,dims, NULL)) < 0) TEST_ERROR
/* Create a dataset using the default LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file_id, "/dataset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is the default */
@@ -1043,7 +1045,7 @@ test_lcpl(hid_t fapl, hbool_t new_format)
if(linfo.cset != H5T_CSET_UTF8) TEST_ERROR
/* Create a dataset using the new LCPL */
- if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((dset_id = H5Dcreate2(file_id, "/dataset2", H5T_NATIVE_INT, space_id, lcpl_id, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
/* Check that its character encoding is UTF-8 */
@@ -2602,7 +2604,7 @@ external_link_toomany(hid_t fapl, hbool_t new_format)
} H5E_END_TRY;
if (gid >= 0) {
H5_FAILED();
- printf("%d: Should have failed for sequence of too many nested links.", __LINE__);
+ HDprintf("%d: Should have failed for sequence of too many nested links.", __LINE__);
goto error;
}
@@ -3758,7 +3760,7 @@ external_set_elink_fapl2(hid_t fapl, hbool_t new_format)
if((space = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
/* Create dataset creation property list */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) TEST_ERROR;
+ if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0) TEST_ERROR;
if(H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0) TEST_ERROR;
/* create "Dataset" in group "A" of target file */
@@ -6100,7 +6102,7 @@ external_link_closing(hid_t fapl, hbool_t new_format)
/* Test creating each kind of object */
if((gid = H5Gcreate2(fid1, "elink/elink/elink/group1", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Tcommit2(fid1, "elink/elink/elink/type1", tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid1, "elink/elink/elink/dataset1", tid2, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
/* Close objects */
if(H5Gclose(gid) < 0) TEST_ERROR
@@ -7298,7 +7300,7 @@ external_open_twice(hid_t fapl, hbool_t new_format)
if((space = H5Screate(H5S_SCALAR)) < 0)
TEST_ERROR
if((oid1 = H5Dcreate2(fid2, "dset", H5T_NATIVE_INT, space, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ dcpl_g, H5P_DEFAULT)) < 0)
TEST_ERROR
if(H5Dclose(oid1) < 0)
TEST_ERROR
@@ -7514,7 +7516,7 @@ external_link_with_committed_datatype(hid_t fapl, hbool_t new_format)
if((sid2 = H5Screate_simple(2, dims, NULL)) < 0)
FAIL_STACK_ERROR
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ if((dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g)) < 0)
FAIL_STACK_ERROR
if(H5Pset_chunk(dcpl, 2, chunks) < 0)
FAIL_STACK_ERROR
@@ -9058,7 +9060,7 @@ lapl_nlinks(hid_t fapl, hbool_t new_format)
dims[0] = 2;
dims[1] = 2;
if((sid = H5Screate_simple(2, dims, NULL)) < 0) TEST_ERROR
- if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(gid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
/* Close group */
@@ -9170,7 +9172,7 @@ linkinfo(hid_t fapl, hbool_t new_format)
if(H5Lcreate_soft("group", fid, "softlink", H5P_DEFAULT, H5P_DEFAULT) < 0) FAIL_STACK_ERROR
if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "dataset", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Lcreate_ud(fid, "ud_link", (H5L_type_t)UD_PLIST_TYPE, NULL, (size_t)0, H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
if(H5Lcreate_external("file_name", "obj_path", fid, "ext_link", H5P_DEFAULT, H5P_DEFAULT) < 0) TEST_ERROR
@@ -9335,13 +9337,13 @@ build_visit_file(hid_t fapl)
/* Create dataset in each group */
if((sid = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Dataset_zero", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Group1/Dataset_one", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
- if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
+ if((did = H5Dcreate2(fid, "/Group1/Group2/Dataset_two", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(did) < 0) TEST_ERROR
if(H5Sclose(sid) < 0) TEST_ERROR
@@ -14890,6 +14892,7 @@ main(void)
hid_t fapl, fapl2; /* File access property lists */
int nerrors = 0;
unsigned new_format; /* Whether to use the new format or not */
+ unsigned minimize_dset_oh; /* Whether to minimize dataset object headers */
unsigned efc; /* Whether to use the external file cache */
const char *env_h5_drvr; /* File Driver value from environment */
@@ -14900,166 +14903,185 @@ main(void)
h5_reset();
fapl = h5_fileaccess();
- /* Copy the file access property list */
+ /* fapl2 uses "latest version bounds" */
if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR
- /* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl;
+ for (minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) {
+ if (minimize_dset_oh) {
+ HDprintf("\n-Testing with minimzed dataset object headers-\n");
+ dcpl_g = H5Pcreate(H5P_DATASET_CREATE);
+ if (0 > dcpl_g) TEST_ERROR
+ } else {
+ HDprintf("\n-Testing with unminimzed dataset object headers-\n");
+ dcpl_g = H5P_DEFAULT;
+ }
- /* Check for FAPL to use */
- if(new_format)
- my_fapl = fapl2;
- else
- my_fapl = fapl;
-
- /* General tests... (on both old & new format groups */
- nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Test new H5L link creation routine */
- nerrors += test_lcpl(my_fapl, new_format);
- nerrors += test_move(my_fapl, new_format);
- nerrors += test_copy(my_fapl, new_format);
- nerrors += test_move_preserves(my_fapl, new_format);
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Check for FAPL to use */
+ if(new_format) {
+ my_fapl = fapl2;
+ HDprintf("\n--Testing with 'new format'--\n");
+ } else {
+ my_fapl = fapl;
+ HDprintf("\n--Testing with 'old format'--\n");
+ }
+
+ /* always enter tests without external cache */
+ if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
+ TEST_ERROR
+
+ /* General tests... (on both old & new format groups */
+ nerrors += mklinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += cklinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += ck_new_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += long_links(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += toomany(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Test new H5L link creation routine */
+ nerrors += test_lcpl(my_fapl, new_format);
+ nerrors += test_move(my_fapl, new_format);
+ nerrors += test_copy(my_fapl, new_format);
+ nerrors += test_move_preserves(my_fapl, new_format);
#ifndef H5_NO_DEPRECATED_SYMBOLS
- nerrors += test_deprec(my_fapl, new_format);
+ nerrors += test_deprec(my_fapl, new_format);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
- /* tests for external link */
- /* Test external file cache first, so it sees the default efc setting on
- * the fapl */
- nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* This test cannot run with the EFC because it assumes that an
- * intermediate file is not held open */
- nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* This test cannot run with the EFC because the EFC cannot currently
- * reopen a cached file with a different intent */
- nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Try external link tests both with and without the external file cache
- */
- for(efc = FALSE; efc <= TRUE; efc++) {
- if(efc) {
- if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
- TEST_ERROR
- printf("\n---Testing with external file cache---\n");
- } /* end if */
- else {
- if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
- TEST_ERROR
- printf("\n---Testing without external file cache---\n");
- } /* end else */
+ /* tests for external link */
+ /* Test external file cache first, so it sees the default efc setting on
+ * the fapl */
+ nerrors += external_file_cache(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* This test cannot run with the EFC because it assumes that an
+ * intermediate file is not held open */
+ nerrors += external_link_mult(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* This test cannot run with the EFC because the EFC cannot currently
+ * reopen a cached file with a different intent */
+ nerrors += external_set_elink_acc_flags(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Try external link tests both with and without the external file cache
+ */
+ for(efc = FALSE; efc <= TRUE; efc++) {
+ if(efc) {
+ if(H5Pset_elink_file_cache_size(my_fapl, 8) < 0)
+ TEST_ERROR
+ HDprintf("\n---Testing with external file cache---\n");
+ } /* end if */
+ else {
+ if(H5Pset_elink_file_cache_size(my_fapl, 0) < 0)
+ TEST_ERROR
+ HDprintf("\n---Testing without external file cache---\n");
+ } /* end else */
- nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
- nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
-
- nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
- nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_root(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_path(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_self(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_pingpong(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_toomany(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_dangling(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_recursive(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_query(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_compact(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_unlink_dense(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_move(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_ride(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_closing(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_endian(new_format) < 0 ? 1 : 0;
+ nerrors += external_link_strong(my_fapl, new_format) < 0 ? 1 : 0;
+
+ nerrors += external_link_prefix(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abs_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_rel_mainpath(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_cwd(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_abstar_cur(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_reltar(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_chdir(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_fapl3(new_format) < 0 ? 1 : 0;
+ nerrors += external_set_elink_cb(my_fapl, new_format) < 0 ? 1 : 0;
#ifdef H5_HAVE_WINDOW_PATH
- nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win1(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win2(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win3(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win4(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win5(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win6(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win7(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win8(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_win9(my_fapl, new_format) < 0 ? 1 : 0;
#endif
- nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
- } /* end for */
-
- /* These tests assume that external links are a form of UD links,
- * so assume that everything that passed for external links
- * above has already been tested for UD links.
- */
- if(new_format == TRUE) {
- nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
- nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
- } /* end if */
- nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Misc. extra tests, useful for both new & old format files */
- nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0;
- nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0;
-
- /* Keep this test last, it's testing files that are used above */
- /* do not do this for files used by external link tests */
- nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
- } /* end for */
-
- /* New group revision feature tests */
- nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
+ nerrors += external_symlink(env_h5_drvr, my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_copy_invalid_object(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_dont_fail_to_source(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_open_twice(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += external_link_with_committed_datatype(my_fapl, new_format) < 0 ? 1 : 0;
+ } /* for with/without external file cache (efc) */
+
+ /* These tests assume that external links are a form of UD links,
+ * so assume that everything that passed for external links
+ * above has already been tested for UD links.
+ */
+ if(new_format == TRUE) {
+ nerrors += ud_hard_links(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ nerrors += ud_link_reregister(fapl2) < 0 ? 1 : 0; /* requires new format groups */
+ } /* end if */
+ nerrors += ud_callbacks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += ud_link_errors(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += lapl_udata(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += lapl_nlinks(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += linkinfo(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Misc. extra tests, useful for both new & old format files */
+ nerrors += link_visit(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += link_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit_by_name(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_visit_stop(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += link_filters(my_fapl, new_format) < 0 ? 1 : 0;
+ nerrors += obj_exists(my_fapl, new_format) < 0 ? 1 : 0;
+
+ /* Keep this test last, it's testing files that are used above */
+ /* do not do this for files used by external link tests */
+ nerrors += check_all_closed(my_fapl, new_format, EXTSTOP) < 0 ? 1 : 0;
+ } /* for new/old format */
+
+ /* New group revision feature tests */
+ nerrors += corder_create_empty(fapl2) < 0 ? 1 : 0;
/* XXX: when creation order indexing is fully working, go back and add checks
* to these tests to make certain that the creation order values are
* correct.
*/
- nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
- nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
- nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
- nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
- nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += link_iterate(fapl2) < 0 ? 1 : 0;
- nerrors += open_by_idx(fapl2) < 0 ? 1 : 0;
- nerrors += object_info(fapl2) < 0 ? 1 : 0;
- nerrors += group_info(fapl2) < 0 ? 1 : 0;
- nerrors += timestamps(fapl2) < 0 ? 1 : 0;
-
- /* Test new API calls on old-style groups */
- nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += link_iterate_old(fapl) < 0 ? 1 : 0;
- nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0;
- nerrors += object_info_old(fapl) < 0 ? 1 : 0;
- nerrors += group_info_old(fapl) < 0 ? 1 : 0;
-
+ nerrors += corder_create_compact(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_create_dense(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_transition(fapl2) < 0 ? 1 : 0;
+ nerrors += corder_delete(fapl2) < 0 ? 1 : 0;
+ nerrors += link_info_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += delete_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += link_iterate(fapl2) < 0 ? 1 : 0;
+ nerrors += open_by_idx(fapl2) < 0 ? 1 : 0;
+ nerrors += object_info(fapl2) < 0 ? 1 : 0;
+ nerrors += group_info(fapl2) < 0 ? 1 : 0;
+ nerrors += timestamps(fapl2) < 0 ? 1 : 0;
+
+ /* Test new API calls on old-style groups */
+ nerrors += link_info_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += delete_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += link_iterate_old(fapl) < 0 ? 1 : 0;
+ nerrors += open_by_idx_old(fapl) < 0 ? 1 : 0;
+ nerrors += object_info_old(fapl) < 0 ? 1 : 0;
+ nerrors += group_info_old(fapl) < 0 ? 1 : 0;
+
+ if (minimize_dset_oh) {
+ if (H5Pclose(dcpl_g) < 0) TEST_ERROR;
+ dcpl_g = -1;
+ }
+ } /* for [un]minimized dataset object headers */
/* Close 2nd FAPL */
H5Pclose(fapl2);
@@ -15075,11 +15097,11 @@ main(void)
/* Results */
if(nerrors) {
- printf("***** %d LINK TEST%s FAILED! *****\n",
+ HDprintf("***** %d LINK TEST%s FAILED! *****\n",
nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
}
- printf("All link tests passed.\n");
+ HDprintf("All link tests passed.\n");
/* clean up symlink created by external link tests */
HDremove(SYMLINK1);
diff --git a/test/ohdr.c b/test/ohdr.c
index 669b1e0..3f61660 100644
--- a/test/ohdr.c
+++ b/test/ohdr.c
@@ -35,9 +35,16 @@
const char *FILENAME[] = {
"ohdr",
+ "ohdr_min_a",
+ "ohdr_min_b",
NULL
};
+/* used for object header size comparison */
+#define EQ 1
+#define LT 2
+#define GT 3
+
/* The tbogus.h5 is generated from gen_bogus.c in HDF5 'test' directory.
* To get this data file, define H5O_ENABLE_BOGUS in src/H5Oprivate, rebuild
* the library and simply compile gen_bogus.c with that HDF5 library and run it.
@@ -50,6 +57,885 @@ const char *FILENAME[] = {
#define OBJ_VERSION_LATEST 2
/*
+ * Set an attribute with the given information.
+ * If the out parameter `attr_id` is negative, a new attribute will be
+ * created with the given information. Else, it will attempt to update the
+ * attribute with the new value.
+ *
+ * `dataspace_id` ignored if `attribute_id` >= 0
+ */
+static herr_t
+put_attribute(hid_t loc_id, const char *attrname, const void *attrvalue, hid_t datatype_id, hid_t dataspace_id, hid_t *attribute_id)
+{
+ if((*attribute_id) < 0) {
+ hid_t id = -1;
+ id = H5Acreate2(loc_id, attrname, datatype_id, dataspace_id, H5P_DEFAULT, H5P_DEFAULT);
+ if(id < 0)
+ return FAIL;
+ *attribute_id = id;
+ }
+ return H5Awrite(*attribute_id, datatype_id, attrvalue);
+} /* put_attribute */
+
+/*
+ * Count the number of attributes attached to an object.
+ * Returns negative in event of error.
+ */
+static int
+count_attributes(hid_t dset_id)
+{
+ H5O_info_t info;
+
+ if(H5Oget_info2(dset_id, &info, H5O_INFO_ALL) < 0)
+ return -1;
+ else
+ return (int)info.num_attrs; /* should never exceed int bounds */
+} /* count_attributes */
+
+/*
+ * Get the total space used by the object header.
+ * Used by oh_compare()
+ * On success, stores size in `size_out` pointer.
+ */
+static herr_t
+_oh_getsize(hid_t did, hsize_t *size_out)
+{
+ H5O_info_t info;
+ if(FAIL == H5Oget_info2(did, &info, H5O_INFO_HDR))
+ return FAIL;
+ *size_out = info.hdr.space.total;
+ return SUCCEED;
+} /* _oh_getsize */
+
+/*
+ * Compare the TOTAL space used by datasets' object headers.
+ * Returns negative value if an error occurred,
+ * else positive #defined indicator value EQ, LT, GT.
+ */
+static int
+oh_compare(hid_t did1, hid_t did2)
+{
+ hsize_t space1 = 0;
+ hsize_t space2 = 0;
+
+ if(FAIL == _oh_getsize(did1, &space1))
+ return -1;
+ if(FAIL == _oh_getsize(did2, &space2))
+ return -2;
+
+ if(space1 < space2)
+ return LT;
+ else if(space1 > space2)
+ return GT;
+ else
+ return EQ;
+} /* oh_compare() */
+
+/*
+ * Demonstrate attribute addition to datasets.
+ * Conduct additions side-by-side with a standard datataset and one with
+ * minimized dataset object headers.
+ */
+static herr_t
+test_minimized_dset_ohdr_attribute_addition(hid_t fapl_id)
+{
+ hsize_t array_10[1] = {10}; /* dataspace extent */
+ char buffer[10] = ""; /* to inspect string attribute */
+ int a_out = 0;
+ char filename[512] = "";
+ hid_t int_type_id = -1;
+ hid_t char_type_id = -1;
+ hid_t dcpl_id = -1;
+ hid_t dspace_id = -1;
+ hid_t dspace_scalar_id = -1;
+ hid_t dset_id = -1;
+ hid_t mindset_id = -1;
+ hid_t attr_1_id = -1;
+ hid_t attr_1a_id = -1;
+ hid_t attr_2_id = -1;
+ hid_t attr_2a_id = -1;
+ hid_t attr_3_id = -1;
+ hid_t attr_3a_id = -1;
+ hid_t file_id = -1;
+ herr_t ret;
+ int count = 0;
+
+ TESTING("minimized dset object headers attribute additions")
+
+ /*********
+ * SETUP *
+ *********/
+
+ if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
+ TEST_ERROR
+
+ dspace_id = H5Screate_simple(1, array_10, NULL);
+ if(dspace_id < 0) TEST_ERROR
+
+ dspace_scalar_id = H5Screate(H5S_SCALAR);
+ if(dspace_scalar_id < 0) TEST_ERROR
+
+ char_type_id = H5Tcopy(H5T_NATIVE_CHAR);
+ if(char_type_id < 0) TEST_ERROR
+
+ int_type_id = H5Tcopy(H5T_NATIVE_INT);
+ if(int_type_id < 0) TEST_ERROR
+
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_id < 0) TEST_ERROR
+
+ ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_id < 0) TEST_ERROR
+
+ H5E_BEGIN_TRY {
+ count = count_attributes(dset_id);
+ } H5E_END_TRY;
+ if(count != -1) TEST_ERROR
+
+ dset_id = H5Dcreate2(file_id, "dataset", int_type_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if(dset_id < 0) TEST_ERROR
+
+ mindset_id = H5Dcreate2(file_id, "mindataset", int_type_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ if(mindset_id < 0) TEST_ERROR
+
+ /********************
+ * TEST/DEMONSTRATE *
+ ********************/
+
+ /* -------------------
+ * no attributes added
+ */
+
+ count = count_attributes(dset_id);
+ if(count != 0) TEST_ERROR
+ count = count_attributes(mindset_id);
+ if(count != 0) TEST_ERROR
+
+ /* -----------------
+ * add one attribute
+ */
+ ret = put_attribute(dset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1_id);
+ if(ret < 0) TEST_ERROR
+
+ ret = put_attribute(mindset_id, "PURPOSE", "DEMO", char_type_id, dspace_id, &attr_1a_id);
+ if(ret < 0) TEST_ERROR
+
+ count = count_attributes(dset_id);
+ if(count != 1) TEST_ERROR
+ count = count_attributes(mindset_id);
+ if(count != 1) TEST_ERROR
+
+ ret = H5Aread(attr_1_id, char_type_id, buffer);
+ if(ret < 0) TEST_ERROR
+ if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+
+ ret = H5Aread(attr_1a_id, char_type_id, buffer);
+ if(ret < 0) TEST_ERROR
+ if(HDstrcmp("DEMO", buffer)) TEST_ERROR
+
+ /* -----------------
+ * modify one attribute
+ */
+
+ ret = put_attribute(dset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1_id);
+ if(ret < 0) TEST_ERROR
+
+ ret = put_attribute(mindset_id, "PURPOSE", "REWRITE", char_type_id, -1, &attr_1a_id);
+ if(ret < 0) TEST_ERROR
+
+ count = count_attributes(dset_id);
+ if(count != 1) TEST_ERROR
+ count = count_attributes(mindset_id);
+ if(count != 1) TEST_ERROR
+
+ ret = H5Aread(attr_1_id, char_type_id, buffer);
+ if(ret < 0) TEST_ERROR
+ if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+
+ ret = H5Aread(attr_1a_id, char_type_id, buffer);
+ if(ret < 0) TEST_ERROR
+ if(HDstrcmp("REWRITE", buffer)) TEST_ERROR
+
+ /* -----------------
+ * add second attribute
+ */
+
+ a_out = 5;
+ ret = put_attribute(dset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2_id);
+ if(ret < 0) TEST_ERROR
+
+ a_out = 3;
+ ret = put_attribute(mindset_id, "RANK", &a_out, int_type_id, dspace_scalar_id, &attr_2a_id);
+ if(ret < 0) TEST_ERROR
+
+ count = count_attributes(dset_id);
+ if(count != 2) TEST_ERROR
+ count = count_attributes(mindset_id);
+ if(count != 2) TEST_ERROR
+
+ ret = H5Aread(attr_2_id, int_type_id, &a_out);
+ if(ret < 0) TEST_ERROR
+ if(a_out != 5) TEST_ERROR
+
+ ret = H5Aread(attr_2a_id, int_type_id, &a_out);
+ if(ret < 0) TEST_ERROR
+ if(a_out != 3) TEST_ERROR
+
+ /* -----------------
+ * add third attribute
+ */
+
+ a_out = -86;
+ ret = put_attribute(dset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3_id);
+ if(ret < 0) TEST_ERROR
+
+ a_out = 2185;
+ ret = put_attribute(mindset_id, "FLAVOR", &a_out, int_type_id, dspace_scalar_id, &attr_3a_id);
+ if(ret < 0) TEST_ERROR
+
+ count = count_attributes(dset_id);
+ if(count != 3) TEST_ERROR
+ count = count_attributes(mindset_id);
+ if(count != 3) TEST_ERROR
+
+ ret = H5Aread(attr_3_id, int_type_id, &a_out);
+ if(ret < 0) TEST_ERROR
+ if(a_out != -86) TEST_ERROR
+
+ ret = H5Aread(attr_3a_id, int_type_id, &a_out);
+ if(ret < 0) TEST_ERROR
+ if(a_out != 2185) TEST_ERROR
+
+ /************
+ * TEARDOWN *
+ ************/
+
+ if(H5Tclose(int_type_id) < 0) TEST_ERROR
+ if(H5Tclose(char_type_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_id) < 0) TEST_ERROR
+ if(H5Sclose(dspace_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_id) < 0) TEST_ERROR
+ if(H5Dclose(mindset_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_1_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_1a_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_2_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_2a_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_3_id) < 0) TEST_ERROR
+ if(H5Aclose(attr_3a_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED()
+ return SUCCEED;
+
+error :
+ H5E_BEGIN_TRY {
+ (void)H5Tclose(int_type_id);
+ (void)H5Tclose(char_type_id);
+ (void)H5Pclose(dcpl_id);
+ (void)H5Sclose(dspace_id);
+ (void)H5Dclose(dset_id);
+ (void)H5Dclose(mindset_id);
+ (void)H5Aclose(attr_1_id);
+ (void)H5Aclose(attr_1a_id);
+ (void)H5Aclose(attr_2_id);
+ (void)H5Aclose(attr_2a_id);
+ (void)H5Aclose(attr_3_id);
+ (void)H5Aclose(attr_3a_id);
+ (void)H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* test_minimized_dset_ohdr_attribute_addition */
+
+/*
+ * Compare header sizes against when headers have been minimized.
+ * Repeats tests with headers "compact" and normal.
+ */
+static herr_t
+test_minimized_dset_ohdr_size_comparisons(hid_t fapl_id)
+{
+ hsize_t array_10[1] = {10}; /* dataspace extents */
+ unsigned compact = 0;
+
+ /* IDs that are file-agnostic */
+ hid_t dspace_id = -1;
+ hid_t int_type_id = -1;
+ hid_t dcpl_minimize = -1;
+ hid_t dcpl_dontmin = -1;
+ hid_t dcpl_default = -1;
+
+ /* IDs for non-minimized file open */
+ hid_t file_f_id = -1; /* lower 'f' for standard file setting */
+ hid_t dset_f_x_id = -1; /* 'x' for default */
+ hid_t dset_f_N_id = -1; /* 'N' for explcit non-minimized dset */
+ hid_t dset_f_Y_id = -1; /* 'Y' for minimized dset */
+
+ /* IDs for minimized file open */
+ hid_t file_F_id = -1; /* upper 'F' for minimized file setting */
+ hid_t dset_F_x_id = -1; /* 'x' for default */
+ hid_t dset_F_N_id = -1; /* 'N' for explcit non-minimized dset */
+ hid_t dset_F_Y_id = -1; /* 'Y' for minimized dset */
+
+ char filename_a[512] = "";
+ char filename_b[512] = "";
+
+ herr_t ret;
+
+ /* dataset suffixes:
+ * | default | minimize | don't minimize (dcpl-set)
+ * ---------------+---------+----------+---------------
+ * file-default | f_x | f_Y | f_N
+ * ---------------+---------+----------+---------------
+ * file-minimized | F_x | F_Y | F_N
+ */
+
+ TESTING("minimized dset object headers size comparisons");
+
+ /*********
+ * SETUP *
+ *********/
+
+ if(h5_fixname(FILENAME[1], fapl_id, filename_a, sizeof(filename_a)) == NULL)
+ TEST_ERROR
+
+ if(h5_fixname(FILENAME[2], fapl_id, filename_b, sizeof(filename_b)) == NULL)
+ TEST_ERROR
+
+ for (compact = 0; compact < 2; compact++) { /* 0 or 1 */
+ dcpl_default = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_default < 0) TEST_ERROR
+
+ dcpl_minimize = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_minimize < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_minimize, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dcpl_dontmin = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_dontmin < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_dontmin, FALSE);
+ if(ret < 0) TEST_ERROR
+
+ if(compact) {
+ HDprintf("...compact ");
+ ret = H5Pset_layout(dcpl_default, H5D_COMPACT);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_layout(dcpl_minimize, H5D_COMPACT);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_layout(dcpl_dontmin, H5D_COMPACT);
+ if(ret < 0) TEST_ERROR
+ } else
+ HDprintf("...not compact ");
+
+ dspace_id = H5Screate_simple(1, array_10, NULL);
+ if(dspace_id < 0) TEST_ERROR
+
+ int_type_id = H5Tcopy(H5T_NATIVE_INT);
+ if(int_type_id < 0) TEST_ERROR
+
+ file_f_id = H5Fcreate(filename_a, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_f_id < 0) TEST_ERROR
+
+ dset_f_x_id = H5Dcreate2(file_f_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
+ if(dset_f_x_id < 0) TEST_ERROR
+
+ dset_f_N_id = H5Dcreate2(file_f_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
+ if(dset_f_N_id < 0) TEST_ERROR
+
+ dset_f_Y_id = H5Dcreate2(file_f_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
+ if(dset_f_x_id < 0) TEST_ERROR
+
+ file_F_id = H5Fcreate(filename_b, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_F_id < 0) TEST_ERROR
+ ret = H5Fset_dset_no_attrs_hint(file_F_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dset_F_x_id = H5Dcreate2(file_F_id, "default", int_type_id, dspace_id, H5P_DEFAULT, dcpl_default, H5P_DEFAULT);
+ if(dset_F_x_id < 0) TEST_ERROR
+
+ dset_F_N_id = H5Dcreate2(file_F_id, "dsetNOT", int_type_id, dspace_id, H5P_DEFAULT, dcpl_dontmin, H5P_DEFAULT);
+ if(dset_F_N_id < 0) TEST_ERROR
+
+ dset_F_Y_id = H5Dcreate2(file_F_id, "dsetMIN", int_type_id, dspace_id, H5P_DEFAULT, dcpl_minimize, H5P_DEFAULT);
+ if(dset_F_Y_id < 0) TEST_ERROR
+
+ /*********
+ * TESTS *
+ *********/
+
+ if(oh_compare(dset_f_x_id, dset_f_x_id) != EQ) TEST_ERROR /* identity */
+
+ if(oh_compare(dset_f_x_id, dset_f_N_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_f_x_id, dset_f_Y_id) != GT) TEST_ERROR
+ if(oh_compare(dset_f_N_id, dset_f_Y_id) != GT) TEST_ERROR
+
+ if(oh_compare(dset_F_x_id, dset_F_N_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_F_x_id, dset_F_Y_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_F_N_id, dset_F_Y_id) != EQ) TEST_ERROR
+
+ if(oh_compare(dset_F_x_id, dset_f_Y_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_F_x_id, dset_f_x_id) != LT) TEST_ERROR
+
+ /************
+ * TEARDOWN *
+ ************/
+
+ if(H5Sclose(dspace_id) < 0) TEST_ERROR
+ if(H5Tclose(int_type_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_default) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_minimize) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_dontmin) < 0) TEST_ERROR
+
+ if(H5Fclose(file_f_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_f_x_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_f_N_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_f_Y_id) < 0) TEST_ERROR
+
+ if(H5Fclose(file_F_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_F_x_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_F_N_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_F_Y_id) < 0) TEST_ERROR
+
+ } /* compact and non-compact */
+
+ PASSED()
+ return SUCCEED;
+
+error :
+ H5E_BEGIN_TRY {
+ (void)H5Pclose(dcpl_default);
+ (void)H5Pclose(dcpl_minimize);
+ (void)H5Pclose(dcpl_dontmin);
+ (void)H5Sclose(dspace_id);
+ (void)H5Tclose(int_type_id);
+
+ (void)H5Fclose(file_f_id);
+ (void)H5Dclose(dset_f_x_id);
+ (void)H5Dclose(dset_f_N_id);
+ (void)H5Dclose(dset_f_Y_id);
+
+ (void)H5Fclose(file_F_id);
+ (void)H5Dclose(dset_F_x_id);
+ (void)H5Dclose(dset_F_N_id);
+ (void)H5Dclose(dset_F_Y_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* test_minimized_dset_ohdr_size_comparisons */
+
+/*
+ * Test minimized dataset object header with filter/pipeline message
+ */
+static herr_t
+test_minimized_dset_ohdr_with_filter(hid_t fapl_id)
+{
+ char filename[512] = "";
+ const hsize_t extents[1] = {1024}; /* extents of dataspace */
+ const unsigned filter_values[] = {0}; /* TBD */
+ const hsize_t chunk_dim[] = {32}; /* needed for filter */
+ const int ndims = 1;
+ hid_t dspace_id = -1;
+ hid_t dtype_id = -1;
+ hid_t dcpl_xZ_id = -1;
+ hid_t dcpl_mx_id = -1;
+ hid_t dcpl_mZ_id = -1;
+ hid_t dset_xx_id = -1;
+ hid_t dset_xZ_id = -1;
+ hid_t dset_mx_id = -1;
+ hid_t dset_mZ_id = -1;
+ hid_t file_id = -1;
+ herr_t ret;
+
+ /* dcpl suffixes:
+ * | default | minimize
+ * ----------+---------+---------
+ * no filter | xx | mx
+ * ----------+---------+---------
+ * filter | xZ | mZ
+ */
+
+ TESTING("minimized dset object headers with filter message");
+
+ /*********
+ * SETUP *
+ *********/
+
+ if(h5_fixname(FILENAME[1], fapl_id, filename, sizeof(filename)) == NULL)
+ TEST_ERROR
+
+ dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_mx_id < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dcpl_xZ_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_xZ_id < 0) TEST_ERROR
+ ret = H5Pset_chunk(dcpl_xZ_id, ndims, chunk_dim);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_filter(dcpl_xZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values);
+ if(ret < 0) TEST_ERROR
+ dcpl_mZ_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_mZ_id < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_mZ_id, TRUE);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_chunk(dcpl_mZ_id, ndims, chunk_dim);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_filter( dcpl_mZ_id, H5Z_FILTER_DEFLATE, H5Z_FLAG_OPTIONAL, 0, filter_values);
+ if(ret < 0) TEST_ERROR
+
+ dspace_id = H5Screate_simple(1, extents, extents);
+ if(dspace_id < 0) TEST_ERROR
+
+ dtype_id = H5Tcopy(H5T_NATIVE_INT);
+ if(dtype_id < 0) TEST_ERROR
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_id < 0) TEST_ERROR
+
+ dset_xx_id = H5Dcreate2(file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if(dset_xx_id < 0) TEST_ERROR
+
+ dset_mx_id = H5Dcreate2(file_id, "Mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT);
+ if(dset_mx_id < 0) TEST_ERROR
+
+ dset_xZ_id = H5Dcreate2(file_id, "xZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xZ_id, H5P_DEFAULT);
+ if(dset_xZ_id < 0) TEST_ERROR
+
+ dset_mZ_id = H5Dcreate2(file_id, "MZ", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mZ_id, H5P_DEFAULT);
+ if(dset_mZ_id < 0) TEST_ERROR
+
+ /*********
+ * TESTS *
+ *********/
+
+ if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR
+ if(oh_compare(dset_mx_id, dset_xZ_id) != LT) TEST_ERROR
+ if(oh_compare(dset_mZ_id, dset_mx_id) != GT) TEST_ERROR
+ if(oh_compare(dset_mZ_id, dset_xZ_id) != LT) TEST_ERROR
+
+ /************
+ * TEARDOWN *
+ ************/
+
+ if(H5Sclose(dspace_id) < 0) TEST_ERROR
+ if(H5Tclose(dtype_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_xZ_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_mZ_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_xx_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_xZ_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_mx_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_mZ_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+
+ PASSED()
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ (void)H5Sclose(dspace_id);
+ (void)H5Tclose(dtype_id);
+ (void)H5Pclose(dcpl_xZ_id);
+ (void)H5Pclose(dcpl_mx_id);
+ (void)H5Pclose(dcpl_mZ_id);
+ (void)H5Dclose(dset_xx_id);
+ (void)H5Dclose(dset_xZ_id);
+ (void)H5Dclose(dset_mx_id);
+ (void)H5Dclose(dset_mZ_id);
+ (void)H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* test_minimized_dset_ohdr_with_filter */
+
+/*
+ * Test minimized dataset object header and recording modification times.
+ */
+static herr_t
+test_minimized_dset_ohdr_modification_times(hid_t _fapl_id)
+{
+ /* test-local structure for parameterized testing
+ */
+ struct testcase {
+ unsigned oh_version;
+ };
+
+ char filename[512] = "";
+ const hsize_t extents[1] = {128}; /* extents of dataspace */
+ hid_t dspace_id = -1;
+ hid_t dtype_id = -1;
+ hid_t dcpl_xT_id = -1; /* Track modtime */
+ hid_t dcpl_mx_id = -1; /* minimized */
+ hid_t dcpl_mT_id = -1; /* minimized, Track */
+ hid_t dcpl_mN_id = -1; /* minimized, do Not track */
+ hid_t dset_xx_id = -1;
+ hid_t dset_xT_id = -1;
+ hid_t dset_mx_id = -1;
+ hid_t dset_mT_id = -1;
+ hid_t dset_mN_id = -1;
+ hid_t file_id = -1;
+ hid_t fapl_id = -1;
+ herr_t ret;
+
+ unsigned i = 0; /* for testcase loop */
+ unsigned n_cases = 2; /* must match `cases` array size below */
+ struct testcase cases[2] = {
+ { 1, }, /* version 1 object header */
+ { 2, }, /* version 2 object header */
+ };
+
+ /* dcpl suffixes:
+ * | default | minimize
+ * ------------+---------+---------
+ * default | xx | mx
+ * ------------+---------+---------
+ * don't track | xN | mN
+ * ------------+---------+---------
+ * track | xT | mT
+ */
+
+ TESTING("minimized dset object headers with modification times");
+
+ /*********
+ * SETUP *
+ *********/
+
+ if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL)
+ TEST_ERROR
+
+ dcpl_mx_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_mx_id < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_mx_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dcpl_xT_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_xT_id < 0) TEST_ERROR
+ ret = H5Pset_obj_track_times(dcpl_xT_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dcpl_mT_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_mT_id < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_mT_id, TRUE);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_obj_track_times(dcpl_mT_id, TRUE);
+ if(ret < 0) TEST_ERROR
+
+ dcpl_mN_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_mN_id < 0) TEST_ERROR
+ ret = H5Pset_dset_no_attrs_hint(dcpl_mN_id, TRUE);
+ if(ret < 0) TEST_ERROR
+ ret = H5Pset_obj_track_times(dcpl_mN_id, FALSE);
+ if(ret < 0) TEST_ERROR
+
+ dspace_id = H5Screate_simple(1, extents, extents);
+ if(dspace_id < 0) TEST_ERROR
+
+ dtype_id = H5Tcopy(H5T_NATIVE_INT);
+ if(dtype_id < 0) TEST_ERROR
+
+ for (i = 0; i < n_cases; i++) {
+
+ /* -------------- *
+ * per-case setup *
+ * -------------- */
+
+ if(cases[i].oh_version > 1) {
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ if(fapl_id < 0) TEST_ERROR
+ ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_V110);
+ if(ret < 0) TEST_ERROR
+ } else {
+ fapl_id = H5Pcopy(_fapl_id);
+ if(fapl_id < 0) TEST_ERROR
+ }
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_id < 0) TEST_ERROR
+
+ dset_xx_id = H5Dcreate2( file_id, "xx", dtype_id, dspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if(dset_xx_id < 0) TEST_ERROR
+
+ dset_mx_id = H5Dcreate2(file_id, "mx", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mx_id, H5P_DEFAULT);
+ if(dset_mx_id < 0) TEST_ERROR
+
+ dset_xT_id = H5Dcreate2(file_id, "xT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_xT_id, H5P_DEFAULT);
+ if(dset_xT_id < 0) TEST_ERROR
+ dset_mT_id = H5Dcreate2(file_id, "mT", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mT_id, H5P_DEFAULT);
+ if(dset_mT_id < 0) TEST_ERROR
+
+ dset_mN_id = H5Dcreate2(file_id, "mN", dtype_id, dspace_id, H5P_DEFAULT, dcpl_mN_id, H5P_DEFAULT);
+ if(dset_mN_id < 0) TEST_ERROR
+
+ /* ----- *
+ * TESTS *
+ * ----- */
+
+ /* sanity check */
+ if(oh_compare(dset_mx_id, dset_xx_id) != LT) TEST_ERROR
+ if(oh_compare(dset_mx_id, dset_xT_id) != LT) TEST_ERROR
+
+ if(oh_compare(dset_xx_id, dset_xT_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_mx_id, dset_mT_id) != EQ) TEST_ERROR
+ if(oh_compare(dset_mN_id, dset_mT_id) != LT) TEST_ERROR
+
+ if(oh_compare(dset_mT_id, dset_xT_id) != LT) TEST_ERROR
+
+ /* ----------------- *
+ * per-case teardown *
+ * ----------------- */
+
+ if(H5Dclose(dset_xx_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_xT_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_mx_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_mT_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_mN_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR
+ if(H5Pclose(fapl_id) < 0) TEST_ERROR
+
+ } /* for each version tested */
+
+ /************
+ * TEARDOWN *
+ ************/
+
+ if(H5Sclose(dspace_id) < 0) TEST_ERROR
+ if(H5Tclose(dtype_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_xT_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_mx_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_mT_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_mN_id) < 0) TEST_ERROR
+
+ PASSED()
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ (void)H5Sclose(dspace_id);
+ (void)H5Tclose(dtype_id);
+ (void)H5Pclose(dcpl_xT_id);
+ (void)H5Pclose(dcpl_mx_id);
+ (void)H5Pclose(dcpl_mT_id);
+ (void)H5Pclose(dcpl_mN_id);
+ (void)H5Dclose(dset_xx_id);
+ (void)H5Dclose(dset_xT_id);
+ (void)H5Dclose(dset_mx_id);
+ (void)H5Dclose(dset_mT_id);
+ (void)H5Dclose(dset_mN_id);
+ (void)H5Fclose(file_id);
+ (void)H5Pclose(fapl_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* test_minimized_dset_ohdr_modification_times */
+
+/*
+ * Test minimized dataset object header with a fill value set.
+ */
+static herr_t
+test_minimized_dset_ohdr_fillvalue_backwards_compatability(hid_t _fapl_id)
+{
+ char filename[512] = "";
+ const hsize_t extents[1] = {64}; /* extents of dataspace */
+ const int fill[1] = {343}; /* fill value of dataset */
+ hid_t file_id = -1;
+ hid_t dtype_id = -1;
+ hid_t dspace_id = -1;
+ hid_t dcpl_id = -1;
+ hid_t fapl_id = -1;
+ hid_t dset_0_id = -1;
+ hid_t dset_1_id = -1;
+ herr_t ret;
+
+ /*********
+ * SETUP *
+ *********/
+
+ TESTING("minimized dset object headers with fill values and different libver support");
+
+ if(h5_fixname(FILENAME[1], _fapl_id, filename, sizeof(filename)) == NULL)
+ TEST_ERROR
+
+ dspace_id = H5Screate_simple(1, extents, extents);
+ if(dspace_id < 0) TEST_ERROR
+
+ dtype_id = H5Tcopy(H5T_NATIVE_INT);
+ if(dtype_id < 0) TEST_ERROR
+
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ if(dcpl_id < 0) TEST_ERROR
+
+ ret = H5Pset_dset_no_attrs_hint(dcpl_id, TRUE);
+ if(ret == FAIL) TEST_ERROR;
+
+ ret = H5Pset_fill_value(dcpl_id, dtype_id, fill);
+ if(ret == FAIL) TEST_ERROR;
+
+ fapl_id = H5Pcopy(_fapl_id);
+ if(fapl_id < 0) TEST_ERROR
+
+ ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_EARLIEST, H5F_LIBVER_LATEST);
+ if(ret == FAIL) TEST_ERROR;
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ if(file_id < 0) TEST_ERROR
+
+ dset_0_id = H5Dcreate2(file_id, "fullrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ if(dset_0_id < 0) TEST_ERROR
+
+ /* Close file and re-open with different libver bounds.
+ * Dataset "fullrange" must also be closed for expected reopen behavior.
+ */
+ if(H5Fclose(file_id) < 0) TEST_ERROR;
+ if(H5Dclose(dset_0_id) < 0) TEST_ERROR
+
+ ret = H5Pset_libver_bounds(fapl_id, H5F_LIBVER_V18, H5F_LIBVER_LATEST);
+ if(ret == FAIL) TEST_ERROR;
+
+ file_id = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
+ if(file_id < 0) TEST_ERROR
+
+ dset_1_id = H5Dcreate2(file_id, "upperrange", dtype_id, dspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ if(dset_1_id < 0) TEST_ERROR
+
+ /* re-open "fullrange" dataset
+ */
+ dset_0_id = H5Dopen2(file_id, "fullrange", H5P_DEFAULT);
+ if(dset_0_id < 0) TEST_ERROR
+
+ /*********
+ * TESTS *
+ *********/
+
+ /* dset not supporting pre-1.08 should be smaller? */
+ if(oh_compare(dset_1_id, dset_0_id) != LT) TEST_ERROR
+
+ /************
+ * TEARDOWN *
+ ************/
+
+ if(H5Sclose(dspace_id) < 0) TEST_ERROR
+ if(H5Tclose(dtype_id) < 0) TEST_ERROR
+ if(H5Pclose(dcpl_id) < 0) TEST_ERROR
+ if(H5Pclose(fapl_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_0_id) < 0) TEST_ERROR
+ if(H5Dclose(dset_1_id) < 0) TEST_ERROR
+ if(H5Fclose(file_id) < 0) TEST_ERROR;
+
+ PASSED()
+ return SUCCEED;
+
+error:
+ H5E_BEGIN_TRY {
+ (void)H5Sclose(dspace_id);
+ (void)H5Tclose(dtype_id);
+ (void)H5Pclose(dcpl_id);
+ (void)H5Pclose(fapl_id);
+ (void)H5Dclose(dset_0_id);
+ (void)H5Dclose(dset_1_id);
+ (void)H5Fclose(file_id);
+ } H5E_END_TRY;
+ return FAIL;
+} /* test_minimized_dset_ohdr_fillvalue_backwards_compatability */
+
+/*
* Verify that messages are moved forward into a "continuation message":
* Create an object header with several continuation chunks
* Remove a message in the last chunk
@@ -513,6 +1399,16 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
PASSED();
+ TESTING("object with unknown header message & 'shareable' flag set");
+
+ /* Open the dataset with the unknown header message, adn "shareable" flag */
+ if((did = H5Dopen2(loc_bogus, "Dataset5", H5P_DEFAULT)) < 0)
+ FAIL_STACK_ERROR
+ if(H5Dclose(did) < 0)
+ FAIL_STACK_ERROR
+
+ PASSED();
+
TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set");
/* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */
@@ -1033,6 +1929,21 @@ main(void)
if(test_ohdr_cache(filename, fapl) < 0)
TEST_ERROR
+ if(test_minimized_dset_ohdr_attribute_addition(fapl) < 0)
+ TEST_ERROR
+
+ if(test_minimized_dset_ohdr_size_comparisons(fapl) < 0)
+ TEST_ERROR
+
+ if(test_minimized_dset_ohdr_with_filter(fapl) < 0)
+ TEST_ERROR
+
+ if(test_minimized_dset_ohdr_modification_times(fapl) < 0)
+ TEST_ERROR
+
+ if(test_minimized_dset_ohdr_fillvalue_backwards_compatability(fapl) < 0)
+ TEST_ERROR
+
} /* high */
} /* low */
diff --git a/test/tattr.c b/test/tattr.c
index 4358d4c..9b6ae90 100644
--- a/test/tattr.c
+++ b/test/tattr.c
@@ -157,6 +157,12 @@ typedef struct {
static herr_t attr_op1(hid_t loc_id, const char *name, const H5A_info_t *ainfo,
void *op_data);
+/* Global dcpl ID, can be re-set as a generated dcpl for various operations
+ * across multiple tests.
+ * e.g., minimized dataset object headers
+ */
+static hid_t dcpl_g = H5P_DEFAULT;
+
/****************************************************************
@@ -196,7 +202,7 @@ test_attr_basic_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -516,7 +522,7 @@ test_attr_flush(hid_t fapl)
spc = H5Screate(H5S_SCALAR);
CHECK(spc, FAIL, "H5Screate");
- set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ set = H5Dcreate2(fil, DSET1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(set, FAIL, "H5Dcreate2");
att = H5Acreate2(set, ATTR1_NAME, H5T_NATIVE_DOUBLE, spc, H5P_DEFAULT, H5P_DEFAULT);
@@ -587,7 +593,7 @@ test_attr_plist(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -701,7 +707,7 @@ test_attr_compound_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataset's dataspace */
@@ -937,7 +943,7 @@ test_attr_scalar_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -1078,7 +1084,7 @@ test_attr_mult_write(hid_t fapl)
CHECK(sid1, FAIL, "H5Screate_simple");
/* Create a dataset */
- dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataset's dataspace */
@@ -1456,7 +1462,7 @@ test_attr_iterate(hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create a new dataset */
- dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(file, DSET2_NAME, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Close dataspace */
@@ -1681,7 +1687,7 @@ test_attr_dtype_shared(hid_t fapl)
CHECK(space_id, FAIL, "H5Screate");
/* Create dataset */
- dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dset_id = H5Dcreate2(file_id, DSET1_NAME, type_id, space_id, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dset_id, FAIL, "H5Dcreate2");
/* Check reference count on named datatype */
@@ -1835,7 +1841,7 @@ test_attr_duplicate_ids(hid_t fapl)
/* Create a dataset */
dataset = H5Dcreate2(fid1, DSET1_NAME, H5T_NATIVE_UCHAR, sid1, H5P_DEFAULT,
- H5P_DEFAULT, H5P_DEFAULT);
+ dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
/* Create dataspace for attribute */
@@ -2161,7 +2167,7 @@ test_attr_dense_create(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -2292,7 +2298,7 @@ test_attr_dense_open(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Enable creation order tracking on attributes, so creation order tests work */
@@ -2405,14 +2411,27 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
h5_stat_size_t empty_filesize; /* Size of empty file */
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Deleting Attributes in Dense Storage\n"));
/* Create file */
+ if (use_min_dset_oh) { /* using minimized dataset headers */
+ /* modify fcpl...
+ * sidestep "bug" where file space is lost with minimized dset ohdrs
+ */
+ fcpl = H5Pcopy(fcpl);
+ CHECK(fcpl, FAIL, "H5Pcopy");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ }
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
+ if (use_min_dset_oh)
+ CHECK(H5Pclose(fcpl), FAIL, "H5Pclose");
+
/* Close file */
ret = H5Fclose(fid);
@@ -2432,7 +2451,7 @@ test_attr_dense_delete(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Enable creation order tracking on attributes, so creation order tests work */
@@ -2584,14 +2603,26 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Renaming Attributes in Dense Storage\n"));
/* Create file */
+ if (use_min_dset_oh) { /* using minimized dataset headers */
+ /* modify fcpl...
+ * sidestep "bug" where file space is lost with minimized dset ohdrs
+ */
+ fcpl = H5Pcopy(fcpl);
+ CHECK(fcpl, FAIL, "H5Pcopy");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ }
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
CHECK(fid, FAIL, "H5Fcreate");
+ if (use_min_dset_oh)
+ CHECK(H5Pclose(fcpl), FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid);
@@ -2611,7 +2642,7 @@ test_attr_dense_rename(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -2743,14 +2774,26 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
h5_stat_size_t filesize; /* Size of file after modifications */
H5O_info_t oinfo; /* Object info */
unsigned u; /* Local index variable */
+ int use_min_dset_oh = (dcpl_g != H5P_DEFAULT);
herr_t ret; /* Generic return value */
/* Output message about test being performed */
MESSAGE(5, ("Testing Unlinking Object with Attributes in Dense Storage\n"));
/* Create file */
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
- CHECK(fid, FAIL, "H5Fcreate");
+ if (use_min_dset_oh) { /* using minimized dataset headers */
+ /* modify fcpl...
+ * sidestep "bug" where file space is lost with minimized dset ohdrs
+ */
+ fcpl = H5Pcopy(fcpl);
+ CHECK(fcpl, FAIL, "H5Pcopy");
+ ret = H5Pset_file_space_strategy(fcpl, H5F_FSPACE_STRATEGY_FSM_AGGR, TRUE, 1);
+ CHECK(ret, FAIL, "H5Pset_file_space_strategy");
+ }
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl, fapl);
+ CHECK(fid, FAIL, "H5Fcreate");
+ if (use_min_dset_oh)
+ CHECK(H5Pclose(fcpl), FAIL, "H5Pclose");
/* Close file */
ret = H5Fclose(fid);
@@ -2770,7 +2813,7 @@ test_attr_dense_unlink(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (use_min_dset_oh) ? H5Pcopy(dcpl_g) : H5Pcreate(H5P_DATASET_CREATE);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -2898,7 +2941,7 @@ test_attr_dense_limits(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Change limits on compact/dense attribute storage */
@@ -3065,7 +3108,7 @@ test_attr_dense_dup_ids(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create a dataset */
@@ -3595,7 +3638,7 @@ test_attr_big(hid_t fcpl, hid_t fapl)
CHECK(big_sid, FAIL, "H5Screate_simple");
/* Query the group creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Retrieve limits for compact/dense attribute storage */
@@ -3861,7 +3904,7 @@ test_attr_null_space(hid_t fcpl, hid_t fapl)
CHECK(null_sid, FAIL, "H5Screate");
/* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -4054,7 +4097,7 @@ test_attr_deprec(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create a dataset */
- dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ dataset = H5Dcreate2(fid, DSET1_NAME, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -4290,7 +4333,7 @@ test_attr_corder_create_basic(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Get creation order indexing on object */
@@ -4413,7 +4456,7 @@ test_attr_corder_create_compact(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -4613,7 +4656,7 @@ test_attr_corder_create_dense(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -4948,7 +4991,7 @@ test_attr_corder_transition(hid_t fcpl, hid_t fapl)
CHECK(fid, FAIL, "H5Fcreate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -5359,7 +5402,7 @@ test_attr_corder_delete(hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Set attribute creation order tracking & indexing for object */
@@ -5702,7 +5745,7 @@ test_attr_info_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -5914,7 +5957,7 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -6857,7 +6900,7 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -7218,7 +7261,7 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -7565,7 +7608,7 @@ test_attr_open_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -7819,7 +7862,7 @@ test_attr_create_by_name(hbool_t new_format, hid_t fcpl, hid_t fapl)
CHECK(sid, FAIL, "H5Screate");
/* Create dataset creation property list */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Query the attribute creation properties */
@@ -8120,7 +8163,7 @@ test_attr_shared_write(hid_t fcpl, hid_t fapl)
} /* end if */
/* Set up to query the object creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create datasets */
@@ -8451,7 +8494,7 @@ test_attr_shared_rename(hid_t fcpl, hid_t fapl)
} /* end if */
/* Set up to query the object creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create datasets */
@@ -8897,7 +8940,7 @@ test_attr_shared_delete(hid_t fcpl, hid_t fapl)
} /* end if */
/* Set up to query the object creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create datasets */
@@ -9266,7 +9309,7 @@ test_attr_shared_unlink(hid_t fcpl, hid_t fapl)
} /* end if */
/* Set up to query the object creation properties */
- dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ dcpl = (dcpl_g == H5P_DEFAULT) ? H5Pcreate(H5P_DATASET_CREATE) : H5Pcopy(dcpl_g);
CHECK(dcpl, FAIL, "H5Pcreate");
/* Create datasets */
@@ -9858,7 +9901,7 @@ test_attr_bug3(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Tcommit2");
/* Create dataset */
- did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ did = H5Dcreate2(fid, "dset", tid2, sid2, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
/* Create attribute on datatype, using that datatype as its datatype */
@@ -9993,7 +10036,7 @@ test_attr_bug4(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Tcommit2");
/* Create dataset */
- did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ did = H5Dcreate2(fid, "dset", tid, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(did, FAIL, "H5Dcreate2");
/* Create attributes on group and dataset */
@@ -10075,7 +10118,7 @@ test_attr_bug5(hid_t fcpl, hid_t fapl)
CHECK(ret, FAIL, "H5Tcommit2");
/* Create dataset */
- did1 = H5Dcreate2(fid1, BUG3_DSET_NAME, tid1, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ did1 = H5Dcreate2(fid1, BUG3_DSET_NAME, tid1, sid, H5P_DEFAULT, dcpl_g, H5P_DEFAULT);
CHECK(did1, FAIL, "H5Dcreate2");
/* Create attribute on root group */
@@ -10773,119 +10816,106 @@ test_attr(void)
{
hid_t fapl = (-1), fapl2 = (-1); /* File access property lists */
hid_t fcpl = (-1), fcpl2 = (-1); /* File creation property lists */
+ hid_t dcpl = -1; /* Dataset creation property list */
unsigned new_format; /* Whether to use the new format or not */
unsigned use_shared; /* Whether to use shared attributes or not */
+ unsigned minimize_dset_oh; /* Whether to use minimized dataset object headers */
herr_t ret; /* Generic return value */
- /* Output message about test being performed */
MESSAGE(5, ("Testing Attributes\n"));
- /* Create a default file access property list */
fapl = H5Pcreate(H5P_FILE_ACCESS);
CHECK(fapl, FAIL, "H5Pcreate");
- /* Copy the file access property list */
+ /* fapl2 uses "latest version of the format" for creating objects in the file */
fapl2 = H5Pcopy(fapl);
CHECK(fapl2, FAIL, "H5Pcopy");
-
- /* Set the "use the latest version of the format" bounds for creating objects in the file */
ret = H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST);
CHECK(ret, FAIL, "H5Pset_libver_bounds");
- /* Create a default file creation property list */
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK(fcpl, FAIL, "H5Pcreate");
- /* Copy the file creation property list */
+ /* files with fcpl make all attributes (> 1 byte) shared
+ * i.e., all of them :-)
+ */
fcpl2 = H5Pcopy(fcpl);
CHECK(fcpl2, FAIL, "H5Pcopy");
-
- /* Make attributes > 1 byte shared (i.e. all of them :-) */
ret = H5Pset_shared_mesg_nindexes(fcpl2, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
ret = H5Pset_shared_mesg_index(fcpl2, (unsigned)0, H5O_SHMESG_ATTR_FLAG, (unsigned)1);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- /* Loop over using new group format */
- for(new_format = FALSE; new_format <= TRUE; new_format++) {
- hid_t my_fapl;
-
- /* Set the FAPL for the type of format */
- if(new_format) {
- MESSAGE(7, ("testing with new file format\n"));
- my_fapl = fapl2;
- } /* end if */
- else {
- MESSAGE(7, ("testing with old file format\n"));
- my_fapl = fapl;
- } /* end else */
+ for(minimize_dset_oh = 0; minimize_dset_oh <= 1; minimize_dset_oh++) {
+ if(minimize_dset_oh == 0) {
+ MESSAGE(7, ("testing with default dataset object headers\n"));
+ dcpl_g = H5P_DEFAULT;
+ } else {
+ MESSAGE(7, ("testing with minimzied dataset object headers\n"));
+ dcpl = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(dcpl, FAIL, "H5Pcreate");
+ ret = H5Pset_dset_no_attrs_hint(dcpl, TRUE);
+ CHECK_I(ret, "H5Pset_dset_no_attrs_hint");
+ dcpl_g = dcpl;
+ }
+
+ for(new_format = FALSE; new_format <= TRUE; new_format++) {
+ hid_t my_fapl;
+
+ /* Set the FAPL for the type of format */
+ if(new_format) {
+ MESSAGE(7, ("testing with new file format\n"));
+ my_fapl = fapl2;
+ } /* end if */
+ else {
+ MESSAGE(7, ("testing with old file format\n"));
+ my_fapl = fapl;
+ } /* end else */
- /* These next two tests use the same file information */
- test_attr_basic_write(my_fapl); /* Test basic H5A writing code */
- test_attr_basic_read(my_fapl); /* Test basic H5A reading code */
+ /* These next two tests use the same file information */
+ test_attr_basic_write(my_fapl); /* Test basic H5A writing code */
+ test_attr_basic_read(my_fapl); /* Test basic H5A reading code */
- /* These next two tests use their own file information */
- test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */
- test_attr_plist(my_fapl); /* Test attribute property lists */
+ /* These next two tests use their own file information */
+ test_attr_flush(my_fapl); /* Test H5A I/O in the presence of H5Fflush calls */
+ test_attr_plist(my_fapl); /* Test attribute property lists */
- /* These next two tests use the same file information */
- test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
- test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
+ /* These next two tests use the same file information */
+ test_attr_compound_write(my_fapl); /* Test complex datatype H5A writing code */
+ test_attr_compound_read(my_fapl); /* Test complex datatype H5A reading code */
- /* These next two tests use the same file information */
- test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
- test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */
+ /* These next two tests use the same file information */
+ test_attr_scalar_write(my_fapl); /* Test scalar dataspace H5A writing code */
+ test_attr_scalar_read(my_fapl); /* Test scalar dataspace H5A reading code */
- /* These next four tests use the same file information */
- test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */
- test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */
- test_attr_iterate(my_fapl); /* Test H5A iterator code */
- test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */
+ /* These next four tests use the same file information */
+ test_attr_mult_write(my_fapl); /* Test H5A writing code for multiple attributes */
+ test_attr_mult_read(my_fapl); /* Test H5A reading code for multiple attributes */
+ test_attr_iterate(my_fapl); /* Test H5A iterator code */
+ test_attr_delete(my_fapl); /* Test H5A code for deleting attributes */
- /* This next test uses its own file information */
- test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */
+ /* This next test uses its own file information */
+ test_attr_dtype_shared(my_fapl); /* Test using shared dataypes in attributes */
- /* This next test uses its own file information */
- test_attr_duplicate_ids(my_fapl);
+ /* This next test uses its own file information */
+ test_attr_duplicate_ids(my_fapl);
- /* Tests on "new format" attribute storage */
- if(new_format == TRUE) {
- /* Loop over using shared attributes */
for(use_shared = FALSE; use_shared <= TRUE; use_shared++) {
hid_t my_fcpl;
- /* Set the FCPL for shared or not */
- if(use_shared) {
+ if(new_format == TRUE && use_shared) {
MESSAGE(7, ("testing with shared attributes\n"));
my_fcpl = fcpl2;
- } /* end if */
- else {
+ } else {
MESSAGE(7, ("testing without shared attributes\n"));
my_fcpl = fcpl;
- } /* end else */
-
- /* General attribute tests */
- test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */
- test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */
- test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */
- test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */
- test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */
- test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */
- test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */
+ }
test_attr_big(my_fcpl, my_fapl); /* Test storing big attribute */
test_attr_null_space(my_fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
test_attr_many(new_format, my_fcpl, my_fapl); /* Test storing lots of attributes */
- /* Attribute creation order tests */
- test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */
- test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */
- test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */
- test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */
- test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */
- test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */
-
/* New attribute API routine tests */
test_attr_info_by_idx(new_format, my_fcpl, my_fapl); /* Test querying attribute info by index */
test_attr_delete_by_idx(new_format, my_fcpl, my_fapl); /* Test deleting attribute by index */
@@ -10894,14 +10924,6 @@ test_attr(void)
test_attr_open_by_name(new_format, my_fcpl, my_fapl); /* Test opening attributes by name */
test_attr_create_by_name(new_format, my_fcpl, my_fapl); /* Test creating attributes by name */
- /* More complex tests with both "new format" and "shared" attributes */
- if(use_shared == TRUE) {
- test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */
- test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */
- test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */
- test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */
- } /* end if */
-
/* Tests that address specific bugs */
test_attr_bug1(my_fcpl, my_fapl); /* Test odd allocation operations */
test_attr_bug2(my_fcpl, my_fapl); /* Test many deleted attributes */
@@ -10909,41 +10931,57 @@ test_attr(void)
test_attr_bug4(my_fcpl, my_fapl); /* Test attributes on named datatypes */
test_attr_bug5(my_fcpl, my_fapl); /* Test opening/closing attributes through different file handles */
test_attr_bug6(my_fcpl, my_fapl); /* Test reading empty attribute */
- test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */
+ /* test_attr_bug7 is specific to the "new" object header format,
+ * and in fact fails if used with the old format due to the
+ * attributes being larger than 64K */
test_attr_bug8(my_fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */
test_attr_bug9(my_fcpl, my_fapl); /* Test large attributes converting to dense storage */
- test_attr_delete_last_dense(my_fcpl, my_fapl); /* Test */
- } /* end for */
- } /* end if */
- else {
- /* General attribute tests */
- test_attr_big(fcpl, my_fapl); /* Test storing big attribute */
- test_attr_null_space(fcpl, my_fapl); /* Test storing attribute with NULL dataspace */
- test_attr_deprec(fcpl, my_fapl); /* Test deprecated API routines */
- test_attr_many(new_format, fcpl, my_fapl); /* Test storing lots of attributes */
-
- /* New attribute API routine tests, on old-format storage */
- test_attr_info_by_idx(new_format, fcpl, my_fapl); /* Test querying attribute info by index */
- test_attr_delete_by_idx(new_format, fcpl, my_fapl); /* Test deleting attribute by index */
- test_attr_iterate2(new_format, fcpl, my_fapl); /* Test iterating over attributes by index */
- test_attr_open_by_idx(new_format, fcpl, my_fapl); /* Test opening attributes by index */
- test_attr_open_by_name(new_format, fcpl, my_fapl); /* Test opening attributes by name */
- test_attr_create_by_name(new_format, fcpl, my_fapl); /* Test creating attributes by name */
-
- /* Tests that address specific bugs */
- test_attr_bug1(fcpl, my_fapl); /* Test odd allocation operations */
- test_attr_bug2(fcpl, my_fapl); /* Test many deleted attributes */
- test_attr_bug3(fcpl, my_fapl); /* Test "self referential" attributes */
- test_attr_bug4(fcpl, my_fapl); /* Test attributes on named datatypes */
- test_attr_bug5(fcpl, my_fapl); /* Test opening/closing attributes through different file handles */
- test_attr_bug6(fcpl, my_fapl); /* Test reading empty attribute */
- /* Skip test_attr_bug7 because it is specific to the new object
- * header format and in fact fails if used with the old format, due
- * to the attributes being larger than 64K */
- test_attr_bug8(fcpl, my_fapl); /* Test attribute expanding object header with undecoded messages */
- test_attr_bug9(fcpl, my_fapl); /* Test large attributes converting to dense storage */
- } /* end else */
- } /* end for */
+
+ /* tests specific to the "new format" */
+ if (new_format == TRUE) {
+ /* General attribute tests */
+ test_attr_dense_create(my_fcpl, my_fapl); /* Test dense attribute storage creation */
+ test_attr_dense_open(my_fcpl, my_fapl); /* Test opening attributes in dense storage */
+ test_attr_dense_delete(my_fcpl, my_fapl); /* Test deleting attributes in dense storage */
+ test_attr_dense_rename(my_fcpl, my_fapl); /* Test renaming attributes in dense storage */
+ test_attr_dense_unlink(my_fcpl, my_fapl); /* Test unlinking object with attributes in dense storage */
+ test_attr_dense_limits(my_fcpl, my_fapl); /* Test dense attribute storage limits */
+ test_attr_dense_dup_ids(my_fcpl, my_fapl); /* Test duplicated IDs for dense attribute storage */
+
+ /* Attribute creation order tests */
+ test_attr_corder_create_basic(my_fcpl, my_fapl);/* Test creating an object w/attribute creation order info */
+ test_attr_corder_create_compact(my_fcpl, my_fapl); /* Test compact attribute storage on an object w/attribute creation order info */
+ test_attr_corder_create_dense(my_fcpl, my_fapl);/* Test dense attribute storage on an object w/attribute creation order info */
+ test_attr_corder_create_reopen(my_fcpl, my_fapl);/* Test creating attributes w/reopening file from using new format to using old format */
+ test_attr_corder_transition(my_fcpl, my_fapl); /* Test attribute storage transitions on an object w/attribute creation order info */
+ test_attr_corder_delete(my_fcpl, my_fapl); /* Test deleting object using dense storage w/attribute creation order info */
+
+ /* More complex tests with exclusively both "new format" and "shared" attributes */
+ if(use_shared == TRUE) {
+ test_attr_shared_write(my_fcpl, my_fapl); /* Test writing to shared attributes in compact & dense storage */
+ test_attr_shared_rename(my_fcpl, my_fapl); /* Test renaming shared attributes in compact & dense storage */
+ test_attr_shared_delete(my_fcpl, my_fapl); /* Test deleting shared attributes in compact & dense storage */
+ test_attr_shared_unlink(my_fcpl, my_fapl); /* Test unlinking object with shared attributes in compact & dense storage */
+ } /* if using shared attributes */
+
+ test_attr_delete_last_dense(my_fcpl, my_fapl);
+
+ /* test_attr_bug7 is specific to the "new" object header format,
+ * and in fact fails if used with the old format due to the
+ * attributes being larger than 64K */
+ test_attr_bug7(my_fcpl, my_fapl); /* Test creating and deleting large attributes in ohdr chunk 0 */
+
+ } /* if using "new format" */
+ } /* for unshared/shared attributes */
+ } /* for old/new format */
+
+ if (minimize_dset_oh != 0) {
+ ret = H5Pclose(dcpl);
+ CHECK(ret, FAIL, "H5Pclose");
+ dcpl_g = H5P_DEFAULT;
+ }
+
+ } /* for default/minimized dataset object headers */
/* Close FCPLs */
ret = H5Pclose(fcpl);
diff --git a/test/tbogus.h5 b/test/tbogus.h5
index 91ab76f..efcbd79 100644
--- a/test/tbogus.h5
+++ b/test/tbogus.h5
Binary files differ
diff --git a/test/test_filenotclosed.sh.in b/test/testabort_fail.sh.in
index 0b43c5b..925d8a4 100644
--- a/test/test_filenotclosed.sh.in
+++ b/test/testabort_fail.sh.in
@@ -13,6 +13,9 @@
#
# Test to verify that the assertion/abort failure is fixed when the application
# does not close the file. (See HDFFV-10160)
+#
+# Test to verify that the infinite loop closing library/abort failure is fixed
+# when the application creates and removes dense attributes (See HDFFV-10659)
srcdir=@srcdir@
@@ -20,22 +23,44 @@ nerrors=0
##############################################################################
##############################################################################
-### T H E T E S T ###
+### T H E T E S T S ###
##############################################################################
##############################################################################
-
+#
+#
echo "Testing file not closed assertion/abort failure"
TEST_NAME=filenotclosed # The test name
-TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
#
# Run the test
-#$RUNSERIAL $TEST_BIN >/dev/null 2>&1
-$RUNSERIAL $TEST_BIN 2>&1
+$RUNSERIAL $TEST_BIN >/dev/null 2>&1
exitcode=$?
if [ $exitcode -eq 0 ]; then
echo "Test PASSED"
else
+ echo "Test FAILED"
nerrors="`expr $nerrors + 1`"
- echo "***Error encountered***"
fi
-exit $nerrors
+#
+#
+echo "Testing infinite loop closing library/abort failure"
+TEST_NAME=del_many_dense_attrs # The test name
+TEST_BIN=`pwd`/$TEST_NAME # The path of the test binary
+# Run the test
+$RUNSERIAL $TEST_BIN >/dev/null 2>&1
+exitcode=$?
+if [ $exitcode -eq 0 ]; then
+ echo "Test PASSED"
+else
+ echo "Test FAILED"
+ nerrors="`expr $nerrors + 1`"
+fi
+#
+#
+if test $nerrors -eq 0 ; then
+ echo "All tests for abort failure passed."
+ exit 0
+else
+ echo "Tests for abort failure failed with $nerrors errors."
+ exit 1
+fi
diff --git a/test/tfile.c b/test/tfile.c
index ad7f87f..2784204 100644
--- a/test/tfile.c
+++ b/test/tfile.c
@@ -4967,7 +4967,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create,
#define VERBFNAME "tverbounds_dspace.h5"
#define VERBDSNAME "dataset 1"
#define SPACE1_DIM1 3
-static int
+static void
test_libver_bounds_open(void)
{
hid_t file = -1; /* File ID */
@@ -7051,6 +7051,132 @@ test_incr_filesize(void)
/****************************************************************
**
+** test_min_dset_ohdr():
+** Test API calls to toggle dataset object header minimization.
+**
+** TODO (as separate function?):
+** + setting persists between close and (re)open?
+** + dataset header sizes created while changing value of toggle
+**
+****************************************************************/
+static void
+test_min_dset_ohdr(void)
+{
+ const char basename[] = "min_dset_ohdr_testfile";
+ char filename[FILENAME_LEN] = "";
+ hid_t file_id = -1;
+ hid_t file2_id = -1;
+ hbool_t minimize;
+ herr_t ret;
+
+ MESSAGE(5, ("Testing dataset object header minimization\n"));
+
+ /*********/
+ /* SETUP */
+ /*********/
+
+ h5_fixname(basename, H5P_DEFAULT, filename, sizeof(filename));
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(file_id, "H5Fcreate");
+
+ /*********/
+ /* TESTS */
+ /*********/
+
+ /*----------------------------------------
+ * TEST default value
+ */
+ ret = H5Fget_dset_no_attrs_hint(file_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, FALSE, "minimize flag");
+
+ /*----------------------------------------
+ * TEST set to TRUE
+ */
+ ret = H5Fset_dset_no_attrs_hint(file_id, TRUE);
+ CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint");
+
+ ret = H5Fget_dset_no_attrs_hint(file_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, TRUE, "minimize flag");
+
+ /*----------------------------------------
+ * TEST second file open on same filename
+ */
+ file2_id = H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK_I(file2_id, "H5Fopen");
+
+ /* verify TRUE setting on second open
+ */
+ ret = H5Fget_dset_no_attrs_hint(file_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, TRUE, "minimize flag");
+
+ /* re-set to FALSE on first open
+ */
+ ret = H5Fset_dset_no_attrs_hint(file_id, FALSE);
+ CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint");
+
+ /* verify FALSE set on both opens
+ */
+ ret = H5Fget_dset_no_attrs_hint(file_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, FALSE, "minimize flag");
+
+ ret = H5Fget_dset_no_attrs_hint(file2_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, FALSE, "minimize flag");
+
+ /* re-set to TRUE on second open
+ */
+ ret = H5Fset_dset_no_attrs_hint(file2_id, TRUE);
+ CHECK(ret, FAIL, "H5Fset_dset_no_attrs_hint");
+
+ /* verify TRUE set on both opens
+ */
+ ret = H5Fget_dset_no_attrs_hint(file_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, TRUE, "minimize flag");
+
+ ret = H5Fget_dset_no_attrs_hint(file2_id, &minimize);
+ CHECK(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+ VERIFY(minimize, TRUE, "minimize flag");
+
+ /*----------------------------------------
+ * TEST error cases
+ */
+
+ /* trying to set with invalid file ID */
+ H5E_BEGIN_TRY {
+ ret = H5Fset_dset_no_attrs_hint(-1, TRUE);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fset_dset_no_attrs_hint");
+
+ /* trying to get with invalid file ID */
+ H5E_BEGIN_TRY {
+ ret = H5Fget_dset_no_attrs_hint(-1, &minimize);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+
+ /* trying to get with invalid pointer */
+ H5E_BEGIN_TRY {
+ ret = H5Fget_dset_no_attrs_hint(file_id, NULL);
+ } H5E_END_TRY;
+ VERIFY(ret, FAIL, "H5Fget_dset_no_attrs_hint");
+
+ /************/
+ /* TEARDOWN */
+ /************/
+
+ ret = H5Fclose(file_id);
+ CHECK(ret, FAIL, "H5Fclose");
+ ret = H5Fclose(file2_id);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* end test_min_dset_ohdr() */
+
+/****************************************************************
+**
** test_deprec():
** Test deprecated functionality.
**
@@ -7336,6 +7462,7 @@ test_file(void)
test_libver_macros(); /* Test the macros for library version comparison */
test_libver_macros2(); /* Test the macros for library version comparison */
test_incr_filesize(); /* Test H5Fincrement_filesize() and H5Fget_eoa() */
+ test_min_dset_ohdr(); /* Test datset object header minimization */
#ifndef H5_NO_DEPRECATED_SYMBOLS
test_deprec(); /* Test deprecated routines */
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/test/th5o.c b/test/th5o.c
index 63fee5f..2949c4e 100644
--- a/test/th5o.c
+++ b/test/th5o.c
@@ -13,7 +13,7 @@
/***********************************************************
*
-* Test program: th5o
+* Test program: th5o
*
* Test public H5O functions for accessing
*
@@ -30,7 +30,7 @@
#define TEST6_DIM1 100
#define TEST6_DIM2 100
-
+
/****************************************************************
**
** test_h5o_open(): Test H5Oopen function.
@@ -140,7 +140,7 @@ test_h5o_open(void)
} /* test_h5o_open() */
-
+
/****************************************************************
**
** test_h5o_close(): Test H5Oclose function.
@@ -230,7 +230,7 @@ test_h5o_close(void)
CHECK(ret, FAIL, "H5Fclose");
}
-
+
/****************************************************************
**
** test_h5o_open_by_addr(): Test H5Oopen_by_addr function.
@@ -367,7 +367,7 @@ test_h5o_open_by_addr(void)
VERIFY(dtype, FAIL, "H5Oopen_by_addr");
} /* test_h5o_open_by_addr() */
-
+
/****************************************************************
**
** test_h5o_refcount(): Test H5O refcounting functions.
@@ -378,7 +378,7 @@ test_h5o_refcount(void)
{
hid_t fid; /* HDF5 File ID */
hid_t grp, dset, dtype, dspace; /* Object identifiers */
- H5O_info_t oinfo; /* Object info struct */
+ H5O_info_t oinfo; /* Object info struct */
hsize_t dims[RANK];
herr_t ret; /* Value returned from API calls */
@@ -562,7 +562,7 @@ test_h5o_refcount(void)
CHECK(ret, FAIL, "H5Fclose");
} /* test_h5o_refcount() */
-
+
/****************************************************************
**
** test_h5o_plist(): Test object creation properties
@@ -756,7 +756,7 @@ test_h5o_plist(void)
CHECK(ret, FAIL, "H5Pclose");
} /* test_h5o_plist() */
-
+
/****************************************************************
**
** test_h5o_link(): Test creating link to object
@@ -850,7 +850,7 @@ test_h5o_link(void)
/* Verify the data */
for(i = 0; i < (TEST6_DIM1 * TEST6_DIM2); i++)
VERIFY(wdata[i], rdata[i], "H5Dread");
-
+
/* Create a group with no name*/
group_id = H5Gcreate_anon(file_id, H5P_DEFAULT, H5P_DEFAULT);
CHECK(group_id, FAIL, "H5Gcreate_anon");
@@ -910,7 +910,7 @@ test_h5o_link(void)
HDfree(rdata);
} /* end test_h5o_link() */
-
+
/****************************************************************
**
** test_h5o_comment(): Test H5Oset(get)_comment functions.
@@ -1083,7 +1083,7 @@ test_h5o_comment(void)
} /* test_h5o_comment() */
-
+
/****************************************************************
**
** test_h5o_comment_by_name(): Test H5Oset(get)_comment_by_name functions.
@@ -1242,7 +1242,7 @@ test_h5o_comment_by_name(void)
} /* test_h5o_comment_by_name() */
-
+
/****************************************************************
**
** test_h5o_getinfo_same_file(): Test that querying the object info for
@@ -1254,7 +1254,7 @@ test_h5o_getinfo_same_file(void)
{
hid_t fid1, fid2; /* HDF5 File ID */
hid_t gid1, gid2; /* Group IDs */
- H5O_info_t oinfo1, oinfo2; /* Object info structs */
+ H5O_info_t oinfo1, oinfo2; /* Object info structs */
herr_t ret; /* Value returned from API calls */
/* Create a new HDF5 file */
@@ -1353,7 +1353,7 @@ test_h5o_getinfo_same_file(void)
/****************************************************************
**
** visit_obj_cb():
-** This is the callback function invoked by H5Ovisit1() in
+** This is the callback function invoked by H5Ovisit() in
** test_h5o_getinfo_visit():
** --Verify that the object info returned to the callback
** function is the same as H5Oget_info2().
@@ -1368,27 +1368,27 @@ visit_obj_cb(hid_t group_id, const char *name, const H5O_info_t *oinfo1,
/* Verify the object info for "group1", "group2" and the root group */
if(!(HDstrcmp(name, "group1"))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_NUM_ATTRS, H5P_DEFAULT);
- VERIFY(oinfo1->num_attrs, oinfo2.num_attrs, "obj info from H5Ovisit1");
+ VERIFY(oinfo1->num_attrs, oinfo2.num_attrs, "obj info from H5Ovisit");
} else if(!(HDstrcmp(name, "group2"))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_HDR, H5P_DEFAULT);
- VERIFY(oinfo1->hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Ovisit1/H5Oget_info2");
- VERIFY(oinfo1->hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Ovisit1/H5Oget_info2");
+ VERIFY(oinfo1->hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Ovisit/H5Oget_info2");
+ VERIFY(oinfo1->hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Ovisit/H5Oget_info2");
} else if(!(HDstrcmp(name, "."))) {
H5Oget_info_by_name2(group_id, name, &oinfo2, H5O_INFO_META_SIZE, H5P_DEFAULT);
- VERIFY(oinfo1->meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Ovisit1/H5Oget_info2");
- VERIFY(oinfo1->meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Ovisit1/H5Oget_info2");
+ VERIFY(oinfo1->meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Ovisit/H5Oget_info2");
+ VERIFY(oinfo1->meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Ovisit/H5Oget_info2");
}
return(H5_ITER_CONT);
} /* end visit_obj_cb() */
-
+
/****************************************************************
**
-** test_h5o_getinfo_visit():
-** Verify that the object info returned via H5Oget_info1()
+** test_h5o_getinfo_visit():
+** Verify that the object info returned via H5Oget_info()
** and H5Oget_info2() are the same.
-** Verify that the object info retrieved via H5Ovisit1() is
+** Verify that the object info retrieved via H5Ovisit() is
** the same as H5Oget_info2().
**
****************************************************************/
@@ -1436,31 +1436,31 @@ test_h5o_getinfo_visit(void)
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
- /* Query the object info for "group1" via H5Oget_info1 and H5Oget_info2 */
- ret = H5Oget_info1(gid1, &oinfo1);
+ /* Query the object info for "group1" via H5Oget_info and H5Oget_info2 */
+ ret = H5Oget_info(gid1, &oinfo1);
CHECK(ret, FAIL, "H5Oget_info");
ret = H5Oget_info2(gid1, &oinfo2, H5O_INFO_BASIC|H5O_INFO_NUM_ATTRS);
CHECK(ret, FAIL, "H5Oget_info");
/* Verify the object info for "group1" is correct */
- VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info1/2");
- VERIFY(oinfo1.num_attrs, oinfo2.num_attrs, "obj info from H5Oget_info1/2");
+ VERIFY(oinfo1.fileno, oinfo2.fileno, "obj info from H5Oget_info/2");
+ VERIFY(oinfo1.num_attrs, oinfo2.num_attrs, "obj info from H5Oget_info/2");
/* Reset object info */
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
- /* Query the object info for "group2" via H5Oget_info1 and H5Oget_info2 */
- ret = H5Oget_info_by_name1(fid, "group2", &oinfo1, H5P_DEFAULT);
+ /* Query the object info for "group2" via H5Oget_info_by_name and H5Oget_info_by_name2 */
+ ret = H5Oget_info_by_name(fid, "group2", &oinfo1, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
ret = H5Oget_info_by_name2(fid, "group2", &oinfo2, H5O_INFO_HDR|H5O_INFO_META_SIZE, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Oget_info_by_name");
/* Verify the object info for "group2" is correct */
- VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info1/2");
- VERIFY(oinfo1.hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Oget_info1/2");
- VERIFY(oinfo1.meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Oget_info1/2");
- VERIFY(oinfo1.meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Oget_info1/2");
+ VERIFY(oinfo1.hdr.nmesgs, oinfo2.hdr.nmesgs, "obj info from H5Oget_info_by_name/2");
+ VERIFY(oinfo1.hdr.nchunks, oinfo2.hdr.nchunks, "obj info from H5Oget_info_by_name/2");
+ VERIFY(oinfo1.meta_size.obj.index_size, oinfo2.meta_size.obj.index_size, "obj info from H5Oget_info_by_name/2");
+ VERIFY(oinfo1.meta_size.obj.heap_size, oinfo2.meta_size.obj.heap_size, "obj info from H5Oget_info_by_name/2");
/* Close everything */
ret = H5Gclose(gid1);
@@ -1469,7 +1469,7 @@ test_h5o_getinfo_visit(void)
CHECK(ret, FAIL, "H5Gclose");
/* Verify the object info returned to the callback function is correct */
- ret = H5Ovisit1(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, NULL);
+ ret = H5Ovisit(fid, H5_INDEX_NAME, H5_ITER_INC, visit_obj_cb, NULL);
/* Close the file */
ret = H5Fclose(fid);
@@ -1479,7 +1479,7 @@ test_h5o_getinfo_visit(void)
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-
+
/****************************************************************
**
** test_h5o(): Main H5O (generic object) testing routine.
@@ -1491,9 +1491,9 @@ test_h5o(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing Objects\n"));
- test_h5o_open(); /* Test generic open function */
- test_h5o_open_by_addr(); /* Test opening objects by address */
- test_h5o_close(); /* Test generic close function */
+ test_h5o_open(); /* Test generic open function */
+ test_h5o_open_by_addr(); /* Test opening objects by address */
+ test_h5o_close(); /* Test generic close function */
test_h5o_refcount(); /* Test incrementing and decrementing reference count */
test_h5o_plist(); /* Test object creation properties */
test_h5o_link(); /* Test object link routine */
@@ -1501,19 +1501,19 @@ test_h5o(void)
test_h5o_comment_by_name(); /* Test routines for comment by name */
test_h5o_getinfo_same_file(); /* Test info for objects in the same file */
#ifndef H5_NO_DEPRECATED_SYMBOLS
- test_h5o_getinfo_visit(); /* Test object info for H5Oget_info1/2 and H5Ovisit1 */
+ test_h5o_getinfo_visit(); /* Test object info for H5Oget_info/2 and H5Ovisit */
#endif
} /* test_h5o() */
-
+
/*-------------------------------------------------------------------------
- * Function: cleanup_h5o
+ * Function: cleanup_h5o
*
- * Purpose: Cleanup temporary test files
+ * Purpose: Cleanup temporary test files
*
- * Return: none
+ * Return: none
*
- * Programmer: James Laird
+ * Programmer: James Laird
* June 3, 2006
*
*-------------------------------------------------------------------------
diff --git a/test/titerate.c b/test/titerate.c
index de652a7..093e8b5 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -20,6 +20,7 @@
*************************************************************/
#include "testhdf5.h"
+#include "H5srcdir.h"
#define DATAFILE "titerate.h5"
@@ -53,6 +54,17 @@ typedef struct {
iter_enum command; /* The type of return value */
} iter_info;
+/* Definition for test_corrupted_attnamelen */
+#define CORRUPTED_ATNAMELEN_FILE "corrupted_name_len.h5"
+#define DSET_NAME "image"
+typedef struct searched_err_t {
+ char message[256];
+ bool found;
+} searched_err_t;
+
+/* Call back function for test_corrupted_attnamelen */
+static int find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data);
+
/* Local functions */
int iter_strcmp(const void *s1, const void *s2);
int iter_strcmp2(const void *s1, const void *s2);
@@ -915,6 +927,92 @@ static void test_links(hid_t fapl)
CHECK(ret, FAIL, "H5Fclose");
} /* test_links() */
+/*-------------------------------------------------------------------------
+ * Function: find_err_msg_cb
+ *
+ * Purpose: Callback function to find the given error message.
+ * Helper function for test_corrupted_attnamelen().
+ *
+ * Return: H5_ITER_STOP when the message is found
+ * H5_ITER_CONT, otherwise
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+find_err_msg_cb(unsigned n, const H5E_error2_t *err_desc, void *_client_data)
+{
+ int status = H5_ITER_CONT;
+ searched_err_t *searched_err = (searched_err_t *)_client_data;
+
+ if (searched_err == NULL)
+ return -1;
+
+ /* If the searched error message is found, stop the iteration */
+ if (err_desc->desc != NULL && strcmp(err_desc->desc, searched_err->message) == 0)
+ {
+ searched_err->found = true;
+ status = H5_ITER_STOP;
+ }
+ return status;
+} /* end find_err_msg_cb() */
+
+/**************************************************************************
+**
+** test_corrupted_attnamelen(): Test the fix for the JIRA issue HDFFV-10588,
+** where corrupted attribute's name length can be
+** detected and invalid read can be avoided.
+**
+**************************************************************************/
+static void test_corrupted_attnamelen(void)
+{
+ hid_t fid = -1; /* File ID */
+ hid_t did = -1; /* Dataset ID */
+ searched_err_t err_caught; /* Data to be passed to callback func */
+ int err_status; /* Status returned by H5Aiterate2 */
+ herr_t ret; /* Return value */
+ const char *testfile = H5_get_srcdir_filename(CORRUPTED_ATNAMELEN_FILE); /* Corrected test file name */
+
+ const char *err_message = "attribute name has different length than stored length";
+ /* the error message produced when the failure occurs */
+
+ /* Output message about test being performed */
+ MESSAGE(5, ("Testing the Handling of Corrupted Attribute's Name Length\n"));
+
+ fid = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT);
+ CHECK(fid, FAIL, "H5Fopen");
+
+ /* Open the dataset */
+ did = H5Dopen2(fid, DSET_NAME, H5P_DEFAULT);
+ CHECK(did, FAIL, "H5Dopen2");
+
+ /* Call H5Aiterate2 to trigger the failure in HDFFV-10588. Failure should
+ occur in the decoding stage, so some arguments are not needed. */
+ err_status = H5Aiterate2(did, H5_INDEX_NAME, H5_ITER_INC, NULL, NULL, NULL);
+
+ /* Make sure the intended error was caught */
+ if(err_status == -1)
+ {
+ /* Initialize client data */
+ HDstrcpy(err_caught.message, err_message);
+ err_caught.found = false;
+
+ /* Look for the correct error message */
+ ret = H5Ewalk2(H5E_DEFAULT, H5E_WALK_UPWARD, find_err_msg_cb, &err_caught);
+ CHECK(ret, FAIL, "H5Ewalk2");
+
+ /* Fail if the indicated message is not found */
+ CHECK(err_caught.found, false, "test_corrupted_attnamelen: Expected error not found");
+ }
+
+ /* Close the dataset and file */
+ ret = H5Dclose(did);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Fclose(fid);
+ CHECK(ret, FAIL, "H5Fclose");
+
+} /* test_corrupted_attnamelen() */
+
/****************************************************************
**
** test_iterate(): Main iteration testing routine.
@@ -951,6 +1049,9 @@ test_iterate(void)
test_links(new_format ? fapl2 : fapl); /* Test soft and hard link iteration */
} /* end for */
+ /* Test the fix for issue HDFFV-10588 */
+ test_corrupted_attnamelen();
+
/* Close FAPLs */
ret = H5Pclose(fapl);
CHECK(ret, FAIL, "H5Pclose");
diff --git a/test/tsohm.c b/test/tsohm.c
index d00a03a..93ba14f 100644
--- a/test/tsohm.c
+++ b/test/tsohm.c
@@ -178,40 +178,41 @@ static void test_sohm_extlink(void);
/****************************************************************
**
-** check_fcpl_values(): Helper function for test_sohm_fcpl.
+** verify_fcpl_values(): Helper function for test_sohm_fcpl.
** Verifies that the *_in and *_out parameters are equal.
**
****************************************************************/
-static void check_fcpl_values(hid_t fcpl_id, const unsigned nindexes_in,
- const unsigned *flags_in, const unsigned *minsizes_in,
+static void
+verify_fcpl_values(hid_t fcpl_id, const unsigned nindexes_expected,
+ const unsigned *flags_expected, const unsigned *minsizes_expected,
unsigned l2b, unsigned b2l)
{
- unsigned num_indexes;
- unsigned index_flags, min_mesg_size;
- unsigned list_size, btree_size;
- unsigned x;
- herr_t ret;
-
- /* Verify number of indexes is set to default */
- ret = H5Pget_shared_mesg_nindexes(fcpl_id, &num_indexes);
+ unsigned nindexes_actual;
+ unsigned list_size;
+ unsigned btree_size;
+ unsigned x;
+ herr_t ret;
+
+ /* Number of indexes */
+ ret = H5Pget_shared_mesg_nindexes(fcpl_id, &nindexes_actual);
CHECK_I(ret, "H5Pget_shared_mesg_nindexes");
- VERIFY(num_indexes, nindexes_in, "H5Pget_shared_mesg_nindexes");
-
- /* Verify index flags and minsizes are set */
- for(x=0; x<num_indexes; ++x)
- {
- ret = H5Pget_shared_mesg_index(fcpl_id, x, &index_flags, &min_mesg_size);
+ VERIFY(nindexes_actual, nindexes_expected, "H5Pget_shared_mesg_nindexes");
+ /* Index flags and minsizes */
+ for(x=0; x<nindexes_actual; ++x) {
+ unsigned flags_i;
+ unsigned min_mesg_size;
+ ret = H5Pget_shared_mesg_index(fcpl_id, x, &flags_i, &min_mesg_size);
CHECK_I(ret, "H5Pget_shared_mesg_index");
- VERIFY(index_flags, flags_in[x], "H5Pget_shared_mesg_index");
- VERIFY(min_mesg_size, minsizes_in[x], "H5Pget_shared_mesg_index");
+ VERIFY(flags_i, flags_expected[x], "H5Pget_shared_mesg_index");
+ VERIFY(min_mesg_size, minsizes_expected[x], "H5Pget_shared_mesg_index");
}
- /* Check list-to-btree and btree-to-list values */
+ /* List-to-btree and btree-to-list values */
ret = H5Pget_shared_mesg_phase_change(fcpl_id, &list_size, &btree_size);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
VERIFY(list_size, l2b, "H5Pset_shared_mesg_phase_change");
VERIFY(btree_size, b2l, "H5Pset_shared_mesg_phase_change");
-}
+} /* verify_fcpl_values */
/****************************************************************
@@ -219,7 +220,8 @@ static void check_fcpl_values(hid_t fcpl_id, const unsigned nindexes_in,
** test_sohm_fcpl(): Test File Creation Property Lists.
**
****************************************************************/
-static void test_sohm_fcpl(void)
+static void
+test_sohm_fcpl(void)
{
hid_t fid = -1;
hid_t fcpl_id = -1;
@@ -227,14 +229,12 @@ static void test_sohm_fcpl(void)
unsigned x;
herr_t ret; /* Generic return value */
- /* Output message about test being performed */
MESSAGE(5, ("Testing File Creation Properties for Shared Messages\n"));
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
- /* Verify fcpl values */
- check_fcpl_values(fcpl_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
+ verify_fcpl_values(fcpl_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
/* Create a file with this fcpl and make sure that all the values can be
* retrieved.
@@ -245,8 +245,7 @@ static void test_sohm_fcpl(void)
fcpl2_id = H5Fget_create_plist(fid);
CHECK_I(fcpl2_id, "H5Fcreate");
- /* Verify fcpl values */
- check_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
+ verify_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
ret = H5Pclose(fcpl2_id);
CHECK_I(ret, "H5Pclose");
@@ -262,8 +261,7 @@ static void test_sohm_fcpl(void)
fcpl2_id = H5Fget_create_plist(fid);
CHECK_I(ret, "H5Fcreate");
- /* Verify fcpl values */
- check_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
+ verify_fcpl_values(fcpl2_id, DEF_NUM_INDEXES, def_type_flags, def_minsizes, DEF_L2B, DEF_B2L);
/* Clean up */
ret = H5Pclose(fcpl2_id);
@@ -289,7 +287,7 @@ static void test_sohm_fcpl(void)
ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- check_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
+ verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
/* Use the fcpl to create a file and get it back again */
fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
@@ -297,8 +295,7 @@ static void test_sohm_fcpl(void)
fcpl2_id = H5Fget_create_plist(fid);
CHECK_I(fcpl2_id, "H5Fcreate");
- /* Verify fcpl values */
- check_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
+ verify_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
ret = H5Pclose(fcpl2_id);
CHECK_I(ret, "H5Pclose");
@@ -314,8 +311,7 @@ static void test_sohm_fcpl(void)
fcpl2_id = H5Fget_create_plist(fid);
CHECK_I(ret, "H5Fcreate");
- /* Verify fcpl values */
- check_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
+ verify_fcpl_values(fcpl2_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
/* Clean up */
ret = H5Pclose(fcpl2_id);
@@ -323,6 +319,72 @@ static void test_sohm_fcpl(void)
ret = H5Fclose(fid);
CHECK_I(ret, "H5Fclose");
+ /* Actually, the list max can be exactly 1 greater than the
+ * btree min, but no more. Also, the errors above shouldn't
+ * have corrupted the fcpl, although we do need to reset the
+ * second index that we changed above.
+ */
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, test_type_flags[1], 15);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 11);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
+ CHECK_I(fid, "H5Fcreate");
+ ret = H5Fclose(fid);
+ CHECK_I(ret, "H5Fclose");
+
+ /* Test edge cases; H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be
+ * valid values. Also, creating a file with uninitialized indexes
+ * (indexes 3-5) should work.
+ */
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
+ CHECK_I(fid, "H5Fcreate");
+
+
+ /* Clean up */
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ ret = H5Fclose(fid);
+ CHECK_I(ret, "H5Fclose");
+} /* test_sohm_fcpl */
+
+
+
+/****************************************************************
+**
+** test_sohm_fcpl_errors(): Test bogus FCPL settings for SOHMs
+**
+****************************************************************/
+static void
+test_sohm_fcpl_errors(void)
+{
+ hid_t fcpl_id = -1;
+ hid_t fid = -1;
+ unsigned x;
+ herr_t ret;
+
+ MESSAGE(5, ("Testing bogus file creation properties for shared messages\n"));
+
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+
+ /* Set up index values */
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, TEST_NUM_INDEXES);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ for(x = 0; x < TEST_NUM_INDEXES; ++x) {
+ ret = H5Pset_shared_mesg_index(fcpl_id, x, test_type_flags[x], test_minsizes[x]);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+ }
+
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, TEST_L2B, TEST_B2L);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+
+ verify_fcpl_values(fcpl_id, TEST_NUM_INDEXES, test_type_flags, test_minsizes, TEST_L2B, TEST_B2L);
+
/* Test giving bogus values to H5P* functions */
H5E_BEGIN_TRY {
/* Trying to create too many indexes should fail */
@@ -370,40 +432,7 @@ static void test_sohm_fcpl(void)
ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE+1);
VERIFY(ret, -1, "H5Pset_shared_mesg_phase_change");
} H5E_END_TRY
-
-
- /* Actually, the list max can be exactly 1 greater than the
- * btree min, but no more. Also, the errors above shouldn't
- * have corrupted the fcpl, although we do need to reset the
- * second index that we changed above.
- */
- ret = H5Pset_shared_mesg_index(fcpl_id, 1, test_type_flags[1], 15);
- CHECK_I(ret, "H5Pset_shared_mesg_index");
- ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 11);
- CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- CHECK_I(fid, "H5Fcreate");
- ret = H5Fclose(fid);
- CHECK_I(ret, "H5Fclose");
-
- /* Test edge cases; H5O_SHMESG_MAX_NINDEXES and H5O_SHMESG_MAX_LIST_SIZE should be
- * valid values. Also, creating a file with uninitialized indexes
- * (indexes 3-5) should work.
- */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, H5O_SHMESG_MAX_NINDEXES);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_phase_change(fcpl_id, H5O_SHMESG_MAX_LIST_SIZE, H5O_SHMESG_MAX_LIST_SIZE);
- CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
- CHECK_I(fid, "H5Fcreate");
-
-
- /* Clean up */
- ret = H5Pclose(fcpl_id);
- CHECK_I(ret, "H5Pclose");
- ret = H5Fclose(fid);
- CHECK_I(ret, "H5Fclose");
-}
+} /* test_sohm_fcpl_errors */
/*-------------------------------------------------------------------------
@@ -455,7 +484,8 @@ error:
H5Tclose(dtype1_id);
} H5E_END_TRY
return -1;
-}
+} /* make_dtype_1 */
+
/*-------------------------------------------------------------------------
* Function: make_dtype_2
@@ -518,9 +548,9 @@ error:
H5Tclose(int_id);
} H5E_END_TRY
return -1;
-}
-
+} /* make_dtype2 */
+
/*-------------------------------------------------------------------------
* Function: close_reopen_file
*
@@ -540,16 +570,16 @@ error:
static hid_t
close_reopen_file(hid_t file, const char* filename, hid_t fapl_id)
{
- hid_t fid;
-
- if(H5Fclose(file) < 0) FAIL_STACK_ERROR
- if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id)) < 0) FAIL_STACK_ERROR
-
- return(fid);
+ if (H5Fclose(file) < 0)
+ FAIL_STACK_ERROR
+ file = H5Fopen(filename, H5F_ACC_RDWR, fapl_id);
+ if (file < 0)
+ FAIL_STACK_ERROR
+ return(file);
error:
return -1;
-}
+} /* close_reopen_file */
/*-------------------------------------------------------------------------
@@ -557,7 +587,6 @@ error:
*
* Purpose: Creates object headers that use a large datatype message.
*
- * Used in test_sohm_basic. Should close the file ID passed in.
* Set test_file_closing to 1 to add file closing and reopening
* whenever possible (to test that SOHMs are written correctly
* on disk and not just in memory).
@@ -571,7 +600,7 @@ error:
*-------------------------------------------------------------------------
*/
static hid_t
-size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_closing)
+size1_helper(hid_t file, const char *filename, hid_t fapl_id, int test_file_closing)
{
dtype1_struct wdata;
dtype1_struct rdata;
@@ -581,6 +610,32 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
hsize_t dim1[1];
int x;
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Macro: TSOHM_S1H_VERIFY_DATA
+ *
+ * Purpose: Encapsulate a common pattern:
+ * Reads the dataset and verifies that [a subset of] the data
+ * are as expected.
+ *
+ * Programmer: Jacob Smith
+ * 2018 November 1
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ */
+#define TSOHM_S1H_VERIFY_DATA(dset_id, dtype_id) \
+{ \
+ HDmemset(&rdata, 0, sizeof(rdata)); \
+ if (0 > H5Dread((dset_id), (dtype_id), H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata)) { \
+ H5_FAILED(); AT(); \
+ printf("Can't read data\n"); \
+ goto error; \
+ } \
+ if ((rdata.i1 != wdata.i1) || (rdata.i2 != wdata.i2) || HDstrcmp(rdata.str, wdata.str)) { \
+ H5_FAILED(); AT(); \
+ printf("incorrect read data\n"); \
+ goto error; \
+ } \
+} /* TSOHM_S1H_VERIFY_DATA() definition */
+
/* Closing and re-opening the file takes a long time on systems without
* local disks. Don't close and reopen if express testing is enabled.
*/
@@ -614,96 +669,55 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
/* Test writing and reading */
if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) FAIL_STACK_ERROR
- if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) FAIL_STACK_ERROR
-
- if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
- H5_FAILED(); AT();
- printf("incorrect read data\n");
- goto error;
- } /* end if */
+ TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
- /* Close and re-open the file if requested*/
if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- /* Create more datasets with the same datatype */
- if((dset_id = H5Dcreate2(file, DSETNAME[1], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR
- if(H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
+ /* Create 3 more datasets with the same datatype/dataspace */
+ for (x = 1; x < 4; x++) {
+ dset_id = H5Dcreate2(file, DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ if (0 > dset_id) FAIL_STACK_ERROR
+ if (x == 3)
+ if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR
+ if (H5Dclose(dset_id) < 0) FAIL_STACK_ERROR
- /* Close and re-open the file if requested*/
- if(test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
-
- if((dset_id = H5Dcreate2(file, DSETNAME[2], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
- if(H5Dclose(dset_id) < 0) TEST_ERROR
-
- /* Close and re-open the file if requested*/
- if(test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
-
- if((dset_id = H5Dcreate2(file,DSETNAME[3],dtype1_id,space_id,H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
-
- /* Write data to dataset 3 for later */
- if(H5Dwrite(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &wdata) < 0) TEST_ERROR
+ if (test_file_closing)
+ if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
+ }
- if(H5Dclose(dset_id) < 0) TEST_ERROR
if(H5Tclose(dtype1_id) < 0) TEST_ERROR
- /* Close and re-open the file if requested*/
- if(test_file_closing)
- if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
-
/* Make sure the data has been written successfully */
- if((dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT)) < 0) TEST_ERROR
- if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
-
- /* Read data back again */
- HDmemset(&rdata, 0, sizeof(rdata));
- if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
- printf("Can't read data\n");
- goto error;
- } /* end if */
-
- if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
- H5_FAILED(); AT();
- printf("incorrect read data\n");
- goto error;
- } /* end if */
+ dset_id = H5Dopen2(file, DSETNAME[0], H5P_DEFAULT);
+ if(dset_id < 0) TEST_ERROR
+ dtype1_id = H5Dget_type(dset_id);
+ if(dtype1_id < 0) TEST_ERROR
+ TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
if(H5Dclose(dset_id) < 0) TEST_ERROR
- /* Create several copies of the dataset (this increases the amount of space saved by sharing the datatype message) */
+ /* Create several copies of the dataset
+ * this increases the amount of space saved by sharing the datatype message
+ */
for(x = 0; x < SOHM_HELPER_NUM_EX_DSETS; x++) {
if((dset_id = H5Dcreate2(file, EXTRA_DSETNAME[x], dtype1_id, space_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR
if(H5Dclose(dset_id) < 0) TEST_ERROR
- /* Close and re-open the file if requested*/
if(test_file_closing)
if((file = close_reopen_file(file, filename, fapl_id)) < 0) TEST_ERROR
- } /* end for */
+ }
if(H5Tclose(dtype1_id) < 0) TEST_ERROR
if(H5Sclose(space_id) < 0) TEST_ERROR
/* Ensure that we can still read data back from dataset 3 */
- if((dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT)) < 0) TEST_ERROR
- if((dtype1_id = H5Dget_type(dset_id)) < 0) TEST_ERROR
-
- /* Read data back again */
- HDmemset(&rdata, 0, sizeof(rdata));
- if(H5Dread(dset_id, dtype1_id, H5S_ALL, H5S_ALL, H5P_DEFAULT, &rdata) < 0) {
- H5_FAILED(); AT();
- printf("Can't read data\n");
- goto error;
- } /* end if */
-
- if(rdata.i1 != wdata.i1 || rdata.i2 != wdata.i2 || HDstrcmp(rdata.str, wdata.str)) {
- H5_FAILED(); AT();
- printf("incorrect read data\n");
- goto error;
- } /* end if */
+ dset_id = H5Dopen2(file, DSETNAME[3], H5P_DEFAULT);
+ if(dset_id < 0) TEST_ERROR
+ dtype1_id = H5Dget_type(dset_id);
+ if(dtype1_id < 0) TEST_ERROR
+ TSOHM_S1H_VERIFY_DATA(dset_id, dtype1_id)
if(H5Dclose(dset_id) < 0) TEST_ERROR
if(H5Tclose(dtype1_id) < 0) TEST_ERROR
@@ -717,7 +731,42 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
H5Fclose(file);
} H5E_END_TRY
return -1;
-}
+#undef TSOHM_S1H_VERIFY_DATA /* macro is exclusive to this function */
+} /* size1_helper */
+
+
+/*----------------------------------------------------------------------------
+ * Function: getsize_testsize1
+ *
+ * Purpose: Creates a test file, populates it, and returns its file size.
+ * Oject header information from the "first" dataset in the file
+ * is stored in pointer `oinfo`.
+ *
+ * Programmer: Jacob Smith
+ * 2018 November 1
+ *----------------------------------------------------------------------------
+ */
+static h5_stat_size_t
+getsize_testsize1(const char *filename, hid_t fcpl_id, hid_t fapl_id, unsigned open_close, H5O_info_t *oinfo)
+{
+ hid_t file = -1;
+ herr_t ret;
+
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK_I(file, "H5Fcreate");
+
+ file = size1_helper(file, FILENAME, fapl_id, open_close);
+ CHECK_I(file, "size1_helper");
+
+ ret = H5Oget_info_by_name2(file, DSETNAME[0], oinfo, H5O_INFO_HDR, H5P_DEFAULT);
+ CHECK_I(ret, "H5Oget_info_by_name");
+
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
+
+ return h5_get_file_size(FILENAME, fapl_id);
+} /* getsize_testsize1 */
+
/*-------------------------------------------------------------------------
* Function: test_sohm_size1
@@ -727,17 +776,26 @@ size1_helper(hid_t file, const char* filename, hid_t fapl_id, int test_file_clos
* Programmer: James Laird
* Monday, April 10, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
-static void test_sohm_size1(void)
+static void
+test_sohm_size1(void)
{
hid_t file = -1;
hid_t fcpl_id = -1;
hid_t fapl_id = -1;
- hsize_t sohm_oh_size;
- hsize_t sohm_btree_oh_size;
+
+ unsigned use_shared = 0;
+ unsigned use_btree = 0;
+ unsigned open_close = 0;
+ h5_stat_size_t file_sizes[9];
+ unsigned size_index = 0;
+ hsize_t oh_sizes[3];
+ unsigned oh_size_index = 0;
+
+ hsize_t norm_oh_size;
+ hsize_t sohm_oh_size;
+ hsize_t sohm_btree_oh_size;
h5_stat_size_t norm_empty_filesize;
h5_stat_size_t sohm_empty_filesize;
h5_stat_size_t sohm_btree_empty_filesize;
@@ -747,6 +805,7 @@ static void test_sohm_size1(void)
h5_stat_size_t norm_final_filesize2;
h5_stat_size_t sohm_final_filesize2;
h5_stat_size_t sohm_btree_final_filesize2;
+
H5O_info_t oinfo;
unsigned num_indexes = 1;
unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
@@ -757,7 +816,6 @@ static void test_sohm_size1(void)
MESSAGE(5, ("Testing that shared datatypes save space\n"));
-
/* Create a FAPL with "semi" close degree, to detect dangling IDs */
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
CHECK_I(fapl_id, "H5Pcreate");
@@ -765,169 +823,97 @@ static void test_sohm_size1(void)
ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI);
CHECK_I(ret, "H5Pset_fclose_degree");
- /* Create a file with SOHMs disabled and get its size */
- fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- CHECK_I(fcpl_id, "H5Pcreate");
-
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
-
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- /* Get the file size */
- norm_empty_filesize = h5_get_file_size(FILENAME, fapl_id);
-
- /* Add a bunch of large datatypes to the file */
- file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id);
- CHECK_I(file, "H5Fopen");
- file = size1_helper(file, FILENAME, fapl_id, 0);
- CHECK_I(file, "size1_helper");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- /* Get the new file size */
- norm_final_filesize = h5_get_file_size(FILENAME, fapl_id);
-
- /* Use the same property list to create a new file. */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
-
- ret = H5Pclose(fcpl_id);
- CHECK_I(ret, "H5Pclose");
-
- /* Add the same large datatypes, but keep closing and re-opening the file */
- file = size1_helper(file, FILENAME, fapl_id, 1);
- CHECK_I(file, "size1_helper");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- /* Get the file size */
- norm_final_filesize2 = h5_get_file_size(FILENAME, fapl_id);
-
-
-
- /* Now do the same thing for a file with SOHMs enabled */
- /* Create FCPL with SOHMs enabled */
- fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- CHECK_I(fcpl_id, "H5Pcreate");
-
- /* Tests one index holding only datatype messages */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size);
- CHECK_I(ret, "H5Pset_shared_mesg_index");
- ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min);
- CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
-
- /* Create a file */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
-
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- sohm_empty_filesize = h5_get_file_size(FILENAME, fapl_id);
-
- /* Add a bunch of datatypes to this file */
- file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id);
- CHECK_I(file, "H5Fopen");
- file = size1_helper(file, FILENAME, fapl_id, 0);
- CHECK_I(file, "size1_helper");
+ /* ----------------------------------------
+ * Run operations, accumulating file sizes to compare later.
+ */
+
+ for (use_shared = 0; use_shared < 2; use_shared++) {
+ for (use_btree = 0; use_btree < 2; use_btree++) {
+
+ /* cannot use btree indexing without shared messages; skip case */
+ if (use_btree && !use_shared)
+ continue;
+
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+
+ if (use_shared) {
+ /* Tests one index holding only datatype messages */
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+
+ if (use_btree) {
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
+ } else {
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min);
+ }
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ } else {
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ }
+
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK_I(file, "H5Fcreate");
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
- /* Get the size of a dataset object header */
- ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK_I(ret, "H5Oget_info_by_name");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
- sohm_oh_size = oinfo.hdr.space.total;
+ /* size of empty file */
+ file_sizes[size_index++] = h5_get_file_size(FILENAME, fapl_id);
- /* Get the new file size */
- sohm_final_filesize = h5_get_file_size(FILENAME, fapl_id);
+ /* size of populated file, with different populating behaviors */
+ for (open_close = 0; open_close < 2; open_close++)
+ file_sizes[size_index++] = getsize_testsize1(FILENAME, fcpl_id, fapl_id, open_close, &oinfo);
+ oh_sizes[oh_size_index++] = oinfo.hdr.space.total;
- /* Use the same property list to create a new file. */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ } /* for btree/listed messages */
+ } /* for normal/shared messages */
- ret = H5Pclose(fcpl_id);
+ ret = H5Pclose(fapl_id);
CHECK_I(ret, "H5Pclose");
- /* Add the same large datatypes, but keep closing and re-opening the file */
- file = size1_helper(file, FILENAME, fapl_id, 1);
- CHECK_I(file, "size1_helper");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- /* Get the file size */
- sohm_final_filesize2 = h5_get_file_size(FILENAME, fapl_id);
-
-
-
- /* Create FCPL with SOHMs enabled that uses a B-tree index */
- fcpl_id = H5Pcreate(H5P_FILE_CREATE);
- CHECK_I(fcpl_id, "H5Pcreate");
-
- /* Tests one index holding only datatype messages */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size);
- CHECK_I(ret, "H5Pset_shared_mesg_index");
- ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
- CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
-
- /* Create a file */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
-
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
-
- sohm_btree_empty_filesize = h5_get_file_size(FILENAME, fapl_id);
-
- /* Add a bunch of datatypes to this file */
- file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id);
- CHECK_I(file, "H5Fopen");
- file = size1_helper(file, FILENAME, fapl_id, 0);
- CHECK_I(file, "size1_helper");
-
- /* Get the size of a dataset object header */
- ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
- CHECK_I(ret, "H5Oget_info_by_name");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
- sohm_btree_oh_size = oinfo.hdr.space.total;
-
- /* Get the new file size */
- sohm_btree_final_filesize = h5_get_file_size(FILENAME, fapl_id);
-
- /* Use the same property list to create a new file. */
- file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
- CHECK_I(file, "H5Fcreate");
+ /* sanity-check state of arrays */
+ VERIFY(9, size_index, "size_index");
+ VERIFY(3, oh_size_index, "oh_size_index");
- ret = H5Pclose(fcpl_id);
- CHECK_I(ret, "H5Pclose");
+ /* ----------------------------------------
+ * Check that all sizes make sense.
+ */
- /* Add the same large datatypes, but keep closing and re-opening the file */
- file = size1_helper(file, FILENAME, fapl_id, 1);
- CHECK_I(file, "size1_helper");
- ret = H5Fclose(file);
- CHECK_I(ret, "H5Fclose");
+ /* Put result sizes into human-readable symbolic names.
+ * Order dependent on loop execution above.
+ */
+ norm_empty_filesize = file_sizes[0];
+ norm_final_filesize = file_sizes[1];
+ norm_final_filesize2 = file_sizes[2];
+ norm_oh_size = oh_sizes[0];
- /* Get the file size */
- sohm_btree_final_filesize2 = h5_get_file_size(FILENAME, fapl_id);
+ sohm_empty_filesize = file_sizes[3];
+ sohm_final_filesize = file_sizes[4];
+ sohm_final_filesize2 = file_sizes[5];
+ sohm_oh_size = oh_sizes[1];
+ sohm_btree_empty_filesize = file_sizes[6];
+ sohm_btree_final_filesize = file_sizes[7];
+ sohm_btree_final_filesize2 = file_sizes[8];
+ sohm_btree_oh_size = oh_sizes[2];
+ /* How the SOHM messages are stored shouldn't affect the
+ * size of the object header.
+ */
+ VERIFY(sohm_btree_oh_size, sohm_oh_size, "H5Oget_info_by_name");
- /* Check that all sizes make sense */
+#if 0 /* TBD: lying comment or bug. See Jira HDFFV-10646 */
/* Object headers in SOHM files should be smaller than normal object
- * headers. How the SOHM messages are stored shouldn't affect the
- * size of the object header.
+ * headers.
*/
- if(sohm_oh_size != sohm_btree_oh_size)
- VERIFY(sohm_btree_oh_size, 1, "H5Oget_info_by_name");
+ if (sohm_oh_size >= norm_oh_size)
+ VERIFY(norm_oh_size, 1, "H5Oget_info_by_name");
+#endif /* Jira HDFFV-10646 */
/* Both sohm files should be bigger than a normal file when empty.
* It's hard to say whether a B-tree with no nodes allocated should be
@@ -950,15 +936,118 @@ static void test_sohm_size1(void)
if(sohm_final_filesize > sohm_btree_final_filesize)
VERIFY(sohm_final_filesize, 1, "h5_get_file_size");
- /* This shouldn't change even if we open and close the file */
+ /* Comparative sizes shouldn't change even if we open and close the file */
+
if(sohm_btree_final_filesize2 >= norm_final_filesize2)
VERIFY(sohm_btree_final_filesize2, 1, "h5_get_file_size");
if(sohm_final_filesize2 > sohm_btree_final_filesize2)
VERIFY(sohm_final_filesize2, 1, "h5_get_file_size");
+} /* test_sohm_size1 */
+
+
+/*-------------------------------------------------------------------------
+ * Function: test_sohm_size_consistency_open_create
+ *
+ * Purpose: Tests that header size is different depending on file open
+ * procedure?
+ * Uses "size1_helper" for file setup directed to a specific
+ * file handle.
+ *
+ * Programmer: Jacob Smith
+ * 2018 November 1
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+test_sohm_size_consistency_open_create(void)
+{
+ hid_t file = -1;
+ hid_t fcpl_id = -1;
+ hid_t fapl_id = -1;
+ unsigned use_btree;
+ hsize_t oh_size_open;
+ hsize_t oh_size_create;
+ H5O_info_t oinfo;
+ unsigned num_indexes = 1;
+ unsigned index_flags = H5O_SHMESG_DTYPE_FLAG;
+ unsigned min_mesg_size = 50;
+ unsigned list_max = 11;
+ unsigned btree_min = 10;
+ herr_t ret;
+
+ MESSAGE(5, ("Testing that header size is consistent between H5Fopen and H5Fcreate\n"));
+
+ /* Create a FAPL with "semi" close degree, to detect dangling IDs */
+ fapl_id = H5Pcreate(H5P_FILE_ACCESS);
+ CHECK_I(fapl_id, "H5Pcreate");
+ ret = H5Pset_fclose_degree(fapl_id, H5F_CLOSE_SEMI);
+ CHECK_I(ret, "H5Pset_fclose_degree");
+
+ for (use_btree = 0; use_btree < 2; use_btree++) {
+ /* Create FCPL with SOHMs enabled
+ */
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, num_indexes);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, index_flags, min_mesg_size);
+ CHECK_I(ret, "H5Pset_shared_mesg_index");
+ if (use_btree) {
+ MESSAGE(5, ("----testing with btree index----\n"));
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ } else {
+ MESSAGE(5, ("----testing with normal index----\n"));
+ ret = H5Pset_shared_mesg_phase_change(fcpl_id, list_max, btree_min);
+ CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
+ }
+
+ /* Create empty file */
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK_I(file, "H5Fcreate");
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
+
+ /* Test Open/Write
+ * Add messages to previously-created file */
+ file = H5Fopen(FILENAME, H5F_ACC_RDWR, fapl_id);
+ CHECK_I(file, "H5Fopen");
+ file = size1_helper(file, FILENAME, fapl_id, 0);
+ CHECK_I(file, "size1_helper");
+
+ /* Get the size of a dataset object header */
+ ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
+ CHECK_I(ret, "H5Oget_info_by_name");
+ oh_size_open = oinfo.hdr.space.total;
+
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
+
+ /* Test Create/Write
+ * Add messages to a newly-created file */
+ file = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, fapl_id);
+ CHECK_I(file, "H5Fcreate");
+ file = size1_helper(file, FILENAME, fapl_id, 0);
+ CHECK_I(file, "size1_helper");
+
+ /* Get the size of a dataset object header */
+ ret = H5Oget_info_by_name2(file, DSETNAME[0], &oinfo, H5O_INFO_HDR, H5P_DEFAULT);
+ CHECK_I(ret, "H5Oget_info_by_name");
+ oh_size_create = oinfo.hdr.space.total;
+
+ ret = H5Fclose(file);
+ CHECK_I(ret, "H5Fclose");
+
+ VERIFY(oh_size_create, oh_size_open, "H5Oget_info_by_name2");
+
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ } /* for normal/btree indexing */
+
ret = H5Pclose(fapl_id);
CHECK_I(ret, "H5Pclose");
-}
+} /* test_sohm_size_consistency_open_create */
/*-------------------------------------------------------------------------
@@ -966,149 +1055,110 @@ static void test_sohm_size1(void)
*
* Purpose: Given an fcpl, tests creating attributes with and without
* committed datatypes.
+ * Verify that an attribute can be written and read back.
+ * Tests attribute on a Group.
+ * Tests committed and non-committed datatypes.
+ * Tests attribute access through `H5Aopen()`.
*
* Programmer: James Laird
* Thursday, November 30, 2006
*
*-------------------------------------------------------------------------
*/
-static void sohm_attr_helper(hid_t fcpl_id)
+static void
+sohm_attr_helper(hid_t fcpl_id)
{
hid_t file_id;
- hid_t type_id;
hid_t space_id;
- hid_t group_id;
- hid_t attr_id, attr_id2;
hsize_t dims = 2;
int wdata[2] = {7, 42};
int rdata[2];
herr_t ret;
size_t x;
+ unsigned op_index=0;
+#define TSOHM_SAH_OP_COUNT 3
+ const char *groupnames[TSOHM_SAH_OP_COUNT] = {
+ "group_for_nothing_special",
+ "group_for_commited_dtype",
+ "group_for_commited_dtype_and_other_ID_access",
+ };
- /*----------------------------------------------------------------------------
- * Test attribute with transient datatype
- */
- /* Create a file using the fcpl */
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
- /* Create a normal datatype and dataset */
- type_id = H5Tcopy(H5T_NATIVE_INT);
- CHECK_I(type_id, "H5Tcopy");
space_id = H5Screate_simple(1, &dims, &dims);
CHECK_I(space_id, "H5Screate_simple");
- /* Create and verify an attribute on a group */
- group_id = H5Gcreate2(file_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(group_id, "H5Gcreate2");
- attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(attr_id, "H5Acreate2");
- ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
- CHECK_I(ret, "H5Awrite");
-
- /* Close the datatype and group */
- ret = H5Tclose(type_id);
- CHECK_I(ret, "H5Tclose");
- ret = H5Gclose(group_id);
- CHECK_I(ret, "H5Gclose");
-
- /* Flush the file to force data to be written */
- ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
- CHECK_I(ret, "H5Fflush");
-
- /* Verify */
- HDmemset(rdata, 0, sizeof(rdata));
- ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
- CHECK_I(ret, "H5Aread");
- for(x = 0; x < (size_t)dims; ++x)
- VERIFY(rdata[x], wdata[x], "H5Aread");
-
- /* Cleanup */
- ret = H5Aclose(attr_id);
- CHECK_I(ret, "H5Aclose");
-
- /*----------------------------------------------------------------------------
- * Test attribute with committed datatype
+ /* loop:
+ * 0 - nothing special
+ * 1 - committed datatype
+ * 2 - committed datatype, read through second ID
*/
- /* Repeat with a committed datatype */
- type_id = H5Tcopy(H5T_NATIVE_INT);
- CHECK_I(type_id, "H5Tcopy");
- ret = H5Tcommit2(file_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(ret, "H5Tcommit2");
-
- /* Create and verify an attribute */
- group_id = H5Gcreate2(file_id, "another_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(group_id, "H5Gcreate2");
- attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(attr_id, "H5Acreate2");
- ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
- CHECK_I(ret, "H5Awrite");
-
- /* Close the datatype and group */
- ret = H5Tclose(type_id);
- CHECK_I(ret, "H5Tclose");
- ret = H5Gclose(group_id);
- CHECK_I(ret, "H5Gclose");
-
- /* Flush the file to force data to be written */
- ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
- CHECK_I(ret, "H5Fflush");
+ for (op_index = 0; op_index < TSOHM_SAH_OP_COUNT; op_index++) {
+ hid_t type_id = -1;
+ hid_t group_id = -1;
+ hid_t attr_id = -1;
+ hid_t attr_id2 = -1;
+ hid_t attr_read_id;
- /* Verify */
- HDmemset(rdata, 0, sizeof(rdata));
- ret = H5Aread(attr_id, H5T_NATIVE_INT, rdata);
- CHECK_I(ret, "H5Aread");
- for(x = 0; x < (size_t)dims; ++x)
- VERIFY(rdata[x], wdata[x], "H5Aread");
+ /* create group in file with name unique to op_index */
+ group_id = H5Gcreate2(file_id, groupnames[op_index], H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(group_id, "H5Gcreate2");
- /* Cleanup */
- ret = H5Aclose(attr_id);
- CHECK_I(ret, "H5Aclose");
+ type_id = H5Tcopy(H5T_NATIVE_INT);
+ CHECK_I(type_id, "H5Tcopy");
- /*----------------------------------------------------------------------------
- * Test attribute operation with two ID handles
- */
- /* Create and verify an attribute */
- group_id = H5Gcreate2(file_id, "yet_another_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(group_id, "H5Gcreate2");
-
- attr_id = H5Acreate2(group_id, "attribute", H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT);
- CHECK_I(attr_id, "H5Acreate2");
+ /* Commit the datatype for the latter iterations.
+ * Only do this ONCE.
+ */
+ if (op_index == 1) {
+ ret = H5Tcommit2(file_id, "datatype", type_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(ret, "H5Tcommit2");
+ }
- /* Open the attribute to get another handle */
- attr_id2 = H5Aopen(group_id, "attribute", H5P_DEFAULT);
- CHECK_I(attr_id2, "H5Aopen");
+ attr_id = H5Acreate2(group_id, "attribute", type_id, space_id, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK_I(attr_id, "H5Acreate2");
- ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
- CHECK_I(ret, "H5Awrite");
+ if (op_index == 2) {
+ /* Open the attribute to get another handle */
+ attr_id2 = H5Aopen(group_id, "attribute", H5P_DEFAULT);
+ CHECK_I(attr_id2, "H5Aopen");
+ }
- /* Close the group */
- ret = H5Gclose(group_id);
- CHECK_I(ret, "H5Gclose");
+ ret = H5Awrite(attr_id, H5T_NATIVE_INT, wdata);
+ CHECK_I(ret, "H5Awrite");
- /* Flush the file to force data to be written */
- ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
- CHECK_I(ret, "H5Fflush");
+ ret = H5Gclose(group_id);
+ CHECK_I(ret, "H5Gclose");
+ ret = H5Tclose(type_id);
+ CHECK_I(ret, "H5Tclose")
- /* Verify the data with another ID handle */
- HDmemset(rdata, 0, sizeof(rdata));
- ret = H5Aread(attr_id2, H5T_NATIVE_INT, rdata);
- CHECK_I(ret, "H5Aread");
+ /* Flush the file to force data to be written */
+ ret = H5Fflush(file_id, H5F_SCOPE_GLOBAL);
+ CHECK_I(ret, "H5Fflush");
- for(x = 0; x < (size_t)dims; ++x)
- VERIFY(rdata[x], wdata[x], "H5Aread");
+ /* Verify */
+ attr_read_id = (op_index == 2) ? attr_id2 : attr_id;
+ HDmemset(rdata, 0, sizeof(rdata));
+ ret = H5Aread(attr_read_id, H5T_NATIVE_INT, rdata);
+ CHECK_I(ret, "H5Aread");
+ for(x = 0; x < (size_t)dims; ++x)
+ VERIFY(rdata[x], wdata[x], "H5Aread");
- /* Cleanup */
- ret = H5Aclose(attr_id);
- CHECK_I(ret, "H5Aclose");
- ret = H5Aclose(attr_id2);
- CHECK_I(ret, "H5Aclose");
+ ret = H5Aclose(attr_id);
+ CHECK_I(ret, "H5Aclose");
+ if (attr_id2 > -1 ) {
+ ret = H5Aclose(attr_id2);
+ CHECK_I(ret, "H5Aclose");
+ }
+ } /* for each attribute operation */
ret = H5Sclose(space_id);
CHECK_I(ret, "H5Sclose");
ret = H5Fclose(file_id);
CHECK_I(ret, "H5Fclose");
-}
+#undef TSOHM_SAH_OP_COUNT
+} /* sohm_attr_helper */
/*-------------------------------------------------------------------------
@@ -1125,101 +1175,160 @@ static void sohm_attr_helper(hid_t fcpl_id)
*
*-------------------------------------------------------------------------
*/
-static void test_sohm_attrs(void)
+static void
+test_sohm_attrs(void)
{
hid_t fcpl_id;
+ unsigned i = 0;
+#define TSOHM_TSA_NFLAGS_1 7
+ unsigned flags1[TSOHM_TSA_NFLAGS_1] = {
+ H5O_SHMESG_ATTR_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ };
+#define TSOHM_TSA_NFLAGS_2 6
+ unsigned flags2[TSOHM_TSA_NFLAGS_2][2] = {
+ { H5O_SHMESG_ATTR_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ },
+ { H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ },
+ { H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
+ },
+ { H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG,
+ },
+ { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG,
+ },
+ { H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_DTYPE_FLAG,
+ },
+ };
+#define TSOHM_TSA_NFLAGS_3 5
+ unsigned flags3[TSOHM_TSA_NFLAGS_3][3] = {
+ { H5O_SHMESG_ATTR_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_DTYPE_FLAG,
+ },
+ { H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG,
+ H5O_SHMESG_SDSPACE_FLAG,
+ },
+ { H5O_SHMESG_SDSPACE_FLAG,
+ H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG,
+ },
+ { 0, /* first index does not hold a shared message type? */
+ H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG,
+ },
+ { 0, /* missing SDSPACE flag */
+ H5O_SHMESG_DTYPE_FLAG,
+ H5O_SHMESG_ATTR_FLAG,
+ },
+ };
herr_t ret;
MESSAGE(5, ("Testing that shared messages work with attributes\n"));
- /* Create an fcpl with no shared messages */
+ /* No shared messages */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 0);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- /* Make sure attributes can be read with these settings (they'd better!) */
- sohm_attr_helper(fcpl_id);
-
-
- /* Run tests with only one kind of message to be shared */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- /* Verify */
- sohm_attr_helper(fcpl_id);
-
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- sohm_attr_helper(fcpl_id);
-
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_DTYPE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- sohm_attr_helper(fcpl_id);
-
-
- /* Run with any two types shared */
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- sohm_attr_helper(fcpl_id);
-
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- sohm_attr_helper(fcpl_id);
-
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_ATTR_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
sohm_attr_helper(fcpl_id);
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
- /* Run test with all three kinds of message shared */
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_ATTR_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ /* One shared message index
+ */
+ for (i=0; i < TSOHM_TSA_NFLAGS_1; i++) {
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags1[i], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- sohm_attr_helper(fcpl_id);
+ sohm_attr_helper(fcpl_id);
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ }
- /* Try using two indexes */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG | H5O_SHMESG_DTYPE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_SDSPACE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ /* two shared message indices
+ */
+ for (i=0; i < TSOHM_TSA_NFLAGS_2; i++) {
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags2[i][0], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, flags2[i][1], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- sohm_attr_helper(fcpl_id);
+ sohm_attr_helper(fcpl_id);
- ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_DTYPE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ }
- sohm_attr_helper(fcpl_id);
+ /* duplicate flags in separate indices causes problems
+ */
+ H5E_BEGIN_TRY {
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ATTR_FLAG, 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+
+ ret = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
+ VERIFY(ret, -1, "H5Fcreate");
+
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ } H5E_END_TRY;
- ret = H5Pset_shared_mesg_index(fcpl_id, 1, H5O_SHMESG_ATTR_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ /* three shared message indices
+ */
+ for (i=0; i < TSOHM_TSA_NFLAGS_3; i++) {
+ fcpl_id = H5Pcreate(H5P_FILE_CREATE);
+ CHECK_I(fcpl_id, "H5Pcreate");
+ ret = H5Pset_shared_mesg_nindexes(fcpl_id, 3);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 0, flags3[i][0], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 1, flags3[i][1], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+ ret = H5Pset_shared_mesg_index(fcpl_id, 2, flags3[i][2], 2);
+ CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- sohm_attr_helper(fcpl_id);
+ sohm_attr_helper(fcpl_id);
+ ret = H5Pclose(fcpl_id);
+ CHECK_I(ret, "H5Pclose");
+ }
- /* One index for each kind of message */
- ret = H5Pset_shared_mesg_nindexes(fcpl_id, 3);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
- ret = H5Pset_shared_mesg_index(fcpl_id, 2, H5O_SHMESG_SDSPACE_FLAG, 2);
- CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
+#undef TSOHM_TSA_NFLAGS_1
+#undef TSOHM_TSA_NFLAGS_2
+#undef TSOHM_TSA_NFLAGS_3
- sohm_attr_helper(fcpl_id);
+} /* test_sohm_attrs */
- /* Close the FCPL */
- ret = H5Pclose(fcpl_id);
- CHECK_I(ret, "H5Pclose");
-}
/*-------------------------------------------------------------------------
* Function: size2_verify_plist1
@@ -1233,7 +1342,8 @@ static void test_sohm_attrs(void)
*
*-------------------------------------------------------------------------
*/
-static void size2_verify_plist1(hid_t plist)
+static void
+size2_verify_plist1(hid_t plist)
{
size_t cd_nelmts;
unsigned int cd_value;
@@ -1281,7 +1391,8 @@ static void size2_verify_plist1(hid_t plist)
ret = H5Tclose(dtype1_id);
CHECK_I(ret, "H5Tclose");
-}
+} /* size2_verify_plist1 */
+
/*-------------------------------------------------------------------------
* Function: size2_verify_plist2
@@ -1295,7 +1406,8 @@ static void size2_verify_plist1(hid_t plist)
*
*-------------------------------------------------------------------------
*/
-static void size2_verify_plist2(hid_t plist)
+static void
+size2_verify_plist2(hid_t plist)
{
size_t cd_nelmts;
unsigned int cd_value;
@@ -1352,7 +1464,7 @@ static void size2_verify_plist2(hid_t plist)
ret = H5Tclose(dtype2_id);
CHECK_I(ret, "H5Tclose");
-}
+} /* size2_verify_plist2 */
#ifdef NOT_NOW
@@ -1382,7 +1494,7 @@ size2_dump_struct(const char *name, size2_helper_struct *sizes)
printf(" interleaved: %llu \tdelta: %llu\n", (unsigned long long)sizes->interleaved, (unsigned long long)(sizes->interleaved - sizes->dsets2));
printf(" attributes: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs1, (unsigned long long)(sizes->attrs1 - sizes->interleaved));
printf(" attributes 2: %llu \tdelta: %llu\n", (unsigned long long)sizes->attrs2, (unsigned long long)(sizes->attrs2 - sizes->attrs1));
-}
+} /* size2_dump_struct */
#endif /* NOT_NOW */
@@ -1573,15 +1685,14 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
ret_sizes->dsets1 = h5_get_file_size(FILENAME, H5P_DEFAULT);
- /* Now create a new group filled with datasets that use all different messages */
+ /* Create new group filled with datasets that use all different messages */
file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
CHECK_I(file_id, "H5Fopen");
group_id = H5Gcreate2(file_id, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(group_id, "H5Gcreate2");
/* Create NUM_DATASETS datasets in the new group */
- for(x=0; x<NUM_DATASETS; ++x)
- {
+ for(x=0; x<NUM_DATASETS; ++x) {
dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype2_id, dspace2_id, H5P_DEFAULT, dcpl2_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
@@ -1604,7 +1715,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
}
- }
+ } /* for each dataset */
/* Close file and get its size now */
ret = H5Gclose(group_id);
@@ -1621,8 +1732,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(group_id, "H5Gcreate2");
/* Create NUM_DATASETS datasets in the new group */
- for(x=0; x<NUM_DATASETS; x+=2)
- {
+ for(x=0; x<NUM_DATASETS; x+=2) {
dset_id = H5Dcreate2(group_id, DSETNAME[x], dtype1_id, dspace1_id, H5P_DEFAULT, dcpl1_id, H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
@@ -1658,7 +1768,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
}
- }
+ } /* for each even dataset */
/* Close file and get its size now */
ret = H5Gclose(group_id);
@@ -1700,7 +1810,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
}
- }
+ } /* for each attribute */
/* Close file and get its size now */
ret = H5Gclose(group_id);
@@ -1716,8 +1826,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
- for(x=0; x<NUM_ATTRIBUTES; ++x)
- {
+ for(x=0; x<NUM_ATTRIBUTES; ++x) {
/* Create the same name and value for each attribute as before */
attr_string1[0] = attr_name[0] = (char)((x / 10) + '0');
attr_string1[1] = attr_name[1] = (char)((x % 10) + '0');
@@ -1740,7 +1849,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
group_id = H5Gopen2(file_id, "interleaved group", H5P_DEFAULT);
CHECK_I(group_id, "H5Gopen2");
}
- }
+ } /* for each attribute */
+
/* Close file and get its size now */
ret = H5Gclose(group_id);
CHECK_I(ret, "H5Gclose");
@@ -1768,7 +1878,7 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
CHECK_I(ret, "H5Pclose");
return 0;
-}
+} /* size2_helper */
/*-------------------------------------------------------------------------
@@ -1785,7 +1895,8 @@ size2_helper(hid_t fcpl_id, int test_file_closing, size2_helper_struct *ret_size
*
*-------------------------------------------------------------------------
*/
-static void size2_verify(void)
+static void
+size2_verify(void)
{
hid_t file_id = -1;
hid_t dset_id=-1;
@@ -1957,7 +2068,7 @@ static void size2_verify(void)
CHECK_I(attr1_id, "H5Aclose");
ret = H5Aclose(attr2_id);
CHECK_I(attr2_id, "H5Aclose");
- }
+ } /* for each attribute */
/* Close everything */
ret = H5Tclose(attr_type_id);
@@ -1968,7 +2079,7 @@ static void size2_verify(void)
CHECK_I(ret, "H5Gclose");
ret = H5Fclose(file_id);
CHECK_I(ret, "H5Fclose");
-}
+} /* size2_verify */
/*-------------------------------------------------------------------------
@@ -1993,7 +2104,8 @@ static void size2_verify(void)
*
*-------------------------------------------------------------------------
*/
-static void test_sohm_size2(int close_reopen)
+static void
+test_sohm_size2(int close_reopen)
{
hid_t fcpl_id = -1;
/* Sizes for file with no shared messages at all */
@@ -2585,7 +2697,7 @@ static void test_sohm_size2(int close_reopen)
VERIFY(0, 1, "h5_get_file_size");
if((h5_stat_size_t)((float)share_tiny_index.attrs2 * OVERHEAD_ALLOWED) < type_space_index.attrs2)
VERIFY(0, 1, "h5_get_file_size");
-} /* end test_sohm_size2() */
+} /* end test_sohm_size2() */
/*-------------------------------------------------------------------------
@@ -2601,27 +2713,24 @@ static void test_sohm_size2(int close_reopen)
*
*-------------------------------------------------------------------------
*/
-static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x)
+static void
+delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id, int x)
{
hid_t dset_id = -1;
hid_t attr_id = -1;
char wdata;
herr_t ret;
- /* Create dataset */
dset_id = H5Dcreate2(file_id, DSETNAME[x], H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, dcpl_id[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dcreate2");
- /* Write data to dataset */
wdata = (char)(x + 'a');
ret = H5Dwrite(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &wdata);
CHECK_I(ret, "H5Dwrite");
- /* Create an attribute on the dataset. */
attr_id = H5Acreate2(dset_id, "attr_name", H5T_NATIVE_CHAR, dspace_id[x], H5P_DEFAULT, H5P_DEFAULT);
CHECK_I(attr_id, "H5Acreate2");
- /* Write to attribute */
ret = H5Awrite(attr_id, H5T_NATIVE_CHAR, &wdata);
CHECK_I(ret, "H5Awrite");
@@ -2629,7 +2738,7 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id,
CHECK_I(ret, "H5Aclose");
ret = H5Dclose(dset_id);
CHECK_I(ret, "H5Dclose");
-}
+} /* delete_helper_write */
/*-------------------------------------------------------------------------
@@ -2645,28 +2754,25 @@ static void delete_helper_write(hid_t file_id, hid_t *dspace_id, hid_t *dcpl_id,
*
*-------------------------------------------------------------------------
*/
-static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
+static void
+delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
{
hid_t dset_id = -1;
hid_t attr_id = -1;
char rdata;
herr_t ret;
- /* Open dataset */
dset_id = H5Dopen2(file_id, DSETNAME[x], H5P_DEFAULT);
CHECK_I(dset_id, "H5Dopen2");
- /* Read */
rdata = '\0';
ret = H5Dread(dset_id, H5T_NATIVE_CHAR, dspace_id[x], dspace_id[x], H5P_DEFAULT, &rdata);
CHECK_I(ret, "H5Dread");
VERIFY(rdata, (x + 'a'), "H5Dread");
- /* Open attribute */
attr_id = H5Aopen(dset_id, "attr_name", H5P_DEFAULT);
CHECK_I(attr_id, "H5Aopen");
- /* Read */
rdata = '\0';
ret = H5Aread(attr_id, H5T_NATIVE_CHAR, &rdata);
CHECK_I(ret, "H5Dread");
@@ -2677,7 +2783,7 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
CHECK_I(ret, "H5Aclose");
ret = H5Dclose(dset_id);
CHECK_I(ret, "H5Dclose");
-}
+} /* delete_helper_read */
/*-------------------------------------------------------------------------
@@ -2701,7 +2807,8 @@ static void delete_helper_read(hid_t file_id, hid_t *dspace_id, int x)
*
*-------------------------------------------------------------------------
*/
-static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
+static void
+delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
{
hid_t file_id=-1;
int x;
@@ -2765,7 +2872,7 @@ static void delete_helper(hid_t fcpl_id, hid_t *dspace_id, hid_t *dcpl_id)
VERIFY(norm_filesize, deleted_filesize, "h5_get_file_size");
if(deleted_filesize > (h5_stat_size_t)((float)norm_filesize * OVERHEAD_ALLOWED))
VERIFY(deleted_filesize, norm_filesize, "h5_get_file_size");
-}
+} /* delete_helper */
/*-------------------------------------------------------------------------
@@ -2799,6 +2906,8 @@ test_sohm_delete(void)
hsize_t dims[] = DELETE_DIMS;
herr_t ret;
+ MESSAGE(5, ("Testing deletion of SOHMs\n"));
+
/* Create a number of different dataspaces.
* For simplicity, each dataspace has only one element.
*/
@@ -2914,13 +3023,14 @@ test_sohm_delete(void)
/*-------------------------------------------------------------------------
- * Function: test_sohm_delete_revert_helper
+ * Function: verify_dset_create_and_delete_does_not_grow_file
*
* Purpose: Tests that shared object header message deletion returns
* the file to its previous state using the supplied FCPL.
*
- * Creates shared messages and then deletes them. Ensures
- * that the file has not grown in size.
+ * Creates a file according to the supplied FCPL,
+ * then creates datasets and deletes them.
+ * Done in two passes: once with one dataset, once with two.
*
* Programmer: James Laird
* Wednesday, January 3, 2007
@@ -2930,7 +3040,7 @@ test_sohm_delete(void)
*-------------------------------------------------------------------------
*/
static int
-test_sohm_delete_revert_helper(hid_t fcpl_id)
+verify_dset_create_and_delete_does_not_grow_file(hid_t fcpl_id)
{
hid_t file_id;
hid_t dspace_id;
@@ -3017,13 +3127,14 @@ test_sohm_delete_revert_helper(hid_t fcpl_id)
return(0);
else
return(-1);
-} /* test_sohm_delete_revert_helper() */
+} /* verify_dset_create_and_delete_does_not_grow_file */
/*-------------------------------------------------------------------------
* Function: test_sohm_delete_revert
*
- * Purpose: Calls test_sohm_delete_revert_helper with different FCPLs.
+ * Purpose: Verifies that creation and deletion of datasets with shared
+ * message headers will not increase file size.
*
* Programmer: James Laird
* Wednesday, January 3, 2007
@@ -3038,6 +3149,8 @@ test_sohm_delete_revert(void)
hid_t fcpl_id;
herr_t ret;
+ MESSAGE(5, ("Testing that file reverts to original size on SOHM deletion\n"));
+
/* Create an fcpl with messages in two indexes */
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
@@ -3049,14 +3162,14 @@ test_sohm_delete_revert(void)
CHECK_I(ret, "H5Pset_shared_mesg_index");
/* Call the helper function to test this FCPL. */
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
/* Try using B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
/* Try sharing all messages */
@@ -3067,14 +3180,14 @@ test_sohm_delete_revert(void)
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 10, 5);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
/* Try using B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
/* There should be at least two messages in the test (datatype and
* dataspace). Use an index that will transition from a list to
@@ -3082,8 +3195,8 @@ test_sohm_delete_revert(void)
*/
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1, 2);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
/* Try with shared messages enabled, but when messages are too big
@@ -3091,16 +3204,16 @@ test_sohm_delete_revert(void)
*/
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 35);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_delete_revert_helper(fcpl_id);
- CHECK_I(ret, "test_sohm_delete_revert_helper");
+ ret = verify_dset_create_and_delete_does_not_grow_file(fcpl_id);
+ CHECK_I(ret, "verify_dset_create_and_delete_does_not_grow_file");
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-}
+} /* test_sohm_delete_revert */
/*-------------------------------------------------------------------------
- * Function: test_sohm_extlink_helper
+ * Function: verify_dset_create_and_open_through_extlink_with_sohm
*
* Purpose: Tests that a dataset created through an external link can
* be opened (that shared messages were created or not and
@@ -3113,7 +3226,8 @@ test_sohm_delete_revert(void)
*
*-------------------------------------------------------------------------
*/
-static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id)
+static void
+verify_dset_create_and_open_through_extlink_with_sohm(hid_t src_fcpl_id, hid_t dst_fcpl_id)
{
hid_t src_file_id = -1;
hid_t dst_file_id = -1;
@@ -3164,7 +3278,7 @@ static void test_sohm_extlink_helper(hid_t src_fcpl_id, hid_t dst_fcpl_id)
CHECK_I(ret, "H5Dclose");
ret = H5Fclose(dst_file_id);
CHECK_I(ret, "H5Fclose");
-}
+} /* verify_dset_create_and_open_through_extlink_with_sohm */
/*-------------------------------------------------------------------------
@@ -3186,7 +3300,8 @@ test_sohm_extlink(void)
hid_t fcpl_id = -1;
herr_t ret;
- /* Create fcpl */
+ MESSAGE(5, ("Testing SOHM creation through external links\n"));
+
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
@@ -3194,20 +3309,17 @@ test_sohm_extlink(void)
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 16);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- /* Test using external links when the source or destination file uses
- * shared messages
- */
- test_sohm_extlink_helper(fcpl_id, H5P_DEFAULT);
- test_sohm_extlink_helper(H5P_DEFAULT, fcpl_id);
- test_sohm_extlink_helper(fcpl_id, fcpl_id);
+ verify_dset_create_and_open_through_extlink_with_sohm(fcpl_id, H5P_DEFAULT);
+ verify_dset_create_and_open_through_extlink_with_sohm(H5P_DEFAULT, fcpl_id);
+ verify_dset_create_and_open_through_extlink_with_sohm(fcpl_id, fcpl_id);
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-}
+} /* test_sohm_extlink */
/*-------------------------------------------------------------------------
- * Function: test_sohm_extend_dset_helper
+ * Function: verify_dataset_extension
*
* Purpose: Tests extending a dataset's dataspace when sharing is
* enabled.
@@ -3223,7 +3335,7 @@ test_sohm_extlink(void)
*-------------------------------------------------------------------------
*/
static int
-test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen)
+verify_dataset_extension(hid_t fcpl_id, hbool_t close_reopen)
{
hid_t file_id = -1;
hid_t orig_space_id = -1;
@@ -3239,10 +3351,95 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen)
int old_nerrs; /* Number of errors when entering this routine */
herr_t ret;
- /* Retrieve the current # of reported errors */
+ hsize_t *space_dims[3];
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Macro: TSOHM_VDE_VERIFY_SPACES
+ *
+ * Purpose: Encapsulate a common pattern
+ * Open, read-verify, and close the dataspaces for datasets 1-3
+ *
+ * Programmer: Jacob Smith
+ * 2018 November 5
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ */
+#define TSOHM_VDE_VERIFY_SPACES(dims) \
+{ \
+ /* Open dataspaces \
+ */ \
+ space1_id = H5Dget_space(dset1_id); \
+ CHECK_I(space1_id, "H5Dget_space"); \
+ space2_id = H5Dget_space(dset2_id); \
+ CHECK_I(space2_id, "H5Dget_space"); \
+ space3_id = H5Dget_space(dset3_id); \
+ CHECK_I(space3_id, "H5Dget_space"); \
+ /* Verify dataspaces \
+ */ \
+ ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for(x=0; x<EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[0][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for(x=0; x<EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[1][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims); \
+ CHECK_I(ret, "H5Sget_simple_extent_dims"); \
+ for(x=0; x<EXTEND_NDIMS; ++x) { \
+ VERIFY(out_dims[x], (dims)[2][x], "H5Sget_simple_extent_dims"); \
+ VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims"); \
+ } \
+ /* Close dataspaces \
+ */ \
+ CHECK_I(H5Sclose(space1_id), "H5Sclose"); \
+ CHECK_I(H5Sclose(space2_id), "H5Sclose"); \
+ CHECK_I(H5Sclose(space3_id), "H5Sclose"); \
+} /* define TSOHM_VDE_VERIFY_SPACES */
+
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ * Macro: TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS()
+ *
+ * Purpose: Encapsulate a common pattern
+ * Wrapper to close and reopen file and datasets:
+ * + "dataset" (dset_id)
+ * + if n > 1 then include "dataset2" (dset_id2)
+ * + if n > 2 then include "dataset3" (dset_id3)
+ * + file (file_id)
+ *
+ * Programmer: Jacob Smith
+ * 2018 November 5
+ * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+ */
+#define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(n) \
+{ \
+ CHECK_I(H5Dclose(dset1_id), "H5Dclose"); \
+ if ((n) > 1) \
+ CHECK_I(H5Dclose(dset2_id), "H5Dclose"); \
+ if ((n) > 2) \
+ CHECK_I(H5Dclose(dset3_id), "H5Dclose"); \
+ CHECK_I(H5Fclose(file_id), "H5Fclose"); \
+ \
+ file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); \
+ CHECK_I(file_id, "H5Fopen"); \
+ dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT); \
+ CHECK_I(dset1_id, "H5Dopen2"); \
+ if ((n) > 1) { \
+ dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT); \
+ CHECK_I(dset2_id, "H5Dopen2"); \
+ } \
+ if ((n) > 2) { \
+ dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT); \
+ CHECK_I(dset3_id, "H5Dopen2"); \
+ } \
+} /* define TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS */
+
+ /* Remember the current # of reported errors */
old_nerrs = GetTestNumErrs();
- /* Create file */
file_id = H5Fcreate(FILENAME, H5F_ACC_TRUNC, fcpl_id, H5P_DEFAULT);
CHECK_I(file_id, "H5Fcreate");
@@ -3258,250 +3455,52 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen)
dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset1_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1);
/* Create another dataset starting with the same dataspace */
dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset2_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2);
/* Create a third dataset with the same dataspace */
dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset3_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
/* Extend the first dataset */
ret = H5Dset_extent(dset1_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
-
- /* Get the dataspaces from the datasets */
- space1_id = H5Dget_space(dset1_id);
- CHECK_I(space1_id, "H5Dget_space");
- space2_id = H5Dget_space(dset2_id);
- CHECK_I(space2_id, "H5Dget_space");
- space3_id = H5Dget_space(dset3_id);
- CHECK_I(space3_id, "H5Dget_space");
-
- /* Verify the dataspaces */
- ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
- /* Close all three dataspaces */
- ret = H5Sclose(space1_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space2_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space3_id);
- CHECK_I(ret, "H5Sclose");
+ space_dims[0] = dims2;
+ space_dims[1] = dims1;
+ space_dims[2] = dims1;
+ TSOHM_VDE_VERIFY_SPACES(space_dims);
/* Extend the second dataset */
ret = H5Dset_extent(dset2_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
- /* Get the dataspaces from the datasets */
- space1_id = H5Dget_space(dset1_id);
- CHECK_I(space1_id, "H5Dget_space");
- space2_id = H5Dget_space(dset2_id);
- CHECK_I(space2_id, "H5Dget_space");
- space3_id = H5Dget_space(dset3_id);
- CHECK_I(space3_id, "H5Dget_space");
-
- /* Verify the dataspaces */
- ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims1[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- /* Close all three dataspaces */
- ret = H5Sclose(space1_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space2_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space3_id);
- CHECK_I(ret, "H5Sclose");
+ space_dims[1] = dims2;
+ TSOHM_VDE_VERIFY_SPACES(space_dims);
/* Extend the third dataset */
ret = H5Dset_extent(dset3_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
-
- /* Get the dataspaces from the datasets */
- space1_id = H5Dget_space(dset1_id);
- CHECK_I(space1_id, "H5Dget_space");
- space2_id = H5Dget_space(dset2_id);
- CHECK_I(space2_id, "H5Dget_space");
- space3_id = H5Dget_space(dset3_id);
- CHECK_I(space3_id, "H5Dget_space");
-
- /* Verify the dataspaces */
- ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
+ if(close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
- ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- /* Close all three dataspaces */
- ret = H5Sclose(space1_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space2_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space3_id);
- CHECK_I(ret, "H5Sclose");
+ space_dims[2] = dims2;
+ TSOHM_VDE_VERIFY_SPACES(space_dims);
/* Close the datasets and file */
ret = H5Dclose(dset1_id);
@@ -3523,164 +3522,44 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen)
CHECK_I(file_id, "H5Fcreate");
dset1_id = H5Dcreate2(file_id, "dataset", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset1_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1);
/* Extend the first dataset */
ret = H5Dset_extent(dset1_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(1);
/* Create the second dataset. Its dataspace will be unshared and then
* become shared when extended.
*/
dset2_id = H5Dcreate2(file_id, "dataset2", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset2_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2);
/* Extend the second dataset */
ret = H5Dset_extent(dset2_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(2);
/* Create the third dataset. Its dataspace will be unshared and then
* become shared when extended.
*/
dset3_id = H5Dcreate2(file_id, "dataset3", H5T_NATIVE_LONG, orig_space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
CHECK_I(dset3_id, "H5Dcreate2");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
/* Extend the third dataset */
ret = H5Dset_extent(dset3_id, dims2);
CHECK_I(ret, "H5Dset_extent");
- if(close_reopen) {
- /* If requested, close all open IDs and reopen them */
- ret = H5Dclose(dset1_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset2_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Dclose(dset3_id);
- CHECK_I(ret, "H5Dclose");
- ret = H5Fclose(file_id);
- CHECK_I(ret, "H5Fclose");
-
- file_id = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT);
- CHECK_I(file_id, "H5Fopen");
- dset1_id = H5Dopen2(file_id, "dataset", H5P_DEFAULT);
- CHECK_I(dset1_id, "H5Dopen2");
- dset2_id = H5Dopen2(file_id, "dataset2", H5P_DEFAULT);
- CHECK_I(dset2_id, "H5Dopen2");
- dset3_id = H5Dopen2(file_id, "dataset3", H5P_DEFAULT);
- CHECK_I(dset3_id, "H5Dopen2");
- }
-
- /* Get the dataspaces from the datasets */
- space1_id = H5Dget_space(dset1_id);
- CHECK_I(space1_id, "H5Dget_space");
- space2_id = H5Dget_space(dset2_id);
- CHECK_I(space2_id, "H5Dget_space");
- space3_id = H5Dget_space(dset3_id);
- CHECK_I(space3_id, "H5Dget_space");
-
- /* Verify the dataspaces */
- ret = H5Sget_simple_extent_dims(space1_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space2_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
-
- ret = H5Sget_simple_extent_dims(space3_id, out_dims, out_maxdims);
- CHECK_I(ret, "H5Sget_simple_extent_dims");
- for(x=0; x<EXTEND_NDIMS; ++x) {
- VERIFY(out_dims[x], dims2[x], "H5Sget_simple_extent_dims");
- VERIFY(out_maxdims[x], max_dims[x], "H5Sget_simple_extent_dims");
- }
+ if (close_reopen)
+ TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS(3);
- /* Close all three dataspaces */
- ret = H5Sclose(space1_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space2_id);
- CHECK_I(ret, "H5Sclose");
- ret = H5Sclose(space3_id);
- CHECK_I(ret, "H5Sclose");
+ TSOHM_VDE_VERIFY_SPACES(space_dims);
/* Close the datasets and file */
ret = H5Dclose(dset1_id);
@@ -3698,12 +3577,15 @@ test_sohm_extend_dset_helper(hid_t fcpl_id, hbool_t close_reopen)
ret = H5Pclose(dcpl_id);
CHECK_I(ret, "H5Pclose");
- /* Retrieve current # of errors */
+ /* Complaini if this test generated errors */
if(old_nerrs == GetTestNumErrs())
return(0);
else
return(-1);
-} /* end test_sohm_extend_dset_helper() */
+/* macros are exclusive to this function */
+#undef TSOHM_VDE_CLOSE_REOPEN_FILE_AND_DSETS
+#undef TSOHM_VDE_VERIFY_SPACES
+} /* verify_dataset_extension */
/*-------------------------------------------------------------------------
@@ -3726,7 +3608,8 @@ test_sohm_extend_dset(void)
hid_t fcpl_id = -1;
herr_t ret;
- /* Create fcpl */
+ MESSAGE(5, ("Testing extending shared dataspaces\n"));
+
fcpl_id = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl_id, "H5Pcreate");
@@ -3735,20 +3618,20 @@ test_sohm_extend_dset(void)
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
/* No shared messages */
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
/* Only dataspaces */
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_SDSPACE_FLAG, 16);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
/* All messages */
ret = H5Pset_shared_mesg_nindexes(fcpl_id, 1);
@@ -3756,44 +3639,44 @@ test_sohm_extend_dset(void)
ret = H5Pset_shared_mesg_index(fcpl_id, 0, H5O_SHMESG_ALL_FLAG, 16);
CHECK_I(ret, "H5Pset_shared_mesg_index");
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
/* All messages in lists */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 100, 50);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
/* All messages in lists converted to B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 1, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
/* All messages in B-trees */
ret = H5Pset_shared_mesg_phase_change(fcpl_id, 0, 0);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- ret = test_sohm_extend_dset_helper(fcpl_id, FALSE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
- ret = test_sohm_extend_dset_helper(fcpl_id, TRUE);
- CHECK_I(ret, "test_sohm_extend_dset_helper");
+ ret = verify_dataset_extension(fcpl_id, FALSE);
+ CHECK_I(ret, "verify_dataset_extension");
+ ret = verify_dataset_extension(fcpl_id, TRUE);
+ CHECK_I(ret, "verify_dataset_extension");
ret = H5Pclose(fcpl_id);
CHECK_I(ret, "H5Pclose");
-}
+} /* test_sohm_extend_dset */
/*-------------------------------------------------------------------------
@@ -3827,37 +3710,30 @@ test_sohm_external_dtype(void)
unsigned x, i;
herr_t ret;
+ MESSAGE(5, ("Testing shared external datatype\n"));
+
fcpl = H5Pcreate(H5P_FILE_CREATE);
CHECK_I(fcpl, "H5Pcreate");
-
- /* Set up index values for sohm */
ret = H5Pset_shared_mesg_nindexes(fcpl, TEST_NUM_INDEXES);
CHECK_I(ret, "H5Pset_shared_mesg_nindexes");
-
- for(x=0; x<TEST_NUM_INDEXES; ++x)
- {
+ for(x=0; x<TEST_NUM_INDEXES; ++x) {
ret = H5Pset_shared_mesg_index(fcpl, x, test_type_flags[x], test_minsizes[x]);
CHECK_I(ret, "H5Pset_shared_mesg_index");
}
-
ret = H5Pset_shared_mesg_phase_change(fcpl, TEST_L2B, TEST_B2L);
CHECK_I(ret, "H5Pset_shared_mesg_phase_change");
- /* Create the data space */
space = H5Screate_simple(2, dims, NULL);
CHECK_I(space, "H5Screate_simple");
- /* Create a data type for s1_t */
s1_tid = H5Tcreate(H5T_COMPOUND, sizeof(s1_t));
CHECK_I(s1_tid, "H5Tcreate");
-
ret = H5Tinsert(s1_tid, "a", HOFFSET(s1_t,a), H5T_NATIVE_INT);
CHECK_I(ret, "H5Tinsert");
-
ret = H5Tinsert (s1_tid, "b", HOFFSET(s1_t,b), H5T_NATIVE_INT);
CHECK_I(ret, "H5Tinsert");
- /* Create the first file for this test */
+ /* Set up dataset in first file */
file1 = H5Fcreate(FILENAME_SRC, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
CHECK_I(file1, "H5Fcreate");
@@ -3866,7 +3742,6 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test");
VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test");
- /* Create data set */
dataset1 = H5Dcreate2(file1, "dataset_1", s1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
CHECK_I(dataset1, "H5Dcreate2");
@@ -3876,26 +3751,25 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test");
VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test");
- /* Retieve the dataset's datatype */
dset1_tid = H5Dget_type(dataset1);
CHECK_I(dset1_tid, "H5Dget_type");
/* Allocate space and initialize data */
orig = (s1_t*)HDmalloc(NX * NY * sizeof(s1_t));
+ if (orig == NULL)
+ CHECK_I(-1, "HDmalloc");
for(i=0; i<NX*NY; i++) {
s_ptr = (s1_t*)orig + i;
s_ptr->a = (int)(i * 3 + 1);
s_ptr->b = (int)(i * 3 + 2);
}
- /* Write the data to the dataset1 */
ret = H5Dwrite(dataset1, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig);
CHECK_I(ret, "H5Dwrite");
-
ret = H5Dclose(dataset1);
CHECK_I(ret, "H5Dclose");
- /* Create the second file for this test */
+ /* Create dataset in second file using datatype from dataset in the first file */
file2 = H5Fcreate(FILENAME_DST, H5F_ACC_TRUNC, fcpl, H5P_DEFAULT);
CHECK_I(file2, "H5Fcreate");
@@ -3904,7 +3778,6 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test");
VERIFY(dmsg_count, 0, "H5F_get_sohm_mesg_count_test");
- /* Create a data set using the datatype of the dataset in the first file. */
dataset2 = H5Dcreate2(file2, "dataset_2", dset1_tid, space, H5P_DEFAULT, H5P_DEFAULT,
H5P_DEFAULT);
CHECK_I(dataset2, "H5Dcreate2");
@@ -3914,30 +3787,25 @@ test_sohm_external_dtype(void)
CHECK(ret, FAIL, "H5F_get_sohm_mesg_count_test");
VERIFY(dmsg_count, 1, "H5F_get_sohm_mesg_count_test");
- /* Write the data to the dataset2 */
ret = H5Dwrite(dataset2, s1_tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, orig);
CHECK_I(ret, "H5Dwrite");
ret = H5Dclose(dataset2);
CHECK_I(ret, "H5Dclose");
- /* Close file 1 and the dataset's datatype in file 1. Verify that the datatype in
- * file 2 is still accessible. */
ret = H5Tclose(dset1_tid);
CHECK_I(ret, "H5Tclose");
ret = H5Fclose(file1);
CHECK_I(ret, "H5Fclose");
- /* Open the dataset in file 2 */
+ /* Verify that datatype details are still accessible by second file */
dataset2 = H5Dopen2(file2, "dataset_2", H5P_DEFAULT);
CHECK_I(dataset2, "H5Dopen2");
- /* Retieve the dataset's datatype */
dset2_tid = H5Dget_type(dataset2);
CHECK_I(dset2_tid, "H5Dget_type");
- /* Verify the datatype is compound */
dtype_class = H5Tget_class(dset2_tid);
VERIFY(dtype_class, H5T_COMPOUND, "H5Tget_class");
@@ -3947,21 +3815,17 @@ test_sohm_external_dtype(void)
ret = H5Dclose(dataset2);
CHECK_I(ret, "H5Dclose");
- /* Finishing test and release resources */
+ /* Cleanup */
ret = H5Sclose(space);
CHECK_I(ret, "H5Sclose");
-
ret = H5Tclose(s1_tid);
CHECK_I(ret, "H5Tclose");
-
ret = H5Pclose(fcpl);
CHECK_I(ret, "H5Pclose");
-
ret = H5Fclose(file2);
CHECK_I(ret, "H5Fclose");
-
HDfree(orig);
-}
+} /* test_sohm_external_dtype */
/****************************************************************
@@ -3972,11 +3836,14 @@ test_sohm_external_dtype(void)
void
test_sohm(void)
{
- /* Output message about test being performed */
MESSAGE(5, ("Testing Shared Object Header Messages\n"));
test_sohm_fcpl(); /* Test SOHMs and file creation plists */
+ test_sohm_fcpl_errors(); /* Bogus H5P* calls for SOHMs */
test_sohm_size1(); /* Tests the sizes of files with one SOHM */
+#if 0 /* TODO: REVEALS BUG TO BE FIXED - SEE JIRA HDFFV-10645 */
+ test_sohm_size_consistency_open_create();
+#endif /* Jira HDFFV-10645 */
test_sohm_attrs(); /* Tests shared messages in attributes */
test_sohm_size2(0); /* Tests the sizes of files with multiple SOHMs */
test_sohm_size2(1); /* Tests the sizes of files with multiple
@@ -4012,5 +3879,5 @@ cleanup_sohm(void)
remove(FILENAME);
remove(FILENAME_SRC);
remove(FILENAME_DST);
-}
+} /* cleanup_sohm */
diff --git a/test/tvlstr.c b/test/tvlstr.c
index 3315d68..2c552eb 100644
--- a/test/tvlstr.c
+++ b/test/tvlstr.c
@@ -23,10 +23,14 @@
#define DATAFILE "tvlstr.h5"
#define DATAFILE2 "tvlstr2.h5"
+#define DATAFILE3 "sel2el.h5"
+
+#define DATASET "1Darray"
/* 1-D dataset with fixed dimensions */
#define SPACE1_RANK 1
#define SPACE1_DIM1 4
+#define NUMP 4
#define VLSTR_TYPE "vl_string_type"
@@ -846,6 +850,101 @@ static void test_vl_rewrite(void)
} /* end test_vl_rewrite() */
/****************************************************************
+ **
+ ** test_write_same_element():
+ ** Tests writing to the same element of VL string using
+ ** H5Sselect_element.
+ **
+ ****************************************************************/
+static void test_write_same_element(void)
+{
+ hid_t file1, dataset1;
+ hid_t mspace, fspace, dtype;
+ hsize_t fdim[] = {SPACE1_DIM1};
+ char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"};
+ hsize_t marray[] = {NUMP};
+ hsize_t coord[SPACE1_RANK][NUMP];
+ herr_t ret;
+
+ char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."};
+
+ file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(file1, FAIL, "H5Fcreate");
+
+ dtype = H5Tcopy(H5T_C_S1);
+ CHECK(dtype, FAIL, "H5Tcopy");
+
+ ret = H5Tset_size(dtype, H5T_VARIABLE);
+ CHECK(ret, FAIL, "H5Tset_size");
+
+ fspace = H5Screate_simple(SPACE1_RANK, fdim, NULL);
+ CHECK(fspace, FAIL, "H5Screate_simple");
+
+ dataset1 = H5Dcreate2(file1, DATASET, dtype, fspace, H5P_DEFAULT,
+ H5P_DEFAULT, H5P_DEFAULT);
+ CHECK(dataset1, FAIL, "H5Dcreate2");
+
+ ret = H5Dwrite(dataset1, dtype, H5S_ALL, H5S_ALL, H5P_DEFAULT, wdata);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ ret = H5Dclose(dataset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Sclose(fspace);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Fclose(file1);
+ CHECK(ret, FAIL, "H5Fclose");
+
+ /*
+ * Open the file. Select the same points, write values to those point locations.
+ */
+ file1 = H5Fopen(DATAFILE3, H5F_ACC_RDWR, H5P_DEFAULT);
+ CHECK(file1, FAIL, "H5Fopen");
+
+ dataset1 = H5Dopen2(file1, DATASET, H5P_DEFAULT);
+ CHECK(dataset1, FAIL, "H5Dopen2");
+
+ fspace = H5Dget_space(dataset1);
+ CHECK(fspace, FAIL, "H5Dget_space");
+
+ dtype = H5Dget_type(dataset1);
+ CHECK(dtype, FAIL, "H5Dget_type");
+
+ mspace = H5Screate_simple(1, marray, NULL);
+ CHECK(mspace, FAIL, "H5Screate_simple");
+
+ coord[0][0] = 0;
+ coord[0][1] = 2;
+ coord[0][2] = 2;
+ coord[0][3] = 0;
+
+ ret = H5Sselect_elements(fspace, H5S_SELECT_SET, NUMP, (const hsize_t *)&coord);
+ CHECK(ret, FAIL, "H5Sselect_elements");
+
+ ret = H5Dwrite(dataset1, dtype, mspace, fspace, H5P_DEFAULT, val);
+ CHECK(ret, FAIL, "H5Dwrite");
+
+ ret = H5Tclose(dtype);
+ CHECK(ret, FAIL, "H5Tclose");
+
+ ret = H5Dclose(dataset1);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Sclose(fspace);
+ CHECK(ret, FAIL, "H5Dclose");
+
+ ret = H5Sclose(mspace);
+ CHECK(ret, FAIL, "H5Sclose");
+
+ ret = H5Fclose(file1);
+ CHECK(ret, FAIL, "H5Fclose");
+} /* test_write_same_element */
+
+/****************************************************************
**
** test_vlstrings(): Main VL string testing routine.
**
@@ -869,6 +968,8 @@ test_vlstrings(void)
/* Test writing VL datasets in files with lots of unlinking */
test_vl_rewrite();
+ /* Test writing to the same element more than once using H5Sselect_elements */
+ test_write_same_element();
} /* test_vlstrings() */
@@ -891,5 +992,6 @@ cleanup_vlstrings(void)
{
HDremove(DATAFILE);
HDremove(DATAFILE2);
+ HDremove(DATAFILE3);
}
diff --git a/test/use.h b/test/use.h
index 0885cc5..54d9b26 100644
--- a/test/use.h
+++ b/test/use.h
@@ -58,6 +58,6 @@ int setup_parameters(int argc, char * const argv[]);
void show_parameters(void);
void usage(const char *prog);
int create_uc_file(void);
-int write_uc_file(hbool_t tosend);
+int write_uc_file(hbool_t tosend, hid_t fid);
int read_uc_file(hbool_t towait);
diff --git a/test/use_append_chunk.c b/test/use_append_chunk.c
index 005eb51..4e8c672 100644
--- a/test/use_append_chunk.c
+++ b/test/use_append_chunk.c
@@ -124,10 +124,13 @@ main(int argc, char *argv[])
int ret_value = 0;
int child_ret_value;
hbool_t send_wait = FALSE;
+ hid_t fapl = -1; /* File access property list */
+ hid_t fid = -1; /* File ID */
+ char *name; /* Test file name */
/* initialization */
if (setup_parameters(argc, argv) < 0){
- Hgoto_error(1);
+ Hgoto_error(1);
}
/* Determine the need to send/wait message file*/
@@ -145,20 +148,20 @@ main(int argc, char *argv[])
/* Create file */
/* ============*/
if (UC_opts.launch != UC_READER){
- printf("Creating skeleton data file for test...\n");
- if (create_uc_file() < 0){
- fprintf(stderr, "***encounter error\n");
- Hgoto_error(1);
- }else
- printf("File created.\n");
+ HDprintf("Creating skeleton data file for test...\n");
+ if (create_uc_file() < 0){
+ HDfprintf(stderr, "***encounter error\n");
+ Hgoto_error(1);
+ }else
+ HDprintf("File created.\n");
}
if (UC_opts.launch==UC_READWRITE){
- /* fork process */
- if((childpid = HDfork()) < 0) {
- HDperror("fork");
- Hgoto_error(1);
- };
+ /* fork process */
+ if((childpid = HDfork()) < 0) {
+ HDperror("fork");
+ Hgoto_error(1);
+ };
};
mypid = HDgetpid();
@@ -166,53 +169,83 @@ main(int argc, char *argv[])
/* launch reader */
/* ============= */
if (UC_opts.launch != UC_WRITER){
- /* child process launch the reader */
- if(0 == childpid) {
- printf("%d: launch reader process\n", mypid);
- if (read_uc_file(send_wait) < 0){
- fprintf(stderr, "read_uc_file encountered error\n");
- exit(1);
- }
- exit(0);
- }
+ /* child process launch the reader */
+ if(0 == childpid) {
+ HDprintf("%d: launch reader process\n", mypid);
+ if (read_uc_file(send_wait) < 0){
+ HDfprintf(stderr, "read_uc_file encountered error\n");
+ HDexit(1);
+ }
+ HDexit(0);
+ }
}
/* ============= */
/* launch writer */
/* ============= */
/* this process continues to launch the writer */
- printf("%d: continue as the writer process\n", mypid);
- if (write_uc_file(send_wait) < 0){
- fprintf(stderr, "write_uc_file encountered error\n");
- Hgoto_error(1);
+ HDprintf("%d: continue as the writer process\n", mypid);
+
+ name = UC_opts.filename;
+
+ /* Set file access proeprty list */
+ if((fapl = h5_fileaccess()) < 0)
+ Hgoto_error(1);
+
+ if(UC_opts.use_swmr)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ Hgoto_error(1);
+
+ /* Open the file */
+ if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) {
+ HDfprintf(stderr, "H5Fopen failed\n");
+ Hgoto_error(1);
+ }
+
+ if(write_uc_file(send_wait, fid) < 0) {
+ HDfprintf(stderr, "write_uc_file encountered error\n");
+ Hgoto_error(1);
}
/* ================================================ */
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (UC_opts.launch == UC_READWRITE){
- if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){
- HDperror("waitpid");
- Hgoto_error(1);
- }
- if (WIFEXITED(child_status)){
- if ((child_ret_value=WEXITSTATUS(child_status)) != 0){
- printf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
- Hgoto_error(2);
- }
- } else {
- printf("%d: child process terminated abnormally\n", mypid);
- Hgoto_error(2);
- }
+ if ((tmppid = HDwaitpid(childpid, &child_status, child_wait_option)) < 0){
+ HDperror("waitpid");
+ Hgoto_error(1);
+ }
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "Failed to close file id\n");
+ Hgoto_error(1);
+ }
+
+ /* Close the property list */
+ if(H5Pclose(fapl) < 0) {
+ HDfprintf(stderr, "Failed to close the property list\n");
+ Hgoto_error(1);
+ }
+
+ if (WIFEXITED(child_status)){
+ if ((child_ret_value=WEXITSTATUS(child_status)) != 0){
+ HDprintf("%d: child process exited with non-zero code (%d)\n",
+ mypid, child_ret_value);
+ Hgoto_error(2);
+ }
+ } else {
+ HDprintf("%d: child process terminated abnormally\n", mypid);
+ Hgoto_error(2);
+ }
}
done:
/* Print result and exit */
if (ret_value != 0){
- printf("Error(s) encountered\n");
+ HDprintf("Error(s) encountered\n");
}else{
- printf("All passed\n");
+ HDprintf("All passed\n");
}
return(ret_value);
diff --git a/test/use_append_mchunks.c b/test/use_append_mchunks.c
index 9ee37cb..0414628 100644
--- a/test/use_append_mchunks.c
+++ b/test/use_append_mchunks.c
@@ -117,10 +117,13 @@ main(int argc, char *argv[])
int ret_value = 0;
int child_ret_value;
hbool_t send_wait = 0;
+ hid_t fapl = -1; /* File access property list */
+ hid_t fid = -1; /* File ID */
+ char *name; /* Test file name */
/* initialization */
if (setup_parameters(argc, argv) < 0){
- Hgoto_error(1);
+ Hgoto_error(1);
}
/* Determine the need to send/wait message file*/
@@ -138,20 +141,20 @@ main(int argc, char *argv[])
/* Create file */
/* ============*/
if (UC_opts.launch != UC_READER){
- printf("Creating skeleton data file for test...\n");
+ HDprintf("Creating skeleton data file for test...\n");
if (create_uc_file() < 0){
- fprintf(stderr, "***encounter error\n");
+ HDfprintf(stderr, "***encounter error\n");
Hgoto_error(1);
}else
- printf("File created.\n");
+ HDprintf("File created.\n");
}
if (UC_opts.launch==UC_READWRITE){
- /* fork process */
- if((childpid = fork()) < 0) {
- perror("fork");
- Hgoto_error(1);
- };
+ /* fork process */
+ if((childpid = fork()) < 0) {
+ perror("fork");
+ Hgoto_error(1);
+ };
};
mypid = getpid();
@@ -159,53 +162,84 @@ main(int argc, char *argv[])
/* launch reader */
/* ============= */
if (UC_opts.launch != UC_WRITER){
- /* child process launch the reader */
- if(0 == childpid) {
- printf("%d: launch reader process\n", mypid);
- if (read_uc_file(send_wait) < 0){
- fprintf(stderr, "read_uc_file encountered error\n");
- exit(1);
- }
- exit(0);
- }
+ /* child process launch the reader */
+ if(0 == childpid) {
+ HDprintf("%d: launch reader process\n", mypid);
+ if (read_uc_file(send_wait) < 0){
+ HDfprintf(stderr, "read_uc_file encountered error\n");
+ HDexit(1);
+ }
+ HDexit(0);
+ }
}
/* ============= */
/* launch writer */
/* ============= */
/* this process continues to launch the writer */
- printf("%d: continue as the writer process\n", mypid);
- if (write_uc_file(send_wait) < 0){
- fprintf(stderr, "write_uc_file encountered error\n");
- Hgoto_error(1);
+ HDprintf("%d: continue as the writer process\n", mypid);
+
+ name = UC_opts.filename;
+
+ /* Set the file access property list */
+ if((fapl = h5_fileaccess()) < 0)
+ Hgoto_error(1);
+
+ if(UC_opts.use_swmr)
+ if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
+ Hgoto_error(1);
+
+ /* Open the file */
+ if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0) {
+ HDfprintf(stderr, "H5Fopen failed\n");
+ Hgoto_error(1);
+ }
+
+ if(write_uc_file(send_wait, fid) < 0) {
+ HDfprintf(stderr, "write_uc_file encountered error\n");
+ Hgoto_error(1);
}
+
/* ================================================ */
/* If readwrite, collect exit code of child process */
/* ================================================ */
if (UC_opts.launch == UC_READWRITE){
- if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){
- perror("waitpid");
- Hgoto_error(1);
- }
- if (WIFEXITED(child_status)){
- if ((child_ret_value=WEXITSTATUS(child_status)) != 0){
- printf("%d: child process exited with non-zero code (%d)\n",
- mypid, child_ret_value);
- Hgoto_error(2);
- }
- } else {
- printf("%d: child process terminated abnormally\n", mypid);
- Hgoto_error(2);
- }
+ if ((tmppid = waitpid(childpid, &child_status, child_wait_option)) < 0){
+ perror("waitpid");
+ Hgoto_error(1);
+ }
+
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "Failed to close file id\n");
+ Hgoto_error(1);
+ }
+
+ /* Close the property list */
+ if(H5Pclose(fapl) < 0) {
+ HDfprintf(stderr, "Failed to close the property list\n");
+ Hgoto_error(1);
+ }
+
+ if (WIFEXITED(child_status)){
+ if ((child_ret_value=WEXITSTATUS(child_status)) != 0){
+ HDprintf("%d: child process exited with non-zero code (%d)\n",
+ mypid, child_ret_value);
+ Hgoto_error(1);
+ }
+ } else {
+ HDprintf("%d: child process terminated abnormally\n", mypid);
+ Hgoto_error(2);
+ }
}
done:
/* Print result and exit */
if (ret_value != 0){
- printf("Error(s) encountered\n");
+ HDprintf("Error(s) encountered\n");
}else{
- printf("All passed\n");
+ HDprintf("All passed\n");
}
return(ret_value);
diff --git a/test/use_common.c b/test/use_common.c
index 5aa6692..3ecb2e1 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -252,13 +252,10 @@ int create_uc_file(void)
*
* Return: 0 succeed; -1 fail.
*/
-int write_uc_file(hbool_t tosend)
+int write_uc_file(hbool_t tosend, hid_t fid)
{
- hid_t fid; /* File ID for new HDF5 file */
hid_t dsid; /* dataset ID */
- hid_t fapl; /* File access property list */
hid_t dcpl; /* Dataset creation property list */
- char *name;
UC_CTYPE *buffer, *bufptr; /* data buffer */
hsize_t cz=UC_opts.chunksize; /* Chunk size */
hid_t f_sid; /* dataset file space id */
@@ -270,19 +267,6 @@ int write_uc_file(hbool_t tosend)
hsize_t start[3] = {0,0,0}, count[3]; /* Hyperslab selection values */
hsize_t i, j, k;
- name = UC_opts.filename;
-
- /* Open the file */
- if((fapl = h5_fileaccess()) < 0)
- return -1;
- if(UC_opts.use_swmr)
- if(H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
- return -1;
- if((fid = H5Fopen(name, H5F_ACC_RDWR | (UC_opts.use_swmr ? H5F_ACC_SWMR_WRITE : 0), fapl)) < 0){
- fprintf(stderr, "H5Fopen failed\n");
- return -1;
- }
-
if(tosend)
/* Send a message that H5Fopen is complete--releasing the file lock */
h5_send_message(WRITER_MESSAGE, NULL, NULL);
@@ -427,14 +411,6 @@ int write_uc_file(hbool_t tosend)
fprintf(stderr, "Failed to close file space\n");
return -1;
}
- if (H5Pclose(fapl) < 0){
- fprintf(stderr, "Failed to property list\n");
- return -1;
- }
- if (H5Fclose(fid) < 0){
- fprintf(stderr, "Failed to close file id\n");
- return -1;
- }
return 0;
}
@@ -471,7 +447,7 @@ int read_uc_file(hbool_t towait)
/* Before reading, wait for the message that H5Fopen is complete--file lock is released */
if(towait && h5_wait_message(WRITER_MESSAGE) < 0) {
- fprintf(stderr, "Cannot find writer message file...failed\n");
+ HDfprintf(stderr, "Cannot find writer message file...failed\n");
return -1;
}
@@ -481,19 +457,19 @@ int read_uc_file(hbool_t towait)
if((fapl = h5_fileaccess()) < 0)
return -1;
if((fid = H5Fopen(name, H5F_ACC_RDONLY | (UC_opts.use_swmr ? H5F_ACC_SWMR_READ : 0), fapl)) < 0){
- fprintf(stderr, "H5Fopen failed\n");
+ HDfprintf(stderr, "H5Fopen failed\n");
return -1;
}
if (H5Pclose(fapl) < 0){
- fprintf(stderr, "Failed to property list\n");
+ HDfprintf(stderr, "Failed to property list\n");
return -1;
}
/* Open the dataset of the program name */
if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){
- fprintf(stderr, "H5Dopen2 failed\n");
- return -1;
+ HDfprintf(stderr, "H5Dopen2 failed\n");
+ return -1;
}
/* allocate space for data buffer 1 X dims[1] X dims[2] of UC_CTYPE */
@@ -501,8 +477,8 @@ int read_uc_file(hbool_t towait)
memdims[1] = UC_opts.dims[1];
memdims[2] = UC_opts.dims[2];
if ((buffer=(UC_CTYPE*)HDmalloc((size_t)memdims[1]*(size_t)memdims[2]*sizeof(UC_CTYPE)))==NULL) {
- fprintf(stderr, "malloc: failed\n");
- return -1;
+ HDfprintf(stderr, "malloc: failed\n");
+ return -1;
};
/*
@@ -512,31 +488,31 @@ int read_uc_file(hbool_t towait)
f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK){
- fprintf(stderr, "rank(%d) of dataset does not match\n", rank);
- return -1;
+ HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){
- fprintf(stderr, "H5Sget_simple_extent_dims got error\n");
- return -1;
+ HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ return -1;
}
- printf("dataset rank %d, dimensions %llu x %llu x %llu\n",
- rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]),
- (unsigned long long)(dims[2]));
+ HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n",
+ rank, (unsigned long long)(dims[0]), (unsigned long long)(dims[1]),
+ (unsigned long long)(dims[2]));
/* verify that file space dims are as expected and are consistent with memory space dims */
if (dims[1] != memdims[1] || dims[2] != memdims[2]){
- fprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n",
- (unsigned long long)dims[0], (unsigned long long)dims[1],
+ HDfprintf(stderr, "dataset dimension is not as expected. Got dims=(%llu,%llu,%llu)\n",
+ (unsigned long long)dims[0], (unsigned long long)dims[1],
(unsigned long long)dims[2]);
- fprintf(stderr, "But memdims=(%llu,%llu,%llu)\n",
- (unsigned long long)memdims[0], (unsigned long long)memdims[1],
+ HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n",
+ (unsigned long long)memdims[0], (unsigned long long)memdims[1],
(unsigned long long)memdims[2]);
- return -1;
+ return -1;
}
/* setup mem-space for buffer */
if ((m_sid=H5Screate_simple(rank, memdims, NULL))<0){
- fprintf(stderr, "H5Screate_simple for memory failed\n");
- return -1;
+ HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ return -1;
};
/* Read 1 plane at a time whenever the dataset grows larger
@@ -550,22 +526,22 @@ int read_uc_file(hbool_t towait)
/* print progress message according to if new planes are availalbe */
if (nplane_old < dims[0]) {
if (nonewplane){
- /* end the previous message */
- printf("\n");
- nonewplane=0;
+ /* end the previous message */
+ HDprintf("\n");
+ nonewplane=0;
}
- printf("reading planes %llu to %llu\n", (unsigned long long)nplane_old,
+ HDprintf("reading planes %llu to %llu\n", (unsigned long long)nplane_old,
(unsigned long long)dims[0]);
}else{
if (nonewplane){
- printf(".");
+ HDprintf(".");
if (nonewplane>=30){
- fprintf(stderr, "waited too long for new plane, quit.\n");
+ HDfprintf(stderr, "waited too long for new plane, quit.\n");
return -1;
}
}else{
- /* print mesg only the first time; dots still no new plane */
- printf("no new planes to read ");
+ /* print mesg only the first time; dots still no new plane */
+ HDprintf("no new planes to read ");
}
nonewplane++;
/* pause for a second */
@@ -575,41 +551,41 @@ int read_uc_file(hbool_t towait)
/* read planes between last old nplanes and current extent */
/* Get the dataset's dataspace */
if((f_sid = H5Dget_space(dsid)) < 0){
- fprintf(stderr, "H5Dget_space failed\n");
- return -1;
+ HDfprintf(stderr, "H5Dget_space failed\n");
+ return -1;
}
start[0]=nplane;
/* Choose the next plane to read */
if(H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0){
- fprintf(stderr, "H5Sselect_hyperslab failed\n");
- return -1;
+ HDfprintf(stderr, "H5Sselect_hyperslab failed\n");
+ return -1;
}
/* Read the plane from the dataset */
if(H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0){
- fprintf(stderr, "H5Dread failed\n");
- return -1;
+ HDfprintf(stderr, "H5Dread failed\n");
+ return -1;
}
/* compare read data with expected data value which is nplane */
bufptr = buffer;
nerrs=0;
for (j=0; j<dims[1]; j++){
- for (k=0; k<dims[2]; k++){
- if ((hsize_t)*bufptr++ != nplane){
- if (++nerrs < ErrorReportMax){
- fprintf(stderr,
- "found error %llu plane(%llu,%llu), expected %llu, got %d\n",
- (unsigned long long)nplane, (unsigned long long)j,
- (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr-1));
- }
- }
- }
+ for (k=0; k<dims[2]; k++){
+ if ((hsize_t)*bufptr++ != nplane){
+ if (++nerrs < ErrorReportMax){
+ HDfprintf(stderr,
+ "found error %llu plane(%llu,%llu), expected %llu, got %d\n",
+ (unsigned long long)nplane, (unsigned long long)j,
+ (unsigned long long)k, (unsigned long long)nplane, (int)*(bufptr-1));
+ }
+ }
+ }
}
if (nerrs){
- nreadererr++;
- fprintf(stderr, "found %d unexpected values in plane %llu\n", nerrs,
+ nreadererr++;
+ HDfprintf(stderr, "found %d unexpected values in plane %llu\n", nerrs,
(unsigned long long)nplane);
}
}
@@ -620,19 +596,19 @@ int read_uc_file(hbool_t towait)
#if 0
/* close dsid and file, then reopen them */
if (H5Dclose(dsid) < 0){
- fprintf(stderr, "H5Dclose failed\n");
+ HDfprintf(stderr, "H5Dclose failed\n");
return -1;
}
if (H5Fclose(fid) < 0){
- fprintf(stderr, "H5Fclose failed\n");
+ HDfprintf(stderr, "H5Fclose failed\n");
return -1;
}
if((fid = H5Fopen(name, H5F_ACC_RDONLY | (UC_opts.use_swmr ? H5F_ACC_SWMR_READ : 0), H5P_DEFAULT)) < 0){
- fprintf(stderr, "H5Fopen failed\n");
+ HDfprintf(stderr, "H5Fopen failed\n");
return -1;
}
if((dsid = H5Dopen2(fid, progname_g, H5P_DEFAULT)) < 0){
- fprintf(stderr, "H5Dopen2 failed\n");
+ HDfprintf(stderr, "H5Dopen2 failed\n");
return -1;
}
#else
@@ -640,16 +616,22 @@ int read_uc_file(hbool_t towait)
#endif
f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0){
- fprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
return -1;
}
}
+ /* Close the file */
+ if(H5Fclose(fid) < 0) {
+ HDfprintf(stderr, "H5Fclose failed\n");
+ return -1;
+ }
+
if (nreadererr)
- return -1;
+ return -1;
else
- return 0;
-}
+ return 0;
+} /* read_uc_file() */
#endif /* H5_HAVE_FORK */
diff --git a/testpar/CMakeLists.txt b/testpar/CMakeLists.txt
index 0b3cbe3..71459c7 100644
--- a/testpar/CMakeLists.txt
+++ b/testpar/CMakeLists.txt
@@ -47,7 +47,7 @@ set (H5P_TESTS
t_mpi
t_bigio
t_cache
- t_cache_image
+ #t_cache_image
t_pflush1
t_pflush2
t_pread
diff --git a/testpar/CMakeTests.cmake b/testpar/CMakeTests.cmake
index 87470f3..12ccc58 100644
--- a/testpar/CMakeTests.cmake
+++ b/testpar/CMakeTests.cmake
@@ -15,59 +15,90 @@
### T E S T I N G ###
##############################################################################
##############################################################################
+# Remove any output file left over from previous test run
+add_test (NAME MPI_TEST-clear-testphdf5-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ParaTest.h5
+ WORKING_DIRECTORY
+ ${HDF5_TEST_PAR_BINARY_DIR}
+)
+set_tests_properties (MPI_TEST-clear-testphdf5-objects PROPERTIES FIXTURES_SETUP par_clear_testphdf5)
-add_test (NAME TEST_PAR_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS})
+set (SKIP_testphdf5 "")
+#if (${HDF5_OPENMPI_VERSION_SKIP})
+# set (SKIP_testphdf5 "${SKIP_testphdf5};-x;ecdsetw")
+#endif ()
-foreach (testp ${H5P_TESTS})
- add_test (NAME TEST_PAR_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS})
-endforeach ()
+add_test (NAME MPI_TEST_testphdf5 COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:testphdf5> ${MPIEXEC_POSTFLAGS} ${SKIP_testphdf5})
+set_tests_properties (MPI_TEST_testphdf5 PROPERTIES
+ FIXTURES_REQUIRED par_clear_testphdf5
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
+)
+if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (MPI_TEST_testphdf5 PROPERTIES DEPENDS ${last_test})
+endif ()
+set (last_test "MPI_TEST_testphdf5")
-# The following will only be correct on windows shared
-#set_tests_properties (TEST_PAR_t_pflush1 PROPERTIES WILL_FAIL "true")
-set_property (TEST TEST_PAR_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED")
-set_tests_properties (TEST_PAR_t_pflush2 PROPERTIES DEPENDS TEST_PAR_t_pflush1)
+#if (${HDF5_OPENMPI_VERSION_SKIP})
+# list (REMOVE_ITEM H5P_TESTS t_shapesame)
+#endif ()
-if (HDF5_TEST_VFD)
+set (test_par_CLEANFILES
+ t_cache_image_00.h5
+ t_cache_image_01.h5
+ t_cache_image_02.h5
+ flush.h5
+ noflush.h5
+ reloc_t_pread_data_file.h5
+ reloc_t_pread_group_0_file.h5
+ reloc_t_pread_group_1_file.h5
+ shutdown.h5
+ after_mpi_fin.h5
+ #the following should have been removed by the programs
+ bigio_test.h5
+ CacheTestDummy.h5
+ t_filters_parallel.h5
+ MPItest.h5
+ ShapeSameTest.h5
+)
- set (VFD_LIST
- sec2
- stdio
- core
- split
- multi
- family
- )
+# Remove any output file left over from previous test run
+add_test (NAME MPI_TEST-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${test_par_CLEANFILES}
+ WORKING_DIRECTORY
+ ${HDF5_TEST_PAR_BINARY_DIR}
+)
+set_tests_properties (MPI_TEST-clear-objects PROPERTIES FIXTURES_SETUP par_clear_objects)
- set (H5P_VFD_TESTS
- t_pflush1
- t_pflush2
+foreach (testp ${H5P_TESTS})
+ add_test (NAME MPI_TEST_${testp} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:${testp}> ${MPIEXEC_POSTFLAGS})
+ set_tests_properties (MPI_TEST_${testp} PROPERTIES
+ FIXTURES_REQUIRED par_clear_objects
+ ENVIRONMENT "HDF5_ALARM_SECONDS=3600;srcdir=${HDF5_TEST_PAR_BINARY_DIR}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}
)
-
- if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (MPI_TEST_${testp} PROPERTIES DEPENDS ${last_test})
endif ()
+ set (last_test "MPI_TEST_${testp}")
+endforeach ()
- macro (ADD_VFD_TEST vfdname resultcode)
- if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- foreach (test ${H5P_VFD_TESTS})
- add_test (
- NAME TEST_PAR_VFD-${vfdname}-${test}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=${test}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- endforeach ()
- endif ()
- endmacro ()
+# The t_pflush1 test is hard-coded to fail.
+set_tests_properties (MPI_TEST_t_pflush1 PROPERTIES WILL_FAIL "true")
+#set_property (TEST MPI_TEST_t_pflush1 PROPERTY PASS_REGULAR_EXPRESSION "PASSED")
+set_tests_properties (MPI_TEST_t_pflush2 PROPERTIES DEPENDS MPI_TEST_t_pflush1)
+set_tests_properties (MPI_TEST_t_prestart PROPERTIES DEPENDS MPI_TEST_t_pshutdown)
- # Run test with different Virtual File Driver
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
- endforeach ()
+##############################################################################
+##############################################################################
+### V F D T E S T S ###
+##############################################################################
+##############################################################################
+if (HDF5_TEST_VFD)
+ include (CMakeVFDTests.cmake)
endif ()
diff --git a/testpar/CMakeVFDTests.cmake b/testpar/CMakeVFDTests.cmake
new file mode 100644
index 0000000..de16a31
--- /dev/null
+++ b/testpar/CMakeVFDTests.cmake
@@ -0,0 +1,73 @@
+#
+# 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.
+#
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+ set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ set (H5P_VFD_TESTS
+ t_pflush1
+ t_pflush2
+ )
+
+ if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+ endif ()
+
+foreach (vfdtest ${VFD_LIST})
+ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/${vfdtest}")
+endforeach ()
+
+ macro (ADD_VFD_TEST vfdname resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ foreach (test ${H5P_VFD_TESTS})
+ add_test (
+ NAME MPI_TEST_VFD-${vfdname}-${test}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${vfdname}-shared/${vfdname}-${test}.out
+ ${vfdname}-shared/${vfdname}-${test}.out.err
+ )
+ add_test (
+ NAME MPI_TEST_VFD-${vfdname}-${test}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:${test}>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=${vfdname}-${test}.out"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/${vfdname}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ set_tests_properties (MPI_TEST_VFD-${vfdname}-${test} PROPERTIES
+ DEPENDS MPI_TEST_VFD-${vfdname}-${test}-clear-objects
+ ENVIRONMENT "srcdir=${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}"
+ WORKING_DIRECTORY ${HDF5_TEST_PAR_BINARY_DIR}/${vfdname}
+ )
+ endforeach ()
+ endif ()
+ endmacro ()
+
+ # Run test with different Virtual File Driver
+ foreach (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ endforeach ()
diff --git a/testpar/Makefile.am b/testpar/Makefile.am
index 7262ca6..a11099d 100644
--- a/testpar/Makefile.am
+++ b/testpar/Makefile.am
@@ -21,11 +21,19 @@ include $(top_srcdir)/config/commence.am
AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/test
+# Test scripts--
+# testpflush.sh:
+TEST_SCRIPT_PARA = testpflush.sh
+SCRIPT_DEPEND = t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
+
+check_SCRIPTS = $(TEST_SCRIPT_PARA)
+
# Test programs. These are our main targets.
#
-TEST_PROG_PARA=t_mpi t_bigio testphdf5 t_cache t_cache_image t_pflush1 t_pflush2 t_pread t_pshutdown t_prestart t_init_term t_shapesame t_filters_parallel
+TEST_PROG_PARA=t_mpi t_bigio testphdf5 t_cache t_cache_image t_pread t_pshutdown t_prestart t_init_term t_shapesame t_filters_parallel
-check_PROGRAMS = $(TEST_PROG_PARA)
+# t_pflush1 and t_pflush2 are used by testpflush.sh
+check_PROGRAMS = $(TEST_PROG_PARA) t_pflush1 t_pflush2
testphdf5_SOURCES=testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \
diff --git a/testpar/Makefile.in b/testpar/Makefile.in
index 5688cd7..7afbfad 100644
--- a/testpar/Makefile.in
+++ b/testpar/Makefile.in
@@ -102,7 +102,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-check_PROGRAMS = $(am__EXEEXT_1)
+check_PROGRAMS = $(am__EXEEXT_1) t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
TESTS =
subdir = testpar
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -130,13 +130,12 @@ DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/src/H5config.h \
$(top_builddir)/fortran/src/H5config_f.inc
-CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_FILES = testpflush.sh
CONFIG_CLEAN_VPATH_FILES =
am__EXEEXT_1 = t_mpi$(EXEEXT) t_bigio$(EXEEXT) testphdf5$(EXEEXT) \
- t_cache$(EXEEXT) t_cache_image$(EXEEXT) t_pflush1$(EXEEXT) \
- t_pflush2$(EXEEXT) t_pread$(EXEEXT) t_pshutdown$(EXEEXT) \
- t_prestart$(EXEEXT) t_init_term$(EXEEXT) t_shapesame$(EXEEXT) \
- t_filters_parallel$(EXEEXT)
+ t_cache$(EXEEXT) t_cache_image$(EXEEXT) t_pread$(EXEEXT) \
+ t_pshutdown$(EXEEXT) t_prestart$(EXEEXT) t_init_term$(EXEEXT) \
+ t_shapesame$(EXEEXT) t_filters_parallel$(EXEEXT)
t_bigio_SOURCES = t_bigio.c
t_bigio_OBJECTS = t_bigio.$(OBJEXT)
t_bigio_LDADD = $(LDADD)
@@ -463,8 +462,9 @@ am__set_b = \
*) \
b='$*';; \
esac
-am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/bin/depcomp \
- $(top_srcdir)/bin/test-driver $(top_srcdir)/config/commence.am \
+am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/testpflush.sh.in \
+ $(top_srcdir)/bin/depcomp $(top_srcdir)/bin/test-driver \
+ $(top_srcdir)/config/commence.am \
$(top_srcdir)/config/conclude.am COPYING
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
@@ -608,7 +608,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -642,6 +641,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -798,9 +798,15 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 MPItest.h5 \
Para*.h5 bigio_test.h5 CacheTestDummy.h5 ShapeSameTest.h5 \
shutdown.h5 after_mpi_fin.h5 go
+# Test scripts--
+# testpflush.sh:
+TEST_SCRIPT_PARA = testpflush.sh
+SCRIPT_DEPEND = t_pflush1$(EXEEXT) t_pflush2$(EXEEXT)
+check_SCRIPTS = $(TEST_SCRIPT_PARA)
+
# Test programs. These are our main targets.
#
-TEST_PROG_PARA = t_mpi t_bigio testphdf5 t_cache t_cache_image t_pflush1 t_pflush2 t_pread t_pshutdown t_prestart t_init_term t_shapesame t_filters_parallel
+TEST_PROG_PARA = t_mpi t_bigio testphdf5 t_cache t_cache_image t_pread t_pshutdown t_prestart t_init_term t_shapesame t_filters_parallel
testphdf5_SOURCES = testphdf5.c t_dset.c t_file.c t_file_image.c t_mdset.c \
t_ph5basic.c t_coll_chunk.c t_span_tree.c t_chunk_alloc.c t_filter_read.c \
t_prop.c t_coll_md_read.c
@@ -863,6 +869,8 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
+testpflush.sh: $(top_builddir)/config.status $(srcdir)/testpflush.sh.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
clean-checkPROGRAMS:
@list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
@@ -1157,7 +1165,7 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
echo "$$col$$br$$std"; \
fi; \
$$success || exit 1
-recheck: all $(check_PROGRAMS)
+recheck: all $(check_PROGRAMS) $(check_SCRIPTS)
@test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
@set +e; $(am__set_TESTS_bases); \
bases=`for i in $$bases; do echo $$i; done \
@@ -1214,7 +1222,7 @@ distdir: $(DISTFILES)
fi; \
done
check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(check_SCRIPTS)
$(MAKE) $(AM_MAKEFLAGS) check-TESTS
check: check-am
all-am: Makefile all-local
@@ -1549,7 +1557,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/testpar/t_bigio.c b/testpar/t_bigio.c
index fdd3488..1d882b8 100644
--- a/testpar/t_bigio.c
+++ b/testpar/t_bigio.c
@@ -671,7 +671,7 @@ dataset_big_write(void)
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, dims, NULL);
VRFY((mem_dataspace >= 0), "");
- if(!mpi_rank == 0) {
+ if(mpi_rank != 0) {
ret = H5Sselect_none(mem_dataspace);
VRFY((ret >= 0), "H5Sset_none succeeded");
}
@@ -980,7 +980,7 @@ dataset_big_read(void)
/* create a memory dataspace independently */
mem_dataspace = H5Screate_simple (RANK, dims, NULL);
VRFY((mem_dataspace >= 0), "");
- if(!mpi_rank == 0) {
+ if(mpi_rank != 0) {
ret = H5Sselect_none(mem_dataspace);
VRFY((ret >= 0), "H5Sset_none succeeded");
}
diff --git a/testpar/t_cache.c b/testpar/t_cache.c
index c27fc23..29c6f4a 100644
--- a/testpar/t_cache.c
+++ b/testpar/t_cache.c
@@ -467,9 +467,7 @@ static void lock_and_unlock_random_entry(H5F_t * file_ptr,
static void lock_entry(H5F_t * file_ptr, int32_t idx);
static void mark_entry_dirty(int32_t idx);
static void pin_entry(H5F_t * file_ptr, int32_t idx, hbool_t global, hbool_t dirty);
-#ifdef H5_METADATA_TRACE_FILE
static void pin_protected_entry(int32_t idx, hbool_t global);
-#endif /* H5_METADATA_TRACE_FILE */
static void move_entry(H5F_t * file_ptr, int32_t old_idx, int32_t new_idx);
static hbool_t reset_server_counts(void);
static void resize_entry(int32_t idx, size_t new_size);
@@ -1217,20 +1215,20 @@ setup_derived_types(void)
struct mssg_t sample; /* used to compute displacements */
/* setup the displacements array */
- if ( ( MPI_SUCCESS != MPI_Address(&sample.req, &displs[0]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.src, &displs[1]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.dest, &displs[2]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.mssg_num, &displs[3]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.base_addr, &displs[4]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.len, &displs[5]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.ver, &displs[6]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.count, &displs[7]) ) ||
- ( MPI_SUCCESS != MPI_Address(&sample.magic, &displs[8]) ) ) {
+ if ( ( MPI_SUCCESS != MPI_Get_address(&sample.req, &displs[0]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.src, &displs[1]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.dest, &displs[2]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.mssg_num, &displs[3]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.base_addr, &displs[4]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.len, &displs[5]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.ver, &displs[6]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.count, &displs[7]) ) ||
+ ( MPI_SUCCESS != MPI_Get_address(&sample.magic, &displs[8]) ) ) {
nerrors++;
success = FALSE;
if ( verbose ) {
- HDfprintf(stdout, "%d:%s: MPI_Address() call failed.\n",
+ HDfprintf(stdout, "%d:%s: MPI_Get_Address() call failed.\n",
world_mpi_rank, FUNC);
}
@@ -1245,7 +1243,7 @@ setup_derived_types(void)
if ( success ) {
- result = MPI_Type_struct(9, block_len, displs, mpi_types, &mpi_mssg_t);
+ result = MPI_Type_create_struct(9, block_len, displs, mpi_types, &mpi_mssg_t);
if ( result != MPI_SUCCESS ) {
@@ -3693,7 +3691,6 @@ pin_entry(H5F_t * file_ptr,
} /* pin_entry() */
-#ifdef H5_METADATA_TRACE_FILE
/*****************************************************************************
* Function: pin_protected_entry()
@@ -3762,7 +3759,6 @@ pin_protected_entry(int32_t idx,
return;
} /* pin_protected_entry() */
-#endif /* H5_METADATA_TRACE_FILE */
/*****************************************************************************
@@ -6809,8 +6805,6 @@ smoke_check_5(int metadata_write_strategy)
* - H5AC_expunge_entry()
* - H5AC_resize_entry()
*
- * This test is skipped if H5_METADATA_TRACE_FILE is undefined.
- *
* Return: Success: TRUE
*
* Failure: FALSE
@@ -6823,63 +6817,63 @@ trace_file_check(int metadata_write_strategy)
{
hbool_t success = TRUE;
-#ifdef H5_METADATA_TRACE_FILE
-
const char *((* expected_output)[]) = NULL;
const char * expected_output_0[] =
{
"### HDF5 metadata cache trace file version 1 ###\n",
- "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 0 0\n",
- "H5AC_insert_entry 0x400 27 0x0 2 0\n",
- "H5AC_insert_entry 0x402 27 0x0 2 0\n",
- "H5AC_insert_entry 0x404 27 0x0 4 0\n",
- "H5AC_insert_entry 0x408 27 0x0 6 0\n",
- "H5AC_protect 0x400 27 0x0 2 1\n",
- "H5AC_mark_entry_dirty 0x400 0\n",
- "H5AC_unprotect 0x400 27 0x0 0\n",
- "H5AC_protect 0x402 27 0x0 2 1\n",
- "H5AC_pin_protected_entry 0x402 0\n",
- "H5AC_unprotect 0x402 27 0x0 0\n",
- "H5AC_unpin_entry 0x402 0\n",
- "H5AC_expunge_entry 0x402 27 0\n",
- "H5AC_protect 0x404 27 0x0 4 1\n",
- "H5AC_pin_protected_entry 0x404 0\n",
- "H5AC_unprotect 0x404 27 0x0 0\n",
- "H5AC_mark_entry_dirty 0x404 0\n",
- "H5AC_resize_entry 0x404 2 0\n",
- "H5AC_resize_entry 0x404 4 0\n",
- "H5AC_unpin_entry 0x404 0\n",
- "H5AC_move_entry 0x400 0x8e65 27 0\n",
- "H5AC_move_entry 0x8e65 0x400 27 0\n",
- "H5AC_flush 0\n",
+ "H5AC_set_cache_auto_resize_config",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_protect",
+ "H5AC_mark_entry_dirty",
+ "H5AC_unprotect",
+ "H5AC_protect",
+ "H5AC_pin_protected_entry",
+ "H5AC_unprotect",
+ "H5AC_unpin_entry",
+ "H5AC_expunge_entry",
+ "H5AC_protect",
+ "H5AC_pin_protected_entry",
+ "H5AC_unprotect",
+ "H5AC_mark_entry_dirty",
+ "H5AC_resize_entry",
+ "H5AC_resize_entry",
+ "H5AC_unpin_entry",
+ "H5AC_move_entry",
+ "H5AC_move_entry",
+ "H5AC_flush",
+ "H5AC_flush",
NULL
};
const char * expected_output_1[] =
{
"### HDF5 metadata cache trace file version 1 ###\n",
- "H5AC_set_cache_auto_resize_config 1 0 1 0 \"t_cache_trace.txt\" 1 0 2097152 0.300000 33554432 1048576 50000 1 0.900000 2.000000 1 1.000000 0.250000 1 4194304 3 0.999000 0.900000 1 1048576 3 1 0.100000 262144 1 0\n",
- "H5AC_insert_entry 0x400 27 0x0 2 0\n",
- "H5AC_insert_entry 0x402 27 0x0 2 0\n",
- "H5AC_insert_entry 0x404 27 0x0 4 0\n",
- "H5AC_insert_entry 0x408 27 0x0 6 0\n",
- "H5AC_protect 0x400 27 0x0 2 1\n",
- "H5AC_mark_entry_dirty 0x400 0\n",
- "H5AC_unprotect 0x400 27 0x0 0\n",
- "H5AC_protect 0x402 27 0x0 2 1\n",
- "H5AC_pin_protected_entry 0x402 0\n",
- "H5AC_unprotect 0x402 27 0x0 0\n",
- "H5AC_unpin_entry 0x402 0\n",
- "H5AC_expunge_entry 0x402 27 0\n",
- "H5AC_protect 0x404 27 0x0 4 1\n",
- "H5AC_pin_protected_entry 0x404 0\n",
- "H5AC_unprotect 0x404 27 0x0 0\n",
- "H5AC_mark_entry_dirty 0x404 0\n",
- "H5AC_resize_entry 0x404 2 0\n",
- "H5AC_resize_entry 0x404 4 0\n",
- "H5AC_unpin_entry 0x404 0\n",
- "H5AC_move_entry 0x400 0x8e65 27 0\n",
- "H5AC_move_entry 0x8e65 0x400 27 0\n",
- "H5AC_flush 0\n",
+ "H5AC_set_cache_auto_resize_config",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_insert_entry",
+ "H5AC_protect",
+ "H5AC_mark_entry_dirty",
+ "H5AC_unprotect",
+ "H5AC_protect",
+ "H5AC_pin_protected_entry",
+ "H5AC_unprotect",
+ "H5AC_unpin_entry",
+ "H5AC_expunge_entry",
+ "H5AC_protect",
+ "H5AC_pin_protected_entry",
+ "H5AC_unprotect",
+ "H5AC_mark_entry_dirty",
+ "H5AC_resize_entry",
+ "H5AC_resize_entry",
+ "H5AC_unpin_entry",
+ "H5AC_move_entry",
+ "H5AC_move_entry",
+ "H5AC_flush",
+ "H5AC_flush",
NULL
};
char buffer[256];
@@ -6887,8 +6881,8 @@ trace_file_check(int metadata_write_strategy)
hbool_t done = FALSE;
int i;
int max_nerrors;
- int expected_line_len;
- int actual_line_len;
+ size_t expected_line_len;
+ size_t actual_line_len;
hid_t fid = -1;
H5F_t * file_ptr = NULL;
H5C_t * cache_ptr = NULL;
@@ -6896,188 +6890,151 @@ trace_file_check(int metadata_write_strategy)
H5AC_cache_config_t config;
struct mssg_t mssg;
-#endif /* H5_METADATA_TRACE_FILE */
- switch ( metadata_write_strategy ) {
+ switch(metadata_write_strategy) {
+
+ case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
- case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY:
-#ifdef H5_METADATA_TRACE_FILE
expected_output = &expected_output_0;
-#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING(
- "trace file collection -- process 0 only md write strategy");
- }
- break;
- case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
-#ifdef H5_METADATA_TRACE_FILE
+ if(world_mpi_rank == 0)
+ TESTING("trace file collection -- process 0 only md write strategy");
+ break;
+
+ case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED:
+
expected_output = &expected_output_1;
-#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING(
- "trace file collection -- distributed md write strategy");
- }
- break;
+
+ if(world_mpi_rank == 0)
+ TESTING("trace file collection -- distributed md write strategy");
+ break;
default:
-#ifdef H5_METADATA_TRACE_FILE
+
/* this will almost certainly cause a failure, but it keeps us
* from de-referenceing a NULL pointer.
*/
expected_output = &expected_output_0;
-#endif /* H5_METADATA_TRACE_FILE */
- if ( world_mpi_rank == 0 ) {
- TESTING("trace file collection -- unknown md write strategy");
- }
- break;
- }
-#ifdef H5_METADATA_TRACE_FILE
+ if(world_mpi_rank == 0)
+ TESTING("trace file collection -- unknown md write strategy");
+ break;
+ } /* end switch */
+
nerrors = 0;
init_data();
reset_stats();
- if ( world_mpi_rank == world_server_mpi_rank ) {
+ if(world_mpi_rank == world_server_mpi_rank) {
- if ( ! server_main() ) {
+ if(!server_main()) {
/* some error occured in the server -- report failure */
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
- world_mpi_rank, FUNC);
- }
+ if ( verbose )
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n", world_mpi_rank, FUNC);
}
}
- else /* run the clients */
- {
+ else {
+ /* run the clients */
- if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr,
- metadata_write_strategy) ) {
+ if(!setup_cache_for_test(&fid, &file_ptr, &cache_ptr, metadata_write_strategy) ) {
nerrors++;
fid = -1;
cache_ptr = NULL;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
- world_mpi_rank, FUNC);
- }
+ if(verbose)
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", world_mpi_rank, FUNC);
}
- if ( nerrors == 0 ) {
+ if(nerrors == 0) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n",
- world_mpi_rank, FUNC);
-
- } else {
-
+ if(H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC);
+ }
+ else {
config.open_trace_file = TRUE;
- strcpy(config.trace_file_name, "t_cache_trace.txt");
-
- if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ strcpy(config.trace_file_name, "t_cache_trace.txt");
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, FUNC);
+ if(H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC);
}
}
- }
+ } /* end if */
- insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
- insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 0, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 1, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 2, H5AC__NO_FLAGS_SET);
+ insert_entry(cache_ptr, file_ptr, 3, H5AC__NO_FLAGS_SET);
- lock_entry(file_ptr, 0);
- mark_entry_dirty(0);
- unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET);
+ lock_entry(file_ptr, 0);
+ mark_entry_dirty(0);
+ unlock_entry(file_ptr, 0, H5AC__NO_FLAGS_SET);
- lock_entry(file_ptr, 1);
+ lock_entry(file_ptr, 1);
pin_protected_entry(1, TRUE);
- unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET);
+ unlock_entry(file_ptr, 1, H5AC__NO_FLAGS_SET);
unpin_entry(file_ptr, 1, TRUE, FALSE, FALSE);
expunge_entry(file_ptr, 1);
- lock_entry(file_ptr, 2);
+ lock_entry(file_ptr, 2);
pin_protected_entry(2, TRUE);
- unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET);
- mark_entry_dirty(2);
+ unlock_entry(file_ptr, 2, H5AC__NO_FLAGS_SET);
+ mark_entry_dirty(2);
resize_entry(2, data[2].len / 2);
resize_entry(2, data[2].len);
unpin_entry(file_ptr, 2, TRUE, FALSE, FALSE);
- move_entry(file_ptr, 0, 20);
- move_entry(file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
+ move_entry(file_ptr, 0, 20);
- if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
+ if(H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n",
- world_mpi_rank, FUNC);
- }
+ if(verbose)
+ HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", world_mpi_rank, FUNC);
}
- if ( nerrors == 0 ) {
-
+ if(nerrors == 0) {
config.version = H5AC__CURR_CACHE_CONFIG_VERSION;
- if ( H5AC_get_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
-
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n",
- world_mpi_rank, FUNC);
-
- } else {
-
+ if(H5AC_get_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_get_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC);
+ }
+ else {
config.open_trace_file = FALSE;
config.close_trace_file = TRUE;
- config.trace_file_name[0] = '\0';
-
- if ( H5AC_set_cache_auto_resize_config(cache_ptr, &config)
- != SUCCEED ) {
+ config.trace_file_name[0] = '\0';
- nerrors++;
- HDfprintf(stdout,
- "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n",
- world_mpi_rank, FUNC);
+ if(H5AC_set_cache_auto_resize_config(cache_ptr, &config) != SUCCEED) {
+ nerrors++;
+ HDfprintf(stdout, "%d:%s: H5AC_set_cache_auto_resize_config() failed.\n", world_mpi_rank, FUNC);
}
}
- }
+ } /* end if */
- if ( fid >= 0 ) {
-
- if ( ! take_down_cache(fid, cache_ptr) ) {
+ if(fid >= 0) {
+ if(!take_down_cache(fid, cache_ptr)) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n",
- world_mpi_rank, FUNC);
- }
+ if(verbose)
+ HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", world_mpi_rank, FUNC);
}
- }
+ } /* end if */
/* verify that all instance of datum are back where the started
* and are clean.
*/
- for ( i = 0; i < NUM_DATA_ENTRIES; i++ )
- {
- HDassert( data_index[i] == i );
- HDassert( ! (data[i].dirty) );
+ for(i = 0; i < NUM_DATA_ENTRIES; i++) {
+ HDassert(data_index[i] == i);
+ HDassert(!(data[i].dirty));
}
/* compose the done message */
@@ -7091,117 +7048,121 @@ trace_file_check(int metadata_write_strategy)
mssg.count = 0; /* not used */
mssg.magic = MSSG_MAGIC;
- if ( success ) {
-
+ if(success) {
success = send_mssg(&mssg, FALSE);
- if ( ! success ) {
-
+ if(!success) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n",
- world_mpi_rank, FUNC);
- }
+ if(verbose)
+ HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", world_mpi_rank, FUNC);
}
- }
-
- if ( nerrors == 0 ) {
+ } /* end if */
- sprintf(trace_file_name, "t_cache_trace.txt.%d",
- (int)file_mpi_rank);
+ if(nerrors == 0) {
+ HDsprintf(trace_file_name, "t_cache_trace.txt.%d", (int)file_mpi_rank);
- if ( (trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL ) {
+ if((trace_file_ptr = HDfopen(trace_file_name, "r")) == NULL ) {
nerrors++;
- if ( verbose ) {
- HDfprintf(stdout, "%d:%s: HDfopen failed.\n",
- world_mpi_rank, FUNC);
- }
+ if(verbose)
+ HDfprintf(stdout, "%d:%s: HDfopen failed.\n", world_mpi_rank, FUNC);
}
- }
-
- i = 0;
- while ( ( nerrors == 0 ) && ( ! done ) )
- {
- if ( (*expected_output)[i] == NULL ) {
-
- expected_line_len = 0;
-
- } else {
-
- expected_line_len = HDstrlen((*expected_output)[i]);
- }
-
- if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) {
-
- actual_line_len = HDstrlen(buffer);
+ } /* end if */
- } else {
- actual_line_len = 0;
- }
+ i = 0;
+ while((nerrors == 0) && (!done)) {
+ /* Get lines of actual and expected data */
+ if((*expected_output)[i] == NULL)
+ expected_line_len = (size_t)0;
+ else
+ expected_line_len = HDstrlen((*expected_output)[i]);
+
+ if(HDfgets(buffer, 255, trace_file_ptr) != NULL)
+ actual_line_len = HDstrlen(buffer);
+ else
+ actual_line_len = (size_t)0;
+
+ /* Compare the lines */
+ /* Handle running out of data */
+ if((actual_line_len == 0) || (expected_line_len == 0)) {
+ if((actual_line_len == 0) && (expected_line_len == 0)) {
+ /* Both ran out at the same time - we're done */
+ done = TRUE;
+ }
+ else {
+ /* One ran out before the other - BADNESS */
+ nerrors++;
+ if(verbose) {
+ HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i);
+ if(expected_line_len == 0) {
+ HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, "<EMPTY>", expected_line_len);
+ HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, actual_line_len);
+ }
+ if(actual_line_len == 0) {
+ HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len);
+ HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, "<EMPTY>", actual_line_len);
+ }
+ }
+ HDfprintf(stdout, "BADNESS BADNESS BADNESS\n");
+ }
+ }
+ /* We directly compare the header line (line 0) */
+ else if(0 == i) {
+ if((actual_line_len != expected_line_len) || (HDstrcmp(buffer, (*expected_output)[i]) != 0 )) {
- if ( ( actual_line_len == 0 ) && ( expected_line_len == 0 ) ) {
+ nerrors++;
+ if(verbose) {
+ HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i);
+ HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n", world_mpi_rank, FUNC, (*expected_output)[i], expected_line_len);
+ HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n", world_mpi_rank, FUNC, buffer, actual_line_len);
+ }
+ }
+ }
+ /* All other lines we tokenize and just compare the function name. This
+ * keeps the test from being too fragile.
+ */
+ else {
+ char *tok = NULL; /* token for actual line */
- done = TRUE;
+ tok = HDstrtok(buffer, " ");
- } else if ( ( actual_line_len != expected_line_len ) ||
- ( HDstrcmp(buffer, (*expected_output)[i]) != 0 ) ) {
+ if(HDstrcmp(tok, (*expected_output)[i]) != 0 ) {
- nerrors++;
- if ( verbose ) {
- HDfprintf(stdout,
- "%d:%s: Unexpected data in trace file line %d.\n",
- world_mpi_rank, FUNC, i);
- HDfprintf(stdout, "%d:%s: expected = \"%s\" %d\n",
- world_mpi_rank, FUNC, (*expected_output)[i],
- expected_line_len);
- HDfprintf(stdout, "%d:%s: actual = \"%s\" %d\n",
- world_mpi_rank, FUNC, buffer,
- actual_line_len);
+ nerrors++;
+ if(verbose) {
+ HDfprintf(stdout, "%d:%s: Unexpected data in trace file line %d.\n", world_mpi_rank, FUNC, i);
+ HDfprintf(stdout, "%d:%s: expected = \"%s\"\n", world_mpi_rank, FUNC, (*expected_output)[i]);
+ HDfprintf(stdout, "%d:%s: actual = \"%s\"\n", world_mpi_rank, FUNC, tok);
+ }
}
- } else {
- i++;
- }
- }
+ } /* end else */
- if ( trace_file_ptr != NULL ) {
+ i++;
+ } /* end while */
- HDfclose(trace_file_ptr);
- trace_file_ptr = NULL;
-#if 1
- HDremove(trace_file_name);
-#endif
+ /* Clean up the trace file */
+ if(trace_file_ptr != NULL) {
+ HDfclose(trace_file_ptr);
+ trace_file_ptr = NULL;
+ HDremove(trace_file_name);
}
- }
+ } /* end giant else that runs clients */
max_nerrors = get_max_nerrors();
- if ( world_mpi_rank == 0 ) {
-
- if ( max_nerrors == 0 ) {
-
- PASSED();
-
- } else {
+ if(world_mpi_rank == 0) {
+ if(max_nerrors == 0) {
+ PASSED();
+ }
+ else {
failures++;
H5_FAILED();
}
}
- success = ( ( success ) && ( max_nerrors == 0 ) );
-
-#else /* H5_METADATA_TRACE_FILE */
-
- if ( world_mpi_rank == 0 ) {
-
- SKIPPED();
-
- HDfprintf(stdout, " trace file support disabled.\n");
- }
-
-#endif /* H5_METADATA_TRACE_FILE */
+ success = ((success) && (max_nerrors == 0));
return(success);
@@ -7264,7 +7225,7 @@ smoke_check_6(int metadata_write_strategy)
/* some error occured in the server -- report failure */
nerrors++;
if ( verbose ) {
- HDfprintf(stdout, "%d:%s: server_main() failed.\n",
+ HDfprintf(stdout, "%d:%s: server_main() failed.\n",
world_mpi_rank, FUNC);
}
}
@@ -7280,7 +7241,7 @@ smoke_check_6(int metadata_write_strategy)
fid = -1;
cache_ptr = NULL;
if ( verbose ) {
- HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
+ HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n",
world_mpi_rank, FUNC);
}
}
@@ -7289,7 +7250,7 @@ smoke_check_6(int metadata_write_strategy)
virt_num_data_entries = NUM_DATA_ENTRIES;
/* insert the first half collectively */
- file_ptr->coll_md_read = H5P_USER_TRUE;
+ H5CX_set_coll_metadata_read(TRUE);
for ( i = 0; i < virt_num_data_entries/2; i++ )
{
struct datum * entry_ptr;
@@ -7310,7 +7271,7 @@ smoke_check_6(int metadata_write_strategy)
}
/* insert the other half independently */
- file_ptr->coll_md_read = H5P_USER_FALSE;
+ H5CX_set_coll_metadata_read(FALSE);
for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ )
{
struct datum * entry_ptr;
@@ -7330,7 +7291,7 @@ smoke_check_6(int metadata_write_strategy)
HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size);
}
- /* flush the file */
+ /* flush the file */
if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) {
nerrors++;
if ( verbose ) {
@@ -7340,7 +7301,7 @@ smoke_check_6(int metadata_write_strategy)
}
/* Protect the first half of the entries collectively */
- file_ptr->coll_md_read = H5P_USER_TRUE;
+ H5CX_set_coll_metadata_read(TRUE);
for ( i = 0; i < (virt_num_data_entries / 2); i++ )
{
struct datum * entry_ptr;
@@ -7361,13 +7322,13 @@ smoke_check_6(int metadata_write_strategy)
}
/* protect the other half independently */
- file_ptr->coll_md_read = H5P_USER_FALSE;
+ H5CX_set_coll_metadata_read(FALSE);
for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ )
{
struct datum * entry_ptr;
entry_ptr = &(data[i]);
- lock_entry(file_ptr, i);
+ lock_entry(file_ptr, i);
if(FALSE != entry_ptr->header.coll_access) {
nerrors++;
diff --git a/testpar/t_coll_md_read.c b/testpar/t_coll_md_read.c
index f945d2b..912388c 100644
--- a/testpar/t_coll_md_read.c
+++ b/testpar/t_coll_md_read.c
@@ -32,6 +32,14 @@
#define PARTIAL_NO_SELECTION_Y_DIM_SCALE 5
#define PARTIAL_NO_SELECTION_X_DIM_SCALE 5
+#define MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS 2
+
+#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_NO_SEL_PROCESS (mpi_rank == mpi_size - 1)
+#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DATASET_NAME "linked_chunk_io_sort_chunk_issue"
+#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_Y_DIM_SCALE 20000
+#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE 1
+#define LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS 1
+
/*
* A test for issue HDFFV-10501. A parallel hang was reported which occurred
* in linked-chunk I/O when collective metadata reads are enabled and some ranks
@@ -57,13 +65,13 @@ void test_partial_no_selection_coll_md_read(void)
hsize_t stride[PARTIAL_NO_SELECTION_DATASET_NDIMS];
hsize_t count[PARTIAL_NO_SELECTION_DATASET_NDIMS];
hsize_t block[PARTIAL_NO_SELECTION_DATASET_NDIMS];
- hid_t file_id = -1;
- hid_t fapl_id = -1;
- hid_t dset_id = -1;
- hid_t dcpl_id = -1;
- hid_t dxpl_id = -1;
- hid_t fspace_id = -1;
- hid_t mspace_id = -1;
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hid_t fspace_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
int mpi_rank, mpi_size;
void *data = NULL;
void *read_buf = NULL;
@@ -86,7 +94,7 @@ void test_partial_no_selection_coll_md_read(void)
file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
VRFY((file_id >= 0), "H5Fcreate succeeded");
- dataset_dims = malloc(PARTIAL_NO_SELECTION_DATASET_NDIMS * sizeof(*dataset_dims));
+ dataset_dims = HDmalloc(PARTIAL_NO_SELECTION_DATASET_NDIMS * sizeof(*dataset_dims));
VRFY((dataset_dims != NULL), "malloc succeeded");
dataset_dims[0] = PARTIAL_NO_SELECTION_Y_DIM_SCALE * mpi_size;
@@ -129,7 +137,7 @@ void test_partial_no_selection_coll_md_read(void)
mspace_id = H5Screate_simple(1, sel_dims, NULL);
VRFY((mspace_id >= 0), "H5Screate_simple succeeded");
- data = calloc(1, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int));
+ data = HDcalloc(1, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int));
VRFY((data != NULL), "calloc succeeded");
dxpl_id = H5Pcreate(H5P_DATASET_XFER);
@@ -151,7 +159,7 @@ void test_partial_no_selection_coll_md_read(void)
*/
VRFY((H5Pset_dxpl_mpio_chunk_opt(dxpl_id, H5FD_MPIO_CHUNK_ONE_IO) >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded");
- read_buf = malloc(count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int));
+ read_buf = HDmalloc(count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int));
VRFY((read_buf != NULL), "malloc succeeded");
/*
@@ -171,21 +179,321 @@ void test_partial_no_selection_coll_md_read(void)
* Check data integrity just to be sure.
*/
if (!PARTIAL_NO_SELECTION_NO_SEL_PROCESS) {
- VRFY((!memcmp(data, read_buf, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int))), "memcmp succeeded");
+ VRFY((!HDmemcmp(data, read_buf, count[1] * (PARTIAL_NO_SELECTION_Y_DIM_SCALE * PARTIAL_NO_SELECTION_X_DIM_SCALE) * sizeof(int))), "memcmp succeeded");
+ }
+
+ if (dataset_dims) {
+ HDfree(dataset_dims);
+ dataset_dims = NULL;
}
+ if (data) {
+ HDfree(data);
+ data = NULL;
+ }
+
+ if (read_buf) {
+ HDfree(read_buf);
+ read_buf = NULL;
+ }
+
+ VRFY((H5Sclose(fspace_id) >= 0), "H5Sclose succeeded");
+ VRFY((H5Sclose(mspace_id) >= 0), "H5Sclose succeeded");
+ VRFY((H5Pclose(dcpl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Pclose(dxpl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Dclose(dset_id) >= 0), "H5Dclose succeeded");
+ VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded");
+}
+
+/*
+ * A test for HDFFV-10562 which attempts to verify that using multi-chunk
+ * I/O with collective metadata reads enabled doesn't causes issues due to
+ * collective metadata reads being made only by process 0 in H5D__chunk_addrmap().
+ *
+ * Failure in this test may either cause a hang, or, due to how the MPI calls
+ * pertaining to this issue might mistakenly match up, may cause an MPI error
+ * message similar to:
+ *
+ * #008: H5Dmpio.c line 2546 in H5D__obtain_mpio_mode(): MPI_BCast failed
+ * major: Internal error (too specific to document in detail)
+ * minor: Some MPI function failed
+ * #009: H5Dmpio.c line 2546 in H5D__obtain_mpio_mode(): Message truncated, error stack:
+ *PMPI_Bcast(1600)..................: MPI_Bcast(buf=0x1df98e0, count=18, MPI_BYTE, root=0, comm=0x84000006) failed
+ *MPIR_Bcast_impl(1452).............:
+ *MPIR_Bcast(1476)..................:
+ *MPIR_Bcast_intra(1249)............:
+ *MPIR_SMP_Bcast(1088)..............:
+ *MPIR_Bcast_binomial(239)..........:
+ *MPIDI_CH3U_Receive_data_found(131): Message from rank 0 and tag 2 truncated; 2616 bytes received but buffer size is 18
+ * major: Internal error (too specific to document in detail)
+ * minor: MPI Error String
+ *
+ */
+void test_multi_chunk_io_addrmap_issue(void)
+{
+ const char *filename;
+ hsize_t start[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS];
+ hsize_t stride[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS];
+ hsize_t count[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS];
+ hsize_t block[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS];
+ hsize_t dims[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS] = {10, 5};
+ hsize_t chunk_dims[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS] = {5, 5};
+ hsize_t max_dims[MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS] = {H5S_UNLIMITED, H5S_UNLIMITED};
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hid_t space_id = H5I_INVALID_HID;
+ void *read_buf = NULL;
+ int mpi_rank;
+ int data[5][5] = { {0, 1, 2, 3, 4},
+ {0, 1, 2, 3, 4},
+ {0, 1, 2, 3, 4},
+ {0, 1, 2, 3, 4},
+ {0, 1, 2, 3, 4} };
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+
+ filename = GetTestParameters();
+
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
+ VRFY((fapl_id >= 0), "create_faccess_plist succeeded");
+
+ /*
+ * Even though the testphdf5 framework currently sets collective metadata reads
+ * on the FAPL, we call it here just to be sure this is futureproof, since
+ * demonstrating this issue relies upon it.
+ */
+ VRFY((H5Pset_all_coll_metadata_ops(fapl_id, true) >= 0), "Set collective metadata reads succeeded");
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file_id >= 0), "H5Fcreate succeeded");
+
+ space_id = H5Screate_simple(MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS, dims, max_dims);
+ VRFY((space_id >= 0), "H5Screate_simple succeeded");
+
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((dcpl_id >= 0), "H5Pcreate succeeded");
+
+ VRFY((H5Pset_chunk(dcpl_id, MULTI_CHUNK_IO_ADDRMAP_ISSUE_DIMS, chunk_dims) >= 0), "H5Pset_chunk succeeded");
+
+ dset_id = H5Dcreate2(file_id, "dset", H5T_NATIVE_INT, space_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "H5Dcreate2 succeeded");
+
+ dxpl_id = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxpl_id >= 0), "H5Pcreate succeeded");
+
+ VRFY((H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) >= 0), "H5Pset_dxpl_mpio succeeded");
+ VRFY((H5Pset_dxpl_mpio_chunk_opt(dxpl_id, H5FD_MPIO_CHUNK_MULTI_IO) >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded");
+
+ start[1] = 0;
+ stride[0] = stride[1] = 1;
+ count[0] = count[1] = 5;
+ block[0] = block[1] = 1;
+
+ if (mpi_rank == 0)
+ start[0] = 0;
+ else
+ start[0] = 5;
+
+ VRFY((H5Sselect_hyperslab(space_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded");
+ if (mpi_rank != 0)
+ VRFY((H5Sselect_none(space_id) >= 0), "H5Sselect_none succeeded");
+
+ VRFY((H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, space_id, dxpl_id, data) >= 0), "H5Dwrite succeeded");
+
+ VRFY((H5Fflush(file_id, H5F_SCOPE_GLOBAL) >= 0), "H5Fflush succeeded");
+
+ read_buf = HDmalloc(50 * sizeof(int));
+ VRFY((read_buf != NULL), "malloc succeeded");
+
+ VRFY((H5Dread(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl_id, read_buf) >= 0), "H5Dread succeeded");
+
+ if (read_buf) {
+ HDfree(read_buf);
+ read_buf = NULL;
+ }
+
+ VRFY((H5Sclose(space_id) >= 0), "H5Sclose succeeded");
+ VRFY((H5Pclose(dcpl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Pclose(dxpl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Dclose(dset_id) >= 0), "H5Dclose succeeded");
+ VRFY((H5Pclose(fapl_id) >= 0), "H5Pclose succeeded");
+ VRFY((H5Fclose(file_id) >= 0), "H5Fclose succeeded");
+}
+
+/*
+ * A test for HDFFV-10562 which attempts to verify that using linked-chunk
+ * I/O with collective metadata reads enabled doesn't cause issues due to
+ * collective metadata reads being made only by process 0 in H5D__sort_chunk().
+ *
+ * NOTE: Due to the way that the threshold value which pertains to this test
+ * is currently calculated within HDF5, there are several conditions that this
+ * test must maintain. Refer to the function H5D__sort_chunk in H5Dmpio.c for
+ * a better idea of why.
+ *
+ * Condition 1: We need to make sure that the test always selects every single
+ * chunk in the dataset. It is fine if the selection is split up among multiple
+ * ranks, but their combined selection must cover the whole dataset.
+ *
+ * Condition 2: The number of chunks in the dataset divided by the number of MPI
+ * ranks must exceed or equal 10000. In other words, each MPI rank must be
+ * responsible for 10000 or more unique chunks.
+ *
+ * Condition 3: This test will currently only be reliably reproducable for 2 or 3
+ * MPI ranks. The threshold value calculated reduces to a constant 100 / mpi_size,
+ * and is compared against a default value of 30%.
+ *
+ * Failure in this test may either cause a hang, or, due to how the MPI calls
+ * pertaining to this issue might mistakenly match up, may cause an MPI error
+ * message similar to:
+ *
+ * #008: H5Dmpio.c line 2338 in H5D__sort_chunk(): MPI_BCast failed
+ * major: Internal error (too specific to document in detail)
+ * minor: Some MPI function failed
+ * #009: H5Dmpio.c line 2338 in H5D__sort_chunk(): Other MPI error, error stack:
+ *PMPI_Bcast(1600)........: MPI_Bcast(buf=0x7eae610, count=320000, MPI_BYTE, root=0, comm=0x84000006) failed
+ *MPIR_Bcast_impl(1452)...:
+ *MPIR_Bcast(1476)........:
+ *MPIR_Bcast_intra(1249)..:
+ *MPIR_SMP_Bcast(1088)....:
+ *MPIR_Bcast_binomial(250): message sizes do not match across processes in the collective routine: Received 2096 but expected 320000
+ * major: Internal error (too specific to document in detail)
+ * minor: MPI Error String
+ */
+void test_link_chunk_io_sort_chunk_issue(void)
+{
+ const char *filename;
+ hsize_t *dataset_dims = NULL;
+ hsize_t max_dataset_dims[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS];
+ hsize_t sel_dims[1];
+ hsize_t chunk_dims[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS] = { LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS };
+ hsize_t start[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS];
+ hsize_t stride[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS];
+ hsize_t count[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS];
+ hsize_t block[LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS];
+ hid_t file_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hid_t fspace_id = H5I_INVALID_HID;
+ hid_t mspace_id = H5I_INVALID_HID;
+ int mpi_rank, mpi_size;
+ void *data = NULL;
+ void *read_buf = NULL;
+
+ MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size);
+
+ filename = GetTestParameters();
+
+ fapl_id = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type);
+ VRFY((fapl_id >= 0), "create_faccess_plist succeeded");
+
+ /*
+ * Even though the testphdf5 framework currently sets collective metadata reads
+ * on the FAPL, we call it here just to be sure this is futureproof, since
+ * demonstrating this issue relies upon it.
+ */
+ VRFY((H5Pset_all_coll_metadata_ops(fapl_id, true) >= 0), "Set collective metadata reads succeeded");
+
+ file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);
+ VRFY((file_id >= 0), "H5Fcreate succeeded");
+
+ dataset_dims = HDmalloc(LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS * sizeof(*dataset_dims));
+ VRFY((dataset_dims != NULL), "malloc succeeded");
+
+ dataset_dims[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE * mpi_size * LINK_CHUNK_IO_SORT_CHUNK_ISSUE_Y_DIM_SCALE;
+ max_dataset_dims[0] = H5S_UNLIMITED;
+
+ fspace_id = H5Screate_simple(LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS, dataset_dims, max_dataset_dims);
+ VRFY((fspace_id >= 0), "H5Screate_simple succeeded");
+
+ /*
+ * Set up chunking on the dataset in order to reproduce the problem.
+ */
+ dcpl_id = H5Pcreate(H5P_DATASET_CREATE);
+ VRFY((dcpl_id >= 0), "H5Pcreate succeeded");
+
+ VRFY((H5Pset_chunk(dcpl_id, LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DIMS, chunk_dims) >= 0), "H5Pset_chunk succeeded");
+
+ dset_id = H5Dcreate2(file_id, LINK_CHUNK_IO_SORT_CHUNK_ISSUE_DATASET_NAME, H5T_NATIVE_INT, fspace_id, H5P_DEFAULT, dcpl_id, H5P_DEFAULT);
+ VRFY((dset_id >= 0), "H5Dcreate2 succeeded");
+
+ /*
+ * Setup hyperslab selection to split the dataset among the ranks.
+ *
+ * The ranks will write rows across the dataset.
+ */
+ stride[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE;
+ count[0] = (dataset_dims[0] / LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) / mpi_size;
+ start[0] = count[0] * mpi_rank;
+ block[0] = LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE;
+
+ VRFY((H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded");
+
+ sel_dims[0] = count[0] * (LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE);
+
+ mspace_id = H5Screate_simple(1, sel_dims, NULL);
+ VRFY((mspace_id >= 0), "H5Screate_simple succeeded");
+
+ data = HDcalloc(1, count[0] * (LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) * sizeof(int));
+ VRFY((data != NULL), "calloc succeeded");
+
+ dxpl_id = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxpl_id >= 0), "H5Pcreate succeeded");
+
+ /*
+ * Enable collective access for the data transfer.
+ */
+ VRFY((H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) >= 0), "H5Pset_dxpl_mpio succeeded");
+
+ VRFY((H5Dwrite(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, data) >= 0), "H5Dwrite succeeded");
+
+ VRFY((H5Fflush(file_id, H5F_SCOPE_GLOBAL) >= 0), "H5Fflush succeeded");
+
+ /*
+ * Ensure that linked-chunk I/O is performed since this is
+ * the particular code path where the issue lies and we don't
+ * want the library doing multi-chunk I/O behind our backs.
+ */
+ VRFY((H5Pset_dxpl_mpio_chunk_opt(dxpl_id, H5FD_MPIO_CHUNK_ONE_IO) >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded");
+
+ read_buf = HDmalloc(count[0] * (LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) * sizeof(int));
+ VRFY((read_buf != NULL), "malloc succeeded");
+
+ VRFY((H5Sselect_hyperslab(fspace_id, H5S_SELECT_SET, start, stride, count, block) >= 0), "H5Sselect_hyperslab succeeded");
+
+ sel_dims[0] = count[0] * (LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE);
+
+ VRFY((H5Sclose(mspace_id) >= 0), "H5Sclose succeeded");
+
+ mspace_id = H5Screate_simple(1, sel_dims, NULL);
+ VRFY((mspace_id >= 0), "H5Screate_simple succeeded");
+
+ read_buf = HDrealloc(read_buf, count[0] * (LINK_CHUNK_IO_SORT_CHUNK_ISSUE_CHUNK_SIZE) * sizeof(int));
+ VRFY((read_buf != NULL), "realloc succeeded");
+
+ /*
+ * Finally have each rank read their section of data back from the dataset.
+ */
+ VRFY((H5Dread(dset_id, H5T_NATIVE_INT, mspace_id, fspace_id, dxpl_id, read_buf) >= 0), "H5Dread succeeded");
+
if (dataset_dims) {
- free(dataset_dims);
+ HDfree(dataset_dims);
dataset_dims = NULL;
}
if (data) {
- free(data);
+ HDfree(data);
data = NULL;
}
if (read_buf) {
- free(read_buf);
+ HDfree(read_buf);
read_buf = NULL;
}
diff --git a/testpar/t_dset.c b/testpar/t_dset.c
index 281d027..d4e556d 100644
--- a/testpar/t_dset.c
+++ b/testpar/t_dset.c
@@ -2649,7 +2649,7 @@ compress_readAll(void)
/* Try reading the data */
ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read);
- VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
+ VRFY((ret >= 0), "H5Dread succeeded");
/* Verify data read */
for(u=0; u<dim; u++)
@@ -2659,8 +2659,10 @@ compress_readAll(void)
nerrors++;
}
+#if MPI_VERSION >= 3
ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read);
VRFY((ret >= 0), "H5Dwrite succeeded");
+#endif
ret = H5Pclose(xfer_plist);
VRFY((ret >= 0), "H5Pclose succeeded");
diff --git a/testpar/t_filters_parallel.c b/testpar/t_filters_parallel.c
index f436c8f..1f26e0d 100644
--- a/testpar/t_filters_parallel.c
+++ b/testpar/t_filters_parallel.c
@@ -32,9 +32,28 @@ char filenames[1][256];
int nerrors = 0;
size_t cur_filter_idx = 0;
+#define GZIP_INDEX 0
+#define FLETCHER32_INDEX 1
#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
+/*
+ * Used to check if a filter is available before running a test.
+ */
+#define CHECK_CUR_FILTER_AVAIL() \
+{ \
+ htri_t filter_is_avail; \
+ \
+ if (cur_filter_idx == GZIP_INDEX) { \
+ if ((filter_is_avail = H5Zfilter_avail(H5Z_FILTER_DEFLATE)) != TRUE) { \
+ if (MAINPROCESS) { \
+ HDputs(" - SKIPPED - Deflate filter not available"); \
+ } \
+ return; \
+ } \
+ } \
+}
+
static herr_t set_dcpl_filter(hid_t dcpl);
#if MPI_VERSION >= 3
@@ -144,9 +163,9 @@ static herr_t
set_dcpl_filter(hid_t dcpl)
{
switch (cur_filter_idx) {
- case 0:
+ case GZIP_INDEX:
return H5Pset_deflate(dcpl, DEFAULT_DEFLATE_LEVEL);
- case 1:
+ case FLETCHER32_INDEX:
return H5Pset_fletcher32(dcpl);
default:
return H5Pset_deflate(dcpl, DEFAULT_DEFLATE_LEVEL);
@@ -178,7 +197,9 @@ test_write_one_chunk_filtered_dataset(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to one-chunk filtered dataset");
+ if (MAINPROCESS) HDputs("Testing write to one-chunk filtered dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -238,9 +259,9 @@ test_write_one_chunk_filtered_dataset(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -292,7 +313,7 @@ test_write_one_chunk_filtered_dataset(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -333,7 +354,9 @@ test_write_filtered_dataset_no_overlap(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to unshared filtered chunks");
+ if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -394,9 +417,9 @@ test_write_filtered_dataset_no_overlap(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -450,7 +473,7 @@ test_write_filtered_dataset_no_overlap(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -492,7 +515,9 @@ test_write_filtered_dataset_overlap(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to shared filtered chunks");
+ if (MAINPROCESS) HDputs("Testing write to shared filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -553,9 +578,9 @@ test_write_filtered_dataset_overlap(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -609,7 +634,7 @@ test_write_filtered_dataset_overlap(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -654,7 +679,9 @@ test_write_filtered_dataset_single_no_selection(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to filtered chunks with a single process having no selection");
+ if (MAINPROCESS) HDputs("Testing write to filtered chunks with a single process having no selection");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -718,9 +745,9 @@ test_write_filtered_dataset_single_no_selection(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -782,7 +809,7 @@ test_write_filtered_dataset_single_no_selection(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -823,7 +850,9 @@ test_write_filtered_dataset_all_no_selection(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to filtered chunks with all processes having no selection");
+ if (MAINPROCESS) HDputs("Testing write to filtered chunks with all processes having no selection");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -912,7 +941,7 @@ test_write_filtered_dataset_all_no_selection(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -949,7 +978,9 @@ test_write_filtered_dataset_point_selection(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to filtered chunks with point selection");
+ if (MAINPROCESS) HDputs("Testing write to filtered chunks with point selection");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1058,7 +1089,7 @@ test_write_filtered_dataset_point_selection(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (coords) HDfree(coords);
@@ -1102,7 +1133,9 @@ test_write_filtered_dataset_interleaved_write(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing interleaved write to filtered chunks");
+ if (MAINPROCESS) HDputs("Testing interleaved write to filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1163,9 +1196,9 @@ test_write_filtered_dataset_interleaved_write(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -1225,7 +1258,7 @@ test_write_filtered_dataset_interleaved_write(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -1265,7 +1298,9 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to unshared filtered chunks on separate pages in 3D dataset");
+ if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks on separate pages in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1333,9 +1368,9 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void)
start[2] = (hsize_t) mpi_rank;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -1385,7 +1420,7 @@ test_write_3d_filtered_dataset_no_overlap_separate_pages(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -1426,7 +1461,9 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void)
hid_t file_id, dset_id, plist_id;
hid_t filespace, memspace;
- if (MAINPROCESS) puts("Testing write to unshared filtered chunks on the same pages in 3D dataset");
+ if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks on the same pages in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1494,9 +1531,9 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void)
start[2] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -1549,7 +1586,7 @@ test_write_3d_filtered_dataset_no_overlap_same_pages(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -1590,7 +1627,9 @@ test_write_3d_filtered_dataset_overlap(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to shared filtered chunks in 3D dataset");
+ if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1658,9 +1697,9 @@ test_write_3d_filtered_dataset_overlap(void)
start[2] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], start[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], start[0], start[1], start[2], block[0], block[1], block[2]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -1722,7 +1761,7 @@ test_write_3d_filtered_dataset_overlap(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -1762,7 +1801,9 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1, memtype = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to unshared filtered chunks in Compound Datatype dataset without Datatype conversion");
+ if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks in Compound Datatype dataset without Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -1834,9 +1875,9 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void)
start[1] = ((hsize_t) mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS);
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -1902,7 +1943,7 @@ test_write_cmpd_filtered_dataset_no_conversion_unshared(void)
VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -1943,7 +1984,9 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void)
hid_t file_id, dset_id, plist_id, memtype;
hid_t filespace, memspace;
- if (MAINPROCESS) puts("Testing write to shared filtered chunks in Compound Datatype dataset without Datatype conversion");
+ if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in Compound Datatype dataset without Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -2015,9 +2058,9 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -2086,7 +2129,7 @@ test_write_cmpd_filtered_dataset_no_conversion_shared(void)
VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -2132,7 +2175,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1, filetype = -1, memtype = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write to unshared filtered chunks in Compound Datatype dataset with Datatype conversion");
+ if (MAINPROCESS) HDputs("Testing write to unshared filtered chunks in Compound Datatype dataset with Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -2215,9 +2260,9 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void)
start[1] = ((hsize_t) mpi_rank * WRITE_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS);
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -2269,7 +2314,7 @@ test_write_cmpd_filtered_dataset_type_conversion_unshared(void)
VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -2316,7 +2361,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void)
hid_t file_id, dset_id, plist_id, filetype, memtype;
hid_t filespace, memspace;
- if (MAINPROCESS) puts("Testing write to shared filtered chunks in Compound Datatype dataset with Datatype conversion");
+ if (MAINPROCESS) HDputs("Testing write to shared filtered chunks in Compound Datatype dataset with Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -2399,9 +2446,9 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -2453,7 +2500,7 @@ test_write_cmpd_filtered_dataset_type_conversion_shared(void)
VRFY((H5Dread(dset_id, memtype, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -2503,6 +2550,10 @@ test_read_one_chunk_filtered_dataset(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from one-chunk filtered dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_ONE_CHUNK_FILTERED_DATASET_NROWS;
dataset_dims[1] = (hsize_t) READ_ONE_CHUNK_FILTERED_DATASET_NCOLS;
@@ -2517,8 +2568,6 @@ test_read_one_chunk_filtered_dataset(void)
+ ((C_DATATYPE) i / (READ_ONE_CHUNK_FILTERED_DATASET_CH_NROWS / mpi_size * READ_ONE_CHUNK_FILTERED_DATASET_CH_NCOLS));
if (MAINPROCESS) {
- puts("Testing read from one-chunk filtered dataset");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -2606,9 +2655,9 @@ test_read_one_chunk_filtered_dataset(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -2648,7 +2697,7 @@ test_read_one_chunk_filtered_dataset(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -2698,6 +2747,10 @@ test_read_filtered_dataset_no_overlap(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_NROWS;
dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_NCOLS;
@@ -2714,8 +2767,6 @@ test_read_filtered_dataset_no_overlap(void)
);
if (MAINPROCESS) {
- puts("Testing read from unshared filtered chunks");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -2803,9 +2854,9 @@ test_read_filtered_dataset_no_overlap(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -2845,7 +2896,7 @@ test_read_filtered_dataset_no_overlap(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -2896,6 +2947,10 @@ test_read_filtered_dataset_overlap(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from shared filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_NROWS;
dataset_dims[1] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_NCOLS;
@@ -2913,8 +2968,6 @@ test_read_filtered_dataset_overlap(void)
);
if (MAINPROCESS) {
- puts("Testing read from shared filtered chunks");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3002,9 +3055,9 @@ test_read_filtered_dataset_overlap(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -3059,7 +3112,7 @@ test_read_filtered_dataset_overlap(void)
}
}
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -3111,6 +3164,10 @@ test_read_filtered_dataset_single_no_selection(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from filtered chunks with a single process having no selection");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NROWS;
dataset_dims[1] = (hsize_t) READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NCOLS;
@@ -3133,8 +3190,6 @@ test_read_filtered_dataset_single_no_selection(void)
0, segment_length * sizeof(*correct_buf));
if (MAINPROCESS) {
- puts("Testing read from filtered chunks with a single process having no selection");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3225,9 +3280,9 @@ test_read_filtered_dataset_single_no_selection(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
if (mpi_rank == READ_SINGLE_NO_SELECTION_FILTERED_CHUNKS_NO_SELECT_PROC)
@@ -3275,7 +3330,7 @@ test_read_filtered_dataset_single_no_selection(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -3319,6 +3374,10 @@ test_read_filtered_dataset_all_no_selection(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
+ if (MAINPROCESS) HDputs("Testing read from filtered chunks with all processes having no selection");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_ALL_NO_SELECTION_FILTERED_CHUNKS_NROWS;
dataset_dims[1] = (hsize_t) READ_ALL_NO_SELECTION_FILTERED_CHUNKS_NCOLS;
@@ -3329,8 +3388,6 @@ test_read_filtered_dataset_all_no_selection(void)
VRFY((NULL != correct_buf), "HDcalloc succeeded");
if (MAINPROCESS) {
- puts("Testing read from filtered chunks with all processes having no selection");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3460,6 +3517,10 @@ test_read_filtered_dataset_point_selection(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from filtered chunks with point selection");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_POINT_SELECTION_FILTERED_CHUNKS_NROWS;
dataset_dims[1] = (hsize_t) READ_POINT_SELECTION_FILTERED_CHUNKS_NCOLS;
@@ -3477,8 +3538,6 @@ test_read_filtered_dataset_point_selection(void)
);
if (MAINPROCESS) {
- puts("Testing read from filtered chunks with point selection");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3615,7 +3674,7 @@ test_read_filtered_dataset_point_selection(void)
}
}
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -3669,6 +3728,10 @@ test_read_filtered_dataset_interleaved_read(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing interleaved read from filtered chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) INTERLEAVED_READ_FILTERED_DATASET_NROWS;
dataset_dims[1] = (hsize_t) INTERLEAVED_READ_FILTERED_DATASET_NCOLS;
@@ -3692,8 +3755,6 @@ test_read_filtered_dataset_interleaved_read(void)
);
if (MAINPROCESS) {
- puts("Testing interleaved read from filtered chunks");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3781,9 +3842,9 @@ test_read_filtered_dataset_interleaved_read(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -3838,7 +3899,7 @@ test_read_filtered_dataset_interleaved_read(void)
}
}
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -3889,6 +3950,10 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
+ if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks on separate pages in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_NROWS;
dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_NCOLS;
dataset_dims[2] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SEP_PAGE_DEPTH;
@@ -3903,8 +3968,6 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void)
correct_buf[i] = (C_DATATYPE) ((i % (hsize_t) mpi_size) + (i / (hsize_t) mpi_size));
if (MAINPROCESS) {
- puts("Testing read from unshared filtered chunks on separate pages in 3D dataset");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -3998,9 +4061,9 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void)
start[2] = (hsize_t) mpi_rank;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -4043,7 +4106,7 @@ test_read_3d_filtered_dataset_no_overlap_separate_pages(void)
VRFY((MPI_SUCCESS == MPI_Allgather(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, 1, resized_vector_type, comm)),
"MPI_Allgather succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
VRFY((MPI_SUCCESS == MPI_Type_free(&vector_type)), "MPI_Type_free succeeded");
@@ -4096,6 +4159,10 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks on the same pages in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_NROWS;
dataset_dims[1] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_NCOLS;
dataset_dims[2] = (hsize_t) READ_UNSHARED_FILTERED_CHUNKS_3D_SAME_PAGE_DEPTH;
@@ -4113,8 +4180,6 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void)
);
if (MAINPROCESS) {
- puts("Testing read from unshared filtered chunks on the same pages in 3D dataset");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -4208,9 +4273,9 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void)
start[2] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -4250,7 +4315,7 @@ test_read_3d_filtered_dataset_no_overlap_same_pages(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, recvcounts, displs, C_DATATYPE_MPI, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -4302,6 +4367,10 @@ test_read_3d_filtered_dataset_overlap(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
+ if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in 3D dataset");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_NROWS;
dataset_dims[1] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_NCOLS;
dataset_dims[2] = (hsize_t) READ_SHARED_FILTERED_CHUNKS_3D_DEPTH;
@@ -4328,8 +4397,6 @@ test_read_3d_filtered_dataset_overlap(void)
);
if (MAINPROCESS) {
- puts("Testing read from shared filtered chunks in 3D dataset");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -4423,9 +4490,9 @@ test_read_3d_filtered_dataset_overlap(void)
start[2] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -4473,7 +4540,7 @@ test_read_3d_filtered_dataset_overlap(void)
VRFY((MPI_SUCCESS == MPI_Allgather(read_buf, (int) flat_dims[0], C_DATATYPE_MPI, global_buf, 1, resized_vector_type, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
VRFY((MPI_SUCCESS == MPI_Type_free(&vector_type)), "MPI_Type_free succeeded");
@@ -4525,6 +4592,10 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks in Compound Datatype dataset without Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_NROWS;
dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_NCOLS;
@@ -4563,8 +4634,6 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void)
"Datatype insertion succeeded");
if (MAINPROCESS) {
- puts("Testing read from unshared filtered chunks in Compound Datatype dataset without Datatype conversion");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -4652,9 +4721,9 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void)
start[1] = ((hsize_t) mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_UNSHARED_CH_NCOLS);
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -4694,7 +4763,7 @@ test_read_cmpd_filtered_dataset_no_conversion_unshared(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -4746,6 +4815,10 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in Compound Datatype dataset without Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_NROWS;
dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_NO_CONVERSION_SHARED_NCOLS;
@@ -4787,8 +4860,6 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void)
"Datatype insertion succeeded");
if (MAINPROCESS) {
- puts("Testing read from shared filtered chunks in Compound Datatype dataset without Datatype conversion");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -4876,9 +4947,9 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -4918,7 +4989,7 @@ test_read_cmpd_filtered_dataset_no_conversion_shared(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -4970,6 +5041,10 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from unshared filtered chunks in Compound Datatype dataset with Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_NROWS;
dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_NCOLS;
@@ -5019,8 +5094,6 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void)
"Datatype insertion succeeded");
if (MAINPROCESS) {
- puts("Testing read from unshared filtered chunks in Compound Datatype dataset with Datatype conversion");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -5108,9 +5181,9 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void)
start[1] = ((hsize_t) mpi_rank * READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_UNSHARED_CH_NCOLS);
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -5150,7 +5223,7 @@ test_read_cmpd_filtered_dataset_type_conversion_unshared(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -5203,6 +5276,10 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void)
int *recvcounts = NULL;
int *displs = NULL;
+ if (MAINPROCESS) HDputs("Testing read from shared filtered chunks in Compound Datatype dataset with Datatype conversion");
+
+ CHECK_CUR_FILTER_AVAIL();
+
dataset_dims[0] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_NROWS;
dataset_dims[1] = (hsize_t) READ_COMPOUND_FILTERED_CHUNKS_TYPE_CONVERSION_SHARED_NCOLS;
@@ -5255,8 +5332,6 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void)
"Datatype insertion succeeded");
if (MAINPROCESS) {
- puts("Testing read from shared filtered chunks in Compound Datatype dataset with Datatype conversion");
-
plist_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY((plist_id >= 0), "FAPL creation succeeded");
@@ -5344,9 +5419,9 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is reading with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
VRFY((H5Sselect_hyperslab(filespace, H5S_SELECT_SET, start, stride, count, block) >= 0),
@@ -5386,7 +5461,7 @@ test_read_cmpd_filtered_dataset_type_conversion_shared(void)
VRFY((MPI_SUCCESS == MPI_Allgatherv(read_buf, (int) (flat_dims[0] * sizeof(COMPOUND_C_DATATYPE)), MPI_BYTE, global_buf, recvcounts, displs, MPI_BYTE, comm)),
"MPI_Allgatherv succeeded");
- VRFY((0 == memcmp(global_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(global_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (displs) HDfree(displs);
@@ -5427,7 +5502,9 @@ test_write_serial_read_parallel(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1;
- if (MAINPROCESS) puts("Testing write file serially; read file in parallel");
+ if (MAINPROCESS) HDputs("Testing write file serially; read file in parallel");
+
+ CHECK_CUR_FILTER_AVAIL();
dataset_dims[0] = (hsize_t) WRITE_SERIAL_READ_PARALLEL_NROWS;
dataset_dims[1] = (hsize_t) WRITE_SERIAL_READ_PARALLEL_NCOLS;
@@ -5527,7 +5604,7 @@ test_write_serial_read_parallel(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, plist_id, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
if (correct_buf) HDfree(correct_buf);
@@ -5568,7 +5645,9 @@ test_write_parallel_read_serial(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing write file in parallel; read serially");
+ if (MAINPROCESS) HDputs("Testing write file in parallel; read serially");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -5636,9 +5715,9 @@ test_write_parallel_read_serial(void)
offset[2] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], offset[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu, %llu ], stride[ %llu, %llu, %llu ], offset[ %llu, %llu, %llu ], block size[ %llu, %llu, %llu ]\n",
mpi_rank, count[0], count[1], count[2], stride[0], stride[1], stride[2], offset[0], offset[1], offset[2], block[0], block[1], block[2]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -5707,7 +5786,7 @@ test_write_parallel_read_serial(void)
VRFY((H5Dread(dset_id, HDF5_DATATYPE_NAME, H5S_ALL, H5S_ALL, H5P_DEFAULT, read_buf) >= 0),
"Dataset read succeeded");
- VRFY((0 == memcmp(read_buf, correct_buf, correct_buf_size)),
+ VRFY((0 == HDmemcmp(read_buf, correct_buf, correct_buf_size)),
"Data verification succeeded");
VRFY((H5Dclose(dset_id) >= 0), "Dataset close succeeded");
@@ -5741,7 +5820,9 @@ test_shrinking_growing_chunks(void)
hid_t file_id = -1, dset_id = -1, plist_id = -1;
hid_t filespace = -1, memspace = -1;
- if (MAINPROCESS) puts("Testing continually shrinking/growing chunks");
+ if (MAINPROCESS) HDputs("Testing continually shrinking/growing chunks");
+
+ CHECK_CUR_FILTER_AVAIL();
/* Set up file access property list with parallel I/O access */
plist_id = H5Pcreate(H5P_FILE_ACCESS);
@@ -5803,9 +5884,9 @@ test_shrinking_growing_chunks(void)
start[1] = 0;
if (VERBOSE_MED) {
- printf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
+ HDprintf("Process %d is writing with count[ %llu, %llu ], stride[ %llu, %llu ], start[ %llu, %llu ], block size[ %llu, %llu ]\n",
mpi_rank, count[0], count[1], stride[0], stride[1], start[0], start[1], block[0], block[1]);
- fflush(stdout);
+ HDfflush(stdout);
}
/* Select hyperslab in the file */
@@ -5868,8 +5949,8 @@ main(int argc, char** argv)
if (mpi_size <= 0) {
if (MAINPROCESS) {
- printf("The Parallel Filters tests require at least 1 rank.\n");
- printf("Quitting...\n");
+ HDprintf("The Parallel Filters tests require at least 1 rank.\n");
+ HDprintf("Quitting...\n");
}
MPI_Abort(MPI_COMM_WORLD, 1);
@@ -5877,16 +5958,16 @@ main(int argc, char** argv)
if (H5dont_atexit() < 0) {
if (MAINPROCESS) {
- printf("Failed to turn off atexit processing. Continue.\n");
+ HDprintf("Failed to turn off atexit processing. Continue.\n");
}
}
H5open();
if (MAINPROCESS) {
- printf("==========================\n");
- printf("Parallel Filters tests\n");
- printf("==========================\n\n");
+ HDprintf("==========================\n");
+ HDprintf("Parallel Filters tests\n");
+ HDprintf("==========================\n\n");
}
if (VERBOSE_MED) h5_show_hostname();
@@ -5942,9 +6023,9 @@ main(int argc, char** argv)
VRFY((H5Fclose(file_id) >= 0), "File close succeeded");
if (MAINPROCESS) {
- printf("\n=================================================================\n");
- printf("Re-running Parallel Filters tests with Fletcher32 checksum filter\n");
- printf("=================================================================\n\n");
+ HDprintf("\n=================================================================\n");
+ HDprintf("Re-running Parallel Filters tests with Fletcher32 checksum filter\n");
+ HDprintf("=================================================================\n\n");
}
for (i = 0; i < ARRAY_SIZE(tests); i++) {
@@ -5959,12 +6040,12 @@ main(int argc, char** argv)
if (nerrors) goto exit;
- if (MAINPROCESS) puts("All Parallel Filters tests passed\n");
+ if (MAINPROCESS) HDputs("All Parallel Filters tests passed\n");
exit:
if (nerrors)
if (MAINPROCESS)
- printf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors,
+ HDprintf("*** %d TEST ERROR%s OCCURRED ***\n", nerrors,
nerrors > 1 ? "S" : "");
ALARM_OFF;
diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c
index 5d989bb..16eb13c 100644
--- a/testpar/t_mdset.c
+++ b/testpar/t_mdset.c
@@ -12,6 +12,7 @@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#include "testphdf5.h"
+#include "H5Dprivate.h"
#define DIM 2
#define SIZE 32
@@ -311,13 +312,27 @@ void compact_dataset(void)
VRFY((ret>= 0),"set independent IO collectively succeeded");
}
-
dataset = H5Dopen2(iof, dname, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dopen2 succeeded");
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ hbool_t prop_value;
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((ret >= 0), "H5Pinsert2() succeeded");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
ret = H5Dread(dataset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, dxpl, inme);
VRFY((ret >= 0), "H5Dread succeeded");
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ prop_value = FALSE;
+ ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value);
+ VRFY((ret >= 0), "H5Pget succeeded");
+ VRFY((prop_value == FALSE && dxfer_coll_type == DXFER_COLLECTIVE_IO),"rank 0 Bcast optimization was performed for a compact dataset");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
/* Verify data value */
for(i = 0; i < size; i++)
for(j = 0; j < size; j++)
@@ -603,8 +618,8 @@ void dataset_fillvalue(void)
hsize_t req_count[4] = {1, 6, 7, 8};
hsize_t dset_size; /* Dataset size */
int *rdata, *wdata; /* Buffers for data to read and write */
- int *twdata, *trdata; /* Temporary pointer into buffer */
- int acc, i, j, k, l; /* Local index variables */
+ int *twdata, *trdata; /* Temporary pointer into buffer */
+ int acc, i, j, k, l, ii; /* Local index variables */
herr_t ret; /* Generic return value */
const char *filename;
@@ -645,27 +660,60 @@ void dataset_fillvalue(void)
/*
* Read dataset before any data is written.
*/
- /* set entire read buffer with the constant 2 */
- HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
- /* Independently read the entire dataset back */
- ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
- VRFY((ret >= 0), "H5Dread succeeded");
- /* Verify all data read are the fill value 0 */
- trdata = rdata;
- err_num = 0;
- for(i = 0; i < (int)dset_dims[0]; i++)
+ /* Create DXPL for I/O */
+ dxpl = H5Pcreate(H5P_DATASET_XFER);
+ VRFY((dxpl >= 0), "H5Pcreate succeeded");
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ hbool_t prop_value;
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ ret = H5Pinsert2(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value,
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ VRFY((ret >= 0),"testing property list inserted succeeded");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ for(ii = 0; ii < 2; ii++) {
+
+ if(ii == 0)
+ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT);
+ else
+ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
+ VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
+
+ /* set entire read buffer with the constant 2 */
+ HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
+
+ /* Read the entire dataset back */
+ ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, rdata);
+ VRFY((ret >= 0), "H5Dread succeeded");
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ prop_value = FALSE;
+ ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value);
+ VRFY((ret >= 0), "testing property list get succeeded");
+ if(ii == 0)
+ VRFY((prop_value == FALSE), "correctly handled rank 0 Bcast");
+ else
+ VRFY((prop_value == TRUE), "correctly handled rank 0 Bcast");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* Verify all data read are the fill value 0 */
+ trdata = rdata;
+ err_num = 0;
+ for(i = 0; i < (int)dset_dims[0]; i++)
for(j = 0; j < (int)dset_dims[1]; j++)
- for(k = 0; k < (int)dset_dims[2]; k++)
- for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++)
- if(*trdata != 0)
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata);
- if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
+ for(k = 0; k < (int)dset_dims[2]; k++)
+ for(l = 0; l < (int)dset_dims[3]; l++, twdata++, trdata++)
+ if(*trdata != 0)
+ if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i, j, k, l, *trdata);
+ if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
printf("[more errors ...]\n");
- if(err_num){
+ if(err_num) {
printf("%d errors found in check_value\n", err_num);
- nerrors++;
+ nerrors++;
+ }
}
/* Barrier to ensure all processes have completed the above test. */
@@ -681,10 +729,6 @@ void dataset_fillvalue(void)
ret = H5Sselect_hyperslab(memspace, H5S_SELECT_SET, req_start, NULL, req_count, NULL);
VRFY((ret >= 0), "H5Sselect_hyperslab succeeded on memory dataspace");
- /* Create DXPL for collective I/O */
- dxpl = H5Pcreate(H5P_DATASET_XFER);
- VRFY((dxpl >= 0), "H5Pcreate succeeded");
-
ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
if(dxfer_coll_type == DXFER_INDEPENDENT_IO) {
@@ -711,37 +755,64 @@ void dataset_fillvalue(void)
/*
* Read dataset after partial write.
*/
- /* set entire read buffer with the constant 2 */
- HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
- /* Independently read the entire dataset back */
- ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, rdata);
- VRFY((ret >= 0), "H5Dread succeeded");
- /* Verify correct data read */
- twdata=wdata;
- trdata=rdata;
- err_num=0;
- for(i=0; i<(int)dset_dims[0]; i++)
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ ret = H5Pset(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value);
+ VRFY((ret >= 0), " H5Pset succeeded");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ for(ii = 0; ii < 2; ii++) {
+
+ if(ii == 0)
+ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_INDEPENDENT);
+ else
+ ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE);
+ VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded");
+
+ /* set entire read buffer with the constant 2 */
+ HDmemset(rdata,2,(size_t)(dset_size*sizeof(int)));
+
+ /* Read the entire dataset back */
+ ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, dxpl, rdata);
+ VRFY((ret >= 0), "H5Dread succeeded");
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ prop_value = FALSE;
+ ret = H5Pget(dxpl, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value);
+ VRFY((ret >= 0), "testing property list get succeeded");
+ if(ii == 0)
+ VRFY((prop_value == FALSE), "correctly handled rank 0 Bcast");
+ else
+ VRFY((prop_value == TRUE), "correctly handled rank 0 Bcast");
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* Verify correct data read */
+ twdata=wdata;
+ trdata=rdata;
+ err_num=0;
+ for(i=0; i<(int)dset_dims[0]; i++)
for(j=0; j<(int)dset_dims[1]; j++)
- for(k=0; k<(int)dset_dims[2]; k++)
- for(l=0; l<(int)dset_dims[3]; l++, twdata++, trdata++)
- if(i<mpi_size) {
- if(*twdata != *trdata )
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,j,k,l, *twdata, *trdata);
- } /* end if */
- else {
- if(*trdata != 0)
- if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
- printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,j,k,l, *trdata);
- } /* end else */
- if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
+ for(k=0; k<(int)dset_dims[2]; k++)
+ for(l=0; l<(int)dset_dims[3]; l++, twdata++, trdata++)
+ if(i<mpi_size) {
+ if(*twdata != *trdata )
+ if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ printf("Dataset Verify failed at [%d][%d][%d][%d]: expect %d, got %d\n", i,j,k,l, *twdata, *trdata);
+ } /* end if */
+ else {
+ if(*trdata != 0)
+ if(err_num++ < MAX_ERR_REPORT || VERBOSE_MED)
+ printf("Dataset Verify failed at [%d][%d][%d][%d]: expect 0, got %d\n", i,j,k,l, *trdata);
+ } /* end else */
+ if(err_num > MAX_ERR_REPORT && !VERBOSE_MED)
printf("[more errors ...]\n");
- if(err_num){
+ if(err_num){
printf("%d errors found in check_value\n", err_num);
- nerrors++;
+ nerrors++;
+ }
}
-
+
/* Close all file objects */
ret = H5Dclose(dataset);
VRFY((ret >= 0), "H5Dclose succeeded");
@@ -856,7 +927,7 @@ void collective_group_write(void)
if(!((m+1) % 10)) {
printf("created %d groups\n", m+1);
MPI_Barrier(MPI_COMM_WORLD);
- }
+ }
#endif /* BARRIER_CHECKS */
}
diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c
index 4677bfe..27b561b 100644
--- a/testpar/t_pflush1.c
+++ b/testpar/t_pflush1.c
@@ -15,11 +15,11 @@
* Programmer: Leon Arber <larber@uiuc.edu>
* Sept. 28, 2006.
*
- * Purpose: This is the first half of a two-part test that makes sure
- * that a file can be read after a parallel application crashes as long
- * as the file was flushed first. We simulate a crash by
- * calling _exit(0) since this doesn't flush HDF5 caches but
- * still exits with success.
+ * Purpose: This is the first half of a two-part test that makes sure
+ * that a file can be read after a parallel application crashes
+ * as long as the file was flushed first. We simulate a crash by
+ * calling _exit() since this doesn't flush HDF5 caches but
+ * still exits with success.
*/
#include "h5test.h"
@@ -29,171 +29,190 @@ const char *FILENAME[] = {
NULL
};
-static double the_data[100][100];
+static int data_g[100][100];
+#define N_GROUPS 100
+
+
/*-------------------------------------------------------------------------
- * Function: create_file
- *
- * Purpose: Creates file used in part 1 of the test
+ * Function: create_test_file
*
- * Return: Success: 0
+ * Purpose: Creates the file used in part 1 of the test
*
- * Failure: 1
+ * Return: Success: A valid file ID
+ * Failure: H5I_INVALID_HID
*
- * Programmer: Leon Arber
+ * Programmer: Leon Arber
* Sept. 26, 2006
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static hid_t
-create_file(char* name, hid_t fapl)
+create_test_file(char *name, hid_t fapl_id)
{
- hid_t file, dcpl, space, dset, groups, grp, plist;
- hsize_t ds_size[2] = {100, 100};
- hsize_t ch_size[2] = {5, 5};
- hsize_t i, j;
-
-
-
- if((file=H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t top_level_gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hsize_t dims[2] = {100, 100};
+ hsize_t chunk_dims[2] = {5, 5};
+ hsize_t i, j;
+
+ if((fid = H5Fcreate(name, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0)
+ goto error;
/* Create a chunked dataset */
- if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error;
- if(H5Pset_chunk(dcpl, 2, ch_size) < 0) goto error;
- if((space = H5Screate_simple(2, ds_size, NULL)) < 0) goto error;
- if((dset = H5Dcreate2(file, "dset", H5T_NATIVE_FLOAT, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
- goto error;
-
- plist = H5Pcreate(H5P_DATASET_XFER);
- H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
-
+ if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
+ goto error;
+ if(H5Pset_chunk(dcpl_id, 2, chunk_dims) < 0)
+ goto error;
+ if((sid = H5Screate_simple(2, dims, NULL)) < 0)
+ goto error;
+ if((did = H5Dcreate2(fid, "dset", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if(H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
/* Write some data */
- for(i = 0; i < ds_size[0]; i++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- for(j = 0; j < ds_size[1]; j++)
- the_data[i][j] = (double)(hssize_t)i/(hssize_t)(j+1);
- }
- if(H5Dwrite(dset, H5T_NATIVE_DOUBLE, space, space, plist, the_data) < 0) goto error;
+ for(i = 0; i < dims[0]; i++)
+ for(j = 0; j < dims[1]; j++)
+ data_g[i][j] = (int)(i + (i * j) + j);
+
+ if(H5Dwrite(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0)
+ goto error;
/* Create some groups */
- if((groups = H5Gcreate2(file, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- for(i = 0; i < 100; i++) {
- sprintf(name, "grp%02u", (unsigned)i);
- if((grp = H5Gcreate2(groups, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
+ if((top_level_gid = H5Gcreate2(fid, "some_groups", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ for(i = 0; i < N_GROUPS; i++) {
+ HDsprintf(name, "grp%02u", (unsigned)i);
+ if((gid = H5Gcreate2(top_level_gid, name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
}
- return file;
+ return fid;
error:
- HD_exit(1);
-}
+ return H5I_INVALID_HID;
+} /* end create_test_file() */
+
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: Part 1 of a two-part H5Fflush() test.
- *
- * Return: Success: 0
+ * Purpose: Part 1 of a two-part parallel H5Fflush() test.
*
- * Failure: 1
+ * Return: EXIT_FAILURE (always)
*
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
- * Modifications:
- * Leon Arber
- * Sept. 26, 2006, expand test to check for failure if H5Fflush is not called.
- *
- *
*-------------------------------------------------------------------------
*/
int
main(int argc, char* argv[])
{
- hid_t file1, file2, fapl;
- MPI_File *mpifh_p = NULL;
- char name[1024];
- const char *envval = NULL;
- int mpi_size, mpi_rank;
- MPI_Comm comm = MPI_COMM_WORLD;
- MPI_Info info = MPI_INFO_NULL;
+ hid_t fid1 = H5I_INVALID_HID;
+ hid_t fid2 = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ MPI_File *mpifh_p = NULL;
+ char name[1024];
+ const char *envval = NULL;
+ int mpi_size;
+ int mpi_rank;
+ MPI_Comm comm = MPI_COMM_WORLD;
+ MPI_Info info = MPI_INFO_NULL;
MPI_Init(&argc, &argv);
MPI_Comm_size(comm, &mpi_size);
MPI_Comm_rank(comm, &mpi_rank);
- fapl = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl, comm, info);
-
if(mpi_rank == 0)
- TESTING("H5Fflush (part1)");
+ TESTING("H5Fflush (part1)");
+
+ /* Don't run using the split VFD */
envval = HDgetenv("HDF5_DRIVER");
if(envval == NULL)
envval = "nomatch";
- if(HDstrcmp(envval, "split")) {
+
+ if(!HDstrcmp(envval, "split")) {
+ if(mpi_rank == 0) {
+ SKIPPED();
+ HDputs(" Test not compatible with current Virtual File Driver");
+ }
+ MPI_Finalize();
+ HDexit(EXIT_FAILURE);
+ }
+
+ if((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
+ goto error;
+
/* Create the file */
- h5_fixname(FILENAME[0], fapl, name, sizeof name);
- file1 = create_file(name, fapl);
+ h5_fixname(FILENAME[0], fapl_id, name, sizeof(name));
+ if((fid1 = create_test_file(name, fapl_id)) < 0)
+ goto error;
/* Flush and exit without closing the library */
- if(H5Fflush(file1, H5F_SCOPE_GLOBAL) < 0) goto error;
+ if(H5Fflush(fid1, H5F_SCOPE_GLOBAL) < 0)
+ goto error;
/* Create the other file which will not be flushed */
- h5_fixname(FILENAME[1], fapl, name, sizeof name);
- file2 = create_file(name, fapl);
-
+ h5_fixname(FILENAME[1], fapl_id, name, sizeof(name));
+ if((fid2 = create_test_file(name, fapl_id)) < 0)
+ goto error;
if(mpi_rank == 0)
PASSED();
- fflush(stdout);
- fflush(stderr);
- } /* end if */
- else {
- SKIPPED();
- puts(" Test not compatible with current Virtual File Driver");
- } /* end else */
-
- /*
- * Some systems like AIX do not like files not closed when MPI_Finalize
+
+ HDfflush(stdout);
+ HDfflush(stderr);
+
+ /* Some systems like AIX do not like files not being closed when MPI_Finalize
* is called. So, we need to get the MPI file handles, close them by hand.
* Then the _exit is still needed to stop at_exit from happening in some systems.
* Note that MPIO VFD returns the address of the file-handle in the VFD struct
* because MPI_File_close wants to modify the file-handle variable.
*/
- /* close file1 */
- if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0) {
- printf("H5Fget_vfd_handle for file1 failed\n");
- goto error;
- } /* end if */
- if(MPI_File_close(mpifh_p) != MPI_SUCCESS) {
- printf("MPI_File_close for file1 failed\n");
- goto error;
- } /* end if */
- /* close file2 */
- if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0) {
- printf("H5Fget_vfd_handle for file2 failed\n");
- goto error;
- } /* end if */
- if(MPI_File_close(mpifh_p) != MPI_SUCCESS) {
- printf("MPI_File_close for file2 failed\n");
- goto error;
- } /* end if */
-
- fflush(stdout);
- fflush(stderr);
- HD_exit(0);
+ /* Close file 1 */
+ if(H5Fget_vfd_handle(fid1, fapl_id, (void **)&mpifh_p) < 0)
+ goto error;
+ if(MPI_File_close(mpifh_p) != MPI_SUCCESS)
+ goto error;
+
+ /* Close file 2 */
+ if(H5Fget_vfd_handle(fid2, fapl_id, (void **)&mpifh_p) < 0)
+ goto error;
+ if(MPI_File_close(mpifh_p) != MPI_SUCCESS)
+ goto error;
+
+ HDfflush(stdout);
+ HDfflush(stderr);
+
+ /* Always exit with a failure code!
+ *
+ * In accordance with the standard, not having all processes
+ * call MPI_Finalize() can be considered an error, so mpiexec
+ * et al. may indicate failure on return. It's much easier to
+ * always ignore the failure condition than to handle some
+ * platforms returning success and others failure.
+ */
+ HD_exit(EXIT_FAILURE);
error:
- fflush(stdout);
- fflush(stderr);
- HD_exit(1);
-}
+ HDfflush(stdout);
+ HDfflush(stderr);
+ HDprintf("*** ERROR ***\n");
+ HDprintf("THERE WAS A REAL ERROR IN t_pflush1.\n");
+ HD_exit(EXIT_FAILURE);
+} /* end main() */
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c
index 2051f4e..f58e5a5 100644
--- a/testpar/t_pflush2.c
+++ b/testpar/t_pflush2.c
@@ -30,116 +30,124 @@ const char *FILENAME[] = {
NULL
};
-static double the_data[100][100];
+static int data_g[100][100];
+#define N_GROUPS 100
/*-------------------------------------------------------------------------
- * Function: check_file
+ * Function: check_test_file
*
- * Purpose: Part 2 of a two-part H5Fflush() test.
+ * Purpose: Part 2 of a two-part H5Fflush() test.
*
- * Return: Success: 0
+ * Return: SUCCEED/FAIL
*
- * Failure: 1
- *
- * Programmer: Leon Arber
+ * Programmer: Leon Arber
* Sept. 26, 2006.
*
*-------------------------------------------------------------------------
*/
-static int
-check_file(char* name, hid_t fapl)
+static herr_t
+check_test_file(char* name, hid_t fapl_id)
{
- hid_t file, space, dset, groups, grp, plist;
- hsize_t ds_size[2];
- double error;
- hsize_t i, j;
-
- plist = H5Pcreate(H5P_DATASET_XFER);
- H5Pset_dxpl_mpio(plist, H5FD_MPIO_COLLECTIVE);
- if((file = H5Fopen(name, H5F_ACC_RDONLY, fapl)) < 0) goto error;
+ hid_t fid = H5I_INVALID_HID;
+ hid_t sid = H5I_INVALID_HID;
+ hid_t did = H5I_INVALID_HID;
+ hid_t top_level_gid = H5I_INVALID_HID;
+ hid_t gid = H5I_INVALID_HID;
+ hid_t dxpl_id = H5I_INVALID_HID;
+ hsize_t dims[2];
+ int val;
+ hsize_t i, j;
+
+ if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
+ goto error;
+ if(H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE) < 0)
+ goto error;
+ if((fid = H5Fopen(name, H5F_ACC_RDONLY, fapl_id)) < 0)
+ goto error;
/* Open the dataset */
- if((dset = H5Dopen2(file, "dset", H5P_DEFAULT)) < 0) goto error;
- if((space = H5Dget_space(dset)) < 0) goto error;
- if(H5Sget_simple_extent_dims(space, ds_size, NULL) < 0) goto error;
- assert(100==ds_size[0] && 100==ds_size[1]);
+ if((did = H5Dopen2(fid, "dset", H5P_DEFAULT)) < 0)
+ goto error;
+ if((sid = H5Dget_space(did)) < 0)
+ goto error;
+ if(H5Sget_simple_extent_dims(sid, dims, NULL) < 0)
+ goto error;
+ HDassert(100 == dims[0] && 100 == dims[1]);
/* Read some data */
- if (H5Dread(dset, H5T_NATIVE_DOUBLE, space, space, plist,
- the_data) < 0) goto error;
- for (i=0; i<ds_size[0]; i++) {
- for (j=0; j<ds_size[1]; j++) {
- /*
- * The extra cast in the following statement is a bug workaround
- * for the Win32 version 5.0 compiler.
- * 1998-11-06 ptl
- */
- error = fabs(the_data[i][j]-(double)(hssize_t)i/((hssize_t)j+1));
- if (error>0.0001) {
- H5_FAILED();
- printf(" dset[%lu][%lu] = %g\n",
- (unsigned long)i, (unsigned long)j, the_data[i][j]);
- printf(" should be %g\n",
- (double)(hssize_t)i/(hssize_t)(j+1));
- goto error;
- }
- }
+ if(H5Dread(did, H5T_NATIVE_INT, sid, sid, dxpl_id, data_g) < 0)
+ goto error;
+ for(i = 0; i < dims[0]; i++) {
+ for(j = 0; j < dims[1]; j++) {
+ val = (int)(i + (i * j) + j);
+ if(data_g[i][j] != val) {
+ H5_FAILED();
+ HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]);
+ HDprintf(" should be %d\n", val);
+ }
+ }
}
/* Open some groups */
- if((groups = H5Gopen2(file, "some_groups", H5P_DEFAULT)) < 0) goto error;
- for(i = 0; i < 100; i++) {
- sprintf(name, "grp%02u", (unsigned)i);
- if((grp = H5Gopen2(groups, name, H5P_DEFAULT)) < 0) goto error;
- if(H5Gclose(grp) < 0) goto error;
+ if((top_level_gid = H5Gopen2(fid, "some_groups", H5P_DEFAULT)) < 0)
+ goto error;
+ for(i = 0; i < N_GROUPS; i++) {
+ HDsprintf(name, "grp%02u", (unsigned)i);
+ if((gid = H5Gopen2(top_level_gid, name, H5P_DEFAULT)) < 0)
+ goto error;
+ if(H5Gclose(gid) < 0)
+ goto error;
}
- if(H5Gclose(groups) < 0) goto error;
- if(H5Dclose(dset) < 0) goto error;
- if(H5Fclose(file) < 0) goto error;
- if(H5Pclose(plist) < 0) goto error;
- if(H5Sclose(space) < 0) goto error;
+ if(H5Gclose(top_level_gid) < 0)
+ goto error;
+ if(H5Dclose(did) < 0)
+ goto error;
+ if(H5Fclose(fid) < 0)
+ goto error;
+ if(H5Pclose(dxpl_id) < 0)
+ goto error;
+ if(H5Sclose(sid) < 0)
+ goto error;
- return 0;
+ return SUCCEED;
error:
H5E_BEGIN_TRY {
- H5Pclose(plist);
- H5Gclose(groups);
- H5Dclose(dset);
- H5Fclose(file);
- H5Sclose(space);
+ H5Pclose(dxpl_id);
+ H5Gclose(top_level_gid);
+ H5Dclose(did);
+ H5Fclose(fid);
+ H5Sclose(sid);
+ H5Gclose(gid);
} H5E_END_TRY;
- return 1;
-}
+ return FAIL;
+} /* end check_test_file() */
/*-------------------------------------------------------------------------
- * Function: main
+ * Function: main
*
- * Purpose: Part 2 of a two-part H5Fflush() test.
+ * Purpose: Part 2 of a two-part H5Fflush() test.
*
- * Return: Success: 0
+ * Return: EXIT_SUCCESS/EXIT_FAIL
*
- * Failure: 1
- *
- * Programmer: Robb Matzke
+ * Programmer: Robb Matzke
* Friday, October 23, 1998
*
- * Modifications:
- * Leon Arber
- * Sept. 26, 2006, expand to check for case where the was file not flushed.
- *
*-------------------------------------------------------------------------
*/
int
-main(int argc, char* argv[])
+main(int argc, char *argv[])
{
+ hid_t fapl_id1 = H5I_INVALID_HID;
+ hid_t fapl_id2 = H5I_INVALID_HID;
H5E_auto2_t func;
- char name[1024];
+ char name[1024];
const char *envval = NULL;
- int mpi_size, mpi_rank;
+ int mpi_size;
+ int mpi_rank;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
@@ -148,69 +156,70 @@ main(int argc, char* argv[])
MPI_Comm_rank(comm, &mpi_rank);
if(mpi_rank == 0)
- TESTING("H5Fflush (part2 with flush)");
+ TESTING("H5Fflush (part2 with flush)");
- /* Don't run this test using the core or split file drivers */
+ /* Don't run using the split VFD */
envval = HDgetenv("HDF5_DRIVER");
- if (envval == NULL)
+ if(envval == NULL)
envval = "nomatch";
- if (HDstrcmp(envval, "core") && HDstrcmp(envval, "split")) {
- hid_t fapl1, fapl2;
-
- fapl1 = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl1, comm, info);
-
- fapl2 = H5Pcreate(H5P_FILE_ACCESS);
- H5Pset_fapl_mpio(fapl2, comm, info);
-
- /* Check the case where the file was flushed */
- h5_fixname(FILENAME[0], fapl1, name, sizeof name);
- if(check_file(name, fapl1))
- {
- H5_FAILED()
- goto error;
- }
- else if(mpi_rank == 0)
- {
- PASSED()
- }
-
- /* Check the case where the file was not flushed. This should give an error
- * so we turn off the error stack temporarily */
- if(mpi_rank == 0)
- TESTING("H5Fflush (part2 without flush)");
- H5Eget_auto2(H5E_DEFAULT,&func,NULL);
- H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
-
- h5_fixname(FILENAME[1], fapl2, name, sizeof name);
- if(check_file(name, fapl2))
- {
- if(mpi_rank == 0)
- {
- PASSED()
- }
- }
- else
- {
- H5_FAILED()
- goto error;
- }
- H5Eset_auto2(H5E_DEFAULT, func, NULL);
-
-
- h5_clean_files(&FILENAME[0], fapl1);
- h5_clean_files(&FILENAME[1], fapl2);
+
+ if(!HDstrcmp(envval, "split")) {
+ if(mpi_rank == 0) {
+ SKIPPED();
+ HDputs(" Test not compatible with current Virtual File Driver");
+ }
+ MPI_Finalize();
+ HDexit(EXIT_FAILURE);
+ }
+
+ if((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_fapl_mpio(fapl_id1, comm, info) < 0)
+ goto error;
+
+ if((fapl_id2 = H5Pcreate(H5P_FILE_ACCESS)) < 0)
+ goto error;
+ if(H5Pset_fapl_mpio(fapl_id2, comm, info) < 0)
+ goto error;
+
+ /* Check the case where the file was flushed */
+ h5_fixname(FILENAME[0], fapl_id1, name, sizeof(name));
+ if(check_test_file(name, fapl_id1)) {
+ H5_FAILED()
+ goto error;
}
- else
- {
- SKIPPED();
- puts(" Test not compatible with current Virtual File Driver");
+ else if(mpi_rank == 0) {
+ PASSED()
}
+ /* Check the case where the file was not flushed. This should give an error
+ * so we turn off the error stack temporarily.
+ */
+ if(mpi_rank == 0)
+ TESTING("H5Fflush (part2 without flush)");
+ H5Eget_auto2(H5E_DEFAULT,&func, NULL);
+ H5Eset_auto2(H5E_DEFAULT, NULL, NULL);
+
+ h5_fixname(FILENAME[1], fapl_id2, name, sizeof(name));
+ if(check_test_file(name, fapl_id2)) {
+ if(mpi_rank == 0)
+ PASSED()
+ }
+ else {
+ H5_FAILED()
+ goto error;
+ }
+
+ H5Eset_auto2(H5E_DEFAULT, func, NULL);
+
+ h5_clean_files(&FILENAME[0], fapl_id1);
+ h5_clean_files(&FILENAME[1], fapl_id2);
+
MPI_Finalize();
- return 0;
- error:
- return 1;
-}
+ HDexit(EXIT_SUCCESS);
+
+error:
+ HDexit(EXIT_FAILURE);
+} /* end main() */
diff --git a/testpar/t_pread.c b/testpar/t_pread.c
index 19ccf56..ac33b88 100644
--- a/testpar/t_pread.c
+++ b/testpar/t_pread.c
@@ -17,6 +17,7 @@
*/
#include "testpar.h"
+#include "H5Dprivate.h"
/* The collection of files is included below to aid
* an external "cleanup" process if required.
@@ -34,6 +35,8 @@ const char *FILENAMES[NFILENAME + 1]={"reloc_t_pread_data_file",
#define COUNT 1000
+#define LIMIT_NPROC 6
+
hbool_t pass = true;
static const char *random_hdf5_text =
"Now is the time for all first-time-users of HDF5 to read their \
@@ -46,7 +49,7 @@ completely foolproof is to underestimate the ingenuity of complete\n\
fools.\n";
static int generate_test_file(MPI_Comm comm, int mpi_rank, int group);
-static int test_parallel_read(MPI_Comm comm, int mpi_rank, int group);
+static int test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group);
static char *test_argv0 = NULL;
@@ -108,6 +111,9 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
hid_t fapl_id = -1;
hid_t dxpl_id = -1;
hid_t dset_id = -1;
+ hid_t dset_id_ch = -1;
+ hid_t dcpl_id = H5P_DEFAULT;
+ hsize_t chunk[1];
float nextValue;
float *data_slice = NULL;
@@ -272,6 +278,55 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
}
}
+
+ /* create a chunked dataset */
+ chunk[0] = COUNT/8;
+
+ if ( pass ) {
+ if ( (dcpl_id = H5Pcreate (H5P_DATASET_CREATE)) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pcreate() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Pset_chunk (dcpl_id, 1, chunk) ) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pset_chunk() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+
+ if ( (dset_id_ch = H5Dcreate2(file_id, "dataset0_chunked", H5T_NATIVE_FLOAT,
+ filespace, H5P_DEFAULT, dcpl_id,
+ H5P_DEFAULT)) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dcreate2() failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Dwrite(dset_id_ch, H5T_NATIVE_FLOAT, memspace,
+ filespace, dxpl_id, data_slice)) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dwrite() failed.\n";
+ }
+ }
+ if ( pass || (dcpl_id != -1)) {
+ if ( H5Pclose(dcpl_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pclose(dcpl_id) failed.\n";
+ }
+ }
+
+ if ( pass || (dset_id_ch != -1)) {
+ if ( H5Dclose(dset_id_ch) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dclose(dset_id_ch) failed.\n";
+ }
+ }
+
/* close file, etc. */
if ( pass || (dset_id != -1)) {
if ( H5Dclose(dset_id) < 0 ) {
@@ -413,7 +468,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
* Function: test_parallel_read
*
* Purpose: This actually tests the superblock optimization
- * and covers the two primary cases we're interested in.
+ * and covers the three primary cases we're interested in.
* 1). That HDF5 files can be opened in parallel by
* the rank 0 process and that the superblock
* offset is correctly broadcast to the other
@@ -423,6 +478,10 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
* subgroups of MPI_COMM_WORLD and that each
* subgroup operates as described in (1) to
* collectively read the data.
+ * 3). Testing proc0-read-and-MPI_Bcast using
+ * sub-communicators, and reading into
+ * a memory space that is different from the
+ * file space, and chunked datasets.
*
* The global MPI rank is used for reading and
* writing data for process specific data in the
@@ -444,7 +503,7 @@ generate_test_file( MPI_Comm comm, int mpi_rank, int group_id )
*-------------------------------------------------------------------------
*/
static int
-test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
+test_parallel_read(MPI_Comm comm, int mpi_rank, int mpi_size, int group_id)
{
const char *failure_mssg;
const char *fcn_name = "test_parallel_read()";
@@ -457,8 +516,13 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
hid_t fapl_id = -1;
hid_t file_id = -1;
hid_t dset_id = -1;
+ hid_t dset_id_ch = -1;
+ hid_t dxpl_id = H5P_DEFAULT;
hid_t memspace = -1;
hid_t filespace = -1;
+ hid_t filetype = -1;
+ size_t filetype_size;
+ hssize_t dset_size;
hsize_t i;
hsize_t offset;
hsize_t count = COUNT;
@@ -552,6 +616,14 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
}
}
+ /* open the chunked data set */
+ if ( pass ) {
+ if ( (dset_id_ch = H5Dopen2(file_id, "dataset0_chunked", H5P_DEFAULT)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dopen2() failed\n";
+ }
+ }
+
/* setup memspace */
if ( pass ) {
dims[0] = count;
@@ -606,14 +678,6 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
}
}
- /* close file, etc. */
- if ( pass || (dset_id != -1) ) {
- if ( H5Dclose(dset_id) < 0 ) {
- pass = false;
- failure_mssg = "H5Dclose(dset_id) failed.\n";
- }
- }
-
if ( pass || (memspace != -1) ) {
if ( H5Sclose(memspace) < 0 ) {
pass = false;
@@ -628,6 +692,330 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
}
}
+ /* free data_slice if it has been allocated */
+ if ( data_slice != NULL ) {
+ HDfree(data_slice);
+ data_slice = NULL;
+ }
+
+ /*
+ * Test reading proc0-read-and-bcast with sub-communicators
+ */
+
+ /* Don't test with more than LIMIT_NPROC processes to avoid memory issues */
+
+ if( group_size <= LIMIT_NPROC ) {
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ hbool_t prop_value;
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ if ( (filespace = H5Dget_space(dset_id )) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dget_space failed.\n";
+ }
+
+ if ( (dset_size = H5Sget_simple_extent_npoints(filespace)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Sget_simple_extent_npoints failed.\n";
+ }
+
+ if ( (filetype = H5Dget_type(dset_id)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dget_type failed.\n";
+ }
+
+ if ( (filetype_size = H5Tget_size(filetype)) == 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Tget_size failed.\n";
+ }
+
+ if ( H5Tclose(filetype) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Tclose failed.\n";
+ };
+
+ if ( (data_slice = (float *)HDmalloc((size_t)dset_size*filetype_size)) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "malloc of data_slice failed.\n";
+ }
+
+ if ( pass ) {
+ if ( (dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pcreate(H5P_DATASET_XFER) failed.\n";
+ }
+ }
+
+ if ( pass ) {
+ if ( (H5Pset_dxpl_mpio(dxpl_id, H5FD_MPIO_COLLECTIVE)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Pset_dxpl_mpio() failed.\n";
+ }
+ }
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ if(H5Pinsert2(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, H5D_XFER_COLL_RANK0_BCAST_SIZE, &prop_value,
+ NULL, NULL, NULL, NULL, NULL, NULL) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pinsert2() failed\n";
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* read H5S_ALL section */
+ if ( pass ) {
+ if ( (H5Dread(dset_id, H5T_NATIVE_FLOAT, H5S_ALL,
+ H5S_ALL, dxpl_id, data_slice)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dread() failed\n";
+ }
+ }
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = FALSE;
+ if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pget() failed\n";
+ }
+ if (pass) {
+ if(prop_value != TRUE) {
+ pass = FALSE;
+ failure_mssg = "rank 0 Bcast optimization was mistakenly not performed\n";
+ }
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* verify the data */
+ if ( pass ) {
+
+ if ( comm == MPI_COMM_WORLD ) /* test 1 */
+ nextValue = 0;
+ else if ( group_id == 0 ) /* test 2 group 0 */
+ nextValue = 0;
+ else /* test 2 group 1 */
+ nextValue = (float)((hsize_t)( mpi_size / 2 )*count);
+
+ i = 0;
+ while ( ( pass ) && ( i < (hsize_t)dset_size ) ) {
+ /* what we really want is data_slice[i] != nextValue --
+ * the following is a circumlocution to shut up the
+ * the compiler.
+ */
+ if ( ( data_slice[i] > nextValue ) ||
+ ( data_slice[i] < nextValue ) ) {
+ pass = FALSE;
+ failure_mssg = "Unexpected dset contents.\n";
+ }
+ nextValue += 1;
+ i++;
+ }
+ }
+
+ /* read H5S_ALL section for the chunked dataset */
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ if(H5Pset(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pset() failed\n";
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ for ( i = 0; i < (hsize_t)dset_size; i++) {
+ data_slice[i] = 0;
+ }
+ if ( pass ) {
+ if ( (H5Dread(dset_id_ch, H5T_NATIVE_FLOAT, H5S_ALL,
+ H5S_ALL, dxpl_id, data_slice)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dread() failed\n";
+ }
+ }
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = FALSE;
+ if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pget() failed\n";
+ }
+ if (pass) {
+ if(prop_value == TRUE) {
+ pass = FALSE;
+ failure_mssg = "rank 0 Bcast optimization was mistakenly performed for chunked dataset\n";
+ }
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* verify the data */
+ if ( pass ) {
+
+ if ( comm == MPI_COMM_WORLD ) /* test 1 */
+ nextValue = 0;
+ else if ( group_id == 0 ) /* test 2 group 0 */
+ nextValue = 0;
+ else /* test 2 group 1 */
+ nextValue = (float)((hsize_t)( mpi_size / 2 )*count);
+
+ i = 0;
+ while ( ( pass ) && ( i < (hsize_t)dset_size ) ) {
+ /* what we really want is data_slice[i] != nextValue --
+ * the following is a circumlocution to shut up the
+ * the compiler.
+ */
+ if ( ( data_slice[i] > nextValue ) ||
+ ( data_slice[i] < nextValue ) ) {
+ pass = FALSE;
+ failure_mssg = "Unexpected chunked dset contents.\n";
+ }
+ nextValue += 1;
+ i++;
+ }
+ }
+
+ if ( pass || (filespace != -1) ) {
+ if ( H5Sclose(filespace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(filespace) failed.\n";
+ }
+ }
+
+ /* free data_slice if it has been allocated */
+ if ( data_slice != NULL ) {
+ HDfree(data_slice);
+ data_slice = NULL;
+ }
+
+ /*
+ * Read an H5S_ALL filespace into a hyperslab defined memory space
+ */
+
+ if ( (data_slice = (float *)HDmalloc((size_t)(dset_size*2)*filetype_size)) == NULL ) {
+ pass = FALSE;
+ failure_mssg = "malloc of data_slice failed.\n";
+ }
+
+ /* setup memspace */
+ if ( pass ) {
+ dims[0] = (hsize_t)dset_size*2;
+ if ( (memspace = H5Screate_simple(1, dims, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Screate_simple(1, dims, NULL) failed\n";
+ }
+ }
+ if ( pass ) {
+ offset = (hsize_t)dset_size;
+ if ( (H5Sselect_hyperslab(memspace, H5S_SELECT_SET,
+ &offset, NULL, &offset, NULL)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Sselect_hyperslab() failed\n";
+ }
+ }
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = H5D_XFER_COLL_RANK0_BCAST_DEF;
+ if(H5Pset(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pset() failed\n";
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* read this processes section of the data */
+ if ( pass ) {
+ if ( (H5Dread(dset_id, H5T_NATIVE_FLOAT, memspace,
+ H5S_ALL, dxpl_id, data_slice)) < 0 ) {
+ pass = FALSE;
+ failure_mssg = "H5Dread() failed\n";
+ }
+ }
+
+#ifdef H5_HAVE_INSTRUMENTED_LIBRARY
+ if ( pass ) {
+ prop_value = FALSE;
+ if(H5Pget(dxpl_id, H5D_XFER_COLL_RANK0_BCAST_NAME, &prop_value) < 0) {
+ pass = FALSE;
+ failure_mssg = "H5Pget() failed\n";
+ }
+ if (pass) {
+ if(prop_value != TRUE) {
+ pass = FALSE;
+ failure_mssg = "rank 0 Bcast optimization was mistakenly not performed\n";
+ }
+ }
+ }
+#endif /* H5_HAVE_INSTRUMENTED_LIBRARY */
+
+ /* verify the data */
+ if ( pass ) {
+
+ if ( comm == MPI_COMM_WORLD ) /* test 1 */
+ nextValue = 0;
+ else if ( group_id == 0 ) /* test 2 group 0 */
+ nextValue = 0;
+ else /* test 2 group 1 */
+ nextValue = (float)((hsize_t)(mpi_size / 2)*count);
+
+ i = (hsize_t)dset_size;
+ while ( ( pass ) && ( i < (hsize_t)dset_size ) ) {
+ /* what we really want is data_slice[i] != nextValue --
+ * the following is a circumlocution to shut up the
+ * the compiler.
+ */
+ if ( ( data_slice[i] > nextValue ) ||
+ ( data_slice[i] < nextValue ) ) {
+ pass = FALSE;
+ failure_mssg = "Unexpected dset contents.\n";
+ }
+ nextValue += 1;
+ i++;
+ }
+ }
+
+ if ( pass || (memspace != -1) ) {
+ if ( H5Sclose(memspace) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Sclose(memspace) failed.\n";
+ }
+ }
+
+ /* free data_slice if it has been allocated */
+ if ( data_slice != NULL ) {
+ HDfree(data_slice);
+ data_slice = NULL;
+ }
+
+ if ( pass || (dxpl_id != -1) ) {
+ if ( H5Pclose(dxpl_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Pclose(dxpl_id) failed.\n";
+ }
+ }
+ }
+
+ /* close file, etc. */
+ if ( pass || (dset_id != -1) ) {
+ if ( H5Dclose(dset_id) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dclose(dset_id) failed.\n";
+ }
+ }
+
+ if ( pass || (dset_id_ch != -1) ) {
+ if ( H5Dclose(dset_id_ch) < 0 ) {
+ pass = false;
+ failure_mssg = "H5Dclose(dset_id_ch) failed.\n";
+ }
+ }
+
if ( pass || (file_id != -1) ) {
if ( H5Fclose(file_id) < 0 ) {
pass = false;
@@ -668,17 +1056,9 @@ test_parallel_read(MPI_Comm comm, int mpi_rank, int group_id)
HDfprintf(stdout, "%s: failure_mssg = \"%s\"\n",
fcn_name, failure_mssg);
}
-
HDremove(reloc_data_filename);
}
- /* free data_slice if it has been allocated */
- if ( data_slice != NULL ) {
- HDfree(data_slice);
- data_slice = NULL;
- }
-
-
return( ! pass );
} /* test_parallel_read() */
@@ -810,7 +1190,7 @@ main( int argc, char **argv)
}
/* Now read the generated test file (stil using MPI_COMM_WORLD) */
- nerrs += test_parallel_read( MPI_COMM_WORLD, mpi_rank, which_group);
+ nerrs += test_parallel_read( MPI_COMM_WORLD, mpi_rank, mpi_size, which_group);
if ( nerrs > 0 ) {
if ( mpi_rank == 0 ) {
@@ -826,7 +1206,7 @@ main( int argc, char **argv)
}
/* run the 2nd set of tests */
- nerrs += test_parallel_read(group_comm, mpi_rank, which_group);
+ nerrs += test_parallel_read(group_comm, mpi_rank, mpi_size, which_group);
if ( nerrs > 0 ) {
if ( mpi_rank == 0 ) {
diff --git a/testpar/testpflush.sh.in b/testpar/testpflush.sh.in
new file mode 100644
index 0000000..02f0e26
--- /dev/null
+++ b/testpar/testpflush.sh.in
@@ -0,0 +1,64 @@
+#! /bin/sh
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# 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.
+#
+#
+# Test script for the parallel flush test
+#
+# The parallel flush test uses two programs to test flush operations
+# in parallel HDF5. The first program purposely exits without calling
+# MPI_Finalize(), which is an error under the MPI standard and mpiexec
+# in some implementations will return an error code even though all
+# processes exit successfully. This script lets us swallow the error
+# from the first program.
+#
+# True errors in the first program will be detected as errors in the
+# second program, so watch out for that.
+#
+# Programmer: Dana Robinson
+# Fall 2018
+
+# The build (current) directory might be different than the source directory.
+if test -z "$srcdir"; then
+ srcdir=.
+fi
+
+# Turn the $$ we use to avoid Autotools munging into $
+#
+# Allowing $$ to substitute in both the RUNPARALLEL string and the
+# regexp is intentional. There doesn't seem to be a way around
+# this using quote shenanigans. The downside is that there is a remote
+# chance that the shell's pid will match a number in the RUNPARALLEL
+# variable, but that seems less likely to cause problems than expecting
+# library builders to specify two almost identical versions of the
+# RUNPARALLEL command, one for use in scripts and one via Makefiles.
+RUNPARALLELSCRIPT=`echo "@RUNPARALLEL@" | sed "s/$$/\$/g"`
+
+# ==========================================
+# Run the first parallel flush test program
+# (note that we ignore any errors here)
+# ==========================================
+echo "*** NOTE ***********************************************************"
+echo "You may see complaints from mpiexec et al. that not all processes"
+echo "called MPI_Finalize(). This is an intended characteristic of the"
+echo "test and should not be considered an error."
+echo "********************************************************************"
+eval ${RUNPARALLELSCRIPT} ./t_pflush1
+
+
+# ===========================================
+# Run the second parallel flush test program
+# The return code of this call is the return
+# code of the script.
+# ===========================================
+eval ${RUNPARALLELSCRIPT} ./t_pflush2
+
diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c
index 69b66ae..999e17a 100644
--- a/testpar/testphdf5.c
+++ b/testpar/testphdf5.c
@@ -549,7 +549,10 @@ int main(int argc, char **argv)
AddTest("noselcollmdread", test_partial_no_selection_coll_md_read, NULL,
"Collective Metadata read with some ranks having no selection", PARATESTFILE);
-
+ AddTest("MC coll MD read", test_multi_chunk_io_addrmap_issue, NULL,
+ "Collective MD read with multi chunk I/O (H5D__chunk_addrmap)", PARATESTFILE);
+ AddTest("LC coll MD read", test_link_chunk_io_sort_chunk_issue, NULL,
+ "Collective MD read with link chunk I/O (H5D__sort_chunk)", PARATESTFILE);
/* Display testing information */
TestInfo(argv[0]);
diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h
index 176574e..4409221 100644
--- a/testpar/testphdf5.h
+++ b/testpar/testphdf5.h
@@ -295,6 +295,8 @@ void compress_readAll(void);
#endif /* H5_HAVE_FILTER_DEFLATE */
void test_dense_attr(void);
void test_partial_no_selection_coll_md_read(void);
+void test_multi_chunk_io_addrmap_issue(void);
+void test_link_chunk_io_sort_chunk_issue(void);
/* commonly used prototypes */
hid_t create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type);
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 2257232..66fb113 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1429,7 +1429,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt
index a03b60a..1596ea7 100644
--- a/tools/lib/CMakeLists.txt
+++ b/tools/lib/CMakeLists.txt
@@ -76,18 +76,6 @@ endif ()
##############################################################################
#-----------------------------------------------------------------------------
-# Add file(s) to CMake Install
-#-----------------------------------------------------------------------------
-install (
- FILES
- ${H5_TOOLS_LIB_HDRS}
- DESTINATION
- ${HDF5_INSTALL_INCLUDE_DIR}
- COMPONENT
- toolsheaders
-)
-
-#-----------------------------------------------------------------------------
# Add Target(s) to CMake Install for import into other projects
#-----------------------------------------------------------------------------
if (HDF5_EXPORTED_TARGETS)
diff --git a/tools/lib/Makefile.in b/tools/lib/Makefile.in
index 8fe4fdf..2cf2778 100644
--- a/tools/lib/Makefile.in
+++ b/tools/lib/Makefile.in
@@ -551,7 +551,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -585,6 +584,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1437,7 +1437,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c
index 8ac0d32..e7e017f 100644
--- a/tools/lib/h5tools_utils.c
+++ b/tools/lib/h5tools_utils.c
@@ -561,6 +561,8 @@ herr_t
init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
table_t **dset_table, table_t **type_table)
{
+ herr_t ret_value = SUCCEED;
+
/* Initialize the tables */
init_table(group_table);
init_table(dset_table);
@@ -573,7 +575,20 @@ init_objs(hid_t fid, find_objs_t *info, table_t **group_table,
info->dset_table = *dset_table;
/* Find all shared objects */
- return(h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC));
+ if((ret_value = h5trav_visit(fid, "/", TRUE, TRUE, find_objs_cb, NULL, info, H5O_INFO_BASIC)) < 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "finding shared objects failed")
+
+done:
+ /* Release resources */
+ if(ret_value < 0) {
+ free_table(*group_table);
+ info->group_table = NULL;
+ free_table(*type_table);
+ info->type_table = NULL;
+ free_table(*dset_table);
+ info->dset_table = NULL;
+ }
+ return ret_value;
}
diff --git a/tools/src/Makefile.in b/tools/src/Makefile.in
index 9f9d6e6..886c7cb 100644
--- a/tools/src/Makefile.in
+++ b/tools/src/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1431,7 +1431,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5copy/Makefile.in b/tools/src/h5copy/Makefile.in
index 9642ef9..23371bd 100644
--- a/tools/src/h5copy/Makefile.in
+++ b/tools/src/h5copy/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1465,7 +1465,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5diff/Makefile.in b/tools/src/h5diff/Makefile.in
index 1f3268a..0f95f7f3 100644
--- a/tools/src/h5diff/Makefile.in
+++ b/tools/src/h5diff/Makefile.in
@@ -558,7 +558,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -592,6 +591,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1468,7 +1468,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5dump/Makefile.in b/tools/src/h5dump/Makefile.in
index c15a857..30d0b02 100644
--- a/tools/src/h5dump/Makefile.in
+++ b/tools/src/h5dump/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1455,7 +1455,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/h5format_convert/CMakeLists.txt b/tools/src/h5format_convert/CMakeLists.txt
index 62f269b..79a1316 100644
--- a/tools/src/h5format_convert/CMakeLists.txt
+++ b/tools/src/h5format_convert/CMakeLists.txt
@@ -34,4 +34,4 @@ if (HDF5_EXPORTED_TARGETS)
${HDF5_EXPORTED_TARGETS}
RUNTIME DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT toolsapplications
)
-endif () \ No newline at end of file
+endif ()
diff --git a/tools/src/h5format_convert/Makefile.in b/tools/src/h5format_convert/Makefile.in
index 9f680aa..0a24ca2 100644
--- a/tools/src/h5format_convert/Makefile.in
+++ b/tools/src/h5format_convert/Makefile.in
@@ -556,7 +556,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -590,6 +589,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1491,7 +1491,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5import/Makefile.in b/tools/src/h5import/Makefile.in
index b835c45..d322f67 100644
--- a/tools/src/h5import/Makefile.in
+++ b/tools/src/h5import/Makefile.in
@@ -553,7 +553,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -587,6 +586,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1449,7 +1449,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/h5jam/Makefile.in b/tools/src/h5jam/Makefile.in
index 2e21773..f4e3529 100644
--- a/tools/src/h5jam/Makefile.in
+++ b/tools/src/h5jam/Makefile.in
@@ -560,7 +560,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -594,6 +593,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1462,7 +1462,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5ls/Makefile.in b/tools/src/h5ls/Makefile.in
index 10aa7a2..db08750 100644
--- a/tools/src/h5ls/Makefile.in
+++ b/tools/src/h5ls/Makefile.in
@@ -553,7 +553,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -587,6 +586,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1449,7 +1449,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5repack/Makefile.in b/tools/src/h5repack/Makefile.in
index 2c48e98..a1f4a02 100644
--- a/tools/src/h5repack/Makefile.in
+++ b/tools/src/h5repack/Makefile.in
@@ -563,7 +563,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -597,6 +596,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1492,7 +1492,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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_filters.c b/tools/src/h5repack/h5repack_filters.c
index 0092abc..3d9472a 100644
--- a/tools/src/h5repack/h5repack_filters.c
+++ b/tools/src/h5repack/h5repack_filters.c
@@ -338,12 +338,14 @@ int apply_filters(const char* name, /* object name from traverse list */
sm_nbytes = msize;
for (i = rank; i > 0; --i) {
- hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
+ hsize_t size = 0;
+ if(sm_nbytes == 0)
+ HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "number of bytes per stripmine must be > 0");
+ size = H5TOOLS_BUFSIZE / sm_nbytes;
if (size == 0) /* datum size > H5TOOLS_BUFSIZE */
size = 1;
sm_size[i - 1] = MIN(dims[i - 1], size);
sm_nbytes *= sm_size[i - 1];
- HDassert(sm_nbytes > 0);
}
for (i = 0; i < rank; i++) {
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/h5stat/Makefile.in b/tools/src/h5stat/Makefile.in
index 1615863..67cc674 100644
--- a/tools/src/h5stat/Makefile.in
+++ b/tools/src/h5stat/Makefile.in
@@ -555,7 +555,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -589,6 +588,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1492,7 +1492,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c
index dc1dc4a..8109b93 100644
--- a/tools/src/h5stat/h5stat.c
+++ b/tools/src/h5stat/h5stat.c
@@ -74,7 +74,7 @@ typedef struct iter_t {
ohdr_info_t group_ohdr_info; /* Object header information for groups */
hsize_t max_attrs; /* Maximum attributes from a group */
- unsigned long *num_small_attrs; /* Size of small attributes tracked */
+ unsigned long *num_small_attrs; /* Size of small attributes tracked */
unsigned attr_nbins; /* Number of bins for attribute counts */
unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
@@ -257,7 +257,7 @@ leave(int ret)
}
-
+
/*-------------------------------------------------------------------------
* Function: usage
*
@@ -297,7 +297,7 @@ static void usage(const char *prog)
HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
}
-
+
/*-------------------------------------------------------------------------
* Function: ceil_log10
*
@@ -324,7 +324,7 @@ ceil_log10(unsigned long x)
return ret;
} /* ceil_log10() */
-
+
/*-------------------------------------------------------------------------
* Function: attribute_stats
*
@@ -374,7 +374,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
return 0;
} /* end attribute_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: group_stats
*
@@ -456,7 +456,7 @@ done:
return ret_value;
} /* end group_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: dataset_stats
*
@@ -648,7 +648,7 @@ done:
return ret_value;
} /* end dataset_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: datatype_stats
*
@@ -680,7 +680,7 @@ done:
return ret_value;
} /* end datatype_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: obj_stats
*
@@ -736,7 +736,7 @@ done:
return ret_value;
} /* end obj_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: lnk_stats
*
@@ -834,7 +834,7 @@ freespace_stats(hid_t fid, iter_t *iter)
return 0;
} /* end freespace_stats() */
-
+
/*-------------------------------------------------------------------------
* Function: hand_free
*
@@ -863,7 +863,7 @@ hand_free(struct handler_t *hand)
} /* end if */
} /* end hand_free() */
-
+
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@@ -1041,7 +1041,7 @@ error:
return -1;
}
-
+
/*-------------------------------------------------------------------------
* Function: iter_free
*
@@ -1106,7 +1106,7 @@ iter_free(iter_t *iter)
} /* end if */
} /* end iter_free() */
-
+
/*-------------------------------------------------------------------------
* Function: print_file_info
*
@@ -1138,7 +1138,7 @@ print_file_info(const iter_t *iter)
return 0;
} /* print_file_info() */
-
+
/*-------------------------------------------------------------------------
* Function: print_file_metadata
*
@@ -1198,7 +1198,7 @@ print_file_metadata(const iter_t *iter)
return 0;
} /* print_file_metadata() */
-
+
/*-------------------------------------------------------------------------
* Function: print_group_info
*
@@ -1255,7 +1255,7 @@ print_group_info(const iter_t *iter)
return 0;
} /* print_group_info() */
-
+
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
@@ -1282,7 +1282,7 @@ print_group_metadata(const iter_t *iter)
return 0;
} /* print_group_metadata() */
-
+
/*-------------------------------------------------------------------------
* Function: print_dataset_info
*
@@ -1369,7 +1369,7 @@ print_dataset_info(const iter_t *iter)
return 0;
} /* print_dataset_info() */
-
+
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
@@ -1398,7 +1398,7 @@ print_dset_metadata(const iter_t *iter)
return 0;
} /* print_dset_metadata() */
-
+
/*-------------------------------------------------------------------------
* Function: print_dset_dtype_meta
*
@@ -1439,7 +1439,7 @@ print_dset_dtype_meta(const iter_t *iter)
return 0;
} /* print_dset_dtype_meta() */
-
+
/*-------------------------------------------------------------------------
* Function: print_attr_info
*
@@ -1488,7 +1488,7 @@ print_attr_info(const iter_t *iter)
return 0;
} /* print_attr_info() */
-
+
/*-------------------------------------------------------------------------
* Function: print_freespace_info
*
@@ -1538,7 +1538,7 @@ print_freespace_info(const iter_t *iter)
return 0;
} /* print_freespace_info() */
-
+
/*-------------------------------------------------------------------------
* Function: print_storage_summary
*
@@ -1602,7 +1602,7 @@ print_storage_summary(const iter_t *iter)
return 0;
} /* print_storage_summary() */
-
+
/*-------------------------------------------------------------------------
* Function: print_file_statistics
*
@@ -1649,7 +1649,7 @@ print_file_statistics(const iter_t *iter)
if(display_summary) print_storage_summary(iter);
} /* print_file_statistics() */
-
+
/*-------------------------------------------------------------------------
* Function: print_object_statistics
*
@@ -1672,7 +1672,7 @@ print_object_statistics(const char *name)
printf("Object name %s\n", name);
} /* print_object_statistics() */
-
+
/*-------------------------------------------------------------------------
* Function: print_statistics
*
@@ -1698,7 +1698,7 @@ print_statistics(const char *name, const iter_t *iter)
print_file_statistics(iter);
} /* print_statistics() */
-
+
/*-------------------------------------------------------------------------
* Function: main
*
@@ -1780,15 +1780,15 @@ main(int argc, const char *argv[])
iter.free_hdr = finfo.free.meta_size;
} /* end else */
- iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
- iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
- iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
+ iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
+ iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
+ iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
- if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
- error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
- h5tools_setstatus(EXIT_FAILURE);
- goto done;
- }
+ if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
+ error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
if((fcpl = H5Fget_create_plist(fid)) < 0)
warn_msg("Unable to retrieve file creation property\n");
diff --git a/tools/src/misc/Makefile.in b/tools/src/misc/Makefile.in
index deeb691..2aafd74 100644
--- a/tools/src/misc/Makefile.in
+++ b/tools/src/misc/Makefile.in
@@ -578,7 +578,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -612,6 +611,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1556,7 +1556,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/src/misc/h5repart.c b/tools/src/misc/h5repart.c
index cdc554f..2f4d93e 100644
--- a/tools/src/misc/h5repart.c
+++ b/tools/src/misc/h5repart.c
@@ -29,11 +29,12 @@
#define NAMELEN 4096
#define GB *1024*1024*1024
-/*Make these 2 private properties(defined in H5Fprivate.h) available to h5repart.
- *The first one updates the member file size in the superblock. The second one
- *change file driver from family to sec2. */
+/* Make these 2 private properties(defined in H5Fprivate.h) available to h5repart.
+ * The first one updates the member file size in the superblock. The second one
+ * change file driver from family to a single file driver.
+ */
#define H5F_ACS_FAMILY_NEWSIZE_NAME "family_newsize"
-#define H5F_ACS_FAMILY_TO_SEC2_NAME "family_to_sec2"
+#define H5F_ACS_FAMILY_TO_SINGLE_NAME "family_to_single"
/*-------------------------------------------------------------------------
@@ -53,13 +54,14 @@
static void
usage (const char *progname)
{
- fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2] SRC DST\n",
+ fprintf(stderr, "usage: %s [-v] [-V] [-[b|m] N[g|m|k]] [-family_to_sec2|-family_to_single] SRC DST\n",
progname);
fprintf(stderr, " -v Produce verbose output\n");
fprintf(stderr, " -V Print a version number and exit\n");
fprintf(stderr, " -b N The I/O block size, defaults to 1kB\n");
fprintf(stderr, " -m N The destination member size or 1GB\n");
- fprintf(stderr, " -family_to_sec2 Change file driver from family to sec2\n");
+ fprintf(stderr, " -family_to_sec2 Deprecated version of -family_to_single (below)\n");
+ fprintf(stderr, " -family_to_single Change file driver from family to the default single-file VFD (windows or sec2)\n");
fprintf(stderr, " SRC The name of the source file\n");
fprintf(stderr, " DST The name of the destination files\n");
fprintf(stderr, "Sizes may be suffixed with `g' for GB, `m' for MB or "
@@ -186,7 +188,7 @@ main (int argc, char *argv[])
hid_t fapl; /*file access property list */
hid_t file;
hsize_t hdsize; /*destination logical memb size */
- hbool_t family_to_sec2=FALSE; /*change family to sec2 driver? */
+ hbool_t family_to_single = FALSE; /*change family to single file driver? */
/*
* Get the program name from argv[0]. Use only the last component.
@@ -206,7 +208,10 @@ main (int argc, char *argv[])
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;
+ family_to_single = TRUE;
+ argno++;
+ } else if (!strcmp (argv[argno], "-family_to_single")) {
+ family_to_single = TRUE;
argno++;
} else if ('b'==argv[argno][1]) {
blk_size = (size_t)get_size (prog_name, &argno, argc, argv);
@@ -422,11 +427,12 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
- if(family_to_sec2) {
- /* The user wants to change file driver from family to sec2. Open the file
- * with sec2 driver. This property signals the library to ignore the family
- * driver information saved in the superblock. */
- if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SEC2_NAME, &family_to_sec2) < 0) {
+ if(family_to_single) {
+ /* The user wants to change file driver from family to a single-file VFD.
+ * Open the file with the sec2, windows, etc. driver. This property signals
+ * the library to ignore the family driver information saved in the superblock.
+ */
+ if(H5Pset(fapl, H5F_ACS_FAMILY_TO_SINGLE_NAME, &family_to_single) < 0) {
perror ("H5Pset");
exit (EXIT_FAILURE);
}
@@ -449,13 +455,14 @@ main (int argc, char *argv[])
/* If the new file is a family file, try to open file for "read and write" to
* flush metadata. Flushing metadata will update the superblock to the new
- * member size. If the original file is a family file and the new file is a sec2
- * file, the property FAMILY_TO_SEC2 will signal the library to switch to sec2
- * driver when the new file is opened. If the original file is a sec2 file and the
- * new file can only be a sec2 file, reopen the new file should fail. There's
- * nothing to do in this case. */
+ * member size. If the original file is a family file and the new file is a single
+ * file, the property FAMILY_TO_SINGLE will signal the library to switch to default
+ * single-file driver when the new file is opened. If the original file is a single
+ * file and the new file can only be a single file, reopen the new file should fail.
+ * There's nothing to do in this case.
+ */
H5E_BEGIN_TRY {
- file=H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl);
+ file = H5Fopen(dst_gen_name, H5F_ACC_RDWR, fapl);
} H5E_END_TRY;
if(file>=0) {
diff --git a/tools/test/Makefile.in b/tools/test/Makefile.in
index dd1d26b..13a8784 100644
--- a/tools/test/Makefile.in
+++ b/tools/test/Makefile.in
@@ -554,7 +554,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -588,6 +587,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1431,7 +1431,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5copy/CMakeTests.cmake b/tools/test/h5copy/CMakeTests.cmake
index 924ade1..f31068b 100644
--- a/tools/test/h5copy/CMakeTests.cmake
+++ b/tools/test/h5copy/CMakeTests.cmake
@@ -30,6 +30,7 @@
set (LIST_OTHER_TEST_FILES
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.out
+ ${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_misc1.err
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5.txt
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/tudfilter.h5_ERR.txt
${HDF5_TOOLS_TEST_H5COPY_SOURCE_DIR}/testfiles/h5copy_plugin_fail_ERR.out.h5.txt
@@ -250,6 +251,7 @@
-D "TEST_OUTPUT=./testfiles/${testname}.out.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=./testfiles/${testname}.out"
+ -D "TEST_ERRREF=./testfiles/${testname}.err"
-D "TEST_MASK=true"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
diff --git a/tools/test/h5copy/Makefile.in b/tools/test/h5copy/Makefile.in
index 9fd36ed..5f35228 100644
--- a/tools/test/h5copy/Makefile.in
+++ b/tools/test/h5copy/Makefile.in
@@ -551,7 +551,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -585,6 +584,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1423,7 +1423,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.err b/tools/test/h5copy/testfiles/h5copy_misc1.err
new file mode 100644
index 0000000..2c2c867
--- /dev/null
+++ b/tools/test/h5copy/testfiles/h5copy_misc1.err
@@ -0,0 +1 @@
+h5copy error: group </g1> doesn't exist. Use -p to create parent groups.
diff --git a/tools/test/h5copy/testfiles/h5copy_misc1.out b/tools/test/h5copy/testfiles/h5copy_misc1.out
index 1624f2b..1c7181b 100644
--- a/tools/test/h5copy/testfiles/h5copy_misc1.out
+++ b/tools/test/h5copy/testfiles/h5copy_misc1.out
@@ -1,3 +1,2 @@
Copying file <./testfiles/h5copytst.h5> and object </simple> to file <./testfiles/h5copy_misc1.out.h5> and object </g1/g2/simple>
Error in copy...Exiting
-h5copy error: group </g1> doesn't exist. Use -p to create parent groups.
diff --git a/tools/test/h5copy/testh5copy.sh.in b/tools/test/h5copy/testh5copy.sh.in
index 203bfef..50758b5 100644
--- a/tools/test/h5copy/testh5copy.sh.in
+++ b/tools/test/h5copy/testh5copy.sh.in
@@ -60,6 +60,7 @@ $SRC_H5COPY_TESTFILES/h5copy_extlinks_trg.h5
# List of expect files that will be copied over to local test dir
LIST_OTHER_TEST_FILES="
$SRC_H5COPY_TESTFILES/h5copy_misc1.out
+$SRC_H5COPY_TESTFILES/h5copy_misc1.err
"
H5COPY=../../src/h5copy/h5copy # The tool name
@@ -396,6 +397,7 @@ CMP_OUTPUT()
TOOLTEST_FAIL()
{
expectout="$TESTDIR/$1"
+ expecterr="$TESTDIR/`basename $1 .out`.err"
actualout="$TESTDIR/$1.actualout"
actualerr="$TESTDIR/$1.actualerr"
actualout_sav=${actualout}-sav
@@ -426,10 +428,7 @@ TOOLTEST_FAIL()
echo " PASSED"
# Verifying output text from h5copy
if [ "$expectout" != "SKIP" ]; then
- # combine stderr to stdout to compare the output at once.
- # We may seperate stdout and stderr later.
- cat $actualerr >> $actualout
- CMP_OUTPUT $expectout $actualout
+ CMP_OUTPUT $expecterr $actualerr
fi
else
echo "*FAILED*"
diff --git a/tools/test/h5diff/CMakeTests.cmake b/tools/test/h5diff/CMakeTests.cmake
index e06f069..1376e0d 100644
--- a/tools/test/h5diff/CMakeTests.cmake
+++ b/tools/test/h5diff/CMakeTests.cmake
@@ -168,21 +168,12 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_452.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_453.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_454_ERR.err
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/dangling_link.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_455_ERR.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_456.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_457_ERR.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_458_ERR.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_459_ERR.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_465.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_466.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_467.txt
@@ -238,7 +229,6 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_63.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_600.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601.txt
- ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_601_ERR.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_603.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_604.txt
@@ -293,6 +283,7 @@
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8625.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_8639.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_ud.txt
+ ${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.err
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_udfail.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v1.txt
${HDF5_TOOLS_TEST_H5DIFF_SOURCE_DIR}/testfiles/h5diff_v2.txt
@@ -400,72 +391,31 @@
endif ()
endmacro ()
- macro (ADD_H5_ERR_TEST resultfile resultcode)
- # If using memchecker add tests without using scripts
- if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME H5DIFF_ERR-${resultfile} COMMAND $<TARGET_FILE:h5diff> --enable-error-stack ${ARGN})
- set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
- if (NOT "${resultcode}" STREQUAL "0")
- set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES WILL_FAIL "true")
- endif ()
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS ${last_test})
- endif ()
- else ()
- # Remove any output file left over from previous test run
- add_test (
- NAME H5DIFF_ERR-${resultfile}-clear-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- testfiles/${resultfile}_ERR.out
- testfiles/${resultfile}_ERR.out.err
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (H5DIFF_ERR-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- add_test (
- NAME H5DIFF_ERR-${resultfile}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff>"
- -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${resultfile}_ERR.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}_ERR.txt"
- -D "TEST_MASK_ERROR=true"
- -D "TEST_APPEND=EXIT CODE:"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- set_tests_properties (H5DIFF_ERR-${resultfile} PROPERTIES DEPENDS H5DIFF_ERR-${resultfile}-clear-objects)
- endif ()
- set (last_test "H5DIFF_ERR-${resultfile}")
- endmacro ()
-
macro (ADD_PH5_TEST resultfile resultcode)
# If using memchecker add tests without using scripts
if (HDF5_ENABLE_USING_MEMCHECKER)
- add_test (NAME PH5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN})
- set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles")
+ add_test (NAME MPI_TEST_H5DIFF-${resultfile} COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:ph5diff> ${MPIEXEC_POSTFLAGS} ${ARGN})
+ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/PAR/testfiles")
if (NOT "${resultcode}" STREQUAL "0")
- set_tests_properties (PH5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
+ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES WILL_FAIL "true")
endif ()
if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS ${last_test})
endif ()
else ()
# Remove any output file left over from previous test run
add_test (
- NAME PH5DIFF-${resultfile}-clear-objects
+ NAME MPI_TEST_H5DIFF-${resultfile}-clear-objects
COMMAND ${CMAKE_COMMAND}
-E remove
PAR/testfiles/${resultfile}.out
PAR/testfiles/${resultfile}.out.err
)
if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (PH5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test})
+ set_tests_properties (MPI_TEST_H5DIFF-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test})
endif ()
add_test (
- NAME PH5DIFF-${resultfile}
+ NAME MPI_TEST_H5DIFF-${resultfile}
COMMAND "${CMAKE_COMMAND}"
-D "TEST_PROGRAM=${MPIEXEC_EXECUTABLE};${MPIEXEC_NUMPROC_FLAG};${MPIEXEC_MAX_NUMPROCS};${MPIEXEC_PREFLAGS};$<TARGET_FILE:ph5diff>;${MPIEXEC_POSTFLAGS}"
-D "TEST_ARGS:STRING=${ARGN}"
@@ -479,7 +429,7 @@
-D "TEST_SORT_COMPARE=TRUE"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
- set_tests_properties (PH5DIFF-${resultfile} PROPERTIES DEPENDS PH5DIFF-${resultfile}-clear-objects)
+ set_tests_properties (MPI_TEST_H5DIFF-${resultfile} PROPERTIES DEPENDS MPI_TEST_H5DIFF-${resultfile}-clear-objects)
set (last_test "PH5DIFF-${resultfile}")
endif ()
endmacro ()
@@ -529,53 +479,6 @@
endif ()
endmacro ()
- macro (ADD_H5_UD_ERR_TEST testname resultcode resultfile)
- if (NOT HDF5_ENABLE_USING_MEMCHECKER)
- # Remove any output file left over from previous test run
- add_test (
- NAME H5DIFF_UD_ERR-${testname}-clearall-objects
- COMMAND ${CMAKE_COMMAND}
- -E remove
- testfiles/${resultfile}_ERR.out
- testfiles/${resultfile}_ERR.out.err
- )
- if ("${resultcode}" STREQUAL "2")
- add_test (
- NAME H5DIFF_UD_ERR-${testname}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
- -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${resultfile}_ERR.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}_ERR.txt"
- -D "TEST_MASK_ERROR=true"
- -D "TEST_APPEND=EXIT CODE:"
- -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
- -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- else ()
- add_test (
- NAME H5DIFF_UD_ERR-${testname}
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5diff-shared>"
- -D "TEST_ARGS:STRING=--enable-error-stack;${ARGN}"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
- -D "TEST_OUTPUT=${resultfile}_ERR.out"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_REFERENCE=${resultfile}_ERR.txt"
- -D "TEST_MASK_ERROR=true"
- -D "TEST_APPEND=EXIT CODE:"
- -D "TEST_ENV_VAR=HDF5_PLUGIN_PATH"
- -D "TEST_ENV_VALUE=${CMAKE_BINARY_DIR}/plugins"
- -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
- )
- endif ()
- set_tests_properties (H5DIFF_UD_ERR-${testname} PROPERTIES DEPENDS H5DIFF_UD_ERR-${testname}-clearall-objects)
- endif ()
- endmacro ()
-
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -798,26 +701,16 @@
h5diff_453.out.err
h5diff_454.out
h5diff_454.out.err
- h5diff_454_ERR.out
- h5diff_454_ERR.out.err
h5diff_455.out
h5diff_455.out.err
- h5diff_455_ERR.out
- h5diff_455_ERR.out.err
h5diff_456.out
h5diff_456.out.err
h5diff_457.out
h5diff_457.out.err
- h5diff_457_ERR.out
- h5diff_457_ERR.out.err
h5diff_458.out
h5diff_458.out.err
- h5diff_458_ERR.out
- h5diff_458_ERR.out.err
h5diff_459.out
h5diff_459.out.err
- h5diff_459_ERR.out
- h5diff_459_ERR.out.err
h5diff_465.out
h5diff_465.out.err
h5diff_466.out
@@ -922,8 +815,6 @@
h5diff_600.out.err
h5diff_601.out
h5diff_601.out.err
- h5diff_601_ERR.out
- h5diff_601_ERR.out.err
h5diff_603.out
h5diff_603.out.err
h5diff_604.out
@@ -1181,7 +1072,6 @@ ADD_H5_TEST (h5diff_600 1 ${FILE1})
# 6.1: Check if non-exist object name is specified
ADD_H5_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj)
-ADD_H5_ERR_TEST (h5diff_601 2 ${FILE1} ${FILE1} nono_obj)
# ##############################################################################
# # -d
@@ -1481,26 +1371,21 @@ ADD_H5_TEST (h5diff_453 2 --follow-symlinks -v --no-dangling-links ${FILE13} $
# dangling link found for soft links (obj to obj)
ADD_H5_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
-ADD_H5_ERR_TEST (h5diff_454 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_dset2 /softlink_noexist)
# dangling link found for soft links (obj to obj) Both dangle links
ADD_H5_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist)
-ADD_H5_ERR_TEST (h5diff_455 2 --follow-symlinks -v --no-dangling-links ${FILE13} ${FILE13} /softlink_noexist /softlink_noexist)
# dangling link found for ext links (FILE to FILE)
ADD_H5_TEST (h5diff_456 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15})
# dangling link found for ext links (obj to obj). target file exist
ADD_H5_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1)
-ADD_H5_ERR_TEST (h5diff_457 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist1)
# dangling link found for ext links (obj to obj). target file NOT exist
ADD_H5_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2)
-ADD_H5_ERR_TEST (h5diff_458 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_dset1 /ext_link_noexist2)
# dangling link found for ext links (obj to obj). Both dangle links
ADD_H5_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2)
-ADD_H5_ERR_TEST (h5diff_459 2 --follow-symlinks -v --no-dangling-links ${FILE15} ${FILE15} /ext_link_noexist1 /ext_link_noexist2)
# dangling link --follow-symlinks (obj vs obj)
# (HDFFV-7836)
diff --git a/tools/test/h5diff/Makefile.in b/tools/test/h5diff/Makefile.in
index ddb6842..2e46a50 100644
--- a/tools/test/h5diff/Makefile.in
+++ b/tools/test/h5diff/Makefile.in
@@ -566,7 +566,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -600,6 +599,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1473,7 +1473,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5diff/h5diff_plugin.sh.in b/tools/test/h5diff/h5diff_plugin.sh.in
index 212f5d6..341cba5 100644
--- a/tools/test/h5diff/h5diff_plugin.sh.in
+++ b/tools/test/h5diff/h5diff_plugin.sh.in
@@ -62,6 +62,7 @@ LIST_HDF5_TEST_FILES="
$SRC_H5DIFF_TESTFILES/tudfilter.h5
$SRC_H5DIFF_TESTFILES/tudfilter2.h5
$SRC_H5DIFF_TESTFILES/h5diff_ud.txt
+$SRC_H5DIFF_TESTFILES/h5diff_udfail.err
$SRC_H5DIFF_TESTFILES/h5diff_udfail.txt
"
@@ -204,7 +205,7 @@ VERIFY() {
TOOLTEST() {
expect="$TESTDIR/$1"
actual="$TESTDIR/`basename $1 .txt`.out"
- actual_err="$TESTDIR/`basename $1 .txt`.err"
+ actual_err="$TESTDIR/`basename $1 .txt`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
shift
@@ -287,6 +288,90 @@ TOOLTEST() {
rm -f $actual_sorted $expect_sorted
fi
}
+# Same as TOOLSET except only err file checked
+TOOLTEST_ERR() {
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .txt`.err"
+ actual="$TESTDIR/`basename $1 .txt`.out"
+ actual_err="$TESTDIR/`basename $1 .txt`.out.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+ shift
+ if test -n "$pmode"; then
+ RUNCMD=$RUNPARALLEL
+ else
+ RUNCMD=$RUNSERIAL
+ fi
+
+ # Run test.
+ TESTING $H5DIFF $@
+ (
+ #echo "#############################"
+ #echo "Expected output for '$H5DIFF $@'"
+ #echo "#############################"
+ cd $TESTDIR
+ eval $ENVCMD $RUNCMD $H5DIFF_BIN "$@"
+ ) >$actual 2>$actual_err
+ EXIT_CODE=$?
+ # save actual and actual_err in case they are needed later.
+ cp $actual $actual_sav
+ STDOUT_FILTER $actual
+ cp $actual_err $actual_err_sav
+ STDERR_FILTER $actual_err
+ # don't add exit code check in pmode, as it causes failure. (exit code
+ # is from mpirun not tool)
+ # if any problem occurs relate to an exit code, it will be caught in
+ # serial mode, so the test is fullfilled.
+ if test $h5haveexitcode = 'yes' -a -z "$pmode"; then
+ echo "EXIT CODE: $EXIT_CODE" >> $actual
+ fi
+
+ if [ ! -f $expect ]; then
+ # Create the expect file if it doesn't yet exist.
+ echo " CREATED"
+ cp $actual $expect
+ echo " Expected result (*.ddl) missing"
+ nerrors="`expr $nerrors + 1`"
+ elif $CMP $expect_err $actual_err; then
+ echo " PASSED"
+ elif test $h5haveexitcode = 'yes' -a -z "$pmode"; then
+ echo "*FAILED*"
+ echo " Expected result ($expect_err) differs from actual result ($actual_err)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
+ else
+ # parallel mode output are often of different ordering from serial
+ # output. If the sorted expect_err and actual_err files compare the same,
+ # it is safe to assume the actual output match the expected file.
+ expect_sorted=expect_sorted
+ actual_sorted=actual_sorted
+ sort $expect_err -o $expect_sorted
+ sort $actual_err -o $actual_sorted
+ mv $expect_sorted.noexit $expect_sorted
+ if $CMP $expect_sorted $actual_sorted; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ nerrors="`expr $nerrors + 1`"
+ if test yes = "$verbose"; then
+ echo "====Expected result ($expect_sorted) differs from actual result ($actual_sorted)"
+ $DIFF $expect_sorted $actual_sorted |sed 's/^/ /'
+ echo "====The actual output ($actual_sav)"
+ sed 's/^/ /' < $actual_sav
+ echo "====The actual stderr ($actual_err_sav)"
+ sed 's/^/ /' < $actual_err_sav
+ echo "====End of actual stderr ($actual_err_sav)"
+ echo ""
+ fi
+ fi
+ fi
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ rm -f $actual $actual_err $actual_sav $actual_err_sav
+ rm -f $actual_sorted $expect_sorted
+ fi
+}
##############################################################################
### T H E T E S T S
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index 7321c66..ac3bbee 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -11,8 +11,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-#include <stdio.h>
-#include <stdlib.h>
#include "hdf5.h"
#include "H5private.h"
diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.err b/tools/test/h5diff/testfiles/dangling_link.err
index 82802a1..82802a1 100644
--- a/tools/test/h5diff/testfiles/h5diff_459_ERR.err
+++ b/tools/test/h5diff/testfiles/dangling_link.err
diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.err b/tools/test/h5diff/testfiles/h5diff_454_ERR.err
deleted file mode 100644
index 82802a1..0000000
--- a/tools/test/h5diff/testfiles/h5diff_454_ERR.err
+++ /dev/null
@@ -1,4 +0,0 @@
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt b/tools/test/h5diff/testfiles/h5diff_454_ERR.txt
deleted file mode 100644
index 4501071..0000000
--- a/tools/test/h5diff/testfiles/h5diff_454_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Warning: </softlink_noexist> is a dangling link.
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.err b/tools/test/h5diff/testfiles/h5diff_455_ERR.err
deleted file mode 100644
index 82802a1..0000000
--- a/tools/test/h5diff/testfiles/h5diff_455_ERR.err
+++ /dev/null
@@ -1,4 +0,0 @@
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt b/tools/test/h5diff/testfiles/h5diff_455_ERR.txt
deleted file mode 100644
index 4501071..0000000
--- a/tools/test/h5diff/testfiles/h5diff_455_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Warning: </softlink_noexist> is a dangling link.
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.err b/tools/test/h5diff/testfiles/h5diff_457_ERR.err
deleted file mode 100644
index 82802a1..0000000
--- a/tools/test/h5diff/testfiles/h5diff_457_ERR.err
+++ /dev/null
@@ -1,4 +0,0 @@
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt b/tools/test/h5diff/testfiles/h5diff_457_ERR.txt
deleted file mode 100644
index 9d73750..0000000
--- a/tools/test/h5diff/testfiles/h5diff_457_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Warning: </ext_link_noexist1> is a dangling link.
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.err b/tools/test/h5diff/testfiles/h5diff_458_ERR.err
deleted file mode 100644
index 82802a1..0000000
--- a/tools/test/h5diff/testfiles/h5diff_458_ERR.err
+++ /dev/null
@@ -1,4 +0,0 @@
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
diff --git a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt b/tools/test/h5diff/testfiles/h5diff_458_ERR.txt
deleted file mode 100644
index b084914..0000000
--- a/tools/test/h5diff/testfiles/h5diff_458_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Warning: </ext_link_noexist2> is a dangling link.
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt b/tools/test/h5diff/testfiles/h5diff_459_ERR.txt
deleted file mode 100644
index 9d73750..0000000
--- a/tools/test/h5diff/testfiles/h5diff_459_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Warning: </ext_link_noexist1> is a dangling link.
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): treat dangling link as error
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_600.txt b/tools/test/h5diff/testfiles/h5diff_600.txt
index f3b346a..13d627c 100644
--- a/tools/test/h5diff/testfiles/h5diff_600.txt
+++ b/tools/test/h5diff/testfiles/h5diff_600.txt
@@ -142,5 +142,4 @@ usage: h5diff [OPTIONS] file1 file2 [obj1[ obj2]]
Use h5diff file1 file1 /g1/dset1 /g1/dset2 to compare
'/g1/dset1' and '/g1/dset2' in the same file
-h5diff error: missing file names
EXIT CODE: 1
diff --git a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt b/tools/test/h5diff/testfiles/h5diff_601_ERR.txt
deleted file mode 100644
index b58124a..0000000
--- a/tools/test/h5diff/testfiles/h5diff_601_ERR.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Object </nono_obj> could not be found in <h5diff_basic1.h5>
-H5tools-DIAG: Error detected in HDF5:tools (version (number)) thread (IDs):
- #000: (file name) line (number) in h5diff(): Error: Object could not be found
- major: Failure in tools library
- minor: error in function
-EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.err b/tools/test/h5diff/testfiles/h5diff_udfail.err
new file mode 100644
index 0000000..d51de38
--- /dev/null
+++ b/tools/test/h5diff/testfiles/h5diff_udfail.err
@@ -0,0 +1,12 @@
+
+file1 file2
+---------------------------------------
+ x x /
+ x x /dynlibud
+
+group : </> and </>
+0 differences found
+dataset: </dynlibud> and </dynlibud>
+0 differences found
+Warning: dataset </dynlibud> cannot be read, user defined filter is not available
+EXIT CODE: 2
diff --git a/tools/test/h5diff/testfiles/h5diff_udfail.txt b/tools/test/h5diff/testfiles/h5diff_udfail.txt
index d51de38..e6000fc 100644
--- a/tools/test/h5diff/testfiles/h5diff_udfail.txt
+++ b/tools/test/h5diff/testfiles/h5diff_udfail.txt
@@ -8,5 +8,4 @@ group : </> and </>
0 differences found
dataset: </dynlibud> and </dynlibud>
0 differences found
-Warning: dataset </dynlibud> cannot be read, user defined filter is not available
EXIT CODE: 2
diff --git a/tools/test/h5diff/testh5diff.sh.in b/tools/test/h5diff/testh5diff.sh.in
index c464f94..557d2ff 100644
--- a/tools/test/h5diff/testh5diff.sh.in
+++ b/tools/test/h5diff/testh5diff.sh.in
@@ -226,6 +226,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_451.txt
$SRC_H5DIFF_TESTFILES/h5diff_452.txt
$SRC_H5DIFF_TESTFILES/h5diff_453.txt
$SRC_H5DIFF_TESTFILES/h5diff_454.txt
+$SRC_H5DIFF_TESTFILES/dangling_link.err
$SRC_H5DIFF_TESTFILES/h5diff_455.txt
$SRC_H5DIFF_TESTFILES/h5diff_456.txt
$SRC_H5DIFF_TESTFILES/h5diff_457.txt
@@ -286,6 +287,7 @@ $SRC_H5DIFF_TESTFILES/h5diff_62.txt
$SRC_H5DIFF_TESTFILES/h5diff_63.txt
$SRC_H5DIFF_TESTFILES/h5diff_600.txt
$SRC_H5DIFF_TESTFILES/h5diff_601.txt
+$SRC_H5DIFF_TESTFILES/h5diff_601_ERR.err
$SRC_H5DIFF_TESTFILES/h5diff_603.txt
$SRC_H5DIFF_TESTFILES/h5diff_604.txt
$SRC_H5DIFF_TESTFILES/h5diff_605.txt
@@ -462,8 +464,9 @@ TESTING() {
#
TOOLTEST() {
expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .txt`.err"
actual="$TESTDIR/`basename $1 .txt`.out"
- actual_err="$TESTDIR/`basename $1 .txt`.err"
+ actual_err="$TESTDIR/`basename $1 .txt`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
shift
@@ -488,7 +491,6 @@ TOOLTEST() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- cat $actual_err >> $actual
# don't add exit code check in pmode, as it causes failure. (exit code
# is from mpirun not tool)
# if any problem occurs relate to an exit code, it will be caught in
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 f74ee50..126d972 100644
--- a/tools/test/h5dump/CMakeTests.cmake
+++ b/tools/test/h5dump/CMakeTests.cmake
@@ -748,10 +748,10 @@
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5DUMP-IMPORT-${resultfile} PROPERTIES DEPENDS "H5DUMP-IMPORT-${resultfile}-clear-objects")
- add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND h5import ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5)
+ add_test (NAME H5DUMP-IMPORT-h5import-${resultfile} COMMAND $<TARGET_FILE:h5import> ${resultfile}.bin -c ${conffile}.out -o ${resultfile}.h5)
set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
set_tests_properties (H5DUMP-IMPORT-h5import-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-${resultfile})
- add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND h5diff ${testfile} ${resultfile}.h5 /integer /integer)
+ add_test (NAME H5DUMP-IMPORT-h5diff-${resultfile} COMMAND $<TARGET_FILE:h5diff> ${testfile} ${resultfile}.h5 /integer /integer)
set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/std")
set_tests_properties (H5DUMP-IMPORT-h5diff-${resultfile} PROPERTIES DEPENDS H5DUMP-IMPORT-h5import-${resultfile})
endif ()
@@ -1544,4 +1544,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/h5dump/Makefile.in b/tools/test/h5dump/Makefile.in
index fd4d7b0..8cf3c69 100644
--- a/tools/test/h5dump/Makefile.in
+++ b/tools/test/h5dump/Makefile.in
@@ -572,7 +572,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -606,6 +605,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1478,7 +1478,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5dump/errfiles/tall-1.err b/tools/test/h5dump/errfiles/tall-1.err
index 9733453..f4c2d91 100644
--- a/tools/test/h5dump/errfiles/tall-1.err
+++ b/tools/test/h5dump/errfiles/tall-1.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2A.err b/tools/test/h5dump/errfiles/tall-2A.err
index 9733453..f4c2d91 100644
--- a/tools/test/h5dump/errfiles/tall-2A.err
+++ b/tools/test/h5dump/errfiles/tall-2A.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2A0.err b/tools/test/h5dump/errfiles/tall-2A0.err
index 9733453..f4c2d91 100644
--- a/tools/test/h5dump/errfiles/tall-2A0.err
+++ b/tools/test/h5dump/errfiles/tall-2A0.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tall-2B.err b/tools/test/h5dump/errfiles/tall-2B.err
index 9733453..f4c2d91 100644
--- a/tools/test/h5dump/errfiles/tall-2B.err
+++ b/tools/test/h5dump/errfiles/tall-2B.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'somefile'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'somefile', temp_file_name = 'somefile'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tdset-2.err b/tools/test/h5dump/errfiles/tdset-2.err
index d00a92b..e61966f 100644
--- a/tools/test/h5dump/errfiles/tdset-2.err
+++ b/tools/test/h5dump/errfiles/tdset-2.err
@@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Lget_info(): unable to get link info
major: Links
minor: Can't get value
- #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'dset3'
- major: Links
- minor: Can't get value
- #002: (file name) line (number) in H5L_get_info(): name doesn't exist
+ #001: (file name) line (number) in H5L_get_info(): name doesn't exist
major: Links
minor: Object already exists
- #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
- #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist
+ #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist
major: Links
minor: Object not found
h5dump error: unable to get link info from "dset3"
diff --git a/tools/test/h5dump/errfiles/textlink.err b/tools/test/h5dump/errfiles/textlink.err
index 99e8530..4a5f545 100644
--- a/tools/test/h5dump/errfiles/textlink.err
+++ b/tools/test/h5dump/errfiles/textlink.err
@@ -2,61 +2,55 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'filename'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'filename', temp_file_name = 'filename'
major: File accessibilty
minor: Unable to open file
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'anotherfile'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'anotherfile', temp_file_name = 'anotherfile'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/textlinkfar.err b/tools/test/h5dump/errfiles/textlinkfar.err
index a888ba9..1f9241a 100644
--- a/tools/test/h5dump/errfiles/textlinkfar.err
+++ b/tools/test/h5dump/errfiles/textlinkfar.err
@@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open object
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open object
major: Links
minor: Can't open object
- #009: (file name) line (number) in H5O_open_name(): object not found
+ #008: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #010: (file name) line (number) in H5G_loc_find(): can't find object
+ #009: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #011: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #010: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
+ #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
major: Links
minor: Link traversal failure
- #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link
+ #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link
major: Symbol table
minor: Object not found
- #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed
+ #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
- #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found
+ #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
diff --git a/tools/test/h5dump/errfiles/textlinksrc.err b/tools/test/h5dump/errfiles/textlinksrc.err
index a888ba9..1f9241a 100644
--- a/tools/test/h5dump/errfiles/textlinksrc.err
+++ b/tools/test/h5dump/errfiles/textlinksrc.err
@@ -2,52 +2,49 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open object
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open object
major: Links
minor: Can't open object
- #009: (file name) line (number) in H5O_open_name(): object not found
+ #008: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #010: (file name) line (number) in H5G_loc_find(): can't find object
+ #009: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #011: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #010: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #012: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #011: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #013: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
+ #012: (file name) line (number) in H5G__traverse_special(): symbolic link traversal failed
major: Links
minor: Link traversal failure
- #014: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link
+ #013: (file name) line (number) in H5G__traverse_slink(): unable to follow symbolic link
major: Symbol table
minor: Object not found
- #015: (file name) line (number) in H5G__traverse_real(): traversal operator failed
+ #014: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
- #016: (file name) line (number) in H5G__traverse_slink_cb(): component not found
+ #015: (file name) line (number) in H5G__traverse_slink_cb(): component not found
major: Symbol table
minor: Object not found
HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
diff --git a/tools/test/h5dump/errfiles/torderlinks1.err b/tools/test/h5dump/errfiles/torderlinks1.err
index 22b4318..648906b 100644
--- a/tools/test/h5dump/errfiles/torderlinks1.err
+++ b/tools/test/h5dump/errfiles/torderlinks1.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/torderlinks2.err b/tools/test/h5dump/errfiles/torderlinks2.err
index 22b4318..648906b 100644
--- a/tools/test/h5dump/errfiles/torderlinks2.err
+++ b/tools/test/h5dump/errfiles/torderlinks2.err
@@ -2,30 +2,27 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Oopen(): unable to open object
major: Object header
minor: Can't open object
- #001: (file name) line (number) in H5O__open_name(): unable to open object
- major: Object header
- minor: Can't open object
- #002: (file name) line (number) in H5O_open_name(): object not found
+ #001: (file name) line (number) in H5O_open_name(): object not found
major: Object header
minor: Object not found
- #003: (file name) line (number) in H5G_loc_find(): can't find object
+ #002: (file name) line (number) in H5G_loc_find(): can't find object
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #005: (file name) line (number) in H5G__traverse_real(): special link traversal failed
+ #004: (file name) line (number) in H5G__traverse_real(): special link traversal failed
major: Links
minor: Link traversal failure
- #006: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
+ #005: (file name) line (number) in H5G__traverse_special(): user-defined link traversal failed
major: Links
minor: Link traversal failure
- #007: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
+ #006: (file name) line (number) in H5G__traverse_ud(): traversal callback returned invalid ID
major: Symbol table
minor: Unable to find atom information (already closed?)
- #008: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname'
+ #007: (file name) line (number) in H5L__extern_traverse(): unable to open external file, external link file name = 'fname'
major: Links
minor: Unable to open file
- #009: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname'
+ #008: (file name) line (number) in H5F_prefix_open_file(): unable to open file, file name = 'fname', temp_file_name = 'fname'
major: File accessibilty
minor: Unable to open file
diff --git a/tools/test/h5dump/errfiles/tperror.err b/tools/test/h5dump/errfiles/tperror.err
index 55aeb4a..733b652 100644
--- a/tools/test/h5dump/errfiles/tperror.err
+++ b/tools/test/h5dump/errfiles/tperror.err
@@ -21,19 +21,16 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs):
#000: (file name) line (number) in H5Lget_info(): unable to get link info
major: Links
minor: Can't get value
- #001: (file name) line (number) in H5L__get_info(): unable to get link info for: 'bogus'
- major: Links
- minor: Can't get value
- #002: (file name) line (number) in H5L_get_info(): name doesn't exist
+ #001: (file name) line (number) in H5L_get_info(): name doesn't exist
major: Links
minor: Object already exists
- #003: (file name) line (number) in H5G_traverse(): internal path traversal failed
+ #002: (file name) line (number) in H5G_traverse(): internal path traversal failed
major: Symbol table
minor: Object not found
- #004: (file name) line (number) in H5G__traverse_real(): traversal operator failed
+ #003: (file name) line (number) in H5G__traverse_real(): traversal operator failed
major: Symbol table
minor: Callback failed
- #005: (file name) line (number) in H5L__get_info_cb(): name doesn't exist
+ #004: (file name) line (number) in H5L__get_info_cb(): name doesn't exist
major: Links
minor: Object not found
h5dump error: unable to get link info from "bogus"
diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c
index aaf5c3e..fe43ecd 100644
--- a/tools/test/h5dump/h5dumpgentest.c
+++ b/tools/test/h5dump/h5dumpgentest.c
@@ -9528,15 +9528,13 @@ gent_intattrscalars(void)
}
/*-------------------------------------------------------------------------
- * Function: gent_packedbits
+ * Function: gent_intsattrs
*
- * Purpose: Generate a file to be used in the h5dump packed bits tests.
+ * Purpose: Generate a file to be used in the h5dump tests.
* Four datasets of 1, 2, 4 and 8 bytes of unsigned int types are created.
* Four more datasets of 1, 2, 4 and 8 bytes of signed int types are created.
* Fill them with raw data such that no bit will be all zero in a dataset.
* A dummy dataset of double type is created for failure test.
- * Created: Albert Cheng, 2010/5/10.
- * Modified: Allen Byrne, 2011/1/5 Use file to test Signed/Unsigned datatypes
*-------------------------------------------------------------------------
*/
static void
diff --git a/tools/test/h5dump/testh5dump.sh.in b/tools/test/h5dump/testh5dump.sh.in
index 1935b0d..9b1543c 100644
--- a/tools/test/h5dump/testh5dump.sh.in
+++ b/tools/test/h5dump/testh5dump.sh.in
@@ -488,7 +488,6 @@ TOOLTEST() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -532,7 +531,6 @@ TOOLTEST2() {
cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
- cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -591,7 +589,6 @@ TOOLTEST2A() {
cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
- cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -658,7 +655,6 @@ TOOLTEST2B() {
cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
- cat $actual_err >> $actual
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
@@ -715,7 +711,6 @@ TOOLTEST3() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext
- cat $actual_ext >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -774,7 +769,6 @@ TOOLTEST4() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext
- #cat $actual_ext >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -840,7 +834,6 @@ TOOLTEST5() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext
- #cat $actual_ext >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -884,7 +877,6 @@ TOOLTEST_HELP() {
cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
- cat $actual_err >> $actual
if [ ! -f $expectdata ]; then
# Create the expect data file if it doesn't yet exist.
diff --git a/tools/test/h5dump/testh5dumppbits.sh.in b/tools/test/h5dump/testh5dumppbits.sh.in
index 9cf5c99..febce2c 100644
--- a/tools/test/h5dump/testh5dumppbits.sh.in
+++ b/tools/test/h5dump/testh5dumppbits.sh.in
@@ -235,7 +235,6 @@ TOOLTEST() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -278,7 +277,6 @@ TOOLTEST2() {
cd $TESTDIR
$RUNSERIAL $DUMPER_BIN "$@"
) >$actual 2>$actual_err
- cat $actual_err >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -348,7 +346,6 @@ TOOLTEST3() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext
- cat $actual_ext >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
@@ -406,7 +403,6 @@ TOOLTEST4() {
-e 's/H5Eget_auto[1-2]*/H5Eget_auto(1 or 2)/' \
-e 's/H5Eset_auto[1-2]*/H5Eset_auto(1 or 2)/' \
$actual_err > $actual_ext
- #cat $actual_ext >> $actual
if [ ! -f $expect ]; then
# Create the expect file if it doesn't yet exist.
diff --git a/tools/test/h5format_convert/CMakeTests.cmake b/tools/test/h5format_convert/CMakeTests.cmake
index 2240813..5792d40 100644
--- a/tools/test/h5format_convert/CMakeTests.cmake
+++ b/tools/test/h5format_convert/CMakeTests.cmake
@@ -22,10 +22,8 @@
set (HDF5_REFERENCE_FILES
h5fc_help.ddl
h5fc_nooption.ddl
- h5fc_nonexistfile.ddl
h5fc_d_file.ddl
h5fc_dname.ddl
- h5fc_nonexistdset_file.ddl
h5fc_v_non_chunked.ddl
h5fc_v_bt1.ddl
h5fc_v_ndata_bt1.ddl
@@ -49,6 +47,12 @@
h5fc_v_err.ddl
h5fc_v_err.ddl.err
)
+ set (HDF5_REFERENCE_ERR_FILES
+ h5fc_d_file.ddl.err
+ h5fc_dname.err
+ h5fc_nonexistfile.ddl.err
+ h5fc_nonexistdset_file.ddl.err
+ )
set (HDF5_REFERENCE_TEST_FILES
h5fc_non_v3.h5
h5fc_edge_v3.h5
@@ -78,6 +82,10 @@
HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${ddl_file}" "${PROJECT_BINARY_DIR}/testfiles/${ddl_file}" "h5fc_files")
endforeach ()
+ foreach (h5_file ${HDF5_REFERENCE_ERR_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files")
+ endforeach ()
+
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5fc_files")
endforeach ()
@@ -119,6 +127,7 @@
-D "TEST_OUTPUT=${testname}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_REFERENCE=${resultfile}"
+ -D "TEST_ERRREF=${resultfile}.err"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
@@ -141,6 +150,42 @@
endif ()
endmacro ()
+ macro (ADD_H5_NOERR_OUTPUT testname resultfile resultcode testfile)
+ # If using memchecker add tests without using scripts
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5FC-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ./testfiles/outtmp.h5
+ ./testfiles/${testname}.out
+ ./testfiles/${testname}.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5FC-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5FC-${testname}-${testfile}-tmpfile
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different ${HDF5_TOOLS_TEST_H5FC_SOURCE_DIR}/testfiles/${testfile} ./testfiles/outtmp.h5
+ )
+ set_tests_properties (H5FC-${testname}-${testfile}-tmpfile PROPERTIES DEPENDS "H5FC-${testname}-clear-objects")
+ add_test (
+ NAME H5FC-${testname}-${testfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5format_convert>"
+ -D "TEST_ARGS=${ARGN};outtmp.h5"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5FC-${testname}-${testfile} PROPERTIES DEPENDS "H5FC-${testname}-${testfile}-tmpfile")
+ set (last_test "H5FC-${testname}-${testfile}")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_MASK_OUTPUT testname resultfile resultcode testfile)
# If using memchecker add tests without using scripts
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
@@ -433,17 +478,17 @@
# h5format_convert -d /GROUP/DSET_BT2 --verbose old_h5fc_ext_none.h5 (verbose, bt1 dataset)
# h5format_convert -d /DSET_NDATA_BT2 -v -n old_h5fc_ext_none.h5 (verbose, noop, bt1+nodata dataset)
# h5format_convert -v old_h5fc_ext_none.h5 (verbose, all datasets)
- ADD_H5_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v)
- ADD_H5_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose)
- ADD_H5_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n)
- ADD_H5_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_non_chunked h5fc_v_non_chunked.ddl 0 old_h5fc_ext_none.h5 -d /DSET_CONTIGUOUS -v)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_bt1 h5fc_v_bt1.ddl 0 old_h5fc_ext_none.h5 -d /GROUP/DSET_BT2 --verbose)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_ndata_bt1 h5fc_v_ndata_bt1.ddl 0 old_h5fc_ext_none.h5 -d /DSET_NDATA_BT2 -v -n)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_all h5fc_v_all.ddl 0 old_h5fc_ext_none.h5 -v)
#
#
#
# h5format_convert -d /DSET_EA -v -n h5fc_ext_none.h5 (verbose, noop, one ea dataset)
# h5format_convert -v -n h5fc_non_v3.h5 (verbose, noop, all datasets)
- ADD_H5_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n)
- ADD_H5_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_n_1d h5fc_v_n_1d.ddl 0 h5fc_ext_none.h5 -d /DSET_EA -v -n)
+ ADD_H5_NOERR_OUTPUT (h5fc_v_n_all h5fc_v_n_all.ddl 0 h5fc_non_v3.h5 -v -n)
#
#
#
diff --git a/tools/test/h5format_convert/Makefile.in b/tools/test/h5format_convert/Makefile.in
index 3f0005a..da61977 100644
--- a/tools/test/h5format_convert/Makefile.in
+++ b/tools/test/h5format_convert/Makefile.in
@@ -555,7 +555,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -589,6 +588,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1434,7 +1434,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/h5format_convert/testfiles/h5fc_d_file-d.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl
new file mode 100644
index 0000000..bc0229c
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_d_file-d.ddl
@@ -0,0 +1,25 @@
+usage: h5format_convert [OPTIONS] file_name
+ OPTIONS
+ -h, --help Print a usage message and exit
+ -V, --version Print version number and exit
+ -v, --verbose Turn on verbose mode
+ -d dname, --dname=dataset_name Pathname for the dataset
+ -n, --noop Perform all the steps except the actual conversion
+
+Examples of use:
+
+h5format_convert -d /group/dataset file_name
+ Convert the dataset </group/dataset> in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert file_name
+ Convert all datasets in the HDF5 file <file_name>:
+ a. chunked dataset: convert the chunk indexing type to version 1 B-tree
+ b. compact/contiguous dataset: downgrade the layout version to 3
+ c. virtual dataset: no action
+
+h5format_convert -n -d /group/dataset file_name
+ Go through all the steps except the actual conversion when
+ converting the dataset </group/dataset> in the HDF5 file <file_name>.
diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
index 38fc432..bc0229c 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
+++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl
@@ -23,4 +23,3 @@ h5format_convert file_name
h5format_convert -n -d /group/dataset file_name
Go through all the steps except the actual conversion when
converting the dataset </group/dataset> in the HDF5 file <file_name>.
-h5format_convert error: missing file name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err
new file mode 100644
index 0000000..ceb0fe4
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_d_file.ddl.err
@@ -0,0 +1 @@
+h5format_convert error: missing file name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl
index 48564b7..bc0229c 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_dname.ddl
+++ b/tools/test/h5format_convert/testfiles/h5fc_dname.ddl
@@ -23,4 +23,3 @@ h5format_convert file_name
h5format_convert -n -d /group/dataset file_name
Go through all the steps except the actual conversion when
converting the dataset </group/dataset> in the HDF5 file <file_name>.
-h5format_convert error: No dataset name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_dname.err b/tools/test/h5format_convert/testfiles/h5fc_dname.err
new file mode 100644
index 0000000..361d8a9
--- /dev/null
+++ b/tools/test/h5format_convert/testfiles/h5fc_dname.err
@@ -0,0 +1 @@
+h5format_convert error: No dataset name
diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err
index 39450c0..39450c0 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl
+++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistdset_file.ddl.err
diff --git a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err
index 706ea9d..706ea9d 100644
--- a/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl
+++ b/tools/test/h5format_convert/testfiles/h5fc_nonexistfile.ddl.err
diff --git a/tools/test/h5format_convert/testh5fc.sh.in b/tools/test/h5format_convert/testh5fc.sh.in
index 585d389..2cdd445 100644
--- a/tools/test/h5format_convert/testh5fc.sh.in
+++ b/tools/test/h5format_convert/testh5fc.sh.in
@@ -103,13 +103,18 @@ $SRC_H5FORMCONV_TESTFILES/old_h5fc_ext3_isf.h5
$SRC_H5FORMCONV_TESTFILES/h5fc_err_level.h5
"
+LIST_ERR_TEST_FILES="
+$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl.err
+$SRC_H5FORMCONV_TESTFILES/h5fc_dname.err
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl.err
+$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl.err
+"
+
LIST_OTHER_TEST_FILES="
$SRC_H5FORMCONV_TESTFILES/h5fc_help.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_nooption.ddl
-$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistfile.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_d_file.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_dname.ddl
-$SRC_H5FORMCONV_TESTFILES/h5fc_nonexistdset_file.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_non_chunked.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_bt1.ddl
$SRC_H5FORMCONV_TESTFILES/h5fc_v_ndata_bt1.ddl
@@ -137,7 +142,7 @@ $SRC_H5FORMCONV_TESTFILES/h5fc_v_err.ddl.err
#
# copy test files and expected output files from source dirs to test dir
#
-COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES"
COPY_TESTFILES_TO_TESTDIR()
{
@@ -193,6 +198,9 @@ TESTING() {
echo "Testing $* $SPACES" | cut -c1-80 | tr -d '\012'
}
+# Source in the output filter function definitions.
+. $srcdir/../../../bin/output_filter.sh
+
# Run a test and print PASS or *FAIL*. If a test fails then increment
# the `nerrors' global variable and (if $verbose is set) display the
# difference between the actual output and the expected output. The
@@ -212,8 +220,9 @@ TESTING() {
TOOLTEST_OUT() {
# Prepare expected and actual output
expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
actual="$TESTDIR/`basename $1 .ddl`.out"
- actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
@@ -233,7 +242,6 @@ TOOLTEST_OUT() {
) >$actual 2>$actual_err
cp $actual $actual_sav
cp $actual_err $actual_err_sav
- cat $actual_err >> $actual
# Compare output
COMPARE_OUT $expect $actual
@@ -251,7 +259,7 @@ TOOLTEST_MASK_OUT() {
expect_err="$TESTDIR/$1.err"
actual_ext="$TESTDIR/$1.ext"
actual="$TESTDIR/`basename $1 .ddl`.out"
- actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
@@ -305,6 +313,42 @@ TOOLTEST_MASK_OUT() {
$RM $actual $actual_err $actual_sav $actual_err_sav
fi
}
+# Same as TOOLTEST_OUT except only compares error outout
+TOOLTEST_ERR() {
+ # Prepare expected and actual output
+ expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/$1.err"
+ actual="$TESTDIR/`basename $1 .ddl`.out"
+ actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+
+ # Prepare the test file
+ $RM $TESTDIR/$TMPOUTFILE
+ TFILE=$2
+ if [ ! -z "$2" ] && [ -e $TESTDIR/$2 ] ; then
+ $CP $TESTDIR/$2 $TESTDIR/$TMPOUTFILE
+ TFILE=$TMPOUTFILE
+ fi
+
+ # Run test.
+ TESTING $FORMCONV $3 $4 $5 $6 $2
+ (
+ cd $TESTDIR
+ $RUNSERIAL $FORMCONV_BIN $3 $4 $5 $6 $TFILE
+ ) >$actual 2>$actual_err
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+
+ # Compare output
+ COMPARE_OUT $expect_err $actual_err
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err
+ $RM $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
# To check that the tool exits success, no output
# Assume all short options
@@ -406,7 +450,7 @@ COPY_TESTFILES_TO_TESTDIR
# h5format_convert nonexist.h5 (no options, file does not exist)
TOOLTEST_OUT h5fc_help.ddl '' --help
TOOLTEST_OUT h5fc_nooption.ddl ''
-TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
+TOOLTEST_ERR h5fc_nonexistfile.ddl nonexist.h5
#
#
# h5format_convert -d old_h5fc_ext_none.h5 (just -d option, file exists)
@@ -416,7 +460,7 @@ TOOLTEST_OUT h5fc_nonexistfile.ddl nonexist.h5
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 -d
TOOLTEST_OUT h5fc_d_file.ddl old_h5fc_ext_none.h5 --dname
TOOLTEST_OUT h5fc_dname.ddl '' --dname
-TOOLTEST_OUT h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist
+TOOLTEST_ERR h5fc_nonexistdset_file.ddl old_h5fc_ext_none.h5 --dname=nonexist
#
#
#
diff --git a/tools/test/h5import/Makefile.in b/tools/test/h5import/Makefile.in
index 2d9e25a..7e41e7f 100644
--- a/tools/test/h5import/Makefile.in
+++ b/tools/test/h5import/Makefile.in
@@ -551,7 +551,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -585,6 +584,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1419,7 +1419,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5jam/CMakeTests.cmake b/tools/test/h5jam/CMakeTests.cmake
index 66ff715..2d00b86 100644
--- a/tools/test/h5jam/CMakeTests.cmake
+++ b/tools/test/h5jam/CMakeTests.cmake
@@ -74,6 +74,8 @@
-D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
-D "TEST_OUTPUT=${expectfile}.out"
-D "TEST_EXPECT=${resultcode}"
+ -D "TEST_ERRREF=testfiles/${expectfile}.txt"
+ -D "TEST_SKIP_COMPARE=1"
-D "TEST_REFERENCE=testfiles/${expectfile}.txt"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
diff --git a/tools/test/h5jam/Makefile.in b/tools/test/h5jam/Makefile.in
index 1163c07..1517f52 100644
--- a/tools/test/h5jam/Makefile.in
+++ b/tools/test/h5jam/Makefile.in
@@ -556,7 +556,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -590,6 +589,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1428,7 +1428,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/h5jam/tellub.c b/tools/test/h5jam/tellub.c
index 8e4b3ac..ea362f5 100644
--- a/tools/test/h5jam/tellub.c
+++ b/tools/test/h5jam/tellub.c
@@ -26,9 +26,9 @@
*/
static const char *s_opts = "h";
static struct long_options l_opts[] = {
- {"help", no_arg, 'h'},
- {"hel", no_arg, 'h'},
- {NULL, 0, '\0'}
+ {"help", no_arg, 'h'},
+ {"hel", no_arg, 'h'},
+ {NULL, 0, '\0'}
};
/*-------------------------------------------------------------------------
@@ -37,152 +37,126 @@ static struct long_options l_opts[] = {
* Purpose: Print the usage message
*
* Return: void
- *
- * Programmer:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
usage (const char *prog)
{
- fflush (stdout);
- fprintf (stdout, "usage: %s h5_file\n", prog);
- fprintf (stdout,
- " Check that h5_fil is HDF5 file and print size of user block \n");
- fprintf (stdout, " %s -h\n", prog);
- fprintf (stdout, " Print a usage message and exit\n");
-}
+ HDfflush(stdout);
+ HDfprintf(stdout, "usage: %s h5_file\n", prog);
+ HDfprintf(stdout,
+ " Check that h5_fil is HDF5 file and print size of user block \n");
+ HDfprintf(stdout, " %s -h\n", prog);
+ HDfprintf(stdout, " Print a usage message and exit\n");
+} /* end usage() */
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
- * Purpose: Parse the command line for the h5dumper.
- *
- * Return: Success:
+ * Purpose: Parse the command line.
*
+ * Return: Success: void
* Failure: Exits program with EXIT_FAILURE value.
- *
- * Programmer:
- *
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
static void
parse_command_line (int argc, const char *argv[])
{
- int opt;
-
- /* parse command line options */
- while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF)
- {
- switch ((char) opt)
- {
- case 'h':
- usage (h5tools_getprogname());
- exit (EXIT_SUCCESS);
- case '?':
- default:
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
- }
+ int opt;
+
+ /* parse command line options */
+ while ((opt = get_option (argc, argv, s_opts, l_opts)) != EOF) {
+ switch ((char) opt) {
+ case 'h':
+ usage (h5tools_getprogname());
+ HDexit(EXIT_SUCCESS);
+ case '?':
+ default:
+ usage (h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
+ }
}
- /* check for file name to be processed */
- if (argc <= opt_ind)
- {
- error_msg("missing file name\n");
- usage (h5tools_getprogname());
- exit (EXIT_FAILURE);
+ /* check for file name to be processed */
+ if (argc <= opt_ind) {
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
+ HDexit(EXIT_FAILURE);
}
-}
+} /* end parse_command_line() */
/*-------------------------------------------------------------------------
* Function: main
*
- * Purpose: HDF5 user block unjammer
- *
- * Return: Success: 0
- * Failure: 1
- *
- * Programmer:
- *
- * Modifications:
+ * Purpose: HDF5 user block tell size
*
+ * Return: EXIT_SUCCESS/EXIT_FAILURE
*-------------------------------------------------------------------------
*/
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;
-
- h5tools_setprogname(PROGRAMNAME);
- h5tools_setstatus(EXIT_SUCCESS);
-
- /* 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);
-
- if (argc <= (opt_ind))
- {
- error_msg("missing file name\n");
- usage (h5tools_getprogname());
- return (EXIT_FAILURE);
+ 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;
+
+ h5tools_setprogname(PROGRAMNAME);
+ h5tools_setstatus(EXIT_SUCCESS);
+
+ /* 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);
+
+ if(argc <= (opt_ind)) {
+ error_msg("missing file name\n");
+ usage (h5tools_getprogname());
+ return EXIT_FAILURE;
}
- ifname = HDstrdup (argv[opt_ind]);
+ ifname = HDstrdup(argv[opt_ind]);
testval = H5Fis_hdf5 (ifname);
- if (testval <= 0)
- {
- error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
- return (EXIT_FAILURE);
+ if(testval <= 0) {
+ error_msg("Input HDF5 file is not HDF \"%s\"\n", ifname);
+ return EXIT_FAILURE;
}
- ifile = H5Fopen (ifname, H5F_ACC_RDONLY, H5P_DEFAULT);
+ 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);
+ if(ifile < 0) {
+ error_msg("Can't open input HDF5 file \"%s\"\n", ifname);
+ return EXIT_FAILURE;
}
- plist = H5Fget_create_plist (ifile);
- if (plist < 0)
- {
- error_msg("Can't get file creation plist for file \"%s\"\n",
- ifname);
- return (EXIT_FAILURE);
+ plist = H5Fget_create_plist(ifile);
+ if(plist < 0) {
+ error_msg("Can't get file creation plist for file \"%s\"\n", ifname);
+ return EXIT_FAILURE;
}
- status = H5Pget_userblock (plist, &usize);
- if (status < 0)
- {
- error_msg("Can't get user block for file \"%s\"\n", ifname);
- return (EXIT_FAILURE);
+ status = H5Pget_userblock(plist, &usize);
+ if(status < 0) {
+ error_msg("Can't get user block for file \"%s\"\n", ifname);
+ return EXIT_FAILURE;
}
- printf ("%ld\n", (long) usize);
+ HDprintf("%ld\n", (long) usize);
- H5Pclose (plist);
- H5Fclose (ifile);
+ H5Pclose (plist);
+ H5Fclose (ifile);
- return (EXIT_SUCCESS);
-}
+ return EXIT_SUCCESS;
+} /* 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..116d097 100644
--- a/tools/test/h5ls/CMakeTests.cmake
+++ b/tools/test/h5ls/CMakeTests.cmake
@@ -47,6 +47,12 @@
${HDF5_TOOLS_DIR}/testfiles/tdset_idx.h5
)
+ set (LIST_ERR_TEST_FILES
+ ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/nosuchfile.err
+ ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/textlinksrc-nodangle-1.err
+ ${HDF5_TOOLS_DIR}/test/h5ls/errfiles/tgroup-1.err
+ )
+
set (LIST_OTHER_TEST_FILES
${HDF5_TOOLS_DIR}/testfiles/help-1.ls
${HDF5_TOOLS_DIR}/testfiles/help-2.ls
@@ -116,6 +122,10 @@
get_filename_component(fname "${listfiles}" NAME)
HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files")
endforeach ()
+ foreach (listfiles ${LIST_ERR_TEST_FILES})
+ get_filename_component(fname "${listfiles}" NAME)
+ HDFTEST_COPY_FILE("${listfiles}" "${PROJECT_BINARY_DIR}/testfiles/${fname}" "h5ls_files")
+ endforeach ()
add_custom_target(h5ls_files ALL COMMENT "Copying files needed by h5ls tests" DEPENDS ${h5ls_files_list})
##############################################################################
@@ -159,6 +169,42 @@
endif ()
endmacro ()
+ macro (ADD_H5_ERR_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5LS-${resultfile} COMMAND $<TARGET_FILE:h5ls> ${ARGN})
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles")
+ if ("${resultcode}" STREQUAL "1")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else ()
+ # Remove any output file left over from previous test run
+ add_test (
+ NAME H5LS-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${resultfile}.out
+ testfiles/${resultfile}.out.err
+ )
+ add_test (
+ NAME H5LS-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5ls>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.ls"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5LS-${resultfile} PROPERTIES DEPENDS H5LS-${resultfile}-clear-objects)
+ endif ()
+ endmacro ()
+
macro (ADD_H5_UD_TEST testname resultcode resultfile)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
# Remove any output file left over from previous test run
@@ -341,7 +387,7 @@
# test for displaying groups
# The following combination of arguments is expected to return an error message
# and return value 1
- ADD_H5_TEST (tgroup-1 1 -w80 -r -g tgroup.h5)
+ ADD_H5_ERR_TEST (tgroup-1 1 -w80 -r -g tgroup.h5)
ADD_H5_TEST (tgroup-2 0 -w80 -g tgroup.h5/g1)
# test for files with groups that have long comments
@@ -382,7 +428,7 @@
# tests for no-dangling-links
# if this option is given on dangling link, h5ls should return exit code 1
# when used alone , expect to print out help and return exit code 1
- ADD_H5_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5)
+ ADD_H5_ERR_TEST (textlinksrc-nodangle-1 1 -w80 --no-dangling-links textlinksrc.h5)
# external dangling link - expected exit code 1
ADD_H5_TEST (textlinksrc-nodangle-2 1 -w80 --follow-symlinks --no-dangling-links textlinksrc.h5)
# soft dangling link - expected exit code 1
@@ -444,7 +490,7 @@
endif ()
# test for non-existing file
- ADD_H5_TEST (nosuchfile 1 nosuchfile.h5)
+ ADD_H5_ERR_TEST (nosuchfile 1 nosuchfile.h5)
# test for variable length data types in verbose mode
if (H5_WORDS_BIGENDIAN)
@@ -470,4 +516,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/h5ls/Makefile.in b/tools/test/h5ls/Makefile.in
index eaa12ec..faa88ce 100644
--- a/tools/test/h5ls/Makefile.in
+++ b/tools/test/h5ls/Makefile.in
@@ -557,7 +557,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -591,6 +590,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1428,7 +1428,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5ls/errfiles/nosuchfile.err b/tools/test/h5ls/errfiles/nosuchfile.err
new file mode 100644
index 0000000..8c4ee42
--- /dev/null
+++ b/tools/test/h5ls/errfiles/nosuchfile.err
@@ -0,0 +1 @@
+nosuchfile.h5: unable to open file
diff --git a/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err
new file mode 100644
index 0000000..8991fc1
--- /dev/null
+++ b/tools/test/h5ls/errfiles/textlinksrc-nodangle-1.err
@@ -0,0 +1,2 @@
+Error: --no-dangling-links must be used along with --follow-symlinks option!
+
diff --git a/tools/test/h5ls/errfiles/tgroup-1.err b/tools/test/h5ls/errfiles/tgroup-1.err
new file mode 100644
index 0000000..ba4cf07
--- /dev/null
+++ b/tools/test/h5ls/errfiles/tgroup-1.err
@@ -0,0 +1,2 @@
+Error: 'recursive' option not compatible with 'group info' option!
+
diff --git a/tools/test/h5ls/testh5ls.sh.in b/tools/test/h5ls/testh5ls.sh.in
index 8c6551b..353f1bb 100644
--- a/tools/test/h5ls/testh5ls.sh.in
+++ b/tools/test/h5ls/testh5ls.sh.in
@@ -53,6 +53,7 @@ SRC_H5REPACK_TESTFILES="$SRC_TOOLS/test/h5repack/testfiles"
SRC_H5JAM_TESTFILES="$SRC_TOOLS/test/h5jam/testfiles"
SRC_H5STAT_TESTFILES="$SRC_TOOLS/test/h5stat/testfiles"
SRC_H5IMPORT_TESTFILES="$SRC_TOOLS/test/h5import/testfiles"
+SRC_H5LS_ERRFILES="$SRC_TOOLS/test/h5ls/errfiles"
TESTDIR=./testfiles
test -d $TESTDIR || mkdir $TESTDIR
@@ -93,6 +94,12 @@ $SRC_H5LS_TESTFILES/tvldtypes1.h5
$SRC_H5LS_TESTFILES/tdset_idx.h5
"
+LIST_ERROR_TEST_FILES="
+$SRC_H5LS_ERRFILES/nosuchfile.err
+$SRC_H5LS_ERRFILES/textlinksrc-nodangle-1.err
+$SRC_H5LS_ERRFILES/tgroup-1.err
+"
+
LIST_OTHER_TEST_FILES="
$SRC_H5LS_TESTFILES/help-1.ls
$SRC_H5LS_TESTFILES/help-2.ls
@@ -228,8 +235,9 @@ TESTING() {
# $2 and on -- argument for the h5ls tool
TOOLTEST() {
expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ls`.err"
actual="$TESTDIR/`basename $1 .ls`.out"
- actual_err="$TESTDIR/`basename $1 .ls`.err"
+ actual_err="$TESTDIR/`basename $1 .ls`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
shift
@@ -251,7 +259,6 @@ TOOLTEST() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $actual_err
- cat $actual_err >> $actual
if [ $h5haveexitcode = 'yes' -a $exitcode -ne $retvalexpect ]; then
echo "*FAILED*"
nerrors="`expr $nerrors + 1`"
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..c2a2be7 100644
--- a/tools/test/h5repack/CMakeTests.cmake
+++ b/tools/test/h5repack/CMakeTests.cmake
@@ -16,39 +16,6 @@
##############################################################################
##############################################################################
- if (HDF5_TEST_VFD)
- set (VFD_LIST
- sec2
- stdio
- core
- split
- multi
- family
- )
-
- if (DIRECT_VFD)
- set (VFD_LIST ${VFD_LIST} direct)
- endif ()
-
- macro (ADD_VFD_TEST vfdname resultcode)
- add_test (
- NAME H5REPACK-VFD-${vfdname}-h5repacktest
- COMMAND "${CMAKE_COMMAND}"
- -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>"
- -D "TEST_ARGS:STRING="
- -D "TEST_VFD:STRING=${vfdname}"
- -D "TEST_EXPECT=${resultcode}"
- -D "TEST_OUTPUT=h5repacktest"
- -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
- -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
- )
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest")
- endmacro ()
- endif ()
-
# --------------------------------------------------------------------
# Copy all the HDF5 files from the source directory into the test directory
# --------------------------------------------------------------------
@@ -377,7 +344,8 @@
-D "TEST_OUTPUT=${resultfile}-${testname}.out"
-D "TEST_EXPECT=${resultcode}"
-D "TEST_MASK_ERROR=true"
- -D "TEST_REFERENCE=${resultfile}-${testname}.tst"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}-${testname}.tst"
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
set_tests_properties (H5REPACK_MASK-${testname} PROPERTIES DEPENDS H5REPACK_MASK-${testname}-clear-objects)
@@ -1450,15 +1418,20 @@ 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
- foreach (vfd ${VFD_LIST})
- ADD_VFD_TEST (${vfd} 0)
- endforeach ()
- endif ()
+##############################################################################
+##############################################################################
+### V F D T E S T S ###
+##############################################################################
+##############################################################################
+
+if (HDF5_TEST_VFD)
+ include (CMakeVFDTests.cmake)
+endif ()
diff --git a/tools/test/h5repack/CMakeVFDTests.cmake b/tools/test/h5repack/CMakeVFDTests.cmake
new file mode 100644
index 0000000..2042f31
--- /dev/null
+++ b/tools/test/h5repack/CMakeVFDTests.cmake
@@ -0,0 +1,65 @@
+#
+# 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.
+#
+
+##############################################################################
+##############################################################################
+### T E S T I N G ###
+##############################################################################
+##############################################################################
+
+ set (VFD_LIST
+ sec2
+ stdio
+ core
+ split
+ multi
+ family
+ )
+
+ if (DIRECT_VFD)
+ set (VFD_LIST ${VFD_LIST} direct)
+ endif ()
+
+##############################################################################
+##############################################################################
+### T H E T E S T S M A C R O S ###
+##############################################################################
+##############################################################################
+
+ macro (ADD_VFD_TEST vfdname resultcode)
+ add_test (
+ NAME H5REPACK-VFD-${vfdname}-h5repacktest
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5repacktest>"
+ -D "TEST_ARGS:STRING="
+ -D "TEST_VFD:STRING=${vfdname}"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_OUTPUT=h5repacktest"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -P "${HDF_RESOURCES_DIR}/vfdTest.cmake"
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5REPACK-VFD-${vfdname}-h5repacktest PROPERTIES DEPENDS ${last_test})
+ endif ()
+ set (last_test "H5REPACK-VFD-${vfdname}-h5repacktest")
+ endmacro ()
+
+##############################################################################
+##############################################################################
+### T H E T E S T S ###
+##############################################################################
+##############################################################################
+
+ # Run test with different Virtual File Driver
+ foreach (vfd ${VFD_LIST})
+ ADD_VFD_TEST (${vfd} 0)
+ endforeach ()
diff --git a/tools/test/h5repack/Makefile.in b/tools/test/h5repack/Makefile.in
index 36abf80..013985e 100644
--- a/tools/test/h5repack/Makefile.in
+++ b/tools/test/h5repack/Makefile.in
@@ -591,7 +591,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -625,6 +624,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1493,7 +1493,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/h5repack/h5repack.sh.in b/tools/test/h5repack/h5repack.sh.in
index b0a2f99..a36eb08 100644
--- a/tools/test/h5repack/h5repack.sh.in
+++ b/tools/test/h5repack/h5repack.sh.in
@@ -997,6 +997,7 @@ fi
##############################################################################
### T H E T E S T S
##############################################################################
+
# prepare for test
COPY_TESTFILES_TO_TESTDIR
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 55bf8fe..341a404 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 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -33,7 +33,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -55,7 +55,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -77,7 +77,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -99,7 +99,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -121,7 +121,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
@@ -143,7 +143,7 @@ GROUP "/" {
USER_DEFINED_FILTER {
FILTER_ID 260
COMMENT dynlib4
- PARAMS { 9 1 10 4 }
+ PARAMS { 9 1 10 5 }
}
}
FILLVALUE {
diff --git a/tools/test/h5stat/CMakeTests.cmake b/tools/test/h5stat/CMakeTests.cmake
index bd55ac1..ec8c9b1 100644
--- a/tools/test/h5stat/CMakeTests.cmake
+++ b/tools/test/h5stat/CMakeTests.cmake
@@ -39,23 +39,30 @@
h5stat_newgrat
h5stat_newgrat-UG
h5stat_newgrat-UA
- h5stat_err1_links
h5stat_idx
h5stat_links1
h5stat_links2
h5stat_links3
h5stat_links4
h5stat_links5
- h5stat_err1_dims
h5stat_dims1
h5stat_dims2
- h5stat_err1_numattrs
- h5stat_err2_numattrs
h5stat_numattrs1
h5stat_numattrs2
h5stat_numattrs3
h5stat_numattrs4
)
+ set (HDF5_REFERENCE_ERR_FILES
+ h5stat_err_refcount
+ h5stat_err_old_layout
+ h5stat_err_old_fill
+ h5stat_err1_dims
+ h5stat_err1_links
+ h5stat_err1_numattrs
+ h5stat_err2_numattrs
+ h5stat_notexist
+ h5stat_nofile
+ )
set (HDF5_REFERENCE_TEST_FILES
h5stat_err_refcount.h5
h5stat_err_old_layout.h5
@@ -71,6 +78,10 @@
HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${ddl_file}.ddl" "${PROJECT_BINARY_DIR}/${ddl_file}.ddl" "h5stat_files")
endforeach ()
+ foreach (h5_file ${HDF5_REFERENCE_ERR_FILES})
+ HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}.err" "${PROJECT_BINARY_DIR}/${h5_file}.err" "h5stat_files")
+ endforeach ()
+
foreach (h5_file ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${HDF5_TOOLS_TEST_H5STAT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/${h5_file}" "h5stat_files")
endforeach ()
@@ -118,6 +129,43 @@
endif ()
endmacro ()
+ macro (ADD_H5_ERR_TEST resultfile resultcode)
+ # If using memchecker add tests without using scripts
+ if (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (NAME H5STAT-${resultfile} COMMAND $<TARGET_FILE:h5stat> ${ARGN})
+ if (NOT "${resultcode}" STREQUAL "0")
+ set_tests_properties (H5STAT-${resultfile} PROPERTIES WILL_FAIL "true")
+ endif ()
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS ${last_test})
+ endif ()
+ else (HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5STAT-${resultfile}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ ${resultfile}.out
+ ${resultfile}.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5STAT-${resultfile}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5STAT-${resultfile}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5stat>"
+ -D "TEST_ARGS=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}"
+ -D "TEST_OUTPUT=${resultfile}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5STAT-${resultfile} PROPERTIES DEPENDS H5STAT-${resultfile}-clear-objects)
+ endif ()
+ endmacro ()
+
##############################################################################
##############################################################################
### T H E T E S T S ###
@@ -173,7 +221,7 @@
# -g -l 8
# --links=8
# --links=20 -g
- ADD_H5_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5)
+ ADD_H5_ERR_TEST (h5stat_err1_links 1 -l 0 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_links1 0 -g -l 8 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_links2 0 --links=8 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_links3 0 --links=20 -g h5stat_threshold.h5)
@@ -188,7 +236,7 @@
# -d --dims=-1 (incorrect threshold value)
# -gd -m 5
# -d --di=15
- ADD_H5_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5)
+ ADD_H5_ERR_TEST (h5stat_err1_dims 1 -d --dims=-1 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_dims1 0 -gd -m 5 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_dims2 0 -d --di=15 h5stat_threshold.h5)
#
@@ -198,8 +246,8 @@
# -AS -a 10
# -a 1
# -A --numattrs=25
- ADD_H5_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5)
- ADD_H5_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5)
+ ADD_H5_ERR_TEST (h5stat_err1_numattrs 1 -a -2 h5stat_threshold.h5)
+ ADD_H5_ERR_TEST (h5stat_err2_numattrs 1 --numattrs h5stat_threshold.h5)
ADD_H5_TEST (h5stat_numattrs1 0 -AS -a 10 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_numattrs2 0 -a 1 h5stat_threshold.h5)
ADD_H5_TEST (h5stat_numattrs3 0 -A --numattrs=25 h5stat_threshold.h5)
diff --git a/tools/test/h5stat/Makefile.in b/tools/test/h5stat/Makefile.in
index 91e781f..e292740 100644
--- a/tools/test/h5stat/Makefile.in
+++ b/tools/test/h5stat/Makefile.in
@@ -551,7 +551,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -585,6 +584,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1430,7 +1430,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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/h5stat/testfiles/h5stat_err1_dims.ddl b/tools/test/h5stat/testfiles/h5stat_err1_dims.err
index 86d375b..86d375b 100644
--- a/tools/test/h5stat/testfiles/h5stat_err1_dims.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err1_dims.err
diff --git a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl b/tools/test/h5stat/testfiles/h5stat_err1_links.err
index d43207c..d43207c 100644
--- a/tools/test/h5stat/testfiles/h5stat_err1_links.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err1_links.err
diff --git a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err
index 01b6c18..01b6c18 100644
--- a/tools/test/h5stat/testfiles/h5stat_err2_numattrs.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err1_numattrs.err
diff --git a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err
index 01b6c18..01b6c18 100644
--- a/tools/test/h5stat/testfiles/h5stat_err1_numattrs.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err2_numattrs.err
diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl
index e751b7f..5cc1e32 100644
--- a/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.ddl
@@ -1,2 +1 @@
Filename: h5stat_err_old_fill.h5
-h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_fill.err b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err
new file mode 100644
index 0000000..8b886d2
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err_old_fill.err
@@ -0,0 +1 @@
+h5stat error: unable to traverse objects/links in file "h5stat_err_old_fill.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl
index a3e27e2..112190c 100644
--- a/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.ddl
@@ -1,2 +1 @@
Filename: h5stat_err_old_layout.h5
-h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_err_old_layout.err b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err
new file mode 100644
index 0000000..7aa2fa7
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err_old_layout.err
@@ -0,0 +1 @@
+h5stat error: unable to traverse objects/links in file "h5stat_err_old_layout.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl
index 1f1b491..41e533e 100644
--- a/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.ddl
@@ -1,2 +1 @@
Filename: h5stat_err_refcount.h5
-h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_err_refcount.err b/tools/test/h5stat/testfiles/h5stat_err_refcount.err
new file mode 100644
index 0000000..d176996
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_err_refcount.err
@@ -0,0 +1 @@
+h5stat error: unable to traverse objects/links in file "h5stat_err_refcount.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.ddl b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
index 7171320..01e39af 100644
--- a/tools/test/h5stat/testfiles/h5stat_nofile.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_nofile.ddl
@@ -23,4 +23,3 @@ Usage: h5stat [OPTIONS] file
-s, --freespace Print free space information
-S, --summary Print summary of file space information
--enable-error-stack Prints messages from the HDF5 error stack as they occur
-h5stat error: missing file name
diff --git a/tools/test/h5stat/testfiles/h5stat_nofile.err b/tools/test/h5stat/testfiles/h5stat_nofile.err
new file mode 100644
index 0000000..3b7e979
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_nofile.err
@@ -0,0 +1 @@
+h5stat error: missing file name
diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.ddl b/tools/test/h5stat/testfiles/h5stat_notexist.ddl
index cc25e43..7f71941 100644
--- a/tools/test/h5stat/testfiles/h5stat_notexist.ddl
+++ b/tools/test/h5stat/testfiles/h5stat_notexist.ddl
@@ -1,2 +1 @@
Filename: notexist.h5
-h5stat error: unable to open file "notexist.h5"
diff --git a/tools/test/h5stat/testfiles/h5stat_notexist.err b/tools/test/h5stat/testfiles/h5stat_notexist.err
new file mode 100644
index 0000000..c1d9e54
--- /dev/null
+++ b/tools/test/h5stat/testfiles/h5stat_notexist.err
@@ -0,0 +1 @@
+h5stat error: unable to open file "notexist.h5"
diff --git a/tools/test/h5stat/testh5stat.sh.in b/tools/test/h5stat/testh5stat.sh.in
index 5082daf..69b856e 100644
--- a/tools/test/h5stat/testh5stat.sh.in
+++ b/tools/test/h5stat/testh5stat.sh.in
@@ -79,6 +79,18 @@ $SRC_H5STAT_TESTFILES/h5stat_idx.h5
$SRC_H5STAT_TESTFILES/h5stat_threshold.h5
"
+LIST_ERR_TEST_FILES="
+$SRC_H5STAT_TESTFILES/h5stat_err_refcount.err
+$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.err
+$SRC_H5STAT_TESTFILES/h5stat_err_old_fill.err
+$SRC_H5STAT_TESTFILES/h5stat_err1_links.err
+$SRC_H5STAT_TESTFILES/h5stat_err1_dims.err
+$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.err
+$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.err
+$SRC_H5STAT_TESTFILES/h5stat_notexist.err
+$SRC_H5STAT_TESTFILES/h5stat_nofile.err
+"
+
LIST_OTHER_TEST_FILES="
$SRC_H5STAT_TESTFILES/h5stat_err_refcount.ddl
$SRC_H5STAT_TESTFILES/h5stat_err_old_layout.ddl
@@ -100,17 +112,13 @@ $SRC_H5STAT_TESTFILES/h5stat_newgrat.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UG.ddl
$SRC_H5STAT_TESTFILES/h5stat_newgrat-UA.ddl
$SRC_H5STAT_TESTFILES/h5stat_idx.ddl
-$SRC_H5STAT_TESTFILES/h5stat_err1_links.ddl
$SRC_H5STAT_TESTFILES/h5stat_links1.ddl
$SRC_H5STAT_TESTFILES/h5stat_links2.ddl
$SRC_H5STAT_TESTFILES/h5stat_links3.ddl
$SRC_H5STAT_TESTFILES/h5stat_links4.ddl
$SRC_H5STAT_TESTFILES/h5stat_links5.ddl
-$SRC_H5STAT_TESTFILES/h5stat_err1_dims.ddl
$SRC_H5STAT_TESTFILES/h5stat_dims1.ddl
$SRC_H5STAT_TESTFILES/h5stat_dims2.ddl
-$SRC_H5STAT_TESTFILES/h5stat_err1_numattrs.ddl
-$SRC_H5STAT_TESTFILES/h5stat_err2_numattrs.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs1.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs2.ddl
$SRC_H5STAT_TESTFILES/h5stat_numattrs3.ddl
@@ -120,7 +128,7 @@ $SRC_H5STAT_TESTFILES/h5stat_numattrs4.ddl
#
# copy test files and expected output files from source dirs to test dir
#
-COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_OTHER_TEST_FILES"
+COPY_TESTFILES="$LIST_HDF5_TEST_FILES $LIST_ERR_TEST_FILES $LIST_OTHER_TEST_FILES"
COPY_TESTFILES_TO_TESTDIR()
{
@@ -184,8 +192,9 @@ TESTING() {
#
TOOLTEST() {
expect="$TESTDIR/$1"
+ expect_err="$TESTDIR/`basename $1 .ddl`.err"
actual="$TESTDIR/`basename $1 .ddl`.out"
- actual_err="$TESTDIR/`basename $1 .ddl`.err"
+ actual_err="$TESTDIR/`basename $1 .ddl`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
shift
@@ -202,14 +211,17 @@ TOOLTEST() {
STDOUT_FILTER $actual
cp $actual_err $actual_err_sav
STDERR_FILTER $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 " Expected result (*.ddl) missing"
- nerrors="`expr $nerrors + 1`"
+ # Compare error files if the expect file doesn't exist.
+ if $CMP $expect_err $actual_err; then
+ echo " PASSED"
+ else
+ echo "*FAILED*"
+ echo " Expected result (*.err) differs from actual result (*.out.err)"
+ nerrors="`expr $nerrors + 1`"
+ test yes = "$verbose" && $DIFF $expect_err $actual_err |sed 's/^/ /'
+ fi
elif $CMP $expect $actual; then
echo " PASSED"
else
@@ -249,7 +261,6 @@ TOOLTEST h5stat_help2.ddl --help
TOOLTEST h5stat_notexist.ddl notexist.h5
TOOLTEST h5stat_nofile.ddl ''
-
# Test file with groups, compressed datasets, user-applied fileters, etc.
# h5stat_filters.h5 is a copy of ../../testfiles/tfilters.h5 as of release 1.8.0-alpha4
TOOLTEST h5stat_filters.ddl h5stat_filters.h5
diff --git a/tools/test/misc/CMakeTestsClear.cmake b/tools/test/misc/CMakeTestsClear.cmake
index a51d0e9..c46ac59 100644
--- a/tools/test/misc/CMakeTestsClear.cmake
+++ b/tools/test/misc/CMakeTestsClear.cmake
@@ -49,8 +49,6 @@
h5clear_missing_file.ddl
h5clear_noclose_after_size.ddl
h5clear_noclose_before_size.ddl
- h5clear_no_mdc_image.ddl
- h5clear_open_fail.ddl
h5clear_status_noclose_after_size.ddl
h5clear_usage.ddl
h5clear_user_equal_after_size.ddl
@@ -60,10 +58,17 @@
h5clear_user_less_after_size.ddl
h5clear_user_less_before_size.ddl
)
+ set (HDF5_REFERENCE_ERR_FILES
+ h5clear_no_mdc_image.err
+ h5clear_open_fail.err
+ )
foreach (h5_file ${HDF5_TEST_FILES} ${HDF5_SEC2_TEST_FILES} ${HDF5_REFERENCE_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files")
endforeach ()
+ foreach (h5_file ${HDF5_REFERENCE_ERR_FILES})
+ HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/${h5_file}" "h5clear_files")
+ endforeach ()
# make second copy of h5clear_sec2.h5
foreach (h5_file ${HDF5_SEC2_TEST_FILES})
HDFTEST_COPY_FILE("${PROJECT_SOURCE_DIR}/testfiles/${h5_file}" "${PROJECT_BINARY_DIR}/testfiles/orig_${h5_file}" "h5clear_files")
@@ -108,6 +113,35 @@
endif ()
endmacro ()
+ macro (ADD_H5_ERR_CMP testname resultfile resultcode)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5CLEAR_CMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}.out
+ testfiles/${testname}.out.err
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5CLEAR_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_ARGS:STRING=${ARGN}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects)
+ set (last_test "H5CLEAR_CMP-${testname}")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_CMP_WITH_COPY testname resultcode resultfile testfile)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -144,6 +178,43 @@
endif ()
endmacro ()
+ macro (ADD_H5_ERR_CMP_WITH_COPY testname resultcode resultfile testfile)
+ if (NOT HDF5_ENABLE_USING_MEMCHECKER)
+ add_test (
+ NAME H5CLEAR_CMP-${testname}-clear-objects
+ COMMAND ${CMAKE_COMMAND}
+ -E remove
+ testfiles/${testname}.out
+ testfiles/${testname}.out.err
+ testfiles/${testfile}
+ )
+ if (NOT "${last_test}" STREQUAL "")
+ set_tests_properties (H5CLEAR_CMP-${testname}-clear-objects PROPERTIES DEPENDS ${last_test})
+ endif ()
+ add_test (
+ NAME H5CLEAR_CMP-copy_${testname}
+ COMMAND ${CMAKE_COMMAND}
+ -E copy_if_different
+ "${PROJECT_SOURCE_DIR}/testfiles/${testfile}" "${PROJECT_BINARY_DIR}/testfiles/${testfile}"
+ )
+ set_tests_properties (H5CLEAR_CMP-copy_${testname} PROPERTIES DEPENDS H5CLEAR_CMP-${testname}-clear-objects)
+ add_test (
+ NAME H5CLEAR_CMP-${testname}
+ COMMAND "${CMAKE_COMMAND}"
+ -D "TEST_PROGRAM=$<TARGET_FILE:h5clear>"
+ -D "TEST_ARGS:STRING=${ARGN};${testfile}"
+ -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles"
+ -D "TEST_OUTPUT=${testname}.out"
+ -D "TEST_EXPECT=${resultcode}"
+ -D "TEST_REFERENCE=${resultfile}.mty"
+ -D "TEST_ERRREF=${resultfile}.err"
+ -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
+ )
+ set_tests_properties (H5CLEAR_CMP-${testname} PROPERTIES DEPENDS H5CLEAR_CMP-copy_${testname})
+ set (last_test "H5CLEAR_CMP-${testname}")
+ endif ()
+ endmacro ()
+
macro (ADD_H5_RETTEST testname resultcode)
if (NOT HDF5_ENABLE_USING_MEMCHECKER)
add_test (
@@ -347,11 +418,11 @@ endif()
ADD_H5_CMP (h5clr_usage_junk h5clear_usage 1 "" junk.h5)
ADD_H5_CMP (h5clr_usage_none h5clear_usage 1 "" orig_h5clear_sec2_v3.h5)
ADD_H5_CMP (h5clr_missing_file_m h5clear_missing_file 1 "-m")
- ADD_H5_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5)
+ ADD_H5_ERR_CMP (h5clr_open_fail_s h5clear_open_fail 1 "-s" junk.h5)
ADD_H5_CMP (h5clr_missing_file_ms h5clear_missing_file 1 "-m" "-s")
- ADD_H5_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5)
- ADD_H5_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5)
- ADD_H5_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5)
+ ADD_H5_ERR_CMP (h5clr_open_fail_ms h5clear_open_fail 1 "-m" "-s" junk.h5)
+ ADD_H5_ERR_CMP (h5clr_no_mdc_image_m h5clear_no_mdc_image 0 "-m" orig_h5clear_sec2_v2.h5)
+ ADD_H5_ERR_CMP (h5clr_no_mdc_image_ms h5clear_no_mdc_image 0 "-s" "-m" orig_h5clear_sec2_v0.h5)
#
#
#
@@ -382,8 +453,8 @@ endif()
#
#
# h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear:
- ADD_H5_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5)
- ADD_H5_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5)
+ ADD_H5_ERR_CMP (h5clr_mdc_image_m h5clear_no_mdc_image 0 "-m" mod_h5clear_mdc_image.h5)
+ ADD_H5_ERR_CMP (h5clr_mdc_image_sm h5clear_no_mdc_image 0 "-s" "-m" mod_h5clear_mdc_image2.h5)
#
#
#
@@ -404,7 +475,7 @@ endif()
# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0)
# (no output, check exit code)
# "h5clear --filesize h5clear_status_noclose.h5" (print EOA/EOF after the last action)
- ADD_H5_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize")
+ ADD_H5_ERR_CMP_WITH_COPY (h5clr_open_fail_nc_s 1 h5clear_open_fail h5clear_status_noclose.h5 "--filesize")
ADD_H5_RETTEST (h5clr_mdc_image_nc "false" "-s" "--increment=0" h5clear_status_noclose.h5)
ADD_H5_CMP (h5clr_no_mdc_image_nc_m h5clear_status_noclose_after_size 0 "--filesize" h5clear_status_noclose.h5)
#
diff --git a/tools/test/misc/CMakeTestsRepart.cmake b/tools/test/misc/CMakeTestsRepart.cmake
index 37da903..8edd243 100644
--- a/tools/test/misc/CMakeTestsRepart.cmake
+++ b/tools/test/misc/CMakeTestsRepart.cmake
@@ -68,28 +68,40 @@
scd_family00001.h5
scd_family00002.h5
scd_family00003.h5
+ family_to_single.h5
family_to_sec2.h5
)
- if (NOT "${last_test}" STREQUAL "")
- set_tests_properties (H5REPART-clearall-objects PROPERTIES DEPENDS ${last_test})
- endif ()
- set (last_test "H5REPART-clearall-objects")
+ set_tests_properties (H5REPART-clearall-objects PROPERTIES FIXTURES_SETUP clear_testrepart)
# repartition family member size to 20,000 bytes.
add_test (NAME H5REPART-h5repart_20K COMMAND $<TARGET_FILE:h5repart> -m 20000 family_file%05d.h5 fst_family%05d.h5)
- set_tests_properties (H5REPART-h5repart_20K PROPERTIES DEPENDS H5REPART-clearall-objects)
+ set_tests_properties (H5REPART-h5repart_20K PROPERTIES
+ FIXTURES_REQUIRED clear_testrepart
+ )
# repartition family member size to 5 KB.
add_test (NAME H5REPART-h5repart_5K COMMAND $<TARGET_FILE:h5repart> -m 5k family_file%05d.h5 scd_family%05d.h5)
- set_tests_properties (H5REPART-h5repart_5K PROPERTIES DEPENDS H5REPART-clearall-objects)
+ set_tests_properties (H5REPART-h5repart_5K PROPERTIES
+ FIXTURES_REQUIRED clear_testrepart
+ )
# convert family file to sec2 file of 20,000 bytes
+ add_test (NAME H5REPART-h5repart_single COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5)
+ set_tests_properties (H5REPART-h5repart_single PROPERTIES
+ FIXTURES_REQUIRED clear_testrepart
+ )
+
+ # convert family file to sec2 file of 20,000 bytes (old argument)
add_test (NAME H5REPART-h5repart_sec2 COMMAND $<TARGET_FILE:h5repart> -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5)
- set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES DEPENDS H5REPART-clearall-objects)
+ set_tests_properties (H5REPART-h5repart_sec2 PROPERTIES
+ FIXTURES_REQUIRED clear_testrepart
+ )
# test the output files repartitioned above.
add_test (NAME H5REPART-h5repart_test COMMAND $<TARGET_FILE:h5repart_test>)
- set_tests_properties (H5REPART-h5repart_test PROPERTIES DEPENDS "H5REPART-clearall-objects;H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_sec2")
+ set_tests_properties (H5REPART-h5repart_test PROPERTIES
+ DEPENDS "H5REPART-h5repart_20K;H5REPART-h5repart_5K;H5REPART-h5repart_single;H5REPART-h5repart_sec2"
+ )
set (H5_DEP_EXECUTABLES ${H5_DEP_EXECUTABLES}
h5repart_test
diff --git a/tools/test/misc/Makefile.in b/tools/test/misc/Makefile.in
index c5dbe09..c0f403c 100644
--- a/tools/test/misc/Makefile.in
+++ b/tools/test/misc/Makefile.in
@@ -613,7 +613,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -647,6 +646,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1602,7 +1602,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/misc/repart_test.c b/tools/test/misc/repart_test.c
index 4016ee8..b8e0292 100644
--- a/tools/test/misc/repart_test.c
+++ b/tools/test/misc/repart_test.c
@@ -26,12 +26,13 @@
const char *FILENAME[] = {
"fst_family%05d.h5",
"scd_family%05d.h5",
+ "family_to_single.h5",
"family_to_sec2.h5",
NULL
};
herr_t test_family_h5repart_opens(void);
-herr_t test_sec2_h5repart_opens(void);
+herr_t test_single_h5repart_opens(void);
/*-------------------------------------------------------------------------
@@ -90,23 +91,28 @@ error:
/*-------------------------------------------------------------------------
- * Function: test_sec2_h5repart_opens
+ * Function: test_single_h5repart_opens
*
- * Purpose: Tries to reopen a sec2 file.
+ * Purpose: Tries to reopen a single file.
*
* Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
herr_t
-test_sec2_h5repart_opens(void)
+test_single_h5repart_opens(void)
{
hid_t fid = -1;
- /* open the sec2 file */
+ /* open the single file */
if ((fid = H5Fopen(FILENAME[2], H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
goto error;
+ if (H5Fclose(fid) < 0)
+ goto error;
+ /* open the single file (created using the old argument) */
+ if ((fid = H5Fopen(FILENAME[3], H5F_ACC_RDWR, H5P_DEFAULT)) < 0)
+ goto error;
if (H5Fclose(fid) < 0)
goto error;
@@ -119,7 +125,7 @@ error:
return FAIL;
-} /* end test_sec2_h5repart_opens() */
+} /* end test_single_h5repart_opens() */
/*-------------------------------------------------------------------------
@@ -137,7 +143,7 @@ main(void)
int nerrors = 0;
nerrors += test_family_h5repart_opens() < 0 ? 1 : 0;
- nerrors += test_sec2_h5repart_opens() < 0 ? 1 : 0;
+ nerrors += test_single_h5repart_opens() < 0 ? 1 : 0;
if (nerrors)
goto error;
@@ -150,3 +156,4 @@ error:
nerrors, 1 == nerrors ? "" : "S");
HDexit(EXIT_FAILURE);
} /* end main() */
+
diff --git a/tools/test/misc/testfiles/h5clear_missing_file.ddl b/tools/test/misc/testfiles/h5clear_missing_file.ddl
index 13eb2c9..32dd549 100644
--- a/tools/test/misc/testfiles/h5clear_missing_file.ddl
+++ b/tools/test/misc/testfiles/h5clear_missing_file.ddl
@@ -20,4 +20,3 @@ h5clear --increment file_name
h5clear --increment=512 file_name
Set the EOA to the maximum of (EOA, EOF) + 512 for the file <file_name>.
-h5clear error: missing file name
diff --git a/tools/test/misc/testfiles/h5clear_missing_file.err b/tools/test/misc/testfiles/h5clear_missing_file.err
new file mode 100644
index 0000000..ea21b76
--- /dev/null
+++ b/tools/test/misc/testfiles/h5clear_missing_file.err
@@ -0,0 +1 @@
+h5clear error: missing file name
diff --git a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl b/tools/test/misc/testfiles/h5clear_no_mdc_image.err
index f5acd71..f5acd71 100644
--- a/tools/test/misc/testfiles/h5clear_no_mdc_image.ddl
+++ b/tools/test/misc/testfiles/h5clear_no_mdc_image.err
diff --git a/tools/test/misc/testfiles/h5clear_open_fail.ddl b/tools/test/misc/testfiles/h5clear_open_fail.err
index 895ecd4..895ecd4 100644
--- a/tools/test/misc/testfiles/h5clear_open_fail.ddl
+++ b/tools/test/misc/testfiles/h5clear_open_fail.err
diff --git a/tools/test/misc/testh5clear.sh.in b/tools/test/misc/testh5clear.sh.in
index 11c2ff9..3f2b32f 100644
--- a/tools/test/misc/testh5clear.sh.in
+++ b/tools/test/misc/testh5clear.sh.in
@@ -62,10 +62,10 @@ test -d $TESTDIR || mkdir -p $TESTDIR
# copy test files and expected output files from source dirs to test dir
#
COPY_TESTFILES="
+$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.err
+$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.err
$SRC_H5CLEAR_TESTFILES/h5clear_usage.ddl
-$SRC_H5CLEAR_TESTFILES/h5clear_open_fail.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_missing_file.ddl
-$SRC_H5CLEAR_TESTFILES/h5clear_no_mdc_image.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_status_noclose_after_size.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_noclose_before_size.ddl
$SRC_H5CLEAR_TESTFILES/h5clear_noclose_after_size.ddl
@@ -179,8 +179,9 @@ TOOLTEST_OUT() {
expected=$5
# Prepare expected and actual output
expect="$TESTDIR/$expected"
+ expect_err="$TESTDIR/`basename $expected .ddl`.err"
actual="$TESTDIR/`basename $expected .ddl`.out"
- actual_err="$TESTDIR/`basename $expected .ddl`.err"
+ actual_err="$TESTDIR/`basename $expected .ddl`.out.err"
actual_sav=${actual}-sav
actual_err_sav=${actual_err}-sav
@@ -192,7 +193,6 @@ TOOLTEST_OUT() {
) >$actual 2>$actual_err
cp $actual $actual_sav
cp $actual_err $actual_err_sav
- cat $actual_err >> $actual
# Compare output
COMPARE_OUT $expect $actual
@@ -202,6 +202,38 @@ TOOLTEST_OUT() {
$RM $actual $actual_err $actual_sav $actual_err_sav
fi
}
+# same as TOOLTEST_OUT just compare stderr
+TOOLTEST_ERR() {
+ fname=$1
+ option1=$2
+ option2=$3
+ option3=$4
+ expected=$5
+ # Prepare expected and actual output
+ expect_err="$TESTDIR/$expected"
+ expect="$TESTDIR/`basename $expected .err`.ddl"
+ actual="$TESTDIR/`basename $expected .err`.out"
+ actual_err="$TESTDIR/`basename $expected .err`.out.err"
+ actual_sav=${actual}-sav
+ actual_err_sav=${actual_err}-sav
+
+ # Run test.
+ TESTING $H5CLEAR $option1 $option2 $option3 $option4 $fname
+ (
+ cd $TESTDIR
+ $RUNSERIAL $H5CLEAR_BIN $option1 $option2 $option3 $option4 $fname
+ ) >$actual 2>$actual_err
+ cp $actual $actual_sav
+ cp $actual_err $actual_err_sav
+
+ # Compare output
+ COMPARE_OUT $expect_err $actual_err
+
+ # Clean up output file
+ if test -z "$HDF5_NOCLEANUP"; then
+ $RM $actual $actual_err $actual_sav $actual_err_sav
+ fi
+}
# $1 is the filename to open
# $2 is the expected return from the open/check program
@@ -274,11 +306,11 @@ TOOLTEST_OUT "" "" "" "" h5clear_usage.ddl
TOOLTEST_OUT junk.h5 "" "" "" h5clear_usage.ddl
TOOLTEST_OUT orig_h5clear_sec2_v3.h5 "" "" "" h5clear_usage.ddl
TOOLTEST_OUT "" -m "" "" h5clear_missing_file.ddl
-TOOLTEST_OUT junk.h5 -s "" "" h5clear_open_fail.ddl
+TOOLTEST_ERR junk.h5 -s "" "" h5clear_open_fail.err
TOOLTEST_OUT "" -m -s "" h5clear_missing_file.ddl
-TOOLTEST_OUT junk.h5 -m -s "" h5clear_open_fail.ddl
-TOOLTEST_OUT orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.ddl
-TOOLTEST_OUT orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.ddl
+TOOLTEST_ERR junk.h5 -m -s "" h5clear_open_fail.err
+TOOLTEST_ERR orig_h5clear_sec2_v2.h5 -m "" "" h5clear_no_mdc_image.err
+TOOLTEST_ERR orig_h5clear_sec2_v0.h5 -s -m "" h5clear_no_mdc_image.err
#
#
# The following are tests to verify the expected exit code from h5clear:
@@ -308,8 +340,8 @@ TOOLTEST h5clear_sec2_v0.h5 -l -m $FAIL
#
#
# h5clear_mdc_image.h5 already has cache image removed earlier, verify the expected warning from h5clear:
-TOOLTEST_OUT mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.ddl
-TOOLTEST_OUT mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.ddl
+TOOLTEST_ERR mod_h5clear_mdc_image.h5 -m "" "" h5clear_no_mdc_image.err
+TOOLTEST_ERR mod_h5clear_mdc_image.h5 -s -m "" h5clear_no_mdc_image.err
#
#
#
@@ -342,16 +374,16 @@ OPEN_CHK h5clear_sec2_v2.h5 $SUCCEED
#
#
#
-# (1) h5clear_status_noclose.h5
+# (1) h5clear_status_noclose.h5
# "h5clear --filesize h5clear_status_noclose.h5" (unable to open the file because status_flag is on)
-# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0)
+# "h5clear -s --increment=0 h5clear_status_noclose.h5" (clear status_flag, EOA = MAX(EOA, EOF) + 0)
# (no output, check exit code)
# "h5clear --filesize h5clear_status_noclose_user.h5" (print EOA/EOF after the last action)
-TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.ddl
+TOOLTEST_ERR h5clear_status_noclose.h5 --filesize "" "" h5clear_open_fail.err
TOOLTEST h5clear_status_noclose.h5 -s --increment=0 $SUCCEED
TOOLTEST_OUT h5clear_status_noclose.h5 --filesize "" "" h5clear_status_noclose_after_size.ddl
#
-# (2) h5clear_fsm_persist_noclose.h5
+# (2) h5clear_fsm_persist_noclose.h5
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF before the next action)
# "h5clear --increment=0 h5clear_fsm_persist_noclose.h5" (EOA = MAX(EOA, EOF)) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_noclose.h5" (print EOA/EOF after the last action)
@@ -364,7 +396,7 @@ TOOLTEST_OUT h5clear_fsm_persist_noclose.h5 --filesize "" "" h5clear_noclose_aft
# "h5clear --increment h5clear_fsm_persist_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_equal.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_before_size.ddl
-TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_equal.h5 --increment "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_size.ddl
#
# (4) h5clear_fsm_persist_greater.h5
@@ -372,7 +404,7 @@ TOOLTEST_OUT h5clear_fsm_persist_equal.h5 --filesize "" "" h5clear_equal_after_s
# "h5clear --increment=0 h5clear_fsm_persist_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_greater.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_before_size.ddl
-TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_greater.h5 --increment=0 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_after_size.ddl
#
# (5) h5clear_fsm_persist_less.h5
@@ -380,7 +412,7 @@ TOOLTEST_OUT h5clear_fsm_persist_greater.h5 --filesize "" "" h5clear_greater_aft
# "h5clear --increment=200 h5clear_fsm_persist_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_less.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_before_size.ddl
-TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_less.h5 --increment=200 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_size.ddl
#
# (6) h5clear_fsm_persist_user_equal.h5
@@ -388,7 +420,7 @@ TOOLTEST_OUT h5clear_fsm_persist_less.h5 --filesize "" "" h5clear_less_after_siz
# "h5clear --increment h5clear_fsm_persist_user_equal.h5" (EOA = MAX(EOA, EOF) + 1M) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_equal.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_before_size.ddl
-TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_user_equal.h5 --increment "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equal_after_size.ddl
#
# (7) h5clear_fsm_persist_user_greater.h5
@@ -396,7 +428,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_equal.h5 --filesize "" "" h5clear_user_equ
# "h5clear --increment=0 h5clear_fsm_persist_user_greater.h5" (EOA = MAX(EOA, EOF) + 0) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_greater.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_before_size.ddl
-TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_user_greater.h5 --increment=0 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_greater_after_size.ddl
#
# (8) h5clear_fsm_persist_user_less.h5
@@ -404,7 +436,7 @@ TOOLTEST_OUT h5clear_fsm_persist_user_greater.h5 --filesize "" "" h5clear_user_g
# "h5clear --increment=200 h5clear_fsm_persist_user_less.h5" (EOA = MAX(EOA, EOF) + 200) (no output, check exit code)
# "h5clear --filesize h5clear_fsm_persist_user_less.h5" (print EOA/EOF after the last action)
TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_before_size.ddl
-TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED
+TOOLTEST h5clear_fsm_persist_user_less.h5 --increment=200 "" $SUCCEED
TOOLTEST_OUT h5clear_fsm_persist_user_less.h5 --filesize "" "" h5clear_user_less_after_size.ddl
#
#
diff --git a/tools/test/misc/testh5repart.sh.in b/tools/test/misc/testh5repart.sh.in
index 594d37e..143f607 100644
--- a/tools/test/misc/testh5repart.sh.in
+++ b/tools/test/misc/testh5repart.sh.in
@@ -171,7 +171,9 @@ COPY_TESTFILES_TO_TESTDIR
TOOLTEST -m 20000 family_file%05d.h5 fst_family%05d.h5
# repartition family member size to 5 KB.
TOOLTEST -m 5k family_file%05d.h5 scd_family%05d.h5
-# convert family file to sec2 file of 20,000 bytes
+# convert family file to single file of 20,000 bytes
+TOOLTEST -m 20000 -family_to_single family_file%05d.h5 family_to_single.h5
+# convert family file to single file of 20,000 bytes (old argument)
TOOLTEST -m 20000 -family_to_sec2 family_file%05d.h5 family_to_sec2.h5
# test the output files repartitioned above.
@@ -183,7 +185,7 @@ CLEAN_TESTFILES_AND_TESTDIR
if test -z "$HDF5_NOCLEANUP"; then
cd $actual_dir
- rm -f fst_family*.h5 scd_family*.h5 family_to_sec2.h5
+ rm -f fst_family*.h5 scd_family*.h5 family_to_single.h5 family_to_sec2.h5
fi
if test $nerrors -eq 0 ; then
diff --git a/tools/test/misc/vds/Makefile.in b/tools/test/misc/vds/Makefile.in
index 56333bc..90970d8 100644
--- a/tools/test/misc/vds/Makefile.in
+++ b/tools/test/misc/vds/Makefile.in
@@ -570,7 +570,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -604,6 +603,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1483,7 +1483,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
diff --git a/tools/test/perform/CMakeTests.cmake b/tools/test/perform/CMakeTests.cmake
index 450667a..36172d1 100644
--- a/tools/test/perform/CMakeTests.cmake
+++ b/tools/test/perform/CMakeTests.cmake
@@ -66,7 +66,7 @@ else ()
-P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake"
)
endif ()
-set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT 1800)
+set_tests_properties (PERFORM_h5perf_serial PROPERTIES TIMEOUT ${CTEST_VERY_LONG_TIMEOUT})
set_tests_properties (PERFORM_h5perf_serial PROPERTIES DEPENDS "PERFORM_h5perform-clearall-objects")
if (HDF5_BUILD_PERFORM_STANDALONE)
@@ -170,9 +170,9 @@ endif ()
set_tests_properties (PERFORM_zip_perf PROPERTIES DEPENDS "PERFORM_zip_perf_help;PERFORM_h5perform-clearall-objects")
if (H5_HAVE_PARALLEL)
- add_test (NAME PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS})
+ add_test (NAME MPI_TEST_PERFORM_h5perf COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf> ${MPIEXEC_POSTFLAGS})
if (HDF5_BUILD_PERFORM_STANDALONE)
- add_test (NAME PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS})
+ add_test (NAME MPI_TEST_PERFORM_h5perf_alone COMMAND ${MPIEXEC_EXECUTABLE} ${MPIEXEC_NUMPROC_FLAG} ${MPIEXEC_MAX_NUMPROCS} ${MPIEXEC_PREFLAGS} $<TARGET_FILE:h5perf_alone> ${MPIEXEC_POSTFLAGS})
endif ()
endif ()
diff --git a/tools/test/perform/Makefile.in b/tools/test/perform/Makefile.in
index fa50dc6..b94f309 100644
--- a/tools/test/perform/Makefile.in
+++ b/tools/test/perform/Makefile.in
@@ -592,7 +592,6 @@ MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MEMORYALLOCSANITYCHECK = @MEMORYALLOCSANITYCHECK@
-METADATATRACEFILE = @METADATATRACEFILE@
MKDIR_P = @MKDIR_P@
MPE = @MPE@
NM = @NM@
@@ -626,6 +625,7 @@ PAC_FORTRAN_NUM_INTEGER_KINDS = @PAC_FORTRAN_NUM_INTEGER_KINDS@
PARALLEL = @PARALLEL@
PARALLEL_FILTERED_WRITES = @PARALLEL_FILTERED_WRITES@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PREADWRITE = @PREADWRITE@
PROFILING = @PROFILING@
RANLIB = @RANLIB@
ROOT = @ROOT@
@@ -1608,7 +1608,7 @@ build-check-p: $(LIB) $(PROGS) $(chk_TESTS)
echo "**** Hint ****"; \
echo "Parallel test files reside in the current directory" \
"by default."; \
- echo "Set HDF5_PARAPREFIX to use another directory. E.g.,"; \
+ echo "Set HDF5_PARAPREFIX to use another directory. e.g.,"; \
echo " HDF5_PARAPREFIX=/PFS/user/me"; \
echo " export HDF5_PARAPREFIX"; \
echo " make check"; \
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();
diff --git a/tools/testfiles/non_existing.ddl b/tools/testfiles/non_existing.ddl
index 4377f8d..4407eae 100644
--- a/tools/testfiles/non_existing.ddl
+++ b/tools/testfiles/non_existing.ddl
@@ -28,4 +28,3 @@ GROUP "/" {
}
}
}
-h5dump error: unable to open file "non_existing.h5"
diff --git a/tools/testfiles/nosuchfile.ls b/tools/testfiles/nosuchfile.ls
index 8c4ee42..e69de29 100644
--- a/tools/testfiles/nosuchfile.ls
+++ b/tools/testfiles/nosuchfile.ls
@@ -1 +0,0 @@
-nosuchfile.h5: unable to open file
diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
index 0a3beb0..19de76f 100644
--- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
+++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: missing file name
diff --git a/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl
index b0683a7..b281827 100644
--- a/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsCharLengthExceeded.ddl
@@ -15,4 +15,3 @@ DATASET "/DS08BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(9) too large. Max is 8
diff --git a/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl
index 530fa05..ee56a5c 100644
--- a/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsCharOffsetExceeded.ddl
@@ -15,4 +15,3 @@ DATASET "/DS08BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(9) too large. Max is 8
diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl
index b353065..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsIncomplete.ddl
+++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Bad mask list(0,2,2,1,0,2,2,)
diff --git a/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl
index 1c919cd..1cba6d5 100644
--- a/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsIntLengthExceeded.ddl
@@ -15,4 +15,3 @@ DATASET "/DS16BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(17) too large. Max is 16
diff --git a/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl
index f3b2a8c..330d61f 100644
--- a/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsIntOffsetExceeded.ddl
@@ -15,4 +15,3 @@ DATASET "/DS16BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(17) too large. Max is 16
diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
index ffe0da9..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Packed Bit offset+length value(65) too large. Max is 64
diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
index 4502143..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl
+++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Packed Bit length value(0) must be positive.
diff --git a/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl
index 812c300..44ec077 100644
--- a/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsLongLengthExceeded.ddl
@@ -23,4 +23,3 @@ DATASET "/DS32BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(33) too large. Max is 32
diff --git a/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl
index cbea722..c775557 100644
--- a/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsLongOffsetExceeded.ddl
@@ -23,4 +23,3 @@ DATASET "/DS32BITS" {
}
}
}
-h5dump error: Packed Bit offset+length value(33) too large. Max is 32
diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
index 011f6c9..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Too many masks requested (max. 8). Mask list(0,1,0,1,1,1,2,1,3,1,4,1,5,1,6,1,7,1)
diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
index 857fe62..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Packed Bit offset value(64) must be between 0 and 63
diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
index 9ac1160..19de76f 100644
--- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
+++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl
@@ -135,4 +135,3 @@ usage: h5dump [OPTIONS] files
h5dump -d /foo -f family fam%05d.h5
-h5dump error: Bad mask list(-1,1)
diff --git a/tools/testfiles/texceedsubblock.ddl b/tools/testfiles/texceedsubblock.ddl
index 499e0d2..69ec706 100644
--- a/tools/testfiles/texceedsubblock.ddl
+++ b/tools/testfiles/texceedsubblock.ddl
@@ -1,3 +1,2 @@
HDF5 "taindices.h5" {
}
-h5dump error: number of block dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubcount.ddl b/tools/testfiles/texceedsubcount.ddl
index 81e8c4a..69ec706 100644
--- a/tools/testfiles/texceedsubcount.ddl
+++ b/tools/testfiles/texceedsubcount.ddl
@@ -1,3 +1,2 @@
HDF5 "taindices.h5" {
}
-h5dump error: number of count dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstart.ddl b/tools/testfiles/texceedsubstart.ddl
index cb535a0..69ec706 100644
--- a/tools/testfiles/texceedsubstart.ddl
+++ b/tools/testfiles/texceedsubstart.ddl
@@ -1,3 +1,2 @@
HDF5 "taindices.h5" {
}
-h5dump error: number of start dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/texceedsubstride.ddl b/tools/testfiles/texceedsubstride.ddl
index bf85997..69ec706 100644
--- a/tools/testfiles/texceedsubstride.ddl
+++ b/tools/testfiles/texceedsubstride.ddl
@@ -1,3 +1,2 @@
HDF5 "taindices.h5" {
}
-h5dump error: number of stride dims (2) exceed dataset dims (1)
diff --git a/tools/testfiles/textlinksrc-nodangle-1.ls b/tools/testfiles/textlinksrc-nodangle-1.ls
index 6d1da9e..491f696 100644
--- a/tools/testfiles/textlinksrc-nodangle-1.ls
+++ b/tools/testfiles/textlinksrc-nodangle-1.ls
@@ -56,5 +56,3 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
Replaced by --follow-symlinks.
-e, --errors Show all HDF5 error reporting
Replaced by --enable-error-stack.
-Error: --no-dangling-links must be used along with --follow-symlinks option!
-
diff --git a/tools/testfiles/tgroup-1.ls b/tools/testfiles/tgroup-1.ls
index 069d43e..491f696 100644
--- a/tools/testfiles/tgroup-1.ls
+++ b/tools/testfiles/tgroup-1.ls
@@ -56,5 +56,3 @@ usage: h5ls [OPTIONS] file[/OBJECT] [file[/[OBJECT]...]
Replaced by --follow-symlinks.
-e, --errors Show all HDF5 error reporting
Replaced by --enable-error-stack.
-Error: 'recursive' option not compatible with 'group info' option!
-